blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
357
content_id
stringlengths
40
40
detected_licenses
listlengths
0
58
license_type
stringclasses
2 values
repo_name
stringlengths
4
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-14 21:31:45
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-01 00:00:00
2023-09-05 23:26:37
committer_date
timestamp[ns]date
1970-01-01 00:00:00
2023-09-05 23:26:37
github_id
int64
966
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
24 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-02-03 21:17:16
2023-08-24 19:49:39
gha_language
stringclasses
180 values
src_encoding
stringclasses
35 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
6
10.4M
extension
stringclasses
121 values
filename
stringlengths
1
148
content
stringlengths
6
10.4M
d4227124aa6109e8277c1453a7634b9479f35b18
27e3576a96a272ad323211ef2e7052eb61f8f7e3
/snippets/storeInput.c
adad3d58d0ded856040e79f06fcd72fc06cf26cf
[]
no_license
The-Cooper-Union-CS102/Lesson-5-Structures
bc65b4c6f8499a4283d3d6cdd75eefbf702fb345
4bb537b8de6dd58c3f84c1f2e92dc8a09d5e9fa6
refs/heads/master
2023-01-02T05:58:46.335829
2020-10-29T21:58:38
2020-10-29T21:58:38
291,831,435
0
0
null
null
null
null
UTF-8
C
false
false
726
c
storeInput.c
#include <stdio.h> #include <stdlib.h> struct Node { struct Node *next; char *str; }; int main(int argc, char *argv[]) { struct Node n = {NULL, ""}; struct Node *sp = &n; // Starting pointer struct Node *cp = &n; // Current pointer int i; for (i = 1; i < argc; i++) { // Initialize new Node struct Node *new = (struct Node *) malloc(sizeof(struct Node)); new->str = argv[i]; new->next = NULL; // Set current pointer to next node cp->next = new; cp = cp->next; } // Print Nodes in order cp = sp; while (cp->next) { printf("(%p, %s)->", cp->next->next, cp->next->str); cp = cp->next; } printf("\n"); }
a3aa4414c862852886992fc61fa5feebcff9db5d
ab534d6f4089fcfa65bd1f317ef83d395d91a16a
/code/2.4rf_code/Source/main.c
eb988ca9e089cd1c4f1b1ee2b680ff6bdba326a2
[]
no_license
1037261092/self_balancing_car
c2eadd120a565560bba25ea28b99581b0b065a4a
e2791a4f52b7d611e2858230cee5d544e810aa95
refs/heads/master
2022-12-07T20:35:18.442830
2020-08-23T10:50:24
2020-08-23T10:50:24
null
0
0
null
null
null
null
UTF-8
C
false
false
4,476
c
main.c
/** ****************************************************************************** * @file main.c * @author Simon Lu * @version V1.0 * @date 01-December-2013 * @brief Default main function. ****************************************************************************** */ #include "hardware.h" #define RF_SLEEP_TIME 4 //x50ms,if joystick don't move over this time, rf chip will stop tx. #define RX_TIME 20 //x50ms, send get volt and temp request to car then transfer to rx mode immediately; void getJoyStickData(void); void sendData2Car(void); void getCarTempVolt(void); void displayGUI(void); uint16_t tx_data[3]={2040,2040,0}; //joystick y,x,request flag. float rx_data[2]={0,0}; //mpu temp and battery voltage. uint8_t time2sleep=0; uint8_t time2rx=21; const unsigned char logo [] = { 0x00, 0x00, 0xE0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0x7E, 0x7E, 0x7E, 0x7E, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0x7E, 0x7E, 0x7E, 0xFC, 0xFC, 0xFC, 0xF8, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0x7E, 0x7E, 0x7E, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0x7E, 0x7E, 0x7E, 0x7E, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFC, 0xE0, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0x7E, 0x7E, 0xFE, 0xFC, 0xFC, 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1F, 0x3F, 0x3F, 0x7F, 0x78, 0x70, 0x70, 0x70, 0x10, 0x00, 0x00, 0x0F, 0x3F, 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x3F, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x73, 0x73, 0x73, 0x3F, 0x3F, 0x1D, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1F, 0x3F, 0x3F, 0x7F, 0x78, 0x70, 0x70, 0x70, 0x10, 0x00, 0x60, 0x7E, 0x7F, 0x3F, 0x31, 0x33, 0x3F, 0x7F, 0x7F, 0x7F, 0x7E, 0x60, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x1C, 0x3C, 0x7F, 0xFF, 0xFF, 0x73, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; /********************************Main******************************************/ int main(void) { Hardware_Init(); Play_Beep(); SI24R1_TxMode(); Delay_ms(1); while(1) { getJoyStickData(); sendData2Car(); getCarTempVolt(); displayGUI(); Delay_ms(50); } } /*******************************Get Joystick Data******************************/ void getJoyStickData(void) { tx_data[0]=Get_JoystickY(); tx_data[1]=Get_JoystickX(); } /*******************************Send Joystick Data*****************************/ void sendData2Car(void) { if((tx_data[0]<2060&&tx_data[0]>2020)&&(tx_data[1]<2060&&tx_data[1]>2020)) { time2sleep++; } else{ time2sleep=0; } if(time2sleep>=RF_SLEEP_TIME) { time2sleep--; } else { SI24R1_TxPacket((uint8_t *)tx_data); } } /*********************Get Car's MPU6050 Temp & Battery Voltage*****************/ void getCarTempVolt(void) { if(time2rx>=RX_TIME) { time2rx=0; tx_data[2]=1; if(SI24R1_TxPacket((uint8_t *)tx_data)==TX_OK) { SI24R1_RxMode(); Delay_ms(1); for(int i=0;i<10;i++) { if(!SI24R1_RxPacket((uint8_t *)rx_data)) { break; } Delay_ms(1); } SI24R1_TxMode(); } tx_data[2]=0; } else { time2rx++; } } /********************************Display Main GUI******************************/ void displayGUI(void) { OLED_ClearDisplay(); //Remote Part SetCursor(3,4); OLED_PrintChar("REMOTE"); OLED_DrawFastVLine(43,0,16,1); SetCursor(50,0); OLED_PrintChar("VOLT: "); OLED_PrintFloat(rx_data[1]); OLED_PrintChar("V"); SetCursor(50,8); OLED_PrintChar("TEMP: "); OLED_PrintFloat(rx_data[0]); OLED_PrintChar("'C"); OLED_DrawFastHLine(0,16,128,1); //Rolling Part OLED_DrawBitmap(19,25,logo,111,17,1); FillRect2(0,41,128,7,0); //Self SetCursor(8,55); OLED_PrintChar("SELF"); OLED_DrawFastVLine(43,48,16,1); SetCursor(50,51); OLED_PrintChar("VOLT: "); OLED_PrintFloat(Get_BattVolt()); OLED_PrintChar("V"); SetCursor(50,59); if(GPIO_ReadInputDataBit(CHARGE_DETECT_PORT,CHARGE_DETECT_PIN)==Bit_RESET) { OLED_PrintChar("CHARGING..."); } else { OLED_PrintChar("NOT CHARGING"); } OLED_DrawFastHLine(0,48,128,1); OLED_Refresh_Gram(); }
259ecb616c6fd4e2a83c02a8523ab4bb74d0ff6f
620360060216bed807427c3b288de9a17c462191
/farm/export.h
57f86ce6256f8412163516d623ebac2a9fd5c4f2
[]
no_license
chengstone/nds
b21920d22d314dfa3ccc9966d532420afc270fa9
31428e4df40516c80c5d5312d491da0d0291387d
refs/heads/master
2020-04-07T11:15:56.343726
2015-04-16T06:36:30
2015-04-16T06:36:30
null
0
0
null
null
null
null
GB18030
C
false
false
161
h
export.h
#include <stdio.h> #include "../common.h" //文本区间链表 typedef struct txtExtent { struct txtExtent * next; ULONG start, end; int iWidth; } txtExt;
e62d648df5e4d6cb339f322a9a7594ee30fdced1
3b0c57090fc56dbe775a91cb5c4b6650b82d6a96
/grid.h
f64f7d47a397582bfcd7c45bc49c4156d4a15ea9
[]
no_license
Stix31/ProjetHex
e0a105779c22ee29f31dd06b0fdfd04baa4bc8ea
29c14239f780611985e150711f3d3adf3e0ce488
refs/heads/master
2021-01-10T14:09:00.122256
2016-05-10T12:25:58
2016-05-10T12:25:58
54,426,695
3
0
null
2016-04-29T13:36:55
2016-03-21T22:14:07
C
UTF-8
C
false
false
605
h
grid.h
#ifndef GRID_H #define GRID_H #define GRID_SIZE 11 #include <SDL/SDL.h> typedef struct{ int cell[GRID_SIZE][GRID_SIZE]; SDL_Surface* b; SDL_Surface* bh; SDL_Surface* h; SDL_Rect posH; }Grid; typedef struct{ int x[61]; int y[61]; int content; }CellBlock; SDL_Rect gridCursorPosition(); int inGrid(); int emptyCell(Grid g, SDL_Rect p); void initGrid(Grid *g); void addToGrid(Grid *g, SDL_Rect p); int blockContainsX(CellBlock cb, int y); int blockContainsY(CellBlock cb, int y); int blockContains(CellBlock cb, int x, int y); void addToBlock(Grid g, CellBlock *cb, int x, int y); #endif
f7541c852d2dc94080b05af3800c8198c3a42bda
f36c4f44f0e9c4d35ae3b4183f00c653bacb63e7
/src/dialog_box/display_dialog_box.c
132dd89f571ce6d402ec0b4b00955be714608919
[]
no_license
lucasGras/libgraph
341e453e82db92d9271b0b78f175e2c20e828b1d
71e7410b704a4b04834be0c77b709c71e1aeca62
refs/heads/master
2020-03-15T06:05:09.088361
2018-05-07T18:21:37
2018-05-07T18:21:37
131,419,483
1
0
null
null
null
null
UTF-8
C
false
false
397
c
display_dialog_box.c
/* ** EPITECH PROJECT, 2018 ** db ** File description: ** display */ #include "lib_graph.h" void display_dialog_box(dialog_box_t *item, sfRenderWindow *window) { if (!item || !window || item->displayed == sfFalse) return; sfRenderWindow_drawSprite(window, item->box_sprt, NULL); sfRenderWindow_drawText(window, item->dynamic_text, NULL); display_button(&item->skip_button, window); }
ecb6e63651c642fe405cf9ce98a05b21b1515966
f6828d0da41d7d48e82853ce6f10e60f9e65fc62
/include/lab1.h
02fb08d59e632ec1a791ce0f86d62d4d6e700228
[]
no_license
josem93/embedded_control_systems
d0cdacb10c1007a8323f1ee659d64f14d671d7da
65b3c110975884c4b033c57aa5bbcc453e8d939d
refs/heads/master
2020-05-29T18:06:20.112977
2019-05-30T11:11:26
2019-05-30T11:11:26
189,296,074
0
0
null
null
null
null
UTF-8
C
false
false
458
h
lab1.h
typedef union { /* Pad Configuration Registers */ volatile unsigned short REG; struct { volatile unsigned short :3; volatile unsigned short PA:3; volatile unsigned short OBE:1; volatile unsigned short IBE:1; volatile unsigned short DSC:2; volatile unsigned short ODE:1; volatile unsigned short HYS:1; volatile unsigned short SRC:2; volatile unsigned short WPE:1; volatile unsigned short WPS:1; } FIELDS3; } SIU_PCR;
de80cf07e82c3801fd0985004028153a143e0a5f
f7d21283b6cdd6df96e724c2e43b1f57831cef83
/sorted-variants/EIFGENs/sorted-variants/W_code/C3/ty1035d.c
cc8d23879f56ef1cc03a15d59f2ab0505ffbe5ad
[]
no_license
kishanpatel98/Eiffel-Labs
c9088d5969d69943447903ef9bd16c40852bc444
f6c5807f4e55f05be704520150fab2418d43f9f9
refs/heads/master
2020-09-10T04:05:32.948313
2019-11-14T08:03:58
2019-11-14T08:03:58
221,642,534
2
1
null
null
null
null
UTF-8
C
false
false
5,484
c
ty1035d.c
/* * Class TYPE [UTIL [COMPARABLE]] */ #include "eif_macros.h" #ifdef __cplusplus extern "C" { #endif static const EIF_TYPE_INDEX egt_0_1035 [] = {0xFF01,232,0xFFFF}; static const EIF_TYPE_INDEX egt_1_1035 [] = {0xFF01,245,1034,1032,107,0xFFFF}; static const EIF_TYPE_INDEX egt_2_1035 [] = {0xFF01,1034,1032,107,0xFFFF}; static const EIF_TYPE_INDEX egt_3_1035 [] = {0,0xFFFF}; static const EIF_TYPE_INDEX egt_4_1035 [] = {0,0xFFFF}; static const EIF_TYPE_INDEX egt_5_1035 [] = {0xFF01,1034,1032,107,0xFFFF}; static const EIF_TYPE_INDEX egt_6_1035 [] = {0xFF01,1034,1032,107,0xFFFF}; static const EIF_TYPE_INDEX egt_7_1035 [] = {0,0xFFFF}; static const EIF_TYPE_INDEX egt_8_1035 [] = {0xFF01,16,0xFFFF}; static const EIF_TYPE_INDEX egt_9_1035 [] = {0xFF01,232,0xFFFF}; static const EIF_TYPE_INDEX egt_10_1035 [] = {0xFF01,232,0xFFFF}; static const EIF_TYPE_INDEX egt_11_1035 [] = {0xFF01,17,0xFFFF}; static const EIF_TYPE_INDEX egt_12_1035 [] = {1034,1032,107,0xFFFF}; static const EIF_TYPE_INDEX egt_13_1035 [] = {0xFF01,1034,1032,107,0xFFFF}; static const EIF_TYPE_INDEX egt_14_1035 [] = {0xFF01,241,0xFFFF}; static const EIF_TYPE_INDEX egt_15_1035 [] = {0xFF01,240,0xFFFF}; static const EIF_TYPE_INDEX egt_16_1035 [] = {0xFF01,245,0,0xFFFF}; static const EIF_TYPE_INDEX egt_17_1035 [] = {0xFF02,0xFFF8,1,0xFFFF}; static const EIF_TYPE_INDEX egt_18_1035 [] = {0xFF02,0xFFF8,1,0xFFFF}; static const EIF_TYPE_INDEX egt_19_1035 [] = {0xFF02,0xFFF8,1,0xFFFF}; static const EIF_TYPE_INDEX egt_20_1035 [] = {0xFF02,0xFFF8,1,0xFFFF}; static const EIF_TYPE_INDEX egt_21_1035 [] = {0xFFF8,1,0xFFFF}; static const EIF_TYPE_INDEX egt_22_1035 [] = {0xFF01,232,0xFFFF}; static const EIF_TYPE_INDEX egt_23_1035 [] = {0xFF01,232,0xFFFF}; static const EIF_TYPE_INDEX egt_24_1035 [] = {0xFF01,232,0xFFFF}; static const EIF_TYPE_INDEX egt_25_1035 [] = {0xFF01,232,0xFFFF}; static const EIF_TYPE_INDEX egt_26_1035 [] = {0xFF01,238,0xFFFF}; static const EIF_TYPE_INDEX egt_27_1035 [] = {0xFF01,232,0xFFFF}; static const EIF_TYPE_INDEX egt_28_1035 [] = {0xFFF8,1,0xFFFF}; static const EIF_TYPE_INDEX egt_29_1035 [] = {0xFF01,237,0xFFFF}; static const struct desc_info desc_1035[] = { {EIF_GENERIC(NULL), 0xFFFFFFFF, 0xFFFFFFFF}, {EIF_GENERIC(egt_0_1035), 0, 0xFFFFFFFF}, {EIF_GENERIC(egt_1_1035), 1, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 2, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 3, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 15128, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 5, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 6, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 7, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 8, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 9, 0xFFFFFFFF}, {EIF_GENERIC(egt_2_1035), 10, 0xFFFFFFFF}, {EIF_GENERIC(NULL), 11, 0xFFFFFFFF}, {EIF_GENERIC(NULL), 12, 0xFFFFFFFF}, {EIF_GENERIC(egt_3_1035), 13, 0xFFFFFFFF}, {EIF_GENERIC(egt_4_1035), 14, 0xFFFFFFFF}, {EIF_GENERIC(egt_5_1035), 15, 0xFFFFFFFF}, {EIF_GENERIC(egt_6_1035), 16, 0xFFFFFFFF}, {EIF_GENERIC(egt_7_1035), 17, 0xFFFFFFFF}, {EIF_GENERIC(NULL), 18, 0xFFFFFFFF}, {EIF_GENERIC(NULL), 19, 0xFFFFFFFF}, {EIF_GENERIC(egt_8_1035), 20, 0xFFFFFFFF}, {EIF_GENERIC(egt_9_1035), 15136, 0xFFFFFFFF}, {EIF_GENERIC(egt_10_1035), 22, 0xFFFFFFFF}, {EIF_GENERIC(NULL), 23, 0xFFFFFFFF}, {EIF_GENERIC(egt_11_1035), 24, 0xFFFFFFFF}, {EIF_GENERIC(NULL), 25, 0xFFFFFFFF}, {EIF_GENERIC(NULL), 26, 0xFFFFFFFF}, {EIF_GENERIC(NULL), 27, 0xFFFFFFFF}, {EIF_GENERIC(egt_12_1035), 28, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x01C7 /*227*/), 29, 0xFFFFFFFF}, {EIF_GENERIC(egt_13_1035), 30, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x01B5 /*218*/), 15122, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 10019, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 15129, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 15130, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 1491, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 1492, 0xFFFFFFFF}, {EIF_GENERIC(egt_14_1035), 15118, 0xFFFFFFFF}, {EIF_GENERIC(egt_15_1035), 15119, 0xFFFFFFFF}, {EIF_GENERIC(egt_16_1035), 15120, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x01B5 /*218*/), 15121, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x01B5 /*218*/), 15123, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 15124, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 15125, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 15126, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 15127, 0xFFFFFFFF}, {EIF_GENERIC(egt_17_1035), 15131, 0xFFFFFFFF}, {EIF_GENERIC(egt_18_1035), 15132, 0xFFFFFFFF}, {EIF_GENERIC(egt_19_1035), 15133, 0xFFFFFFFF}, {EIF_GENERIC(egt_20_1035), 15134, 0xFFFFFFFF}, {EIF_GENERIC(egt_21_1035), 15135, 0xFFFFFFFF}, {EIF_GENERIC(egt_22_1035), 15138, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 15139, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x0197 /*203*/), 15140, 0xFFFFFFFF}, {EIF_GENERIC(egt_23_1035), 15141, 0xFFFFFFFF}, {EIF_GENERIC(egt_24_1035), 15142, 0xFFFFFFFF}, {EIF_GENERIC(egt_25_1035), 15143, 0xFFFFFFFF}, {EIF_GENERIC(egt_26_1035), 15144, 0xFFFFFFFF}, {EIF_NON_GENERIC(0x01E3 /*241*/), 15145, 0}, {EIF_NON_GENERIC(0x01E1 /*240*/), 15146, 8}, {EIF_GENERIC(egt_27_1035), 15147, 0xFFFFFFFF}, {EIF_GENERIC(egt_28_1035), 0x00, 0xFFFFFFFF}, {EIF_GENERIC(egt_29_1035), 15137, 0xFFFFFFFF}, }; void Init1035(void) { IDSC(desc_1035, 0, 1034); IDSC(desc_1035 + 1, 1, 1034); IDSC(desc_1035 + 32, 261, 1034); IDSC(desc_1035 + 34, 213, 1034); IDSC(desc_1035 + 38, 11, 1034); IDSC(desc_1035 + 63, 356, 1034); } #ifdef __cplusplus } #endif
3b8b0e3dd508553092c942e704fd0877b8d2dcb6
5d80f47a196635a1c0347f4323c6e6bb14e8dc1e
/firmware/cnc_robot/location.h
699afe3c64918e0b6fefdd0cdb4841f65c560e91
[]
no_license
icprog/cnc_machine
03a8443754c0e5dd957416e7adbb610c98985d31
9452474f29858127e500ce7bf9f20a763117aebb
refs/heads/master
2020-03-30T07:17:21.391570
2018-01-09T02:44:21
2018-01-09T02:44:21
null
0
0
null
null
null
null
UTF-8
C
false
false
227
h
location.h
/* * location.h * * Created: 7/1/2013 9:59:40 PM * Author: xeno */ #ifndef LOCATION_H_ #define LOCATION_H_ typedef struct { uint16_t time; int32_t x; int32_t y; int32_t z; } Location_t; #endif /* LOCATION_H_ */
afd58950ed61c9ecd999be625dadb2a95ac46e7a
d63528b0d7f39b8ad3cc75b2d383b7ea482be6c4
/lib/my/print_binary.c
daf8725b2276552a9ad24b19eb26738e919b2305
[]
no_license
nathanagez/my_ls
373f0a8ddfdd7430f3233e5b57943227a4f9d8ae
235e6fb17fe09ebf648a4c9f8963bdb7db657b43
refs/heads/master
2021-09-10T20:35:25.005622
2018-04-01T23:06:17
2018-04-01T23:06:17
null
0
0
null
null
null
null
UTF-8
C
false
false
228
c
print_binary.c
/* ** EPITECH PROJECT, 2017 ** print_binary.c ** File description: ** print in binary base */ #include "my.h" void print_binary(va_list list, int *counter) { int nb = va_arg(list, int); my_putnbr_base(nb, "01", counter); }
958bac7046045371d378e647d524b490a4cd2411
ab53107b36e661145bf15ddfb114bee19d21dc54
/tp1/base_64.c
7d129c8e8746b705b71af9050530834026b98ab6
[]
no_license
Xero-Hige/gaston-rodrigo
2c7294dac4e7616919e0557e22e165953f757f02
3ec8868dfd1684173034d3a2fa3292d9875de890
refs/heads/master
2020-05-18T16:57:58.934745
2014-06-25T02:44:32
2014-06-25T02:44:32
41,748,246
0
0
null
null
null
null
UTF-8
C
false
false
4,677
c
base_64.c
/* * base_64.c */ #include <stdlib.h> #include <stdint.h> #include <string.h> #include "base_64.h" static bool little_endian = true; /** * Setea la variable que indica si el sistema es * little o big endian */ void set_endianess(void) { int i = 1; char *p = (char *) &i; if (p[0] == 1) little_endian = true; else little_endian = false; } /** * Invierte las posiciones de un arreglo de 4 bytes */ void array_invert(char temporal_array[4]) { char aux = 0; aux = temporal_array[0]; temporal_array[0] = temporal_array[3]; temporal_array[3] = aux; aux = temporal_array[1]; temporal_array[1] = temporal_array[2]; temporal_array[2] = aux; } /** * Transforma el contenido del arreglo 'input' en * una cadena con la codificacion de este en base * 64. El resultado se almacena en el arreglo 'output'. * Devuelve true si la operacion fue exitosa. */ bool encode_to_base64(char input[3], char output[4]) { int32_t temporal = 0; int32_t index = 0; int i; char* temporal_array = (char*) &temporal; char* index_array = (char*) &index; memcpy(&temporal, input, 3); if (little_endian) array_invert(temporal_array); temporal = temporal >> 8; for (i = 0; i < 4; i++) { temporal = temporal << 6; if (little_endian) { //Little endian index_array[0] = temporal_array[3]; temporal_array[3] = 0; } else { //Big endian index_array[3] = temporal_array[0]; temporal_array[0] = 0; } output[i] = ALFABETO[index]; } return true; } /** * Devuelve la posicion del caracter 'c' dentro * de la cadena 'string'. -1 en caso que el caracter * no pertenezca. */ int index_of(char c, char* string, size_t len) { int index = -1; size_t i; for (i = 0; i < len; i++) { if (c == string[i]) { index = i; break; } } return index; } /** * Decodifica el contenido del arreglo 'input' en * codificado en base 64. El resultado se almacena * en el arreglo 'output'. Devuelve true si la * operacion fue exitosa. */ bool decode_from_base64(char input[4], char output[3], int* padding) { int32_t temporal = 0; int i; *padding = 0; char* temporal_array = (char*) &temporal; for (i = 3; i >= 0; i--) { int index = index_of(input[i], ALFABETO, 64); //TODO: largo de la base if (index < 0) { if (input[i] != PADDING_CHAR) return false; *padding += 1; if (little_endian) temporal_array[3] = 0; else temporal_array[0] = 0; } else { if (little_endian) temporal_array[3] = index; else temporal_array[0] = index; } temporal = temporal >> 6; } if (little_endian) array_invert(temporal_array); memcpy(output, (temporal_array + 1), 3); return true; } /** * Agrega los caracteres de padding necesarios segun la * cantidad de bytes leidos */ void add_padding(int bytes_read, char buffer[4]) { if (bytes_read < 3) { if (bytes_read < 3) buffer[3] = PADDING_CHAR; if (bytes_read < 2) buffer[2] = PADDING_CHAR; } } /** * Escribe sobre el output_stream el contenido del * input_stream codificado en base 64 */ int encode(FILE* input_stream, FILE* output_stream) { char input_buffer[3]; char output_buffer[4]; set_endianess(); int bytes_read = fread(input_buffer, sizeof(char), 3, input_stream); while (bytes_read > 0) { if (bytes_read < 3) input_buffer[2] = 0; if (bytes_read < 2) input_buffer[1] = 0; if (!encode_to_base64(input_buffer, output_buffer)) return ENCODE_ERROR; add_padding(bytes_read, output_buffer); int bytes_wrote = fwrite(output_buffer, sizeof(char), 4, output_stream); if (bytes_wrote != 4) return WRITE_ERROR; bytes_read = fread(input_buffer, sizeof(char), 3, input_stream); } return 0; } /** * Escribe sobre el output_stream el contenido del * input_stream decodificado de base 64. * Pre: El input_stream contiene solo caracteres del * "ALFABETO" */ int decode(FILE* input_stream, FILE* output_stream) { char input_buffer[4]; char output_buffer[3]; set_endianess(); int padding = 0; int bytes_read = fread(input_buffer, sizeof(char), 4, input_stream); while (bytes_read > 0) { if (bytes_read < 4) //No es la cantidad correcta de bytes return ENCODE_ERROR; //TODO: cambiar tipo de error if (!decode_from_base64(input_buffer, output_buffer, &padding)) return DECODE_ERROR; int bytes_to_write = 3; if (padding != 0) { if (padding == 1) { bytes_to_write = 2; } if (padding == 2) { bytes_to_write = 1; } } int bytes_wrote = fwrite(output_buffer, sizeof(char), bytes_to_write, output_stream); if (bytes_wrote != bytes_to_write) return WRITE_ERROR; bytes_read = fread(input_buffer, sizeof(char), 4, input_stream); } return 0; }
4c95b2336697f1dad627b2c41e08c658b8adffed
e28e765a6d85fbc1b1a855fcf4b7ea4d3b2a25a7
/QuickMARSales/Pods/Headers/Private/BuddySDK/BPAppSettings.h
53c0a97744094de10859ff25352492cd65488306
[]
no_license
daltonpurnell/QuickMARSales
8eb053422d25cdb7185d1ee1fdbac773f1e4b89b
663d50474c8930a67c42c352eea28e17289643a8
refs/heads/master
2021-01-17T05:19:03.691352
2016-07-02T14:57:19
2016-07-02T14:57:19
44,117,903
0
0
null
null
null
null
UTF-8
C
false
false
58
h
BPAppSettings.h
../../../BuddySDK/Src/Lib/BuddySDK/Service/BPAppSettings.h
179970caad851e3cab9ffe20afe5b44b439741d0
7d762549d7a285e0c51ebf6407dd55e0a56ffd8f
/srs.h
674ff80968a52f940506363fa994a563eba67bc2
[]
no_license
M-atthew/cmsc11-srs
2d7ddb77b469be9c44d3e47c59db1164879b36e4
02a91378ab6667e10bc27e6f0be9f949deb1970e
refs/heads/master
2020-11-24T18:02:08.083393
2019-12-16T02:16:07
2019-12-16T02:16:07
228,283,132
0
0
null
null
null
null
UTF-8
C
false
false
4,255
h
srs.h
void introductionDisplay(void){ printf("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n"); printf("\u2551CMSC11 STUDENT REGISTRATION SYSTEM (SRS)\u2551\n"); printf("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n"); } void adminStudentRecordsMenu(void){ printf("\n\nSTUDENT RECORDS\n"); printf("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n"); printf("\u25510. Back \u2551\n"); printf("\u25511. Create a student record through keyboard input. \u2551\n"); printf("\u25512. Import student record/s from .txt or .csv file. \u2551\n"); printf("\u25513. Update a student's records. \u2551\n"); printf("\u25514. Delete a student's records. \u2551\n"); printf("\u25515. Enrol a student to a subject. \u2551\n"); printf("\u25516. Drop a student's subject. \u2551\n"); printf("\u25517. Display all student records. \u2551\n"); printf("\u25518. Display specific student's records. \u2551\n"); printf("\u25519. Output student records as .csv file \u2551\n"); printf("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n"); } void adminSubjectsRecordsMenu(void){ printf("\n\nSUBJECT RECORDS\n"); printf("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n"); printf("\u25510. Back \u2551\n"); printf("\u25511. Create a subject record through keyboard input. \u2551\n"); printf("\u25512. Import subject record/s from .txt or .csv file. \u2551\n"); printf("\u25513. Update a subject's record. \u2551\n"); printf("\u25514. Delete a subject's record. \u2551\n"); printf("\u25515. Display all subject records. \u2551\n"); printf("\u25516. Search subject. \u2551\n"); printf("\u25517. Output subject records as .csv file. \u2551\n"); printf("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n"); } void studentMenu(void){ printf("0. Back\n"); printf("1. Enrol to a subject.\n"); printf("2. Drop a subject.\n"); printf("3. Display student info.\n"); } void stringCopy(char src[], char dest[]){ int count; for(count = 0; src[count] != '\0'; count++){ dest[count] = src[count]; } } int power(int p, int n){ int result = 1; for (n=n; n>0; n--){ result = result * p; } return result; } double squareRoot(int number){ float temp, sqrt; sqrt = number / 2; temp = 0; while(sqrt != temp){ temp = sqrt; sqrt = ( number/temp + temp) / 2; } return sqrt; }
08e91750ad5576c2c3aa5f3b0b2229692d9f1904
d003f289d01c0af46a5aaa4820841e983794ecdb
/pinfo.c
73d4752f7c41923b1befc898c8fabb078b2bcd05
[ "MIT" ]
permissive
ShivamMangale/xv6-public
98e4e9428b4c38c70f9672d52095b9b0a4ce42f7
45abbc830da764766b6875f686b24c048e3752db
refs/heads/master
2020-09-03T04:59:25.477894
2019-11-07T17:43:22
2019-11-07T17:43:22
219,391,695
0
0
NOASSERTION
2019-11-04T01:22:04
2019-11-04T01:22:04
null
UTF-8
C
false
false
1,046
c
pinfo.c
#include "types.h" #include "stat.h" #include "user.h" #include "fcntl.h" struct proc_stat{ int pid; int run_time; int num_run; int current_queue; int ticks[5]; }; int main(int argc, char *argv[]) { // int pid = 0; // if(argc !=1) atoi(argv[1]); printf(1,"In main\n"); struct proc_stat* curproc=(struct proc_stat*)(malloc(sizeof(struct proc_stat*)*1)); printf(1,"allocated resources\n"); // curproc->pid = 0; // printf(1,"---\n"); // curproc->run_time = 0; // printf(1,"---\n"); // curproc->num_run = 0; // printf(1,"---\n"); // curproc->current_queue = 0; // for(int i=0;i<5;++i) curproc->ticks[i] = 0; // printf(1,"assigned values\n"); getpinfo(curproc); // printf(1,"PID : %d\n",curproc->pid); // printf(1,"Runtime : %d\n",curproc->run_time); // printf(1,"Number of times process in RUNNING state : %d\n",curproc->num_run); // printf(1,"Current Queue Number : %d\n",curproc->current_queue); // for(int i=0;i<5;++i) printf(1,"Ticks in queue %d : %d\n",i,curproc->pid); return 0; }
515ad998e36460d30603d57456d532a7f41e76c2
5338d599b615fec6546467893b325fb14a69df9a
/src/args.c
14dc52e2484dfedbd0556d9dd16b2cbd591dbbbf
[]
no_license
bradens-stuff/int-table
d5cb1af18343e98b7797a13fafe255cc2e7df16f
a65f4fbd877454a073516ff94f70107dc8149f75
refs/heads/master
2021-01-18T22:31:18.821819
2016-08-01T23:30:25
2016-08-01T23:30:25
18,934,227
0
0
null
null
null
null
UTF-8
C
false
false
798
c
args.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "args.h" static void usage(char *pname); void parse_args(char **argv, struct options *o) {/*{{{*/ char *arg; char **args = argv + 1; while(arg = *(args++)){ if(!strncmp(arg, "-nb", 3)) o->num_bits = atol(*args); if(!strncmp(arg, "-md", 3)) o->markdown = 1; if(!strncmp(arg, "-h", 2)) usage(*argv); } }/*}}}*/ static void usage(char *pname) {/*{{{*/ printf( "Usage: %s [options]\n" "Options:\n" " -nb [number] change the number of bits to account for. Default = 4\n" " -md use markdown format\n" " -h display this help\n", pname); exit(1); }/*}}}*/
044f9f85aa9ddbb8535741e5eb8c18593d8f1cc5
2c5124df4fbc4d8184c9879c280b1ca9c77b8a12
/arbre.h
f55e97eb7093d145e980b45ab2132fdb70dd5469
[]
no_license
Malyasse/CompilationL3_2017
27c258add5218523caf8a65f2345e27da852be2b
4fbe4ca28cceeb6f39057b2b89320117e29d20b5
refs/heads/master
2021-08-28T15:36:28.000797
2017-11-17T19:57:06
2017-11-17T19:57:06
107,559,787
0
0
null
null
null
null
UTF-8
C
false
false
1,220
h
arbre.h
#ifndef ARBRE_H #define ARBRE_H typedef struct struct_arbre{ /*Carreteros Laetitia*/ int type_noeud; int num_lexico; struct struct_arbre *frere; struct struct_arbre *fils; }type_arbre; typedef type_arbre* arbre; /******************* Fonction :arbre arbre_vide():Creer un arbre vide Auteur :Carreteros Laetitia ******************/ arbre arbre_vide(); /******************* Fonction :arbre creer_noeud(int nouveau_noeud):creer un nouveau noeud Auteur :Carreteros Laetitia ********************/ arbre creer_noeud(int nouveau_type_noeud,int num_lexico); /******************* Fonction :arbre concat_pere_frere(arbre arbre_pere,arbre arbre_frere) : Ajoute un frere a un arbre_pere Auteur :Carreteros Laetitia ******************/ arbre concat_pere_frere(arbre arbre_pere,arbre arbre_frere); /******************* Fonction :arbre concat_pere_fils(arbre arbre_pere,arbre arbre_fils) : Ajoute un fils a un arbre_pere Auteur :Carreteros Laetitia ******************/ arbre concat_pere_fils(arbre arbre_pere,arbre arbre_fils); void afficher_arbre_bis(arbre a,int i); void afficher_arbre(arbre a); void afficher_arbre_horizontal(arbre a, int max_prof, int cacher, FILE* mon_flux); #endif
fa8b438bd537a007b9977971aa74700f4ac6dce8
fd4919c450e0dc85c964bb83b97eec9cd2f3f569
/src/keyboard/keyboard.c
dd170441e9a27983d95b1299e8173da6f279a838
[]
no_license
Alvarwow69/RPG-Epitech_project
171701386c689bca9a16bea01ae5fdb4e98ca66a
ab710fb33ab2d117c164b7176b1ec4eb38cf7d51
refs/heads/master
2022-07-16T22:40:41.615953
2020-05-15T12:55:22
2020-05-15T12:55:22
264,188,166
0
0
null
null
null
null
UTF-8
C
false
false
2,245
c
keyboard.c
/* ** EPITECH PROJECT, 2020 ** Delivery ** File description: ** keyboard_pressed */ #include "rpg.h" void key_release(sfEvent event, global_data_t *data) { key_released_a_j(event, data); key_released_k_t(event, data); key_released_u_num3(event, data); key_released_num4_lalt(event, data); key_released_lsystem_comma(event, data); key_released_period_back(event, data); key_released_tab_mult(event, data); key_released_div_pad4(event, data); key_released_pad5_f5(event, data); key_released_f6_f15(event, data); if (event.key.code == sfKeyPause) data->key->pause = 0; if (event.key.code == sfKeyCount) data->key->count = 0; } void key_pressed(sfEvent event, global_data_t *data) { key_pressed_a_j(event, data); key_pressed_k_t(event, data); key_pressed_u_num3(event, data); key_pressed_num4_lalt(event, data); key_pressed_lsystem_comma(event, data); key_pressed_period_back(event, data); key_pressed_tab_mult(event, data); key_pressed_div_pad4(event, data); key_pressed_pad5_f5(event, data); key_pressed_f6_f15(event, data); if (event.key.code == sfKeyPause) data->key->pause = 1; if (event.key.code == sfKeyCount) data->key->count = 1; } void event_keyboard2(sfEvent event, global_data_t *data) { if (event.type == sfEvtKeyPressed){ key_pressed(event, data); } if (event.type == sfEvtMouseButtonPressed){ if (event.mouseButton.button == sfMouseRight) data->key->right_click = 1; if (event.mouseButton.button == sfMouseLeft) data->key->left_click = 1; } } void event_keyboard(sfEvent event, global_data_t *data) { sfMouseWheelEvent mousewheel; if (event.type == sfEvtKeyReleased) { key_release(event, data); } if (event.type == sfEvtMouseButtonReleased){ if (event.mouseButton.button == sfMouseRight) data->key->right_click = 0; if (event.mouseButton.button == sfMouseLeft) data->key->left_click = 0; } event_keyboard2(event, data); if (event.type == sfEvtMouseWheelMoved) { mousewheel = event.mouseWheel; data->key->mouse_wheel = mousewheel.delta; } }
776ab61f8b7ccf678598e0592fb3109f8cbbd28e
2b93f887bdc61bbc5f7da771681659f72d2acc4f
/myki-br/.svn/pristine/77/776ab61f8b7ccf678598e0592fb3109f8cbbd28e.svn-base
6d32423d89e735cd2e3d38ce1557d4d42a4db497
[]
no_license
PengWEI9/Vix
a0796ff0d5e8ce962efa60b4bd22eaba03ac6017
c6dd23d2ffc36d82221a8d920862c435683f1c24
refs/heads/master
2021-01-10T16:01:18.530308
2016-01-25T03:42:00
2016-01-25T03:42:00
49,394,563
3
0
null
null
null
null
UTF-8
C
false
false
5,238
776ab61f8b7ccf678598e0592fb3109f8cbbd28e.svn-base
/************************************************************************** * ID : BR_LLSC_4_1 * Missing Scan-On Station Exit Fee * * Data Fields * 1. TAppControl.ProductInUse * 2. Dynamic.StopId * 3. Tariff.StationExitFee * 4. Static.ServiceProviderId * 5. TAppTProduct.PurchaseValue * 6. TAppTProduct.NextTxSeqNo * * Pre-Conditions * 1. The product in use field(1) is 0 (no products are scanned-on). * 2. The station exit fee(3) for the current station(2) is greater than zero. * * Description * 1. Perform a TPurseUsage/Penalty transaction for the value of the station exit fee(3). * 2. Modify usage log * a. Definition: * i. TAppLoadLog.ControlBitmap: Value, * ii. TxType = Station Exit Fee (15) * iii. ProviderID = ServiceProviderID(4) * b. Value: * i. TxValue = TxValue + station Exit fee(3) * ii. NewTPurseBalance = As returned from TPurseUsage/Penalty transaction * iii. PaymentMethod = T-Purse (1) * * Post-Conditions * 1. A station exit fee is charged. * Devices * Exit gates * ***********************************************************************/ #include <cs.h> // For debug logging #include <myki_cardservices.h> // Myki Card Services #include <LDT.h> // Logical Device Transaction #include "myki_br_rules.h" // API for all BR_xxx modules #include "BR_Common.h" // Common utilities, macros, etc //============================================================================= // // // //============================================================================= RuleResult_e BR_LLSC_4_1( MYKI_BR_ContextData_t *pData ) { MYKI_TAControl_t *pMYKI_TAControl = NULL; TAppUsageLog_t *pTAppUsageLog = NULL; MYKI_TAPurseBalance_t *pMYKI_TAPurseBalance = NULL; CsDbg( BRLL_RULE, "BR_LLSC_4_1 : Start (Missing Scan-On Station Exit Fee)" ); if ( ! pData ) { CsErrx( "BR_LLSC_4_1 : Invalid argument(s)" ); return RULE_RESULT_ERROR; } if ( MYKI_CS_TAControlGet( &pMYKI_TAControl ) < 0 ) { CsErrx( "BR_LLSC_4_1 : MYKI_CS_TAControlGet() failed" ); return RULE_RESULT_ERROR; } // 1. The product in use field(1) is 0 (no products are scanned-on). if ( pMYKI_TAControl->ProductInUse != 0 ) { CsDbg( BRLL_RULE, "BR_LLSC_4_1 : Bypass - Product in use" ); pData->ReturnedData.bypassCode = 1; return RULE_RESULT_BYPASSED; } // 2. The station exit fee(3) for the current station(2) is greater than zero. if ( pData->Tariff.stationExitFee <= 0 ) { CsDbg( BRLL_RULE,"BR_LLSC_4_1 : Bypass - Station Exit Fee (%d) <= 0", pData->Tariff.stationExitFee ); pData->ReturnedData.bypassCode = 2; return RULE_RESULT_BYPASSED; } // // Indicate to Test Harness that all Pre-Conditions have been satisfied // pData->ReturnedData.bypassCode = 3; //---------------------------------------------------------------------------- // Description // 1. Perform a TPurseUsage/Penalty transaction for the value of the station exit fee(3). if (myki_br_ldt_PurseUsage_Penalty(pData, pData->Tariff.stationExitFee) < 0 ) { CsErrx("BR_LLSC_4_1 : MYKI_LDT_TPurseUsagePenalty() failed"); return RULE_RESULT_ERROR; } /* 2. Modify usage log */ pTAppUsageLog = &pData->InternalData.UsageLogData; /* a. Definition: */ { /* i. TxType = Station Exit Fee (15) */ pTAppUsageLog->transactionType = MYKI_BR_TRANSACTION_TYPE_STATION_EXIT_FEE; /* ii. Determine uselog ControlBitmap though look up of the TxUsageType (Done by framework) iii.ProviderID = ServiceProviderID (Done by framework) iv. TXDateTime as Current DateTime (Done by framework) */ } /* b. Value: */ { /* i. TxValue = TxValue + station Exit fee */ pTAppUsageLog->isTransactionValueSet = TRUE; pTAppUsageLog->transactionValue += pData->Tariff.stationExitFee; /* ii. NewTPurseBalance = As returned from TPurseUsage/Penalty transaction */ if ( MYKI_CS_TAPurseBalanceGet( &pMYKI_TAPurseBalance ) < 0 || pMYKI_TAPurseBalance == NULL ) { CsErrx( "BR_LLSC_4_1 : MYKI_CS_TAPurseBalanceGet() failed" ); return RULE_RESULT_ERROR; } /* end-of-if */ pTAppUsageLog->isNewTPurseBalanceSet = TRUE; pTAppUsageLog->newTPurseBalance = pMYKI_TAPurseBalance->Balance; /* iii.PaymentMethod = T-Purse (1) */ pTAppUsageLog->isPaymentMethodSet = TRUE; pTAppUsageLog->paymentMethod = TAPP_USAGE_LOG_PAYMENT_METHOD_TPURSE; } /* NOTE: TAppUsageLog entry is added by application framework. */ pData->InternalData.IsUsageLogUpdated = TRUE; CsDbg( BRLL_RULE, "BR_LLSC_4_1 : Updated TAppUsageLog" ); CsDbg( BRLL_RULE, "BR_LLSC_4_1 : Executed" ); return RULE_RESULT_EXECUTED; }
cbc05c9d832075222a1872bea7670dafb6100d29
98202e03f83ecb0f80bcad48078dc468a5dc0bc2
/adc/ad7779/ad7779-low.h
9877cab9c57027236ebcc2726704f6f0b8058531
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
phoenix-rtos/phoenix-rtos-devices
e7de9531c8f1b418310bb3b1d6089d4d8905c4f7
5cb46807a914a0d5885ea0b98dc638c7ddabaeaa
refs/heads/master
2023-08-17T06:05:50.582582
2023-08-10T17:54:13
2023-08-11T13:56:30
125,824,524
17
39
BSD-3-Clause
2023-09-14T14:44:31
2018-03-19T08:21:41
C
UTF-8
C
false
false
1,072
h
ad7779-low.h
/* * Phoenix-RTOS * * AD7779 components API * * Copyright 2021 Phoenix Systems * * This file is part of Phoenix-RTOS. * * %LICENSE% */ #ifndef AD7779_LOW_H #define AD7779_LOW_H /* For now most of the drivers do not have common api. This set of functions represents abstraction layer for targets and must be implemented by the user */ /* DMA api */ int dma_init(size_t size, size_t count, addr_t *phys_addr); void dma_free(void); void dma_enable(void); void dma_disable(void); /* dma_read in most cases is used to read an interrupt counter (and to wait for the interrupt) */ int dma_read(void *data, size_t len); /* SAI api */ int sai_init(void); void sai_free(void); void sai_rx_enable(void); void sai_rx_disable(void); addr_t sai_fifo_rx_ptr(void); uint32_t sai_fifo_watermark(void); /* SPI api */ int spi_exchange(uint8_t *buff, uint8_t len); int spi_init(void); /* GPIO api */ typedef enum { start, reset, hardreset } ad7779_gpio_t; int ad7779_gpio(ad7779_gpio_t gpio, int state); int ad7779_gpio_init(void); #endif
0580fbda076126d97710cdb19c942cb36eaa2db7
2ad2ff716fe60c753b04eba8fbd8d9f6f4b274d5
/libft/ft_wtoc.c
b04db596a084ab98422c873a1cb96156d6870c09
[]
no_license
LucBRG/lem_in
5736409e8d3f8673a5c1b95a2ca30b29447af723
29248b7f7a40ce37504321935f7f1db3142fa031
refs/heads/master
2021-03-24T09:37:00.781435
2017-08-22T19:05:51
2017-08-22T19:05:51
93,735,762
0
0
null
null
null
null
UTF-8
C
false
false
1,706
c
ft_wtoc.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_wtoc.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: lbrugero <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/20 14:10:19 by lbrugero #+# #+# */ /* Updated: 2017/01/20 14:10:20 by lbrugero ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" #include <stdlib.h> static int ft_wtoc_second(wchar_t w, char *str, int i) { if (w <= 0x7F) str[i++] = w; else if (w <= 0x7FF) { str[i++] = (w >> 6) + 0xC0; str[i++] = (w & 0x3F) + 0x80; } else if (w <= 0xFFFF) { str[i++] = (w >> 12) + 0xE0; str[i++] = ((w >> 6) & 0x3F) + 0x80; str[i++] = (w & 0x3F) + 0x80; } else if (w <= 0x1FFFFF) { str[i++] = (w >> 18) + 0xF0; str[i++] = ((w >> 12) & 0x3F) + 0x80; str[i++] = ((w >> 6) & 0x3F) + 0x80; str[i++] = (w & 0x3F) + 0x80; } return (i); } char *ft_wtoc(wchar_t *w) { char *str; int byte; size_t i; if (!w) return (NULL); i = 0; byte = ft_strwoctet(w); if (!(str = (char*)malloc(byte + 1))) return (NULL); while (*w) { i = ft_wtoc_second(*w, str, i); w++; } str[i] = 0; return (str); }
e28d53bff7f39a7f046237ba6644a141830d86fc
06bc6e472a1839e82245414bf31f5d0002211309
/lab/code/node2/sound.c
52964ac81493c9105d429baab4b759d4a349b9e3
[]
no_license
Sia131/Byggern
503023a3cf8ad3daef1513e5e02289ce3d2d5616
2260cd4dc2a257f3ac76b5cc4efaa83ff5a8d3fa
refs/heads/master
2020-07-12T23:28:45.557637
2019-11-19T11:08:35
2019-11-19T11:08:35
195,295,912
0
0
null
null
null
null
UTF-8
C
false
false
688
c
sound.c
#include "sound.h" #include <util/delay.h> void sound_init(){ /*set the DDR register on OC1B as output PE3 = OC1B */ DDRE |= (1 << PE3); /*clear OC3A on compare match set OC3A at BOTTOM non-inverting */ TCCR3A = (1 << COM3A0); /*Mode 12 -CTC */ //TCCR3A |= (1 << WGM31); TCCR3B |= (1 << WGM33) | (1 << WGM32); /*select clock speed Prescale = 8 */ TCCR3B |= (1 << CS31) | ( 1 << CS30); } /*the range of the sound should be between 380Hz to 5kHz*/ void sound_set_tone(float freq){ //float period = 1 / freq; float freq_mcu = 16000000; int value = (freq_mcu/(2*64*freq)) - 1; ICR3 = value; //OCR3A = ICR3/2; }
c7d5db6606209c92bbb8b4de7293f5dd46c079fb
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
/mail/exim/files/patch-exim_monitor-em_hdr.h
a7a496684e17159f468c185ea2c3315fbe8a5edb
[ "BSD-2-Clause" ]
permissive
freebsd/freebsd-ports
86f2e89d43913412c4f6b2be3e255bc0945eac12
605a2983f245ac63f5420e023e7dce56898ad801
refs/heads/main
2023-08-30T21:46:28.720924
2023-08-30T19:33:44
2023-08-30T19:33:44
1,803,961
916
918
NOASSERTION
2023-09-08T04:06:26
2011-05-26T11:15:35
null
UTF-8
C
false
false
284
h
patch-exim_monitor-em_hdr.h
--- exim_monitor/em_hdr.h.orig 2019-12-08 12:53:48 UTC +++ exim_monitor/em_hdr.h @@ -95,6 +95,8 @@ this interface so that this kind of kludge isn't neede #endif typedef void hctx; +typedef unsigned long ulong; + #include "local_scan.h" #include "macros.h" #include "structs.h"
d711afecf7f7707bbe9b2612e303905b5633eb72
952d51299d2591eda87839f86ec5887e4af09507
/Assignment_3/reduction_clause.c
c3a811f096ae7956ae86f922f113e076556731a1
[]
no_license
jacob5412/Parallel-and-Distributed-Computing
36cb5f51707d07b910ab5c990b5002da979e83bb
371a319cd3df8ef0873edf50604115a8a937124a
refs/heads/master
2023-08-07T17:41:35.048656
2021-09-24T16:21:06
2021-09-24T16:21:06
142,436,968
5
0
null
null
null
null
UTF-8
C
false
false
917
c
reduction_clause.c
/*OpenMP program to employ reduction clause to express the reduction of a for loop. */ #include <stdio.h> #include <omp.h> #include <time.h> int main() { int sum = 0; int temp = 0; int a[10]; clock_t t; printf("Enter a value: \n"); for(int j = 0; j < 9; j ++) scanf("%d",&a[j]); omp_set_num_threads(3); t = clock(); #pragma omp parallel for shared(temp, a) reduction(+:sum) for (int i = 0; i < 9; i++) { temp = a[i]; sum += temp; printf("Thread %d is in execution and temp is = %d\n", omp_get_thread_num(),temp); printf("Value of temp is = %d (race condition) and sum = %d\n", temp, sum); } t = clock() - t; printf("Value of sum is: %d\n",sum); double time_taken = ((double)t) / CLOCKS_PER_SEC; printf("Running the program parallelly took %f seconds to execute \n", time_taken); }
3e6dec51cac407159058fc63f4409699e5af64f8
2cbf3d7b8bf35648dc9a4b53085ad19a212198e2
/Uni/Sorting/heapSort.c
996e284d489cf01648c78c1e6084f3eb6e2bbda4
[]
no_license
hmu332233/Algorithm
66a8193907db9b3369a3c3c8fae6c9bd833528de
d612bae76cea36d5024417be8a766de9f3d725c3
refs/heads/master
2020-04-05T12:38:03.435902
2018-01-27T18:18:59
2018-01-27T18:18:59
95,194,061
0
0
null
null
null
null
UTF-8
C
false
false
1,163
c
heapSort.c
#include <stdio.h> #include <stdlib.h> void buildHeap(int* arr,int n); void heapify(int* arr , int k, int n); int times = 0; int sw = 0; int main() { int n; scanf("%d",&n); int arr[n+1]; arr[0] = 0; int i; for( i = 1 ; i <= n ; i++) { scanf("%d",&arr[i]); } heapSort( arr , n ); for( i = 1 ; i <= n;i++) { printf("%d ",arr[i]); } printf("%d" , times); } void heapSort(int* arr , int n) { int tmp; buildHeap(arr,n); sw = 1; int i; for( i = n ; i >= 2 ; i--) { tmp = arr[i]; arr[i] = arr[1]; arr[1] = tmp; heapify(arr,1,i-1); } } void buildHeap(int* arr,int n) { int i; //각 부모노드 for( i = n/2 ; i >= 1 ; i--) { heapify(arr,i,n); } } void heapify(int* arr , int k, int n) { int bigger; int left = 2*k; int right = 2*k+1; if(right <= n) { if(arr[left] > arr[right] ) bigger = left; else bigger = right; } else if (left <= n) bigger = left; else return; int tmp; //자식이 더 크면 위로 올림 if( arr[bigger] > arr[k] ) { tmp = arr[bigger]; arr[bigger] = arr[k]; arr[k] = tmp; heapify(arr,bigger,n); if( sw == 1) times++; } }
9816f982e52489057cc6564bcdebd07033bbbb0c
0dd05f5e0d683d90cd711841ffe682e56d306084
/FdF/src/draw.c
e5b995d558401f47617e737a8813376fe6849e3f
[]
no_license
Dombi4/FdF
03b06aa8145514697ca3dc187f24d7600e941bda
9913a8828a949fd9f6138f85894eb13371ef56ee
refs/heads/master
2022-12-09T06:38:39.703619
2020-09-12T17:07:44
2020-09-12T17:07:44
294,986,819
0
0
null
null
null
null
UTF-8
C
false
false
2,577
c
draw.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* draw.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: tmorgana <tmorgana@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/08/14 19:49:49 by tmorgana #+# #+# */ /* Updated: 2020/08/14 19:49:52 by tmorgana ### ########.fr */ /* */ /* ************************************************************************** */ #include "../fdf.h" void ft_horizontal(t_blst *fdf) { int dy; int yi; int d; int dx; dy = fdf->y2 - fdf->y1; dx = fdf->x2 - fdf->x1; yi = 1; if (dy < 0) { yi = -1; dy = -dy; } d = 2 * dy - dx; while (fdf->x1++ != fdf->x2) { if (fdf->x1 >= 0 && fdf->y1 >= 0 && fdf->y1 < WID && fdf->x1 < WID) fdf->img_data[fdf->x1 + fdf->y1 * WID] = fdf->colx1; if (d > 0) { fdf->y1 = fdf->y1 + yi; d = d - 2 * dx; } d = d + 2 * dy; } } void ft_vertical(t_blst *fdf) { int dx; int xi; int dy; int d; dx = fdf->x2 - fdf->x1; dy = fdf->y2 - fdf->y1; xi = 1; if (dx < 0) { xi = -1; dx = -dx; } d = 2 * dx - dy; while (fdf->y1++ != fdf->y2) { if (fdf->x1 >= 0 && fdf->y1 >= 0 && fdf->y1 < WID && fdf->x1 < WID) fdf->img_data[fdf->x1 + fdf->y1 * WID] = fdf->colx1; if (d > 0) { fdf->x1 = fdf->x1 + xi; d = d - 2 * dy; } d = d + 2 * dx; } } void ft_swapint(t_blst *fdf) { int buf; buf = fdf->x1; fdf->x1 = fdf->x2; fdf->x2 = buf; buf = fdf->y1; fdf->y1 = fdf->y2; fdf->y2 = buf; } void ft_bresenham(t_blst *fdf) { if (abs(fdf->y2 - fdf->y1) < abs(fdf->x2 - fdf->x1)) { if (fdf->x1 > fdf->x2) { ft_swapint(fdf); ft_horizontal(fdf); } else ft_horizontal(fdf); } else { if (fdf->y1 > fdf->y2) { ft_swapint(fdf); ft_vertical(fdf); } else ft_vertical(fdf); } } void ft_draw(t_blst *fdf) { int i; int j; i = 0; while (i < fdf->hig) { j = 0; while (j < fdf->wit) { if (i < fdf->hig - 1) ft_horizont(fdf, i, j); if (j < fdf->wit - 1) ft_vertic(fdf, i, j); j++; } i++; } mlx_put_image_to_window(fdf->mlx_ptr, fdf->win_ptr, fdf->img_ptr, 0, 0); }
432bb4c72860a5f4c17fd7dd190cb61ba92f3271
5cc6d32ac295b446c8e615c8a4b3d031c82e231d
/game/game.c
b4bae6175dd9ad9234c72123ca655b0ea8f81571
[]
no_license
sgreenlay/Colonies
0efc7c0bc0183e7bd5686379276a7339f7cb5589
eac66f4f76fac4cffcbe39253af3ff44c18afadf
refs/heads/master
2021-01-01T19:23:46.525249
2014-01-27T07:48:58
2014-01-27T07:48:58
null
0
0
null
null
null
null
UTF-8
C
false
false
12,869
c
game.c
#include "game.h" #include "sprite_mapping.h" #include "credits.h" // // Constructor // game * create_game() { game * gm = (game *)malloc(sizeof(game)); if (gm == NULL) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to allocate game\n"); return NULL; } return gm; } // // Methods // int game_init(game * gm, engine * e) { int idx = 0; graphics * g = engine_get_graphics(e); if (sprite_sheet_init(&gm->m_sprites, g, 50, 50, "assets/sprites.png")) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to initialize sprite sheet\n"); return 1; } if (font_sheet_init(&gm->m_font, g, "assets/font_tilemap.png")) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to initialize font sheet\n"); return 1; } gm->m_planet_count = 4; for (idx = 0; idx < gm->m_planet_count; idx++) { planet_type type; int x, y; int w, h; switch (idx) { case 0: type = planet_type_human; x = g->width / 5; y = 2 * g->height / 3; w = 128; h = 128; break; case 1: type = planet_type_alien; x = 4 * g->width / 5; y = g->height / 3; w = 128; h = 128; break; case 2: type = planet_type_human; x = 2 * g->width / 6; y = g->height / 4; w = 64; h = 64; break; case 3: type = planet_type_alien; x = 4 * g->width / 6; y = 3 * g->height / 4; w = 64; h = 64; break; default: break; } if (planet_init(&gm->m_planets[idx], gm, x, y, w, h, type)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to initialize planet %d\n", idx); return 1; } } gm->m_ship_count = 2; for (idx = 0; idx < gm->m_ship_count; idx++) { ship_type ty; ship_class cl; int x, y, w, h; switch (idx) { case 0: ty = ship_type_human; cl = ship_class_colony; x = gm->m_planets[idx].x; y = gm->m_planets[idx].y; w = 64; h = 64; break; case 1: ty = ship_type_human; cl = ship_class_frigate; x = gm->m_planets[idx].x; y = gm->m_planets[idx].y; w = 64; h = 64; break; default: break; } if (ship_init(&gm->m_ships[idx], gm, x, y, w, h, cl, ty)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to initialize ship %d\n", idx); return 1; } } sprite_mapping spm = get_sprite_mapping(sprite_map_selection); if (sprite_init_from_sheet(&gm->m_selection_sprite, &gm->m_sprites, spm.x, spm.y, spm.w, spm.h)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to initialize cursor sprite\n"); return 1; } spm = get_sprite_mapping(sprite_map_cursor); if (sprite_init_from_sheet(&gm->m_cursor_sprite, &gm->m_sprites, spm.x, spm.y, spm.w, spm.h)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to initialize cursor sprite\n"); return 1; } gm->game_status = MENU_CREDITS; return 0; } hit_test_target game_hit_test(game * gm, int x, int y) { int idx = 0; hit_test_target target = { hit_test_target_none, 0 }; for (idx = 0; idx < gm->m_ship_count; idx++) { if (ship_hit_test(&gm->m_ships[idx], x, y)) { target.type = hit_test_target_ship; target.index = idx; switch (gm->m_ships[idx].ty) { case ship_type_human: target.controller = hit_test_control_human; break; case ship_type_alien: target.controller = hit_test_control_alien; break; default: target.controller = hit_test_control_none; break; } return target; } } for (idx = 0; idx < gm->m_planet_count; idx++) { if (planet_hit_test(&gm->m_planets[idx], x, y)) { target.type = hit_test_target_planet; target.index = idx; switch (gm->m_planets[idx].type) { case planet_type_human: target.controller = hit_test_control_human; break; case planet_type_alien: target.controller = hit_test_control_alien; break; default: target.controller = hit_test_control_none; break; } return target; } } return target; } int game_update_ships(game * gm, engine * e, int is_mouse_left_down, int is_mouse_right_down, unsigned int dt) { int idx = 0; if (is_mouse_left_down) { hit_test_target target = game_hit_test(gm, gm->m_cursor_x, gm->m_cursor_y); if ((target.controller == hit_test_control_human) && ((target.type != gm->m_current_target.type) || (target.index != gm->m_current_target.index))) { gm->m_current_target = target; } else if (target.controller == hit_test_control_none) { gm->m_current_target = target; } } else if (is_mouse_right_down) { if (gm->m_current_target.type == hit_test_target_ship) { hit_test_target target = game_hit_test(gm, gm->m_cursor_x, gm->m_cursor_y); if (target.type == hit_test_target_planet) { ship * ship = &gm->m_ships[gm->m_current_target.index]; planet * planet = &gm->m_planets[target.index]; if (ship_fly_to(ship, planet->x, planet->y, target.index + 1) != 0) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to set ship destination %d\n", gm->m_current_target.index); return 1; } } } } float elapsed = (float)dt / 1000; for (idx = 0; idx < gm->m_ship_count; idx++) { int evt = ship_update(&gm->m_ships[idx], gm, elapsed); if (evt > 0) { planet * planet = &gm->m_planets[evt - 1]; if (planet->type != planet_type_human) { planet_set_type(planet, gm, planet_type_human); } ENGINE_DEBUG_LOG_ERROR("Ship %d arrived at planet %d\n", idx, evt - 1); } } return 0; } int game_update(game * gm, engine * e, unsigned int dt) { int idx = 0; input * i = engine_get_input(e); int is_mouse_left_down = 0; int is_mouse_right_down = 0; if (input_get_mouse_state(i, &is_mouse_left_down, &is_mouse_right_down, &gm->m_cursor_x, &gm->m_cursor_y)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to get mouse state\n"); return 1; } switch (gm->game_status) { case MENU_CREDITS: if (input_is_key_down(&e->m_input,Key_Space, 0)) gm->game_status = MENU_MAIN; break; case MENU_MAIN: //TODO: sigh if (input_is_key_down(&e->m_input, Key_Char, 's')) gm->game_status = MENU_GAME; if (input_is_key_down(&e->m_input, Key_Char, 'c')) gm->game_status = MENU_CREDITS; if (input_is_key_down(&e->m_input, Key_Char, 'q')) gm->game_status = MENU_QUIT; break; case MENU_GAME: if (game_update_ships(gm, e, is_mouse_left_down, is_mouse_right_down, dt) != 0) return 1; if (input_is_key_down(&e->m_input, Key_Char, 'p')) gm->game_status = MENU_PAUSE; break; //GAME case MENU_PAUSE: if (input_is_key_down(&e->m_input, Key_Space, 0)) gm->game_status = MENU_GAME; break; case MENU_WIN: //FALL-THROUGH case MENU_LOSE: if (input_is_key_down(&e->m_input, Key_Space, 0)) gm->game_status = MENU_MAIN; break; case MENU_QUIT: return 2; default: ENGINE_DEBUG_LOG_ERROR("Error! Unknown state%i\n", gm->game_status); return 1; } return 0; } int game_render_planets(game *gm, graphics* g) { int idx = 0; for (idx = 0; idx < gm->m_planet_count; idx++) { if (planet_draw(&gm->m_planets[idx], g)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to draw planet %d\n", idx); return 1; } if ((gm->m_current_target.type == hit_test_target_planet) && (gm->m_current_target.index == idx)) { if (sprite_draw_scaled(&gm->m_selection_sprite, g, gm->m_planets[idx].x, gm->m_planets[idx].y, gm->m_planets[idx].w, gm->m_planets[idx].h)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to draw selection sprite\n"); return 1; } } } return 0; } int game_render_ships(game *gm, graphics* g) { int idx = 0; for (idx = 0; idx < gm->m_ship_count; idx++) { if (ship_draw(&gm->m_ships[idx], g)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to draw ship %d\n", idx); return 1; } if ((gm->m_current_target.type == hit_test_target_ship) && (gm->m_current_target.index == idx)) { if (sprite_draw_scaled(&gm->m_selection_sprite, g, gm->m_ships[idx].x, gm->m_ships[idx].y, gm->m_ships[idx].w, gm->m_ships[idx].h)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to draw selection sprite\n"); return 1; } } } //this will be part of GUI setFontColor(g, 255, 0, 0); drawString(&gm->m_font, g, "Human Power", 300, 400, 30); return 0; } int game_render(game * gm, graphics * g) { int idx = 0; char* print_string; switch (gm->game_status) { case MENU_CREDITS: setFontColor(g, 255, 255, 255); drawString(&gm->m_font, g, "Press Space to skip.", 80, 20, 30); for (idx = 0; idx < sizeof(CREDITS) / sizeof(char*); idx++) drawString(&gm->m_font, g, CREDITS[idx], 40, 80 + idx * 30, 25); break; case MENU_MAIN: setFontColor(g, 255, 255, 255); drawString(&gm->m_font, g, "Press letters to select", 20, 20, 20); drawString(&gm->m_font, g, "s)Start New Game.", 20, 120, 40); drawString(&gm->m_font, g, "c)Credits.", 20,220, 40); drawString(&gm->m_font, g, "q)Quit.", 20, 320, 40); break; case MENU_GAME: game_render_planets(gm, g); game_render_ships(gm, g); //TODO: GUI break; case MENU_PAUSE: game_render_planets(gm, g); game_render_ships(gm, g); setFontColor(g, 255, 255, 255); drawString(&gm->m_font, g, "PAUSED.", 300, 480 / 2, 30); drawString(&gm->m_font, g, "Press space to unpause.", 100, 480 / 2+200, 20); break; case MENU_WIN: //FALL-THROUGH CASE case MENU_LOSE: game_render_planets(gm, g); game_render_ships(gm, g); setFontColor(g, 255, 0, 0); if (gm->game_status == MENU_WIN) print_string = "YOU WIN!!!"; else print_string = "YOU LOSE!!!"; drawString(&gm->m_font, g, print_string, 800 / 2 - 100, 480 / 2 , 30); break; case MENU_QUIT: break; //we will go away soon, just quit. ENGINE_DEBUG_LOG_ERROR("Error! Unknown state%i\n", gm->game_status); return 1; } //always draw cursor if (sprite_draw(&gm->m_cursor_sprite, g, gm->m_cursor_x, gm->m_cursor_y)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to draw cursor sprite\n"); return 1; } return 0; } int game_cleanup(game * gm) { int idx = 0; if (sprite_cleanup(&gm->m_selection_sprite)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to clean-up selection sprite\n"); return 1; } if (sprite_cleanup(&gm->m_cursor_sprite)) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to clean-up cursor sprite\n"); return 1; } for (idx = 0; idx < gm->m_ship_count; idx++) { if (ship_cleanup(&gm->m_ships[idx])) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to clean-up ship %d\n", idx); return 1; } } for (idx = 0; idx < gm->m_planet_count; idx++) { if (planet_cleanup(&gm->m_planets[idx])) { ENGINE_DEBUG_LOG_ERROR("ERROR: Failed to clean-up planet %d\n", idx); return 1; } } return 0; }
e8dd32d84cccc5744785f275b58afc110e791520
475220ae31fdd4f216b5e447f0e1f8834dd8e7ce
/wolf_3d/src/control_1.c
cdd68ad300fc9186c0684bb8153a3a5763213107
[]
no_license
GabrielOarga/academy
cf27f7c3b69a590deea5ba19683cbc843be5c982
95e2c8e6125cfdb223b3574d0b3f7b9285c4b81f
refs/heads/master
2020-03-07T05:32:55.930369
2018-03-29T14:02:30
2018-03-29T14:02:30
127,298,959
0
0
null
null
null
null
UTF-8
C
false
false
1,580
c
control_1.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* control_1.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: goarga <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/03/01 11:52:35 by goarga #+# #+# */ /* Updated: 2016/03/08 19:00:48 by goarga ### ########.fr */ /* */ /* ************************************************************************** */ #include "wolf.h" void clear_wolf(t_wolf *w) { if (w->a.clear == 1) mlx_destroy_image(w->mlx_id, w->img_id); } void init_wolf(t_wolf *w) { int bpp; int lsize; int endian; int x; int y; w->a.clear = 1; w->img_id = mlx_xpm_file_to_image(w->mlx_id, "src/epic3.xpm", &x, &y); w->addr = NULL; w->addr = mlx_get_data_addr(w->img_id, &bpp, &lsize, &endian); } void draw_wolf(t_wolf *w) { mlx_put_image_to_window(w->mlx_id, w->win_id, w->img_id, 0, 0); } int wolf_control(t_wolf *w) { keyhook(w); movehook(w); clear_wolf(w); init_wolf(w); wolf_main(w); draw_wolf(w); return (0); } void wolf_expose(t_wolf *w) { mlx_expose_hook(w->win_id, wolf_control, w); }
7e380f443892cb70690cb526d7e6c55241243213
59b8a08ecc2fdc6f782f104f157bf7bdcc966e81
/_Aulas C/_Jokenpo/jokenpo.c
6f8b00816fa366b3ff82f85cce0b551d1c3d36f0
[]
no_license
Aludeku/Linguagem-C
5c6363cdcf7d43f181595d3fe5afe86eaa2d0bac
c459c199acda82365df4b46b67df0e3ccebf6683
refs/heads/master
2022-07-10T10:17:59.208515
2020-05-16T22:54:36
2020-05-16T22:54:36
264,529,324
0
0
null
null
null
null
ISO-8859-1
C
false
false
1,108
c
jokenpo.c
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <locale.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { int n, bot; setlocale(LC_ALL, "Portuguese"); system("color 5"); printf("\nJO KEN PO!\n"); srand(time(NULL)); bot = rand() % 3+1; //número aleatório gerado pelo cpu do { printf("Digite:\n\n1-PEDRA\n2-PAPEL\n3-TESOURA:\n"); scanf("%d", &n); }while(n<1 || n>3); if (n==1) { printf("Você escolheu Pedra"); } if (n==2) { printf("Você escolheu Papel"); } if (n==3) { printf("Você escolheu Tesoura"); } switch(bot) { case 1: printf("\nO bot escolheu Pedra"); break; case 2: printf("\nO bot escolheu Papel"); break; case 3: printf("\nO bot escolheu Tesoura"); break; } if ((n==1 && bot==3) || (n==2 && bot==1) || (n==3 && bot== 2)) { printf("\nVocê Venceu!\n"); } if (n == bot) { printf("\nEmpate!\n"); } if ((n==1 && bot==2) || (n==2 && bot==3) || (n==3 && bot== 1)) { printf("\nO bot venceu!\n"); } return 0; }
38e0d2f63be4b6d128ccb393b3e4fdd17a8cb07f
398840f07de3cbe3c05de22bbfdfa5e1772c5883
/ma.c
a7865ddbd3ccd6f71fa169bc43cd5868a369f2bc
[]
no_license
Request2609/shu_ju_jie_gou
89a1fd71c599fdb223685db3242245022f67341d
f9d775fc761bf44aefb110fcfdfa6adc3726e6f4
refs/heads/master
2020-03-28T19:44:36.634158
2019-03-25T08:07:40
2019-03-25T08:07:40
null
0
0
null
null
null
null
UTF-8
C
false
false
320
c
ma.c
/************************************************************************* > File Name: ma.c > Author: > Mail: > Created Time: Mon 08 Oct 2018 06:54:32 AM PDT ************************************************************************/ #include<stdio.h> #include<stdlib.h> typedef struct node{ }; int main(){ }
708ea159e1b95096791ea0d340d4382cc938e30d
aeb8302deb7f2240ef150d833515f26e82f4d692
/Temp/il2cppOutput/il2cppOutput/UnityEngine_UnityEngine_WebCamDeviceMethodDeclarations.h
25aca18908682a07707c37a8803ada6d41f4e19f
[]
no_license
AlvianPrasetya/TwistedMaze
4f8ad5dbf10590d90bc4bda4f88607d6bc562bb8
ddf046f1d9acb4ba8335efcd5acde787e66a6434
refs/heads/master
2021-01-13T00:50:20.752597
2015-12-15T09:12:32
2015-12-15T09:12:32
47,547,689
1
0
null
null
null
null
UTF-8
C
false
false
912
h
UnityEngine_UnityEngine_WebCamDeviceMethodDeclarations.h
#pragma once #include <stdint.h> #include <assert.h> #include <exception> #include "codegen/il2cpp-codegen.h" // UnityEngine.WebCamDevice struct WebCamDevice_t180; struct WebCamDevice_t180_marshaled; // System.String struct String_t; // System.String UnityEngine.WebCamDevice::get_name() extern "C" String_t* WebCamDevice_get_name_m920 (WebCamDevice_t180 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean UnityEngine.WebCamDevice::get_isFrontFacing() extern "C" bool WebCamDevice_get_isFrontFacing_m921 (WebCamDevice_t180 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; void WebCamDevice_t180_marshal(const WebCamDevice_t180& unmarshaled, WebCamDevice_t180_marshaled& marshaled); void WebCamDevice_t180_marshal_back(const WebCamDevice_t180_marshaled& marshaled, WebCamDevice_t180& unmarshaled); void WebCamDevice_t180_marshal_cleanup(WebCamDevice_t180_marshaled& marshaled);
f2b4b64d8326582bc09092df86eae05919cac2cd
d2d9ebc032f26f54b08ac3f35e3777e3a3ef68f6
/quickfeather/source/qorc-sdk/Tasks/ADC/inc/ql_adcTask.h
1f660df85139673da9861dc8d015fecb1621549a
[ "Apache-2.0", "MIT" ]
permissive
rahmant3/polymath-iot
9976d09ad5b2f0287d9d91b07fea193c34f153e6
2bfa10f763d4d612a850413599bb4e76471426c7
refs/heads/develop
2023-04-26T03:27:19.844781
2021-05-31T05:23:52
2021-05-31T05:23:52
326,521,284
0
0
MIT
2021-05-31T03:58:15
2021-01-03T23:29:52
Verilog
UTF-8
C
false
false
4,928
h
ql_adcTask.h
/*========================================================== * Copyright 2020 QuickLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *==========================================================*/ #ifndef __QL_ADCTASK_H_ #define __QL_ADCTASK_H_ #if !defined( _EnD_Of_Fw_global_config_h ) #error "Include Fw_global_config.h first" #endif #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include "FreeRTOS.h" #include "task.h" #include <queue.h> #include "common.h" #include "test_types.h" #include "eoss3_hal_fpga_adc_api.h" /* sensor control functions */ /* return TRUE if the task is running and collecting data */ int sensor_adc_fpga_is_running( void ); /* clear sensor configuration */ void sensor_adc_fpga_clear(void); // verify the fpga is present for this fpga bool sensor_is_adc_fpga_present( uint32_t sensorid ); /* configure the sensor based content of 'ltc1859_task_config' */ void sensor_adc_fpga_configure(void); /* start or stop the LTC1859 sensor */ void sensor_adc_fpga_startstop( int is_start ); /* Last known configuration of the sensor */ extern HAL_ADC_FPGA_cfg_t adc_fpga_task_config; //Analog channel type #define LTC1859_SINGLE_ENDED 1 //Single Ended configuration #define LTC1859_DIFFERENTIAL 0 //Differential configuration #define LTC1859_SINGLE_DIFF_CHANNEL_CONFIG LTC1859_SINGLE_ENDED //Current configuration #define LTC1859_CH0_ADDR ((0x0) | (LTC1859_SINGLE_DIFF_CHANNEL_CONFIG << 3)) #define LTC1859_CH1_ADDR ((0x1) | (LTC1859_SINGLE_DIFF_CHANNEL_CONFIG << 3)) #define LTC1859_CH2_ADDR ((0x2) | (LTC1859_SINGLE_DIFF_CHANNEL_CONFIG << 3)) #define LTC1859_CH3_ADDR ((0x3) | (LTC1859_SINGLE_DIFF_CHANNEL_CONFIG << 3)) /* * If the sensor is "running" this points to current data. * meaning: An array of uint16_t values representing each enabled channel. * * The purpose is so that debug code can reasonably display live sensor data on a terminal screen. */ extern const uint16_t *ltc1859_watch_data; extern const uint16_t *ad7476_watch_data; #define LTC1859_UNIPOLAR 1 #define LTC1859_BIPOLAR 0 #define LTC1859_POLARITY LTC1859_BIPOLAR //Current configuration #define LTC1859_RANGE5V 0 #define LTC1859_RANGE10V 1 #define LTC1859_GAIN LTC1859_RANGE5V //Current configuration for gain. #define LTC1859_NAP 0 #define LTC1859_SLEEP 0 //Current configuration for power mode. Always set it to 0. We dont support low power configuration. #define LTC1859_POWER_DOWN_MODE ((LTC1859_NAP << 1) | (LTC1859_SLEEP << 0)) #define LTC1859_CHANNEL_NUM_BITS_POS 4 #define LTC1859_POLARITY_BIT_POS 3 #define LTC1859_GAIN_BIT_POS 2 #define LTC1859_POWER_MODE_BIT_POS 0 //Refer LTC185x Datasheet.pdf page no. 15 for descrption of various fields. #define LTC1859_CHANNEL_0_COMMAND ((LTC1859_CH0_ADDR << LTC1859_CHANNEL_NUM_BITS_POS) |\ (LTC1859_POLARITY << LTC1859_POLARITY_BIT_POS) |\ (LTC1859_GAIN << LTC1859_GAIN_BIT_POS) |\ (LTC1859_POWER_DOWN_MODE << LTC1859_POWER_MODE_BIT_POS)) #define LTC1859_CHANNEL_1_COMMAND ((LTC1859_CH1_ADDR << LTC1859_CHANNEL_NUM_BITS_POS) |\ (LTC1859_POLARITY << LTC1859_POLARITY_BIT_POS) |\ (LTC1859_GAIN << LTC1859_GAIN_BIT_POS) |\ (LTC1859_POWER_DOWN_MODE << LTC1859_POWER_MODE_BIT_POS)) #define LTC1859_CHANNEL_2_COMMAND ((LTC1859_CH2_ADDR << LTC1859_CHANNEL_NUM_BITS_POS) |\ (LTC1859_POLARITY << LTC1859_POLARITY_BIT_POS) |\ (LTC1859_GAIN << LTC1859_GAIN_BIT_POS) |\ (LTC1859_POWER_DOWN_MODE << LTC1859_POWER_MODE_BIT_POS)) #define LTC1859_CHANNEL_3_COMMAND ((LTC1859_CH3_ADDR << LTC1859_CHANNEL_NUM_BITS_POS) |\ (LTC1859_POLARITY << LTC1859_POLARITY_BIT_POS) |\ (LTC1859_GAIN << LTC1859_GAIN_BIT_POS) |\ (LTC1859_POWER_DOWN_MODE << LTC1859_POWER_MODE_BIT_POS)) #define LTC1859_ADC_SAMPLE_FREQ_16K 16000 // ADC sampling frequency 16000Hz #define LTC1859_ADC_SAMPLE_FREQ_100K 100000 // ADC sampling frequency 100000Hz #define LTC1859_EN_ALL_ADC_CHNLS 0xFF // If all ADC channels need to be enabled signed portBASE_TYPE StartRtosTaskADC(void); #endif //__QL_AUDIOTASK_H_
2ee781721f654b4d233005ea5f33936481ea69a4
b6a26569f334ba847e474427ecf81b50b0362cea
/Intel/ServerSiliconPkg/Include/Guid/SgxInitData.h
4aa9853bc77ab490a5a8f5cafe0f2f3b18c55c91
[]
no_license
marktsai0316/Transformer
fd553728daa5aaa5b3f3fed9b9a2352d70dcd51c
e39ec3030ef0fd1841c6d916bdb77cddaaebc6ad
refs/heads/master
2022-12-10T22:30:54.984958
2020-09-10T05:55:24
2020-09-10T05:55:24
null
0
0
null
null
null
null
UTF-8
C
false
false
39,948
h
SgxInitData.h
/** @file Data structures used by SGX init flows @copyright INTEL CONFIDENTIAL Copyright 2017 - 2020 Intel Corporation. <BR> The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licensors. The Material may contain trade secrets and proprietary and confidential information of Intel Corporation and its suppliers and licensors, and is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without Intel's prior express written permission. No license under any patent, copyright, trade secret or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual property rights must be express and approved by Intel in writing. Unless otherwise agreed by Intel in writing, you may not remove or alter this notice or any other notice embedded in Materials by Intel or Intel's suppliers or licensors in any way. **/ #ifndef __SGX_INIT_DATA__ #define __SGX_INIT_DATA__ #include <Library/DebugLib.h> #include <Uefi/UefiBaseType.h> #include "SysHost.h" #define SGX_D_ERROR EFI_D_ERROR #define SGX_D_INFO EFI_D_VERBOSE #define SGX_D_VERBOSE EFI_D_VERBOSE #define SGX_DEBUG(Expression) \ do { \ DEBUG (Expression); \ } while (FALSE) // // Below SGX structures are based on MCHECK 2.4 SAS Platform Attestation document // // Size Transformation MAcros #define CONVERT_GB_TO_B(x) ((UINT64) ((UINT64)x << 30)) #define CONVERT_MB_TO_B 20 #define UEFI_CONVERT_B_TO_GB(x) ((UINT32) RShiftU64 (x, 30)) // MAX Values #define VALID_PRM_PER_IMC_COUNT_LCC 3 #define VALID_PRM_PER_IMC_0_LCC CONVERT_GB_TO_B(2) #define VALID_PRM_PER_IMC_1_LCC CONVERT_GB_TO_B(16) #define VALID_PRM_PER_IMC_2_LCC CONVERT_GB_TO_B(128) #define MIN_VALID_PRM_PER_DOMAIN CONVERT_GB_TO_B(2) #define MAX_VALID_PRM_PER_IMC CONVERT_GB_TO_B(128) #define MAX_PRMRR_COUNT 8 #define CURR_SUPPORTED_PRMRR_COUNT 8 #define MAX_CPU_SUPPORTED_SGX 4 #define SGX_MCHECK_MAX_PACKAGE 8 #define SGX_MCHECK_MAX_KEYS 32 #define SGX_MCHECK_MAX_P2P_LINKS 7 #define SGX_SUPPORTED_MEM_TYPES 1 #define SGX_MCHECK_SUPPORTED_PACKAGES 4 // Other #define PROCESSOR_AS_PBSP_BIT BIT3 #define B_TME_ACTIVATE_ENABLE BIT1 #define SHA256_DIGEST_SIZE 32 #define SHA3072_DIGEST_SIZE 384 #define AES128_KEY 16 #define UUID_BYTES_SIZE 16 #define EPOCH_SIZE 32 #define SGX_4K 4096 #define INDENTATION_OFFSET 2 #define SECURITY_PROPERTIES_TEM_SUPPORTED 0x10000 #define EPC_ENABLE BIT0 #define LOW_EPC_SHIFT 12 #define HIGH_EPC_SHIFT 32 #define SGX_SERVER_URL_LENGTH 256 // Versions #define SGX_STRUCTURE_VERSION_1 1 // ICX, ICX-D #define SGX_STRUCTURE_VERSION_2 2 // SPR #define SGX_REGISTRATION_HEADER_VERSION 1 #define SGX_REGISTRATION_MANIFEST_HEADER_VERSION 2 // 2 manifests CCB // SAI - Security Atributes of the Initiator #define SGX_SAI_RAC 0 #define SGX_SAI_WAC 1 #define SGX_SAI_CP 2 // Other Guids extern EFI_GUID gEfiHashAlgorithmSha256Guid; // DEBUG #define SGX_DEBUG_RESTORE_KEY_BLOBS_FROM_REGISTRATION_PACKAGE_INFO 0 #pragma pack(1) typedef enum { McheckRegularBoot = 0, McheckFirstPlatformBinding = 1, McheckTcbRecovery = 2, McheckAddingNewPackages = 3, McheckInvalid = 0xFF } SGX_MCHECK_SCENARIO; // Internal to BIOS / System Firmware typedef enum { SgxNormalBoot, SgxFirstBinding, SgxTcbRecovery, SgxAddPackageBoot, SgxAddPackageReboot, SgxDisabled } SGX_UEFI_BOOT_SCENARIO; // HOB SGX internal interface extern EFI_GUID gSgxInitDataHobGuid; #define SGX_INIT_DATA_HOB_GUID { 0x4EF0BEDC, 0xC5C1, 0x4E69, { 0x82, 0x18, 0x7D, 0xBE, 0x8A, 0x60, 0x68, 0x8C } } extern EFI_GUID gSgxPreMemInitHobGuid; #define SGX_INIT_PREMEM_DATA_HOB { 0x9A9E2225, 0xE026, 0x4BFF, { 0x99, 0x17, 0xF1, 0x23, 0xE1, 0xD4, 0x3A, 0xD5 } } // // NVRAM SGX internal interface // part of: SGX_MCHECK_BIOS_PARAM_INFO BiosParamInfo->PlatformManifest // part of: SGX_MCHECK_BIOS_PARAM_INFO BiosParamInfo->SocketData[Index].KeyBlob // #define SGX_UEFIFW_NONVOLATILVE_REGISTRATION_STATE_VARIABLE_NAME L"SgxRegistrationState" #define SGX_UEFIFW_KEY_BLOB_VARIABLE_NAME L"SgxKeyBlobs" #define SGX_UEFIFW_PLATFORM_MANIFEST_VARIABLE_NAME L"SgxPlatformManifest" extern EFI_GUID gSgxUefiFwRegistrationStateVariableGuid; extern EFI_GUID gSgxUefiFwKeyBlobsVariableGuid; extern EFI_GUID gSgxUefiFwPlatformManifestVariableGuid; // // SGX OS Agent external interface // #define SGX_REGISTRATION_CONFIG_VARIABLE_NAME L"SgxRegistrationConfiguration" #define SGX_REGISTRATION_REQUEST_VARIABLE_NAME L"SgxRegistrationServerRequest" #define SGX_REGISTRATION_PACKAGE_INFO_VARIABLE_NAME L"SgxRegistrationPackageInfo" #define SGX_REGISTRATION_RESPONSE_VARIABLE_NAME L"SgxRegistrationServerResponse" #define SGX_REGISTRATION_STATUS_VARIABLE_NAME L"SgxRegistrationStatus" #define SGX_UEFI_REGISTRATION_CONFIG_VARIABLE_NAME L"SgxUefiRegistrationConfiguration" #define SGX_UEFI_REGISTRATION_REQUEST_VARIABLE_NAME L"SgxUefiRegistrationServerRequest" #define SGX_UEFI_REGISTRATION_RESPONSE_VARIABLE_NAME L"SgxUefiRegistrationServerResponse" #define SGX_UEFI_REGISTRATION_STATUS_VARIABLE_NAME L"SgxUefiRegistrationStatus" #define SGX_LEGACY_REGISTRATION_SW_GUARD_STATUS_VARIABLE_NAME L"SOFTWAREGUARDSTATUS" #define SGX_LEGACY_REGISTRATION_EPC_BIOS_VARIABLE_NAME L"EPCBIOS" #define SGX_LEGACY_REGISTRATION_EPC_SW_VARIABLE_NAME L"EPCSW" // Registration Protocol Variables UUID extern EFI_GUID gSgxRegistrationConfigVariableGuid; extern EFI_GUID gSgxRegistrationServerRequestVariableGuid; extern EFI_GUID gSgxRegistrationPackageInfoVariableGuid; extern EFI_GUID gSgxRegistrationServerResponseVariableGuid; extern EFI_GUID gSgxRegistrationStatusVariableGuid; // Backup Registration Protocol Variables UUID in Flash extern EFI_GUID gSgxUefiRegistrationConfigVariableGuid; extern EFI_GUID gSgxUefiRegistrationServerRequestVariableGuid; extern EFI_GUID gSgxUefiRegistrationServerResponseVariableGuid; extern EFI_GUID gSgxUefiRegistrationStatusVariableGuid; // Other Registration Variables UUID extern EFI_GUID gSgxRegistrationServerInfoGuid; // Legacy Registration Variables UUID extern EFI_GUID gSgxLegacyRegistrationSoftwareGuardStatusVariableGuid; extern EFI_GUID gSgxLegacyRegistrationEpcBiosVariableGuid; extern EFI_GUID gSgxLegacyRegistrationEpcSwVariableGuid; #define SGX_MCHECK_BIOS_PARAM_INFO_UUID { 0x13, 0x43, 0xF1, 0x5C, 0xAA, 0x00, 0x42, 0x07, 0xA2, 0x14, 0xA8, 0x4F, 0x35, 0x58, 0x22, 0xA2} #define SGX_MCHECK_KEY_BLOB_UUID { 0x2E, 0xCF, 0x43, 0xFD, 0x61, 0x4E, 0x4F, 0x94, 0x98, 0x2C, 0xDF, 0x36, 0x10, 0xF4, 0x3A, 0x9D} #define SGX_MCHECK_MEMBERSHIP_CERTIFICATE_UUID { 0xEB, 0xBD, 0x00, 0xC0, 0xEF, 0x90, 0x49, 0x10, 0xA4, 0x80, 0xF7, 0x72, 0xE7, 0x35, 0x5D, 0xB4} #define SGX_REGISTRATION_ADD_REQUEST_UUID { 0x69, 0x65, 0x19, 0xCA, 0x73, 0xC1, 0x47, 0x85, 0xA0, 0xF6, 0x4D, 0x28, 0x9D, 0x37, 0xE9, 0x95} // // typedef union { UINT8 Uuid[16]; UINT64 Uuid64[2]; } SGX_UUID; typedef struct { SGX_UUID Uuid; //MSB UINT16 Size; //LSB UINT16 Version; //LSB UINT8 Reserved[12]; } SGX_HEADER; typedef struct { UINT8 Modulus[SHA3072_DIGEST_SIZE]; UINT32 PubExp; } SGX_MCHECK_PUBKEY; typedef struct { SGX_HEADER Header; UINT8 CpuSvn; SGX_UUID Prid; SGX_UUID PlatformInstanceId; UINT8 PlatformEpoch[EPOCH_SIZE]; SGX_MCHECK_PUBKEY Prsk; //Public Key SGX_MCHECK_PUBKEY Rsak; //Public Key UINT8 Signature[SHA3072_DIGEST_SIZE]; } SGX_MCHECK_PLATFORM_MEMBERSHIP_CERTIFICATE; typedef struct { SGX_HEADER Header; UINT8 RsName[SHA256_DIGEST_SIZE]; SGX_MCHECK_PUBKEY Rsak; //Public Key SGX_MCHECK_PUBKEY Rsek; //Public Key UINT8 Signature[SHA3072_DIGEST_SIZE]; } SGX_MCHECK_REGISTRATION_SERVER_ID; typedef struct { SGX_HEADER Header; SGX_UUID PlatformInstanceId; SGX_MCHECK_PUBKEY Rsak; //Public Key UINT8 PlatformEpoch[EPOCH_SIZE]; UINT32 SecurityProperties; UINT32 PackageCount; } SGX_MCHECK_PLATFORM_INFO; typedef struct { SGX_HEADER Header; UINT32 KeySlotCount; UINT32 KeyCount; UINT8 CpuSvn; SGX_UUID Prid; UINT8 PlatformInfoHash[SHA256_DIGEST_SIZE]; UINT8 EncWrapKey[SHA3072_DIGEST_SIZE]; UINT8 PprResetKey[SGX_MCHECK_MAX_KEYS][AES128_KEY]; UINT8 Signature[SHA3072_DIGEST_SIZE]; } SGX_MCHECK_ENCRYPTED_PLATFORM_KEYS; typedef struct { SGX_HEADER Header; UINT8 CpuSvn; SGX_UUID Prid; UINT8 PlatformInfoHash[SHA256_DIGEST_SIZE]; SGX_UUID TargetPrid[SGX_MCHECK_MAX_P2P_LINKS]; SGX_MCHECK_PUBKEY TargetPrsk[SGX_MCHECK_MAX_P2P_LINKS]; UINT8 Signature[SHA3072_DIGEST_SIZE]; } SGX_MCHECK_PAIRING_RECEIPT; typedef struct { SGX_HEADER Header; SGX_MCHECK_PLATFORM_INFO PlatformInfo; SGX_MCHECK_ENCRYPTED_PLATFORM_KEYS EncryptedKeys; SGX_MCHECK_PAIRING_RECEIPT Receipt[SGX_MCHECK_MAX_PACKAGE]; } MCHECK_SGX_PLATFORM_MANIFEST; typedef struct { SGX_HEADER Header; UINT8 CpuSvn; UINT32 SecurityProperties; UINT8 Reserved1[11]; SGX_UUID Prid; UINT8 PlatformEpoch[EPOCH_SIZE]; UINT8 RsakHash[SHA256_DIGEST_SIZE]; UINT8 Pfk1[AES128_KEY]; UINT8 PprResetKey[SGX_MCHECK_MAX_KEYS][AES128_KEY]; UINT8 LastUsedSvn; UINT8 Reserved2[15]; SGX_UUID TargetPrid[SGX_MCHECK_MAX_P2P_LINKS]; SGX_UUID MasterComms[SGX_MCHECK_MAX_P2P_LINKS]; UINT8 Iv[SGX_MCHECK_MAX_KEYS][12];//IV for different components of the structure UINT8 Mac[SGX_MCHECK_MAX_KEYS][16];//MAC for different components of the structure UINT8 IvComm[12];//IV for MasterCommsKeys UINT8 MacComm[16];//MAC for MasterCommsKeys } SGX_MCHECK_KEY_BLOB; typedef struct { SGX_MCHECK_KEY_BLOB KeyBlob; EFI_TIME TimeStamp; BOOLEAN Present; } SGX_UEFIFW_KEY_BLOB; typedef struct { SGX_MCHECK_PLATFORM_MEMBERSHIP_CERTIFICATE PlatformMembershipCertificate; BOOLEAN Present; } SGX_UEFIFW_PLATFORM_MEMBERSHIP_CERTIFICATE; typedef struct { VOID *Address; UINT64 Size; } SGX_MCHECK_BUFFER; #define FLAGS_BLOB_IN_BIT BIT0 #define FLAGS_BLOB_OUT_BIT BIT1 typedef struct { UINT64 Flags; SGX_MCHECK_BUFFER KeyBlob; // SGX_MCHECK_KEY_BLOB SGX_MCHECK_BUFFER Certificate; // SGX_MCHECK_PLATFORM_MEMBERSHIP_CERTIFICATE UINT8 Reserved[24]; } SGX_MCHECK_SOCKET_DATA; typedef struct { UINT8 CpuSvn; UINT8 MasterId; UINT8 NodeIds[8]; // Node ID is used to identify the package in the UPI communication UINT8 Reserved[22]; SGX_UUID Prids[SGX_MCHECK_MAX_PACKAGE]; } SGX_MCHECK_TOPOLOGY_INFO; typedef struct { SGX_HEADER Header; SGX_MCHECK_TOPOLOGY_INFO TopologyInfo; UINT8 Scenario; UINT8 NumSockets; UINT32 SecurityProperties; UINT8 Reserved[10]; SGX_MCHECK_BUFFER RegistrationServer; // SGX_REGISTRATION_SERVER_INFO SGX_MCHECK_BUFFER PlatformManifest; // MCHECK_SGX_PLATFORM_MANIFEST SGX_MCHECK_BUFFER WorkingArea; SGX_MCHECK_SOCKET_DATA SocketData[SGX_MCHECK_MAX_PACKAGE]; } SGX_MCHECK_BIOS_PARAM_INFO; // // SGX Multi-Package Registration UEFI Interface // typedef struct { SGX_HEADER Header; UINT16 UrlSize; UINT8 Url[SGX_SERVER_URL_LENGTH]; SGX_MCHECK_REGISTRATION_SERVER_ID RegServerId; } SGX_REGISTRATION_SERVER_INFO; typedef struct { UINT16 Version; UINT16 Size; } SGX_REGISTRATION_HEADER; #define RS_SAVES_ENCRYPTED_KEYS_TRUE 0 #define RS_SAVES_ENCRYPTED_KEYS_FALSE 1 typedef struct { SGX_REGISTRATION_HEADER Header; struct { UINT16 RSsavesEncryptedKeys : 1; UINT16 Reserved : 15; } Flags; SGX_REGISTRATION_SERVER_INFO SgxRegServerInfo; } SGX_REGISTRATION_CONFIG; // // // UEFIFW version of PLATFORM_MANIFEST for SgxRegistrationRequest with registration variable HEADER typedef struct { SGX_REGISTRATION_HEADER Header; MCHECK_SGX_PLATFORM_MANIFEST McheckPlatformManifestIpe; // Initial Platform Establishment MCHECK_SGX_PLATFORM_MANIFEST McheckPlatformManifestTr; // TCB Recovery } SGX_UEFI_REGISTRATION_PLATFORM_MANIFEST; typedef struct { SGX_HEADER Header; UINT8 CpuSvn; UINT16 NumPackages; SGX_UUID PlatformInstanceId; SGX_UUID Prid[SGX_MCHECK_MAX_PACKAGE]; SGX_UUID Reserved; } SGX_REGISTRATION_ADD_REQUEST; // UEFIFW version of ADD_REQUEST for SgxRegistrationRequest with registration variable HEADER typedef struct { SGX_REGISTRATION_HEADER Header; SGX_REGISTRATION_ADD_REQUEST AddRequest; } SGX_UEFI_REGISTRATION_ADD_PACKAGE; typedef union { SGX_UEFI_REGISTRATION_PLATFORM_MANIFEST PlatformManifest; SGX_UEFI_REGISTRATION_ADD_PACKAGE AddPackage; } SGX_REGISTRATION_REQUEST; typedef struct { SGX_REGISTRATION_HEADER Header; SGX_MCHECK_KEY_BLOB KeyBlobs[SGX_MCHECK_MAX_PACKAGE]; } SGX_REGISTRATION_PACKAGE_INFO; typedef struct { SGX_REGISTRATION_HEADER Header; SGX_MCHECK_PLATFORM_MEMBERSHIP_CERTIFICATE PlatformMembershipCertificate[SGX_MCHECK_MAX_PACKAGE]; } SGX_REGISTRATION_RESPONSE; typedef enum { // RS_SUCCESS RS_SUCCESS = 0x00, // RS_PREMEM_GROUP RS_PREMEM_OTHER = 0x10, RS_PREMEM_NOMEM = 0x11, RS_PREMEM_SYS_NOT_CAPABLE = 0x12, RS_PREMEM_NO_VALID_PRMRR = 0x13, RS_PREMEM_HW_NOT_CAPABLE = 0x14, RS_PREMEM_TME_DISABLED = 0x15, RS_PREMEM_SGX_DISABLED = 0x16, RS_PREMEM_INVALID_PRRMR_SIZE = 0x17, RS_PREMEM_PRMRR_NOT_SECURED = 0x18, RS_PREMEM_MEM_TOPOLOGY_ERR = 0x19, // RS_POSTMEM_GROUP RS_POSTMEM_OTHER = 0x20, RS_POSTMEM_NOMEM = 0x21, RS_POSTMEM_SYSHOST_NOTFOUND = 0x22, RS_POSTMEM_MMAP_HOST_NOTFOUND = 0x23, RS_POSTMEM_VSPPI_NOTFOUND = 0x24, RS_POSTMEM_MRCHCSPPI_NOTFOUND = 0x25, RS_POSTMEM_SVN_ERR = 0x26, RS_POSTMEM_REGVARS_ERR = 0x27, RS_POSTMEM_KEYBLOBS_RES_ERR = 0x28, RS_POSTMEM_PRID_UNLOCK_ERR = 0x29, RS_POSTMEM_DETERMINE_BOOT_ERR = 0x2A, RS_POSTMEM_FIRSTBOOT_ERR = 0x2B, RS_POSTMEM_WARMRESET_ERR = 0x2C, // RS_LATEINIT_GROUP RS_LATEINIT_OTHER = 0x30, RS_LATEINIT_TRIGCALLBACK_ERR = 0x31, RS_LATEINIT_HOBLIST_NOTFOUND = 0x32, RS_LATEINIT_MPSVC_ERR = 0x33, RS_LATEINIT_INITDATAHOB_RES = 0x34, RS_LATEINIT_UPDTCAPAB_ERR = 0x35, RS_LATEINIT_UPDTPRMRR_ERR = 0x36, RS_LATEINIT_CRDIMM_ERR = 0x37, RS_LATEINIT_UPDTLEWR_ERR = 0x38, RS_LATEINIT_SYS_NOT_CAPABLE = 0x39, RS_LATEINIT_SGX_DISABLED = 0x3A, RS_LATEINIT_FACTORY_RESET_ERR = 0x3B, RS_LATEINIT_NVSAREA_ERR = 0x3C, RS_LATEINIT_GET_NVVAR_ERR = 0x3D, RS_LATEINIT_EXPOSE_PROTO_ERR = 0x3E, RS_LATEINIT_LOCKVARS_ERR = 0x3F, RS_LATEINIT_VAR_ROTO_ERR = 0x40, // RS_LATE_INIT_CALLBACK_GROUP RS_LATEINIT_CALLBACK_OTHER = 0x50, RS_LATEINIT_CALLBACK_NOMEM = 0x51, RS_LATEINIT_CALLBACK_BIOSPARAM_ERR = 0x52, RS_LATEINIT_CALLBACK_UCODE_LAUNCH_ERR = 0x53, RS_LATEINIT_CALLBACK_UPDT_TIMESTMP_ERR = 0x54, RS_LATEINIT_CALLBACK_UPDT_PKG_INFO_ERR = 0x55, RS_LATEINIT_CALLBACK_LAUNCHCTRL_ERR = 0x56, RS_LATEINIT_CALLBACK_UPDT_KEYBLOBS_ERR = 0x57, RS_LATEINIT_CALLBACK_TCBRECOVERY_ERR = 0x58, RS_LATEINIT_CALLBACK_STORPLATMANIF_ERR = 0x59, RS_LATEINIT_CALLBACK_LEGACYVARS_ERR = 0x5A, RS_LATEINIT_CALLBACK_REGSTATE_VAR_ERR = 0x5B, // RS_MCHECK_GROUP RS_MCHECK_BEGIN = 0x70, RS_MCHECK_END = 0x7F } SGX_ERROR_CODE_ENUM; typedef union { struct { UINT8 RegistrationErrorCode : 7; UINT8 SourceOfErrorCode : 1; } ErrorCodeFields; UINT8 ErrorCode; } SGX_ERROR_CODE; typedef struct { SGX_REGISTRATION_HEADER Header; struct { UINT16 SgxRegistrationComplete : 1; UINT16 SgxPackageInfoReadComplete : 1; UINT16 Reserved : 14; } Status; SGX_ERROR_CODE ErrorCode; } SGX_REGISTRATION_STATUS; // // // /// /// EPC data structure for BIOS Variable /// typedef struct _EPC_BIOS_CONFIG { UINT32 SupportedPrmBins; ///< supported EPC bins; Bit 0- Support for 1 MB, 1- Support for 2 MB, 2- Support for 4 MB, UINT32 MaxEpcSize; ///< Maximum EPC size supported by platform in MB UINT32 AllocatedEpcSize; ///< Allocated EPC size in MB UINT32 EpcMap[32]; ///< Mapping of PRM size to corresponding EPC size } EPC_BIOS_CONFIG; /// /// EPC data structure for OS Variable /// typedef struct { UINT32 RequestedEpcSize; ///< Requested EPC size in MB } EPC_OS_CONFIG; /// /// Data structure for SGX Policy Status /// The presence of this variable implies that SGX is supported /// For backward compatibility: /// Absence of this variable implies that SGX is supported and defaulted to 'Software Controlled' /// typedef struct { /** Bitmap of SGX Policy setting - BIT[1:0]: SgxStatus - 00b = Disabled. - 01b = Enabled. - 10b = Software Controlled. - 11b = Reserved. **/ UINT8 SgxStatus:2; UINT8 Reserved:6; ///< Reserved 6 bits } SOFTWARE_GUARD_STATUS; #pragma pack() // //SGX_TODO: Remove all hardcoded registration server data when //MCHECK populate it by default and after PowerOn [Begin] // #define SGX_MCHECK_REGISTRATION_SERVER_UUID { 0x31, 0xA1, 0x2A, 0xFE, 0x07, 0x20, 0x4E, 0xBC, 0xB6, 0x4E, 0xC4, 0xB3, 0xC7, 0xF8, 0xBC, 0x0F } #define SGX_MCHECK_SERVER_URL "https://pre.api.trustedservices.intel.com:443" #define SGX_MCHECK_SBX_SERVER_URL "https://sbx.api.trustedservices.intel.com:443" #define SGX_MCHECK_SERVER_RSNAME \ { \ 0x5E306161EA7257AF\ ,0x337B416B89177A10\ ,0x5D3ECB09435253C5\ ,0xCF8F292FD10BD407\ } #define SGX_MCHECK_SERVER_RSAK\ {\ 0x7FC1B9FDCA250CCB\ ,0x72EF96645F6E7CC1\ ,0xBBB59C19AF2C3876\ ,0x5255F3E36D18E33C\ ,0x717587CBAC1737ED\ ,0xDE4A25A3F64A6326\ ,0x35A4EEC1346CA4ED\ ,0x7FE57CB012D42F6A\ ,0xA29B3D5BBD493726\ ,0xA19D9CEDBADB51ED\ ,0xC12D43312DAD4E10\ ,0x16C675DB82E7049B\ ,0xCE9053DB862E0C85\ ,0x5D887A6CDD726294\ ,0x3D9C71CC1B7A4039\ ,0x675AD89FA26BA305\ ,0xB6B543B9B826CD0B\ ,0x413559AE21FE92DF\ ,0xD09DB753DAF1C33D\ ,0x95C855F27DBB0A73\ ,0x6D95F49032F878A5\ ,0x8847EF7F362E0FD5\ ,0xBE452C79744AF26E\ ,0xC0474AC3FFC2A51F\ ,0x5563B92FE57BF412\ ,0x51AB6345BA3C9832\ ,0xAB64AE51696AB37B\ ,0x74A9838EDD1919A7\ ,0xF689B82F5A785A64\ ,0x1F1FB1D2AE6D05DC\ ,0x9D51BB1D819E97DC\ ,0x6A0384654A15C9A7\ ,0x1286EBE126E2C644\ ,0x252E2C248DA6EDD1\ ,0xD7C4782F447444B6\ ,0x7985E3901702AF29\ ,0x83E4EC0B84E70147\ ,0xB88864D36585B53B\ ,0x9C5D74F9CBD94AA4\ ,0x58A724BF0821A028\ ,0x19D0EFBD4A9624B2\ ,0xC4391E14E582DB41\ ,0x13285048CAA58A3D\ ,0x70C6363C17047EBB\ ,0xC86AE2E1636B086\ ,0xA299968C68F4A76D\ ,0x853224F91725B9A\ ,0xA2C071E50EC02B00\ } #define SGX_MCHECK_SERVER_RSAK_EXP 0x10001 #define SGX_MCHECK_SERVER_RSEK \ {\ 0x12CF4B066EF611A9\ ,0x56462E8BF6912264\ ,0x37218434859C086A\ ,0x791C47A05F19C3F4\ ,0xC9EA2A38BD33ACB2\ ,0x9ECF2D4E71D6C38D\ ,0x24BDCB2FB6C1FB27\ ,0xCCF89806554279B0\ ,0x6AAEBCBC9FE41521\ ,0x3662718AD9534060\ ,0xD83D7A2E9372370B\ ,0x710720FC74131841\ ,0xC79D33248B09487B\ ,0x98318536F3639EC8\ ,0x40009B1219E3D32A\ ,0x523687EE8FFF1F90\ ,0xA6F123DE0C53997B\ ,0xD25E1B3204C96CD1\ ,0xDF888BFBD4390D17\ ,0x59014905DEE99C30\ ,0x5A392B13D4ACC983\ ,0x113975B517A4FFDD\ ,0xD7135199CC4D22F8\ ,0x11260623F6456F19\ ,0x141DEDB7635EA914\ ,0xB0B75915ED9CCB42\ ,0x2E69A336D7098A47\ ,0xB94A269B91842E3\ ,0xC7DCEB17BD92FE08\ ,0x9A428C572046EE4A\ ,0xCFE5F13CC1725885\ ,0xD549B61E355DA2FB\ ,0x21EAD913BB59D98A\ ,0x81BD0273392E9F2A\ ,0x64BC60DBCA1FF8E9\ ,0x314A66385C04A935\ ,0xB251BB2981DD11F0\ ,0x53CEDDC7BA542A29\ ,0xD080C2311D95DDBA\ ,0x1F3845AD9AB7D91E\ ,0xF321E5953990CAE\ ,0x33AC6505AB7026CC\ ,0x30F272974621EA0A\ ,0x5FADDC2EA89DF681\ ,0x9C41476AD41256A9\ ,0xBF4F0B75144D69F6\ ,0x2867973B3431D699\ ,0xC01861FB28A1E859\ } #define SGX_MCHECK_SERVER_RSEK_EXP 0x10001 #define SGX_MCHECK_SERVER_SIGNATURE \ { \ 0xE0FD8D87C3EB078\ ,0x6C8767CC8A7D0DCF\ ,0x9A3AE4B9B1436597\ ,0x9DC26B8E35D9B4DC\ ,0xF2AEAEE51D0CDC27\ ,0x4B0AB935279A2C81\ ,0x16601D155BBA7956\ ,0x7AE9E766D76B7\ ,0x40907CC6DE564AD3\ ,0x1034972B21BAC8AC\ ,0x1645DF710E6AC18A\ ,0x54A50BB183E32F87\ ,0x30030F7C0FD6005A\ ,0x42E42F642F59AD2D\ ,0x6584B2B27050E258\ ,0x58535F029BE82A8C\ ,0x45505EBBFAF20EEE\ ,0x3ACD776D928771B3\ ,0x4AEA3C39134BC6EE\ ,0x35B41C423B25BABF\ ,0x9A72012DBED8BF1E\ ,0x50C07D858E4E0374\ ,0xD2CCB2D252F662F0\ ,0x26F3CA1927A0E4F4\ ,0x135B334763266E04\ ,0xBAE130B1DC1982C3\ ,0x23E0A9034B537BF9\ ,0x34FF383B9D14E9CA\ ,0x71FAB815DB94127C\ ,0xCD4B483DD7088754\ ,0xA4AF26F482D59A77\ ,0xD0A10A2913BBAEBC\ ,0xC05BC3C6453DE885\ ,0xE277FBB8A39DE7F3\ ,0xBB70E93D1B24FE6E\ ,0x8E3DFB6E51039B39\ ,0x842B17D08A501219\ ,0x28737CF0D9C498FC\ ,0x1E3070FDA4D251EA\ ,0x7605DB151FFDE715\ ,0xA38BB55A6AC1435\ ,0x4DE37643B0AC9F34\ ,0x53A9D0FCA4DE67F\ ,0x65C34DC42B63EA8E\ ,0xA4041A31A8AAAED2\ ,0xF1401C26A06CD7A1\ ,0x5D19FC52C18CEAE2\ ,0x13193555947F291C\ } #define SGX_SERVER_ID \ {\ 0x31, 0xa1, 0x2a, 0xfe, 0x07, 0x20, 0x4e, 0xbc, \ 0xb6, 0x4e, 0xc4, 0xb3, 0xc7, 0xf8, 0xbc, 0x0f, \ 0xa8, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x0f, 0xe4, 0x50, 0xdc, 0xfd, 0x28, 0x18, 0x26, \ 0x37, 0x6c, 0xe0, 0x5f, 0xde, 0x2c, 0xae, 0x99, \ 0x45, 0xdf, 0xf9, 0x5c, 0x9b, 0x3b, 0x32, 0x87, \ 0x9b, 0x98, 0xb2, 0x50, 0x85, 0x56, 0x4a, 0x88, \ 0x71, 0xd5, 0x42, 0xe3, 0x89, 0x3c, 0x9f, 0x6f, \ 0x88, 0xef, 0x99, 0x9a, 0x79, 0x69, 0xea, 0xcc, \ 0x38, 0xe1, 0x56, 0xd8, 0x23, 0x3e, 0x64, 0x79, \ 0x99, 0x7f, 0x6d, 0xaa, 0x35, 0x53, 0xd9, 0x02, \ 0xbb, 0x6a, 0x7f, 0xd6, 0xe6, 0xdb, 0x21, 0xc4, \ 0x3c, 0x13, 0x99, 0x3c, 0x91, 0xc2, 0xeb, 0x95, \ 0xb6, 0x65, 0x4b, 0x70, 0xd3, 0xe1, 0x60, 0x2d, \ 0x5c, 0x23, 0x6f, 0x9c, 0x5e, 0x82, 0x09, 0xa6, \ 0xa9, 0x92, 0x3f, 0x49, 0x62, 0x8e, 0xb7, 0xba, \ 0x93, 0x49, 0x13, 0xcc, 0xee, 0x4a, 0xe3, 0xdf, \ 0x1c, 0x9c, 0xe1, 0x1d, 0x0d, 0xac, 0x1c, 0x2e, \ 0x6e, 0xbb, 0xeb, 0x7b, 0x03, 0x6e, 0x12, 0x88, \ 0xad, 0x98, 0xd0, 0xaa, 0xc4, 0x4e, 0x5d, 0xbe, \ 0x3e, 0x01, 0xea, 0x40, 0xeb, 0x73, 0x01, 0xc5, \ 0x13, 0xc3, 0x88, 0xd7, 0xe8, 0x7b, 0x66, 0x30, \ 0xfc, 0xee, 0x23, 0xdc, 0xcc, 0x28, 0xe5, 0x46, \ 0x6a, 0x36, 0x69, 0x13, 0x7e, 0x79, 0x02, 0x1e, \ 0x38, 0x6d, 0xb7, 0x55, 0x69, 0x60, 0x6a, 0x48, \ 0x1a, 0xc8, 0x1b, 0xcd, 0x03, 0xfd, 0xc3, 0x0a, \ 0x14, 0x2b, 0xce, 0x8c, 0xca, 0x27, 0x4d, 0xc0, \ 0x44, 0xf2, 0xb4, 0x0d, 0xc9, 0xab, 0xae, 0xf9, \ 0x52, 0xbb, 0x4f, 0x0d, 0x01, 0x05, 0x8d, 0x59, \ 0x0d, 0x69, 0x50, 0xcd, 0x56, 0xbd, 0x03, 0x6c, \ 0x73, 0x85, 0x27, 0x27, 0x89, 0xe3, 0x8d, 0xe9, \ 0xb7, 0x30, 0x2f, 0xaf, 0xd5, 0x51, 0x42, 0x48, \ 0xde, 0x83, 0xc1, 0x8a, 0xed, 0xc9, 0xfb, 0x3c, \ 0x4a, 0x60, 0x75, 0x4b, 0x41, 0xd8, 0x03, 0x8b, \ 0xe2, 0xc8, 0x5d, 0x9e, 0x10, 0x97, 0x42, 0x45, \ 0x0b, 0x76, 0x98, 0x9f, 0xf2, 0x62, 0xcb, 0x0a, \ 0x7a, 0x97, 0x95, 0x46, 0x01, 0x8c, 0x7c, 0x76, \ 0x10, 0x9e, 0xc6, 0xdd, 0x79, 0x65, 0xee, 0xad, \ 0x46, 0x2b, 0xbd, 0x1e, 0xdf, 0x61, 0x24, 0xe4, \ 0xa7, 0xda, 0x00, 0xde, 0x49, 0x74, 0x08, 0xe4, \ 0x48, 0x69, 0x49, 0x61, 0x38, 0xcc, 0x13, 0x83, \ 0xf2, 0xca, 0xef, 0x7b, 0x6b, 0xf4, 0x56, 0xc1, \ 0xf4, 0x94, 0xc2, 0xb5, 0x39, 0xe1, 0x74, 0x1d, \ 0x90, 0x45, 0x15, 0x41, 0x48, 0x16, 0xa5, 0x09, \ 0x6e, 0x96, 0x35, 0x0b, 0x5d, 0xec, 0xc8, 0x4c, \ 0xdb, 0x9c, 0x29, 0xfe, 0x6f, 0xfa, 0x7a, 0x19, \ 0x82, 0xb5, 0x5f, 0xe6, 0xfb, 0x25, 0x8e, 0x18, \ 0xf0, 0x3c, 0x17, 0x24, 0xb2, 0x96, 0xaa, 0xb4, \ 0x46, 0xa9, 0xf4, 0xe1, 0x0d, 0xe1, 0xd4, 0x94, \ 0x85, 0xf4, 0x36, 0x0d, 0xfa, 0xde, 0x7b, 0xc6, \ 0xab, 0xf7, 0x0c, 0x0f, 0x1e, 0xd5, 0x9c, 0x15, \ 0xab, 0x30, 0xfa, 0xce, 0x19, 0xe3, 0xcf, 0xee, \ 0x43, 0xe1, 0xbe, 0xe2, 0xf2, 0x80, 0x00, 0x95, \ 0x57, 0x6a, 0xf5, 0x2b, 0x46, 0x34, 0x4e, 0xa4, \ 0xe7, 0xe0, 0x8c, 0x2b, 0xc1, 0xd5, 0x68, 0xdd, \ 0x01, 0x00, 0x01, 0x00, 0x53, 0x86, 0x5e, 0x87, \ 0x4b, 0x6c, 0x87, 0xac, 0x13, 0xa5, 0xc6, 0xfc, \ 0x78, 0x92, 0xd4, 0xd7, 0xf4, 0xeb, 0x09, 0x82, \ 0xd6, 0x26, 0xbb, 0xd5, 0xc6, 0x8b, 0xc8, 0xb3, \ 0xa5, 0x25, 0xa7, 0x98, 0x81, 0x5d, 0xe4, 0x07, \ 0x07, 0xd7, 0xbf, 0x43, 0x25, 0xfc, 0x10, 0x54, \ 0xe1, 0x21, 0x5b, 0x35, 0xae, 0xa8, 0xd0, 0x4e, \ 0x3a, 0xb6, 0x95, 0xd1, 0x23, 0xfb, 0x11, 0xa2, \ 0x15, 0xcd, 0x3b, 0x17, 0x40, 0x20, 0xb3, 0xdc, \ 0xab, 0xa8, 0x69, 0x92, 0x48, 0x77, 0x2e, 0xd5, \ 0x8c, 0xcd, 0x2f, 0x59, 0x15, 0x20, 0xbc, 0x74, \ 0xa6, 0xb3, 0xd7, 0x23, 0x46, 0xfb, 0x10, 0x3b, \ 0x1c, 0xe5, 0x4b, 0xc3, 0x31, 0xd2, 0x9c, 0xa6, \ 0x1d, 0x10, 0xa5, 0xe0, 0x27, 0x89, 0x36, 0x43, \ 0xe4, 0x1e, 0xd8, 0x23, 0x36, 0xc5, 0x5c, 0x3c, \ 0x73, 0x2f, 0x10, 0xfb, 0x4f, 0x1c, 0xd7, 0xd5, \ 0x6f, 0x25, 0x40, 0xf0, 0xa9, 0x74, 0xe9, 0xd4, \ 0xc1, 0xec, 0x3f, 0x99, 0x9b, 0x18, 0xfe, 0x61, \ 0x82, 0x37, 0xb6, 0xe6, 0x16, 0x33, 0x9f, 0x7f, \ 0x52, 0xcf, 0xa6, 0x83, 0xe9, 0xf9, 0x8b, 0xb6, \ 0x39, 0x42, 0xdb, 0x5b, 0xf5, 0x05, 0x11, 0x74, \ 0xa2, 0xde, 0x73, 0x0e, 0xcc, 0xba, 0x31, 0xbb, \ 0x7e, 0xfa, 0xfa, 0x5e, 0x75, 0x8c, 0x28, 0x33, \ 0x4b, 0xcc, 0x8a, 0x99, 0x07, 0x89, 0xa4, 0xd1, \ 0xf6, 0x7f, 0x92, 0xa2, 0x13, 0x49, 0x5e, 0x60, \ 0x7b, 0xf7, 0x60, 0xa3, 0x56, 0xa9, 0x37, 0xd5, \ 0xf3, 0xd7, 0xa9, 0x3d, 0x17, 0x8c, 0x93, 0xac, \ 0xa4, 0xfd, 0x02, 0x4d, 0x0e, 0x69, 0xdb, 0xf2, \ 0xab, 0x0a, 0xe8, 0x5d, 0x3b, 0xf7, 0x38, 0xe8, \ 0x29, 0xbd, 0x7d, 0xa6, 0xd0, 0xa2, 0xce, 0x59, \ 0x5c, 0x8a, 0x10, 0xe1, 0x86, 0x9b, 0x42, 0x32, \ 0xf6, 0x4d, 0xcc, 0x1b, 0xaa, 0x31, 0xde, 0x86, \ 0x4b, 0x18, 0xbc, 0x1e, 0x27, 0x13, 0x5e, 0x84, \ 0x8e, 0xf3, 0xeb, 0x24, 0xca, 0x35, 0xcd, 0xf8, \ 0xe2, 0xc5, 0x5c, 0x37, 0x30, 0x36, 0x1a, 0xba, \ 0x50, 0x65, 0xa2, 0xeb, 0x20, 0xf5, 0xeb, 0xc2, \ 0xf0, 0xc7, 0xfd, 0xd4, 0x7a, 0xa2, 0x1c, 0x31, \ 0xbb, 0xc6, 0x9e, 0x82, 0xcb, 0x09, 0x49, 0x5a, \ 0xa0, 0xdc, 0xff, 0xb3, 0x83, 0x1e, 0x5f, 0xa7, \ 0x9f, 0x35, 0xd6, 0x6a, 0xd9, 0x6a, 0xce, 0x75, \ 0x7e, 0x75, 0xed, 0x06, 0x86, 0x1b, 0xed, 0x0b, \ 0x35, 0xa3, 0x31, 0x35, 0x1b, 0x2f, 0xea, 0x04, \ 0x23, 0x0b, 0x0d, 0xf1, 0xd5, 0x61, 0x56, 0xea, \ 0xa1, 0x9a, 0xd0, 0x0c, 0xb4, 0xb2, 0x8b, 0xb7, \ 0x16, 0x93, 0xfd, 0x0b, 0xed, 0x35, 0x76, 0x7e, \ 0x3e, 0xf9, 0x40, 0x37, 0x81, 0x90, 0xce, 0x58, \ 0x26, 0x39, 0x03, 0x3f, 0xab, 0x28, 0x49, 0xee, \ 0x70, 0xeb, 0x9e, 0x97, 0x24, 0x6c, 0xab, 0x79, \ 0x38, 0xbb, 0x7e, 0x93, 0x01, 0x00, 0x01, 0x00, \ 0x44, 0x91, 0x62, 0xe4, 0x3c, 0xe4, 0xb9, 0x57, \ 0xb8, 0x70, 0x95, 0xe4, 0x84, 0x56, 0x2b, 0xfb, \ 0xa1, 0x8e, 0x80, 0x51, 0xcb, 0x47, 0xf4, 0xf2, \ 0x89, 0xcd, 0x67, 0xf1, 0x66, 0x8a, 0xbd, 0x66, \ 0x99, 0xef, 0x4b, 0xa9, 0x20, 0xd4, 0x8c, 0xd9, \ 0xf2, 0x1b, 0xfa, 0x94, 0x49, 0x90, 0x69, 0x52, \ 0x02, 0x92, 0xda, 0x8a, 0xe0, 0xe7, 0x24, 0x0f, \ 0x7f, 0xca, 0x73, 0x86, 0xf4, 0x0e, 0x45, 0x24, \ 0x13, 0xdc, 0xbe, 0xf8, 0x50, 0xee, 0x08, 0xf9, \ 0xb6, 0xab, 0x86, 0x93, 0x29, 0x5b, 0x0b, 0x2e, \ 0x12, 0x99, 0x8c, 0x77, 0x4b, 0x75, 0xa4, 0xc5, \ 0xa8, 0x4d, 0x56, 0xd0, 0xb6, 0x09, 0x9d, 0xef, \ 0x3e, 0x01, 0x92, 0x91, 0xa9, 0x5e, 0xaa, 0x7e, \ 0x94, 0x50, 0xb3, 0xcc, 0x19, 0xe0, 0x28, 0x6a, \ 0xd9, 0x2f, 0x2c, 0xbf, 0x40, 0xda, 0x8c, 0x12, \ 0x75, 0x4f, 0x95, 0x4f, 0x16, 0x2f, 0xed, 0xcc, \ 0xc7, 0x3f, 0x63, 0x75, 0xf9, 0x06, 0xa4, 0x7a, \ 0x3f, 0xc9, 0xf4, 0x7c, 0x2e, 0x7d, 0x02, 0xe5, \ 0xa0, 0x2c, 0xab, 0x3c, 0x5e, 0xd0, 0x20, 0xcb, \ 0x99, 0xd4, 0x41, 0x03, 0xab, 0x27, 0xf5, 0xa1, \ 0x70, 0xa1, 0xea, 0x73, 0x82, 0xd3, 0x04, 0xbd, \ 0xa6, 0x98, 0x5f, 0x21, 0x74, 0xee, 0xa0, 0xa2, \ 0x58, 0xdf, 0xd6, 0x82, 0x55, 0x5d, 0x32, 0x42, \ 0x0d, 0x5c, 0x90, 0xde, 0x3b, 0xcd, 0x68, 0xe9, \ 0x4f, 0xe6, 0xf7, 0x47, 0x4d, 0xaf, 0xfb, 0xd8, \ 0xad, 0xb5, 0x9f, 0xae, 0x2e, 0xd1, 0xb7, 0x59, \ 0x2e, 0x22, 0x43, 0xab, 0xfe, 0x44, 0x9a, 0xea, \ 0x27, 0x48, 0x9b, 0x1f, 0x5e, 0x3c, 0xf1, 0x54, \ 0xe7, 0xe7, 0x23, 0x85, 0x50, 0x7b, 0xa8, 0x26, \ 0xb4, 0x80, 0x34, 0xbf, 0x0f, 0xa3, 0xfa, 0xe8, \ 0x1f, 0x0f, 0x9e, 0x93, 0xad, 0x33, 0x71, 0x5a, \ 0x3d, 0xa6, 0x80, 0xdd, 0x0c, 0x81, 0x3f, 0x83, \ 0x56, 0x90, 0x78, 0x86, 0xb5, 0x04, 0x2a, 0x27, \ 0xb6, 0x56, 0x10, 0x6e, 0xa6, 0xe3, 0xe1, 0xb2, \ 0xad, 0x6b, 0x88, 0x3d, 0xa6, 0xa2, 0x2f, 0x20, \ 0x49, 0xc9, 0x3f, 0xfe, 0x1d, 0xd8, 0x68, 0xc1, \ 0xa2, 0xbc, 0xff, 0x65, 0x7f, 0x90, 0xa6, 0x96, \ 0x32, 0xe4, 0x1a, 0x51, 0x7f, 0xd3, 0x66, 0xb3, \ 0xa4, 0x95, 0x34, 0x0d, 0xc1, 0xd7, 0x8c, 0x75, \ 0x76, 0xd9, 0x1d, 0xed, 0x0b, 0x41, 0x40, 0x95, \ 0x75, 0x8f, 0x72, 0x6a, 0xf0, 0x8f, 0xb1, 0x63, \ 0xd2, 0xa8, 0x39, 0x03, 0x17, 0x71, 0x4d, 0x80, \ 0x17, 0x01, 0xef, 0x1e, 0x6b, 0x69, 0xaa, 0x73, \ 0x49, 0x24, 0xa6, 0xc1, 0xab, 0x97, 0x35, 0x96, \ 0xf1, 0xcb, 0x66, 0x30, 0x4d, 0x64, 0x15, 0xd5, \ 0x2a, 0x6c, 0x66, 0x34, 0x3d, 0x17, 0x17, 0x4e, \ 0xc2, 0xa0, 0x8f, 0x77, 0x86, 0x14, 0x20, 0x17, \ 0xfb, 0xed, 0x41, 0xed, 0x24, 0x96, 0xc8, 0x68 \ } // //SGX_TODO: Remove all hardcoded registration server data when //MCHECK populate it by default and after PowerOn [END] // typedef EFI_STATUS (EFIAPI *GET_REGISTRATION_CONFIG) ( SGX_REGISTRATION_CONFIG *SgxRegistrationConfig ); typedef EFI_STATUS (EFIAPI *SET_REGISTRATION_CONFIG) ( SGX_REGISTRATION_CONFIG *SgxRegistrationConfig ); typedef EFI_STATUS (EFIAPI *GET_REGISTRATION_REQUEST) ( SGX_REGISTRATION_REQUEST *SgxRegistrationRequest ); typedef EFI_STATUS (EFIAPI *GET_REGISTRATION_PACKAGE_INFO) ( SGX_REGISTRATION_PACKAGE_INFO *SgxRegistrationPackageInfo ); typedef EFI_STATUS (EFIAPI *SET_REGISTRATION_RESPONSE) ( SGX_REGISTRATION_RESPONSE *SgxRegistrationResponse ); typedef EFI_STATUS (EFIAPI *GET_REGISTRATION_STATUS) ( SGX_REGISTRATION_STATUS *SgxRegistrationStatus ); typedef EFI_STATUS (EFIAPI *SET_REGISTRATION_STATUS) ( SGX_REGISTRATION_STATUS *SgxRegistrationStatus ); typedef enum { SgxRequestNone, SgxRequestPlatformManifest, SgxRequestAddRequest } SGX_REGISTRATION_SERVER_REQUEST_TYPE; typedef struct { // Registration Request UINT64 RegistrationRequestSize; SGX_REGISTRATION_SERVER_REQUEST_TYPE RegistrationRequestType; SGX_REGISTRATION_SERVER_REQUEST_TYPE PreviousRegistrationRequestType; BOOLEAN PreviousRequestPending; // Registration Config BOOLEAN RegistrationConfigHashPresent; UINT8 RegistrationConfigHash[SHA256_DIGEST_SIZE]; // SHA256 hash BOOLEAN SwAgentFirstBindingComplete; } SGX_UEFIFW_NONVOLATILVE_REGISTRATION_STATE; typedef struct { SGX_UEFIFW_NONVOLATILVE_REGISTRATION_STATE NonVolatile; // Variables exposure states BOOLEAN SgxTcbRecoveryPending; BOOLEAN SgxAddPackagePending; // Helpers - Response Variable BOOLEAN RegistrationResponseVariablePresent; // Helpers - Status Variable BOOLEAN RegistrationStatusVariablePresent; BOOLEAN RequestPending; BOOLEAN PackageInfoPending; // Helpers - Config Variable BOOLEAN RegistrationConfigVariablePresent; BOOLEAN ForceFirstBindingOnRegConfChanged; } SGX_UEFIFW_REGISTRATION_STATE; typedef struct{ UINT64 Prids_0; UINT64 Prids_1; // Socket is new in AddPackage Flow BOOLEAN AddPackageNew; } SGX_UEFIFW_SOCKET; typedef struct { UINT64 PrmrrBase[MAX_PRMRR_COUNT]; UINT64 MaxSadRuleSize; UINT64 ValidPrmrrBitMap; UINT64 PrmrrSize; BOOLEAN IsSgxCapable; UINT8 CrDimmsPresent; UINT8 IsHwCongifSupportedBySgx; UINT8 ClusterValidForSgx [MAX_SOCKET][MAX_IMC]; UINT8 SocketCount; UINT8 PrmrrCount; UINT8 MaxSadRuleImcWays; UINT8 TargetPrmrrCount; UINT8 PrmrrCountPerPackage; SGX_ERROR_CODE_ENUM ErrorCode; } SGX_PREMEM_INIT_HOB; // // SGX UEFI FW Internal HOB // typedef struct { SGX_PREMEM_INIT_HOB SgxPreMemInitHob; SGX_UEFIFW_SOCKET Socket[SGX_MCHECK_MAX_PACKAGE]; UINT64 Prids_QualifiedForAddPkg[SGX_MCHECK_MAX_PACKAGE]; UINT8 PrResetSvn[SGX_MCHECK_MAX_PACKAGE]; UINT8 BootingSvn; BOOLEAN SgxFirstBoot; SGX_UEFI_BOOT_SCENARIO SgxBootScenario; UINT32 ErrorCode; SGX_UEFIFW_KEY_BLOB UefiFwKeyBlobs[SGX_MCHECK_MAX_PACKAGE]; SGX_UEFIFW_PLATFORM_MEMBERSHIP_CERTIFICATE UefiFwPlatMemCert[SGX_MCHECK_MAX_PACKAGE]; BOOLEAN KeyBlobsExistInNvram; BOOLEAN KeyBlobsCreatedOrModifiedByMcheck; BOOLEAN KeyBlobsRestoredFromPackageInfo; UINT8 SgxLeWr; // Registration state SGX_UEFIFW_REGISTRATION_STATE RegistrationState; } SGX_INIT_DATA_HOB; // // ACM HEADER // // Intel (R) Trusted Execution Technology (Intel (R) Txt) November 2017 Revision 015 // Appendix A Intel(R) TXT Execution Technology Authenticated Code Modules // https://www.intel.com/content/dam/www/public/us/en/documents/guides/intel-txt-software-development-guide.pdf // typedef struct _ACM_HEADER_V30 { UINT16 ModuleType; ///< 0 2 Module type UINT16 ModuleSubType; ///< 2 2 Module sub-type UINT32 HeaderLen; ///< 4 4 Header length (in multiples of four bytes) (161 for version 0.0) UINT32 HeaderVersion; ///< 8 4 Module format version UINT16 ChipsetId; ///< 12 2 Module release identifier UINT16 Flags; ///< 14 2 Module-specific flags UINT32 ModuleVendor; ///< 16 4 Module vendor identifier UINT32 Date; ///< 20 4 Creation date (BCD format: year.month.day) UINT32 Size; ///< 24 4 Module size (in multiples of four bytes) UINT16 TxtSvn; ///< 28 2 TXT Security Vesrsion Number UINT16 SeSvn; ///< 30 2 Software Guard Extension (Secure Enclaves) Security Version Number UINT32 CodeControl; ///< 32 4 Authenticated code control flags UINT32 ErrorEntryPoint; ///< 36 4 Error response entry point offset (bytes) UINT32 GdtLimit; ///< 40 4 GDT limit (defines last byte of GDT) UINT32 GdtBasePtr; ///< 44 4 GDT base pointer offset (bytes) UINT32 SegSel; ///< 48 4 Segment selector initializer UINT32 EntryPoint; ///< 52 4 Authenticated code entry point offset (bytes) UINT32 Reserved2[16]; ///< 56 64 Reserved for future extensions UINT32 KeySize; ///< 120 4 Module public key size less the exponent (in multiples of four bytes - 64 for version 0.0) UINT32 ScratchSize; ///< 124 4 Scratch field size (in multiples of four bytes - 2 * KeySize + 15 for version 0.0) } ACM_HEADER_V30; typedef struct _ACM_INFO_TABLE_V30 { UINT32 Uuid; ///< 0 4 UUID of the chipset AC module UINT16 ChipsetAcmType; ///< 4 2 UUID of the chipset AC module } ACM_INFO_TABLE_V30; typedef struct { // // ACM information // EFI_PHYSICAL_ADDRESS BiosAcmAddress; EFI_PHYSICAL_ADDRESS StartupAcmAddressInFit; EFI_PHYSICAL_ADDRESS StartupAcmAddress; // // Misc Policy // UINT32 MiscPolicy; // // BiosOs region. It should be at least 2 for LCP PD. // UINT32 BiosOsDataRegionRevision; EFI_PHYSICAL_ADDRESS LcpPolicyDataBase; UINT64 LcpPolicyDataSize; // // 64-bits TXT Scratch Register // EFI_PHYSICAL_ADDRESS TxtScratchAddress; // // Bios ACM Policy // UINT32 BiosAcmPolicy; // // BiosOsData (SINIT consumption, chipset specific) // UINT64 FlagVariable; // // DPR Lock // // UINT32 DprLock; // // Clear TPM Aux Index // UINT8 TxtClearAuxIndex; } EFI_PLATFORM_TXT_POLICY_DATA; #endif // __SGX_INIT_DATA__
193fe7f1532f7d40bc2ee93d9b2113f1a46b3d55
84ebba6079f6ac6319e10760df7b333e1fb8188f
/apue/fig_17_18.c
c5dad0ed5c0b4678650fbe64437dc2bd3b65f133
[]
no_license
cuiyongbo/ProgrammingPearls
f6a839805bec0f3772e65269da2ff11b27d1508a
bab4283d524000acdd846dfd064bfffb28c1be94
refs/heads/master
2023-08-17T01:20:47.986344
2023-08-04T09:26:21
2023-08-07T15:16:58
113,848,369
3
0
null
null
null
null
UTF-8
C
false
false
509
c
fig_17_18.c
#include "open.h" int main(int argc, char* argv[]) { int fd, n; char buf[BUFSIZ]; char line[BUFSIZ]; while(fgets(line, BUFSIZ, stdin) != NULL) { if(line[strlen(line)-1] == '\n') line[strlen(line)-1] = 0; // replace newline with null if((fd = csopen(line, O_RDONLY)) < 0) continue; while((n=read(fd, buf, BUFSIZ)) > 0) { if(write(STDOUT_FILENO, buf, n) != n) err_sys("write error"); } if(n<0) err_sys("read error"); close(fd); } return 0; }
bb5c519528e90903a373e2f8adc983a96697adb0
a5fe75e5ce592110dcb954e9a3c91ccb57d4670e
/common/Drivers/source/xn_spi.c
095d50f15706975d4a9bf6187632827a0c76fa2a
[]
no_license
yjiangmtl/XN11E
2fdd3475fc7925dd72336a5fd383993e2bc76435
0cf6968f90a1b79e8dcfd30a999c566dfdfc3ebb
refs/heads/master
2021-01-11T09:59:20.392184
2017-01-03T06:14:27
2017-01-03T06:14:27
77,888,592
0
0
null
null
null
null
UTF-8
C
false
false
7,230
c
xn_spi.c
/*----------- This driver is for general SPI usage ----------------*/ /* Includes ------------------------------------------------------------------*/ #include "xn11exxx.h" #include "xn_sys.h" #include "xn_spi.h" extern uint32_t SystemCoreClock; /***************************************************************************** Function Name SPI_Open Function Definition void SPI_Open(uint8_t framemode, uint8_t bitwidth, uint8_t master, uint8_t spionlymode) Function Description Initial SPI infterface Input Parameters Framemode: SPI_FRAME/SSI_FRAME, current support SPI_FRAME only Bitwidth: data size, from 4-bit to 16-bit Master: selection of master or slave, SPI_MASTER/SPI_SLAVE spionlymode: SPI_MODE0~SPI_MODE3 Return Value No Condition No Function called - Last Chang Date: 2015/09/12 By:YL *****************************************************************************/ void SPI_Open(uint8_t framemode, uint8_t bitwidth, uint8_t master, uint8_t spionlymode) { //enable SPI clock XN_SYSCON->SYSAHBCLKCTRL.bit.SPICLK=1; //set spi frame SPI/SSI selcetion XN_SPI->CR0.bit.FRF=framemode; //select bit width XN_SPI->CR0.bit.DSS=bitwidth-1; //Set master/slave if (master==SPI_MASTER) XN_SPI->CR1.bit.MS=0; else XN_SPI->CR1.bit.MS=1; //set SPI mode XN_SPI->CR0.bit.CPOL=spionlymode; XN_SPI->CR0.bit.CPHA=spionlymode>>1; //enable SPIcontroller XN_SPI->CR1.bit.SSE=1; return; } /***************************************************************************** Function Name SPI_Close Function Definition void SPI_Close(void) Function Description De-Initial SPI interface Input Parameters No Return Value No Condition No Function called - Last Chang Date: 2015/09/12 By:YL *****************************************************************************/ void SPI_Close(void) { //Disable SPI clock XN_SYSCON->SYSAHBCLKCTRL.bit.SPICLK=0; return; } /***************************************************************************** Function Name SPI_SetClk Function Definition void SPI_SetClk(uint32_t freq) Function Description Setup SPI clock. In Master mode, SPI frequency set no more than system clock divide by 7; in Slave mode, the frequency set no more than system clock divide by 12. Input Parameters No Return Value No Condition No Function called - Last Chang Date: 2015/09/12 By:YL *****************************************************************************/ void SPI_SetClk(uint32_t freq) { uint32_t div; div=SystemCoreClock/freq; if (XN_SPI->CR1.bit.MS) { //slave mode if (div<12) div=12; }else { //master mode if (div<7) div=7; } //set up divider XN_SPI->CPSR.bit.CPSDVSR=div; return; } /***************************************************************************** Function Name SPI_ClearFIFO Function Definition void SPI_ClearFIFO(void) Function Description Clear SPI TX and RX FIFO. Input Parameters No Return Value No Condition No Function called - Last Chang Date: 2015/09/12 By:YL *****************************************************************************/ void SPI_ClearFIFO(void) { //wait untile TX FIFO empty while(SPI_TX_FIFO_Not_Empty); //clear RX FIFO XN_SPI->CR1.bit.RSFR=1; XN_SPI->CR1.bit.RSFR=0; return; } /***************************************************************************** Function Name SPI_SingleWriteRead Function Definition void SPI_SingleWriteRead(uint16_t *data) Function Description Write data to external SPI device and same time read same size data back from SPI device. Input Parameters No Return Value No Condition No Function called - Last Chang Date: 2015/09/12 By:YL *****************************************************************************/ void SPI_SingleWriteRead(uint16_t *data) { //wait untile TX FIFO empty while(SPI_TX_FIFO_Not_Empty); //clear RX FIFO XN_SPI->CR1.bit.RSFR=1; XN_SPI->CR1.bit.RSFR=0; //Write data to FIFO XN_SPI->DR.bit.DATA=*data; //wait untile TX FIFO empty while(SPI_TX_FIFO_Not_Empty); //Read data from FIFO *data=XN_SPI->DR.bit.DATA; return; } /***************************************************************************** Function Name SPI_WritetoFIFO Function Definition void SPI_WritetoFIFO (uint16_t *src, uint8_t *noofdata) Function Description Write data to SPI FIFO, if FIFO full, stop with rest number of data and current data pointer Input Parameters *src: pointer to data *noofdata: number of data to send Return Value No Condition No Function called - Last Chang Date: 2015/09/12 By:YL *****************************************************************************/ void SPI_WritetoFIFO (uint16_t *src, uint8_t *noofdata) { while((XN_SPI->SR.bit.TNF)&&(*noofdata!=0)) { //Write data to FIFO XN_SPI->DR.bit.DATA=*src; (*noofdata)--; } return; } /***************************************************************************** Function Name SPI_ReadFIFOData Function Definition void SPI_ReadFIFOData (uint16_t *dst, uint8_t *noofdata) Function Description Read data from SPI FIFO. Input Parameters *dst: pointer to destination *noofdata: number of data read Return Value No Condition No Function called - Last Chang Date: 2015/09/12 By:YL *****************************************************************************/ void SPI_ReadFIFOData (uint16_t *dst, uint8_t *noofdata) { while((XN_SPI->SR.bit.RNE)&&(*noofdata!=0)) { *dst++=XN_SPI->DR.bit.DATA; noofdata--; } return; } /***************************************************************************** Function Name SPI_ClrInt(may not need) Function Definition void SPI_ClrInt(void) Function Description Clear SPI interrupt Input Parameters No Return Value No Condition No Function called - Last Chang Date: 2015/09/12 By:YL *****************************************************************************/ void SPI_ClrInt(void) { XN_SPI->ICR.bit.RORIC; } /***************************************************************************** Function Name SPI_EnableInt Function Definition void SPI_EnableInt(uint8_t inttype) Function Description Setup SPI interrupt Input Parameters Inttype: combination of SPI_RX_FIFO_FULL 1 SPI_RX_FIFO_NOT_EMPTY 2 SPI_RX_FIFO_HALF_FULL 4 SPI_TX_FIFO_HALF_EMPTY 8 Return Value No Condition No Function called - Last Chang Date: 2015/09/12 By:YL *****************************************************************************/ void SPI_EnableInt(uint8_t inttype) { XN_SPI->IMSC.all |= inttype; return; } /***************************************************************************** Function Name SPI_DisableInt Function Definition void SPI_DisableInt(uint8_t inttype) Function Description Setup SPI interrupt Input Parameters Inttype: combination of SPI_RX_FIFO_FULL 1 SPI_RX_FIFO_NOT_EMPTY 2 SPI_RX_FIFO_HALF_FULL 4 SPI_TX_FIFO_HALF_EMPTY 8 Return Value No Condition No Function called - Last Chang Date: 2015/09/12 By:YL *****************************************************************************/ void SPI_DisableInt(uint8_t inttype) { XN_SPI->IMSC.all &= ~inttype; return; } /****************************************************************************** ** End Of File ******************************************************************************/
48d7bff07bcd0aa9d9c1beccfc38f439f2bc75e9
02dfdb56737fb7c0bb4f1e3e8fa3a7d2f79b2199
/b_search2.c
bc9b17dd17c9cdf5a4fe23039c3a508b59636df1
[]
no_license
muhammad-alamin1/binary-searching-algorithm-in-c
8fdd440aaa1becd73d672f87dd9c7567df840d1c
1f1d7fd8080e6095082fb1c95d8b560bf6ca88a4
refs/heads/main
2023-08-19T03:55:17.741622
2021-10-21T15:11:35
2021-10-21T15:11:35
null
0
0
null
null
null
null
UTF-8
C
false
false
999
c
b_search2.c
#include <stdio.h> int binary_search(int a[], int low_index, int high_index, int num); int main() { int a[] = {1, 4, 6, 8, 9, 11, 14, 15, 20, 25, 33, 83, 87, 97, 99, 100}; int low_index = 0, high_index = 15, num = 87; int find_element = binary_search(a, low_index, high_index, num); if(find_element == NULL) printf("%d is not in the array\n", a[find_element]); else printf("%d is found in the array. It is the %dth element of the array. \n", a[find_element], find_element); getch(); } int binary_search(int a[], int low_index, int high_index, int num) { int mid_index; while(low_index <= high_index) { mid_index = (low_index + high_index) / 2; if(num == a[mid_index]) { break; } if(num < a[mid_index]) { high_index = mid_index - 1; } else if(num > a[mid_index]) { low_index = mid_index + 1; } } return mid_index; }
840eb9a57432fa67ecf2bf4846f2dbe1de8a54fc
2c73a693c2b3c162eae2ab94f649d8c4494878ba
/components/multimedia/amr_decode/amr_wb/dec/include/mime_io.h
9c040bc8b8db3fb629391eaceaf1e0ba42b379d4
[ "MIT" ]
permissive
openLuat/LuatOS
185e1e140aed908434168133571ddcafe98f4e12
4b29d5121ab4f7133630331e8502c526c7856897
refs/heads/master
2023-08-23T04:57:23.263539
2023-08-23T04:46:46
2023-08-23T04:46:46
230,403,844
378
93
MIT
2021-12-17T02:19:30
2019-12-27T08:29:19
C
UTF-8
C
false
false
3,413
h
mime_io.h
/* ------------------------------------------------------------------ * Copyright (C) 1998-2009 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. * See the License for the specific language governing permissions * and limitations under the License. * ------------------------------------------------------------------- */ /**************************************************************************************** Portions of this file are derived from the following 3GPP standard: 3GPP TS 26.173 ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec Available from http://www.3gpp.org (C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) Permission to distribute, modify and use this file under the standard license terms listed above has been obtained from the copyright holder. ****************************************************************************************/ /* ------------------------------------------------------------------------------ Pathname: ./cpp/include/mime_io.h ------------------------------------------------------------------------------ INCLUDE DESCRIPTION ------------------------------------------------------------------------------ */ #ifndef MIME_IO_H #define MIME_IO_H /*---------------------------------------------------------------------------- ; INCLUDES ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; MACROS ; Define module specific macros here ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; DEFINES ----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- ; EXTERNAL VARIABLES REFERENCES ----------------------------------------------------------------------------*/ extern const uint8 toc_byte[16]; /* number of speech bits for all modes */ extern const int16 unpacked_size[16]; /* size of packed frame for each mode, excluding TOC byte */ extern const int16 packed_size[16]; /* number of unused speech bits in packed format for each mode */ extern const int16 unused_size[16]; /* sorting tables for all modes */ extern const int16 sort_660[132]; extern const int16 sort_885[177]; extern const int16 sort_1265[253]; extern const int16 sort_1425[285]; extern const int16 sort_1585[317]; extern const int16 sort_1825[365]; extern const int16 sort_1985[397]; extern const int16 sort_2305[461]; extern const int16 sort_2385[477]; extern const int16 sort_SID[35]; /*---------------------------------------------------------------------------- ; SIMPLE TYPEDEF'S ----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif /* MIME_IO_H */
690e30043e63e5e90928568aa00587676fa8dc38
df031ea2d7d696abf1f97213c5f0808b05c198df
/Pods/CIWFramework/CIWFramework/Classes/Common/Consts.h
1f74dc27e61c6ef4b382182e69c4e52b612b13b4
[ "MIT" ]
permissive
oldBlackComing/CCPCalendar
6504c154bda775fd5990840265ef9f6c7ae0c450
292aed966ff3abf66a23b3280c4d2aacb86a1c09
refs/heads/master
2021-08-20T05:53:51.417782
2017-11-28T10:12:40
2017-11-28T10:12:40
110,676,355
0
0
null
null
null
null
UTF-8
C
false
false
3,446
h
Consts.h
// // Consts.h // HunBoHuiReqeust_demo // // Created by GarrettGao on 14-10-24. // Copyright (c) 2014年 HapN. All rights reserved. // // Git Master 分支 #ifndef HunBoHuiReqeust_demo_Consts_h #define HunBoHuiReqeust_demo_Consts_h #define KEY_MODEL @"kModel" #define kSelf_View_Tag 135024 #define kCacheCityList @"kCacheCityList" #define kCityChnage @"kCityChnageNotification" /**获取appdelegate*/ #define APP_DELEGATE (AppDelegate *)[UIApplication sharedApplication].delegate /**设置颜色*/ #define RGB(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(1.0)] #define RGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)] #define RGBRandom(a) [UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:(a)] #define RGBFromHexColor(HexValue) \ [UIColor colorWithRed:((float)((HexValue & 0xFF0000) >> 16))/255.0 \ green:((float)((HexValue & 0xFF00) >> 8))/255.0 \ blue:((float)(HexValue & 0xFF))/255.0 alpha:1.0] /**等到屏幕宽高*/ #define kScreenWidth [UIScreen mainScreen].bounds.size.width // 屏幕宽度 #define kScreenHeight [UIScreen mainScreen].bounds.size.height // 屏幕高度 //当前系统版本是否 >= 某个版本 #define kiOSVersion(v) ([UIDevice currentDevice].systemVersion.floatValue >= (v)) /**iphone比例*/ #define kSeveralfold kScreenWidth/320.f #define kSeveralfold6 kScreenWidth/375.f /**版本号*/ #define APP_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] #define APP_KEY @"1d78ae9a3e219d6531758daf8c230c1c" #define APP_ID @"10011" #define APP_BUNDLE_ID_INHOUSE @"com.hunbohui.yingbashaETP" #define APP_BUNDLE_ID_APPSTORE @"com.hunbohui.yingbasha" #define kAppStoreAddress @"https://itunes.apple.com/us/app/ying-ba-sha-zhong-guo-hun-bo-hui/id1155985315?l=zh&ls=1&mt=8" //AppID:wxa8555a4cafbab428 //AppSecret: 1c2347619a55ec8bfa6cdb6cc6674d77 /**全局控制 线上 线下 接口,默认线上接口 * 注意: 开发者如果需要更改接口,请直接在 设置 -》关于结婚订购 页面 两个指头双击5下 直接修改 * !请勿修随意修改此处接口! **线上接口*/ #define REQUEST_HOST @"https://api.jiehun.com.cn" // 默认线上接口 //#define REQUEST_HOST @"http://api.zhy.hapn.cc" #define URL_SCHEME @"ybs" #define URL_SCHEME__ @"ybs://" #define kDefault_imageName @"default_img"//默认图片 #define kDefault_imageName_small @"default_img_small"//默认小图片 #define kDetault_UserName @"default_user"//默认 //新浪微博AppKey #define kAppKey_Weibo @"1632741491" #define kRedirectURI_Weibo @"http://www.jiehun.com.cn/api/weibo/_grant" //QQ AppKey #define kAppID_QQ @"1105626771" #define kAppID_QQ_ETP @"1105750546" #define MessageNotificotion @"MessageNotificotion" //微信kAuthScope、Secret、AppId、Grant_type #define kAppId_weChat @"wx78b27fadc81b6df4" #define kAppSecret_weChat @"022fa45d435d7845179b6ae8d1912690" #define kAuthScope @"snsapi_userinfo" #define kGrant_type @"authorization_code" //用于web请求的时候,后台识别用 //#define kUserAgent @"{app-wap-mode:1}" #define kUserAgent @"a=yingbasha&p=ybs&m=3" #define weak(obj) __weak typeof(obj) _weak##obj = obj; #endif #ifdef DEBUG #else #define NSLog(...) {} #endif
5e35f8950e7936644f055a94392614eb1398176c
3181be453277f3035b6b2e420032f0602edf22af
/libft/ft_strncmp.c
5671e57510ed706781dcaa9ade54f91f4b3d6dc0
[]
no_license
tasertasertaser/rainbowlines
2f09d5749e1b252ec6f7a407db582862d17d7b79
c89bb1c4ed0704f293dad5084645420320bfdc4a
refs/heads/master
2020-07-16T07:01:40.649479
2019-09-01T23:48:25
2019-09-01T23:48:25
205,743,911
1
0
null
null
null
null
UTF-8
C
false
false
1,249
c
ft_strncmp.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cschulle <cschulle@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/12/08 16:02:51 by cschulle #+# #+# */ /* Updated: 2019/05/31 14:31:25 by cschulle ### ########.fr */ /* */ /* ************************************************************************** */ /* ** Numerically compares the first n characters of two strings. */ #include <unistd.h> int ft_strncmp(const char *s1, const char *s2, size_t n) { size_t i; i = 0; if ((s1[0] == '\0' && s2[0] == '\0') || n == 0) return (0); while ((i + 1 != n && s1[i] == s2[i]) && (s1[i] && s2[i])) i++; return ((unsigned char)s1[i] - (unsigned char)s2[i]); }
f157532810b86d00c8e0fb3cff87a2a2f4884224
77a8a53a4e452680da704dc41c71f626256b685f
/include/backtracking.h
bf751b597545a5dbdb0c505cdbd5eb4c2b0debf9
[]
no_license
paulohtobias/UFSJ_4_GRAFOS_TP1
10f732577f715cfc5290475ea3bc695c1bee1949
7fd3033704e646ad2d55ec0bbbd85c734d610c8c
refs/heads/master
2021-01-23T12:44:56.813807
2017-07-12T02:25:24
2017-07-12T02:25:24
93,195,640
0
1
null
2017-06-07T14:01:49
2017-06-02T19:01:19
C
UTF-8
C
false
false
914
h
backtracking.h
#ifndef BACKTRACKING_H #define BACKTRACKING_H #include "sudoku.h" #define estatico -1 typedef enum{ NAO_COLORIU = 0, COLORIU = 1, FIM }Exato_Estado; //Inicializa a mtriz de possibilidades. void inicializa_possibilidades(Sudoku *sudoku); //Atualiza a matriz de possibilidades quando um vértice é colorido. void atualiza_possibilidades(Sudoku *sudoku, int v, int cor); //Tenta colorir um vértice. Se conseguir, então a matriz de //possibilidades é atualizada. void exato_colore(Sudoku *sudoku, int id, int cor); //Função principal. bool algoritmo_exato(Sudoku *sudoku); //Funções de poda. Podem resolver o sudoku. Exato_Estado poda_vertice(Sudoku *sudoku); Exato_Estado poda_hiper_aresta(Sudoku *sudoku); //Funções de tentativa e erro. void define_estaticos(int *vetor_combinacao, Grafo *grafo); bool backtracking(Sudoku *sudoku); void printS(Sudoku *sudoku); #endif //BACKTRACKING_H
ad46fcb29c8dce5978a64644880399f622ae5609
7ba54b32c5df2e5f725d41cfc9ff084c8d5396ba
/Day05 (String manipulation)/ex08/ft_strupcase.c
ed760655852c0888d0b814c7f812ec8bdbab8c57
[ "MIT" ]
permissive
Wittiest/C-Bootcamp
7659a7240b16d3b9d3b86d1c277efdce16ea2149
fa6ab527ba8f45087cb0b485a2a5831122c68498
refs/heads/master
2021-01-02T23:09:23.535802
2017-10-03T19:47:44
2017-10-03T19:47:44
99,477,800
1
0
null
null
null
null
UTF-8
C
false
false
1,098
c
ft_strupcase.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strupcase.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dpearson <dpearson@student.42.us.org> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/07/04 01:42:20 by dpearson #+# #+# */ /* Updated: 2017/07/04 01:42:21 by dpearson ### ########.fr */ /* */ /* ************************************************************************** */ char *ft_strupcase(char *str) { int index; index = 0; while (str[index] != '\0') { if (str[index] >= 'a' && str[index] <= 'z') { str[index] = str[index] - 32; } index++; } return (str); }
6cd9ef5cf6c9ab67e3ed8f9b19db03c737b7e594
f090866e1ebbb7d4b80c49ad68de9d13559c2915
/code/mos6551.c
0275e3b95439457bcad9a427e9d1e3bb95ea84aa
[]
no_license
marekw1986/RetroEG
494ffbe2dd90aab064530a7566c364c5573dc021
8bbcd3a900a3aa15b41da08ea92ed8162fd927ae
refs/heads/master
2023-03-28T15:31:28.170782
2020-10-14T05:53:59
2020-10-14T05:53:59
189,200,429
1
0
null
2020-10-14T05:54:00
2019-05-29T10:06:01
C
UTF-8
C
false
false
2,400
c
mos6551.c
#include "mos6551.h" #include "parser.h" #include "io.h" #define ACIA_RXD (*(volatile uint8_t*)0x6500) //ACIA receive data port #define ACIA_TXD (*(volatile uint8_t*)0x6500) //ACIA transmit data port #define ACIA_STS (*(volatile uint8_t*)0x6501) //ACIA status port #define ACIA_RES (*(volatile uint8_t*)0x6501) //ACIA reset port #define ACIA_CMD (*(volatile uint8_t*)0x6502) //ACIA command port #define ACIA_CTL (*(volatile uint8_t*)0x6503) //ACIA control port volatile char mos6551_RxChar; volatile char mos6551_rxrb[256]; //DO NOT CHAGE! IT NEEDS TO BE 256 BYTES LONG! volatile uint8_t mos6551_rxrb_head = 0; volatile uint8_t mos6551_rxrb_tail = 0; char mos6551_line[256]; //DO NOT CHAGE! IT NEEDS TO BE 256 BYTES LONG! Oftherwise uncomment and adjust line in mos6551_handle_rx uint8_t mos6551_line_ind = 0; void __fastcall__ mos6551_init (void) { //initialise 6551 ACIA ACIA_RES = 0xFF; //soft reset (value not important) //ACIA_CMD = 0x0B; /set specific modes and functions: no parity, no echo, no Tx interrupt, no Rx interrupt, enable Tx/Rx ACIA_CMD = 0x09; //set specific modes and functions: no parity, no echo, no Tx interrupt, Rx interrupt enabled, enable Tx/Rx ACIA_CTL = 0x1E; //8-N-1, 9600 baud port_clr(RS485_PIN); //RS485 set to receive by default } void __fastcall__ mos6551_putc (char c) { while (!(ACIA_STS & 0x10)); ACIA_TXD = c; } void __fastcall__ mos6551_puts (const char *str) { port_set(RS485_PIN); //Set RS485 to transmit while (*str != '\0') { while (!(ACIA_STS & 0x10)); ACIA_TXD = *str; str++; } while (!(ACIA_STS & 0x10)); //Be it is not transmitting before switching back to receceive port_clr(RS485_PIN); //Set RS485 to receive again } void __fastcall__ mos6551_handle_rx (void) { while (mos6551_rxrb_head != mos6551_rxrb_tail) { // There is a new data in ring buffer mos6551_RxChar = mos6551_rxrb[mos6551_rxrb_tail]; mos6551_rxrb_tail++; switch(mos6551_RxChar) { case 0: break; // ignorujemy znak \0 case 13: break; // ignorujemy znak CR case 10: mos6551_line[mos6551_line_ind] = '\0'; mos6551_line_ind = 0; parse_cmd(mos6551_line); break; default: mos6551_line[mos6551_line_ind] = mos6551_RxChar; mos6551_line_ind++; //if (mos6551_line_ind >= MOS6551_LINE_BUF_LEN) mos6551_line_ind = 0; //Not needed if buffer size is 256 break; } } }
3545fd63847918bb0c37ecbececf07e591231086
be81f77592404e96e869d157acb6345027802282
/tunerservice/tunerservice/jni/euinstallertc/installation/comp/svpaci/src/_svpaci_mdiv.h
e6856242a58013384f24f7440ebcdcef986a523c
[]
no_license
GongHuixue/2k15_asta_app
a5f39ca515958ad38a50b6a42a46b3fdb0d86b09
99ee7b8795db43374a19b0b439e90c3a63866862
refs/heads/master
2021-01-24T20:01:59.468015
2018-08-26T03:29:39
2018-08-26T03:29:39
123,243,941
0
0
null
null
null
null
UTF-8
C
false
false
491
h
_svpaci_mdiv.h
#ifndef SVPACI_MDIV #define SVPACI_MDIV #define GENERATE__LEGACY__DEFINES #include "../CSvcPaci_mdiv.h" #include "CSvcPaci_mdiv_Priv.h" #undef GENERATE__LEGACY__DEFINES void CSvcPaci_mdiv_Priv::params__init(void) { } CSvcPaci_mdiv_Priv::~CSvcPaci_mdiv_Priv() { } //public class connections CSvcPaci_mdiv::CSvcPaci_mdiv() { m_priv = new CSvcPaci_mdiv_Priv(); adiv = m_priv->adiv; m_priv->div =div; } CSvcPaci_mdiv::~CSvcPaci_mdiv() { delete m_priv; } #endif
016f7314bf3c3175cc806d7465d06c6119c3fe1c
52c83a0b50f9759292a1a175693fab7c82352092
/Unused Code/C_Tests/pyramids.c
23e60dd07601e7025fd39df731411cb26d8187ee
[]
no_license
Rutgers-RISC-V/RISC-V-Processor
e95b8cd1568102f8a094c3b8708d682bff8b0839
5048cf7ef0019c707b647dde978923d8ee9277e0
refs/heads/master
2020-04-19T18:48:42.031701
2019-06-17T14:58:56
2019-06-17T14:58:56
168,372,791
4
1
null
null
null
null
UTF-8
C
false
false
359
c
pyramids.c
#include <stdio.h> int main(){ int loops = 1200; int counter = 0; int zeros = 1; int direction = 1; while(counter < loops){ for(int i = 0; i < zeros; i++){ printf("0"); } printf("\n"); if(zeros >= 80){ direction = 0; } if(zeros <= 0){ direction = 1; } if(direction == 1){ zeros++; } else{ zeros--; } counter++; } }
5afc7a5044bf1d140f8d85febf8d129d4f2a03ee
26ebcb9930b3046ec9043b8194ee296541458e0e
/assets/util/util.h
e77ef42e9d8af8a18579a21de1e88e76c375adff
[]
no_license
JonathanGun/Avatar-World-War-Multiplayer-Strategy-Game
78bb86bbf4893d99b7468246d836ae8e53657ea8
ae4d1e188fd486b958c4664b14c554db5bb662c7
refs/heads/master
2022-03-28T01:40:49.342502
2019-11-24T13:48:00
2019-11-24T13:48:00
216,133,317
0
2
null
null
null
null
UTF-8
C
false
false
805
h
util.h
#ifndef UTIL_H #define UTIL_H #define boolean unsigned char #define true 1 #define false 0 #define max(a, b) a>b?a:b #define min(a, b) a<b?a:b #define selisih(a,b) abs(a-b) #define swapint(a,b) {int tmp; tmp = b; b = a; a = tmp;} #define swapc(a,b) {char tmp; tmp = b; b = a; a = tmp;} #define print(a) printf("%d", a) #define prints(a) printf("%d ", a) #define println(a) printf("%d\n", a) #define printc(a) printf("%c", a) #define printcs(a) printf("%c ", a) #define printcln(a) printf("%c\n", a) #define ENDL printf("\n") #define fori(i, n) for(int i = 0; i < n; ++i) #define forii(i,s,e) for(int i = s; i < e; i++) #define Nil NULL #ifndef DEBUG #define DEBUG false #endif #include <stdio.h> #include <stdlib.h> #include "pcolor.h" #include "global.h" #endif
39e2c2d1709d2b20b989fc817e61e88d71997031
d853ae7ac78fe8c58c4812f731c917b3ce65a5ce
/m2r/firmware/audio_data.c
4499fa459da0e2533f299f0b72e2714be0fa5278
[]
no_license
adamgreig/m2-electronics
a0e52f7afe25499bf75129c048fad63284ad8cf8
ef173d2c7e5fd6553c315520165bddc4eb3d6bf2
refs/heads/master
2021-01-18T05:03:54.359938
2015-11-15T21:16:32
2015-11-15T21:16:32
29,137,690
0
0
null
2015-01-12T13:54:15
2015-01-12T13:54:15
null
UTF-8
C
false
false
343,370
c
audio_data.c
/* * Audio sample data * M2R * 2014 Fergus Noble, Cambridge University Spaceflight */ #include <stdint.h> const uint8_t zero[4452] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 123, 123, 125, 121, 120, 125, 126, 126, 125, 130, 127, 129, 129, 131, 133, 136, 138, 135, 142, 141, 146, 142, 150, 147, 150, 147, 149, 146, 148, 147, 142, 142, 142, 139, 137, 132, 131, 125, 122, 126, 120, 117, 99, 117, 108, 111, 113, 99, 105, 98, 98, 95, 105, 107, 129, 91, 122, 105, 115, 105, 111, 109, 106, 107, 106, 104, 99, 108, 99, 111, 122, 134, 128, 134, 138, 154, 157, 166, 158, 169, 173, 175, 174, 171, 171, 165, 168, 157, 150, 144, 139, 134, 134, 128, 126, 129, 129, 130, 131, 131, 125, 136, 130, 132, 135, 129, 127, 131, 112, 94, 131, 91, 133, 92, 140, 88, 96, 97, 107, 86, 115, 97, 99, 106, 85, 127, 110, 100, 107, 124, 109, 107, 120, 100, 128, 104, 136, 127, 122, 113, 121, 125, 104, 134, 105, 138, 124, 132, 133, 138, 152, 130, 160, 143, 154, 146, 164, 156, 160, 148, 166, 139, 153, 143, 159, 136, 147, 135, 159, 128, 135, 141, 133, 127, 127, 146, 123, 148, 129, 128, 121, 113, 147, 115, 122, 103, 123, 93, 142, 108, 117, 111, 125, 94, 87, 124, 114, 133, 87, 125, 120, 102, 113, 125, 129, 127, 123, 73, 137, 96, 141, 96, 144, 107, 124, 125, 131, 131, 110, 115, 137, 121, 127, 133, 125, 135, 137, 138, 139, 143, 156, 118, 128, 121, 112, 154, 69, 124, 76, 133, 100, 89, 120, 103, 109, 77, 129, 90, 157, 100, 137, 74, 140, 96, 144, 112, 120, 99, 131, 124, 144, 104, 137, 113, 122, 134, 125, 125, 128, 134, 139, 129, 148, 148, 154, 141, 158, 155, 146, 154, 161, 145, 160, 140, 149, 141, 134, 144, 136, 160, 134, 131, 107, 121, 136, 123, 136, 132, 110, 149, 121, 107, 130, 114, 118, 108, 98, 118, 111, 149, 78, 158, 77, 143, 113, 138, 122, 112, 166, 90, 157, 79, 117, 141, 109, 131, 93, 131, 99, 82, 129, 95, 153, 87, 150, 98, 120, 130, 100, 118, 114, 143, 127, 138, 131, 146, 128, 125, 131, 134, 154, 139, 146, 153, 140, 148, 141, 157, 127, 150, 156, 139, 169, 133, 141, 137, 150, 156, 135, 165, 126, 151, 89, 142, 122, 166, 132, 112, 163, 111, 150, 113, 119, 114, 116, 132, 123, 131, 129, 120, 98, 151, 61, 140, 137, 131, 131, 79, 148, 89, 120, 122, 103, 127, 114, 124, 149, 85, 130, 126, 124, 130, 114, 127, 138, 88, 144, 84, 142, 116, 119, 125, 114, 127, 120, 156, 123, 143, 126, 146, 125, 157, 136, 138, 129, 131, 149, 122, 157, 126, 146, 125, 151, 123, 142, 141, 172, 125, 158, 124, 138, 155, 130, 110, 115, 160, 106, 149, 139, 118, 154, 112, 124, 93, 115, 125, 115, 144, 102, 146, 149, 117, 143, 81, 112, 113, 135, 102, 109, 87, 119, 94, 126, 109, 125, 108, 96, 160, 101, 146, 90, 123, 93, 152, 92, 165, 118, 126, 110, 130, 144, 145, 126, 142, 126, 144, 112, 128, 107, 149, 131, 151, 150, 148, 131, 131, 163, 120, 162, 127, 184, 130, 167, 114, 154, 118, 156, 125, 128, 127, 149, 111, 167, 120, 138, 108, 124, 131, 143, 105, 135, 134, 119, 126, 123, 142, 126, 130, 112, 128, 107, 156, 131, 151, 150, 120, 131, 131, 163, 119, 162, 127, 184, 108, 167, 114, 154, 127, 156, 125, 128, 127, 132, 111, 167, 120, 144, 108, 124, 131, 126, 105, 135, 134, 139, 131, 101, 155, 103, 154, 85, 155, 94, 176, 98, 111, 96, 130, 110, 81, 126, 94, 136, 88, 141, 88, 130, 140, 121, 129, 107, 158, 93, 154, 114, 174, 91, 151, 82, 146, 103, 179, 103, 125, 134, 143, 123, 151, 121, 146, 116, 125, 128, 139, 117, 162, 118, 146, 120, 159, 126, 156, 124, 153, 104, 165, 97, 161, 137, 127, 117, 131, 134, 127, 116, 122, 140, 128, 134, 124, 147, 120, 132, 109, 104, 126, 116, 142, 119, 117, 114, 133, 114, 143, 75, 111, 113, 98, 151, 119, 140, 152, 108, 135, 83, 124, 123, 124, 131, 131, 155, 116, 119, 140, 113, 126, 125, 126, 135, 116, 129, 129, 140, 145, 131, 140, 135, 130, 143, 134, 157, 115, 163, 118, 131, 121, 143, 123, 156, 112, 163, 124, 158, 99, 126, 125, 139, 121, 146, 102, 156, 136, 113, 108, 114, 154, 105, 114, 101, 143, 96, 140, 97, 140, 84, 168, 55, 123, 136, 84, 151, 105, 171, 112, 147, 121, 127, 90, 161, 120, 151, 146, 109, 114, 99, 147, 102, 131, 144, 100, 145, 118, 137, 141, 131, 149, 142, 127, 146, 111, 168, 119, 157, 111, 160, 135, 163, 131, 160, 138, 168, 127, 167, 139, 154, 142, 170, 105, 164, 126, 142, 122, 144, 146, 130, 108, 150, 111, 120, 99, 150, 109, 169, 65, 164, 90, 190, 65, 178, 87, 165, 107, 146, 98, 148, 91, 132, 139, 124, 140, 126, 109, 103, 109, 122, 92, 144, 127, 132, 135, 100, 139, 129, 140, 120, 146, 145, 151, 121, 144, 122, 153, 129, 141, 134, 159, 148, 127, 136, 132, 147, 136, 140, 125, 151, 111, 141, 137, 127, 134, 131, 149, 171, 113, 100, 125, 127, 123, 119, 141, 60, 150, 96, 135, 84, 137, 126, 132, 147, 81, 142, 110, 134, 90, 146, 90, 125, 106, 99, 98, 119, 95, 110, 124, 110, 111, 146, 132, 144, 137, 155, 133, 179, 142, 148, 160, 175, 135, 137, 164, 133, 153, 127, 154, 127, 162, 117, 141, 143, 136, 138, 141, 140, 136, 142, 118, 111, 144, 116, 114, 123, 114, 119, 122, 102, 109, 122, 116, 86, 106, 102, 111, 101, 109, 77, 120, 77, 101, 68, 95, 85, 91, 83, 85, 105, 107, 106, 129, 149, 136, 159, 165, 171, 163, 183, 174, 178, 166, 164, 158, 162, 141, 142, 132, 136, 124, 131, 130, 132, 133, 135, 142, 143, 146, 146, 150, 141, 138, 135, 128, 120, 117, 114, 115, 100, 108, 101, 102, 80, 96, 84, 89, 83, 87, 76, 76, 77, 69, 74, 88, 68, 108, 103, 126, 133, 153, 158, 170, 186, 175, 206, 198, 197, 188, 195, 176, 164, 160, 141, 132, 122, 119, 116, 116, 116, 120, 128, 135, 146, 151, 153, 166, 167, 168, 166, 154, 143, 136, 129, 113, 104, 101, 87, 82, 70, 66, 67, 64, 63, 62, 50, 50, 48, 47, 45, 64, 54, 120, 124, 127, 143, 177, 189, 186, 202, 205, 209, 201, 189, 192, 181, 158, 147, 140, 129, 117, 108, 108, 108, 113, 113, 124, 137, 147, 151, 165, 171, 175, 173, 173, 161, 149, 138, 133, 118, 106, 100, 93, 85, 75, 72, 64, 69, 60, 64, 52, 52, 50, 54, 47, 45, 64, 63, 120, 124, 127, 160, 177, 189, 186, 214, 205, 210, 201, 186, 191, 180, 158, 137, 137, 127, 113, 106, 105, 105, 112, 118, 130, 138, 154, 163, 176, 178, 186, 180, 177, 168, 152, 138, 130, 114, 99, 92, 81, 73, 67, 65, 58, 59, 55, 58, 50, 47, 45, 49, 48, 59, 60, 113, 134, 128, 157, 183, 200, 195, 204, 218, 215, 201, 191, 185, 174, 145, 134, 121, 116, 99, 93, 96, 104, 108, 116, 133, 151, 162, 174, 188, 196, 196, 192, 187, 171, 154, 142, 128, 111, 99, 94, 80, 76, 67, 61, 64, 64, 52, 53, 53, 43, 31, 34, 37, 50, 57, 112, 143, 141, 157, 206, 216, 201, 207, 222, 215, 201, 185, 172, 168, 147, 124, 114, 116, 100, 93, 99, 108, 111, 122, 140, 151, 164, 180, 192, 200, 198, 189, 183, 168, 156, 138, 124, 109, 103, 92, 79, 76, 70, 59, 64, 64, 54, 54, 53, 43, 37, 36, 37, 50, 55, 97, 143, 141, 144, 191, 216, 200, 196, 215, 215, 202, 194, 174, 169, 148, 123, 111, 117, 101, 91, 94, 110, 112, 121, 132, 152, 167, 181, 188, 198, 205, 192, 182, 177, 158, 132, 124, 114, 98, 89, 83, 79, 76, 70, 66, 69, 70, 62, 55, 53, 46, 31, 32, 38, 51, 64, 123, 140, 136, 169, 210, 212, 199, 212, 223, 213, 199, 184, 170, 166, 144, 121, 111, 115, 100, 90, 100, 110, 113, 122, 140, 153, 167, 182, 192, 198, 205, 191, 180, 176, 156, 129, 117, 108, 96, 87, 80, 75, 76, 71, 67, 73, 73, 67, 53, 52, 49, 31, 27, 44, 51, 72, 137, 127, 129, 186, 214, 197, 196, 222, 223, 199, 190, 181, 168, 146, 128, 110, 103, 104, 92, 87, 109, 115, 123, 134, 152, 166, 184, 192, 193, 195, 195, 186, 151, 146, 132, 103, 94, 95, 89, 83, 86, 88, 90, 90, 92, 89, 90, 77, 67, 59, 44, 23, 19, 37, 48, 92, 137, 139, 148, 201, 222, 207, 198, 224, 223, 206, 181, 168, 154, 142, 115, 99, 94, 100, 91, 91, 108, 125, 132, 140, 159, 179, 187, 196, 195, 195, 196, 181, 158, 141, 136, 116, 93, 94, 92, 88, 82, 89, 90, 93, 91, 91, 87, 89, 75, 65, 51, 36, 19, 27, 42, 61, 116, 138, 142, 166, 212, 214, 194, 198, 219, 209, 181, 168, 158, 145, 123, 111, 102, 102, 104, 101, 105, 117, 133, 137, 139, 150, 159, 161, 160, 158, 155, 153, 145, 133, 127, 124, 116, 108, 106, 108, 107, 105, 106, 110, 108, 107, 106, 99, 93, 85, 69, 44, 30, 24, 27, 44, 56, 118, 142, 150, 172, 214, 220, 199, 199, 214, 200, 179, 162, 146, 131, 117, 109, 95, 95, 105, 107, 110, 121, 138, 146, 146, 154, 161, 162, 160, 155, 150, 145, 142, 131, 124, 120, 116, 110, 107, 109, 109, 108, 108, 111, 111, 108, 108, 101, 96, 88, 75, 52, 37, 26, 23, 41, 43, 91, 138, 145, 158, 202, 221, 210, 199, 213, 206, 186, 162, 150, 134, 120, 109, 100, 91, 102, 110, 111, 118, 136, 150, 151, 155, 161, 163, 161, 155, 147, 140, 137, 131, 122, 116, 113, 112, 110, 110, 113, 117, 121, 123, 124, 122, 120, 113, 101, 91, 76, 62, 31, 16, 10, 21, 33, 46, 118, 157, 171, 184, 221, 231, 215, 211, 211, 187, 170, 149, 130, 106, 94, 96, 91, 91, 103, 116, 133, 138, 151, 159, 164, 163, 158, 159, 152, 146, 137, 129, 124, 122, 116, 112, 112, 112, 115, 118, 122, 124, 133, 138, 140, 137, 132, 125, 118, 103, 84, 69, 56, 31, 8, 4, 7, 24, 48, 117, 160, 189, 199, 237, 253, 242, 208, 192, 178, 165, 132, 107, 89, 84, 89, 92, 94, 99, 120, 142, 150, 152, 162, 168, 165, 161, 156, 148, 141, 136, 128, 123, 120, 117, 113, 115, 115, 115, 117, 121, 125, 126, 133, 138, 140, 137, 132, 125, 113, 97, 84, 70, 49, 23, 8, 4, 10, 33, 48, 160, 185, 194, 220, 254, 249, 217, 195, 184, 171, 143, 112, 92, 81, 83, 90, 93, 97, 112, 139, 154, 156, 160, 170, 170, 166, 157, 148, 138, 132, 125, 120, 117, 115, 114, 117, 118, 118, 121, 124, 127, 131, 133, 138, 140, 139, 137, 132, 127, 112, 102, 92, 81, 60, 46, 35, 26, 17, 18, 40, 82, 151, 189, 204, 204, 233, 253, 243, 186, 154, 150, 139, 112, 85, 77, 76, 85, 104, 114, 124, 137, 156, 175, 176, 169, 163, 157, 153, 144, 134, 121, 117, 116, 117, 116, 117, 117, 122, 127, 128, 128, 131, 135, 137, 137, 139, 140, 141, 140, 131, 118, 112, 103, 91, 77, 69, 58, 52, 47, 44, 42, 43, 63, 98, 132, 192, 216, 202, 197, 203, 212, 191, 162, 131, 121, 112, 111, 104, 95, 92, 100, 127, 145, 143, 142, 149, 165, 169, 164, 151, 140, 136, 135, 130, 124, 119, 117, 119, 124, 125, 123, 123, 127, 132, 134, 133, 132, 135, 139, 140, 136, 133, 134, 134, 126, 112, 98, 93, 91, 88, 79, 72, 66, 65, 60, 60, 59, 55, 68, 82, 140, 206, 216, 201, 181, 197, 215, 199, 154, 125, 120, 120, 113, 98, 94, 100, 110, 128, 145, 153, 153, 155, 161, 163, 159, 147, 136, 132, 129, 125, 120, 117, 118, 121, 123, 124, 125, 127, 130, 134, 135, 133, 131, 132, 133, 135, 135, 133, 131, 133, 134, 127, 114, 104, 95, 92, 89, 84, 73, 67, 65, 61, 61, 59, 55, 60, 82, 140, 206, 225, 202, 181, 197, 213, 201, 155, 125, 117, 120, 114, 98, 94, 98, 108, 125, 139, 156, 157, 153, 154, 162, 162, 150, 136, 130, 128, 124, 119, 118, 116, 116, 121, 125, 129, 130, 131, 133, 136, 135, 133, 132, 130, 129, 130, 132, 132, 131, 129, 127, 125, 122, 115, 109, 100, 95, 93, 90, 88, 86, 81, 77, 75, 70, 63, 56, 58, 70, 105, 173, 208, 209, 183, 177, 191, 208, 184, 150, 135, 126, 122, 114, 111, 110, 108, 112, 124, 147, 157, 154, 149, 152, 159, 154, 147, 138, 131, 123, 117, 114, 116, 117, 116, 117, 123, 131, 136, 136, 136, 136, 136, 136, 132, 130, 129, 129, 130, 131, 132, 131, 128, 125, 122, 117, 112, 109, 101, 94, 91, 91, 93, 90, 86, 85, 81, 73, 67, 66, 64, 62, 78, 108, 174, 211, 202, 181, 170, 191, 206, 197, 170, 145, 133, 123, 117, 114, 118, 115, 113, 122, 144, 159, 158, 150, 147, 149, 146, 139, 129, 122, 119, 114, 112, 117, 120, 124, 125, 126, 130, 136, 139, 138, 136, 133, 132, 131, 130, 130, 130, 129, 129, 129, 129, 128, 127, 126, 125, 122, 120, 120, 118, 115, 108, 105, 101, 97, 91, 88, 83, 79, 73, 66, 60, 62, 67, 67, 65, 85, 149, 196, 237, 215, 177, 173, 199, 208, 171, 142, 117, 114, 116, 115, 119, 130, 133, 133, 138, 153, 167, 164, 154, 141, 137, 136, 131, 119, 109, 106, 108, 111, 117, 124, 126, 128, 129, 134, 139, 144, 142, 138, 136, 134, 132, 130, 129, 128, 127, 127, 127, 127, 127, 125, 123, 122, 120, 120, 119, 119, 116, 114, 115, 115, 116, 111, 101, 93, 84, 82, 84, 81, 68, 56, 56, 56, 61, 71, 106, 151, 220, 243, 218, 195, 183, 192, 185, 166, 139, 124, 119, 118, 116, 119, 125, 126, 125, 132, 148, 161, 161, 150, 143, 142, 140, 131, 119, 113, 111, 110, 111, 116, 121, 124, 126, 128, 132, 139, 143, 140, 138, 135, 133, 132, 130, 129, 128, 127, 127, 127, 128, 128, 127, 125, 124, 122, 121, 120, 119, 117, 115, 115, 115, 116, 113, 108, 97, 86, 81, 83, 83, 74, 60, 54, 55, 59, 66, 78, 127, 201, 243, 238, 205, 183, 188, 192, 176, 147, 128, 123, 119, 116, 117, 120, 125, 123, 126, 141, 152, 161, 155, 146, 145, 145, 137, 125, 119, 114, 111, 108, 109, 115, 120, 123, 124, 128, 135, 142, 142, 139, 136, 134, 134, 133, 132, 131, 130, 128, 127, 127, 127, 127, 126, 125, 123, 123, 122, 121, 119, 118, 117, 117, 116, 113, 107, 101, 95, 91, 89, 88, 84, 80, 74, 75, 84, 86, 76, 65, 82, 123, 199, 237, 219, 193, 172, 188, 202, 186, 141, 112, 107, 110, 114, 111, 119, 130, 133, 140, 155, 170, 174, 162, 146, 139, 137, 124, 117, 108, 105, 102, 103, 107, 114, 118, 121, 126, 134, 141, 143, 140, 137, 136, 137, 137, 133, 128, 126, 126, 127, 127, 127, 125, 124, 124, 126, 127, 126, 123, 122, 125, 128, 125, 121, 116, 113, 108, 103, 102, 100, 93, 86, 86, 87, 87, 83, 81, 80, 77, 73, 73, 91, 149, 226, 245, 225, 187, 177, 189, 197, 160, 121, 111, 108, 106, 105, 109, 126, 133, 130, 137, 156, 166, 159, 147, 140, 145, 141, 128, 120, 108, 100, 97, 102, 118, 128, 125, 121, 122, 130, 138, 141, 139, 137, 133, 131, 132, 133, 131, 128, 123, 124, 128, 129, 128, 129, 131, 131, 130, 129, 128, 127, 124, 121, 118, 114, 110, 110, 113, 114, 112, 105, 103, 107, 108, 104, 96, 91, 94, 93, 87, 78, 72, 74, 87, 104, 120, 163, 216, 236, 222, 195, 183, 183, 175, 148, 122, 105, 99, 95, 103, 119, 126, 134, 148, 166, 172, 166, 150, 137, 129, 127, 122, 119, 114, 110, 109, 113, 120, 124, 129, 131, 133, 134, 135, 136, 135, 133, 128, 127, 131, 135, 134, 131, 128, 128, 127, 126, 127, 127, 127, 127, 127, 128, 127, 126, 125, 122, 120, 117, 116, 115, 113, 112, 112, 112, 111, 110, 111, 106, 97, 91, 93, 93, 93, 90, 85, 82, 85, 90, 93, 101, 128, 204, 252, 234, 207, 174, 166, 155, 139, 120, 108, 94, 93, 117, 145, 153, 144, 143, 156, 162, 155, 149, 136, 125, 118, 119, 123, 119, 113, 114, 122, 130, 133, 133, 134, 131, 125, 123, 125, 125, 124, 123, 124, 126, 131, 137, 145, 142, 135, 132, 129, 126, 124, 123, 123, 123, 123, 124, 125, 126, 126, 125, 124, 123, 120, 117, 117, 116, 112, 109, 108, 112, 112, 108, 107, 103, 98, 97, 95, 91, 84, 80, 77, 87, 102, 111, 126, 183, 238, 234, 209, 178, 163, 146, 127, 121, 111, 99, 109, 126, 146, 146, 145, 151, 162, 158, 152, 147, 132, 115, 111, 114, 118, 116, 119, 124, 131, 135, 136, 134, 128, 122, 122, 121, 118, 116, 119, 122, 126, 130, 135, 137, 141, 142, 137, 133, 132, 129, 125, 121, 120, 119, 119, 123, 127, 125, 123, 124, 126, 126, 125, 126, 124, 120, 116, 108, 100, 96, 97, 97, 93, 96, 103, 111, 110, 106, 102, 96, 87, 86, 95, 104, 117, 162, 200, 236, 213, 181, 165, 143, 130, 122, 114, 98, 105, 133, 156, 165, 174, 169, 161, 158, 158, 147, 116, 100, 91, 96, 106, 118, 136, 146, 150, 152, 153, 143, 127, 116, 98, 90, 98, 106, 113, 121, 133, 139, 145, 149, 150, 146, 144, 145, 142, 143, 141, 131, 120, 120, 121, 125, 128, 124, 119, 114, 120, 129, 130, 125, 120, 116, 114, 111, 100, 98, 103, 110, 105, 98, 96, 94, 97, 104, 105, 97, 89, 87, 91, 87, 100, 106, 107, 125, 175, 230, 236, 208, 167, 132, 122, 126, 134, 120, 112, 124, 149, 169, 176, 169, 156, 141, 140, 138, 125, 114, 102, 100, 110, 131, 146, 146, 148, 149, 145, 141, 129, 113, 93, 86, 92, 103, 117, 125, 131, 140, 150, 151, 145, 135, 132, 130, 133, 137, 143, 146, 139, 130, 127, 127, 125, 118, 116, 113, 113, 125, 135, 135, 129, 117, 111, 111, 113, 113, 105, 102, 96, 91, 96, 102, 105, 103, 105, 104, 103, 105, 95, 97, 98, 89, 92, 95, 95, 115, 185, 244, 241, 220, 181, 134, 113, 118, 120, 104, 105, 120, 144, 171, 190, 184, 162, 147, 139, 131, 114, 105, 102, 105, 119, 137, 145, 146, 145, 141, 134, 131, 122, 107, 96, 98, 103, 115, 134, 141, 139, 137, 138, 137, 135, 128, 116, 110, 110, 121, 144, 164, 171, 159, 141, 133, 125, 121, 115, 107, 109, 119, 130, 134, 131, 120, 109, 108, 111, 117, 116, 106, 102, 98, 102, 109, 108, 108, 104, 103, 109, 110, 105, 103, 99, 94, 91, 88, 87, 93, 104, 166, 233, 239, 222, 186, 136, 117, 121, 135, 121, 111, 122, 135, 159, 177, 186, 164, 142, 133, 119, 115, 122, 118, 116, 120, 128, 138, 145, 148, 141, 132, 126, 118, 114, 108, 105, 101, 107, 125, 137, 148, 147, 139, 132, 123, 121, 117, 115, 120, 132, 140, 147, 155, 148, 140, 137, 133, 127, 126, 123, 113, 114, 121, 123, 124, 121, 111, 107, 113, 118, 116, 111, 109, 107, 109, 113, 105, 103, 104, 107, 110, 109, 102, 96, 101, 102, 92, 78, 84, 94, 103, 140, 219, 245, 238, 210, 159, 114, 105, 114, 122, 121, 128, 139, 147, 170, 177, 171, 158, 141, 129, 114, 114, 116, 112, 115, 126, 132, 141, 147, 146, 138, 131, 128, 117, 107, 105, 105, 107, 120, 132, 136, 140, 139, 129, 124, 122, 121, 117, 122, 133, 140, 154, 163, 157, 142, 132, 125, 113, 112, 113, 111, 114, 125, 127, 123, 123, 117, 107, 107, 109, 112, 120, 122, 118, 108, 104, 102, 105, 111, 109, 106, 102, 104, 110, 106, 105, 111, 110, 105, 98, 89, 78, 85, 125, 214, 242, 234, 217, 156, 117, 117, 122, 128, 122, 132, 128, 132, 158, 167, 167, 165, 153, 129, 119, 125, 132, 121, 117, 113, 113, 130, 145, 148, 141, 131, 119, 115, 117, 118, 110, 110, 115, 120, 133, 139, 141, 139, 132, 132, 137, 143, 146, 138, 138, 134, 127, 121, 119, 123, 127, 127, 129, 125, 124, 123, 117, 107, 102, 101, 104, 109, 112, 108, 106, 110, 111, 114, 114, 112, 110, 107, 106, 105, 104, 110, 110, 109, 110, 109, 113, 113, 108, 102, 98, 96, 114, 160, 211, 220, 210, 195, 153, 131, 122, 119, 124, 127, 134, 143, 150, 158, 161, 151, 147, 142, 132, 129, 126, 125, 123, 123, 121, 120, 126, 134, 135, 135, 132, 124, 121, 119, 119, 117, 117, 120, 121, 126, 131, 131, 131, 129, 129, 129, 129, 135, 138, 136, 134, 132, 128, 127, 127, 127, 126, 126, 126, 125, 125, 124, 121, 118, 117, 114, 113, 114, 116, 117, 119, 122, 121, 117, 116, 114, 113, 115, 117, 117, 112, 112, 114, 115, 113, 112, 110, 107, 105, 104, 98, 91, 79, 95, 177, 214, 235, 240, 195, 153, 125, 123, 130, 130, 136, 133, 116, 124, 148, 155, 167, 166, 145, 126, 117, 123, 125, 130, 131, 116, 111, 116, 123, 138, 142, 135, 124, 112, 111, 112, 117, 122, 121, 117, 121, 125, 127, 134, 135, 135, 136, 139, 140, 141, 144, 141, 133, 132, 132, 130, 131, 130, 126, 119, 116, 115, 113, 112, 112, 109, 107, 107, 106, 109, 115, 115, 114, 114, 110, 108, 107, 106, 108, 111, 114, 112, 113, 122, 124, 122, 116, 106, 97, 93, 94, 91, 90, 105, 158, 202, 218, 218, 193, 154, 135, 132, 138, 144, 146, 141, 126, 126, 139, 147, 158, 160, 144, 128, 122, 122, 130, 137, 136, 126, 116, 114, 117, 127, 137, 136, 131, 123, 117, 116, 118, 123, 124, 122, 122, 122, 125, 130, 133, 134, 135, 136, 136, 137, 137, 133, 131, 126, 123, 122, 124, 128, 128, 127, 125, 121, 115, 112, 110, 110, 110, 113, 112, 112, 115, 115, 115, 117, 117, 114, 114, 115, 114, 114, 115, 117, 117, 117, 123, 121, 115, 114, 113, 109, 107, 110, 103, 94, 83, 81, 128, 173, 211, 232, 220, 172, 146, 129, 128, 137, 142, 149, 137, 126, 129, 130, 139, 156, 157, 149, 136, 125, 123, 126, 136, 138, 133, 125, 115, 112, 116, 123, 129, 129, 126, 121, 116, 117, 119, 122, 128, 129, 128, 130, 130, 134, 138, 140, 139, 135, 133, 130, 127, 128, 127, 127, 127, 124, 121, 118, 115, 113, 113, 114, 114, 113, 111, 109, 112, 116, 120, 123, 120, 114, 108, 108, 112, 117, 123, 125, 123, 118, 112, 110, 111, 117, 122, 122, 122, 121, 116, 111, 108, 101, 93, 87, 92, 120, 154, 181, 195, 200, 182, 162, 149, 143, 144, 155, 163, 158, 148, 135, 126, 126, 138, 147, 150, 144, 134, 123, 120, 123, 127, 132, 133, 129, 123, 118, 116, 117, 120, 123, 123, 121, 119, 117, 118, 121, 125, 128, 128, 128, 127, 127, 131, 135, 138, 141, 139, 135, 130, 126, 125, 125, 128, 129, 125, 122, 120, 116, 116, 117, 116, 113, 109, 107, 105, 108, 115, 117, 119, 120, 116, 115, 115, 117, 121, 120, 119, 119, 114, 112, 111, 111, 112, 114, 116, 117, 115, 112, 107, 101, 97, 96, 106, 134, 157, 177, 184, 180, 167, 152, 142, 140, 145, 155, 158, 155, 148, 134, 128, 128, 132, 140, 145, 146, 141, 134, 129, 127, 127, 131, 132, 132, 128, 121, 116, 116, 118, 120, 122, 123, 123, 122, 122, 122, 122, 123, 124, 124, 125, 125, 126, 130, 133, 136, 137, 137, 135, 130, 127, 123, 120, 120, 120, 122, 124, 125, 124, 122, 120, 119, 117, 116, 118, 118, 117, 116, 114, 114, 114, 115, 116, 118, 119, 119, 118, 117, 117, 117, 119, 118, 117, 116, 117, 116, 111, 111, 112, 113, 115, 115, 122, 136, 147, 155, 164, 165, 161, 157, 152, 148, 147, 147, 146, 143, 141, 138, 134, 134, 137, 140, 144, 145, 142, 138, 133, 129, 129, 130, 131, 131, 129, 126, 121, 117, 117, 118, 121, 125, 124, 123, 122, 120, 121, 124, 125, 126, 125, 124, 123, 121, 124, 127, 128, 131, 131, 129, 127, 125, 125, 126, 128, 128, 127, 126, 124, 122, 120, 120, 121, 122, 124, 123, 122, 121, 119, 117, 117, 118, 118, 119, 118, 117, 116, 117, 118, 119, 121, 121, 119, 116, 113, 113, 116, 120, 123, 123, 122, 121, 117, 115, 116, 122, 132, 140, 148, 152, 152, 151, 150, 149, 150, 152, 152, 150, 145, 139, 134, 134, 134, 136, 138, 137, 135, 132, 131, 130, 130, 131, 132, 130, 127, 123, 121, 120, 120, 122, 122, 122, 122, 121, 122, 123, 124, 125, 125, 124, 124, 123, 124, 126, 128, 130, 131, 129, 127, 126, 125, 126, 127, 128, 127, 126, 123, 122, 120, 120, 121, 122, 124, 123, 122, 121, 119, 117, 117, 118, 118, 119, 118, 117, 116, 117, 118, 119, 121, 121, 119, 116, 113, 113, 116, 120, 123, 123, 122, 121, 117, 115, 116, 122, 132, 140, 148, 151, 152, 151, 150, 151, 150, 153, 153, 149, 146, 140, 134, 133, 133, 135, 137, 137, 136, 133, 131, 130, 130, 131, 133, 132, 131, 127, 124, 120, 120, 120, 121, 122, 122, 122, 123, 123, 123, 124, 126, 126, 125, 125, 125, 125, 127, 128, 129, 129, 128, 127, 126, 126, 125, 126, 127, 126, 125, 125, 123, 121, 122, 122, 123, 124, 123, 122, 120, 118, 117, 117, 118, 119, 120, 120, 119, 117, 117, 116, 117, 120, 121, 121, 120, 120, 119, 120, 121, 123, 124, 125, 124, 121, 121, 123, 123, 126, 132, 137, 139, 140, 140, 139, 141, 144, 148, 151, 152, 152, 148, 144, 141, 139, 140, 143, 144, 145, 144, 140, 137, 136, 134, 133, 132, 131, 128, 125, 121, 120, }; const uint8_t one[2968] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 131, 144, 159, 167, 174, 177, 178, 178, 175, 170, 163, 158, 150, 142, 134, 130, 123, 118, 113, 111, 110, 109, 110, 111, 113, 116, 118, 119, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 131, 131, 131, 130, 129, 127, 127, 125, 123, 122, 121, 120, 120, 119, 119, 119, 119, 120, 121, 122, 123, 125, 125, 125, 125, 124, 123, 121, 119, 118, 117, 115, 114, 113, 113, 111, 109, 106, 105, 102, 100, 101, 105, 109, 119, 133, 146, 155, 168, 176, 179, 179, 179, 177, 171, 167, 160, 152, 145, 139, 132, 125, 119, 116, 113, 112, 113, 114, 117, 120, 124, 126, 128, 129, 129, 128, 127, 126, 125, 124, 123, 124, 124, 125, 126, 126, 126, 127, 126, 125, 123, 119, 116, 111, 105, 99, 97, 93, 92, 94, 96, 101, 107, 113, 117, 120, 121, 119, 116, 111, 107, 105, 106, 111, 121, 136, 147, 164, 180, 188, 191, 191, 188, 181, 171, 163, 151, 140, 130, 124, 116, 111, 108, 106, 106, 107, 110, 113, 118, 124, 131, 134, 139, 143, 144, 143, 140, 136, 131, 127, 122, 117, 114, 113, 112, 114, 116, 119, 123, 127, 130, 132, 132, 131, 128, 124, 120, 114, 107, 100, 97, 92, 91, 93, 95, 100, 106, 113, 116, 120, 121, 119, 116, 111, 107, 105, 106, 111, 121, 136, 147, 164, 180, 188, 191, 191, 189, 182, 175, 163, 152, 140, 129, 123, 115, 110, 107, 105, 105, 107, 112, 115, 121, 128, 134, 137, 141, 142, 142, 140, 135, 130, 124, 121, 116, 112, 111, 111, 113, 116, 121, 124, 128, 132, 133, 133, 131, 126, 121, 114, 108, 102, 96, 92, 91, 92, 96, 102, 106, 112, 118, 120, 121, 119, 114, 110, 107, 105, 107, 114, 121, 136, 153, 170, 180, 188, 191, 191, 189, 182, 171, 159, 151, 139, 128, 119, 115, 110, 107, 106, 108, 110, 115, 121, 127, 131, 135, 138, 139, 138, 134, 131, 125, 120, 116, 113, 111, 111, 113, 116, 120, 125, 129, 131, 133, 132, 128, 125, 119, 111, 104, 100, 94, 92, 93, 95, 100, 106, 112, 116, 120, 121, 119, 116, 111, 107, 105, 106, 111, 121, 136, 153, 164, 181, 189, 193, 193, 190, 183, 172, 163, 150, 137, 124, 117, 108, 101, 98, 97, 98, 103, 110, 116, 126, 137, 146, 151, 156, 157, 155, 152, 143, 133, 121, 113, 103, 95, 91, 91, 95, 102, 112, 122, 128, 135, 139, 139, 137, 131, 122, 112, 105, 95, 88, 82, 80, 78, 80, 85, 87, 92, 96, 101, 104, 107, 111, 121, 131, 147, 164, 181, 188, 192, 193, 191, 187, 176, 164, 150, 141, 128, 116, 106, 100, 98, 97, 100, 106, 112, 121, 131, 140, 145, 151, 154, 154, 152, 147, 140, 132, 126, 118, 112, 108, 107, 107, 109, 113, 115, 120, 123, 127, 128, 129, 131, 129, 129, 125, 123, 117, 110, 103, 97, 87, 80, 75, 72, 71, 68, 70, 74, 83, 95, 110, 127, 158, 180, 198, 214, 220, 215, 208, 187, 165, 141, 129, 113, 105, 103, 106, 112, 121, 130, 137, 144, 150, 153, 152, 151, 147, 144, 141, 138, 134, 130, 126, 123, 120, 119, 118, 118, 120, 121, 123, 124, 126, 128, 130, 131, 131, 130, 126, 123, 117, 109, 100, 95, 85, 77, 73, 68, 65, 65, 67, 65, 69, 70, 85, 92, 117, 140, 169, 197, 210, 221, 221, 207, 193, 170, 146, 125, 114, 108, 107, 114, 121, 130, 140, 147, 150, 153, 152, 149, 146, 143, 139, 135, 134, 132, 128, 126, 124, 122, 121, 121, 121, 122, 123, 125, 126, 128, 129, 131, 131, 131, 128, 124, 117, 111, 104, 95, 84, 80, 74, 68, 65, 68, 65, 65, 69, 69, 79, 92, 116, 130, 160, 187, 209, 218, 223, 212, 195, 182, 155, 133, 116, 110, 108, 112, 121, 131, 138, 148, 151, 154, 153, 150, 146, 141, 138, 134, 133, 132, 130, 130, 129, 127, 126, 125, 124, 124, 125, 126, 127, 130, 130, 132, 133, 131, 130, 127, 119, 112, 104, 94, 84, 76, 73, 69, 69, 67, 71, 69, 67, 66, 61, 58, 70, 88, 111, 143, 204, 224, 233, 227, 206, 189, 154, 125, 105, 101, 100, 117, 131, 141, 156, 164, 164, 164, 154, 147, 139, 135, 131, 129, 129, 129, 129, 130, 129, 130, 129, 128, 128, 128, 128, 129, 130, 131, 132, 133, 133, 133, 131, 128, 123, 116, 110, 102, 92, 86, 83, 79, 81, 81, 81, 81, 77, 72, 66, 59, 47, 53, 69, 105, 145, 196, 224, 239, 237, 212, 190, 148, 114, 90, 84, 94, 115, 145, 160, 175, 180, 172, 160, 150, 137, 130, 131, 131, 135, 134, 133, 130, 126, 124, 123, 124, 127, 130, 133, 134, 134, 134, 133, 132, 131, 129, 128, 126, 124, 119, 116, 113, 109, 104, 100, 97, 93, 87, 83, 78, 76, 69, 67, 65, 61, 60, 61, 78, 101, 134, 184, 219, 234, 234, 213, 175, 145, 105, 88, 87, 101, 124, 152, 174, 181, 180, 168, 151, 141, 130, 128, 130, 133, 139, 139, 136, 132, 126, 122, 123, 126, 130, 134, 137, 137, 136, 134, 131, 129, 128, 127, 126, 126, 127, 126, 125, 120, 116, 108, 99, 91, 85, 79, 78, 77, 78, 75, 73, 66, 61, 50, 38, 59, 91, 132, 196, 240, 249, 239, 208, 154, 106, 84, 77, 91, 126, 144, 171, 187, 180, 173, 153, 137, 125, 125, 129, 136, 142, 144, 139, 134, 125, 121, 119, 122, 129, 133, 137, 139, 138, 136, 132, 129, 127, 126, 126, 127, 128, 129, 127, 125, 119, 111, 104, 95, 87, 80, 79, 77, 77, 76, 75, 71, 63, 53, 45, 38, 76, 117, 151, 212, 247, 246, 231, 187, 136, 92, 80, 77, 103, 137, 158, 182, 189, 175, 166, 142, 129, 121, 125, 132, 142, 148, 143, 137, 129, 119, 116, 118, 125, 135, 141, 144, 142, 137, 130, 126, 123, 121, 123, 125, 130, 136, 137, 136, 129, 118, 102, 93, 82, 79, 78, 83, 89, 91, 87, 82, 69, 56, 43, 39, 51, 103, 147, 209, 234, 244, 222, 178, 140, 98, 77, 95, 111, 152, 178, 189, 188, 167, 141, 124, 118, 126, 138, 151, 155, 152, 141, 124, 117, 111, 112, 123, 130, 139, 145, 141, 138, 130, 124, 120, 122, 125, 132, 139, 143, 145, 142, 133, 118, 109, 92, 89, 91, 97, 100, 101, 97, 83, 66, 58, 45, 41, 46, 51, 70, 128, 164, 192, 230, 228, 204, 178, 130, 98, 85, 99, 120, 157, 172, 178, 177, 160, 142, 139, 133, 140, 146, 149, 146, 139, 129, 120, 120, 122, 127, 135, 138, 138, 137, 130, 127, 123, 123, 125, 128, 133, 137, 140, 140, 138, 133, 125, 120, 111, 107, 105, 104, 106, 104, 98, 93, 84, 72, 62, 56, 52, 52, 54, 53, 56, 92, 139, 187, 223, 243, 228, 188, 149, 103, 77, 88, 105, 149, 181, 190, 185, 168, 142, 131, 127, 134, 146, 156, 156, 147, 133, 121, 116, 117, 122, 132, 137, 139, 137, 132, 127, 124, 122, 125, 127, 133, 137, 140, 141, 140, 136, 130, 123, 118, 110, 107, 106, 105, 106, 104, 98, 93, 84, 72, 62, 57, 52, 52, 54, 53, 56, 92, 139, 168, 223, 243, 228, 203, 148, 103, 76, 79, 105, 150, 183, 192, 187, 168, 140, 128, 125, 135, 148, 159, 159, 149, 132, 118, 114, 114, 122, 135, 139, 140, 136, 128, 123, 120, 121, 128, 132, 139, 143, 144, 144, 140, 133, 125, 119, 112, 106, 107, 109, 111, 113, 109, 101, 94, 81, 74, 71, 73, 70, 71, 61, 54, 40, 37, 91, 133, 189, 252, 254, 238, 184, 116, 74, 64, 88, 133, 186, 205, 202, 179, 141, 116, 111, 117, 143, 154, 164, 156, 134, 120, 107, 109, 123, 139, 148, 150, 139, 128, 119, 114, 116, 125, 131, 138, 143, 143, 142, 138, 132, 128, 124, 121, 119, 120, 120, 121, 117, 112, 107, 97, 88, 82, 79, 81, 83, 87, 87, 79, 67, 53, 46, 42, 73, 143, 191, 236, 250, 226, 172, 130, 85, 78, 106, 141, 186, 209, 194, 175, 145, 118, 126, 130, 150, 161, 153, 141, 120, 103, 102, 111, 133, 151, 157, 153, 135, 118, 103, 104, 113, 125, 138, 144, 144, 142, 138, 135, 133, 132, 131, 131, 131, 130, 128, 124, 121, 116, 110, 102, 99, 94, 91, 89, 87, 81, 77, 74, 74, 72, 69, 68, 63, 60, 58, 120, 160, 208, 254, 246, 216, 157, 89, 70, 88, 125, 173, 214, 208, 188, 154, 123, 120, 132, 162, 166, 154, 127, 100, 90, 95, 121, 144, 155, 157, 141, 116, 106, 95, 101, 119, 132, 147, 150, 147, 142, 134, 131, 130, 131, 131, 132, 133, 132, 130, 127, 123, 121, 119, 118, 115, 112, 105, 96, 90, 83, 80, 75, 71, 74, 75, 81, 85, 86, 85, 82, 78, 85, 114, 151, 198, 224, 227, 208, 160, 119, 102, 107, 139, 174, 195, 192, 174, 143, 126, 123, 132, 148, 156, 152, 134, 113, 105, 104, 118, 139, 151, 156, 145, 127, 110, 103, 104, 113, 127, 133, 139, 141, 135, 135, 133, 133, 136, 137, 137, 136, 132, 131, 127, 125, 123, 122, 121, 120, 117, 116, 112, 105, 99, 96, 91, 89, 87, 85, 85, 81, 81, 81, 80, 81, 74, 72, 73, 81, 119, 169, 198, 243, 235, 209, 175, 126, 107, 114, 140, 172, 196, 182, 167, 134, 113, 115, 128, 149, 163, 158, 141, 121, 101, 105, 114, 138, 155, 159, 147, 132, 112, 100, 101, 107, 117, 124, 128, 128, 130, 135, 142, 144, 147, 144, 137, 132, 126, 124, 126, 128, 131, 132, 131, 128, 122, 117, 113, 113, 112, 110, 105, 103, 96, 93, 93, 94, 94, 92, 89, 84, 84, 81, 82, 81, 79, 78, 77, 97, 124, 174, 214, 240, 232, 204, 155, 114, 108, 118, 154, 181, 192, 179, 153, 127, 115, 119, 136, 156, 162, 155, 131, 112, 101, 106, 123, 145, 155, 158, 146, 124, 107, 100, 101, 111, 120, 125, 128, 129, 131, 135, 142, 146, 146, 144, 137, 130, 124, 124, 125, 129, 132, 132, 131, 126, 120, 117, 113, 112, 111, 110, 105, 101, 93, 92, 93, 96, 96, 95, 90, 85, 85, 80, 83, 81, 81, 81, 80, 101, 142, 193, 212, 236, 221, 181, 150, 115, 112, 134, 155, 180, 183, 165, 145, 129, 124, 138, 149, 158, 153, 132, 117, 104, 105, 121, 134, 150, 151, 141, 125, 115, 108, 106, 114, 119, 126, 127, 127, 127, 129, 135, 139, 142, 143, 139, 134, 132, 128, 128, 129, 129, 131, 131, 130, 128, 124, 121, 117, 115, 114, 113, 109, 105, 102, 94, 94, 94, 96, 97, 93, 89, 86, 85, 80, 83, 81, 81, 81, 85, 101, 179, 202, 232, 230, 197, 165, 125, 108, 125, 144, 175, 185, 173, 154, 133, 124, 135, 146, 160, 156, 138, 119, 102, 103, 119, 132, 150, 151, 140, 128, 112, 106, 108, 114, 124, 130, 130, 128, 125, 126, 130, 134, 136, 140, 139, 136, 135, 132, 134, 133, 134, 132, 130, 127, 125, 124, 124, 126, 126, 125, 121, 116, 111, 106, 103, 101, 102, 98, 97, 96, 97, 100, 104, 103, 101, 95, 84, 78, 71, 67, 74, 83, 103, 121, 171, 193, 219, 227, 195, 170, 136, 120, 122, 139, 162, 171, 178, 154, 142, 138, 133, 147, 151, 151, 136, 122, 111, 113, 125, 140, 152, 149, 140, 127, 117, 115, 113, 115, 117, 119, 120, 123, 127, 131, 132, 131, 130, 131, 133, 136, 139, 138, 137, 135, 132, 130, 129, 128, 127, 126, 126, 127, 128, 130, 128, 126, 120, 114, 108, 106, 105, 108, 110, 113, 114, 111, 107, 102, 92, 89, 85, 88, 95, 97, 95, 90, 85, 77, 83, 86, 93, 122, 148, 174, 174, 204, 192, 185, 164, 141, 140, 139, 161, 162, 174, 166, 150, 148, 142, 147, 148, 146, 137, 130, 121, 121, 131, 131, 135, 137, 138, 136, 133, 131, 121, 112, 110, 109, 115, 120, 125, 128, 132, 135, 134, 134, 131, 133, 133, 133, 133, 133, 135, 134, 135, 134, 132, 131, 128, 127, 127, 125, 125, 123, 121, 122, 120, 118, 117, 116, 116, 115, 114, 110, 107, 104, 105, 106, 98, 97, 91, 92, 89, 91, 102, 100, 92, 81, 77, 78, 83, 102, 125, 142, 183, 199, 198, 181, 143, 128, 152, 163, 184, 180, 158, 142, 144, 152, 166, 167, 155, 139, 132, 135, 137, 141, 129, 125, 126, 131, 144, 144, 140, 133, 122, 117, 114, 116, 115, 115, 118, 120, 125, 131, 132, 130, 129, 127, 127, 133, 138, 136, 133, 131, 130, 131, 134, 135, 134, 130, 126, 126, 127, 128, 127, 125, 124, 124, 124, 123, 120, 120, 118, 116, 112, 110, 109, 109, 112, 109, 106, 101, 96, 97, 96, 92, 87, 89, 94, 99, 98, 96, 96, 94, 94, 95, 90, 103, 129, 173, 197, 187, 197, 192, 183, 170, 169, 154, 143, 148, 147, 163, 157, 150, 145, 147, 145, 148, 137, 123, 119, 119, 127, 129, 131, 131, 133, 135, 133, 128, 121, 115, 115, 116, 118, 117, 118, 125, 130, 134, 135, 136, 138, 140, 136, 131, 128, 127, 130, 135, 134, 133, 133, 132, 130, 128, 127, 126, 126, 124, 122, 122, 121, 120, 118, 118, 117, 115, 115, 114, 113, 112, 112, 111, 108, 108, 105, 102, 100, 100, 97, 98, 99, 95, 96, 102, 108, 103, 90, 85, 88, 103, 88, 96, 114, 164, 195, 197, 189, 191, 191, 180, 176, 166, 149, 148, 151, 157, 162, 153, 145, 144, 150, 149, 152, 142, 129, 126, 127, 132, 132, 130, 126, 126, 129, 131, 127, 120, 116, 113, 116, 116, 114, 115, 122, 127, 132, 136, 138, 140, 138, 136, 133, 132, 132, 130, 129, 130, 130, 128, 128, 127, 126, 126, 126, 125, 125, 123, 122, 122, 122, 120, 120, 120, 118, 116, 115, 115, 114, 114, 114, 112, 111, 110, 106, 104, 105, 102, 105, 100, 96, 98, 95, 100, 97, 102, 98, 100, 101, 101, 98, 100, 101, 118, 155, 172, 182, 182, 174, 178, 189, 187, 171, 165, 159, 160, 165, 161, 157, 148, 149, 154, 153, 146, 140, 136, 132, 136, 138, 134, 127, 125, 124, 129, 126, 122, 117, 115, 117, 117, 117, 117, 121, 124, 129, 135, 137, 135, 133, 136, 137, 134, 130, 130, 132, 129, 127, 127, 127, 127, 126, 125, 125, 124, 124, 123, 121, 121, 121, 122, 120, 119, 118, 118, 118, 117, 116, 114, 113, 111, 110, 109, 111, 111, 109, 106, 107, 108, 109, 111, 107, 108, 109, 107, 100, 104, 102, 105, 106, 96, 102, 113, 104, 118, 146, 153, 157, 172, 174, 175, 175, 177, 177, 178, 172, 167, 164, 162, 158, 156, 149, 149, 148, 143, 141, 140, 138, 136, 135, 134, 131, 132, 130, 128, 124, 123, 122, 119, 117, 117, 118, 118, 117, 117, 119, 122, 124, 128, 127, 131, 133, 132, 133, 134, 133, 133, 132, 131, 130, 129, 127, 126, 126, 125, 124, 123, 123, 123, 122, 122, 122, 121, 121, 120, 120, 119, 118, 117, 116, 114, 113, 113, 111, 110, 108, 107, 106, 105, 104, 106, 105, 105, 110, 108, 109, 109, 106, 109, 114, 109, 107, 109, 110, 111, 114, 117, 126, 135, 134, 140, 148, 154, 153, 160, 171, 173, 175, 179, 183, 182, 181, 178, 175, 171, 166, 161, 156, 150, 145, 142, 139, 132, 129, 124, 121, 119, 116, 114, 114, 113, 112, 112, 112, 113, 114, 116, 118, 121, 122, 123, 125, 128, 129, 131, 131, 132, 133, 134, 134, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 124, 123, 122, 121, 119, 118, 117, 115, 113, 112, 111, 109, 108, 107, 107, 106, 106, 106, 107, 107, 108, 110, 110, 110, 112, 113, 112, 112, 114, 114, 113, 112, 114, 113, 111, 111, 109, 111, 116, 122, 124, 130, 138, 144, 155, 161, 163, 169, 183, 187, 187, 188, 190, 193, 190, 184, 177, 173, 167, 162, 154, 146, 141, 139, 132, 128, 123, 120, 115, 114, 112, 111, 109, 108, 108, 108, 108, 108, 111, 113, 113, 117, 122, 121, 122, 127, 129, 130, 132, 133, 134, 136, 136, 134, 134, 133, 133, 132, 130, 128, 128, 126, 124, 122, 122, 121, 118, 116, 115, 114, 112, 110, 109, 108, 107, 106, 105, 104, 105, 105, 104, 104, 107, 107, 108, 107, 109, 110, 113, 111, 113, 115, 116, 116, 116, 118, 118, 115, 114, 118, 112, 112, 121, 125, 126, 134, 140, 144, 153, 161, 163, 169, 176, 182, 184, 184, 185, 187, 186, 180, 176, 173, 167, 160, 154, 148, 145, 140, 134, 129, 127, 124, 119, 118, 116, 114, 113, 112, 111, 112, 112, 112, 113, 115, 116, 119, 121, 123, 124, 126, 128, 131, 131, 131, 133, 134, 133, 132, 132, 132, 131, 129, 128, 127, 126, 125, 123, 123, 121, 120, 118, 117, 116, 115, 113, 112, 111, 110, 109, 108, 108, 108, 108, 107, 107, 108, 108, 109, 109, 111, 113, 112, 113, 115, 117, 117, 116, 116, 121, 119, 114, 115, 117, 112, 111, 109, 117, 122, 120, 123, 138, 146, 148, 154, 160, 172, 178, 180, 180, 188, 191, 191, 188, 182, 180, 177, 171, 161, 156, 152, 147, 141, 137, 132, 128, 123, 120, 118, 115, 113, 111, 110, 110, 109, 109, 108, 110, 110, 113, 115, 118, 118, 121, 124, }; const uint8_t two[2968] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 127, 127, 127, 127, 128, 127, 127, 127, 128, 127, 127, 128, 125, 126, 125, 127, 124, 129, 126, 128, 126, 128, 126, 127, 127, 129, 126, 128, 126, 127, 128, 126, 148, 106, 170, 113, 124, 135, 119, 123, 112, 124, 114, 124, 118, 130, 123, 126, 135, 150, 131, 118, 116, 131, 121, 123, 127, 133, 115, 124, 132, 124, 126, 126, 125, 132, 132, 127, 109, 139, 117, 133, 107, 133, 102, 150, 110, 133, 112, 123, 126, 123, 131, 133, 121, 145, 134, 146, 126, 126, 152, 125, 129, 124, 139, 118, 110, 123, 113, 105, 117, 125, 144, 132, 85, 139, 114, 139, 160, 99, 149, 129, 162, 102, 132, 82, 151, 106, 150, 138, 136, 120, 142, 132, 118, 119, 123, 134, 147, 131, 118, 133, 147, 125, 141, 155, 142, 135, 140, 157, 144, 128, 124, 120, 102, 127, 103, 123, 104, 134, 118, 104, 122, 132, 123, 124, 112, 139, 130, 117, 137, 103, 168, 106, 133, 116, 150, 107, 143, 102, 171, 112, 146, 107, 118, 125, 149, 116, 158, 100, 133, 115, 119, 114, 124, 151, 129, 143, 104, 135, 124, 144, 125, 114, 142, 147, 142, 120, 130, 142, 152, 128, 133, 139, 119, 110, 121, 134, 136, 133, 97, 134, 144, 101, 146, 108, 128, 124, 118, 132, 106, 146, 97, 142, 127, 138, 120, 116, 152, 142, 131, 149, 129, 139, 131, 115, 134, 115, 143, 111, 119, 123, 112, 108, 126, 124, 162, 99, 138, 125, 135, 127, 125, 133, 122, 127, 118, 127, 119, 126, 116, 127, 121, 125, 140, 125, 135, 111, 144, 128, 131, 141, 124, 139, 146, 126, 133, 158, 140, 117, 132, 126, 104, 155, 129, 161, 111, 138, 139, 142, 138, 133, 152, 103, 149, 116, 156, 110, 141, 128, 121, 104, 140, 133, 125, 87, 139, 113, 122, 125, 122, 119, 141, 135, 124, 97, 143, 110, 134, 118, 136, 94, 131, 128, 135, 132, 75, 143, 115, 139, 115, 124, 137, 110, 165, 113, 133, 132, 139, 146, 130, 125, 131, 136, 134, 129, 131, 159, 126, 132, 125, 153, 160, 94, 126, 131, 104, 155, 121, 144, 114, 107, 129, 114, 145, 127, 119, 104, 142, 99, 141, 148, 149, 124, 146, 129, 122, 128, 133, 128, 140, 96, 154, 98, 141, 99, 144, 108, 161, 57, 154, 119, 121, 124, 108, 145, 104, 149, 108, 140, 163, 146, 129, 114, 164, 92, 145, 110, 170, 136, 132, 120, 154, 161, 116, 124, 120, 128, 134, 123, 117, 145, 129, 127, 107, 113, 139, 128, 126, 127, 126, 140, 123, 134, 106, 114, 132, 124, 124, 122, 128, 145, 129, 157, 141, 128, 143, 140, 140, 103, 122, 141, 124, 113, 144, 132, 93, 145, 105, 136, 115, 127, 106, 115, 151, 128, 126, 141, 132, 153, 121, 123, 132, 129, 125, 126, 120, 138, 94, 151, 108, 133, 135, 145, 119, 141, 171, 97, 154, 109, 143, 130, 130, 154, 121, 133, 97, 132, 126, 129, 125, 118, 151, 118, 133, 132, 109, 123, 127, 150, 126, 148, 98, 130, 114, 132, 121, 144, 131, 127, 130, 130, 126, 136, 125, 128, 144, 122, 118, 146, 128, 110, 137, 104, 142, 130, 141, 117, 159, 89, 142, 125, 132, 130, 100, 150, 95, 143, 133, 115, 137, 110, 140, 99, 146, 95, 138, 128, 121, 123, 135, 134, 114, 150, 121, 135, 121, 115, 139, 100, 144, 111, 125, 116, 133, 133, 138, 124, 136, 120, 125, 134, 126, 135, 123, 105, 142, 109, 134, 107, 133, 137, 140, 103, 133, 135, 129, 108, 112, 125, 130, 125, 117, 125, 132, 129, 118, 117, 138, 145, 127, 114, 118, 134, 136, 120, 117, 141, 141, 114, 133, 127, 151, 117, 123, 131, 123, 131, 118, 140, 123, 127, 117, 136, 128, 123, 121, 123, 129, 132, 131, 119, 127, 136, 113, 115, 141, 126, 124, 116, 133, 124, 135, 114, 118, 144, 139, 115, 138, 138, 124, 132, 119, 138, 131, 129, 114, 120, 133, 111, 122, 124, 128, 122, 125, 126, 125, 128, 130, 128, 126, 128, 131, 116, 117, 131, 124, 119, 121, 134, 127, 122, 127, 128, 134, 125, 123, 132, 138, 124, 127, 134, 129, 125, 129, 119, 136, 133, 123, 132, 144, 132, 127, 137, 131, 133, 133, 126, 129, 134, 126, 114, 127, 124, 124, 120, 117, 129, 127, 126, 120, 133, 131, 109, 117, 116, 115, 114, 107, 106, 109, 120, 106, 107, 124, 117, 115, 120, 125, 131, 137, 129, 135, 140, 150, 140, 151, 158, 157, 162, 165, 167, 170, 172, 163, 167, 157, 155, 148, 148, 132, 131, 129, 123, 118, 109, 117, 97, 91, 97, 100, 92, 89, 96, 86, 78, 79, 73, 82, 70, 71, 66, 71, 57, 53, 60, 63, 67, 120, 148, 120, 163, 186, 199, 192, 208, 205, 214, 214, 199, 184, 193, 179, 155, 147, 150, 141, 135, 127, 119, 137, 132, 117, 124, 146, 144, 137, 139, 150, 142, 136, 127, 118, 119, 95, 82, 72, 75, 64, 39, 42, 48, 38, 36, 37, 44, 49, 51, 46, 43, 151, 151, 99, 167, 206, 216, 190, 213, 215, 229, 220, 181, 175, 189, 171, 125, 121, 132, 117, 106, 95, 113, 124, 130, 121, 152, 175, 174, 175, 182, 187, 186, 169, 153, 154, 147, 115, 94, 97, 85, 64, 50, 46, 56, 60, 47, 47, 57, 66, 49, 45, 51, 57, 70, 150, 130, 162, 193, 202, 173, 213, 216, 216, 224, 180, 175, 186, 166, 124, 114, 131, 111, 98, 95, 94, 118, 126, 120, 132, 173, 178, 172, 186, 200, 194, 187, 172, 161, 154, 142, 101, 93, 92, 77, 46, 46, 45, 60, 50, 40, 49, 59, 57, 43, 43, 44, 37, 144, 137, 109, 159, 208, 213, 181, 208, 214, 227, 214, 174, 167, 178, 146, 113, 103, 120, 101, 94, 90, 94, 121, 127, 118, 142, 179, 183, 181, 191, 199, 197, 187, 167, 157, 151, 129, 95, 94, 85, 67, 47, 45, 47, 59, 46, 41, 51, 59, 52, 43, 46, 44, 63, 155, 102, 107, 186, 216, 200, 182, 216, 213, 230, 218, 167, 172, 174, 150, 103, 103, 118, 98, 92, 87, 99, 125, 125, 118, 148, 182, 186, 184, 192, 203, 204, 187, 164, 157, 153, 127, 95, 92, 89, 67, 48, 45, 45, 60, 48, 42, 49, 60, 53, 43, 43, 43, 66, 156, 100, 109, 188, 217, 199, 181, 218, 213, 231, 214, 165, 173, 172, 145, 99, 103, 117, 102, 90, 86, 102, 122, 124, 118, 154, 179, 189, 188, 193, 204, 210, 187, 159, 157, 150, 122, 94, 86, 82, 69, 50, 42, 45, 61, 59, 44, 49, 70, 63, 48, 48, 38, 94, 172, 125, 98, 182, 223, 207, 182, 205, 213, 226, 208, 154, 166, 176, 147, 91, 94, 109, 97, 84, 85, 96, 129, 130, 123, 144, 191, 190, 185, 205, 211, 203, 178, 155, 150, 143, 109, 86, 90, 87, 73, 60, 64, 62, 67, 78, 70, 57, 68, 65, 53, 35, 32, 49, 115, 139, 87, 153, 196, 220, 189, 201, 217, 223, 232, 182, 157, 174, 168, 122, 84, 95, 106, 81, 79, 75, 101, 131, 125, 119, 153, 196, 193, 185, 199, 216, 202, 188, 159, 151, 143, 129, 89, 84, 90, 80, 65, 62, 68, 62, 73, 76, 61, 64, 70, 56, 43, 36, 32, 73, 157, 98, 104, 175, 215, 197, 183, 210, 214, 222, 216, 164, 160, 167, 152, 108, 95, 116, 102, 90, 92, 100, 116, 129, 123, 133, 151, 161, 159, 156, 162, 164, 158, 146, 139, 139, 131, 116, 100, 97, 105, 96, 83, 82, 98, 88, 88, 91, 90, 87, 70, 58, 45, 43, 30, 82, 133, 104, 113, 177, 208, 200, 185, 219, 219, 224, 203, 164, 167, 160, 143, 98, 93, 107, 86, 80, 92, 92, 113, 126, 128, 133, 154, 168, 160, 158, 161, 164, 160, 145, 138, 133, 126, 119, 110, 99, 97, 101, 101, 93, 98, 106, 108, 109, 102, 95, 94, 81, 62, 49, 39, 21, 38, 133, 117, 61, 143, 199, 204, 185, 207, 223, 223, 225, 184, 148, 169, 161, 120, 88, 101, 101, 84, 89, 89, 99, 123, 130, 133, 140, 159, 167, 158, 156, 159, 161, 152, 144, 138, 131, 127, 122, 113, 106, 100, 100, 100, 101, 96, 100, 108, 111, 109, 103, 96, 93, 75, 62, 49, 38, 24, 68, 133, 96, 88, 170, 199, 193, 183, 217, 224, 216, 220, 168, 147, 171, 148, 100, 87, 101, 91, 81, 90, 88, 107, 129, 131, 136, 148, 165, 169, 158, 158, 156, 157, 149, 138, 134, 129, 126, 117, 113, 110, 103, 103, 104, 105, 109, 111, 116, 121, 124, 114, 102, 108, 98, 76, 49, 34, 37, 12, 18, 118, 125, 81, 137, 210, 211, 201, 221, 229, 233, 240, 194, 147, 157, 157, 116, 78, 93, 97, 85, 90, 87, 97, 118, 131, 131, 137, 157, 165, 156, 156, 157, 152, 150, 142, 131, 129, 130, 124, 115, 117, 119, 113, 106, 109, 113, 112, 113, 110, 123, 130, 127, 110, 114, 118, 93, 69, 51, 41, 33, 7, 11, 105, 122, 80, 126, 193, 218, 221, 220, 225, 236, 239, 214, 148, 147, 146, 126, 84, 62, 75, 87, 90, 86, 84, 114, 138, 143, 140, 154, 171, 171, 163, 157, 153, 153, 144, 131, 124, 124, 125, 119, 113, 117, 118, 116, 109, 111, 115, 118, 119, 119, 124, 132, 135, 122, 114, 119, 110, 76, 60, 49, 33, 9, 3, 18, 102, 111, 84, 132, 199, 220, 215, 225, 234, 223, 230, 214, 152, 145, 142, 115, 83, 76, 72, 68, 80, 86, 92, 108, 135, 142, 146, 156, 171, 169, 162, 160, 153, 147, 143, 136, 122, 121, 123, 120, 115, 116, 119, 121, 120, 115, 116, 119, 123, 125, 132, 133, 137, 150, 139, 127, 125, 119, 99, 73, 58, 16, 4, 255, 250, 27, 109, 122, 100, 155, 209, 228, 224, 227, 231, 232, 240, 201, 140, 136, 139, 96, 74, 55, 69, 70, 81, 85, 90, 124, 144, 152, 150, 164, 175, 171, 160, 157, 152, 143, 139, 129, 119, 119, 121, 117, 116, 119, 121, 121, 124, 124, 117, 117, 120, 121, 123, 129, 131, 134, 147, 144, 129, 127, 124, 109, 83, 66, 45, 16, 2, 255, 250, 27, 116, 122, 100, 155, 226, 228, 224, 227, 237, 231, 242, 201, 130, 145, 139, 95, 57, 55, 67, 70, 84, 85, 88, 126, 159, 155, 154, 167, 181, 168, 160, 156, 147, 136, 133, 125, 116, 114, 117, 115, 114, 118, 121, 124, 126, 126, 125, 123, 123, 124, 125, 130, 132, 133, 139, 146, 147, 132, 129, 123, 111, 105, 75, 56, 40, 41, 31, 13, 254, 18, 76, 139, 140, 138, 199, 244, 254, 233, 225, 236, 227, 211, 166, 125, 125, 117, 87, 62, 62, 73, 74, 90, 95, 105, 129, 155, 162, 163, 168, 173, 174, 165, 154, 140, 136, 127, 117, 110, 109, 112, 113, 112, 115, 123, 129, 131, 131, 132, 130, 129, 130, 131, 135, 134, 135, 141, 143, 145, 137, 132, 123, 106, 102, 95, 73, 64, 52, 42, 31, 31, 34, 38, 54, 81, 101, 151, 203, 191, 201, 226, 249, 232, 208, 203, 186, 166, 155, 131, 96, 93, 94, 89, 72, 87, 104, 111, 128, 138, 142, 158, 165, 167, 159, 156, 154, 145, 138, 126, 118, 112, 114, 112, 110, 111, 117, 123, 126, 130, 133, 137, 138, 138, 137, 134, 135, 133, 132, 133, 133, 134, 132, 133, 132, 127, 122, 115, 109, 102, 96, 85, 77, 76, 73, 68, 66, 63, 63, 70, 73, 76, 91, 112, 131, 143, 179, 190, 193, 204, 220, 212, 201, 199, 186, 161, 150, 141, 116, 106, 104, 98, 97, 102, 109, 112, 123, 135, 139, 145, 149, 152, 151, 149, 145, 139, 132, 127, 123, 116, 114, 114, 116, 118, 122, 127, 129, 133, 136, 137, 137, 137, 135, 133, 131, 130, 128, 128, 128, 129, 130, 131, 131, 131, 130, 126, 123, 119, 113, 106, 100, 97, 92, 90, 90, 88, 86, 84, 85, 84, 86, 84, 77, 76, 85, 95, 109, 123, 145, 158, 179, 197, 204, 205, 208, 210, 201, 189, 171, 154, 137, 126, 111, 99, 92, 91, 94, 98, 106, 115, 127, 139, 148, 153, 155, 155, 154, 152, 143, 135, 127, 118, 114, 108, 106, 106, 109, 115, 122, 130, 133, 136, 140, 142, 142, 140, 138, 137, 136, 136, 137, 136, 135, 134, 133, 130, 128, 121, 112, 106, 102, 95, 90, 88, 86, 85, 91, 95, 97, 101, 105, 110, 110, 104, 91, 81, 76, 66, 64, 72, 87, 106, 137, 161, 182, 199, 218, 233, 236, 233, 226, 208, 184, 169, 143, 118, 99, 90, 81, 78, 82, 88, 97, 113, 130, 136, 145, 155, 160, 160, 159, 153, 143, 133, 128, 118, 109, 104, 103, 103, 105, 108, 112, 120, 129, 138, 144, 148, 149, 150, 151, 150, 146, 142, 139, 136, 132, 126, 120, 114, 111, 107, 102, 96, 96, 99, 101, 101, 100, 106, 114, 119, 115, 109, 105, 104, 96, 88, 77, 67, 60, 55, 55, 56, 80, 118, 146, 164, 191, 213, 234, 240, 244, 235, 217, 207, 192, 166, 136, 116, 94, 83, 77, 77, 77, 82, 99, 110, 126, 138, 149, 159, 165, 171, 168, 158, 151, 140, 128, 117, 110, 102, 97, 96, 98, 103, 110, 118, 122, 132, 141, 149, 153, 153, 151, 150, 148, 145, 140, 137, 134, 130, 127, 122, 117, 112, 108, 105, 102, 99, 98, 97, 101, 105, 109, 111, 116, 118, 119, 118, 115, 112, 104, 94, 85, 77, 66, 60, 57, 56, 60, 81, 119, 142, 170, 192, 214, 228, 239, 244, 236, 223, 206, 187, 162, 142, 115, 95, 80, 74, 74, 75, 83, 97, 109, 125, 140, 152, 157, 163, 166, 165, 162, 151, 139, 127, 120, 111, 104, 98, 97, 98, 103, 110, 113, 121, 132, 141, 148, 156, 156, 153, 151, 149, 146, 140, 137, 132, 127, 124, 119, 115, 109, 106, 103, 101, 100, 99, 100, 102, 108, 114, 116, 121, 124, 125, 124, 119, 109, 100, 95, 88, 78, 71, 65, 64, 63, 66, 73, 84, 118, 155, 179, 191, 210, 221, 228, 231, 230, 211, 189, 175, 162, 143, 124, 107, 96, 86, 89, 91, 93, 108, 115, 126, 137, 147, 151, 154, 157, 156, 153, 147, 141, 131, 125, 118, 113, 108, 106, 107, 108, 111, 115, 122, 128, 136, 143, 150, 151, 151, 149, 145, 142, 138, 135, 130, 125, 120, 116, 111, 107, 102, 99, 97, 96, 98, 103, 107, 112, 118, 123, 125, 128, 127, 124, 121, 113, 106, 99, 95, 91, 88, 82, 79, 75, 76, 84, 91, 97, 110, 139, 160, 183, 197, 206, 208, 208, 211, 212, 203, 186, 170, 152, 136, 130, 123, 111, 100, 97, 99, 105, 115, 121, 128, 133, 140, 145, 149, 152, 150, 145, 138, 133, 129, 126, 120, 115, 110, 108, 108, 111, 116, 119, 124, 128, 135, 141, 148, 150, 149, 147, 143, 140, 137, 133, 130, 126, 122, 117, 114, 110, 106, 103, 101, 100, 100, 102, 104, 108, 114, 119, 120, 121, 120, 120, 119, 116, 113, 104, 97, 89, 83, 84, 86, 88, 89, 89, 89, 96, 105, 113, 137, 157, 175, 193, 203, 204, 201, 199, 204, 200, 189, 177, 157, 144, 132, 126, 120, 116, 112, 110, 108, 110, 118, 129, 135, 136, 140, 139, 141, 144, 146, 143, 135, 130, 123, 119, 118, 116, 114, 112, 114, 116, 119, 123, 127, 130, 133, 139, 144, 146, 145, 143, 140, 136, 135, 132, 129, 126, 123, 119, 116, 112, 110, 107, 105, 105, 105, 106, 108, 109, 111, 114, 117, 119, 120, 118, 115, 111, 109, 105, 101, 96, 91, 88, 86, 89, 94, 96, 98, 100, 103, 103, 111, 133, 159, 174, 192, 202, 200, 199, 198, 201, 197, 193, 184, 166, 149, 139, 130, 122, 114, 111, 108, 105, 108, 113, 120, 128, 135, 139, 141, 143, 147, 148, 148, 143, 134, 125, 119, 115, 113, 113, 113, 112, 112, 113, 116, 122, 128, 136, 139, 143, 143, 143, 143, 142, 139, 136, 133, 129, 126, 122, 120, 117, 114, 111, 110, 108, 107, 107, 109, 110, 112, 116, 119, 121, 122, 124, 122, 120, 116, 110, 105, 100, 97, 94, 94, 93, 90, 91, 92, 95, 100, 105, 111, 112, 111, 115, 128, 143, 164, 185, 195, 196, 193, 191, 193, 195, 199, 197, 183, 164, 153, 137, 129, 125, 121, 115, 107, 103, 104, }; const uint8_t three[3710] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 128, 127, 127, 127, 126, 126, 127, 128, 126, 127, 127, 128, 127, 127, 128, 128, 127, 126, 127, 127, 126, 127, 127, 128, 128, 127, 127, 126, 127, 127, 128, 126, 127, 127, 127, 127, 126, 127, 127, 127, 128, 127, 127, 127, 127, 126, 126, 127, 128, 125, 128, 128, 128, 128, 127, 126, 126, 128, 126, 126, 126, 126, 127, 127, 128, 128, 128, 130, 126, 128, 126, 129, 126, 126, 126, 129, 127, 125, 128, 129, 126, 126, 128, 126, 127, 127, 129, 126, 128, 128, 126, 127, 126, 128, 125, 126, 128, 128, 125, 129, 126, 128, 123, 130, 128, 125, 130, 127, 125, 129, 128, 126, 131, 125, 127, 126, 122, 128, 126, 128, 129, 127, 125, 123, 127, 130, 122, 123, 129, 129, 131, 126, 126, 128, 126, 120, 125, 123, 133, 122, 128, 125, 121, 121, 130, 129, 118, 133, 126, 122, 124, 127, 125, 124, 132, 127, 131, 133, 123, 127, 127, 127, 126, 128, 129, 126, 125, 123, 127, 130, 122, 123, 129, 130, 131, 126, 126, 125, 126, 120, 125, 125, 139, 122, 128, 125, 120, 121, 130, 129, 124, 133, 126, 122, 130, 127, 125, 124, 129, 127, 131, 133, 125, 127, 137, 121, 130, 127, 124, 130, 123, 128, 131, 121, 131, 124, 125, 125, 136, 126, 138, 127, 120, 122, 136, 132, 130, 120, 137, 129, 127, 134, 121, 136, 122, 127, 120, 141, 133, 127, 137, 133, 121, 121, 121, 134, 151, 124, 128, 117, 136, 143, 126, 115, 119, 132, 114, 112, 125, 126, 145, 105, 128, 119, 144, 110, 109, 129, 138, 134, 122, 120, 131, 141, 125, 113, 114, 135, 139, 122, 139, 131, 132, 127, 118, 131, 124, 122, 130, 115, 128, 133, 116, 140, 124, 138, 114, 130, 136, 131, 104, 137, 123, 134, 116, 116, 137, 126, 116, 150, 123, 122, 130, 121, 130, 129, 127, 129, 137, 121, 136, 144, 138, 136, 131, 129, 128, 130, 133, 110, 138, 134, 123, 123, 127, 112, 123, 126, 141, 119, 118, 143, 129, 146, 115, 130, 124, 130, 126, 122, 127, 130, 119, 129, 128, 128, 144, 114, 127, 125, 126, 127, 101, 107, 137, 146, 134, 116, 106, 141, 108, 126, 124, 125, 136, 121, 122, 118, 117, 134, 157, 110, 121, 111, 129, 126, 125, 128, 128, 132, 134, 134, 115, 131, 131, 135, 134, 139, 121, 133, 123, 118, 125, 131, 126, 121, 125, 120, 115, 128, 119, 140, 144, 142, 139, 136, 122, 115, 119, 127, 124, 137, 127, 124, 119, 125, 125, 126, 130, 152, 130, 126, 134, 106, 138, 139, 131, 130, 119, 141, 127, 125, 128, 118, 129, 139, 128, 130, 123, 142, 124, 139, 137, 112, 116, 136, 117, 105, 123, 129, 119, 110, 137, 108, 120, 139, 130, 123, 135, 125, 129, 135, 131, 116, 139, 143, 116, 114, 127, 132, 145, 117, 107, 133, 121, 137, 130, 120, 135, 136, 103, 131, 127, 123, 149, 141, 114, 113, 113, 130, 142, 113, 113, 125, 136, 136, 136, 118, 128, 123, 129, 124, 115, 96, 112, 139, 135, 117, 126, 140, 128, 137, 127, 125, 124, 137, 132, 120, 121, 115, 149, 123, 111, 118, 130, 117, 126, 118, 122, 127, 111, 130, 141, 124, 137, 134, 117, 125, 132, 122, 137, 122, 124, 137, 131, 138, 126, 135, 121, 136, 128, 132, 138, 120, 121, 126, 132, 105, 132, 131, 135, 126, 121, 126, 148, 132, 135, 136, 98, 124, 120, 116, 114, 119, 132, 143, 115, 147, 129, 130, 121, 118, 117, 120, 122, 129, 124, 126, 127, 125, 130, 151, 130, 125, 121, 117, 115, 134, 122, 128, 142, 130, 114, 138, 109, 128, 140, 116, 125, 120, 134, 126, 132, 137, 128, 114, 126, 126, 126, 125, 132, 122, 119, 125, 128, 115, 126, 139, 130, 151, 125, 114, 141, 126, 118, 149, 117, 115, 110, 135, 139, 124, 114, 139, 130, 143, 133, 124, 122, 127, 124, 123, 130, 131, 136, 120, 140, 134, 151, 121, 130, 107, 113, 116, 146, 124, 111, 117, 134, 124, 121, 132, 127, 117, 103, 119, 130, 140, 147, 122, 125, 135, 125, 109, 135, 136, 135, 120, 142, 127, 121, 123, 110, 116, 115, 116, 120, 121, 133, 133, 121, 129, 137, 129, 120, 132, 137, 124, 128, 139, 113, 117, 139, 119, 123, 131, 129, 130, 142, 131, 125, 113, 122, 130, 128, 123, 125, 127, 112, 116, 128, 124, 125, 123, 119, 119, 118, 147, 119, 138, 126, 120, 121, 129, 108, 129, 113, 127, 124, 115, 132, 125, 127, 126, 141, 131, 134, 124, 136, 120, 151, 135, 121, 119, 137, 134, 119, 116, 140, 132, 123, 118, 123, 133, 139, 141, 126, 132, 141, 159, 126, 114, 137, 117, 120, 132, 122, 111, 130, 130, 123, 125, 130, 135, 137, 147, 131, 132, 120, 115, 115, 118, 111, 129, 119, 122, 116, 127, 118, 113, 127, 130, 128, 129, 131, 112, 118, 123, 121, 118, 129, 133, 127, 119, 132, 132, 135, 139, 137, 135, 138, 128, 142, 129, 140, 152, 134, 133, 132, 124, 120, 137, 130, 121, 121, 120, 118, 110, 119, 115, 111, 105, 110, 109, 107, 101, 101, 91, 97, 108, 100, 113, 116, 112, 102, 109, 116, 111, 134, 134, 150, 164, 181, 180, 183, 191, 185, 196, 189, 188, 168, 173, 172, 159, 146, 146, 146, 130, 122, 122, 119, 98, 106, 101, 95, 91, 93, 92, 85, 87, 72, 65, 66, 60, 64, 52, 57, 55, 48, 62, 57, 56, 57, 109, 144, 152, 158, 179, 198, 199, 206, 215, 205, 193, 177, 176, 164, 150, 136, 121, 117, 115, 124, 131, 134, 134, 142, 158, 165, 173, 177, 176, 167, 164, 152, 143, 128, 116, 118, 109, 101, 100, 99, 97, 103, 106, 105, 95, 90, 85, 83, 76, 71, 64, 57, 52, 45, 39, 39, 39, 53, 87, 115, 151, 161, 171, 181, 201, 216, 222, 220, 210, 188, 170, 162, 146, 132, 113, 105, 105, 109, 117, 126, 135, 144, 154, 167, 176, 186, 188, 185, 182, 163, 151, 135, 120, 108, 103, 99, 99, 99, 103, 107, 110, 111, 111, 107, 99, 91, 92, 90, 73, 57, 48, 43, 39, 33, 32, 36, 62, 104, 133, 159, 163, 170, 182, 202, 219, 223, 217, 204, 184, 166, 150, 140, 129, 114, 103, 101, 106, 116, 125, 132, 141, 152, 164, 171, 178, 183, 183, 180, 172, 159, 143, 133, 119, 109, 105, 102, 101, 101, 106, 108, 111, 112, 110, 107, 99, 92, 94, 89, 73, 57, 45, 42, 38, 33, 33, 42, 63, 105, 147, 162, 163, 171, 190, 210, 221, 223, 211, 196, 182, 164, 147, 134, 125, 111, 102, 102, 105, 117, 126, 134, 141, 152, 165, 173, 175, 178, 177, 172, 167, 153, 139, 126, 116, 112, 109, 109, 107, 107, 109, 113, 119, 119, 113, 104, 97, 96, 91, 81, 70, 62, 52, 42, 35, 36, 37, 46, 74, 99, 135, 154, 159, 161, 175, 201, 222, 225, 214, 191, 173, 162, 156, 143, 131, 119, 111, 106, 108, 115, 122, 131, 141, 151, 156, 164, 170, 175, 176, 174, 167, 155, 146, 133, 121, 114, 111, 110, 109, 107, 108, 111, 116, 118, 117, 110, 102, 96, 95, 88, 78, 66, 56, 49, 39, 35, 36, 38, 53, 86, 124, 143, 157, 159, 168, 183, 209, 225, 220, 207, 183, 168, 160, 153, 141, 129, 117, 111, 108, 110, 116, 123, 135, 145, 151, 155, 161, 168, 173, 174, 172, 164, 151, 139, 131, 121, 115, 113, 112, 110, 111, 113, 115, 117, 113, 108, 107, 104, 101, 92, 88, 82, 78, 73, 63, 51, 45, 41, 37, 45, 73, 109, 133, 157, 161, 157, 160, 179, 205, 220, 217, 199, 176, 161, 156, 153, 145, 130, 117, 111, 108, 111, 121, 129, 141, 150, 156, 156, 157, 162, 169, 173, 172, 160, 143, 132, 122, 121, 121, 120, 115, 110, 108, 110, 113, 115, 113, 108, 102, 99, 93, 87, 85, 81, 69, 58, 53, 44, 36, 36, 44, 70, 107, 143, 160, 168, 162, 165, 178, 206, 224, 224, 212, 186, 160, 146, 144, 143, 136, 122, 113, 105, 102, 107, 115, 131, 148, 158, 161, 160, 161, 166, 174, 178, 172, 155, 135, 125, 117, 115, 116, 117, 109, 106, 102, 101, 104, 107, 105, 97, 91, 90, 87, 83, 79, 73, 61, 45, 31, 27, 29, 47, 79, 105, 143, 167, 175, 173, 174, 191, 220, 233, 234, 217, 185, 164, 144, 141, 143, 140, 127, 109, 96, 96, 103, 120, 136, 148, 153, 157, 160, 163, 166, 172, 176, 172, 163, 145, 126, 114, 113, 114, 115, 113, 111, 107, 105, 105, 107, 108, 103, 91, 85, 84, 88, 92, 88, 74, 56, 41, 36, 32, 34, 46, 74, 102, 143, 169, 172, 169, 169, 189, 222, 233, 231, 205, 171, 153, 141, 141, 142, 137, 122, 107, 99, 100, 110, 123, 133, 138, 143, 145, 146, 146, 148, 150, 151, 149, 144, 135, 127, 123, 121, 122, 122, 120, 119, 116, 114, 114, 114, 115, 112, 104, 97, 93, 93, 96, 94, 83, 65, 49, 40, 34, 33, 40, 53, 87, 130, 162, 172, 170, 167, 180, 200, 230, 235, 216, 193, 160, 143, 140, 143, 140, 126, 109, 98, 98, 105, 119, 131, 136, 141, 145, 146, 147, 149, 152, 154, 153, 147, 139, 130, 126, 123, 123, 124, 123, 120, 115, 113, 113, 116, 119, 119, 115, 105, 95, 91, 92, 93, 89, 74, 54, 42, 31, 26, 28, 36, 61, 101, 142, 159, 169, 167, 172, 188, 219, 238, 232, 213, 178, 155, 148, 148, 146, 135, 115, 104, 96, 100, 111, 118, 127, 134, 138, 141, 144, 148, 153, 155, 155, 151, 143, 136, 132, 127, 124, 122, 121, 120, 118, 117, 116, 114, 115, 116, 116, 115, 111, 106, 103, 98, 96, 92, 87, 74, 59, 44, 35, 25, 19, 33, 57, 110, 158, 177, 175, 170, 181, 212, 233, 239, 219, 180, 152, 146, 151, 151, 134, 118, 98, 92, 100, 108, 118, 124, 128, 131, 139, 144, 147, 149, 150, 150, 147, 145, 140, 136, 132, 130, 126, 123, 121, 121, 121, 122, 123, 123, 122, 121, 122, 121, 118, 111, 101, 94, 91, 89, 82, 65, 51, 33, 24, 21, 20, 26, 54, 103, 140, 171, 173, 166, 172, 205, 241, 245, 230, 193, 166, 162, 164, 159, 134, 104, 92, 92, 103, 112, 114, 114, 119, 130, 144, 151, 155, 153, 149, 147, 145, 144, 142, 139, 129, 127, 125, 125, 126, 126, 125, 125, 124, 125, 127, 129, 129, 127, 122, 115, 108, 103, 96, 89, 80, 71, 56, 42, 35, 33, 31, 25, 23, 36, 80, 134, 166, 168, 160, 172, 212, 237, 246, 223, 190, 181, 183, 183, 161, 128, 110, 101, 106, 112, 110, 104, 105, 117, 127, 142, 149, 150, 148, 147, 147, 147, 145, 141, 135, 130, 128, 127, 126, 125, 125, 124, 125, 125, 125, 126, 128, 129, 129, 128, 123, 117, 110, 105, 97, 89, 80, 72, 57, 42, 35, 33, 31, 25, 23, 36, 79, 134, 166, 167, 160, 172, 212, 238, 247, 224, 192, 183, 187, 187, 164, 140, 111, 103, 109, 113, 108, 99, 99, 107, 126, 141, 148, 146, 145, 147, 150, 151, 149, 141, 132, 127, 127, 128, 127, 123, 122, 121, 123, 127, 129, 130, 131, 131, 131, 134, 136, 131, 125, 111, 98, 92, 89, 83, 67, 45, 35, 31, 36, 35, 26, 21, 23, 63, 120, 153, 169, 163, 174, 201, 247, 254, 223, 198, 189, 203, 198, 176, 132, 113, 122, 126, 117, 97, 91, 98, 116, 128, 129, 130, 137, 147, 154, 155, 150, 143, 138, 137, 136, 131, 125, 122, 123, 126, 126, 125, 125, 126, 129, 132, 134, 135, 135, 135, 136, 137, 133, 123, 116, 105, 95, 88, 80, 64, 49, 46, 47, 41, 29, 24, 26, 36, 47, 85, 113, 154, 167, 171, 190, 223, 242, 227, 208, 207, 215, 210, 176, 151, 134, 132, 126, 111, 94, 93, 104, 111, 115, 119, 127, 134, 142, 146, 148, 146, 144, 141, 138, 135, 129, 124, 124, 124, 125, 125, 127, 129, 131, 133, 135, 136, 137, 138, 138, 137, 136, 134, 132, 126, 123, 115, 105, 96, 90, 84, 76, 64, 59, 59, 62, 52, 40, 34, 50, 67, 65, 53, 85, 138, 156, 160, 161, 200, 219, 222, 207, 203, 217, 220, 194, 163, 154, 154, 143, 124, 110, 108, 112, 111, 109, 111, 117, 130, 137, 141, 139, 138, 143, 146, 144, 135, 129, 128, 125, 121, 116, 118, 122, 125, 128, 130, 135, 137, 139, 139, 140, 140, 140, 139, 137, 135, 130, 127, 125, 120, 113, 107, 103, 97, 89, 82, 78, 70, 71, 75, 73, 62, 59, 64, 71, 71, 66, 56, 79, 127, 141, 130, 139, 197, 218, 198, 182, 219, 245, 220, 179, 182, 199, 183, 130, 110, 119, 122, 102, 90, 95, 111, 116, 121, 126, 142, 147, 148, 149, 152, 150, 141, 132, 128, 123, 122, 120, 115, 110, 115, 124, 126, 127, 132, 140, 141, 141, 144, 145, 146, 144, 143, 140, 138, 133, 125, 115, 110, 105, 98, 89, 85, 82, 84, 87, 87, 85, 87, 94, 96, 95, 93, 89, 88, 86, 84, 79, 72, 65, 89, 122, 124, 123, 148, 191, 203, 193, 200, 222, 225, 206, 187, 194, 184, 162, 137, 135, 128, 114, 97, 100, 106, 109, 109, 118, 125, 130, 135, 140, 144, 145, 144, 140, 133, 130, 128, 123, 116, 116, 119, 122, 122, 123, 128, 135, 136, 136, 138, 141, 140, 140, 141, 140, 137, 133, 130, 125, 122, 117, 111, 107, 104, 98, 95, 94, 92, 90, 94, 96, 95, 95, 94, 93, 86, 86, 91, 88, 81, 73, 80, 81, 69, 78, 121, 126, 142, 150, 195, 206, 204, 216, 230, 240, 227, 208, 201, 190, 168, 145, 125, 122, 101, 95, 89, 93, 96, 96, 111, 127, 140, 152, 157, 165, 167, 166, 160, 151, 147, 127, 113, 103, 100, 94, 89, 96, 100, 103, 112, 130, 142, 151, 164, 178, 178, 174, 173, 173, 162, 145, 136, 122, 110, 96, 92, 85, 79, 77, 79, 82, 86, 92, 98, 100, 108, 108, 101, 95, 96, 93, 84, 84, 73, 67, 65, 59, 53, 51, 81, 99, 147, 149, 158, 200, 225, 217, 217, 237, 246, 213, 198, 204, 186, 154, 125, 135, 111, 92, 85, 95, 93, 89, 96, 118, 130, 144, 144, 160, 165, 165, 162, 162, 159, 143, 132, 124, 115, 102, 93, 94, 102, 96, 95, 107, 130, 130, 133, 151, 171, 172, 168, 179, 179, 163, 157, 150, 139, 121, 114, 109, 95, 89, 87, 87, 83, 84, 90, 94, 100, 103, 101, 106, 109, 100, 96, 95, 94, 83, 75, 79, 69, 63, 61, 61, 65, 84, 105, 145, 134, 155, 204, 221, 202, 208, 245, 241, 195, 208, 206, 175, 147, 143, 139, 109, 102, 99, 98, 95, 95, 110, 119, 133, 136, 150, 160, 161, 159, 158, 159, 148, 133, 127, 120, 109, 96, 98, 100, 97, 97, 105, 111, 124, 134, 149, 153, 168, 175, 170, 172, 171, 164, 153, 146, 137, 120, 114, 105, 92, 84, 83, 81, 77, 80, 85, 86, 90, 96, 104, 106, 106, 107, 102, 98, 98, 96, 84, 86, 82, 73, 73, 66, 63, 87, 101, 126, 150, 144, 183, 199, 213, 203, 214, 233, 216, 198, 200, 189, 171, 144, 143, 126, 107, 102, 101, 101, 98, 105, 114, 126, 133, 140, 153, 160, 159, 160, 161, 154, 142, 137, 128, 117, 106, 103, 102, 98, 97, 101, 107, 112, 121, 128, 139, 147, 161, 165, 169, 176, 170, 163, 160, 152, 134, 128, 127, 110, 98, 98, 95, 81, 82, 89, 86, 85, 96, 100, 100, 105, 114, 109, 106, 108, 107, 94, 91, 90, 83, 81, 68, 70, 72, 61, 58, 80, 96, 126, 124, 145, 180, 189, 195, 204, 227, 217, 206, 220, 208, 191, 167, 168, 150, 127, 116, 110, 105, 97, 100, 103, 111, 117, 127, 135, 144, 147, 148, 150, 150, 138, 133, 130, 121, 113, 108, 106, 104, 103, 107, 108, 116, 122, 128, 135, 141, 148, 149, 159, 162, 159, 157, 157, 153, 144, 135, 130, 124, 114, 109, 103, 102, 97, 95, 96, 97, 97, 97, 104, 106, 103, 105, 109, 107, 97, 100, 91, 94, 86, 87, 83, 83, 76, 79, 81, 72, 74, 99, 115, 142, 113, 166, 195, 179, 183, 221, 232, 194, 201, 230, 202, 175, 166, 177, 135, 130, 122, 115, 103, 97, 102, 107, 111, 113, 122, 137, 139, 142, 147, 154, 148, 141, 142, 134, 125, 120, 116, 113, 111, 110, 111, 114, 116, 121, 127, 132, 142, 142, 156, 158, 154, 158, 158, 154, 143, 141, 131, 119, 114, 107, 98, 89, 92, 86, 84, 86, 91, 92, 98, 103, 103, 106, 110, 110, 102, 113, 105, 95, 96, 99, 91, 86, 94, 92, 83, 82, 94, 82, 91, 113, 135, 131, 135, 186, 180, 176, 193, 220, 207, 195, 220, 200, 192, 181, 173, 158, 145, 133, 125, 116, 108, 105, 112, 109, 115, 120, 130, 131, 134, 141, 143, 143, 138, 137, 129, 124, 124, 119, 117, 115, 116, 117, 117, 121, 128, 130, 139, 142, 148, 153, 153, 154, 156, 148, 145, 142, 133, 123, 118, 112, 102, 94, 92, 88, 86, 86, 88, 91, 94, 98, 103, 103, 105, 118, 98, 112, 119, 100, 95, 108, 102, 83, 95, 94, 86, 85, 94, 90, 86, 90, 111, 108, 134, 141, 147, 178, 182, 179, 195, 215, 204, 193, 215, 197, 187, 174, 178, 153, 142, 136, 129, 120, 114, 114, 117, 116, 120, 126, 130, 133, 134, 141, 138, 138, 132, 134, 129, 123, 121, 118, 115, 113, 114, 113, 117, 120, 127, 129, 133, 141, 139, 144, 147, 147, 140, 140, 143, 131, 123, 123, 117, 106, 103, 104, 99, 96, 98, 100, 99, 101, 106, 107, 108, 111, 111, 111, 109, 113, 102, 104, 108, 98, 92, 99, 99, 90, 93, 98, 98, 92, 103, 100, 103, 101, 113, 123, 142, 137, 148, 180, 178, 172, 193, 206, 190, 191, 206, 192, 184, 179, 175, 161, 148, 143, 133, 127, 116, 116, 120, 117, 118, 125, 127, 126, 131, 135, 133, 133, 131, 133, 128, 125, 124, 125, 118, 119, 120, 124, 120, 125, 133, 134, 133, 139, 144, 141, 137, 145, 138, 132, 131, 129, 117, 114, 112, 103, 100, 96, 97, 94, 95, 97, 97, 101, 101, 107, 108, 108, 111, 114, 112, 103, 109, 115, 101, 98, 110, 101, 95, 100, 110, 99, 95, 109, 104, 102, 107, 111, 118, 127, 143, 146, 151, 170, 173, 179, 190, 196, 192, 195, 201, 186, 185, 182, 171, 159, 151, 147, 135, 126, 123, 119, 118, 115, 119, 121, 121, 124, 127, 128, 129, 128, 127, 127, 124, 122, 121, 117, 117, 117, 116, 118, 123, 122, 126, 133, 134, 134, 140, 143, 142, 140, 142, 139, 134, 129, 126, 118, 114, 109, 104, 98, 96, 93, 92, 92, 92, 95, 95, 99, 101, 102, 108, 108, 110, 109, 109, 111, 109, 111, 106, 114, 107, 104, 112, 107, 114, 109, 115, 114, 112, 113, 107, 134, 114, 118, 150, 141, 155, 155, 179, 174, 182, 193, 191, 194, 186, 190, 187, 173, 170, 163, 150, 141, 133, 125, 120, 118, 115, 116, 116, 119, 119, 123, 125, 128, 129, 127, 128, 126, 126, 124, 122, 121, 119, 122, 118, 122, 125, 122, 127, 130, 129, 132, 134, 133, 132, 135, 128, 129, 128, 120, 119, 114, 112, 109, 106, 105, 101, 104, 102, 102, 104, 104, 104, 107, 107, 107, 109, 108, 105, 113, 111, 100, 122, 112, 107, 120, 116, 111, 115, 122, 112, 117, 119, 115, 116, 108, 116, 129, 113, 130, 146, 143, 151, 160, 170, 172, 181, 185, 191, 188, 184, 190, 180, 171, 166, 158, 149, 139, 135, 126, 123, 119, 120, 116, 115, 119, 120, 118, 122, 126, 123, 126, 126, 126, 125, 124, 124, 123, 120, 124, 124, 121, 124, 125, 125, 127, 128, 129, 130, 130, 128, 129, 127, 124, 122, 120, 118, 113, 113, 110, 109, 106, 107, 104, 104, 105, 104, 103, 104, 107, 102, 104, 104, 108, 104, 105, 109, 108, 107, 108, 109, 113, 108, 110, 116, 111, 109, 114, 115, 113, 112, 117, 113, 123, 129, 118, 142, 146, 142, 154, 168, 167, 172, 181, 185, 188, 184, 186, 188, 175, 173, 172, 160, 152, 149, 141, 134, 128, 126, 122, 120, 118, 117, 119, 119, 120, 121, 123, 125, 125, 126, 126, 128, 127, 126, 131, 128, 127, 129, 131, 128, 129, 131, 128, 131, 129, 127, 130, 126, 123, 123, 122, 117, 117, 117, 112, 112, 110, 106, 107, 104, 103, 102, 103, 101, 102, 101, 102, 102, 103, 106, 103, 110, 106, 109, 112, 112, 107, 116, 115, 114, 110, 122, 115, 110, 122, 118, 117, 117, 118, 122, 113, 130, 128, 127, 146, 141, 150, 158, 163, 167, 172, 178, 179, 183, 182, 180, 179, 174, 169, 163, 155, 151, 142, 136, 130, 124, 124, 120, 118, 119, 117, 118, 121, 120, 121, 123, 123, 122, 122, 123, 121, 121, 121, 122, 121, 122, 123, 123, 124, 127, 127, 127, 129, 130, 128, 129, 128, 125, 124, 123, 121, 118, 116, 115, 113, 111, 111, 110, 108, 109, 109, 108, 108, 110, 109, 109, 111, 109, 110, 110, 111, 109, 111, 113, 110, 111, 116, 114, 115, 119, 120, 119, 126, 127, 123, 126, 129, 125, 129, 124, 125, 124, 131, 130, 130, 141, 141, 150, 151, 155, 164, 159, 166, }; const uint8_t four[3710] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 126, 128, 127, 127, 127, 126, 126, 127, 127, 127, 128, 127, 127, 127, 126, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 127, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 128, 128, 127, 127, 126, 127, 127, 127, 127, 127, 128, 127, 127, 127, 128, 126, 128, 127, 127, 128, 127, 126, 127, 126, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 126, 128, 127, 128, 128, 127, 127, 127, 127, 127, 127, 126, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 125, 126, 126, 128, 127, 127, 128, 126, 127, 126, 126, 127, 127, 126, 128, 126, 128, 128, 128, 126, 128, 127, 128, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 128, 126, 127, 127, 127, 126, 127, 126, 127, 127, 129, 128, 127, 127, 128, 127, 127, 127, 127, 127, 128, 127, 128, 127, 125, 127, 127, 127, 128, 126, 128, 128, 127, 127, 128, 127, 128, 126, 127, 128, 127, 128, 127, 126, 127, 128, 127, 126, 126, 128, 128, 127, 126, 127, 127, 127, 128, 128, 127, 127, 128, 127, 127, 127, 126, 127, 128, 127, 128, 126, 127, 127, 128, 126, 127, 127, 127, 126, 128, 127, 128, 127, 127, 127, 128, 127, 127, 125, 126, 127, 128, 127, 128, 127, 126, 126, 128, 127, 128, 128, 126, 127, 126, 127, 127, 128, 128, 127, 126, 127, 127, 126, 127, 127, 127, 128, 127, 129, 128, 127, 128, 126, 126, 126, 127, 128, 127, 128, 126, 128, 127, 127, 125, 129, 128, 126, 127, 127, 127, 126, 126, 126, 128, 127, 128, 128, 128, 126, 127, 128, 127, 126, 127, 129, 126, 129, 127, 127, 126, 126, 127, 126, 126, 128, 127, 128, 126, 127, 128, 128, 127, 126, 129, 129, 128, 128, 127, 127, 128, 127, 126, 126, 127, 128, 127, 126, 127, 125, 128, 127, 127, 126, 127, 128, 128, 127, 127, 127, 127, 128, 127, 127, 126, 125, 127, 127, 128, 128, 126, 127, 129, 128, 126, 125, 127, 127, 127, 126, 127, 128, 128, 126, 127, 128, 128, 127, 127, 127, 127, 126, 127, 128, 128, 128, 128, 127, 128, 128, 126, 126, 128, 126, 128, 128, 129, 125, 127, 126, 128, 128, 127, 127, 127, 128, 128, 127, 127, 128, 126, 124, 127, 127, 125, 127, 128, 127, 129, 127, 127, 128, 127, 127, 126, 131, 126, 126, 125, 124, 127, 125, 125, 125, 129, 126, 128, 126, 125, 128, 127, 126, 127, 127, 127, 128, 126, 128, 127, 127, 126, 126, 128, 128, 125, 127, 126, 126, 128, 129, 127, 129, 127, 127, 126, 127, 126, 128, 127, 125, 126, 127, 127, 125, 127, 127, 128, 128, 127, 126, 125, 128, 129, 128, 127, 127, 125, 129, 127, 128, 126, 127, 128, 126, 126, 127, 127, 127, 129, 126, 128, 128, 126, 126, 128, 128, 126, 126, 128, 128, 125, 126, 126, 125, 127, 126, 126, 128, 128, 127, 127, 128, 127, 127, 128, 130, 128, 126, 125, 126, 126, 128, 128, 127, 127, 128, 130, 130, 126, 127, 127, 126, 126, 129, 127, 131, 127, 129, 128, 128, 130, 129, 126, 125, 130, 130, 126, 124, 128, 128, 129, 127, 126, 126, 125, 129, 127, 129, 126, 126, 129, 129, 129, 127, 127, 128, 127, 128, 125, 125, 129, 130, 125, 126, 127, 128, 128, 126, 129, 127, 125, 128, 125, 128, 126, 128, 129, 128, 126, 126, 128, 128, 129, 127, 130, 126, 127, 125, 124, 126, 127, 129, 127, 128, 130, 125, 126, 127, 128, 126, 129, 129, 127, 127, 125, 129, 127, 124, 124, 129, 127, 124, 129, 128, 128, 125, 127, 124, 125, 130, 123, 128, 129, 129, 127, 130, 126, 126, 125, 127, 128, 127, 130, 125, 124, 130, 127, 125, 126, 127, 122, 124, 129, 128, 127, 125, 126, 128, 129, 128, 129, 124, 125, 130, 123, 126, 127, 128, 127, 128, 130, 126, 130, 124, 125, 129, 131, 126, 127, 125, 124, 127, 130, 126, 125, 128, 128, 127, 126, 124, 128, 130, 127, 128, 128, 124, 126, 125, 127, 125, 127, 124, 125, 127, 125, 131, 130, 128, 128, 130, 126, 129, 128, 128, 128, 123, 122, 128, 128, 128, 131, 123, 124, 131, 127, 124, 129, 129, 128, 128, 128, 123, 131, 128, 129, 131, 129, 125, 125, 129, 127, 128, 128, 131, 125, 125, 128, 124, 128, 125, 128, 127, 129, 129, 125, 127, 128, 129, 126, 124, 122, 126, 127, 126, 127, 125, 129, 126, 128, 129, 132, 125, 126, 131, 126, 124, 126, 127, 131, 126, 125, 126, 129, 126, 127, 128, 125, 128, 128, 126, 124, 127, 127, 122, 125, 132, 125, 126, 126, 129, 128, 126, 127, 128, 129, 128, 126, 126, 127, 124, 126, 127, 130, 130, 128, 127, 123, 130, 131, 127, 126, 129, 127, 130, 125, 130, 125, 128, 129, 127, 128, 129, 127, 121, 132, 123, 127, 127, 125, 126, 121, 128, 123, 127, 130, 125, 126, 126, 128, 125, 124, 126, 127, 129, 130, 128, 124, 127, 125, 125, 127, 130, 124, 125, 130, 129, 128, 127, 128, 126, 128, 132, 129, 124, 126, 126, 125, 128, 127, 130, 126, 129, 124, 131, 125, 130, 127, 128, 131, 124, 127, 122, 128, 127, 128, 123, 127, 122, 130, 126, 126, 129, 130, 136, 130, 121, 130, 127, 124, 125, 128, 122, 121, 128, 125, 127, 129, 132, 126, 123, 127, 129, 127, 123, 127, 129, 123, 128, 128, 126, 128, 124, 127, 126, 127, 127, 125, 123, 127, 126, 129, 127, 128, 127, 128, 129, 124, 131, 128, 122, 124, 127, 125, 128, 127, 128, 129, 129, 129, 130, 134, 129, 126, 132, 126, 128, 127, 128, 126, 124, 124, 125, 125, 129, 126, 125, 127, 126, 128, 130, 122, 123, 130, 131, 121, 127, 126, 125, 127, 128, 130, 130, 122, 126, 129, 129, 129, 130, 127, 131, 128, 127, 124, 128, 125, 125, 127, 127, 128, 127, 133, 130, 126, 124, 125, 126, 125, 128, 134, 126, 130, 124, 126, 125, 126, 124, 127, 128, 126, 128, 127, 130, 131, 129, 128, 127, 131, 129, 125, 127, 128, 126, 127, 129, 129, 129, 121, 131, 127, 127, 126, 124, 127, 127, 129, 124, 127, 129, 126, 124, 127, 125, 126, 124, 128, 129, 125, 129, 129, 129, 131, 130, 122, 124, 124, 129, 126, 126, 133, 128, 124, 123, 129, 130, 125, 126, 126, 125, 127, 124, 122, 124, 128, 127, 128, 124, 128, 127, 127, 124, 129, 127, 130, 127, 127, 131, 130, 128, 127, 122, 127, 125, 124, 125, 127, 128, 129, 129, 134, 132, 129, 127, 127, 128, 126, 123, 128, 128, 128, 129, 127, 127, 127, 127, 128, 125, 126, 127, 129, 132, 132, 130, 132, 129, 124, 119, 124, 126, 121, 122, 128, 130, 129, 130, 128, 127, 125, 128, 130, 128, 126, 128, 128, 127, 132, 130, 129, 127, 125, 125, 122, 123, 125, 124, 124, 131, 132, 131, 127, 126, 124, 124, 123, 122, 118, 122, 126, 127, 129, 132, 128, 126, 125, 124, 123, 119, 123, 124, 128, 129, 130, 130, 132, 130, 131, 132, 131, 134, 136, 136, 136, 137, 134, 137, 134, 133, 129, 131, 128, 130, 129, 133, 130, 132, 131, 131, 125, 122, 117, 116, 108, 101, 97, 101, 100, 98, 99, 94, 90, 87, 87, 85, 89, 110, 124, 141, 164, 174, 175, 170, 164, 159, 155, 153, 155, 157, 155, 152, 148, 139, 133, 133, 132, 129, 128, 127, 130, 134, 140, 141, 138, 140, 140, 141, 134, 133, 132, 128, 124, 121, 119, 120, 119, 117, 114, 106, 99, 92, 86, 85, 78, 74, 69, 66, 62, 58, 55, 55, 72, 109, 147, 189, 203, 208, 197, 179, 164, 144, 138, 142, 140, 137, 128, 114, 104, 96, 100, 114, 126, 150, 166, 171, 167, 158, 146, 137, 133, 134, 135, 138, 138, 135, 131, 129, 128, 131, 134, 140, 141, 142, 139, 131, 122, 113, 99, 89, 77, 70, 62, 59, 55, 52, 46, 42, 44, 46, 80, 137, 187, 216, 231, 230, 204, 182, 152, 126, 116, 119, 124, 125, 117, 110, 95, 89, 99, 114, 141, 170, 188, 192, 185, 166, 142, 125, 117, 114, 116, 122, 124, 126, 127, 130, 136, 146, 152, 157, 157, 152, 144, 129, 112, 96, 87, 78, 70, 63, 59, 57, 52, 49, 46, 46, 56, 85, 127, 177, 230, 244, 246, 222, 182, 145, 126, 101, 103, 107, 105, 110, 105, 98, 91, 96, 121, 144, 176, 191, 195, 189, 171, 154, 131, 115, 112, 110, 113, 119, 122, 124, 129, 132, 139, 146, 157, 161, 164, 161, 149, 134, 120, 111, 98, 89, 84, 82, 77, 74, 68, 64, 59, 58, 52, 59, 66, 113, 159, 206, 232, 242, 228, 191, 170, 139, 106, 101, 108, 107, 116, 112, 111, 102, 96, 106, 117, 136, 173, 188, 195, 194, 176, 153, 134, 115, 106, 100, 104, 113, 116, 126, 129, 133, 140, 150, 158, 160, 163, 160, 148, 138, 123, 109, 97, 90, 85, 81, 77, 75, 71, 64, 59, 58, 54, 55, 68, 91, 142, 182, 226, 240, 239, 213, 174, 153, 124, 102, 106, 105, 110, 117, 113, 104, 97, 98, 113, 129, 147, 178, 191, 198, 188, 168, 142, 119, 111, 101, 100, 110, 115, 119, 129, 131, 135, 145, 156, 162, 161, 162, 154, 141, 130, 115, 101, 91, 86, 82, 77, 74, 73, 67, 60, 58, 53, 53, 62, 96, 149, 172, 219, 239, 234, 218, 178, 145, 116, 104, 108, 107, 114, 119, 118, 110, 103, 103, 113, 124, 145, 157, 168, 175, 166, 157, 141, 125, 115, 111, 108, 114, 117, 120, 128, 129, 132, 135, 138, 142, 143, 147, 148, 144, 139, 126, 117, 103, 88, 79, 77, 77, 82, 84, 86, 89, 83, 75, 64, 58, 98, 127, 160, 218, 234, 232, 223, 194, 155, 118, 111, 110, 102, 112, 113, 108, 102, 101, 106, 112, 129, 151, 162, 168, 172, 161, 148, 137, 123, 113, 110, 112, 116, 120, 129, 131, 134, 136, 136, 134, 132, 130, 131, 131, 134, 137, 137, 133, 124, 110, 95, 86, 82, 82, 85, 87, 86, 79, 57, 43, 38, 57, 102, 149, 196, 241, 254, 245, 221, 176, 131, 96, 91, 91, 101, 119, 123, 126, 119, 110, 106, 107, 119, 142, 154, 172, 181, 174, 164, 144, 122, 105, 100, 100, 106, 115, 125, 129, 135, 137, 138, 138, 138, 138, 138, 138, 137, 136, 134, 126, 118, 111, 97, 86, 80, 78, 79, 86, 94, 96, 97, 93, 67, 59, 96, 106, 159, 205, 234, 245, 230, 211, 162, 113, 93, 88, 79, 102, 118, 120, 127, 127, 121, 117, 116, 130, 143, 158, 169, 171, 166, 153, 140, 121, 107, 102, 102, 108, 120, 128, 131, 136, 136, 136, 137, 137, 137, 136, 136, 136, 135, 134, 134, 128, 121, 111, 102, 90, 82, 78, 78, 83, 93, 96, 97, 96, 78, 59, 96, 104, 137, 205, 234, 243, 239, 211, 162, 127, 96, 88, 78, 91, 114, 120, 128, 131, 125, 120, 118, 126, 137, 146, 164, 167, 163, 158, 143, 131, 116, 106, 104, 105, 115, 127, 132, 135, 137, 135, 134, 135, 136, 135, 134, 132, 130, 128, 128, 131, 129, 125, 120, 101, 91, 80, 72, 74, 79, 89, 98, 100, 98, 75, 69, 102, 101, 144, 200, 231, 239, 237, 209, 165, 128, 96, 78, 65, 86, 97, 111, 133, 143, 143, 138, 132, 131, 131, 137, 152, 158, 162, 162, 151, 134, 124, 109, 101, 102, 107, 119, 128, 135, 137, 136, 135, 134, 134, 136, 138, 139, 138, 133, 128, 126, 124, 120, 117, 112, 99, 93, 85, 75, 72, 73, 77, 78, 79, 76, 72, 82, 112, 126, 165, 207, 226, 233, 230, 201, 165, 139, 107, 87, 77, 84, 96, 106, 124, 129, 130, 130, 132, 131, 137, 144, 156, 158, 160, 157, 146, 131, 122, 109, 102, 101, 104, 113, 123, 134, 139, 141, 141, 138, 136, 134, 135, 137, 139, 139, 137, 131, 127, 121, 117, 114, 113, 111, 107, 100, 96, 90, 86, 85, 86, 87, 88, 88, 89, 85, 93, 108, 128, 149, 177, 203, 211, 211, 199, 171, 139, 122, 100, 90, 94, 101, 113, 124, 132, 134, 130, 130, 129, 130, 136, 145, 151, 154, 153, 147, 136, 128, 117, 110, 107, 109, 116, 124, 133, 139, 141, 140, 136, 131, 129, 127, 130, 134, 137, 140, 139, 135, 131, 123, 117, 111, 109, 107, 104, 100, 97, 93, 90, 87, 86, 84, 82, 77, 71, 65, 75, 102, 114, 156, 199, 223, 232, 233, 211, 177, 140, 121, 99, 89, 97, 104, 111, 123, 125, 124, 122, 123, 127, 136, 148, 154, 158, 159, 152, 143, 130, 117, 108, 105, 106, 112, 121, 127, 135, 139, 140, 139, 135, 130, 126, 124, 124, 127, 132, 136, 140, 141, 138, 135, 128, 121, 114, 111, 107, 103, 99, 95, 93, 89, 87, 85, 84, 82, 77, 69, 65, 75, 102, 126, 156, 199, 223, 236, 234, 212, 179, 141, 122, 99, 88, 96, 103, 109, 122, 122, 121, 118, 120, 122, 128, 140, 155, 162, 166, 165, 153, 138, 122, 111, 101, 98, 102, 106, 115, 125, 134, 137, 142, 144, 143, 141, 137, 131, 128, 126, 126, 129, 134, 137, 140, 141, 138, 134, 126, 116, 107, 101, 96, 93, 91, 92, 92, 95, 100, 104, 108, 110, 110, 104, 97, 80, 67, 80, 89, 115, 161, 197, 214, 227, 219, 194, 170, 140, 117, 100, 101, 110, 114, 124, 128, 127, 123, 120, 118, 120, 125, 136, 143, 150, 157, 158, 153, 145, 132, 117, 106, 102, 101, 106, 115, 123, 132, 139, 143, 143, 141, 137, 132, 129, 126, 124, 125, 126, 129, 133, 136, 137, 137, 135, 131, 128, 123, 121, 119, 119, 117, 111, 103, 97, 85, 78, 77, 77, 83, 92, 96, 96, 94, 90, 80, 98, 111, 136, 177, 212, 224, 229, 216, 187, 161, 128, 109, 96, 94, 106, 115, 123, 129, 129, 127, 125, 126, 129, 134, 144, 152, 154, 157, 153, 146, 132, 120, 108, 103, 100, 103, 110, 119, 125, 132, 137, 140, 141, 141, 139, 137, 134, 131, 127, 125, 124, 125, 127, 130, 133, 135, 136, 135, 134, 131, 126, 120, 117, 114, 114, 115, 118, 117, 113, 107, 100, 88, 82, 77, 77, 77, 78, 75, 73, 72, 74, 102, 128, 154, 198, 231, 240, 241, 223, 192, 150, 127, 103, 87, 87, 95, 104, 115, 125, 128, 128, 131, 132, 135, 141, 150, 156, 158, 158, 152, 139, 130, 116, 103, 97, 98, 100, 109, 118, 128, 132, 137, 140, 140, 140, 140, 139, 137, 134, 131, 128, 126, 126, 127, 128, 131, 133, 134, 135, 132, 130, 124, 119, 115, 114, 114, 118, 120, 120, 117, 112, 102, 97, 89, 85, 83, 85, 85, 84, 81, 80, 76, 81, 104, 130, 151, 215, 230, 237, 230, 204, 181, 141, 112, 90, 83, 87, 99, 111, 122, 131, 134, 133, 133, 132, 135, 141, 148, 154, 157, 155, 149, 134, 121, 107, 100, 96, 99, 106, 113, 122, 131, 135, 137, 139, 140, 141, 141, 141, 139, 135, 131, 128, 124, 123, 123, 124, 127, 131, 134, 135, 136, 134, 130, 125, 118, 112, 108, 108, 110, 114, 117, 118, 117, 113, 108, 105, 100, 97, 93, 91, 86, 79, 71, 66, 64, 73, 99, 130, 159, 199, 229, 236, 234, 214, 185, 151, 132, 110, 98, 97, 101, 106, 115, 123, 126, 126, 129, 130, 133, 138, 147, 154, 157, 157, 152, 137, 127, 111, 99, 94, 96, 102, 112, 122, 129, 135, 138, 138, 136, 135, 136, 138, 139, 139, 137, 133, 129, 127, 124, 123, 124, 126, 129, 133, 136, 136, 134, 129, 122, 117, 111, 109, 112, 114, 120, 124, 123, 122, 115, 107, 98, 96, 94, 95, 96, 97, 94, 86, 75, 65, 59, 71, 94, 131, 161, 206, 235, 246, 243, 222, 188, 149, 128, 101, 87, 90, 94, 105, 117, 125, 127, 129, 128, 130, 133, 140, 149, 157, 159, 157, 148, 133, 123, 108, 96, 92, 94, 100, 110, 123, 134, 139, 144, 145, 141, 138, 135, 134, 133, 134, 133, 132, 130, 128, 125, 124, 123, 124, 127, 130, 132, 133, 132, 127, 121, 117, 113, 112, 116, 120, 127, 133, 135, 132, 125, 114, 102, 91, 87, 83, 84, 85, 86, 87, 85, 83, 82, 84, 95, 117, 137, 171, 205, 229, 234, 231, 207, 174, 149, 116, 95, 86, 87, 98, 110, 123, 130, 135, 136, 137, 136, 139, 142, 147, 150, 150, 146, 138, 124, 115, 104, 97, 96, 100, 109, 121, 132, 137, 142, 142, 139, 137, 133, 130, 131, 132, 133, 135, 134, 132, 128, 125, 123, 122, 123, 126, 129, 131, 132, 131, 127, 124, 119, 115, 115, 119, 122, 127, 129, 127, 123, 116, 107, 100, 97, 97, 98, 101, 103, 104, 102, 99, 97, 91, 87, 90, 95, 113, 137, 169, 187, 207, 215, 210, 197, 172, 144, 121, 109, 102, 103, 113, 119, 127, 133, 133, 132, 131, 130, 133, 139, 143, 147, 148, 142, 137, 119, 112, 106, 104, 107, 112, 120, 127, 132, 134, 135, 134, 133, 132, 132, 133, 135, 136, 136, 136, 134, 131, 128, 125, 123, 123, 124, 126, 128, 129, 129, 127, 124, 121, 119, 119, 120, 122, 125, 127, 126, 122, 119, 112, 107, 106, 106, 107, 110, 111, 110, 108, 104, 99, 96, 93, 95, 98, 100, 104, 112, 123, 132, 151, 175, 194, 203, 207, 198, 175, 158, 131, 111, 101, 101, 107, 117, 125, 130, 132, 130, 129, 130, 132, 137, 143, 146, 145, 141, 133, 123, 117, 110, 106, 107, 111, 118, 126, 132, 135, 137, 137, 135, 133, 132, 133, 136, 136, 136, 134, 131, 128, 124, 122, 122, 123, 126, 128, 130, 131, 130, 128, 124, 121, 119, 118, 120, 124, 126, 129, 129, 126, 122, 115, 109, 106, 106, 108, 112, 115, 114, 112, 106, 100, 97, 95, 97, 99, 101, 102, 99, 102, 109, 123, 143, 172, 191, 203, 205, 196, 174, 155, 133, 120, 111, 112, 119, 127, 130, 131, 132, 128, 125, 127, 133, 138, 145, 148, 149, 142, 132, 125, 115, 108, 107, 109, 114, 122, 128, 130, 132, 131, 130, 128, 128, 130, 133, 135, 138, 140, 137, 134, 132, 127, 123, 122, 123, 124, 127, 130, 130, 130, 127, 124, 121, 120, 120, 122, 124, 127, 128, 125, 123, 118, 113, 110, 110, 111, 112, 113, 113, 110, 106, 103, 101, 99, 101, 106, 108, 110, 111, 108, 99, 94, 96, 109, 131, 151, 186, 208, 213, 208, 189, 159, 131, 119, 114, 116, 127, 134, 140, 137, 130, 126, 120, 122, 132, 139, 147, 150, 149, 142, 130, 120, 113, 111, 111, 116, 121, 123, 126, 127, 127, 126, 126, 127, 129, 132, 135, 138, 141, 142, 141, 136, 131, 126, 124, 122, 122, 124, 126, 128, 130, 129, 127, 126, 123, 121, 120, 121, 123, 125, 126, 126, 123, 120, 118, 115, 114, 115, 116, 115, 115, 112, 107, 103, 99, 98, 96, 99, 103, 107, 110, 111, 112, 108, 102, 97, 96, 115, 139, 159, 190, 214, 212, 202, 174, 144, 120, 111, 115, 130, 138, 142, 145, 138, 128, 125, 126, 130, 136, 143, 145, 142, 134, 128, 122, 115, 115, 120, 122, 129, 130, 130, 126, 124, 124, 125, 126, 128, 129, 130, 130, 131, 132, 136, 139, 139, 138, 134, 129, 125, 123, 123, 124, 126, 128, 129, 128, 124, 122, 120, 119, 120, 122, 125, 126, 123, 120, 116, 112, 110, 112, 116, 120, 121, 119, 117, 112, 107, 103, 103, 104, 107, 110, 111, 111, 107, 104, 101, 96, 92, 92, 99, 122, 155, 188, 206, 218, 208, 180, 159, 132, 120, 120, 127, 138, 141, 136, 132, 125, 124, 130, 140, 147, 152, 149, 140, 133, 122, 117, 118, 120, 124, 127, 129, 128, 126, 125, 125, 126, 128, 131, 131, 130, 126, 122, 120, 121, 125, 131, 139, 142, 143, 138, 133, 130, 126, 124, 125, 127, 127, 127, 126, 124, 122, 121, 121, 123, 123, 123, 123, 120, 118, 116, 116, 116, 116, 118, 121, 121, 120, 119, 116, 110, 106, 103, 103, 102, 104, 111, 116, 114, 114, 110, 102, 93, 88, 85, 90, 111, 149, 179, 213, 221, 209, 190, 155, 126, 117, 122, 134, 143, 144, 140, 128, 122, 129, 137, 147, 152, 150, 145, 134, 126, 124, 125, 126, 127, 126, 125, 122, 122, 125, 128, 131, 131, 129, 127, 122, 121, 121, 123, 124, 127, 131, 136, 138, 142, 141, 136, 132, 127, 124, 123, 124, 127, 128, 127, 126, 124, 122, 121, 121, 123, 125, 125, 124, 123, 120, 118, 117, 117, 118, 119, 119, 120, 120, 116, 113, 108, 105, 103, 104, 107, 110, 111, 109, 108, 107, 107, 108, 108, 106, 104, 97, 94, 89, 104, 145, 176, 213, 220, 204, 184, 151, 129, 128, 136, 147, 147, 140, 134, 126, 126, 139, 150, 158, 151, 137, 129, 122, 121, 126, 132, 132, 127, 122, 120, 120, 122, 126, 129, 129, 127, 124, 123, 123, 124, 124, 124, 124, 126, 129, 135, 140, 144, 141, 133, 129, 126, 124, 124, 125, 127, 128, 127, 126, 125, 123, 122, 123, 123, 123, 123, 121, 121, 119, 119, 118, 118, 118, 118, 118, 117, 115, 113, 110, 109, 109, 111, 115, 116, 116, 116, 114, 112, 111, 111, 114, 118, 117, 113, 106, 102, 97, 92, 98, 116, 166, 207, 211, 187, 171, 156, 146, 143, 149, 156, 150, 131, 121, }; const uint8_t five[4452] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 128, 128, 127, 127, 127, 128, 127, 127, 127, 127, 126, 126, 128, 127, 128, 127, 126, 127, 127, 127, 127, 127, 128, 127, 127, 126, 127, 128, 126, 126, 127, 127, 126, 128, 128, 127, 125, 127, 128, 127, 128, 128, 128, 126, 126, 128, 127, 128, 126, 128, 128, 128, 126, 127, 127, 127, 128, 127, 127, 127, 127, 126, 126, 127, 126, 128, 125, 127, 126, 127, 128, 126, 126, 128, 129, 127, 127, 127, 128, 127, 127, 127, 128, 128, 126, 126, 127, 128, 127, 128, 128, 126, 126, 126, 128, 127, 127, 126, 126, 127, 126, 128, 126, 128, 125, 128, 127, 125, 127, 126, 128, 127, 128, 128, 128, 126, 126, 127, 126, 126, 128, 128, 127, 128, 127, 126, 126, 128, 127, 127, 127, 126, 126, 128, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 126, 128, 127, 127, 128, 127, 127, 127, 128, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 126, 126, 126, 127, 126, 126, 126, 128, 127, 128, 127, 127, 126, 127, 128, 126, 125, 127, 128, 126, 127, 129, 127, 128, 127, 126, 127, 125, 127, 127, 126, 127, 128, 128, 128, 126, 126, 126, 128, 128, 126, 126, 128, 127, 128, 128, 127, 126, 127, 127, 128, 126, 127, 125, 126, 129, 127, 127, 126, 125, 127, 128, 127, 128, 127, 128, 127, 124, 129, 128, 128, 127, 126, 128, 128, 128, 127, 126, 127, 127, 128, 128, 127, 129, 126, 127, 127, 126, 125, 129, 127, 128, 128, 126, 127, 128, 127, 129, 127, 126, 127, 128, 127, 128, 128, 127, 128, 126, 126, 129, 126, 128, 125, 126, 125, 125, 125, 127, 127, 127, 126, 126, 128, 127, 128, 130, 127, 126, 127, 127, 127, 128, 129, 127, 130, 125, 127, 128, 124, 127, 125, 126, 126, 127, 126, 126, 129, 125, 128, 124, 125, 127, 127, 127, 127, 126, 126, 127, 128, 128, 127, 128, 129, 128, 126, 127, 125, 127, 127, 126, 123, 130, 128, 126, 124, 127, 125, 130, 128, 127, 125, 129, 130, 127, 127, 127, 126, 126, 126, 128, 128, 128, 129, 125, 125, 127, 128, 125, 126, 125, 127, 126, 126, 125, 129, 128, 126, 127, 126, 128, 127, 129, 126, 127, 126, 128, 126, 125, 129, 127, 127, 126, 128, 128, 127, 129, 125, 126, 129, 127, 126, 128, 127, 127, 126, 128, 127, 128, 130, 127, 126, 128, 128, 128, 127, 127, 129, 125, 125, 126, 127, 126, 127, 128, 127, 128, 127, 126, 126, 128, 129, 127, 128, 127, 128, 129, 126, 128, 128, 125, 126, 126, 129, 128, 126, 129, 126, 128, 129, 128, 127, 125, 127, 128, 125, 126, 129, 128, 126, 126, 127, 126, 129, 127, 128, 125, 129, 127, 126, 125, 130, 128, 128, 126, 129, 124, 128, 126, 127, 128, 127, 131, 125, 129, 126, 126, 128, 127, 127, 127, 128, 124, 128, 127, 129, 127, 128, 128, 127, 126, 127, 126, 125, 129, 127, 127, 127, 128, 128, 128, 125, 128, 129, 128, 124, 128, 125, 126, 128, 128, 126, 125, 127, 127, 129, 125, 127, 128, 127, 128, 128, 124, 128, 127, 126, 126, 127, 123, 124, 126, 127, 126, 128, 130, 125, 127, 127, 128, 127, 130, 126, 126, 127, 127, 126, 125, 127, 127, 125, 125, 128, 128, 127, 126, 130, 129, 126, 126, 129, 130, 127, 129, 124, 127, 132, 125, 133, 125, 127, 126, 128, 126, 122, 127, 122, 130, 129, 126, 127, 126, 127, 128, 124, 125, 127, 128, 127, 126, 129, 132, 125, 126, 128, 131, 132, 122, 127, 128, 127, 126, 127, 130, 126, 126, 130, 128, 128, 126, 126, 128, 129, 127, 128, 126, 124, 124, 127, 127, 124, 126, 130, 127, 129, 129, 126, 126, 128, 126, 129, 129, 128, 126, 128, 126, 121, 122, 132, 128, 125, 126, 130, 125, 124, 126, 127, 127, 129, 127, 132, 128, 130, 129, 125, 126, 128, 128, 128, 126, 125, 130, 130, 131, 129, 131, 127, 128, 126, 126, 128, 127, 126, 126, 125, 126, 125, 129, 130, 128, 129, 125, 128, 131, 127, 130, 129, 129, 123, 126, 124, 123, 125, 125, 124, 128, 129, 132, 129, 131, 130, 129, 127, 124, 126, 127, 125, 126, 129, 127, 130, 127, 129, 124, 129, 130, 126, 125, 129, 130, 128, 128, 123, 128, 123, 125, 124, 123, 121, 122, 124, 126, 132, 133, 131, 131, 131, 128, 124, 124, 124, 124, 121, 126, 125, 129, 129, 129, 128, 133, 131, 131, 129, 128, 126, 125, 127, 127, 128, 127, 125, 123, 122, 122, 124, 127, 126, 130, 127, 121, 125, 138, 132, 127, 120, 119, 127, 121, 119, 119, 127, 129, 129, 128, 129, 133, 130, 131, 127, 126, 124, 124, 127, 126, 127, 126, 127, 126, 127, 124, 127, 127, 127, 129, 130, 131, 132, 132, 133, 127, 124, 122, 120, 120, 125, 126, 130, 131, 133, 134, 135, 134, 134, 135, 133, 128, 125, 126, 128, 122, 124, 125, 126, 130, 133, 131, 129, 128, 127, 130, 128, 128, 128, 127, 123, 120, 115, 112, 112, 114, 118, 122, 126, 132, 133, 132, 128, 126, 124, 122, 122, 120, 119, 114, 117, 116, 116, 117, 123, 126, 127, 133, 138, 138, 141, 145, 149, 152, 154, 156, 153, 147, 145, 142, 140, 142, 144, 144, 144, 142, 141, 141, 144, 141, 133, 124, 115, 107, 101, 98, 99, 95, 87, 82, 80, 78, 78, 80, 80, 76, 67, 65, 62, 67, 85, 131, 202, 221, 222, 212, 180, 136, 113, 110, 112, 111, 114, 116, 110, 113, 133, 149, 168, 179, 175, 155, 137, 121, 117, 109, 110, 111, 109, 109, 118, 138, 156, 166, 167, 161, 146, 127, 118, 112, 105, 108, 112, 115, 122, 133, 134, 131, 120, 109, 98, 87, 83, 79, 76, 67, 59, 55, 57, 74, 103, 187, 231, 237, 220, 189, 129, 95, 79, 79, 97, 100, 122, 126, 132, 140, 166, 182, 178, 173, 147, 113, 91, 90, 99, 112, 129, 134, 139, 141, 148, 148, 150, 147, 135, 125, 114, 115, 120, 130, 140, 146, 145, 141, 140, 131, 122, 116, 112, 101, 98, 101, 101, 101, 104, 98, 90, 75, 70, 72, 85, 105, 168, 218, 232, 222, 184, 129, 87, 72, 80, 105, 113, 139, 144, 146, 150, 161, 175, 165, 150, 127, 100, 82, 93, 108, 130, 149, 156, 157, 146, 140, 133, 125, 114, 112, 112, 122, 133, 144, 154, 153, 144, 137, 127, 117, 114, 117, 116, 114, 114, 113, 107, 107, 106, 107, 95, 85, 68, 58, 50, 71, 109, 176, 241, 254, 214, 183, 117, 61, 54, 84, 106, 126, 154, 151, 151, 148, 166, 159, 153, 136, 111, 91, 85, 102, 126, 149, 157, 163, 150, 136, 127, 119, 113, 113, 116, 123, 136, 148, 154, 152, 142, 126, 120, 116, 119, 127, 132, 130, 120, 113, 101, 102, 104, 110, 107, 102, 89, 66, 59, 66, 83, 117, 205, 244, 249, 199, 146, 96, 45, 53, 101, 125, 149, 176, 160, 151, 145, 157, 147, 139, 127, 108, 90, 92, 116, 138, 154, 160, 159, 141, 126, 118, 114, 109, 114, 125, 130, 141, 152, 154, 147, 134, 122, 117, 117, 123, 130, 131, 127, 119, 110, 100, 103, 108, 111, 105, 100, 82, 61, 62, 68, 91, 150, 229, 249, 239, 182, 121, 52, 45, 65, 116, 141, 163, 173, 155, 146, 145, 152, 139, 132, 119, 102, 94, 114, 130, 146, 158, 160, 150, 128, 118, 111, 109, 109, 121, 134, 142, 151, 154, 145, 134, 122, 118, 118, 121, 131, 135, 128, 117, 115, 105, 105, 111, 117, 117, 108, 92, 75, 58, 61, 79, 95, 176, 242, 250, 223, 168, 96, 43, 47, 81, 127, 151, 174, 167, 149, 143, 149, 146, 136, 127, 114, 95, 98, 123, 135, 150, 161, 155, 134, 123, 116, 109, 106, 112, 128, 139, 149, 155, 152, 137, 122, 118, 117, 120, 132, 137, 135, 124, 113, 109, 105, 111, 120, 126, 120, 108, 86, 69, 52, 57, 79, 100, 195, 249, 253, 211, 153, 69, 36, 58, 95, 140, 169, 178, 154, 133, 134, 145, 139, 140, 128, 108, 97, 107, 131, 148, 155, 157, 140, 120, 114, 111, 109, 117, 128, 139, 146, 155, 154, 136, 124, 119, 118, 123, 135, 136, 131, 127, 115, 109, 110, 116, 117, 122, 116, 109, 86, 68, 54, 61, 79, 105, 150, 203, 234, 231, 171, 137, 62, 40, 71, 108, 152, 178, 179, 155, 136, 131, 140, 133, 141, 132, 114, 106, 121, 136, 148, 153, 149, 130, 115, 111, 110, 114, 125, 136, 141, 153, 147, 134, 121, 113, 114, 126, 141, 143, 135, 120, 107, 107, 112, 120, 124, 123, 118, 98, 89, 75, 72, 72, 86, 103, 110, 169, 217, 224, 205, 155, 88, 36, 53, 97, 153, 184, 198, 166, 133, 122, 131, 134, 137, 131, 114, 112, 119, 135, 145, 153, 151, 133, 120, 117, 114, 112, 121, 128, 134, 143, 150, 145, 132, 124, 120, 121, 131, 142, 137, 130, 120, 111, 113, 119, 122, 118, 115, 110, 98, 92, 92, 80, 77, 85, 99, 108, 122, 178, 211, 206, 180, 132, 77, 61, 80, 124, 163, 181, 179, 145, 127, 125, 128, 133, 141, 130, 119, 120, 128, 137, 144, 150, 137, 127, 123, 115, 112, 118, 121, 126, 139, 149, 146, 143, 134, 120, 121, 129, 137, 139, 138, 132, 114, 109, 115, 118, 119, 124, 112, 103, 92, 88, 88, 91, 84, 79, 87, 95, 114, 167, 216, 220, 197, 138, 86, 58, 80, 122, 164, 179, 179, 146, 125, 125, 129, 134, 138, 131, 121, 118, 125, 136, 143, 152, 143, 128, 122, 116, 112, 114, 118, 123, 131, 145, 151, 151, 142, 128, 119, 120, 131, 139, 141, 139, 126, 111, 109, 114, 118, 122, 121, 112, 99, 91, 88, 88, 92, 82, 82, 87, 102, 123, 190, 216, 215, 173, 123, 86, 57, 93, 139, 166, 179, 171, 135, 124, 124, 133, 136, 138, 130, 116, 117, 124, 137, 149, 153, 145, 129, 117, 114, 112, 113, 118, 123, 133, 142, 155, 156, 143, 131, 119, 119, 130, 139, 144, 138, 126, 118, 112, 115, 122, 123, 120, 109, 97, 91, 87, 89, 93, 90, 82, 83, 98, 108, 137, 183, 203, 193, 164, 126, 91, 88, 107, 140, 165, 170, 162, 141, 130, 127, 127, 132, 135, 128, 123, 123, 128, 138, 144, 147, 139, 127, 119, 112, 112, 117, 121, 127, 135, 144, 148, 148, 143, 135, 132, 129, 135, 135, 132, 128, 123, 119, 121, 122, 120, 115, 110, 108, 106, 104, 97, 92, 91, 90, 84, 83, 87, 98, 119, 139, 170, 194, 184, 167, 127, 98, 90, 105, 137, 165, 172, 168, 151, 135, 131, 130, 132, 131, 127, 119, 121, 126, 137, 146, 148, 140, 126, 114, 109, 115, 119, 124, 129, 137, 144, 150, 150, 141, 132, 122, 122, 130, 137, 144, 143, 133, 124, 115, 113, 113, 115, 115, 110, 101, 96, 90, 90, 93, 93, 85, 80, 87, 95, 115, 144, 170, 184, 184, 165, 135, 115, 108, 120, 138, 154, 158, 155, 144, 135, 134, 138, 144, 143, 136, 120, 113, 115, 121, 134, 145, 143, 140, 129, 120, 113, 112, 111, 116, 125, 134, 145, 149, 148, 146, 141, 136, 130, 129, 129, 130, 134, 135, 132, 127, 125, 122, 118, 107, 94, 87, 84, 87, 94, 97, 95, 91, 82, 72, 75, 96, 125, 157, 192, 219, 193, 149, 121, 89, 85, 125, 150, 173, 172, 156, 138, 128, 136, 146, 150, 145, 126, 108, 111, 117, 132, 144, 143, 136, 128, 124, 123, 124, 122, 116, 113, 117, 125, 134, 140, 143, 145, 146, 145, 143, 137, 126, 119, 121, 131, 141, 148, 146, 130, 112, 102, 101, 104, 105, 103, 98, 95, 90, 89, 90, 95, 93, 86, 78, 83, 97, 119, 164, 205, 220, 196, 144, 113, 75, 90, 134, 162, 185, 181, 154, 136, 131, 134, 140, 138, 133, 123, 124, 125, 128, 134, 138, 136, 131, 126, 121, 116, 115, 113, 114, 119, 125, 133, 140, 141, 138, 137, 139, 142, 142, 142, 139, 137, 134, 132, 134, 134, 131, 125, 117, 110, 109, 110, 108, 105, 105, 104, 100, 98, 95, 86, 81, 83, 83, 82, 91, 108, 133, 150, 186, 209, 191, 165, 119, 89, 91, 118, 158, 183, 179, 165, 136, 123, 129, 133, 140, 139, 130, 123, 122, 124, 129, 133, 137, 136, 134, 131, 123, 117, 113, 112, 116, 125, 133, 137, 136, 130, 127, 135, 144, 154, 156, 145, 135, 126, 124, 124, 127, 132, 132, 129, 123, 111, 102, 103, 105, 109, 112, 106, 101, 91, 89, 91, 94, 96, 97, 90, 85, 81, 93, 116, 141, 193, 222, 206, 160, 129, 94, 98, 132, 156, 172, 166, 142, 127, 121, 130, 144, 150, 149, 133, 121, 119, 121, 129, 137, 138, 137, 134, 128, 123, 118, 111, 107, 108, 113, 124, 137, 143, 144, 139, 131, 128, 131, 143, 150, 150, 148, 140, 132, 129, 127, 122, 120, 123, 123, 124, 122, 114, 109, 107, 105, 105, 105, 103, 100, 94, 91, 92, 95, 95, 94, 90, 88, 90, 104, 136, 168, 208, 218, 183, 152, 106, 91, 112, 139, 164, 168, 154, 141, 128, 130, 141, 144, 142, 132, 125, 122, 124, 131, 137, 135, 132, 129, 127, 125, 124, 121, 116, 113, 115, 123, 132, 136, 136, 134, 130, 129, 128, 130, 139, 146, 148, 147, 145, 141, 139, 133, 127, 123, 124, 123, 120, 117, 115, 114, 113, 109, 105, 102, 98, 94, 97, 101, 109, 111, 107, 100, 88, 77, 77, 80, 101, 127, 157, 183, 209, 201, 159, 134, 96, 96, 125, 150, 171, 171, 153, 138, 132, 136, 142, 140, 136, 125, 121, 124, 131, 138, 137, 131, 126, 123, 125, 126, 125, 120, 115, 118, 123, 132, 135, 131, 127, 122, 122, 125, 128, 132, 136, 142, 147, 150, 148, 142, 136, 130, 129, 130, 129, 129, 125, 120, 117, 114, 113, 115, 112, 109, 104, 99, 96, 97, 102, 106, 109, 107, 101, 91, 82, 81, 84, 104, 134, 153, 163, 164, 164, 171, 164, 155, 137, 135, 126, 136, 149, 153, 152, 141, 130, 123, 127, 134, 143, 141, 136, 127, 122, 126, 129, 136, 135, 130, 124, 119, 116, 118, 120, 123, 126, 127, 128, 131, 131, 128, 128, 127, 127, 127, 128, 129, 135, 139, 138, 133, 128, 125, 124, 128, 133, 133, 131, 128, 124, 120, 120, 120, 120, 119, 116, 112, 111, 112, 110, 110, 110, 106, 104, 107, 113, 109, 102, 96, 88, 87, 103, 123, 147, 160, 161, 153, 152, 160, 158, 149, 140, 130, 126, 134, 153, 160, 156, 152, 139, 126, 125, 128, 131, 132, 130, 125, 126, 130, 132, 134, 133, 130, 125, 122, 121, 120, 122, 124, 125, 126, 129, 131, 131, 129, 126, 123, 123, 127, 130, 133, 133, 132, 137, 141, 139, 131, 124, 119, 119, 123, 130, 134, 136, 134, 128, 121, 116, 113, 114, 117, 119, 120, 117, 111, 106, 105, 109, 111, 108, 106, 107, 108, 109, 106, 93, 87, 93, 100, 115, 132, 141, 149, 177, 196, 184, 162, 131, 108, 115, 132, 163, 171, 164, 146, 133, 127, 135, 137, 138, 136, 130, 125, 126, 129, 129, 132, 132, 130, 129, 128, 125, 120, 120, 119, 121, 126, 130, 131, 131, 130, 128, 126, 125, 126, 126, 127, 129, 134, 139, 142, 137, 130, 127, 125, 125, 127, 128, 127, 126, 127, 127, 124, 123, 122, 120, 120, 120, 120, 120, 121, 116, 111, 107, 105, 107, 109, 108, 107, 111, 112, 103, 99, 97, 97, 96, 98, 105, 111, 125, 135, 174, 203, 202, 176, 137, 107, 106, 121, 157, 176, 167, 160, 141, 131, 129, 136, 139, 140, 137, 128, 123, 120, 121, 128, 132, 136, 134, 129, 128, 123, 118, 117, 120, 123, 128, 131, 131, 129, 127, 126, 125, 125, 126, 128, 129, 131, 134, 137, 137, 135, 131, 127, 127, 126, 128, 129, 128, 126, 126, 125, 123, 122, 123, 121, 120, 121, 122, 121, 119, 117, 113, 111, 110, 111, 115, 115, 113, 111, 111, 111, 109, 107, 105, 103, 101, 97, 98, 112, 118, 123, 139, 182, 201, 193, 167, 131, 102, 110, 130, 154, 165, 164, 159, 143, 137, 134, 133, 131, 134, 134, 133, 132, 128, 126, 127, 132, 134, 135, 134, 130, 125, 123, 120, 118, 120, 125, 127, 129, 129, 127, 126, 126, 126, 125, 125, 128, 132, 135, 136, 137, 135, 130, 126, 126, 126, 127, 128, 128, 127, 126, 124, 124, 123, 122, 122, 122, 122, 121, 119, 116, 114, 113, 114, 114, 116, 115, 113, 113, 111, 107, 108, 109, 108, 103, 106, 114, 116, 109, 101, 103, 105, 102, 101, 125, 156, 205, 212, 177, 143, 112, 114, 134, 146, 156, 159, 157, 157, 148, 135, 125, 124, 132, 141, 144, 140, 131, 124, 123, 126, 131, 133, 134, 135, 132, 128, 122, 117, 115, 118, 125, 128, 129, 127, 126, 126, 127, 127, 126, 130, 132, 133, 132, 133, 132, 129, 127, 127, 128, 129, 129, 129, 128, 126, 124, 123, 122, 121, 121, 122, 123, 123, 122, 118, 115, 114, 115, 116, 116, 118, 119, 117, 112, 108, 105, 105, 107, 109, 113, 120, 120, 109, 99, 104, 112, 110, 115, 146, 174, 178, 165, 151, 142, 138, 141, 150, 150, 148, 150, 151, 143, 135, 136, 134, 137, 141, 142, 133, 129, 135, 135, 131, 131, 132, 131, 128, 127, 124, 123, 123, 122, 121, 123, 125, 126, 125, 125, 127, 128, 126, 127, 126, 126, 130, 136, 133, 130, 129, 130, 127, 127, 127, 127, 127, 128, 129, 128, 124, 123, 123, 124, 125, 123, 122, 121, 119, 118, 116, 113, 113, 117, 120, 115, 111, 115, 117, 110, 102, 106, 110, 115, 115, 115, 113, 109, 108, 115, 112, 108, 110, 126, 142, 168, 173, 158, 148, 149, 152, 147, 138, 135, 143, 155, 158, 153, 139, 130, 135, 138, 138, 135, 134, 136, 135, 133, 128, 127, 127, 127, 127, 129, 129, 125, 122, 124, 123, 122, 123, 124, 126, 128, 127, 126, 125, 126, 128, 128, 127, 127, 130, 134, 133, 130, 130, 131, 130, 128, 128, 127, 128, 130, 131, 127, 123, 120, 120, 123, 125, 125, 122, 120, 119, 118, 117, 114, 114, 115, 116, 114, 113, 119, 120, 113, 109, 106, 105, 105, 108, 107, 111, 123, 124, 114, 105, 107, 103, 109, 146, 187, 201, 190, 169, 141, 126, 123, 128, 135, 148, 162, 172, 161, 142, 136, 130, 130, 130, 127, 129, 135, 139, 137, 131, 126, 123, 125, 129, 130, 127, 124, 121, 121, 119, 118, 118, 121, 125, 128, 127, 127, 126, 126, 124, 125, 127, 130, 135, 141, 139, 133, 133, 132, 127, 123, 124, 125, 127, 130, 128, 123, 118, 118, 116, 115, 118, 120, 119, 118, 120, 117, 112, 109, 113, 115, 116, 114, 109, 110, 113, 111, 110, 115, 111, 108, 109, 112, 106, 105, 110, 120, 120, 120, 111, 113, 146, 167, 169, 161, 175, 172, 155, 138, 135, 132, 134, 150, 148, 145, 148, 153, 140, 133, 134, 131, 128, 131, 133, 129, 130, 134, 131, 125, 127, 130, 128, 126, 125, 123, 122, 122, 121, 122, 124, 127, 125, 125, 127, 129, 128, 129, 130, 131, 131, 131, 131, 128, 129, 129, 127, 126, 128, 129, 129, 129, 129, 127, 124, 123, 122, 122, 121, 122, 122, 120, 118, 117, 115, 116, 118, 118, 119, 117, 116, 115, 118, 116, 106, 104, 111, 111, 109, 112, 114, 114, 114, 114, 111, 114, 113, 109, 99, 114, 154, 171, 175, 182, 182, 165, 151, 140, 131, 130, 139, 151, 149, 151, 151, 146, 141, 136, 132, 130, 130, 129, 127, 128, 128, 129, 130, 133, 132, 129, 127, 125, 123, 119, 120, 120, 120, 122, 125, 124, 127, 131, 130, 130, 135, 137, 131, 127, 129, 129, 126, 126, 128, 128, 128, 129, 127, 126, 126, 126, 124, 122, 122, 121, 121, 121, 121, 121, 121, 121, 120, 118, 116, 116, 116, 113, 110, 112, 118, 116, 115, 116, 113, 113, 118, 116, 113, 114, 117, 119, 116, 114, 120, 124, 115, 109, 109, 116, 132, 154, 166, 168, 176, 184, 165, 147, 144, 143, 139, 140, 143, 145, 150, 156, 151, 141, 137, 135, 131, 127, 126, 126, 127, 127, 126, 128, 129, 130, 127, 123, 121, 119, 117, 117, 119, 121, 124, 127, 129, 130, 131, 129, 129, 130, 130, 128, 130, 131, 128, 129, 130, 129, 128, 127, 127, 125, 125, 126, 125, 124, 124, 124, 123, 123, 122, 121, 120, 121, 120, 119, 119, 118, 117, 118, 119, 118, 117, 119, 119, 115, 117, 118, 115, 115, 117, 118, 118, 118, 118, 122, 126, 122, 117, 122, 123, 115, 108, 109, 113, 132, 148, 160, 162, 182, 189, 178, 160, 155, 153, 144, 142, 137, 135, 139, 145, 139, 135, 139, 139, 132, 130, 131, 126, 125, 124, 122, 119, 121, 122, 123, 126, 129, 127, 125, 126, 123, 121, 121, 121, 122, 124, 126, 127, 129, 131, 132, 131, 129, 132, 134, 132, 129, 129, 128, 127, 127, 125, 125, 127, 126, 124, 124, 125, 125, 123, 122, 122, 123, 122, 120, 120, 120, 121, 119, 118, 118, 119, 118, 117, 117, 119, 117, 118, 122, 120, 117, 120, 120, 115, 112, 115, 116, 112, 113, 115, 117, 120, 125, 120, 116, 116, 118, 112, 111, 127, 143, 148, 170, 181, 173, 164, 172, 164, 149, 147, 145, 139, 138, 142, 139, 133, 141, 142, 138, 137, 138, 135, 131, 131, 127, 123, 123, 125, 124, 123, 124, 123, 124, 123, 123, 122, 123, 124, 125, 126, 129, 130, 130, 130, 133, 132, 130, 129, 128, 127, 127, 127, 125, 125, 125, 125, 123, 124, 125, 124, 123, 124, 124, 123, 123, 122, 122, 122, 121, 120, 121, 121, 121, 120, 119, 119, 120, 121, 120, 121, 121, 122, 123, 124, 119, 120, 123, 125, 120, 116, 120, 123, 120, 118, 118, 122, 132, 129, 121, 119, 123, 126, 123, 123, 132, 143, 151, 167, 165, 160, 163, 170, 160, 150, 148, 150, 142, 142, 140, 133, 133, 138, 135, 131, 133, 136, 133, 131, 128, 125, 123, 124, 122, 118, 119, 123, 125, 123, 123, 123, 124, 125, 124, 123, 124, 127, 129, 130, 130, 131, 133, 132, 130, 129, 129, 129, 128, 126, 126, 125, 126, 125, 124, 124, 125, 124, 124, 124, 124, 124, 123, 124, 123, 122, 122, 122, 123, 122, 122, 122, 122, 121, 120, 121, 121, 120, 120, 121, 120, 119, 119, 120, 122, 123, 123, 121, 122, 124, 126, 123, 123, 124, 123, 123, 121, 122, 122, 122, 126, 124, 124, 125, 126, 125, 122, 127, 135, 139, 147, 153, 159, 159, 160, 159, 155, 152, 150, 147, 142, 141, 140, 137, 133, 134, 135, 132, 131, 130, 130, 129, 128, 127, 126, 124, 123, 122, 122, 123, 123, 123, 125, 124, 123, 123, 125, 126, 126, 128, 129, 129, 129, 130, 130, 128, 128, 128, 127, 126, 127, 127, 127, 126, 126, 124, 124, 124, 125, 123, 123, 124, 124, 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 121, 120, 121, 121, 120, 120, 121, 122, 122, 123, 122, 122, 123, 124, 124, 125, 125, 123, 124, 128, 129, 126, 128, 128, 128, 128, 127, 126, 125, 124, 124, 122, 123, 122, 122, 134, 144, 145, 143, 148, 155, 153, 149, 148, 146, 145, 145, 144, 139, 137, 139, 137, 134, 132, 131, 131, 130, 131, 129, 128, 128, 127, 126, 124, 124, 125, 125, 125, 124, 123, 123, 123, 123, 122, 123, 124, 125, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 125, 125, 126, 126, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, 125, 126, 126, 125, 125, 126, 126, 125, 125, 126, 126, 126, 126, 126, 125, 126, 126, 126, 125, 125, 125, 125, 125, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 127, 128, 129, 129, 129, 130, 131, 132, 134, 134, 135, 136, 136, 136, 137, 136, 136, 137, 136, 135, 135, 133, 132, 131, 131, 130, 129, 129, 130, 129, 128, 127, 127, 126, 126, 126, 126, 125, 125, 125, 124, 125, 125, 124, 124, 125, 125, 124, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 126, 126, 126, 126, 126, 126, 127, 126, 126, 126, 127, 126, 126, 126, 126, 127, 127, 126, 125, 126, 126, 125, 125, 125, 125, 126, 126, 126, 127, 128, 127, 128, 128, 128, 129, 128, 129, 131, 130, 130, 132, 133, 133, 131, 133, 134, 135, 136, 134, 133, 134, 134, 135, 134, 133, 132, 132, 132, 131, 130, 129, 130, 130, 128, 127, 127, 127, 129, 127, 125, 126, 127, 126, 125, 124, 124, 125, 126, 124, 123, 123, 125, 124, 124, 124, 124, 125, 126, 126, 125, 125, 126, 126, 126, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 126, 126, 126, 126, 126, 127, 126, 126, 126, 127, 126, 126, 127, 128, 127, 126, 127, 126, 127, 127, 126, 127, 127, 128, 126, 126, 129, 128, 128, 128, 128, 128, 128, 129, 128, 129, 131, 131, 132, 130, 131, 131, 131, 133, 133, 133, 133, 132, 132, 132, 132, 131, 131, 131, 131, 131, 132, 130, 130, 130, 127, 125, 128, 128, 126, 126, 126, 125, 124, 125, 125, 125, 124, 126, 123, 124, 126, 124, 122, 124, 124, 121, 123, 123, 125, 122, 124, 124, 124, 125, 123, 124, 125, 126, 125, 124, 124, 125, 124, 125, 124, 127, 125, 124, 127, 126, 126, 126, 125, 127, 125, 128, 128, 127, 127, 127, 127, 129, 128, 125, 125, 126, 129, 126, 128, 127, 128, 129, 129, 128, 129, 129, 128, 129, 129, 130, 130, 132, 131, 131, 130, 129, 130, 131, 132, 131, 131, 130, 132, 131, 130, 130, 132, 130, 129, 130, 127, 127, 128, 128, 126, 126, 126, 126, 124, 125, 125, 125, 125, 126, 124, 124, 126, 125, 123, 124, 124, 120, 123, 123, 124, 123, 124, 124, 124, 125, 125, 124, 125, 126, 125, 124, 124, 125, 125, 125, 124, 127, 126, 124, 127, 126, 126, }; const uint8_t six[4452] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 129, 128, 125, 127, 126, 128, 125, 128, 126, 127, 128, 128, 126, 128, 126, 128, 127, 128, 126, 128, 125, 128, 127, 128, 126, 128, 128, 127, 127, 127, 126, 129, 125, 129, 125, 126, 129, 127, 130, 124, 126, 125, 129, 130, 123, 132, 126, 123, 130, 121, 130, 126, 125, 128, 123, 132, 124, 129, 129, 124, 129, 125, 126, 134, 122, 132, 125, 128, 127, 126, 132, 117, 132, 121, 126, 130, 127, 129, 126, 118, 129, 128, 128, 131, 124, 129, 124, 128, 132, 121, 131, 124, 123, 131, 122, 135, 123, 127, 127, 128, 124, 125, 127, 126, 128, 123, 129, 129, 126, 135, 119, 138, 117, 129, 133, 127, 136, 123, 118, 127, 126, 138, 125, 131, 123, 125, 132, 125, 132, 131, 119, 132, 115, 139, 125, 129, 123, 121, 124, 127, 129, 135, 129, 119, 132, 114, 129, 115, 129, 125, 130, 120, 133, 131, 119, 126, 127, 125, 131, 131, 121, 141, 120, 131, 121, 126, 136, 123, 135, 118, 134, 141, 121, 130, 125, 141, 118, 127, 123, 130, 123, 130, 129, 124, 132, 131, 141, 117, 139, 114, 138, 124, 135, 120, 115, 153, 108, 154, 111, 122, 138, 125, 139, 116, 135, 120, 140, 120, 114, 134, 112, 146, 116, 142, 116, 135, 131, 130, 129, 113, 129, 122, 129, 130, 118, 130, 126, 130, 120, 130, 123, 134, 138, 127, 135, 100, 145, 116, 137, 109, 126, 138, 120, 126, 131, 115, 136, 124, 120, 120, 121, 131, 141, 111, 137, 114, 129, 134, 126, 133, 128, 132, 122, 125, 120, 138, 118, 130, 121, 122, 134, 112, 121, 127, 128, 127, 129, 127, 128, 124, 134, 130, 124, 140, 127, 126, 137, 135, 139, 123, 115, 148, 117, 122, 123, 124, 132, 143, 114, 150, 122, 133, 138, 112, 130, 148, 105, 155, 107, 138, 138, 119, 141, 133, 117, 141, 114, 142, 118, 121, 117, 112, 142, 129, 135, 120, 128, 102, 132, 126, 125, 126, 138, 125, 134, 120, 120, 143, 110, 128, 134, 122, 131, 118, 133, 129, 128, 134, 116, 127, 128, 139, 122, 121, 128, 130, 145, 112, 139, 125, 126, 134, 122, 129, 125, 137, 120, 120, 113, 131, 122, 134, 136, 119, 117, 143, 129, 125, 133, 122, 132, 126, 135, 114, 126, 119, 151, 106, 129, 131, 116, 131, 108, 135, 128, 129, 132, 131, 123, 121, 121, 128, 124, 120, 113, 142, 119, 121, 127, 127, 129, 128, 129, 129, 144, 127, 130, 131, 122, 138, 121, 133, 125, 140, 114, 136, 115, 132, 110, 122, 139, 110, 135, 112, 141, 116, 144, 108, 112, 149, 115, 149, 95, 137, 112, 135, 126, 98, 142, 109, 155, 106, 125, 110, 129, 142, 100, 154, 97, 138, 125, 144, 125, 117, 162, 98, 136, 121, 130, 123, 118, 132, 126, 131, 123, 121, 128, 127, 132, 128, 122, 133, 129, 136, 118, 119, 127, 126, 126, 129, 114, 133, 122, 142, 105, 150, 127, 109, 137, 119, 135, 122, 139, 116, 136, 127, 146, 124, 109, 136, 119, 129, 117, 133, 118, 132, 133, 123, 131, 141, 127, 131, 123, 140, 129, 128, 117, 132, 122, 119, 132, 121, 143, 132, 120, 128, 116, 124, 124, 141, 103, 126, 141, 112, 120, 124, 102, 140, 100, 128, 117, 134, 129, 116, 140, 110, 138, 121, 128, 125, 128, 141, 141, 120, 110, 102, 131, 128, 129, 124, 131, 131, 141, 130, 130, 136, 112, 125, 124, 133, 141, 124, 122, 119, 125, 113, 131, 120, 131, 119, 132, 126, 134, 128, 143, 120, 134, 132, 113, 119, 125, 126, 118, 135, 122, 126, 152, 104, 148, 111, 150, 116, 115, 151, 112, 128, 125, 144, 131, 124, 151, 105, 143, 124, 123, 113, 125, 108, 110, 131, 124, 158, 118, 146, 110, 134, 137, 124, 125, 124, 137, 107, 124, 123, 119, 134, 128, 147, 118, 130, 125, 150, 139, 121, 125, 121, 134, 124, 141, 125, 144, 120, 133, 132, 110, 115, 135, 138, 117, 126, 122, 131, 130, 128, 127, 142, 121, 149, 100, 144, 126, 123, 132, 111, 128, 143, 109, 129, 112, 143, 127, 135, 116, 116, 149, 114, 115, 141, 137, 91, 150, 96, 149, 130, 128, 125, 121, 145, 113, 144, 114, 131, 140, 112, 101, 120, 136, 126, 137, 101, 129, 115, 123, 129, 107, 155, 102, 129, 157, 111, 150, 115, 129, 106, 120, 147, 123, 142, 110, 111, 146, 108, 145, 122, 125, 133, 118, 126, 134, 120, 160, 133, 127, 141, 122, 121, 156, 137, 145, 123, 105, 116, 127, 129, 119, 139, 118, 149, 121, 125, 116, 115, 122, 113, 143, 122, 139, 158, 114, 131, 97, 123, 141, 115, 129, 109, 132, 131, 140, 118, 120, 139, 125, 136, 124, 143, 126, 134, 149, 125, 140, 110, 120, 128, 137, 127, 136, 123, 122, 122, 124, 130, 121, 116, 138, 111, 130, 123, 135, 119, 115, 136, 118, 102, 145, 122, 160, 118, 145, 96, 145, 133, 142, 111, 122, 127, 119, 121, 117, 137, 120, 153, 129, 129, 124, 132, 114, 146, 113, 134, 114, 155, 111, 143, 134, 99, 136, 121, 138, 130, 82, 152, 105, 141, 121, 131, 123, 113, 117, 123, 122, 136, 116, 132, 120, 117, 134, 130, 124, 131, 120, 136, 115, 114, 152, 126, 164, 114, 133, 124, 122, 127, 124, 138, 147, 154, 130, 134, 132, 129, 122, 118, 143, 115, 145, 126, 133, 111, 127, 151, 119, 129, 106, 120, 130, 110, 144, 142, 114, 122, 125, 114, 137, 119, 141, 127, 124, 107, 137, 145, 116, 119, 117, 150, 122, 129, 107, 131, 134, 129, 139, 121, 126, 119, 133, 141, 94, 155, 118, 141, 128, 134, 142, 94, 137, 96, 128, 113, 112, 138, 123, 142, 126, 149, 110, 123, 124, 117, 120, 116, 115, 118, 92, 145, 125, 132, 127, 115, 122, 115, 125, 124, 130, 133, 125, 127, 101, 124, 134, 130, 148, 122, 141, 116, 125, 143, 109, 116, 130, 125, 123, 144, 130, 108, 143, 135, 129, 121, 144, 131, 123, 137, 126, 120, 97, 144, 121, 141, 116, 94, 151, 109, 132, 115, 134, 117, 143, 131, 128, 139, 154, 134, 112, 138, 102, 139, 145, 112, 146, 116, 135, 110, 122, 116, 132, 116, 122, 124, 135, 118, 112, 140, 122, 142, 142, 117, 119, 143, 115, 116, 115, 138, 133, 119, 122, 125, 116, 131, 136, 132, 134, 137, 112, 137, 105, 137, 115, 131, 127, 128, 123, 139, 133, 127, 127, 122, 109, 152, 105, 158, 125, 126, 110, 109, 121, 110, 131, 118, 134, 124, 135, 122, 110, 131, 127, 131, 110, 129, 138, 126, 123, 149, 115, 140, 119, 101, 137, 118, 138, 136, 135, 136, 123, 156, 108, 150, 122, 121, 122, 125, 133, 119, 124, 121, 129, 127, 114, 141, 122, 114, 120, 118, 121, 136, 110, 126, 122, 129, 116, 115, 130, 127, 125, 110, 139, 123, 139, 118, 134, 121, 115, 119, 126, 122, 121, 119, 134, 110, 125, 118, 137, 114, 136, 132, 130, 132, 132, 124, 135, 114, 147, 124, 138, 132, 120, 130, 119, 123, 133, 120, 144, 116, 125, 136, 121, 135, 117, 119, 148, 116, 147, 115, 124, 117, 115, 135, 108, 135, 106, 111, 119, 116, 119, 107, 114, 104, 119, 130, 118, 127, 123, 133, 144, 132, 139, 153, 154, 160, 158, 164, 163, 160, 156, 148, 138, 156, 126, 145, 125, 112, 127, 117, 108, 107, 107, 100, 90, 98, 87, 87, 82, 86, 81, 84, 87, 76, 79, 68, 76, 83, 116, 118, 124, 145, 153, 172, 182, 179, 194, 189, 197, 173, 168, 167, 158, 146, 125, 113, 109, 102, 100, 99, 103, 110, 121, 129, 140, 148, 164, 164, 171, 169, 165, 154, 149, 138, 120, 122, 112, 102, 88, 92, 89, 83, 85, 96, 86, 85, 76, 70, 65, 59, 53, 54, 51, 131, 107, 119, 129, 180, 185, 207, 182, 197, 199, 189, 166, 160, 145, 139, 123, 114, 91, 103, 98, 101, 98, 120, 123, 133, 146, 161, 161, 174, 174, 174, 171, 176, 154, 142, 137, 134, 117, 108, 107, 111, 120, 101, 98, 98, 102, 91, 77, 69, 59, 51, 39, 30, 30, 39, 135, 129, 120, 141, 210, 215, 224, 206, 208, 215, 224, 169, 140, 131, 118, 101, 79, 59, 71, 92, 94, 101, 112, 147, 161, 171, 171, 188, 193, 180, 167, 160, 150, 138, 123, 102, 106, 105, 100, 95, 114, 126, 129, 130, 129, 137, 132, 116, 92, 80, 71, 53, 30, 13, 25, 28, 100, 111, 110, 140, 201, 219, 225, 226, 208, 223, 220, 179, 134, 112, 101, 66, 58, 56, 79, 93, 98, 116, 148, 174, 182, 186, 189, 200, 192, 171, 153, 143, 127, 111, 93, 92, 97, 103, 95, 113, 137, 144, 150, 150, 154, 160, 145, 114, 102, 97, 67, 46, 20, 10, 23, 18, 16, 117, 140, 138, 174, 238, 248, 236, 238, 192, 202, 193, 148, 88, 95, 74, 66, 55, 55, 53, 107, 120, 125, 139, 187, 194, 202, 192, 189, 187, 193, 150, 127, 123, 120, 102, 90, 84, 101, 109, 112, 109, 134, 149, 152, 155, 152, 154, 159, 127, 107, 100, 88, 53, 35, 21, 10, 24, 18, 16, 117, 153, 153, 174, 238, 241, 245, 238, 191, 192, 187, 145, 84, 81, 66, 61, 54, 50, 76, 119, 130, 142, 172, 204, 208, 212, 196, 177, 176, 160, 113, 94, 91, 80, 75, 81, 83, 109, 135, 140, 147, 171, 177, 179, 175, 160, 149, 139, 119, 90, 80, 70, 58, 58, 50, 51, 56, 61, 47, 61, 88, 132, 187, 159, 189, 215, 254, 203, 180, 143, 161, 138, 98, 48, 79, 80, 93, 81, 107, 120, 172, 173, 163, 159, 188, 177, 156, 138, 130, 125, 122, 100, 95, 103, 114, 111, 119, 132, 144, 151, 148, 150, 152, 156, 142, 129, 124, 125, 113, 101, 93, 91, 96, 92, 89, 90, 98, 96, 93, 81, 71, 69, 73, 65, 139, 180, 151, 174, 212, 219, 194, 194, 140, 154, 147, 121, 65, 95, 97, 100, 94, 109, 129, 160, 167, 155, 162, 180, 171, 148, 135, 128, 124, 119, 100, 94, 109, 116, 111, 115, 123, 137, 149, 151, 146, 148, 157, 149, 136, 124, 122, 119, 114, 100, 97, 105, 108, 101, 103, 118, 120, 119, 102, 91, 88, 77, 50, 44, 50, 72, 129, 177, 164, 177, 220, 231, 204, 182, 163, 149, 143, 105, 68, 82, 94, 96, 97, 124, 138, 164, 176, 166, 166, 174, 157, 128, 121, 115, 106, 103, 95, 96, 112, 121, 122, 128, 140, 144, 151, 152, 148, 142, 140, 136, 129, 123, 118, 118, 117, 118, 118, 120, 126, 126, 120, 117, 118, 115, 104, 96, 84, 81, 78, 67, 49, 48, 60, 85, 103, 149, 179, 220, 222, 218, 206, 193, 166, 115, 99, 88, 78, 82, 89, 116, 144, 166, 179, 193, 196, 184, 172, 144, 118, 99, 86, 76, 81, 97, 109, 126, 144, 157, 163, 159, 149, 133, 122, 109, 104, 110, 117, 129, 145, 164, 167, 167, 161, 148, 133, 123, 107, 100, 102, 99, 97, 103, 105, 109, 113, 111, 110, 110, 105, 90, 79, 80, 73, 67, 61, 70, 79, 102, 127, 140, 169, 194, 226, 222, 197, 182, 173, 159, 119, 100, 94, 99, 100, 110, 127, 158, 172, 177, 173, 174, 169, 149, 123, 104, 98, 98, 90, 91, 106, 123, 133, 137, 142, 148, 147, 135, 127, 119, 115, 106, 106, 116, 127, 154, 162, 165, 166, 174, 161, 137, 121, 113, 112, 107, 104, 110, 130, 130, 125, 126, 128, 119, 106, 99, 95, 96, 86, 81, 87, 92, 90, 92, 100, 99, 106, 98, 93, 98, 112, 118, 130, 163, 188, 207, 192, 183, 173, 171, 138, 116, 117, 118, 118, 121, 129, 143, 159, 160, 154, 154, 152, 137, 121, 110, 106, 108, 108, 108, 121, 138, 144, 141, 143, 143, 139, 127, 117, 113, 115, 114, 113, 117, 122, 130, 135, 152, 154, 144, 147, 141, 133, 122, 120, 115, 115, 115, 118, 122, 127, 128, 129, 128, 128, 126, 121, 117, 114, 112, 109, 109, 105, 106, 111, 108, 107, 113, 112, 102, 106, 107, 105, 92, 91, 108, 111, 110, 125, 148, 175, 193, 202, 189, 180, 172, 150, 122, 111, 115, 115, 119, 124, 139, 155, 162, 158, 152, 154, 144, 133, 118, 112, 108, 109, 114, 118, 130, 137, 142, 140, 143, 141, 132, 122, 117, 114, 109, 111, 115, 120, 126, 132, 137, 138, 143, 145, 136, 131, 132, 132, 123, 120, 123, 128, 125, 123, 126, 130, 128, 126, 126, 127, 126, 123, 121, 123, 124, 118, 118, 122, 122, 118, 119, 121, 121, 119, 115, 114, 116, 117, 112, 110, 116, 108, 105, 109, 118, 109, 97, 97, 100, 97, 104, 105, 106, 115, 191, 219, 177, 168, 203, 203, 144, 123, 134, 128, 123, 113, 120, 131, 156, 145, 134, 152, 166, 148, 121, 123, 129, 121, 111, 109, 118, 129, 131, 127, 132, 142, 134, 123, 121, 123, 119, 115, 116, 127, 129, 130, 129, 131, 132, 127, 125, 124, 125, 124, 131, 141, 134, 128, 136, 138, 130, 125, 129, 128, 127, 124, 125, 126, 125, 124, 122, 124, 125, 123, 120, 122, 124, 123, 118, 119, 122, 121, 118, 117, 118, 117, 113, 115, 117, 119, 114, 112, 119, 116, 113, 111, 109, 110, 110, 101, 96, 106, 105, 111, 185, 201, 162, 172, 213, 201, 132, 136, 150, 135, 112, 115, 134, 132, 138, 136, 142, 149, 155, 141, 128, 142, 141, 122, 115, 126, 126, 116, 124, 130, 131, 129, 130, 130, 129, 127, 123, 123, 122, 122, 121, 122, 124, 125, 125, 128, 130, 130, 126, 128, 128, 126, 124, 126, 128, 128, 130, 130, 130, 132, 130, 127, 128, 130, 128, 125, 126, 127, 127, 125, 124, 125, 125, 124, 123, 123, 123, 121, 121, 122, 121, 120, 121, 121, 120, 119, 117, 118, 117, 117, 116, 116, 118, 118, 115, 114, 119, 120, 116, 116, 114, 115, 114, 112, 111, 125, 138, 131, 133, 150, 158, 143, 144, 157, 156, 143, 140, 149, 147, 137, 134, 139, 136, 130, 132, 134, 133, 130, 132, 133, 133, 133, 131, 132, 131, 131, 129, 127, 128, 127, 125, 124, 126, 125, 124, 125, 126, 126, 126, 127, 127, 127, 126, 125, 125, 126, 125, 124, 126, 125, 124, 124, 124, 125, 124, 125, 126, 125, 125, 124, 125, 125, 124, 125, 126, 125, 125, 125, 124, 125, 125, 126, 125, 125, 124, 124, 125, 123, 122, 124, 124, 124, 123, 124, 125, 126, 126, 126, 127, 128, 126, 124, 125, 126, 125, 125, 126, 126, 126, 126, 125, 127, 126, 126, 126, 127, 126, 126, 127, 126, 127, 126, 126, 127, 127, 127, 128, 128, 128, 128, 129, 129, 128, 128, 130, 129, 129, 127, 126, 127, 127, 128, 128, 129, 130, 130, 130, 131, 132, 131, 129, 129, 128, 127, 126, 126, 126, 126, 127, 128, 129, 128, 128, 129, 129, 129, 128, 128, 128, 128, 127, 127, 127, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 127, 127, 127, 126, 126, 125, 125, 124, 125, 125, 126, 127, 128, 128, 128, 127, 126, 126, 125, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 125, 125, 125, 126, 127, 128, 129, 129, 129, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 127, 128, 128, 128, 128, 128, 128, 128, 127, 127, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 128, 128, 128, 128, 128, 128, 127, 127, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 128, 127, 127, 126, 127, 127, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 127, 127, 127, 127, 127, 126, 127, 127, 127, 128, 128, 127, 127, 127, 128, 130, 130, 129, 129, 147, 142, 122, 109, 119, 131, 127, 114, 116, 127, 131, 122, 119, 132, 138, 131, 122, 122, 131, 133, 125, 122, 125, 131, 128, 124, 122, 126, 129, 127, 124, 124, 128, 129, 128, 125, 125, 128, 129, 128, 124, 128, 129, 128, 123, 122, 123, 128, 128, 126, 122, 123, 128, 132, 128, 124, 140, 135, 143, 131, 126, 127, 131, 126, 119, 117, 124, 128, 126, 122, 121, 127, 129, 129, 127, 129, 131, 131, 130, 128, 129, 131, 130, 135, 148, 135, 125, 117, 125, 128, 123, 112, 115, 125, 127, 121, 116, 123, 132, 132, 128, 124, 127, 130, 129, 123, 122, 125, 127, 125, 123, 125, 128, 127, 127, 126, 128, 129, 130, 129, 131, 130, 130, 128, 128, 127, 129, 130, 126, 127, 128, 129, 127, 125, 126, 128, 128, 126, 126, 129, 130, 127, 119, 131, 136, 129, 124, 121, 128, 138, 128, 114, 121, 126, 136, 125, 116, 123, 134, 124, 134, 124, 127, 115, 136, 123, 127, 126, 126, 135, 122, 119, 126, 131, 122, 130, 121, 130, 114, 145, 116, 140, 118, 125, 132, 136, 128, 124, 117, 128, 136, 140, 119, 127, 126, 145, 132, 131, 125, 130, 153, 123, 134, 111, 130, 125, 132, 126, 110, 124, 126, 129, 128, 108, 130, 153, 120, 127, 120, 128, 137, 140, 115, 138, 114, 137, 121, 138, 126, 130, 128, 127, 143, 130, 119, 133, 128, 123, 125, 129, 131, 137, 128, 108, 136, 145, 127, 126, 113, 136, 130, 132, 123, 111, 128, 136, 139, 100, 133, 124, 135, 123, 128, 126, 124, 131, 137, 126, 109, 138, 140, 129, 110, 104, 151, 117, 143, 95, 144, 103, 128, 117, 124, 113, 123, 113, 152, 110, 130, 133, 145, 120, 137, 127, 122, 118, 120, 127, 113, 134, 117, 119, 131, 128, 118, 120, 128, 112, 148, 131, 126, 152, 125, 144, 115, 134, 136, 135, 123, 118, 128, 110, 157, 111, 133, 105, 151, 128, 128, 122, 136, 121, 122, 114, 136, 122, 131, 127, 115, 97, 108, 120, 134, 139, 104, 147, 121, 138, 110, 151, 116, 143, 107, 124, 127, 134, 111, 152, 134, 139, 121, 129, 116, 131, 107, 136, 135, 120, 127, 119, 121, 125, 120, 125, 152, 117, 133, 129, 119, 129, 118, 134, 124, 121, 136, 125, 128, 126, 144, 130, 130, 114, 139, 130, 123, 113, 139, 135, 143, 117, 132, 96, 150, 127, 126, 131, 136, 123, 133, 110, 145, 99, 143, 121, 144, 105, 145, 106, 149, 122, 130, 125, 136, 132, 133, 129, 129, 122, 135, 118, 133, 135, 121, 137, 116, 126, 149, 123, 144, 102, 129, 130, 129, 107, 133, 111, 147, 118, 124, 118, 134, 133, 144, 123, 121, 138, 116, 149, 119, 117, 133, 124, 139, 131, 113, 131, 111, 146, 109, 134, 119, 134, 122, 128, 128, 122, 122, 134, 109, 129, 126, 116, 128, 117, 129, 132, 131, 138, 102, 139, 115, 146, 114, 111, 129, 127, 127, 116, 122, 133, 115, 132, 104, 139, 123, 129, 115, 131, 126, 128, 123, 139, 113, 140, 108, 141, 122, 112, 127, 130, 118, 141, 114, 146, 123, 135, 111, 142, 103, 147, 129, 124, 127, 132, 132, 121, 128, 122, 123, 145, 114, 111, 142, 124, 130, 118, 136, 125, 129, 142, 124, 111, 126, 139, 127, 110, 132, 128, 133, 127, 107, 146, 143, 95, 141, 118, 129, 120, 123, 123, 138, 123, 134, 140, 102, 143, 109, 147, 119, 133, 112, 144, 141, 107, 138, 131, 113, 128, 118, 147, 110, 139, 137, 134, 125, 127, 127, 133, 120, 129, 121, 126, 117, 148, 106, 144, 111, 130, 124, 127, 120, 135, 121, 125, 124, 133, 118, 131, 138, 110, 123, 121, 135, 131, 127, 122, 132, 131, 118, 135, 115, 135, 133, 107, 139, 103, 126, 125, 130, 127, 129, 131, 129, 135, 121, 125, 119, 129, 121, 125, 103, 119, 143, 112, 135, 124, 128, 132, 128, 125, 116, 149, 114, 143, 115, 137, 114, 138, 116, 136, 130, 127, 136, 118, 134, 116, 138, 116, 143, 108, 101, 146, 114, 141, 133, 128, 136, 126, 136, 114, 140, 116, 142, 93, 145, 113, 130, 107, 136, 123, 125, 125, 125, 104, 160, 107, 146, 103, 144, 118, 140, 116, 121, 132, 117, 147, 115, 152, 112, 136, 134, 126, 125, 136, 119, 148, 116, 140, 109, 158, 115, 149, 111, 147, 137, 119, 136, 125, 152, 105, 143, 123, 142, 112, 139, 117, 138, 118, 139, 103, 140, 111, 144, 123, 124, 118, 133, 123, 131, 132, 136, 131, 127, 133, 124, 131, 123, 135, 107, 139, 110, 137, 118, 153, 108, 130, 120, 143, 104, 134, 131, 114, 138, 115, 128, 125, 143, 114, 135, 109, 138, 128, 127, 116, 142, 132, 132, 115, 141, 126, 141, 127, 122, 140, 126, 146, 103, 161, 92, 159, 113, 135, 123, 139, 128, 120, 129, 117, 136, 133, 142, 128, 144, 116, 145, 107, 133, 126, 137, 113, 132, 127, 127, 120, 132, 109, 144, 104, 143, 142, 100, 135, 111, 141, 116, 131, 103, 144, 122, 136, 127, 108, 139, 118, 136, 127, 130, 126, 129, 123, 134, 121, 135, 119, 126, 117, 141, 123, 120, 115, 137, 116, 122, 130, 129, 126, 120, 141, 118, 138, 125, 127, 129, 129, 118, 138, 120, 133, 125, 131, 124, 134, 125, 128, 115, 131, 131, 117, 120, 130, 134, 118, 122, 131, 132, 123, 138, 106, 135, 132, 136, 119, 137, 112, 139, 112, 131, 130, 129, 140, 106, 145, 115, 128, 125, 133, 125, 125, 137, 117, 127, 126, 125, 129, 122, 133, 108, 142, 113, 145, 124, 132, 127, 124, 127, 134, 121, 142, 116, 123, 125, 134, 121, 126, 140, 113, 135, 117, 141, 115, 147, 116, 138, 122, 137, 127, 127, 127, 136, 124, 123, 140, 125, 140, 115, 141, 118, 143, 121, 126, 127, 129, 121, 131, 117, 137, 117, 131, 115, 133, 123, 134, 116, 127, 132, 129, 124, 129, 115, 130, 121, 132, 128, 127, 123, 132, 125, 126, 123, 129, 126, 111, 143, 119, 134, 113, 140, 121, 127, 121, 137, 118, 147, 108, 134, 117, 132, 128, 128, 126, 127, 134, 117, 137, 115, 135, 116, 131, 120, 142, 109, 147, 108, 145, 115, 136, 117, 134, 117, 143, 120, 121, 126, 129, 127, 127, 122, 131, 116, 127, 120, 137, 123, 123, 126, 127, 127, 123, 130, 128, 136, 116, 131, 123, 132, 124, 126, 120, 131, 126, 127, 130, 131, 120, 132, 121, 127, 124, 122, 130, 130, 116, 134, 131, 123, 127, 139, 133, 128, 119, 145, 124, 131, 120, 139, 127, 136, 119, 139, 125, 138, 113, 144, 119, 136, 110, 140, 113, 140, 114, 137, 112, 135, 123, 131, 116, 134, 121, 124, 121, 129, 128, 122, 146, 116, 139, 117, 138, 120, 128, 127, 126, 127, 122, 131, 128, 129, 122, 130, 122, 132, 123, 126, 130, 135, 123, 123, 128, 132, 122, 130, 122, 130, 118, 136, 123, 135, 122, 131, 124, 138, 113, 131, 137, 120, 126, 125, 129, 124, 125, 133, 120, 137, 117, 134, 123, 126, 126, 130, 126, 127, 125, 130, 125, 126, 129, 123, 132, 122, 136, 121, 132, 135, 124, 133, 126, 126, 132, 125, 134, 123, 133, 126, 132, 128, 130, 132, 126, 118, 137, 126, 130, 121, 130, 131, 123, 124, 135, 126, 131, 122, 132, 127, 128, 127, 123, 130, 118, 136, 121, 133, 124, 124, 138, 119, 134, 115, 129, 120, 132, 123, 128, 128, 129, 125, 128, 121, 130, 120, 137, 117, 136, 114, 142, 127, 126, 138, 119, 131, 116, 137, 125, 128, 123, 132, 128, 128, 129, 125, 127, 133, 128, 128, 113, 133, 123, 127, 117, 134, 119, 134, 116, 125, 119, 125, 116, 125, 121, 128, 121, 127, 130, 122, 134, 119, 143, 113, 143, 115, 133, 118, 138, 126, 129, 126, 128, 132, 120, 131, 121, 138, 120, 134, 119, 137, 117, 138, 119, 130, 127, 134, 127, 121, 133, 117, 136, 118, 140, 119, 139, 114, 133, 125, 134, 124, 127, 131, 127, 126, 121, 135, 126, 134, 118, 133, 121, 139, 120, 132, 122, 134, 124, 128, 121, 132, 124, 128, 123, 130, 127, 127, 131, 128, 128, 125, 134, 130, 131, 120, 132, 126, 130, 126, 128, 128, 126, 128, 125, 128, 121, 128, 125, 130, 123, 126, 126, 129, 124, 123, 128, 123, 128, 125, 125, 129, 125, 128, 125, 128, 124, 129, 125, 129, 124, 130, 125, 127, 126, 128, 130, 125, 132, }; const uint8_t seven[5194] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 126, 127, 126, 127, 127, 127, 127, 127, 127, 127, 128, 126, 128, 126, 128, 126, 127, 126, 127, 128, 126, 128, 127, 127, 127, 127, 127, 126, 128, 127, 128, 126, 127, 128, 127, 128, 126, 128, 125, 127, 128, 127, 128, 126, 127, 127, 128, 127, 125, 129, 125, 129, 126, 126, 127, 127, 127, 127, 126, 127, 128, 128, 126, 128, 127, 129, 128, 128, 124, 130, 124, 130, 128, 124, 128, 126, 128, 125, 126, 128, 124, 135, 120, 134, 121, 127, 129, 126, 127, 132, 123, 131, 122, 132, 123, 133, 126, 124, 130, 123, 128, 132, 128, 126, 130, 125, 121, 131, 120, 132, 126, 129, 122, 129, 124, 128, 119, 129, 138, 111, 139, 116, 132, 130, 128, 131, 119, 133, 120, 135, 131, 122, 130, 124, 136, 119, 135, 116, 133, 130, 129, 133, 121, 128, 117, 127, 126, 119, 142, 119, 134, 126, 116, 135, 121, 132, 132, 127, 130, 132, 123, 125, 129, 128, 119, 132, 118, 131, 125, 130, 126, 125, 132, 129, 125, 124, 121, 141, 116, 122, 139, 120, 143, 113, 124, 124, 135, 129, 124, 130, 128, 117, 114, 124, 126, 132, 121, 115, 134, 125, 123, 117, 134, 118, 137, 126, 135, 118, 125, 144, 115, 135, 124, 138, 110, 137, 125, 121, 127, 112, 133, 121, 137, 135, 120, 137, 117, 145, 114, 124, 137, 125, 127, 113, 128, 123, 126, 133, 123, 135, 119, 126, 120, 143, 117, 121, 129, 124, 123, 134, 126, 126, 126, 133, 113, 131, 111, 144, 113, 138, 122, 121, 126, 117, 130, 118, 127, 133, 137, 133, 114, 126, 126, 115, 133, 121, 132, 116, 137, 119, 139, 133, 126, 126, 128, 124, 126, 127, 116, 126, 147, 102, 146, 125, 145, 112, 141, 122, 129, 119, 119, 119, 117, 130, 114, 129, 145, 122, 131, 124, 128, 128, 125, 126, 124, 134, 133, 130, 131, 121, 134, 121, 115, 126, 131, 128, 133, 121, 133, 120, 127, 121, 121, 125, 135, 115, 126, 121, 134, 103, 143, 128, 115, 121, 113, 126, 133, 117, 121, 127, 126, 130, 133, 136, 105, 139, 129, 119, 127, 130, 121, 129, 118, 129, 138, 124, 128, 138, 127, 131, 129, 132, 127, 121, 108, 132, 119, 139, 119, 144, 115, 141, 128, 120, 129, 124, 130, 128, 119, 129, 134, 110, 150, 124, 128, 133, 130, 127, 125, 112, 113, 130, 117, 121, 137, 124, 141, 108, 127, 126, 132, 132, 131, 129, 134, 111, 145, 104, 113, 133, 117, 127, 115, 138, 116, 135, 108, 123, 139, 121, 137, 135, 123, 114, 119, 135, 114, 136, 114, 123, 116, 135, 129, 126, 132, 149, 104, 135, 126, 113, 133, 115, 103, 137, 123, 128, 113, 122, 147, 117, 114, 140, 115, 117, 140, 123, 138, 121, 108, 144, 102, 134, 137, 104, 143, 129, 142, 110, 140, 104, 124, 129, 115, 132, 125, 134, 119, 138, 112, 139, 139, 132, 138, 130, 150, 109, 139, 117, 143, 117, 122, 151, 121, 145, 126, 139, 121, 132, 126, 118, 152, 105, 157, 115, 131, 116, 123, 149, 112, 156, 87, 148, 142, 118, 128, 101, 158, 111, 156, 113, 119, 155, 120, 142, 99, 137, 92, 131, 144, 89, 161, 98, 137, 132, 128, 134, 119, 129, 120, 128, 130, 111, 148, 113, 127, 122, 131, 112, 134, 138, 105, 137, 135, 122, 123, 132, 147, 118, 134, 117, 126, 124, 123, 125, 128, 152, 123, 126, 114, 117, 120, 126, 127, 129, 119, 131, 128, 144, 120, 131, 111, 135, 127, 139, 119, 118, 129, 128, 124, 135, 125, 127, 107, 128, 136, 96, 140, 83, 137, 130, 129, 122, 128, 130, 122, 152, 131, 118, 112, 121, 141, 110, 144, 102, 130, 123, 145, 136, 131, 128, 136, 122, 131, 131, 123, 135, 111, 143, 134, 132, 136, 109, 122, 115, 146, 139, 108, 146, 113, 120, 136, 126, 149, 114, 141, 133, 167, 109, 146, 112, 154, 134, 137, 129, 134, 121, 150, 109, 118, 132, 160, 111, 142, 104, 106, 136, 125, 152, 117, 152, 94, 133, 121, 124, 125, 126, 127, 134, 119, 124, 137, 123, 141, 113, 153, 123, 142, 115, 134, 132, 135, 97, 138, 140, 128, 98, 134, 116, 132, 125, 133, 147, 117, 115, 123, 131, 128, 114, 140, 117, 150, 121, 143, 119, 117, 136, 118, 131, 135, 114, 147, 102, 114, 128, 134, 123, 125, 137, 130, 127, 132, 118, 138, 109, 127, 135, 128, 127, 120, 151, 116, 151, 112, 131, 141, 118, 124, 128, 114, 143, 89, 132, 128, 149, 110, 124, 129, 136, 114, 137, 111, 133, 118, 129, 107, 122, 133, 121, 132, 139, 119, 116, 128, 124, 122, 114, 123, 144, 122, 110, 126, 135, 117, 134, 136, 128, 125, 102, 155, 117, 151, 119, 109, 142, 127, 138, 126, 160, 95, 142, 131, 105, 124, 130, 136, 134, 127, 120, 112, 130, 109, 141, 114, 123, 125, 130, 138, 104, 133, 116, 129, 148, 105, 153, 122, 110, 123, 126, 139, 128, 117, 120, 125, 135, 117, 154, 142, 105, 147, 124, 134, 112, 124, 128, 148, 131, 130, 120, 129, 124, 122, 116, 133, 114, 127, 129, 114, 131, 118, 132, 125, 126, 128, 115, 152, 133, 89, 155, 90, 134, 136, 113, 134, 117, 117, 137, 128, 131, 125, 128, 157, 103, 163, 122, 140, 119, 131, 125, 119, 139, 128, 121, 135, 121, 136, 144, 113, 154, 133, 115, 144, 114, 159, 126, 133, 115, 128, 143, 102, 152, 123, 122, 126, 134, 135, 117, 134, 122, 138, 145, 117, 124, 121, 115, 119, 135, 122, 142, 94, 144, 119, 148, 135, 125, 139, 135, 129, 143, 122, 174, 112, 141, 114, 123, 135, 117, 144, 110, 121, 162, 105, 149, 111, 128, 117, 140, 137, 124, 142, 107, 137, 134, 101, 140, 118, 123, 144, 112, 120, 130, 133, 128, 130, 129, 115, 136, 109, 133, 136, 116, 132, 120, 124, 113, 106, 135, 139, 116, 146, 122, 132, 119, 147, 130, 121, 130, 121, 127, 141, 124, 122, 123, 111, 140, 111, 132, 142, 121, 128, 130, 117, 151, 119, 137, 124, 135, 132, 118, 122, 122, 125, 140, 128, 107, 138, 119, 117, 127, 119, 132, 125, 121, 133, 104, 135, 149, 114, 148, 126, 123, 118, 136, 116, 120, 142, 115, 140, 147, 102, 145, 146, 111, 130, 119, 143, 112, 128, 132, 128, 130, 110, 146, 111, 155, 124, 114, 145, 115, 145, 131, 127, 115, 140, 126, 103, 145, 114, 125, 131, 136, 139, 93, 149, 121, 137, 127, 141, 117, 127, 140, 107, 137, 109, 138, 134, 103, 148, 88, 148, 115, 150, 124, 124, 157, 104, 147, 116, 148, 95, 130, 138, 96, 150, 87, 147, 118, 152, 105, 134, 138, 145, 135, 94, 167, 104, 173, 105, 108, 120, 125, 145, 83, 161, 87, 159, 106, 136, 110, 127, 137, 120, 130, 112, 130, 130, 129, 121, 103, 155, 106, 138, 106, 146, 116, 143, 123, 129, 124, 129, 122, 134, 117, 117, 130, 123, 125, 121, 125, 122, 134, 122, 150, 120, 135, 123, 138, 117, 133, 124, 133, 101, 129, 111, 131, 120, 112, 127, 131, 120, 129, 135, 129, 130, 122, 129, 139, 130, 116, 137, 117, 111, 141, 116, 127, 124, 124, 135, 116, 141, 124, 123, 125, 139, 117, 130, 112, 128, 114, 119, 125, 115, 131, 133, 136, 130, 133, 138, 138, 131, 125, 131, 121, 130, 129, 115, 125, 119, 129, 117, 133, 125, 138, 133, 143, 129, 130, 144, 122, 136, 115, 122, 119, 119, 123, 109, 129, 114, 129, 124, 136, 129, 135, 132, 129, 130, 117, 124, 115, 124, 114, 114, 124, 119, 127, 128, 143, 137, 150, 151, 149, 151, 143, 147, 135, 139, 128, 122, 127, 119, 126, 121, 127, 126, 133, 131, 130, 126, 121, 119, 110, 100, 92, 85, 80, 69, 71, 65, 67, 65, 77, 93, 128, 150, 161, 171, 193, 195, 197, 185, 182, 168, 168, 149, 134, 117, 115, 109, 106, 103, 103, 110, 118, 125, 133, 140, 150, 157, 160, 161, 161, 157, 149, 143, 141, 135, 125, 122, 120, 115, 117, 115, 107, 103, 104, 100, 92, 86, 81, 72, 61, 53, 49, 36, 50, 99, 139, 130, 141, 170, 209, 210, 209, 177, 184, 189, 176, 126, 116, 107, 103, 97, 98, 88, 113, 131, 142, 141, 158, 166, 173, 168, 165, 159, 160, 153, 143, 127, 125, 123, 119, 111, 117, 120, 121, 130, 132, 126, 136, 139, 115, 108, 100, 84, 62, 55, 38, 36, 41, 45, 124, 145, 172, 167, 222, 209, 226, 202, 179, 156, 163, 130, 95, 73, 83, 89, 101, 98, 109, 133, 164, 167, 170, 176, 181, 179, 165, 147, 135, 130, 111, 100, 95, 98, 107, 120, 125, 134, 152, 160, 156, 154, 150, 144, 135, 118, 97, 90, 83, 67, 46, 32, 33, 27, 41, 66, 155, 197, 193, 179, 229, 227, 214, 175, 151, 118, 135, 100, 71, 56, 81, 95, 111, 124, 130, 159, 181, 181, 169, 170, 168, 161, 148, 123, 114, 117, 114, 102, 104, 109, 120, 132, 136, 135, 150, 160, 155, 148, 146, 143, 133, 124, 103, 90, 84, 75, 54, 35, 33, 29, 33, 54, 155, 182, 186, 190, 229, 232, 210, 196, 150, 131, 122, 119, 67, 54, 69, 91, 113, 132, 132, 156, 189, 189, 174, 166, 158, 145, 136, 113, 92, 94, 106, 111, 115, 129, 144, 159, 166, 160, 157, 159, 155, 133, 119, 112, 112, 109, 103, 94, 94, 93, 79, 70, 68, 68, 48, 33, 48, 154, 199, 181, 178, 203, 233, 214, 183, 123, 96, 104, 122, 70, 45, 65, 122, 142, 154, 148, 157, 193, 212, 183, 148, 140, 130, 117, 106, 82, 74, 97, 144, 145, 140, 154, 170, 179, 167, 132, 121, 135, 137, 121, 108, 98, 115, 121, 111, 92, 94, 97, 92, 71, 56, 46, 35, 31, 59, 194, 215, 194, 186, 228, 223, 195, 149, 102, 78, 88, 103, 72, 60, 90, 146, 166, 169, 166, 166, 178, 173, 151, 125, 117, 113, 109, 107, 104, 110, 123, 140, 142, 140, 141, 147, 149, 143, 135, 124, 125, 131, 129, 119, 110, 114, 122, 120, 103, 98, 98, 98, 82, 64, 56, 44, 25, 44, 120, 200, 210, 206, 200, 228, 205, 190, 121, 99, 68, 101, 85, 71, 59, 117, 154, 169, 170, 167, 169, 178, 170, 140, 117, 115, 111, 108, 105, 105, 111, 131, 143, 143, 140, 143, 147, 146, 141, 128, 123, 128, 130, 125, 116, 111, 117, 124, 115, 99, 100, 101, 95, 75, 64, 52, 36, 32, 46, 145, 215, 194, 206, 213, 222, 195, 181, 111, 76, 85, 103, 77, 60, 90, 133, 163, 180, 172, 170, 173, 178, 149, 119, 105, 104, 101, 101, 104, 119, 133, 150, 155, 151, 147, 144, 140, 132, 124, 115, 113, 119, 124, 128, 127, 127, 128, 128, 115, 107, 105, 95, 81, 72, 66, 63, 44, 31, 43, 138, 240, 208, 187, 172, 198, 169, 151, 94, 64, 75, 108, 103, 95, 119, 162, 172, 187, 178, 154, 141, 139, 129, 102, 89, 94, 107, 124, 131, 134, 138, 153, 160, 151, 135, 129, 128, 123, 120, 115, 114, 117, 126, 137, 140, 137, 135, 134, 126, 116, 104, 97, 87, 83, 71, 60, 59, 58, 59, 79, 171, 236, 244, 192, 170, 177, 152, 120, 79, 62, 63, 116, 134, 133, 133, 163, 176, 184, 172, 140, 117, 117, 118, 105, 95, 99, 113, 134, 142, 144, 141, 148, 154, 143, 133, 126, 125, 122, 121, 118, 119, 119, 123, 127, 138, 138, 137, 133, 134, 121, 116, 104, 97, 88, 84, 71, 60, 59, 58, 59, 79, 171, 236, 244, 192, 170, 176, 151, 119, 78, 48, 63, 117, 138, 129, 138, 166, 177, 178, 169, 133, 108, 113, 111, 101, 98, 109, 121, 144, 153, 150, 147, 148, 146, 133, 123, 116, 119, 121, 121, 120, 123, 128, 128, 131, 136, 142, 142, 135, 129, 127, 118, 107, 91, 89, 92, 91, 77, 66, 71, 73, 70, 80, 166, 232, 248, 201, 155, 146, 135, 126, 81, 63, 68, 126, 153, 151, 144, 161, 170, 170, 156, 124, 102, 105, 113, 114, 114, 120, 128, 145, 154, 148, 142, 138, 137, 130, 124, 120, 121, 123, 125, 125, 125, 128, 129, 130, 131, 134, 134, 134, 133, 131, 126, 117, 104, 97, 96, 85, 76, 64, 74, 78, 73, 75, 88, 148, 250, 245, 204, 129, 124, 116, 99, 83, 68, 92, 144, 168, 165, 153, 163, 168, 160, 136, 106, 92, 97, 114, 126, 124, 128, 143, 153, 155, 146, 133, 124, 125, 127, 123, 123, 125, 128, 129, 129, 128, 128, 130, 130, 131, 130, 128, 130, 129, 131, 131, 124, 120, 120, 107, 96, 105, 101, 89, 86, 92, 87, 68, 54, 69, 95, 214, 254, 201, 154, 151, 137, 121, 104, 83, 71, 119, 153, 163, 149, 156, 158, 157, 147, 125, 96, 94, 109, 129, 130, 130, 136, 147, 154, 152, 128, 123, 127, 125, 123, 123, 126, 128, 130, 130, 129, 128, 128, 129, 130, 131, 128, 128, 129, 127, 130, 131, 126, 121, 120, 113, 97, 101, 101, 95, 84, 90, 87, 75, 56, 65, 95, 177, 254, 220, 154, 152, 138, 124, 104, 84, 62, 97, 152, 162, 148, 153, 157, 155, 151, 136, 106, 95, 104, 125, 135, 133, 133, 142, 151, 154, 145, 128, 122, 128, 124, 123, 123, 126, 128, 132, 131, 131, 129, 128, 127, 127, 127, 128, 130, 129, 129, 127, 127, 129, 128, 125, 123, 116, 110, 105, 98, 100, 92, 86, 87, 92, 79, 66, 70, 97, 198, 238, 238, 171, 133, 120, 122, 104, 88, 69, 92, 139, 174, 166, 158, 153, 160, 154, 145, 114, 97, 102, 112, 128, 132, 137, 141, 147, 145, 137, 131, 119, 124, 127, 130, 130, 130, 127, 129, 133, 133, 127, 125, 126, 128, 128, 127, 127, 126, 127, 129, 131, 125, 122, 126, 129, 128, 125, 124, 118, 109, 101, 99, 98, 87, 79, 84, 90, 70, 56, 75, 102, 190, 250, 218, 182, 154, 139, 116, 106, 87, 69, 95, 135, 168, 161, 152, 157, 163, 155, 138, 119, 102, 107, 122, 126, 127, 131, 142, 150, 152, 141, 130, 126, 127, 125, 123, 124, 125, 129, 131, 132, 131, 129, 129, 130, 130, 129, 127, 125, 124, 123, 123, 126, 127, 129, 127, 129, 130, 132, 132, 130, 127, 115, 106, 99, 94, 93, 92, 93, 92, 90, 82, 78, 64, 70, 100, 128, 214, 237, 202, 154, 157, 144, 115, 99, 87, 86, 113, 154, 158, 153, 156, 171, 169, 160, 139, 118, 113, 118, 117, 110, 115, 124, 137, 145, 148, 140, 133, 131, 130, 122, 119, 122, 127, 132, 134, 136, 134, 131, 129, 127, 127, 127, 127, 126, 125, 124, 123, 123, 124, 127, 128, 130, 130, 129, 127, 126, 127, 128, 126, 121, 116, 107, 97, 94, 95, 95, 97, 96, 85, 75, 74, 65, 63, 91, 129, 188, 233, 219, 168, 164, 155, 131, 102, 89, 91, 109, 137, 143, 143, 153, 173, 172, 164, 148, 123, 111, 110, 114, 114, 116, 129, 141, 146, 146, 140, 132, 126, 125, 123, 120, 122, 130, 134, 136, 137, 137, 134, 132, 129, 125, 123, 123, 124, 124, 125, 125, 125, 125, 126, 127, 129, 131, 131, 131, 129, 124, 119, 118, 117, 117, 118, 114, 111, 107, 101, 95, 96, 97, 88, 81, 80, 74, 61, 66, 104, 131, 195, 216, 199, 174, 177, 171, 142, 114, 89, 94, 110, 132, 138, 140, 156, 174, 181, 167, 148, 134, 121, 118, 117, 113, 107, 115, 129, 135, 139, 139, 139, 138, 136, 130, 125, 122, 121, 126, 130, 130, 130, 133, 133, 132, 132, 131, 129, 127, 126, 125, 123, 123, 123, 123, 124, 125, 127, 128, 129, 130, 131, 130, 127, 124, 121, 115, 112, 110, 104, 97, 98, 103, 102, 102, 98, 91, 89, 89, 84, 71, 71, 82, 109, 169, 206, 203, 182, 179, 179, 166, 149, 125, 111, 106, 122, 130, 124, 125, 139, 153, 158, 162, 154, 142, 136, 140, 134, 123, 118, 119, 122, 126, 128, 126, 124, 125, 128, 128, 128, 132, 134, 137, 137, 135, 130, 128, 128, 127, 126, 126, 126, 126, 127, 126, 125, 125, 125, 125, 124, 125, 125, 125, 125, 125, 125, 126, 125, 122, 120, 119, 117, 114, 113, 113, 113, 111, 112, 110, 108, 104, 103, 101, 100, 99, 99, 99, 96, 95, 107, 139, 153, 156, 151, 152, 155, 155, 163, 158, 149, 143, 149, 148, 140, 136, 133, 130, 127, 130, 129, 127, 129, 132, 135, 133, 132, 132, 130, 129, 131, 130, 129, 127, 126, 124, 122, 122, 122, 122, 124, 128, 129, 129, 131, 132, 132, 131, 131, 130, 127, 126, 126, 126, 125, 126, 127, 128, 128, 127, 126, 125, 124, 123, 124, 125, 126, 127, 126, 124, 122, 122, 120, 119, 118, 118, 118, 120, 117, 113, 110, 110, 111, 112, 107, 103, 106, 107, 108, 114, 131, 133, 128, 129, 138, 141, 144, 149, 147, 140, 138, 145, 148, 145, 143, 141, 140, 140, 141, 137, 134, 131, 129, 127, 127, 128, 128, 126, 126, 129, 128, 127, 125, 125, 126, 126, 125, 125, 125, 125, 125, 125, 124, 124, 125, 126, 127, 128, 128, 128, 129, 130, 130, 128, 129, 129, 129, 128, 128, 128, 127, 126, 127, 127, 125, 125, 125, 125, 125, 125, 123, 123, 123, 122, 121, 120, 121, 121, 120, 118, 117, 117, 116, 116, 116, 117, 116, 116, 117, 117, 125, 132, 132, 129, 129, 132, 133, 135, 138, 136, 135, 137, 142, 141, 139, 138, 137, 137, 137, 138, 136, 135, 136, 135, 132, 131, 130, 126, 125, 127, 128, 126, 123, 125, 126, 126, 125, 126, 125, 124, 124, 123, 122, 122, 124, 124, 125, 124, 125, 125, 127, 126, 129, 130, 131, 132, 132, 132, 132, 129, 127, 127, 128, 129, 129, 129, 129, 128, 129, 130, 130, 128, 124, 125, 126, 124, 121, 118, 119, 119, 121, 121, 119, 119, 120, 121, 120, 118, 115, 113, 114, 116, 116, 115, 117, 120, 125, 126, 125, 126, 130, 137, 139, 137, 137, 140, 143, 139, 136, 135, 137, 137, 136, 134, 133, 133, 133, 134, 131, 128, 129, 128, 128, 129, 130, 128, 125, 123, 123, 123, 126, 127, 126, 123, 126, 127, 127, 127, 127, 128, 129, 129, 128, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 126, 125, 125, 125, 125, 125, 124, 124, 123, 124, 122, 121, 122, 121, 120, 118, 118, 119, 118, 117, 117, 117, 114, 116, 114, 116, 120, 123, 124, 127, 131, 134, 135, 140, 142, 144, 144, 146, 143, 141, 142, 140, 138, 135, 133, 133, 130, 129, 127, 127, 128, 128, 127, 125, 124, 124, 125, 124, 126, 128, 130, 128, 127, 127, 128, 128, 130, 130, 130, 131, 131, 131, 131, 132, 129, 128, 129, 129, 128, 128, 128, 128, 127, 127, 127, 127, 127, 126, 125, 125, 125, 124, 124, 124, 123, 120, 117, 116, 116, 115, 114, 113, 111, 111, 110, 110, 109, 111, 112, 111, 103, 94, 95, 91, 86, 78, 96, 129, 160, 166, 157, 164, 174, 180, 173, 160, 147, 145, 157, 148, 130, 116, 122, 127, 131, 131, 127, 128, 134, 141, 136, 133, 134, 134, 133, 130, 127, 123, 126, 127, 124, 123, 121, 121, 123, 127, 129, 134, 135, 135, 135, 136, 136, 136, 134, 130, 129, 129, 129, 126, 127, 127, 128, 127, 125, 125, 124, 124, 123, 123, 124, 124, 122, 120, 117, 115, 116, 112, 111, 111, 111, 110, 109, 106, 104, 101, 99, 100, 98, 97, 90, 91, 86, 86, 78, 79, 85, 159, 196, 189, 179, 198, 213, 204, 191, 160, 140, 144, 153, 136, 104, 105, 115, 130, 129, 132, 131, 142, 160, 161, 153, 140, 142, 139, 135, 124, 112, 109, 111, 115, 112, 113, 117, 120, 126, 130, 131, 130, 134, 139, 140, 143, 140, 137, 134, 135, 132, 128, 125, 124, 125, 126, 126, 126, 127, 127, 126, 123, 121, 122, 123, 123, 121, 123, 123, 121, 117, 114, 112, 114, 114, 110, 108, 107, 106, 105, 106, 100, 91, 98, 97, 89, 80, 87, 86, 85, 88, 87, 97, 108, 152, 173, 202, 201, 202, 201, 195, 187, 158, 151, 140, 139, 129, 125, 122, 130, 139, 141, 144, 146, 149, 143, 141, 135, 130, 126, 122, 119, 114, 115, 117, 118, 121, 124, 125, 124, 126, 127, 127, 125, 126, 127, 129, 131, 137, 145, 140, 137, 141, 138, 130, 127, 123, 122, 127, 129, 126, 125, 128, 126, 123, 121, 120, 121, 122, 121, 119, 121, 120, 118, 111, 112, 112, 109, 103, 104, 105, 105, 107, 99, 94, 100, 105, 95, 89, 87, 85, 85, 85, 82, 86, 99, 108, 128, 153, 176, 206, 211, 211, 202, 199, 177, 164, 152, 144, 139, 138, 134, 131, 134, 141, 144, 146, 146, 147, 140, 138, 133, 129, 126, 126, 123, 120, 122, 120, 121, 120, 120, 120, 125, 125, 124, 127, 127, 129, 129, 131, 129, 136, 144, 146, 141, 137, 139, 136, 130, 124, 124, 126, 127, 126, 125, 127, 126, 124, 122, 120, 122, 123, 121, 118, 120, 119, 118, 114, 112, 111, 112, 107, 100, 98, 103, 101, 99, 99, 100, 104, 107, 95, 93, 93, 89, 86, 88, 92, 99, 109, 110, 123, 164, 178, 177, 181, 190, 193, 191, 180, 156, 155, 157, 152, 137, 135, 139, 145, 151, 147, 142, 143, 147, 140, 132, 127, 127, 127, 122, 119, 119, 123, 125, 124, 121, 123, 125, 123, 122, 121, 122, 122, 123, 125, 127, 130, 135, 145, 143, 139, 139, 141, 135, 130, 129, 127, 128, 128, 126, 125, 127, 126, 125, 123, 122, 122, 121, 120, 120, 121, 119, 117, 114, 113, 112, 111, 107, 108, 110, 106, 106, 106, 105, 110, 107, 97, 98, 99, 93, 85, 90, 96, 95, 92, 93, 100, 111, 115, 132, 167, 180, 184, 181, 189, 176, 175, 175, 165, 157, 159, 162, 152, 148, 145, 144, 145, 147, 143, 142, 138, 134, 133, 132, 132, 131, 132, 130, 127, 125, 123, 121, 117, 117, 117, 118, 121, 123, 123, 125, 129, 131, 133, 134, 137, 137, 138, 137, 137, 135, 132, 131, 128, 128, 127, 126, 125, 125, 124, 124, 124, 123, 122, 122, 122, 121, 120, 120, 120, 118, 117, 116, 115, 114, 112, 111, 110, 109, 109, 109, 109, 109, 109, 104, 104, 103, 99, 101, 99, 100, 103, 108, 105, 102, 108, 115, 107, 94, 89, 139, 158, 161, 161, 190, 195, 190, 185, 172, 168, 172, 176, 154, 148, 149, 148, 143, 139, 138, 133, 141, 135, 134, 132, 135, 132, 133, 132, 128, 127, 126, 124, 118, 117, 116, 117, 115, 115, 117, 119, 123, 126, 129, 133, 136, 139, 139, 139, 140, 138, 134, 132, 130, 129, 128, 127, 126, 125, 126, 124, 123, 123, 123, 122, 122, 121, 121, 121, 120, 119, 119, 119, 117, 116, 115, 114, 112, 111, 112, 111, 111, 111, 112, 108, 108, 111, 110, 104, 101, 104, 103, 103, 105, 107, 107, 111, 115, 113, 113, 109, 108, 107, 137, 151, 152, 152, 175, 189, 183, 185, 177, 181, 179, 178, 164, 160, 159, 154, 148, 142, 134, 133, 134, 130, 128, 128, 130, 130, 131, 130, 129, 127, 126, 123, 120, 118, 118, 117, 117, 117, 118, 120, 122, 123, 126, 128, 131, 133, 135, 135, 135, 137, 136, 134, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 123, 122, 121, 121, 121, 120, 120, 119, 118, 117, 117, 116, 115, 114, 114, 113, 112, 114, 113, 112, 111, 113, 112, 110, 112, 115, 115, 114, 113, 114, 115, 114, 115, 116, 117, 118, 118, 118, 118, 116, 114, 120, 132, 130, 127, 140, 152, 153, 153, 164, 169, 171, 174, 174, 173, 174, 173, 168, 165, 161, 154, 151, 146, 140, 135, 134, 131, 127, 125, 123, 119, 119, 117, 116, 116, 116, 116, 116, 117, 118, 119, 119, 121, 125, 127, 128, 130, 134, 134, 134, 134, 134, 134, 134, 133, 132, 131, 130, 129, 127, 126, 125, 125, 124, 122, 121, 121, 120, 119, 118, 117, 116, 115, 114, 114, 113, 112, 111, 111, 110, 109, 110, 111, 111, 110, 113, 114, 115, 116, 115, 115, 119, 120, 117, 120, 122, 123, 123, 122, 120, 118, 119, 117, 113, 113, 128, 132, 128, 133, 152, 155, 154, 161, 169, 173, 176, 179, 173, 175, 175, 174, 168, 162, 158, 155, 151, 140, 135, 133, 132, 125, 124, 122, 118, 116, 115, 114, 111, 112, 112, 113, 113, 115, 116, 118, 122, 123, 124, 127, 130, 132, 132, 134, 136, 136, 135, 135, 134, 133, 132, 131, 129, 128, 126, 126, 124, 123, 122, 122, 121, 120, 119, 119, 118, 118, 117, 116, 115, 115, 114, 113, 113, 113, 112, 112, 113, 113, 111, 112, 116, 117, 114, 117, 120, 120, 120, 120, 119, 123, 126, 122, 121, 127, 125, 119, 120, 121, 117, 112, 115, 124, 127, 124, 133, 145, 150, 148, 156, 162, 169, 168, 172, 172, 173, 173, 170, 168, 163, 159, 154, 152, 144, 139, 135, 134, 130, 127, 124, 121, 120, 119, 116, 113, 115, 115, 114, 114, 115, 117, 120, 121, 122, 125, 127, 129, 129, 132, 133, 134, 135, 134, 133, 133, 133, 131, 130, 129, 128, 126, 125, 123, 122, 122, 121, 120, 120, 119, 118, 117, 117, 116, 116, 115, 115, 114, 113, 113, 113, 113, 114, 113, 113, 114, 116, 116, 117, 119, 121, 121, 121, 122, 124, 124, 121, 123, 127, 123, 120, 122, 126, 124, 120, 120, 121, 116, 118, 127, 128, 128, 141, 150, 151, 152, 161, 165, 172, 173, 173, 173, 175, 174, 171, 166, 162, 159, 155, 147, 140, 137, 135, 131, 128, 125, 122, 120, 119, 116, 114, 115, 115, 114, 115, 116, 117, 119, 121, 122, 123, 125, 127, 128, 129, 131, 132, 132, 132, 132, 132, 131, 129, 129, 128, 127, 125, 124, 124, 122, 122, 121, 120, 120, 119, 119, 118, 118, 117, 117, 116, 116, 115, 115, 115, 115, 115, 115, 115, 114, 116, 116, 116, 119, 119, 118, 121, 123, 122, 123, 123, 124, 125, 124, 124, 125, 125, 125, 125, 122, 121, 122, 119, 116, 122, 136, 133, 134, 144, 156, 153, 154, 159, 166, 171, 169, 169, 170, 170, 167, 165, 161, 154, 151, 149, 142, 135, 134, 132, 129, 127, 123, 120, 119, 118, 115, 114, 114, 114, 115, 115, 115, 117, 119, 120, 122, 124, 125, 126, 128, 130, 132, 132, 133, 133, 132, 132, 131, 130, 129, 127, 126, 126, 124, 123, 122, 121, 120, 119, 119, 118, 118, 118, 117, 117, 116, 116, 116, 115, 116, 116, 116, 116, 117, 118, 118, 118, 120, 122, 121, 121, 124, 127, 125, 124, 128, 131, 127, 126, 128, 128, 126, 125, 124, 123, 121, 121, 120, 118, 116, 116, 127, 132, 129, 133, 147, 151, 149, 153, 159, 165, 166, 166, 165, 166, 165, 162, 161, 156, 151, 148, 147, 140, 135, 134, 133, 130, 127, 124, 122, 122, 119, 117, 117, 117, 117, 118, 118, 118, 119, 121, 121, 122, 124, 125, 125, 126, 128, 129, 129, 130, 130, 130, 129, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 120, 119, 118, 118, 118, 117, 117, 117, 117, 116, 116, 117, 117, 117, 117, 119, 119, 119, 120, 122, 122, 122, 124, 126, 125, 125, 129, 130, 127, 127, 128, 128, 126, 125, 124, 123, 121, 120, 119, 118, 116, 119, 130, 132, 129, 137, 150, 151, 149, 155, 160, 165, 166, 166, 165, 166, 165, 162, 160, 156, 151, 148, 145, 140, 135, 134, 132, 129, 127, 124, 122, 121, 119, 117, 117, 117, 117, 118, 118, 118, 119, 121, 121, 122, 124, 125, 125, 127, 128, 129, 129, 130, 130, 130, 129, 129, 128, 127, 126, 125, 125, 123, 122, 121, 121, 120, 119, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 118, 118, 119, 119, 119, 121, 122, 122, 123, 125, 123, 124, 127, 127, 126, 127, 129, 128, 126, 125, 126, 127, 126, 124, 124, 125, 123, 122, 122, 123, 129, 134, 133, 136, 145, 148, 149, 152, 155, 159, 161, 161, 161, 162, 162, 159, 156, 153, 151, 146, 143, 139, 135, 133, 131, 128, 126, 124, 122, 121, 120, 118, 117, 117, 118, 117, 117, 118, 119, 119, 119, 120, 121, 122, 123, 124, 125, 126, 127, 127, 127, 128, 128, 127, 126, 126, 126, 125, 124, 123, 123, 123, 122, 122, 121, 121, 120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 120, 119, 120, 121, 121, 121, 122, 123, 122, 123, 126, 125, 125, 128, 129, 129, 129, 128, 128, 130, 128, 127, 128, 128, 127, 128, 127, 127, 129, 131, 133, 135, 137, 140, 143, 146, 146, 149, 151, 152, 152, 152, 151, 152, 151, 148, 147, 146, 143, 141, 139, 137, 135, 133, 132, 131, 129, 127, 125, 125, 124, 122, 121, 121, 121, 119, 119, 120, 120, 120, 120, 120, 121, 123, 123, 123, 124, 125, 126, 126, 126, 126, 127, 126, 126, 125, 125, 125, 125, 124, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 124, 125, 124, 125, 126, 126, 127, 127, 128, 129, 130, 131, 131, 131, 133, 133, 133, 133, 134, 135, 135, 135, 135, 136, 137, 139, 139, 140, 142, 143, 143, 144, 144, 145, 145, 144, 144, 143, 142, 141, 140, 138, 136, 135, 133, 131, 129, 128, 127, 126, 125, 124, 123, 123, 123, 122, 122, 121, 121, 121, 121, 120, 121, 121, 121, 120, 121, 121, 121, 121, 121, 122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, 125, 125, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 127, 127, 127, 128, 129, 129, 129, 130, 130, 130, 130, 130, 131, 131, 131, 132, 132, 132, 132, 132, 132, 133, 134, 135, 136, 136, 137, 138, 139, 139, 140, 141, 141, 141, 140, 140, 140, 139, 138, 137, 137, 136, 134, 133, 132, 131, 129, 129, 128, 127, 126, 125, 124, 124, 123, 122, 122, 121, 121, 120, 120, 120, 121, 121, 120, 120, 121, 121, 121, 121, 121, 122, 123, 122, 122, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, 125, 125, 124, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, }; const uint8_t eight[2968] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 138, 144, 138, 118, 104, 86, 70, 77, 89, 96, 116, 147, 168, 178, 194, 193, 180, 170, 153, 128, 105, 93, 86, 81, 84, 92, 102, 119, 139, 144, 151, 160, 162, 161, 157, 149, 140, 133, 123, 118, 114, 114, 114, 115, 121, 120, 121, 121, 121, 116, 115, 119, 119, 121, 128, 135, 136, 140, 138, 133, 118, 107, 99, 91, 77, 84, 84, 69, 81, 85, 74, 73, 111, 153, 137, 153, 204, 204, 181, 192, 212, 164, 152, 155, 137, 102, 103, 108, 103, 104, 125, 134, 140, 150, 160, 157, 153, 154, 148, 135, 126, 137, 124, 115, 130, 131, 124, 127, 136, 131, 132, 132, 131, 129, 126, 125, 125, 124, 123, 123, 125, 126, 126, 128, 128, 130, 127, 123, 122, 119, 107, 103, 104, 92, 81, 88, 74, 54, 55, 53, 49, 56, 66, 88, 103, 143, 198, 174, 190, 230, 207, 173, 184, 180, 127, 126, 126, 113, 92, 112, 118, 118, 129, 151, 160, 161, 167, 172, 165, 155, 146, 137, 124, 116, 110, 104, 104, 104, 109, 116, 116, 120, 133, 147, 146, 146, 154, 151, 143, 142, 142, 132, 127, 127, 118, 111, 108, 103, 100, 99, 98, 101, 106, 112, 115, 120, 120, 117, 120, 107, 101, 101, 67, 61, 56, 21, 3, 53, 178, 90, 109, 254, 243, 142, 237, 236, 167, 149, 189, 135, 94, 103, 108, 90, 76, 105, 126, 120, 128, 161, 166, 150, 168, 173, 147, 143, 143, 126, 111, 118, 111, 108, 117, 121, 124, 128, 132, 137, 135, 133, 136, 134, 131, 131, 134, 130, 129, 133, 134, 130, 130, 132, 124, 111, 115, 106, 87, 91, 95, 84, 84, 97, 104, 98, 96, 97, 93, 85, 84, 103, 143, 121, 132, 184, 179, 160, 188, 199, 159, 162, 169, 140, 117, 117, 113, 102, 99, 117, 124, 123, 138, 156, 155, 149, 160, 157, 145, 141, 140, 123, 116, 119, 113, 111, 120, 121, 124, 130, 133, 136, 134, 135, 136, 134, 134, 136, 133, 133, 135, 132, 128, 130, 118, 111, 113, 98, 86, 91, 94, 85, 87, 97, 104, 98, 94, 97, 93, 85, 81, 103, 143, 121, 148, 183, 179, 160, 200, 198, 159, 162, 162, 130, 119, 118, 111, 102, 103, 117, 123, 127, 138, 153, 149, 151, 156, 152, 143, 140, 138, 128, 120, 119, 115, 113, 120, 120, 125, 131, 133, 136, 137, 137, 138, 137, 137, 137, 137, 135, 132, 128, 127, 117, 111, 106, 96, 92, 89, 90, 88, 92, 98, 101, 99, 91, 85, 81, 91, 75, 107, 141, 120, 140, 181, 187, 170, 197, 195, 180, 168, 168, 142, 124, 116, 107, 95, 92, 99, 110, 118, 125, 147, 154, 155, 162, 162, 153, 145, 139, 132, 120, 113, 113, 115, 113, 118, 126, 126, 128, 134, 136, 134, 136, 140, 138, 136, 138, 137, 131, 128, 125, 116, 106, 100, 93, 84, 77, 79, 76, 73, 78, 74, 67, 76, 93, 93, 106, 148, 140, 157, 181, 184, 172, 196, 196, 170, 170, 167, 151, 130, 125, 116, 103, 102, 106, 109, 114, 124, 139, 147, 150, 155, 159, 152, 148, 144, 134, 125, 122, 119, 115, 118, 118, 120, 125, 128, 131, 134, 135, 138, 140, 139, 139, 139, 133, 130, 125, 116, 106, 99, 92, 83, 77, 77, 75, 72, 78, 76, 67, 76, 93, 94, 106, 148, 140, 148, 181, 184, 172, 187, 196, 169, 170, 166, 149, 129, 125, 117, 104, 105, 109, 109, 115, 125, 139, 144, 147, 154, 157, 149, 147, 144, 133, 126, 128, 127, 116, 123, 125, 120, 122, 128, 127, 128, 133, 132, 134, 137, 137, 136, 135, 133, 126, 117, 109, 103, 88, 80, 75, 66, 60, 61, 57, 47, 63, 82, 88, 107, 143, 158, 177, 187, 197, 202, 195, 192, 184, 168, 149, 145, 128, 111, 110, 106, 100, 104, 110, 115, 123, 136, 144, 148, 153, 157, 152, 149, 146, 137, 130, 130, 127, 118, 123, 122, 119, 121, 125, 126, 128, 130, 135, 137, 137, 137, 136, 133, 127, 119, 110, 98, 88, 80, 74, 61, 59, 61, 57, 47, 63, 82, 88, 123, 147, 158, 178, 195, 198, 202, 195, 188, 182, 168, 145, 135, 114, 109, 106, 101, 101, 109, 116, 121, 130, 142, 146, 150, 156, 155, 152, 149, 142, 136, 133, 131, 120, 123, 121, 117, 118, 120, 121, 122, 125, 130, 133, 134, 136, 136, 135, 131, 125, 119, 107, 90, 90, 77, 63, 58, 53, 45, 39, 57, 63, 76, 102, 153, 151, 157, 208, 201, 190, 205, 217, 177, 173, 177, 150, 123, 124, 118, 94, 98, 105, 104, 107, 125, 133, 136, 147, 158, 158, 154, 156, 152, 141, 143, 139, 127, 127, 126, 120, 120, 121, 119, 121, 123, 122, 125, 127, 127, 130, 131, 129, 128, 124, 118, 110, 97, 91, 85, 59, 56, 52, 36, 39, 66, 63, 67, 129, 147, 139, 176, 217, 195, 203, 236, 213, 181, 195, 171, 142, 132, 128, 100, 92, 98, 100, 95, 105, 123, 128, 134, 145, 155, 151, 156, 157, 151, 152, 144, 138, 136, 130, 123, 123, 125, 118, 119, 122, 120, 115, 121, 120, 116, 120, 123, 117, 117, 122, 115, 105, 104, 99, 84, 70, 65, 56, 32, 48, 52, 52, 60, 129, 157, 134, 176, 218, 203, 191, 229, 211, 180, 188, 181, 139, 130, 128, 110, 97, 99, 109, 104, 112, 129, 131, 130, 141, 144, 141, 145, 145, 141, 144, 144, 139, 141, 141, 134, 137, 133, 129, 131, 123, 119, 120, 113, 107, 107, 103, 100, 99, 96, 100, 101, 96, 100, 101, 88, 86, 81, 74, 66, 58, 39, 96, 144, 79, 146, 211, 172, 183, 243, 217, 182, 230, 215, 162, 171, 174, 125, 122, 128, 103, 100, 107, 112, 107, 119, 124, 124, 132, 133, 134, 135, 138, 134, 138, 140, 139, 141, 144, 144, 140, 142, 138, 134, 135, 126, 120, 120, 112, 106, 106, 99, 99, 97, 95, 100, 100, 95, 99, 98, 89, 87, 81, 69, 66, 58, 39, 96, 144, 79, 146, 211, 173, 183, 244, 218, 183, 231, 218, 163, 179, 177, 125, 122, 123, 101, 96, 105, 105, 100, 117, 119, 127, 135, 133, 139, 141, 139, 137, 141, 137, 134, 138, 139, 138, 138, 139, 139, 133, 134, 133, 126, 124, 125, 121, 114, 113, 112, 106, 104, 105, 101, 95, 95, 99, 90, 89, 90, 88, 85, 80, 81, 73, 69, 61, 85, 128, 107, 126, 196, 178, 164, 216, 215, 184, 215, 222, 178, 182, 182, 149, 135, 139, 118, 109, 111, 109, 106, 111, 117, 114, 123, 125, 128, 129, 132, 135, 133, 137, 137, 134, 138, 139, 141, 141, 139, 142, 139, 135, 136, 128, 126, 125, 121, 115, 113, 111, 107, 103, 102, 102, 95, 95, 101, 92, 89, 91, 87, 88, 80, 80, 81, 70, 68, 62, 85, 132, 94, 153, 196, 164, 181, 225, 197, 184, 228, 201, 179, 187, 173, 139, 138, 137, 108, 114, 109, 106, 109, 113, 116, 116, 125, 126, 128, 129, 133, 132, 132, 135, 134, 133, 132, 134, 134, 139, 136, 136, 144, 135, 137, 134, 133, 126, 123, 121, 114, 113, 109, 107, 103, 106, 105, 107, 108, 107, 107, 102, 105, 98, 93, 97, 91, 84, 82, 83, 72, 73, 74, 94, 119, 109, 139, 172, 164, 166, 195, 198, 184, 199, 197, 180, 178, 173, 153, 138, 134, 123, 116, 118, 110, 113, 118, 118, 121, 125, 128, 129, 135, 136, 134, 135, 135, 136, 132, 132, 134, 136, 137, 133, 144, 141, 133, 145, 139, 133, 136, 140, 126, 122, 128, 113, 106, 111, 102, 96, 104, 95, 97, 98, 98, 98, 96, 100, 97, 97, 96, 94, 83, 86, 81, 68, 77, 100, 103, 99, 144, 143, 140, 171, 184, 178, 185, 208, 188, 190, 195, 173, 162, 161, 149, 131, 131, 120, 114, 115, 113, 112, 115, 118, 119, 124, 126, 129, 130, 132, 131, 130, 133, 129, 130, 130, 136, 133, 136, 142, 137, 139, 144, 141, 134, 144, 134, 125, 129, 122, 109, 108, 110, 96, 99, 103, 93, 99, 97, 97, 97, 96, 100, 96, 97, 97, 91, 84, 86, 76, 71, 87, 100, 98, 111, 152, 143, 147, 182, 181, 179, 198, 205, 187, 193, 194, 168, 165, 164, 141, 131, 130, 119, 112, 112, 108, 110, 111, 115, 118, 123, 123, 128, 131, 131, 132, 133, 130, 127, 131, 126, 127, 131, 133, 129, 134, 140, 136, 142, 146, 142, 143, 145, 136, 131, 130, 121, 111, 111, 105, 95, 99, 93, 89, 94, 93, 91, 95, 95, 94, 93, 97, 94, 90, 89, 88, 82, 105, 108, 96, 127, 142, 137, 150, 181, 169, 176, 201, 189, 192, 197, 188, 171, 176, 164, 143, 143, 129, 121, 114, 114, 104, 102, 110, 107, 108, 113, 119, 119, 126, 129, 128, 131, 133, 134, 132, 135, 135, 134, 137, 139, 137, 141, 144, 141, 142, 144, 144, 143, 140, 139, 136, 130, 126, 118, 115, 107, 103, 98, 94, 91, 89, 87, 88, 89, 88, 91, 93, 92, 90, 95, 93, 88, 86, 86, 105, 100, 105, 140, 127, 135, 165, 170, 166, 187, 198, 185, 201, 201, 186, 182, 179, 165, 153, 149, 133, 125, 121, 114, 102, 103, 102, 99, 102, 105, 107, 110, 117, 117, 121, 126, 127, 128, 132, 133, 134, 135, 136, 138, 139, 141, 143, 142, 143, 146, 144, 144, 145, 143, 143, 140, 137, 133, 129, 124, 116, 111, 105, 101, 97, 92, 90, 88, 87, 89, 88, 88, 91, 92, 92, 90, 95, 90, 88, 86, 86, 111, 94, 105, 140, 126, 145, 165, 169, 164, 194, 195, 181, 197, 192, 182, 178, 176, 156, 151, 149, 134, 126, 124, 119, 107, 110, 108, 104, 107, 110, 110, 110, 118, 116, 118, 124, 125, 125, 128, 130, 129, 133, 132, 132, 134, 134, 134, 134, 135, 133, 135, 134, 133, 133, 133, 133, 132, 133, 132, 131, 130, 129, 127, 126, 125, 122, 118, 117, 113, 110, 106, 103, 103, 98, 95, 96, 92, 92, 94, 93, 92, 95, 93, 95, 96, 87, 89, 112, 105, 101, 137, 124, 127, 154, 159, 157, 170, 183, 171, 188, 189, 180, 175, 176, 168, 155, 156, 141, 135, 131, 126, 117, 114, 115, 109, 111, 112, 113, 112, 116, 118, 116, 121, 121, 123, 125, 127, 128, 129, 132, 131, 131, 134, 134, 133, 135, 133, 132, 134, 132, 131, 131, 131, 130, 131, 130, 130, 130, 129, 128, 130, 128, 127, 128, 126, 125, 124, 121, 119, 116, 112, 108, 108, 104, 101, 101, 102, 98, 100, 100, 99, 103, 103, 105, 105, 107, 104, 105, 112, 105, 107, 122, 120, 123, 135, 143, 135, 152, 160, 155, 165, 170, 171, 168, 172, 165, 159, 160, 152, 145, 139, 134, 127, 125, 122, 116, 116, 115, 115, 112, 116, 117, 118, 120, 120, 121, 124, 125, 126, 128, 129, 130, 131, 133, 132, 133, 135, 132, 133, 134, 132, 131, 131, 131, 129, 130, 129, 129, 129, 129, 128, 128, 129, 128, 127, 128, 127, 126, 125, 124, 120, 118, 115, 109, 109, 105, 103, 102, 101, 100, 98, 102, 100, 101, 105, 101, 106, 107, 106, 103, 109, 108, 106, 118, 124, 119, 129, 145, 137, 147, 158, 156, 158, 169, 171, 166, 172, 168, 161, 161, 158, 148, 143, 139, 131, 129, 125, 121, 117, 117, 116, 112, 114, 115, 114, 116, 119, 119, 120, 122, 124, 124, 126, 127, 129, 130, 131, 131, 133, 135, 132, 134, 134, 133, 133, 132, 131, 131, 131, 130, 130, 129, 128, 129, 127, 127, 127, 126, 126, 124, 125, 122, 120, 118, 116, 113, 111, 109, 106, 104, 103, 102, 100, 100, 104, 100, 102, 107, 104, 106, 111, 112, 112, 125, 126, 125, 137, 139, 143, 148, 152, 156, 158, 161, 162, 161, 161, 160, 155, 152, 150, 145, 140, 139, 131, 129, 129, 124, 122, 123, 120, 121, 121, 121, 122, 125, 126, 125, 129, 131, 133, 134, 136, 137, 138, 137, 136, 137, 135, 132, 130, 127, 123, 120, 117, 116, 112, 110, 110, 109, 107, 108, 108, 108, 112, 111, 112, 117, 117, 117, 120, 122, 121, 126, 129, 129, 134, 137, 140, 143, 150, 153, 157, 161, 164, 166, 165, 169, 162, 161, 158, 153, 145, 139, 132, 122, 120, 111, 103, 101, 99, 96, 91, 96, 95, 96, 102, 104, 107, 112, 120, 121, 127, 132, 136, 138, 142, 144, 143, 145, 145, 144, 142, 142, 139, 136, 135, 132, 129, 124, 122, 119, 116, 114, 112, 111, 109, 111, 109, 110, 112, 113, 116, 118, 121, 123, 127, 130, 132, 135, 137, 139, 139, 140, 139, 139, 138, 137, 135, 133, 132, 130, 127, 125, 124, 122, 120, 120, 118, 117, 118, 118, 118, 119, 120, 120, 122, 123, 124, 125, 127, 128, 129, 131, 131, 131, 132, 132, 132, 131, 131, 131, 130, 130, 129, 128, 128, 128, 128, 127, 127, 127, 126, 126, 126, 126, 126, 126, 125, 124, 125, 124, 123, 124, 124, 124, 124, 126, 125, 126, 127, 127, 127, 129, 129, 129, 131, 130, 130, 132, 131, 131, 132, 131, 130, 131, 129, 128, 127, 126, 125, 125, 122, 122, 123, 121, 122, 123, 124, 124, 126, 127, 127, 127, 129, 129, 129, 129, 129, 129, 128, 128, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 131, 132, 132, 132, 131, 131, 131, 130, 130, 129, 128, 127, 126, 125, 124, 123, 122, 122, 121, 121, 121, 120, 120, 121, 121, 121, 122, 122, 122, 124, 124, 125, 126, 127, 128, 129, 130, 131, 133, 133, 133, 134, 134, 133, 133, 132, 132, 131, 131, 129, 128, 128, 127, 126, 125, 125, 124, 123, 123, 123, 122, 122, 121, 122, 122, 122, 122, 124, 127, 129, 130, 130, 129, 128, 127, 126, 125, 124, 123, 123, 122, 122, 121, 121, 120, 120, 120, 121, 121, 121, 122, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 133, 134, 134, 133, 133, 132, 132, 131, 130, 129, 128, 127, 127, 125, 125, 124, 124, 123, 123, 123, 122, 122, 121, 122, 122, 122, 122, 122, 123, 124, 124, 125, 127, 127, 128, 129, 129, 130, 131, 131, 131, 131, 131, 131, 131, 131, 130, 130, 130, 129, 129, 128, 128, 127, 126, 126, 125, 125, 124, 124, 124, 123, 123, 123, 123, 123, 123, 124, 124, 124, 125, 125, 126, 127, 127, 128, 129, 129, 130, 130, 130, 130, 130, 130, 131, 130, 130, 130, 129, 129, 129, 128, 128, 128, 127, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 127, 126, 127, 128, 128, 125, 128, 129, 129, 127, 128, 127, 127, 127, 128, 127, 127, 127, 126, 126, 126, 126, 125, 125, 124, 125, 125, 125, 125, 126, 126, 126, 126, 127, 127, 127, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 127, 127, 127, 128, 127, 125, 128, 129, 128, 127, 128, 127, 127, 127, 127, 126, 127, 127, 128, 127, 127, 128, 127, 127, 127, 127, 126, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 126, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 126, 126, 126, 126, 125, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 126, 126, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 126, 126, 126, 125, 125, 125, 125, 125, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 126, 127, 126, 126, 127, 127, 127, 127, 127, 127, 127, 126, 126, 125, 125, 124, 125, 125, 125, 125, 125, 126, 126, 128, 128, 128, 128, 129, 129, 132, 134, 134, 134, 169, 152, 153, 126, 148, 127, 107, 116, 129, 112, 96, 97, 117, 116, 97, 100, 126, 127, 116, 117, 144, 139, 133, 118, 146, 139, 135, 113, 149, 158, 128, 129, 148, 142, 119, 117, 131, 135, 109, 109, 129, 126, 107, 109, 133, 119, 113, 120, 136, 126, 124, 127, 140, 132, 125, 129, 129, 129, 129, 129, 132, 134, 134, 134, 169, 149, 138, 126, 148, 127, 108, 116, 129, 112, 93, 97, 117, 116, 94, 100, 126, 127, 116, 117, 144, 139, 132, 119, 146, 139, 128, 116, 149, 158, 123, 137, 148, 142, 114, 125, 131, 135, 101, 116, 129, 126, 101, 116, 133, 119, 113, 124, 136, 126, 124, 133, 141, 134, 121, 137, 141, 124, 118, 134, 125, 114, 120, 127, 124, 118, 125, 133, 129, 125, 131, 140, 129, 125, 136, 135, 126, 126, 133, 128, 124, 123, 127, 126, 120, 121, 126, 126, 120, 125, 129, 126, 127, 130, 131, 131, 131, 129, 135, 130, 130, 133, 130, 126, 129, 124, 125, 121, 125, 123, 123, }; const uint8_t nine[4452] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 122, 117, 107, 100, 111, 119, 121, 128, 141, 146, 152, 163, 168, 170, 174, 177, 178, 177, 176, 172, 168, 165, 159, 152, 148, 145, 138, 132, 127, 124, 119, 115, 112, 110, 108, 110, 113, 115, 117, 121, 125, 128, 130, 132, 136, 138, 140, 142, 145, 147, 149, 151, 152, 154, 154, 154, 154, 153, 150, 146, 142, 135, 130, 122, 113, 102, 95, 84, 74, 67, 62, 56, 51, 46, 42, 39, 37, 33, 34, 41, 52, 60, 73, 82, 98, 116, 131, 139, 154, 171, 182, 188, 199, 208, 211, 213, 213, 207, 199, 193, 183, 170, 158, 151, 140, 130, 121, 115, 108, 103, 98, 96, 95, 94, 94, 95, 98, 100, 104, 109, 113, 121, 130, 135, 140, 154, 161, 162, 166, 174, 175, 175, 174, 171, 167, 166, 161, 151, 145, 138, 131, 123, 115, 105, 100, 95, 86, 78, 77, 74, 67, 65, 64, 57, 51, 50, 47, 40, 43, 51, 57, 66, 81, 90, 105, 120, 134, 142, 160, 172, 183, 192, 203, 206, 208, 211, 208, 202, 194, 184, 172, 165, 155, 144, 133, 128, 120, 112, 106, 103, 101, 98, 98, 99, 100, 103, 108, 112, 118, 127, 136, 144, 150, 161, 169, 175, 179, 184, 186, 185, 185, 182, 178, 171, 165, 158, 149, 138, 131, 121, 112, 101, 93, 82, 72, 65, 61, 55, 50, 46, 43, 40, 38, 38, 38, 41, 51, 65, 73, 80, 95, 116, 131, 137, 153, 170, 183, 190, 199, 204, 209, 212, 211, 204, 196, 191, 180, 170, 159, 151, 140, 131, 122, 117, 111, 105, 101, 99, 98, 97, 99, 100, 104, 109, 116, 121, 129, 137, 147, 156, 161, 169, 175, 178, 179, 182, 182, 180, 178, 173, 166, 158, 152, 141, 130, 118, 111, 98, 86, 75, 68, 58, 51, 46, 41, 37, 36, 35, 35, 33, 35, 51, 64, 75, 78, 101, 120, 135, 142, 162, 180, 186, 196, 205, 206, 206, 208, 204, 195, 189, 172, 165, 157, 145, 135, 130, 123, 115, 109, 105, 101, 99, 98, 98, 99, 103, 109, 112, 119, 127, 136, 142, 149, 156, 164, 168, 173, 175, 178, 179, 179, 176, 172, 168, 161, 151, 141, 134, 123, 111, 98, 87, 79, 69, 58, 52, 48, 42, 37, 36, 36, 35, 33, 36, 44, 64, 75, 79, 92, 120, 135, 142, 154, 175, 185, 194, 201, 204, 204, 206, 204, 197, 188, 178, 170, 162, 153, 142, 136, 129, 122, 115, 110, 106, 103, 102, 101, 101, 102, 106, 111, 113, 118, 127, 134, 138, 145, 153, 160, 164, 168, 171, 173, 173, 171, 168, 164, 160, 152, 144, 133, 127, 115, 104, 94, 87, 77, 69, 62, 57, 49, 44, 40, 37, 39, 54, 57, 65, 75, 98, 104, 117, 128, 143, 153, 165, 169, 175, 182, 186, 187, 185, 183, 179, 176, 167, 158, 153, 148, 141, 133, 130, 126, 123, 120, 119, 117, 118, 118, 117, 118, 119, 120, 121, 122, 124, 127, 129, 132, 135, 138, 141, 145, 147, 149, 152, 153, 153, 151, 150, 147, 143, 136, 128, 119, 112, 101, 91, 79, 72, 63, 52, 43, 40, 37, 37, 47, 53, 57, 67, 88, 97, 105, 120, 140, 153, 163, 172, 182, 192, 197, 199, 200, 200, 197, 193, 185, 176, 170, 165, 155, 145, 140, 133, 126, 119, 115, 108, 106, 103, 102, 100, 103, 107, 108, 113, 121, 128, 132, 142, 150, 155, 162, 167, 171, 171, 172, 171, 169, 163, 156, 150, 140, 129, 118, 110, 96, 84, 73, 65, 54, 46, 39, 36, 34, 36, 48, 50, 55, 69, 87, 92, 105, 121, 136, 144, 159, 170, 179, 186, 192, 197, 197, 194, 191, 188, 180, 170, 166, 159, 151, 141, 136, 127, 122, 115, 110, 103, 101, 98, 98, 99, 101, 104, 108, 115, 123, 129, 133, 142, 154, 158, 160, 166, 171, 170, 169, 167, 163, 158, 150, 141, 129, 118, 107, 97, 82, 70, 61, 53, 43, 38, 36, 36, 45, 53, 57, 64, 84, 96, 107, 116, 131, 144, 159, 163, 169, 178, 185, 186, 186, 183, 180, 179, 173, 164, 157, 150, 145, 138, 131, 124, 122, 118, 116, 114, 114, 114, 115, 117, 120, 126, 130, 136, 145, 148, 150, 155, 154, 154, 154, 146, 138, 134, 127, 113, 105, 92, 85, 75, 54, 39, 35, 25, 26, 38, 40, 88, 127, 117, 138, 178, 174, 175, 173, 150, 155, 158, 135, 121, 131, 139, 146, 154, 145, 150, 166, 158, 141, 139, 135, 130, 130, 114, 110, 121, 126, 122, 124, 128, 131, 139, 135, 136, 139, 148, 156, 160, 162, 167, 171, 171, 165, 156, 150, 140, 126, 116, 107, 102, 98, 96, 91, 84, 73, 59, 43, 26, 19, 31, 54, 119, 171, 145, 157, 202, 195, 157, 132, 104, 109, 131, 98, 99, 126, 158, 169, 169, 163, 167, 171, 149, 130, 119, 123, 125, 122, 114, 125, 147, 148, 139, 134, 143, 134, 128, 119, 133, 137, 138, 145, 161, 171, 175, 168, 157, 153, 146, 128, 120, 111, 112, 114, 106, 102, 105, 101, 85, 66, 55, 46, 22, 17, 30, 63, 156, 207, 156, 167, 195, 168, 120, 102, 76, 101, 125, 115, 119, 151, 182, 187, 172, 153, 146, 146, 137, 109, 108, 118, 133, 130, 133, 136, 147, 145, 132, 125, 125, 124, 117, 117, 134, 140, 146, 157, 172, 172, 171, 163, 150, 143, 131, 127, 120, 118, 119, 116, 111, 106, 103, 91, 77, 55, 51, 26, 12, 23, 66, 164, 234, 172, 164, 166, 169, 110, 91, 55, 77, 131, 152, 144, 157, 174, 187, 176, 159, 122, 128, 133, 127, 115, 120, 132, 144, 147, 138, 138, 139, 138, 128, 120, 115, 117, 126, 139, 144, 146, 155, 167, 166, 161, 148, 143, 138, 135, 133, 130, 127, 127, 123, 118, 107, 102, 89, 69, 48, 38, 29, 23, 29, 38, 149, 254, 198, 150, 128, 133, 120, 105, 62, 79, 145, 170, 168, 158, 147, 155, 164, 149, 114, 115, 125, 138, 143, 133, 129, 136, 148, 144, 139, 127, 122, 125, 127, 119, 114, 129, 145, 155, 154, 157, 160, 160, 152, 137, 131, 133, 138, 135, 125, 122, 121, 115, 105, 100, 91, 79, 62, 54, 43, 29, 34, 44, 109, 253, 210, 184, 113, 114, 98, 114, 96, 90, 124, 161, 175, 169, 149, 143, 138, 156, 136, 123, 118, 127, 139, 148, 140, 125, 130, 141, 144, 129, 121, 116, 119, 120, 125, 137, 145, 153, 159, 159, 154, 150, 141, 133, 133, 135, 136, 135, 128, 123, 123, 111, 101, 92, 86, 72, 62, 40, 28, 40, 55, 115, 216, 225, 188, 125, 103, 69, 118, 115, 109, 116, 146, 167, 184, 174, 144, 120, 141, 142, 138, 128, 125, 125, 138, 141, 135, 133, 134, 132, 133, 130, 124, 120, 120, 124, 135, 146, 153, 158, 161, 159, 151, 140, 130, 129, 140, 145, 135, 123, 123, 121, 116, 111, 100, 89, 78, 62, 45, 34, 26, 33, 111, 252, 245, 208, 130, 88, 63, 97, 106, 124, 128, 138, 156, 177, 168, 150, 119, 129, 126, 137, 139, 131, 123, 129, 135, 136, 136, 136, 132, 132, 130, 128, 122, 120, 127, 136, 146, 154, 157, 155, 151, 151, 138, 130, 127, 134, 142, 140, 130, 123, 119, 118, 110, 105, 89, 78, 60, 44, 31, 28, 41, 118, 240, 245, 217, 129, 71, 49, 79, 118, 144, 139, 138, 141, 166, 165, 150, 123, 123, 127, 138, 140, 137, 128, 124, 129, 138, 141, 142, 139, 128, 119, 122, 124, 128, 139, 143, 145, 149, 157, 159, 155, 145, 134, 127, 127, 134, 142, 140, 138, 123, 116, 108, 104, 94, 85, 69, 52, 36, 26, 39, 58, 189, 242, 225, 178, 99, 50, 84, 105, 125, 142, 138, 134, 151, 155, 150, 144, 137, 130, 139, 149, 152, 140, 124, 126, 133, 138, 144, 141, 135, 126, 117, 119, 124, 131, 139, 144, 142, 149, 162, 159, 155, 140, 135, 136, 137, 142, 144, 134, 122, 113, 105, 102, 103, 89, 73, 50, 40, 28, 29, 67, 157, 241, 235, 172, 114, 58, 69, 109, 131, 144, 142, 132, 154, 159, 158, 142, 135, 129, 135, 149, 152, 144, 129, 125, 132, 134, 141, 142, 135, 128, 118, 116, 124, 129, 135, 142, 142, 145, 159, 160, 155, 145, 134, 135, 138, 142, 145, 140, 121, 113, 109, 100, 105, 89, 78, 58, 40, 28, 26, 37, 166, 239, 235, 194, 109, 52, 54, 99, 128, 143, 145, 128, 146, 159, 159, 147, 135, 126, 127, 147, 153, 144, 134, 122, 126, 134, 142, 142, 140, 131, 122, 120, 124, 127, 132, 140, 143, 147, 160, 160, 154, 144, 133, 136, 139, 142, 144, 139, 120, 114, 109, 100, 105, 95, 78, 58, 40, 29, 26, 37, 166, 231, 235, 195, 110, 72, 54, 100, 128, 144, 146, 127, 146, 161, 161, 148, 136, 125, 124, 148, 156, 144, 135, 121, 123, 133, 142, 139, 140, 134, 124, 125, 127, 126, 123, 138, 139, 146, 156, 160, 160, 149, 140, 134, 137, 143, 144, 140, 125, 108, 105, 105, 104, 101, 90, 60, 41, 24, 29, 35, 83, 214, 223, 228, 163, 89, 44, 74, 109, 136, 151, 144, 124, 150, 153, 158, 146, 138, 115, 133, 150, 142, 141, 132, 115, 123, 140, 138, 139, 135, 126, 126, 127, 126, 134, 135, 143, 142, 144, 155, 167, 166, 156, 135, 130, 132, 144, 142, 136, 125, 114, 115, 108, 96, 83, 63, 50, 37, 29, 30, 40, 161, 229, 228, 200, 121, 65, 74, 93, 113, 142, 142, 128, 139, 151, 157, 148, 142, 125, 130, 140, 138, 136, 133, 127, 130, 132, 135, 134, 138, 131, 127, 123, 123, 126, 132, 136, 135, 134, 135, 144, 149, 146, 138, 133, 131, 128, 135, 134, 134, 122, 117, 113, 113, 105, 86, 60, 36, 27, 30, 29, 91, 181, 232, 238, 168, 107, 52, 83, 106, 119, 151, 136, 127, 141, 144, 154, 145, 143, 126, 128, 134, 142, 143, 131, 118, 123, 129, 138, 141, 139, 132, 128, 124, 124, 127, 131, 134, 135, 135, 137, 141, 142, 142, 140, 134, 130, 133, 136, 134, 127, 119, 119, 112, 111, 105, 91, 73, 47, 32, 33, 26, 47, 131, 222, 232, 193, 137, 72, 69, 92, 108, 146, 148, 131, 134, 148, 159, 153, 141, 123, 124, 131, 133, 132, 132, 127, 131, 133, 135, 138, 134, 131, 124, 122, 124, 131, 136, 136, 133, 132, 132, 136, 143, 145, 146, 139, 132, 126, 128, 135, 139, 134, 124, 113, 105, 110, 104, 97, 77, 41, 31, 30, 16, 46, 139, 230, 241, 188, 129, 69, 70, 99, 110, 146, 140, 129, 136, 151, 155, 154, 144, 130, 128, 134, 137, 139, 128, 118, 121, 131, 134, 139, 143, 139, 132, 120, 119, 123, 130, 134, 136, 135, 136, 137, 137, 138, 139, 138, 138, 134, 134, 134, 133, 125, 125, 119, 113, 117, 114, 111, 90, 61, 37, 27, 18, 22, 93, 191, 231, 228, 162, 104, 55, 81, 106, 133, 149, 132, 127, 138, 138, 158, 149, 150, 128, 128, 132, 138, 139, 128, 121, 121, 129, 138, 146, 139, 133, 124, 122, 126, 128, 129, 128, 130, 134, 136, 140, 139, 140, 138, 135, 133, 132, 129, 135, 140, 137, 126, 119, 112, 115, 119, 111, 103, 94, 72, 47, 38, 24, 20, 54, 192, 226, 247, 183, 110, 63, 72, 94, 134, 145, 143, 123, 131, 140, 159, 162, 156, 130, 127, 126, 125, 127, 127, 125, 127, 131, 141, 143, 139, 133, 126, 120, 121, 124, 126, 129, 130, 134, 139, 141, 139, 140, 139, 136, 136, 133, 126, 126, 127, 132, 135, 134, 129, 121, 121, 119, 111, 97, 86, 81, 61, 47, 37, 26, 25, 149, 236, 238, 212, 115, 58, 58, 90, 118, 152, 137, 122, 138, 144, 162, 163, 149, 129, 128, 127, 131, 134, 122, 122, 129, 134, 138, 140, 139, 130, 125, 125, 125, 123, 123, 123, 129, 136, 136, 136, 137, 136, 136, 135, 137, 134, 135, 133, 133, 130, 134, 131, 133, 127, 123, 122, 122, 119, 110, 107, 97, 72, 45, 23, 17, 27, 78, 214, 233, 241, 179, 107, 60, 74, 95, 130, 142, 140, 127, 148, 154, 166, 153, 141, 130, 125, 126, 132, 134, 133, 127, 128, 133, 139, 142, 135, 127, 122, 120, 124, 125, 124, 123, 128, 133, 137, 140, 137, 134, 133, 134, 136, 136, 134, 132, 132, 132, 133, 131, 131, 135, 135, 133, 130, 114, 106, 102, 108, 102, 96, 71, 39, 24, 18, 25, 94, 219, 230, 235, 160, 87, 51, 72, 100, 142, 153, 142, 124, 146, 154, 158, 152, 147, 132, 130, 125, 133, 136, 134, 128, 127, 129, 132, 143, 139, 127, 122, 120, 122, 126, 127, 129, 135, 139, 137, 136, 132, 129, 132, 134, 137, 136, 130, 129, 131, 135, 139, 136, 130, 126, 129, 129, 125, 129, 122, 119, 117, 107, 96, 83, 55, 28, 27, 32, 45, 120, 232, 226, 207, 130, 74, 51, 87, 114, 147, 143, 139, 141, 159, 159, 147, 138, 133, 141, 146, 140, 133, 123, 117, 119, 125, 137, 150, 149, 138, 120, 112, 114, 120, 127, 129, 127, 133, 138, 142, 141, 136, 128, 126, 130, 133, 138, 137, 131, 127, 128, 129, 134, 137, 133, 132, 134, 132, 123, 118, 115, 122, 124, 114, 105, 89, 72, 31, 12, 19, 24, 69, 217, 243, 234, 160, 81, 41, 67, 109, 137, 148, 144, 128, 156, 160, 167, 145, 132, 117, 127, 144, 145, 131, 123, 118, 127, 140, 140, 137, 136, 130, 127, 123, 120, 116, 123, 125, 126, 129, 135, 140, 140, 137, 132, 129, 127, 130, 135, 136, 136, 134, 129, 126, 127, 133, 138, 138, 135, 130, 123, 124, 125, 127, 130, 123, 106, 100, 97, 85, 73, 59, 59, 45, 35, 29, 148, 239, 241, 206, 113, 47, 44, 94, 128, 156, 157, 148, 147, 159, 165, 150, 136, 126, 128, 136, 134, 126, 123, 124, 130, 140, 146, 141, 135, 127, 122, 121, 126, 125, 124, 122, 124, 132, 136, 137, 135, 133, 130, 130, 130, 132, 133, 132, 131, 130, 129, 129, 129, 130, 131, 135, 134, 134, 129, 128, 127, 129, 126, 124, 121, 119, 116, 114, 115, 112, 94, 67, 58, 45, 44, 41, 46, 131, 234, 221, 181, 105, 76, 82, 117, 128, 149, 148, 140, 138, 156, 152, 140, 140, 149, 136, 137, 130, 121, 120, 125, 131, 136, 142, 136, 126, 120, 124, 127, 133, 130, 123, 120, 120, 123, 129, 133, 137, 140, 136, 131, 129, 127, 128, 131, 132, 131, 131, 131, 131, 131, 129, 128, 127, 131, 134, 133, 132, 130, 128, 131, 134, 135, 130, 124, 115, 98, 95, 102, 106, 104, 83, 59, 47, 34, 27, 64, 208, 237, 213, 143, 109, 86, 109, 115, 118, 131, 147, 147, 164, 165, 162, 138, 138, 139, 139, 133, 124, 116, 115, 129, 134, 130, 127, 129, 135, 138, 137, 129, 124, 121, 121, 124, 127, 129, 129, 131, 130, 130, 129, 129, 129, 132, 134, 135, 133, 132, 131, 130, 128, 127, 127, 130, 134, 135, 134, 133, 131, 129, 127, 125, 125, 130, 135, 137, 131, 122, 111, 101, 103, 114, 124, 120, 96, 68, 50, 41, 46, 53, 68, 152, 237, 201, 124, 93, 83, 106, 122, 121, 136, 154, 166, 161, 150, 134, 114, 132, 140, 134, 126, 128, 132, 136, 140, 130, 122, 125, 135, 137, 139, 134, 121, 114, 117, 120, 125, 130, 133, 135, 136, 133, 127, 122, 123, 130, 133, 132, 131, 132, 132, 132, 130, 127, 128, 130, 131, 131, 131, 132, 132, 132, 130, 127, 129, 132, 134, 132, 130, 125, 122, 117, 111, 106, 106, 112, 116, 116, 99, 71, 64, 59, 65, 66, 69, 110, 219, 207, 148, 106, 104, 105, 131, 133, 137, 145, 163, 160, 143, 129, 129, 125, 138, 133, 124, 124, 135, 135, 134, 134, 130, 132, 134, 133, 124, 120, 120, 122, 125, 128, 128, 129, 130, 131, 133, 133, 130, 126, 124, 124, 126, 127, 131, 133, 133, 134, 133, 130, 129, 129, 129, 130, 131, 132, 132, 132, 131, 130, 130, 130, 130, 130, 129, 127, 128, 131, 128, 124, 119, 110, 104, 107, 112, 108, 93, 86, 85, 88, 83, 71, 51, 58, 160, 222, 175, 131, 117, 126, 130, 126, 110, 110, 144, 164, 160, 135, 135, 141, 142, 139, 127, 122, 136, 145, 135, 127, 127, 127, 128, 128, 128, 129, 131, 130, 127, 124, 124, 123, 124, 127, 129, 132, 133, 132, 128, 125, 124, 124, 126, 126, 127, 132, 135, 133, 132, 132, 132, 130, 129, 130, 131, 131, 132, 133, 131, 128, 127, 128, 130, 130, 130, 130, 129, 126, 123, 121, 123, 122, 114, 108, 106, 107, 105, 102, 102, 101, 98, 92, 72, 84, 93, 97, 137, 170, 164, 146, 145, 134, 122, 115, 118, 125, 138, 143, 141, 144, 152, 149, 140, 134, 130, 129, 130, 126, 124, 134, 138, 134, 128, 130, 131, 132, 127, 125, 126, 131, 127, 123, 123, 125, 127, 127, 127, 127, 128, 126, 125, 124, 124, 124, 126, 128, 129, 132, 134, 134, 133, 133, 131, 130, 130, 130, 130, 130, 130, 129, 129, 128, 127, 127, 127, 128, 131, 131, 131, 131, 130, 128, 124, 120, 109, 103, 107, 109, 112, 109, 107, 106, 108, 94, 81, 77, 76, 73, 125, 174, 165, 140, 154, 167, 142, 113, 103, 111, 131, 143, 133, 142, 158, 168, 145, 135, 133, 134, 127, 120, 125, 135, 135, 126, 128, 133, 134, 132, 129, 129, 131, 128, 121, 121, 123, 124, 124, 127, 129, 129, 129, 127, 127, 127, 127, 125, 125, 126, 126, 127, 129, 131, 133, 132, 131, 132, 131, 130, 128, 129, 130, 129, 128, 128, 129, 130, 130, 130, 132, 134, 134, 133, 132, 131, 124, 119, 119, 116, 112, 111, 112, 114, 117, 115, 108, 117, 108, 91, 81, 96, 87, 70, 71, 158, 178, 132, 135, 182, 159, 113, 110, 121, 126, 129, 118, 119, 147, 168, 146, 128, 153, 145, 137, 126, 127, 126, 130, 128, 116, 133, 140, 137, 127, 133, 135, 130, 123, 118, 122, 123, 122, 120, 125, 134, 132, 129, 129, 131, 129, 124, 121, 122, 125, 123, 123, 124, 129, 130, 129, 129, 132, 134, 130, 129, 131, 134, 130, 128, 130, 133, 131, 128, 129, 132, 131, 130, 129, 130, 130, 129, 126, 124, 128, 127, 122, 122, 123, 120, 114, 113, 109, 104, 105, 102, 99, 90, 93, 96, 89, 84, 81, 138, 174, 129, 127, 170, 180, 121, 107, 133, 136, 123, 117, 125, 140, 154, 146, 128, 153, 156, 141, 124, 133, 137, 128, 123, 125, 131, 133, 131, 125, 127, 134, 130, 122, 124, 128, 126, 121, 123, 128, 129, 127, 128, 131, 132, 130, 126, 125, 125, 124, 121, 122, 123, 125, 125, 127, 129, 130, 130, 128, 128, 128, 129, 127, 128, 130, 130, 131, 133, 134, 133, 132, 133, 132, 130, 129, 129, 128, 129, 130, 129, 130, 131, 128, 124, 124, 121, 115, 112, 109, 102, 106, 107, 101, 93, 103, 103, 97, 83, 85, 113, 127, 134, 126, 154, 171, 164, 141, 148, 152, 143, 125, 127, 133, 134, 133, 135, 143, 150, 148, 138, 138, 140, 133, 123, 124, 127, 126, 123, 125, 126, 127, 125, 122, 123, 124, 120, 116, 119, 124, 125, 126, 129, 133, 133, 132, 132, 132, 131, 128, 124, 123, 122, 119, 118, 118, 120, 122, 124, 125, 127, 128, 128, 129, 130, 130, 132, 134, 133, 134, 138, 138, 137, 138, 140, 139, 136, 137, 137, 135, 133, 134, 134, 133, 131, 131, 128, 125, 123, 120, 116, 113, 112, 108, 105, 105, 103, 96, 95, 93, 92, 87, 80, 92, 118, 125, 120, 136, 163, 156, 146, 151, 158, 144, 136, 137, 137, 133, 130, 130, 137, 145, 143, 137, 141, 143, 138, 131, 133, 133, 129, 125, 126, 126, 125, 124, 123, 124, 124, 121, 120, 123, 124, 124, 126, 128, 130, 130, 130, 131, 130, 129, 127, 125, 123, 122, 121, 121, 121, 122, 124, 126, 126, 127, 127, 128, 128, 127, 128, 130, 131, 130, 130, 133, 134, 134, 136, 139, 139, 138, 136, 135, 135, 133, 132, 132, 134, 131, 129, 130, 128, 125, 125, 125, 120, 116, 114, 110, 104, 102, 103, 97, 91, 92, 90, 87, 83, 98, 111, 121, 121, 138, 150, 153, 147, 154, 158, 154, 145, 142, 142, 141, 136, 131, 137, 140, 136, 130, 134, 136, 132, 129, 131, 132, 130, 127, 126, 127, 127, 125, 124, 125, 125, 123, 122, 123, 125, 125, 124, 124, 126, 127, 127, 127, 128, 129, 128, 127, 127, 127, 126, 125, 125, 125, 125, 124, 124, 124, 124, 125, 125, 125, 126, 127, 127, 128, 129, 130, 131, 132, 132, 134, 134, 135, 135, 137, 138, 138, 137, 137, 137, 136, 135, 135, 134, 133, 131, 130, 129, 128, 127, 125, 123, 121, 118, 115, 112, 110, 108, 104, 98, 94, 91, 87, 83, 86, 95, 98, 100, 107, 119, 124, 129, 135, 142, 147, 152, 154, 154, 156, 158, 158, 157, 154, 151, 149, 147, 143, 139, 137, 136, 133, 130, 128, 126, 124, 122, 121, 119, 117, 116, 116, 115, 116, 116, 117, 118, 119, 121, 123, 124, 126, 128, 130, 131, 132, 133, 134, 134, 134, 134, 133, 132, 131, 129, 128, 127, 126, 125, 124, 124, 123, 123, 122, 122, 122, 121, 121, 121, 121, 121, 122, 123, 124, 125, 126, 126, 127, 128, 128, 128, 128, 129, 129, 129, 129, 129, 128, 128, 128, 127, 126, 126, 126, 125, 125, 125, 126, 126, 127, 132, 138, 135, 133, 141, 145, 141, 139, 143, 144, 143, 142, 140, 138, 139, 139, 136, 133, 131, 128, 126, 122, 118, 113, 111, 108, 103, 97, 94, 90, 86, 84, 90, 91, 90, 97, 108, 113, 117, 124, 132, 137, 143, 147, 150, 153, 156, 157, 158, 158, 156, 154, 152, 149, 145, 143, 140, 137, 134, 132, 128, 127, 124, 122, 120, 119, 117, 115, 114, 113, 113, 113, 113, 113, 114, 115, 116, 118, 120, 122, 124, 126, 128, 131, 132, 133, 135, 136, 136, 136, 136, 135, 134, 133, 132, 130, 129, 127, 127, 126, 125, 124, 124, 123, 123, 122, 122, 122, 121, 121, 122, 122, 122, 123, 124, 125, 126, 127, 127, 128, 129, 130, 130, 131, 131, 131, 131, 131, 130, 130, 129, 129, 128, 128, 127, 127, 127, 126, 126, 126, 125, 125, 125, 125, 124, 124, 124, 124, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 125, 125, 126, 126, 126, 126, 126, 126, 128, 130, 129, 130, 133, 135, 135, 137, 139, 139, 139, 140, 139, 139, 139, 139, 137, 136, 135, 133, 131, 130, 127, 125, 122, 121, 118, 114, 110, 108, 105, 101, 97, 93, 93, 96, 97, 97, 100, 108, 113, 116, 120, 126, 133, 137, 140, 143, 147, 150, 151, 152, 153, 152, 151, 151, 148, 145, 144, 143, 140, 137, 136, 134, 131, 129, 127, 125, 123, 121, 119, 117, 116, 116, 116, 116, 116, 117, 118, 119, 120, 122, 123, 125, 127, 128, 128, 128, 127, 127, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 127, 127, 128, 133, 139, 135, 134, 139, 142, 138, 137, 139, 140, 140, 137, 135, 134, 135, 132, 131, 130, 126, 125, 125, 122, 119, 119, 118, 115, 114, 113, 112, 115, 120, 123, 125, 126, 127, 127, 128, 128, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 128, 127, 126, 127, 127, 127, 127, 127, 127, 127, 126, 126, 127, 127, 126, 126, 126, 126, 125, 125, 125, 124, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 128, 134, 133, 130, 133, 138, 135, 133, 134, 135, 134, 133, 131, 129, 130, 129, 127, 125, 124, 122, 122, 121, 119, 120, 121, 120, 120, 120, 119, 120, 121, 121, 122, 122, 123, 124, 124, 124, 126, 127, 127, 127, 129, 129, 129, 130, 130, 130, 129, 129, 129, 128, 128, 128, 127, 127, 127, 126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 126, 125, 125, 126, 126, 126, 127, 129, 130, 130, 130, 132, 133, 133, 133, 134, 134, 135, 135, 135, 135, 135, 134, 133, 133, 132, 131, 130, 129, 128, 127, 126, 126, 125, 123, 123, 122, 121, 120, 119, 119, 118, 117, 116, 116, 115, 115, 115, 116, 115, 116, 118, 120, 120, 122, 125, 127, 128, 130, 132, 133, 135, 136, 136, 137, 137, 138, 137, 136, 136, 136, 135, 134, 133, 132, 131, 131, 130, 129, 128, 128, 127, 126, 125, 125, 124, 124, 123, 123, 123, 123, 123, 123, 124, 124, 125, 125, 125, 126, 126, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 126, 126, 126, 127, 126, 126, 126, 127, 127, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 127, 127, 128, 128, 128, 127, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, }; const uint8_t kft[7420] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 123, 125, 136, 125, 125, 126, 128, 126, 125, 126, 124, 129, 130, 123, 127, 126, 125, 126, 131, 127, 123, 124, 125, 128, 129, 126, 129, 126, 125, 126, 127, 124, 125, 120, 129, 129, 121, 122, 131, 127, 128, 135, 127, 125, 128, 131, 127, 123, 123, 123, 124, 131, 125, 128, 129, 124, 131, 126, 122, 124, 137, 124, 134, 137, 123, 116, 127, 126, 126, 125, 123, 123, 128, 131, 125, 124, 128, 136, 130, 129, 127, 129, 123, 126, 122, 125, 129, 129, 129, 130, 124, 123, 124, 127, 136, 134, 125, 120, 123, 123, 123, 135, 129, 129, 124, 125, 136, 125, 122, 130, 130, 126, 130, 126, 142, 134, 116, 124, 127, 135, 120, 128, 123, 127, 119, 128, 134, 136, 122, 123, 125, 124, 126, 122, 130, 124, 136, 123, 136, 132, 127, 135, 126, 119, 123, 123, 134, 125, 129, 134, 126, 131, 124, 124, 128, 123, 131, 120, 128, 126, 123, 127, 132, 129, 124, 123, 129, 125, 122, 130, 129, 126, 130, 124, 129, 134, 116, 124, 129, 135, 120, 128, 126, 127, 119, 128, 126, 136, 122, 123, 129, 124, 126, 122, 125, 124, 136, 123, 127, 122, 127, 135, 137, 109, 123, 123, 130, 134, 129, 134, 129, 124, 124, 124, 125, 127, 132, 117, 122, 128, 125, 130, 138, 129, 135, 118, 117, 139, 145, 138, 129, 124, 137, 124, 115, 104, 112, 124, 127, 143, 147, 102, 114, 117, 112, 132, 148, 140, 115, 124, 143, 121, 135, 133, 135, 144, 129, 120, 122, 125, 140, 117, 130, 144, 129, 123, 129, 132, 109, 132, 139, 118, 124, 138, 120, 122, 120, 128, 123, 134, 132, 123, 134, 142, 117, 134, 123, 105, 123, 140, 123, 111, 132, 128, 136, 121, 139, 129, 119, 124, 128, 128, 133, 110, 128, 114, 132, 135, 161, 148, 136, 106, 123, 122, 117, 116, 126, 125, 134, 125, 140, 118, 132, 144, 129, 117, 140, 132, 132, 129, 115, 113, 138, 125, 112, 122, 147, 112, 125, 135, 135, 130, 139, 126, 117, 138, 128, 114, 132, 120, 116, 127, 127, 128, 119, 128, 116, 133, 126, 140, 134, 129, 134, 128, 127, 125, 125, 153, 148, 136, 121, 130, 116, 116, 115, 123, 128, 132, 115, 117, 122, 128, 112, 125, 125, 144, 125, 136, 107, 120, 157, 131, 128, 153, 122, 116, 114, 104, 126, 127, 111, 125, 137, 138, 119, 121, 124, 128, 143, 130, 128, 134, 135, 134, 119, 144, 153, 139, 126, 124, 116, 118, 117, 130, 118, 119, 132, 129, 115, 123, 132, 133, 132, 131, 118, 120, 132, 126, 116, 131, 125, 132, 126, 122, 124, 133, 129, 123, 120, 122, 127, 127, 132, 129, 121, 125, 126, 124, 122, 130, 118, 115, 125, 119, 119, 126, 133, 126, 136, 134, 142, 140, 127, 131, 130, 122, 124, 123, 125, 127, 140, 143, 128, 131, 122, 120, 120, 112, 118, 115, 119, 117, 119, 118, 132, 135, 136, 132, 136, 132, 127, 130, 156, 127, 121, 130, 133, 134, 130, 127, 147, 136, 123, 114, 121, 126, 117, 121, 130, 125, 133, 125, 121, 118, 129, 128, 122, 119, 120, 126, 122, 123, 123, 130, 133, 129, 126, 124, 124, 123, 118, 119, 122, 125, 129, 127, 127, 130, 131, 132, 135, 136, 134, 132, 134, 128, 128, 126, 121, 125, 132, 125, 129, 130, 135, 133, 136, 137, 139, 137, 137, 133, 131, 127, 126, 117, 117, 115, 118, 117, 117, 118, 124, 124, 122, 116, 121, 116, 111, 104, 95, 83, 74, 70, 68, 67, 65, 82, 144, 170, 168, 167, 191, 198, 181, 164, 155, 149, 148, 143, 121, 121, 130, 141, 138, 144, 157, 171, 171, 162, 158, 164, 161, 145, 133, 124, 119, 111, 99, 78, 78, 86, 80, 68, 65, 72, 70, 70, 67, 62, 58, 61, 52, 50, 60, 101, 140, 169, 196, 211, 216, 207, 193, 180, 154, 136, 112, 101, 98, 106, 111, 117, 133, 147, 161, 170, 176, 167, 156, 153, 142, 130, 124, 120, 120, 117, 115, 116, 122, 123, 123, 129, 133, 148, 167, 170, 160, 159, 165, 157, 146, 132, 122, 120, 119, 110, 107, 110, 112, 97, 93, 89, 75, 61, 54, 55, 56, 56, 53, 46, 54, 72, 70, 187, 230, 191, 166, 226, 212, 153, 123, 107, 97, 117, 115, 86, 101, 164, 177, 166, 171, 185, 178, 170, 148, 111, 105, 116, 106, 90, 110, 136, 159, 156, 145, 149, 161, 152, 125, 110, 104, 93, 104, 123, 138, 137, 164, 172, 158, 146, 142, 137, 125, 117, 109, 108, 116, 117, 108, 103, 102, 100, 92, 90, 105, 109, 103, 99, 86, 71, 65, 33, 13, 75, 223, 217, 165, 163, 236, 206, 161, 107, 70, 102, 144, 123, 73, 127, 184, 191, 172, 163, 157, 154, 149, 111, 87, 95, 115, 111, 107, 124, 160, 179, 177, 154, 136, 132, 128, 99, 78, 102, 124, 127, 133, 152, 163, 171, 166, 137, 125, 131, 119, 94, 102, 114, 118, 119, 117, 112, 106, 109, 103, 106, 104, 101, 92, 85, 83, 84, 58, 30, 84, 230, 241, 177, 142, 195, 186, 138, 104, 66, 78, 137, 145, 111, 130, 189, 199, 176, 151, 131, 123, 125, 111, 83, 86, 117, 140, 144, 149, 161, 166, 160, 144, 107, 90, 98, 100, 96, 120, 156, 167, 174, 173, 154, 138, 130, 114, 102, 116, 125, 123, 126, 134, 130, 116, 110, 98, 92, 98, 104, 92, 84, 90, 96, 100, 108, 104, 83, 93, 145, 205, 189, 142, 144, 150, 135, 113, 95, 87, 124, 167, 164, 146, 159, 176, 170, 147, 116, 95, 107, 125, 129, 123, 140, 157, 163, 151, 138, 129, 116, 113, 113, 106, 108, 145, 179, 173, 146, 138, 144, 135, 120, 106, 104, 116, 145, 142, 122, 119, 123, 119, 107, 101, 94, 104, 112, 106, 84, 67, 51, 51, 55, 68, 88, 202, 254, 243, 155, 128, 136, 114, 90, 76, 73, 100, 178, 207, 188, 153, 157, 151, 137, 116, 93, 86, 103, 146, 154, 146, 150, 158, 148, 133, 123, 104, 96, 111, 123, 119, 121, 145, 165, 161, 142, 131, 133, 129, 124, 115, 113, 121, 142, 140, 123, 120, 123, 120, 110, 104, 96, 104, 112, 106, 85, 68, 52, 50, 55, 68, 88, 164, 254, 243, 155, 130, 136, 113, 89, 75, 72, 101, 181, 210, 190, 154, 157, 147, 131, 94, 82, 91, 140, 166, 161, 156, 160, 147, 133, 118, 94, 77, 86, 120, 134, 135, 140, 146, 143, 137, 129, 112, 111, 127, 137, 147, 145, 132, 129, 128, 129, 126, 126, 132, 139, 136, 124, 113, 114, 111, 100, 98, 99, 104, 112, 113, 108, 106, 105, 104, 106, 97, 78, 94, 160, 194, 174, 155, 137, 114, 118, 131, 122, 100, 132, 166, 184, 160, 139, 127, 124, 139, 139, 124, 112, 129, 145, 146, 138, 132, 128, 146, 157, 146, 126, 126, 130, 129, 129, 122, 118, 119, 132, 130, 124, 122, 127, 129, 125, 118, 107, 99, 97, 96, 91, 83, 77, 83, 91, 84, 80, 95, 159, 230, 234, 169, 102, 94, 107, 124, 136, 134, 139, 156, 186, 177, 143, 120, 98, 99, 128, 143, 134, 125, 138, 152, 166, 158, 132, 114, 105, 116, 121, 121, 116, 124, 126, 122, 120, 116, 118, 122, 134, 138, 132, 125, 119, 123, 129, 133, 138, 149, 147, 138, 131, 122, 112, 116, 124, 133, 132, 136, 132, 123, 114, 111, 116, 116, 113, 108, 107, 105, 105, 108, 109, 106, 105, 103, 99, 87, 103, 161, 184, 182, 158, 139, 122, 111, 130, 139, 131, 134, 147, 155, 160, 158, 137, 118, 133, 142, 142, 130, 126, 123, 134, 149, 145, 135, 124, 130, 135, 134, 132, 120, 112, 121, 132, 128, 122, 123, 124, 130, 132, 127, 112, 109, 109, 110, 111, 106, 99, 96, 94, 83, 71, 70, 74, 90, 146, 190, 209, 204, 164, 113, 95, 109, 120, 135, 133, 140, 153, 170, 173, 154, 133, 116, 112, 117, 137, 140, 137, 135, 139, 142, 146, 144, 130, 116, 116, 123, 125, 127, 120, 115, 119, 127, 127, 125, 127, 127, 131, 132, 126, 114, 111, 110, 111, 115, 110, 105, 99, 95, 84, 75, 70, 75, 90, 127, 177, 210, 204, 181, 129, 94, 109, 118, 132, 133, 141, 155, 168, 176, 154, 128, 116, 110, 115, 136, 140, 137, 139, 147, 147, 146, 142, 126, 114, 106, 110, 113, 118, 121, 120, 117, 116, 122, 130, 137, 137, 134, 131, 124, 121, 121, 120, 130, 150, 168, 160, 144, 126, 115, 111, 121, 117, 118, 126, 130, 127, 125, 119, 117, 118, 115, 109, 107, 100, 94, 96, 101, 109, 107, 102, 102, 100, 82, 102, 145, 186, 192, 178, 155, 117, 107, 130, 131, 128, 134, 139, 141, 154, 164, 147, 137, 124, 120, 130, 144, 153, 142, 136, 130, 130, 139, 149, 144, 137, 125, 111, 114, 123, 130, 123, 122, 125, 128, 133, 138, 136, 125, 116, 105, 100, 100, 99, 96, 96, 97, 93, 84, 79, 69, 68, 85, 121, 174, 191, 196, 183, 146, 115, 117, 118, 121, 134, 143, 147, 150, 164, 158, 149, 146, 132, 120, 122, 124, 130, 145, 153, 150, 144, 136, 131, 128, 123, 116, 109, 110, 111, 112, 113, 115, 120, 124, 131, 136, 139, 135, 127, 120, 118, 124, 139, 155, 156, 146, 132, 125, 122, 126, 130, 128, 126, 124, 120, 118, 120, 124, 127, 119, 112, 106, 102, 99, 102, 105, 107, 105, 98, 90, 87, 84, 77, 72, 131, 183, 200, 211, 184, 131, 94, 97, 110, 137, 162, 159, 145, 141, 147, 151, 158, 159, 138, 125, 115, 120, 137, 148, 154, 146, 136, 130, 127, 132, 138, 136, 129, 120, 118, 119, 124, 135, 136, 134, 131, 127, 120, 120, 116, 106, 102, 100, 99, 104, 105, 93, 83, 68, 59, 60, 63, 77, 123, 160, 176, 208, 207, 172, 148, 119, 103, 102, 120, 140, 144, 152, 154, 156, 159, 161, 156, 142, 128, 110, 109, 121, 134, 147, 150, 146, 137, 130, 124, 120, 116, 110, 104, 102, 106, 117, 128, 132, 134, 132, 130, 129, 131, 134, 148, 154, 155, 151, 139, 128, 117, 122, 131, 134, 135, 127, 115, 108, 106, 116, 124, 127, 125, 109, 94, 82, 75, 83, 96, 101, 98, 91, 80, 62, 56, 105, 164, 207, 227, 219, 173, 120, 103, 98, 114, 148, 161, 160, 152, 136, 130, 137, 153, 160, 154, 143, 122, 113, 114, 130, 156, 171, 169, 149, 130, 120, 117, 123, 128, 124, 121, 119, 122, 125, 138, 145, 147, 142, 126, 114, 99, 90, 89, 89, 95, 95, 89, 84, 71, 62, 59, 61, 66, 88, 133, 156, 207, 226, 211, 188, 141, 103, 84, 94, 120, 147, 168, 167, 159, 146, 143, 146, 154, 159, 151, 132, 122, 106, 113, 131, 153, 163, 161, 143, 121, 109, 107, 112, 122, 125, 123, 120, 119, 122, 128, 141, 148, 149, 144, 127, 111, 98, 93, 91, 95, 97, 95, 88, 78, 65, 61, 61, 65, 77, 102, 145, 192, 227, 220, 200, 157, 111, 87, 85, 112, 141, 164, 173, 162, 150, 143, 146, 154, 159, 156, 140, 120, 104, 103, 113, 135, 156, 159, 154, 132, 107, 95, 94, 103, 116, 123, 124, 119, 116, 119, 125, 138, 151, 166, 173, 164, 153, 139, 123, 117, 113, 114, 123, 129, 136, 131, 129, 123, 114, 107, 103, 100, 95, 92, 87, 85, 83, 82, 81, 79, 83, 83, 76, 93, 135, 164, 199, 211, 203, 171, 139, 123, 106, 117, 136, 149, 157, 156, 142, 137, 139, 147, 157, 167, 160, 144, 125, 108, 109, 122, 142, 152, 154, 153, 139, 125, 122, 118, 121, 127, 131, 132, 130, 133, 131, 127, 121, 111, 106, 97, 91, 85, 82, 82, 80, 77, 73, 73, 70, 70, 76, 81, 108, 153, 198, 213, 221, 205, 166, 141, 115, 110, 115, 126, 139, 145, 144, 142, 141, 148, 161, 165, 170, 161, 141, 126, 109, 104, 108, 120, 134, 142, 142, 133, 127, 117, 113, 110, 113, 117, 117, 118, 119, 127, 153, 174, 180, 186, 170, 139, 122, 104, 99, 106, 115, 126, 129, 127, 120, 112, 107, 107, 106, 101, 96, 89, 85, 85, 81, 82, 82, 78, 70, 61, 88, 109, 143, 181, 206, 204, 185, 163, 139, 132, 135, 149, 154, 155, 143, 127, 120, 122, 131, 147, 165, 167, 161, 151, 135, 127, 120, 125, 126, 128, 138, 140, 142, 141, 134, 126, 119, 117, 117, 127, 135, 141, 143, 144, 139, 134, 131, 124, 116, 111, 106, 97, 88, 79, 74, 70, 72, 74, 76, 76, 68, 62, 59, 58, 91, 143, 168, 203, 222, 210, 190, 161, 144, 130, 137, 145, 148, 145, 133, 125, 119, 129, 140, 151, 167, 169, 161, 153, 139, 127, 123, 126, 128, 130, 132, 129, 124, 121, 120, 120, 123, 126, 129, 133, 139, 141, 143, 143, 140, 135, 131, 127, 119, 114, 107, 101, 93, 84, 76, 72, 73, 74, 77, 76, 72, 63, 59, 58, 74, 155, 182, 211, 222, 201, 178, 156, 135, 133, 141, 147, 147, 140, 131, 121, 122, 134, 142, 159, 170, 167, 161, 147, 135, 125, 124, 129, 131, 130, 125, 114, 102, 98, 100, 113, 131, 145, 152, 156, 150, 145, 139, 136, 135, 136, 132, 128, 124, 119, 118, 117, 116, 111, 105, 103, 101, 99, 96, 98, 96, 95, 90, 85, 76, 71, 64, 58, 58, 77, 117, 137, 175, 199, 204, 195, 183, 171, 160, 165, 167, 167, 156, 139, 127, 115, 114, 121, 129, 143, 147, 147, 145, 139, 134, 135, 139, 140, 144, 140, 134, 130, 123, 122, 123, 126, 124, 125, 126, 128, 132, 138, 139, 139, 137, 128, 128, 121, 123, 118, 121, 115, 113, 107, 104, 98, 94, 91, 86, 87, 83, 79, 74, 72, 69, 66, 71, 81, 115, 142, 171, 183, 194, 188, 178, 174, 165, 168, 169, 170, 163, 151, 132, 122, 115, 118, 126, 133, 142, 143, 142, 137, 135, 133, 138, 139, 142, 143, 137, 131, 129, 123, 123, 125, 125, 124, 125, 126, 129, 135, 138, 140, 138, 135, 126, 123, 120, 121, 120, 115, 116, 110, 108, 100, 97, 92, 89, 85, 85, 80, 77, 72, 71, 67, 70, 77, 115, 130, 159, 179, 190, 186, 177, 171, 164, 165, 172, 171, 168, 157, 144, 126, 119, 118, 120, 131, 131, 136, 128, 130, 127, 128, 136, 137, 144, 142, 139, 132, 134, 131, 131, 130, 126, 123, 121, 118, 117, 123, 127, 130, 133, 128, 125, 120, 118, 119, 121, 123, 124, 119, 120, 110, 103, 97, 91, 90, 84, 92, 89, 89, 87, 89, 87, 89, 93, 109, 117, 138, 152, 163, 166, 165, 165, 164, 166, 167, 168, 168, 163, 158, 146, 136, 131, 128, 127, 126, 124, 121, 118, 117, 120, 124, 129, 131, 133, 133, 132, 132, 134, 133, 135, 130, 130, 126, 123, 121, 124, 125, 126, 125, 124, 129, 123, 128, 126, 129, 126, 127, 127, 116, 124, 114, 112, 110, 108, 102, 103, 93, 104, 100, 105, 105, 111, 101, 112, 101, 109, 109, 120, 129, 138, 143, 144, 149, 148, 150, 154, 157, 158, 160, 156, 152, 144, 142, 137, 135, 130, 134, 126, 126, 121, 122, 126, 127, 126, 133, 133, 132, 134, 125, 138, 126, 135, 122, 125, 121, 124, 120, 120, 125, 120, 125, 134, 126, 132, 129, 128, 130, 123, 139, 116, 138, 125, 122, 120, 115, 125, 102, 121, 104, 122, 98, 124, 118, 120, 113, 110, 110, 107, 110, 107, 116, 121, 135, 128, 140, 125, 144, 149, 149, 151, 156, 153, 147, 149, 138, 148, 138, 141, 124, 126, 124, 124, 131, 125, 128, 124, 120, 135, 120, 137, 128, 138, 127, 124, 128, 120, 122, 131, 116, 127, 125, 124, 126, 133, 124, 129, 119, 128, 125, 124, 132, 121, 130, 130, 121, 123, 122, 113, 117, 114, 120, 124, 113, 123, 122, 106, 121, 103, 117, 100, 129, 111, 122, 111, 121, 115, 121, 135, 133, 134, 136, 146, 144, 146, 143, 143, 151, 142, 138, 135, 142, 134, 142, 133, 123, 129, 125, 129, 137, 123, 128, 127, 129, 133, 132, 126, 132, 136, 125, 130, 134, 116, 127, 119, 127, 122, 133, 122, 126, 131, 121, 133, 121, 134, 109, 126, 120, 106, 134, 120, 144, 102, 135, 124, 120, 128, 103, 123, 103, 123, 105, 115, 111, 112, 100, 116, 115, 126, 127, 133, 125, 137, 136, 146, 140, 147, 146, 149, 149, 142, 143, 145, 139, 132, 134, 140, 128, 136, 130, 128, 138, 127, 131, 133, 126, 128, 128, 136, 126, 130, 125, 124, 128, 112, 135, 118, 139, 118, 122, 119, 108, 137, 99, 143, 98, 139, 136, 102, 127, 119, 144, 102, 142, 100, 124, 120, 120, 105, 113, 120, 100, 114, 100, 112, 98, 121, 122, 126, 125, 130, 141, 132, 148, 145, 153, 154, 151, 152, 147, 151, 146, 143, 141, 134, 135, 135, 136, 129, 123, 132, 125, 133, 129, 133, 129, 140, 138, 134, 135, 128, 129, 128, 122, 128, 121, 127, 121, 122, 134, 111, 133, 103, 140, 102, 137, 134, 105, 127, 118, 140, 104, 132, 101, 123, 120, 112, 105, 113, 120, 100, 114, 100, 112, 97, 121, 122, 126, 141, 130, 141, 132, 152, 145, 153, 155, 145, 152, 147, 151, 146, 143, 142, 133, 135, 136, 136, 128, 123, 130, 125, 134, 128, 138, 129, 148, 143, 133, 139, 130, 139, 119, 135, 128, 120, 137, 116, 123, 113, 125, 123, 126, 120, 123, 112, 121, 124, 109, 119, 115, 115, 114, 110, 109, 101, 104, 99, 84, 104, 82, 90, 87, 91, 111, 122, 136, 128, 147, 144, 164, 167, 165, 166, 169, 172, 167, 166, 148, 146, 141, 140, 135, 129, 118, 113, 124, 128, 126, 130, 133, 137, 146, 148, 146, 143, 139, 137, 135, 126, 124, 119, 117, 114, 120, 119, 109, 117, 119, 122, 117, 117, 128, 122, 133, 120, 127, 98, 103, 116, 86, 106, 84, 90, 70, 83, 65, 62, 61, 71, 90, 116, 134, 132, 152, 167, 180, 197, 190, 197, 188, 196, 188, 180, 167, 155, 145, 141, 134, 127, 118, 119, 117, 131, 127, 135, 139, 145, 152, 158, 156, 149, 148, 144, 139, 129, 123, 114, 113, 113, 113, 115, 116, 119, 123, 125, 122, 122, 120, 116, 111, 113, 100, 97, 83, 88, 78, 79, 62, 62, 54, 50, 53, 55, 53, 63, 92, 119, 134, 143, 161, 184, 193, 207, 201, 206, 194, 199, 186, 183, 159, 157, 143, 144, 128, 129, 119, 123, 123, 129, 131, 138, 142, 149, 150, 151, 147, 146, 141, 138, 129, 124, 120, 120, 117, 117, 119, 123, 128, 130, 129, 129, 128, 125, 123, 118, 109, 103, 100, 90, 85, 72, 72, 60, 62, 52, 50, 46, 47, 45, 54, 68, 93, 115, 136, 151, 180, 197, 202, 201, 204, 207, 206, 199, 185, 177, 163, 163, 149, 144, 132, 132, 128, 130, 129, 134, 137, 142, 144, 144, 140, 136, 129, 127, 125, 124, 119, 119, 120, 124, 126, 129, 130, 137, 142, 145, 145, 143, 139, 137, 130, 121, 112, 105, 96, 86, 79, 70, 67, 64, 60, 53, 52, 49, 45, 43, 50, 63, 85, 102, 116, 140, 163, 177, 186, 194, 199, 204, 204, 202, 197, 189, 185, 178, 168, 157, 150, 143, 135, 132, 132, 132, 133, 137, 138, 138, 134, 130, 126, 125, 124, 122, 121, 121, 124, 126, 129, 130, 133, 138, 143, 144, 144, 141, 137, 134, 127, 116, 109, 102, 92, 83, 77, 70, 65, 62, 58, 53, 50, 47, 44, 43, 52, 67, 88, 108, 124, 150, 168, 182, 188, 198, 199, 204, 204, 199, 194, 189, 181, 172, 165, 155, 146, 138, 135, 133, 130, 131, 132, 133, 134, 131, 128, 126, 123, 124, 124, 125, 124, 127, 128, 132, 132, 134, 135, 140, 141, 139, 137, 135, 131, 123, 119, 111, 105, 96, 89, 84, 79, 70, 66, 61, 53, 45, 41, 39, 40, 46, 58, 70, 90, 112, 133, 145, 159, 173, 185, 188, 195, 201, 205, 204, 205, 201, 195, 189, 179, 169, 159, 152, 145, 139, 136, 135, 134, 131, 127, 123, 120, 115, 113, 114, 116, 119, 121, 125, 129, 132, 135, 138, 140, 143, 144, 145, 144, 142, 138, 133, 127, 118, 110, 102, 96, 89, 80, 73, 69, 62, 53, 45, 39, 36, 37, 42, 48, 60, 78, 97, 118, 130, 147, 161, 178, 184, 197, 205, 211, 213, 215, 211, 205, 198, 187, 174, 162, 155, 146, 140, 135, 133, 130, 125, 121, 117, 113, 110, 108, 109, 114, 116, 117, 122, 128, 131, 133, 137, 139, 145, 146, 147, 147, 146, 142, 137, 129, 120, 112, 102, 96, 89, 81, 75, 70, 60, 53, 44, 39, 36, 41, 46, 54, 69, 89, 105, 119, 135, 155, 168, 176, 188, 200, 206, 210, 213, 211, 208, 199, 193, 182, 170, 159, 155, 147, 141, 136, 133, 127, 122, 115, 112, 108, 106, 105, 107, 112, 114, 115, 120, 125, 127, 131, 132, 137, 145, 146, 148, 148, 145, 142, 140, 127, 117, 110, 105, 96, 89, 80, 74, 70, 61, 53, 45, 41, 39, 43, 50, 56, 71, 91, 107, 118, 134, 151, 166, 175, 186, 198, 207, 212, 215, 213, 210, 205, 195, 184, 173, 165, 156, 149, 143, 139, 135, 128, 123, 118, 111, 107, 105, 103, 105, 110, 113, 113, 118, 123, 127, 130, 132, 137, 145, 147, 149, 148, 145, 143, 140, 127, 117, 109, 104, 96, 87, 79, 75, 69, 59, 52, 46, 40, 39, 45, 49, 60, 76, 96, 111, 122, 138, 155, 170, 178, 189, 200, 210, 214, 215, 212, 209, 203, 193, 181, 170, 162, 154, 148, 142, 138, 133, 126, 121, 115, 109, 106, 103, 101, 103, 108, 109, 110, 115, 121, 125, 127, 131, 139, 146, 151, 152, 153, 152, 149, 144, 134, 123, 115, 108, 92, 87, 78, 71, 63, 58, 49, 42, 39, 38, 39, 49, 63, 73, 93, 110, 128, 137, 154, 167, 181, 188, 199, 209, 215, 216, 215, 211, 203, 197, 186, 175, 163, 157, 147, 140, 134, 130, 125, 118, 111, 107, 103, 100, 98, 99, 101, 109, 111, 112, 116, 126, 128, 133, 135, 144, 150, 153, 154, 156, 152, 149, 145, 135, 125, 116, 110, 100, 90, 80, 75, 69, 58, 51, 47, 41, 39, 37, 39, 50, 63, 76, 96, 108, 125, 140, 157, 165, 180, 189, 201, 207, 214, 214, 216, 213, 206, 197, 186, 178, 167, 156, 147, 142, 135, 129, 124, 119, 113, 108, 103, 100, 99, 99, 102, 106, 112, 111, 117, 125, 128, 131, 135, 144, 148, 153, 154, 156, 153, 151, 145, 135, 127, 119, 109, 100, 93, 83, 75, 68, 61, 52, 46, 41, 39, 38, 39, 51, 60, 73, 89, 110, 121, 137, 153, 166, 176, 188, 198, 208, 215, 214, 217, 213, 205, 199, 191, 177, 167, 158, 148, 140, 132, 128, 124, 117, 112, 109, 104, 101, 102, 103, 106, 112, 114, 117, 123, 128, 130, 134, 137, 143, 148, 149, 152, 154, 151, 149, 144, 135, 127, 119, 113, 105, 97, 88, 83, 75, 69, 63, 59, 54, 52, 50, 50, 50, 57, 72, 81, 95, 111, 127, 139, 156, 164, 176, 185, 195, 202, 207, 208, 211, 208, 202, 196, 186, 174, 166, 158, 146, 139, 133, 128, 124, 116, 111, 107, 104, 102, 101, 101, 103, 110, 113, 116, 119, 125, 130, 135, 136, 141, 147, 149, 150, 152, 149, 147, 144, 137, 129, 121, 116, 109, 102, 94, 89, 82, 75, 68, 63, 59, 58, 56, 56, 56, 58, 60, 71, 80, 93, 106, 124, 135, 150, 162, 173, 182, 193, 201, 208, 212, 212, 211, 209, 203, 195, 185, 173, 165, 154, 143, 135, 131, 123, 117, 110, 106, 102, 99, 96, 97, 98, 100, 107, 114, 115, 120, 128, 132, 135, 139, 143, 148, 150, 151, 153, 151, 149, 146, 139, 131, 127, 119, 112, 104, 99, 93, 88, 78, 74, 70, 65, 62, 61, 61, 62, 63, 64, 65, 69, 82, 96, 103, 116, 135, 148, 158, 168, 180, 191, 198, 208, 209, 211, 209, 205, 199, 191, 181, 170, 161, 150, 140, 135, 130, 124, 117, 112, 109, 105, 100, 99, 100, 102, 103, 106, 111, 120, 122, 127, 132, 136, 138, 142, 144, 148, 151, 150, 151, 148, 143, 138, 132, 126, 122, 114, 106, 101, 95, 87, 81, 76, 71, 68, 65, 62, 64, 64, 66, 68, 70, 70, 73, 77, 91, 102, 113, 125, 142, 153, 166, 175, 184, 194, 201, 205, 209, 211, 209, 207, 200, 191, 181, 169, 158, 148, 138, 130, 125, 121, 115, 113, 110, 106, 102, 101, 100, 101, 101, 102, 104, 110, 117, 120, 122, 132, 137, 143, 147, 153, 156, 161, 160, 161, 159, 155, 150, 145, 136, 128, 122, 112, 103, 97, 90, 86, 79, 75, 71, 69, 67, 67, 66, 67, 69, 69, 69, 71, 72, 74, 86, 95, 105, 116, 135, 143, 157, 168, 180, 185, 195, 202, 207, 210, 210, 208, 204, 199, 190, 179, 167, 153, 146, 137, 128, 122, 119, 115, 112, 108, 105, 103, 101, 100, 100, 100, 101, 105, 108, 111, 116, 123, 127, 131, 139, 146, 149, 154, 159, 161, 162, 162, 160, 157, 154, 147, 142, 134, 128, 120, 111, 101, 94, 89, 82, 77, 73, 70, 67, 65, 64, 65, 66, 68, 71, 73, 75, 78, 82, 82, 89, 103, 113, 119, 133, 148, 158, 166, 178, 187, 194, 200, 204, 207, 208, 206, 202, 196, 186, 179, 166, 152, 141, 132, 127, 120, 116, 113, 110, 105, 102, 100, 99, 97, 97, 99, 99, 102, 104, 108, 111, 117, 121, 125, 129, 136, 141, 148, 153, 158, 160, 162, 163, 162, 158, 154, 151, 145, 136, 129, 125, 117, 108, 100, 94, 90, 85, 81, 79, 78, 78, 78, 79, 80, 82, 85, 89, 92, 96, 100, 103, 104, 106, 107, 112, 119, 126, 130, 138, 144, 153, 160, 167, 172, 178, 182, 186, 188, 186, 181, 178, 173, 169, 161, 153, 144, 139, 132, 128, 122, 118, 116, 113, 111, 110, 109, 108, 107, 108, 109, 109, 110, 111, 114, 116, 119, 121, 123, 125, 128, 130, 132, 133, 134, 136, 138, 139, 139, 139, 139, 140, 139, 139, 137, 135, 133, 129, 126, 123, 119, 115, 113, 108, 107, 105, 104, 104, 103, 103, 104, 105, 106, 108, 109, 110, 111, 113, 114, 116, 117, 118, 120, 121, 122, 123, 124, 128, 130, 132, 133, 136, 138, 141, 143, 145, 146, 147, 149, 151, 151, 150, 149, 148, 146, 145, 143, 139, 136, 135, 133, 131, 128, 127, 126, 125, 125, 124, 123, 122, 121, 119, 114, 109, 106, 106, 106, 108, 109, 110, 111, 114, 115, 116, 117, 119, 121, 121, 122, 123, 125, 128, 131, 132, 134, 137, 139, 141, 144, 146, 146, 148, 150, 151, 151, 150, 149, 148, 146, 144, 142, 138, 136, 135, 133, 130, 128, 127, 126, 125, 125, 124, 122, 122, 122, 121, 121, 121, 120, 120, 120, 120, 120, 121, 121, 122, 123, 124, 126, 127, 128, 128, 129, 129, 130, 130, 130, 130, 129, 129, 129, 128, 128, 127, 127, 127, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 125, 124, 124, 123, 124, 124, 124, 123, 123, 125, 124, 123, 123, 125, 125, 125, 124, 126, 125, 126, 125, 125, 126, 125, 125, 125, 125, 126, 127, 126, 128, 128, 128, 128, 128, 129, 129, 128, 128, 129, 128, 129, 127, 126, 129, 127, 129, 128, 131, 130, 129, 127, 129, 128, 129, 128, 128, 126, 128, 127, 128, 126, 125, 127, 128, 126, 124, 125, 124, 126, 127, 127, 129, 129, 127, 128, 128, 126, 128, 128, 127, 128, 130, 128, 128, 128, 128, 127, 128, 127, 128, 127, 129, 128, 127, 130, 127, 128, 128, 127, 126, 125, 129, 126, 127, 125, 127, 128, 128, 126, 125, 130, 125, 126, 129, 127, 129, 127, 126, 129, 129, 129, 127, 128, 125, 126, 125, 132, 126, 131, 128, 127, 131, 129, 125, 124, 124, 128, 128, 126, 127, 127, 122, 124, 126, 124, 130, 129, 125, 126, 129, 125, 125, 132, 125, 124, 126, 129, 134, 129, 127, 132, 128, 127, 131, 125, 131, 130, 126, 126, 128, 122, 127, 134, 129, 127, 129, 125, 127, 128, 128, 122, 128, 129, 123, 129, 123, 124, 127, 123, 125, 122, 123, 130, 128, 128, 125, 126, 128, 127, 123, 125, 127, 127, 123, 128, 126, 128, 127, 127, 127, 126, 127, 127, 126, 133, 121, 134, 120, 124, 124, 126, 119, 125, 128, 130, 126, 128, 127, 128, 124, 125, 130, 130, 127, 131, 124, 128, 127, 122, 130, 124, 127, 129, 122, 123, 128, 126, 126, 131, 131, 125, 129, 123, 125, 124, 126, 132, 128, 128, 127, 128, 123, 130, 124, 125, 136, 137, 124, 123, 130, 125, 128, 123, 124, 130, 124, 127, 126, 122, 123, 123, 126, 126, 131, 122, 123, 128, 123, 138, 133, 129, 132, 128, 131, 121, 128, 123, 129, 122, 125, 136, 124, 126, 124, 133, 126, 126, 127, 126, 130, 126, 130, 126, 127, 133, 127, 125, 127, 127, 130, 127, 124, 120, 127, 124, 130, 127, 129, 125, 128, 126, 127, 125, 130, 129, 127, 129, 131, 127, 124, 132, 128, 126, 127, 137, 131, 129, 125, 124, 126, 128, 124, 134, 130, 120, 131, 126, 129, 123, 126, 124, 133, 127, 121, 126, 123, 129, 127, 124, 128, 129, 127, 120, 126, 125, 135, 129, 125, 129, 129, 126, 126, 122, 127, 129, 126, 132, 123, 125, 121, 125, 128, 138, 130, 126, 130, 126, 123, 121, 130, 134, 126, 126, 132, 127, 125, 125, 129, 130, 130, 120, 132, 125, 133, 122, 129, 124, 127, 125, 122, 128, 121, 131, 124, 125, 128, 119, 124, 124, 124, 126, 133, 124, 129, 134, 129, 131, 119, 126, 129, 124, 127, 125, 128, 128, 125, 131, 129, 126, 125, 123, 125, 127, 130, 132, 127, 120, 133, 126, 127, 130, 129, 127, 131, 132, 131, 130, 124, 126, 125, 128, 127, 129, 126, 131, 126, 124, 126, 125, 125, 127, 131, 131, 127, 126, 123, 131, 126, 128, 130, 136, 127, 133, 119, 126, 129, 118, 125, 124, 121, 134, 127, 127, 129, 124, 124, 128, 138, 131, 129, 127, 123, 130, 130, 129, 128, 126, 130, 125, 118, 127, 127, 129, 125, 129, 127, 127, 118, 122, 124, 127, 128, 123, 128, 124, 124, 126, 130, 121, 126, 121, 126, 124, 124, 119, 126, 128, 130, 129, 126, 134, 128, 126, 114, 129, 130, 131, 123, 130, 124, 134, 120, 128, 125, 121, 129, 132, 129, 122, 120, 123, 138, 127, 130, 125, 132, 125, 125, 126, 124, 120, 124, 128, 131, 131, 124, 128, 130, 135, 117, 123, 123, 125, 126, 131, 127, 135, 127, 128, 117, 123, 129, 128, 126, 130, 137, 124, 120, 129, 126, 134, 132, 127, 133, 131, 124, 124, 129, 128, 128, 134, 123, 131, 133, 126, 124, 133, 129, 128, 121, 116, 138, 126, 131, 123, 133, 137, 121, 129, 124, 127, 123, 125, 135, 135, 131, 123, 127, 124, 127, 123, 126, 120, 124, 121, 127, 123, 124, 128, 128, 126, 121, 133, 126, 130, 126, 128, 131, 127, 118, 121, 127, 125, 118, 120, 131, 126, 131, 133, 124, 125, 115, 131, 129, 127, 130, 125, 124, 131, 137, 133, 133, 130, 135, 130, 132, 134, 120, 130, 126, 133, 129, 109, 128, 122, 131, 126, 130, 126, 133, 120, 125, 128, 131, 128, 139, 124, 126, 124, 124, 123, 124, 124, 125, 121, 131, 126, 137, 129, 127, 129, 129, 121, 127, 121, 124, 128, 119, 115, 136, 122, 134, 133, 133, 128, 121, 138, 117, 129, 122, 122, 144, 123, 124, 121, 126, 126, 134, 120, 126, 131, 122, 119, 135, 132, 123, 122, 123, 116, 130, 117, 132, 128, 134, 128, 132, 119, 131, 136, 124, 122, 127, 131, 122, 117, 128, 113, 137, 130, 121, 126, 123, 123, 121, 137, 126, 124, 134, 122, 126, 113, 141, 124, 123, 138, 128, 125, 107, 138, 133, 127, 118, 122, 122, 132, 130, 116, 143, 141, 128, 121, 130, 118, 117, 127, 122, 131, 131, 125, 123, 129, 123, 127, 124, 131, 133, 129, 130, 117, 140, 123, 124, 129, 129, 136, 125, 135, 131, 123, 123, 135, 119, 119, 132, 116, 126, 128, 132, 123, 135, 125, 112, 127, 131, 124, 128, 123, 135, 133, 131, 114, 139, 126, 136, 122, 118, 121, 137, 116, 131, 123, 127, 143, 135, 119, 127, 130, 141, 120, 134, 124, 130, 120, 130, 119, 136, 119, 123, 130, 142, 129, 135, 113, 143, 130, 150, 111, 110, 140, 137, 126, 121, 140, 141, 171, 97, 128, 136, 131, 123, 117, 114, 123, 126, 108, 123, 125, 126, 120, 125, 122, 118, 124, 121, 117, 122, 133, 128, 137, 133, 119, 130, 146, 120, 122, 108, 129, 139, 114, 115, 133, 136, 103, 125, 130, 145, 111, 110, 132, 150, 115, 101, 139, 131, 120, 112, 129, 133, 130, 134, 127, 142, 127, 124, 129, 136, 132, 111, 133, 122, 126, 130, 117, 118, 143, 135, 115, 132, 139, 139, 127, 123, 118, 139, 133, 113, 104, 132, 130, 99, 111, 124, 115, 109, 111, 120, 123, 126, 120, 116, 139, 126, 122, 124, 131, 135, 129, 149, 151, 160, 151, 174, 168, 173, 172, 179, 175, 171, 169, 148, 155, 152, 133, 117, 128, 119, 114, 116, 106, 102, 117, 103, 98, 106, 107, 86, 101, 97, 83, 92, 76, 74, 75, 76, 67, 75, 73, 77, 78, 70, 63, 81, 137, 109, 110, 163, 186, 168, 170, 203, 193, 188, 181, 196, 182, 170, 158, 154, 147, 122, 123, 125, 116, 108, 111, 120, 117, 121, 124, 133, 132, 136, 140, 145, 143, 141, 143, 140, 135, 131, 130, 127, 126, 123, 122, 123, 121, 122, 122, 121, 119, 120, 118, 118, 117, 115, 113, 113, 113, 109, 107, 106, 105, 98, 93, 90, 82, 77, 75, 71, 63, 62, 59, 50, 60, 78, 103, 133, 129, 166, 196, 195, 196, 215, 208, 202, 208, 202, 185, 177, 167, 149, 139, 125, 117, 117, 111, 106, 110, 114, 115, 122, 128, 130, 129, 136, 133, 133, 130, 131, 131, 127, 123, 125, 125, 123, 126, 125, 128, 131, 133, 132, 133, 134, 134, 133, 135, 135, 134, 133, 133, 132, 131, 128, 126, 124, 119, 113, 106, 104, 96, 90, 87, 82, 78, 78, 74, 76, 78, 74, 73, 74, 75, 92, 93, 99, 150, 143, 152, 176, 197, 177, 204, 210, 200, 193, 196, 193, 172, 159, 149, 144, 123, 113, 114, 104, 99, 106, 115, 111, 116, 126, 128, 130, 131, 135, 134, 131, 129, 130, 127, 123, 122, 123, 120, 120, 123, 127, 126, 131, 134, 135, 135, 137, 137, 136, 136, 135, 135, 134, 135, 133, 132, 131, 130, 125, 122, 119, 112, 103, 98, 91, 85, 80, 78, 77, 74, 82, 78, 77, 83, 83, 76, 82, 94, 91, 107, 120, 147, 144, 163, 186, 193, 186, 211, 220, 203, 201, 206, 198, 175, 164, 155, 134, 122, 117, 110, 98, 98, 103, 101, 102, 111, 116, 120, 129, 132, 134, 133, 134, 134, 131, 129, 130, 127, 125, 125, 125, 123, 124, 124, 131, 130, 131, 134, 136, 133, 135, 136, 133, 133, 135, 135, 131, 134, 133, 131, 129, 130, 126, 122, 122, 118, 110, 106, 104, 97, 90, 89, 90, 85, 87, 89, 89, 81, 88, 85, 81, 88, 93, 93, 97, 123, 123, 141, 151, 170, 173, 189, 195, 204, 203, 198, 201, 189, 178, 167, 160, 141, 133, 121, 114, 105, 102, 101, 103, 103, 109, 114, 118, 123, 126, 130, 131, 133, 133, 132, 131, 130, 128, 126, 126, 125, 125, 124, 125, 127, 129, 130, 133, 133, 133, 133, 135, 133, 132, 132, 133, 132, 131, 132, 132, 130, 130, 131, 128, 124, 124, 121, 114, 108, 107, 101, 93, 89, 91, 88, 85, 89, 90, 84, 85, 87, 83, 82, 90, 91, 94, 116, 126, 138, 145, 165, 173, 187, 192, 201, 203, 199, 199, 195, 179, 171, 161, 148, 137, 125, 115, 108, 103, 100, 103, 102, 103, 111, 115, 119, 122, 128, 128, 130, 133, 132, 133, 131, 130, 129, 128, 126, 126, 125, 125, 125, 126, 128, 130, 129, 132, 133, 133, 133, 133, 133, 132, 132, 133, 133, 131, 132, 132, 130, 129, 129, 128, 123, 123, 119, 112, 109, 105, 96, 95, 92, 91, 88, 89, 89, 89, 91, 92, 93, 93, 96, 98, 95, 99, 105, 122, 115, 138, 142, 155, 164, 181, 181, 193, 191, 195, 198, 189, 183, 178, 167, 152, 148, 135, 125, 114, 112, 105, 101, 101, 104, 104, 109, 115, 119, 121, 127, 132, 133, 134, 134, 135, 135, 132, 131, 132, 130, 128, 128, 125, 125, 126, 127, 128, 130, 130, 131, 132, 131, 132, 131, 131, 131, 131, 130, 130, 130, 129, 128, 127, 127, 125, 123, 122, 117, 114, 112, 108, 103, 102, 102, 99, 98, 101, 102, 100, 102, 104, 103, 101, 96, 104, 95, 96, 104, 97, 99, 130, 120, 123, 156, 151, 152, 172, 181, 181, 185, 194, 196, 186, 179, 186, 169, 151, 153, 138, 122, 121, 120, 104, 100, 112, 110, 104, 112, 119, 117, 120, 125, 127, 124, 129, 132, 129, 128, 131, 129, 127, 128, 129, 124, 125, 127, 128, 125, 130, 130, 129, 131, 133, 131, 131, 134, 132, 132, 132, 132, 129, 131, 130, 128, 127, 127, 124, 122, 119, 115, 112, 109, 106, 104, 102, 102, 100, 101, 102, 102, 102, 107, 106, 105, 110, 105, 106, 100, 105, 101, 98, 90, 93, 139, 68, 143, 153, 135, 155, 185, 175, 180, 194, 194, 195, 171, 198, 190, 155, 157, 159, 135, 130, 126, 123, 101, 108, 114, 102, 98, 113, 115, 109, 116, 127, 124, 123, 134, 131, 127, 130, 133, 128, 128, 131, 128, 124, 126, 129, 125, 125, 131, 131, 128, 131, 133, 130, 132, 134, 131, 130, 132, 131, 128, 130, 128, 126, 126, 128, 122, 122, 123, 118, 114, 116, 113, 110, 109, 109, 108, 109, 110, 112, 107, 111, 113, 107, 107, 111, 103, 103, 102, 92, 96, 91, 93, 85, 114, 118, 83, 155, 139, 147, 152, 179, 177, 180, 190, 196, 197, 172, 193, 182, 154, 159, 148, 132, 120, 129, 109, 97, 109, 108, 100, 101, 113, 111, 113, 121, 125, 124, 126, 133, 130, 129, 132, 133, 126, 127, 129, 126, 124, 126, 128, 127, 127, 132, 130, 128, 133, 134, 129, 131, 134, 131, 130, 131, 131, 128, 129, 129, 127, 126, 127, 126, 124, 122, 123, 118, 116, 117, 114, 109, 110, 112, 107, 109, 112, 110, 109, 111, 110, 109, 108, 109, 107, 105, 102, 100, 100, 95, 100, 86, 114, 118, 94, 157, 136, 139, 157, 179, 174, 182, 197, 196, 193, 182, 194, 173, 159, 155, 149, 128, 122, 124, 112, 103, 110, 106, 105, 106, 113, 114, 115, 121, 124, 124, 125, 130, 129, 128, 129, 131, 126, 127, 128, 126, 125, 127, 128, 125, 128, 130, 129, 128, 131, 131, 130, 131, 132, 130, 129, 130, 129, 127, 127, 127, 127, 126, 126, 127, 125, 123, 124, 122, 119, 118, 118, 115, 113, 113, 114, 111, 112, 112, 111, 112, 111, 112, 112, 107, 108, 105, 103, 101, 99, 95, 96, 93, 87, 106, 134, 93, 132, 152, 142, 150, 176, 179, 175, 188, 199, 195, 181, 187, 188, 161, 160, 156, 142, 123, 127, 129, 105, 111, 112, 107, 104, 113, 117, 113, 118, 123, 124, 123, 126, 127, 126, 128, 130, 125, 126, 128, 125, 125, 125, 126, 127, 126, 129, 130, 129, 130, 132, 131, 131, 132, 131, 130, 129, 129, 128, 127, 127, 127, 127, 126, 127, 126, 126, 124, 123, 124, 121, 118, 119, 117, 116, 117, 118, 116, 117, 119, 119, 119, 119, 118, 121, 114, 115, 116, 107, 108, 103, 96, 94, 91, 88, 87, 96, 118, 87, 122, 138, 130, 146, 163, 169, 170, 184, 189, 191, 177, 189, 187, 160, 159, 155, 138, 127, 128, 123, 106, 113, 112, 110, 109, 113, 117, 116, 118, 121, 122, 119, 126, 127, 123, 125, 128, 126, 125, 128, 129, 126, 128, 130, 128, 128, 131, 130, 129, 130, 131, 130, 130, 131, 130, 129, 128, 128, 127, 126, 126, 126, 125, 125, 127, 126, 126, 126, 126, 124, 123, 124, 121, 119, 118, 120, 116, 116, 118, 116, 115, 119, 120, 116, 118, 119, 119, 119, 116, 117, 113, 111, 108, 102, 97, 100, 94, 86, 106, 112, 101, 116, 134, 130, 136, 156, 161, 161, 174, 184, 181, 179, 179, 180, 163, 157, 162, 144, 132, 132, 130, 115, 116, 118, 114, 111, 114, 117, 115, 118, 120, 124, 120, 123, 127, 125, 124, 127, 127, 125, 126, 129, 127, 127, 127, 129, 128, 127, 129, 130, 129, 130, 131, 130, 130, 131, 130, 129, 129, 128, 128, 126, 126, 126, 125, 125, 126, 126, 125, 126, 126, 125, 125, 124, 124, 121, 121, 121, 119, 117, 119, 120, 115, 119, 119, 119, 120, 121, 124, 122, 121, 124, 120, 117, 119, 115, 109, 110, 105, 101, 97, 95, 95, 111, 103, 102, 132, 122, 140, 146, 156, 158, 167, 179, 174, 176, 175, 173, 166, 157, 156, 144, 137, 133, 130, 119, 119, 119, 116, 115, 116, 120, 117, 119, 122, 121, 122, 122, 125, 122, 122, 125, 124, 124, 125, 125, 125, 125, 126, 127, 127, 126, 131, 129, 129, 130, 131, 130, 132, 130, 130, 130, 129, 129, 128, 128, 127, 127, 126, 127, 126, 126, 126, 127, 126, 126, 126, 126, 124, 125, 124, 122, 122, 123, 122, 121, 121, 122, 120, 120, 122, 122, 119, 123, 121, 120, 121, 120, 118, 117, 115, 115, 115, 107, 109, 105, 100, 109, 119, 115, 106, 138, 128, 135, 144, 152, 156, 155, 166, 169, 164, 166, 170, 166, 152, 159, 152, 141, 138, 137, 130, 123, 124, 123, 119, 117, 121, 119, 117, 122, 123, 120, 119, 124, 123, 121, 124, 124, 122, 121, 124, 122, 119, 123, 121, 122, 122, 124, 123, 124, 124, 126, 127, 127, 126, 129, 127, 127, 129, 130, 127, 128, 128, 126, 126, 127, 125, 124, 124, 123, 122, 122, 120, 120, 120, 120, 120, 119, 120, 122, 119, 122, 122, 121, 121, 120, 119, 119, 116, 116, 116, 109, 110, 113, 106, 104, 111, 123, 115, 115, 141, 124, 135, 147, 152, 153, 155, 170, 170, 165, 166, 171, 158, 157, 159, 148, 139, 136, 134, 127, 123, 125, 120, 119, 118, 122, 118, 117, 123, 122, 119, 121, 125, 121, 121, 124, 122, 120, 121, 124, 121, 120, 123, 120, 121, 123, 124, 122, 123, 125, 126, 126, 126, 128, 129, 126, 129, 130, 130, 128, 130, 129, 125, 127, 125, 126, 124, 124, 121, 122, 120, 119, 118, 117, 119, 118, 117, 119, 119, 120, 120, 121, 121, 121, 122, 123, 122, 123, 124, 123, 124, 123, 124, 124, 124, 123, 127, 126, 126, 129, 129, 131, 130, 134, 134, 134, 136, 136, 138, 137, 139, 139, 140, 139, 139, 141, 137, 139, 139, 139, 137, 137, 137, 135, 134, 134, 131, 132, 128, 128, 128, 127, 124, 124, 125, 122, 122, 122, 121, 120, 120, 120, 119, 120, 121, 121, 120, 121, 122, 122, 123, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 126, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 128, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 127, 126, 127, 127, 127, 127, 126, }; const uint8_t drogue[8162] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 129, 131, 135, 139, 141, 143, 145, 147, 148, 149, 150, 150, 150, 149, 147, 146, 144, 142, 140, 138, 136, 134, 132, 129, 128, 125, 123, 121, 119, 117, 116, 115, 114, 113, 113, 113, 114, 115, 116, 117, 119, 120, 122, 124, 125, 126, 128, 129, 130, 130, 131, 131, 131, 130, 130, 129, 128, 127, 126, 125, 124, 123, 122, 120, 119, 119, 118, 117, 117, 117, 117, 117, 118, 119, 119, 120, 121, 122, 123, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 130, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 138, 138, 138, 138, 138, 138, 137, 136, 136, 134, 133, 132, 131, 129, 128, 126, 124, 123, 121, 121, 120, 119, 119, 119, 119, 119, 120, 121, 122, 123, 124, 124, 125, 126, 127, 127, 127, 128, 127, 127, 127, 126, 126, 125, 124, 123, 122, 121, 120, 119, 118, 118, 117, 117, 117, 118, 118, 119, 120, 121, 121, 122, 123, 124, 125, 125, 126, 127, 127, 127, 128, 128, 129, 130, 130, 131, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 138, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 137, 136, 135, 133, 132, 130, 129, 127, 125, 123, 121, 120, 119, 118, 117, 116, 116, 115, 115, 115, 115, 115, 115, 116, 116, 116, 117, 118, 119, 120, 121, 123, 123, 124, 124, 122, 120, 118, 117, 118, 119, 120, 121, 123, 124, 124, 125, 126, 127, 127, 127, 127, 127, 126, 126, 125, 125, 125, 125, 127, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 129, 129, 128, 127, 126, 125, 124, 123, 123, 122, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 125, 125, 126, 127, 127, 127, 128, 128, 128, 128, 128, 127, 127, 127, 126, 126, 127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 130, 129, 129, 128, 129, 130, 131, 130, 134, 155, 112, 137, 125, 133, 127, 121, 125, 122, 123, 115, 124, 118, 146, 137, 136, 129, 123, 136, 130, 111, 110, 133, 110, 116, 104, 119, 116, 122, 121, 116, 127, 126, 124, 121, 129, 126, 127, 130, 123, 128, 131, 135, 123, 123, 129, 130, 127, 125, 125, 136, 131, 133, 136, 134, 137, 131, 131, 128, 128, 132, 125, 122, 123, 125, 129, 128, 126, 126, 136, 133, 131, 136, 135, 139, 134, 134, 131, 133, 133, 125, 121, 120, 118, 119, 113, 110, 114, 116, 117, 115, 115, 126, 129, 131, 132, 132, 129, 129, 128, 121, 122, 120, 118, 117, 115, 118, 116, 118, 116, 120, 123, 124, 126, 127, 129, 129, 132, 132, 132, 132, 133, 132, 132, 130, 128, 127, 128, 130, 137, 142, 148, 152, 160, 165, 169, 170, 170, 171, 170, 165, 159, 152, 144, 138, 129, 120, 112, 107, 100, 97, 96, 96, 96, 97, 102, 102, 103, 101, 103, 98, 94, 92, 85, 81, 81, 81, 80, 81, 88, 92, 99, 101, 101, 96, 105, 104, 104, 114, 124, 146, 160, 180, 183, 191, 197, 198, 196, 189, 183, 173, 164, 149, 134, 123, 120, 115, 112, 111, 116, 121, 130, 135, 138, 142, 144, 143, 137, 132, 125, 120, 115, 110, 110, 113, 119, 125, 130, 134, 146, 153, 150, 148, 150, 144, 136, 132, 122, 113, 114, 112, 105, 104, 109, 109, 108, 112, 111, 112, 112, 107, 96, 89, 88, 84, 76, 74, 74, 76, 79, 88, 88, 88, 114, 129, 140, 178, 192, 193, 198, 209, 206, 190, 187, 175, 160, 152, 144, 122, 108, 113, 113, 107, 111, 118, 123, 136, 150, 155, 153, 156, 158, 149, 140, 135, 127, 120, 122, 121, 114, 115, 120, 125, 132, 134, 135, 134, 139, 139, 131, 126, 120, 118, 116, 116, 111, 105, 107, 109, 112, 111, 108, 108, 110, 111, 103, 99, 94, 91, 90, 85, 84, 85, 86, 89, 92, 96, 103, 120, 131, 149, 185, 196, 199, 199, 201, 199, 188, 180, 164, 142, 136, 129, 122, 112, 109, 114, 116, 127, 134, 139, 143, 149, 154, 154, 148, 144, 139, 130, 124, 118, 111, 105, 104, 104, 105, 108, 110, 115, 118, 121, 124, 124, 125, 124, 124, 122, 118, 114, 111, 110, 109, 108, 109, 109, 110, 113, 113, 113, 113, 113, 114, 114, 114, 121, 128, 137, 151, 156, 159, 158, 159, 163, 164, 164, 162, 156, 151, 147, 145, 141, 137, 134, 131, 129, 129, 131, 132, 132, 133, 133, 133, 134, 133, 132, 131, 127, 125, 122, 120, 119, 118, 118, 118, 119, 120, 121, 123, 126, 127, 127, 128, 128, 127, 127, 126, 125, 124, 123, 122, 123, 123, 124, 125, 126, 127, 127, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 125, 124, 124, 123, 122, 121, 120, 119, 119, 119, 119, 119, 120, 120, 120, 121, 122, 122, 123, 123, 124, 125, 125, 125, 126, 126, 127, 127, 128, 128, 129, 130, 131, 132, 133, 133, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 132, 132, 132, 131, 130, 129, 128, 128, 127, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 125, 124, 124, 124, 124, 124, 123, 123, 124, 124, 125, 125, 125, 125, 149, 137, 125, 138, 130, 129, 134, 154, 138, 125, 123, 136, 145, 123, 115, 114, 117, 114, 117, 135, 123, 124, 114, 130, 128, 130, 133, 130, 133, 131, 131, 134, 124, 125, 113, 118, 116, 113, 114, 114, 120, 121, 121, 124, 119, 128, 124, 133, 132, 127, 126, 126, 129, 127, 124, 123, 127, 125, 122, 124, 122, 126, 131, 128, 127, 128, 126, 130, 128, 129, 132, 127, 131, 132, 132, 136, 131, 127, 126, 130, 130, 129, 127, 125, 124, 130, 125, 130, 124, 129, 122, 127, 127, 122, 122, 122, 126, 120, 128, 127, 126, 129, 130, 129, 129, 125, 126, 129, 128, 127, 135, 132, 133, 126, 131, 126, 134, 128, 127, 127, 127, 123, 128, 124, 136, 124, 133, 130, 127, 120, 123, 121, 129, 131, 130, 126, 132, 127, 132, 128, 131, 126, 119, 121, 120, 132, 129, 131, 132, 128, 127, 120, 128, 125, 125, 129, 123, 131, 129, 120, 124, 124, 126, 122, 125, 121, 123, 130, 124, 133, 128, 133, 126, 127, 130, 125, 129, 126, 124, 131, 126, 132, 125, 127, 121, 127, 127, 127, 125, 127, 127, 123, 123, 121, 129, 122, 133, 126, 127, 122, 124, 126, 123, 127, 128, 127, 129, 122, 127, 124, 129, 128, 129, 132, 127, 127, 124, 131, 124, 130, 125, 127, 124, 124, 116, 121, 125, 125, 129, 133, 130, 131, 131, 133, 133, 127, 131, 128, 119, 128, 119, 124, 124, 124, 122, 128, 125, 125, 127, 130, 131, 133, 128, 128, 133, 127, 128, 128, 127, 126, 128, 125, 130, 128, 131, 128, 130, 129, 124, 125, 130, 126, 130, 131, 134, 134, 129, 130, 121, 123, 126, 129, 122, 125, 124, 128, 129, 123, 131, 121, 124, 123, 124, 126, 127, 130, 127, 129, 123, 130, 127, 136, 126, 133, 126, 127, 126, 125, 126, 128, 130, 117, 129, 118, 119, 126, 127, 129, 127, 133, 131, 130, 128, 133, 126, 128, 130, 131, 129, 125, 120, 122, 121, 125, 128, 124, 124, 125, 127, 130, 129, 135, 134, 136, 127, 124, 124, 121, 126, 125, 127, 128, 128, 127, 129, 132, 131, 132, 125, 124, 123, 127, 118, 125, 129, 125, 131, 134, 128, 129, 123, 123, 121, 122, 123, 123, 121, 123, 129, 127, 137, 130, 138, 142, 138, 140, 141, 141, 137, 141, 139, 132, 128, 132, 135, 137, 135, 137, 137, 137, 136, 136, 139, 141, 137, 131, 125, 119, 115, 114, 108, 115, 108, 110, 117, 116, 122, 120, 124, 121, 123, 122, 118, 123, 113, 113, 111, 103, 100, 101, 99, 102, 105, 114, 118, 120, 120, 122, 116, 115, 108, 102, 105, 109, 124, 143, 161, 169, 177, 178, 176, 177, 176, 173, 171, 166, 158, 148, 136, 130, 121, 117, 116, 117, 121, 126, 132, 138, 143, 145, 145, 143, 136, 127, 115, 106, 102, 95, 92, 93, 95, 100, 107, 113, 118, 121, 123, 120, 116, 112, 106, 100, 97, 91, 83, 79, 78, 76, 79, 83, 85, 87, 88, 83, 91, 108, 136, 168, 185, 197, 202, 197, 187, 174, 161, 153, 149, 150, 146, 142, 136, 128, 124, 118, 119, 119, 125, 128, 133, 136, 136, 136, 135, 135, 133, 134, 132, 130, 129, 127, 126, 126, 128, 129, 130, 130, 130, 128, 126, 124, 122, 119, 117, 116, 116, 116, 118, 119, 120, 123, 122, 120, 117, 112, 106, 101, 98, 91, 86, 81, 79, 76, 79, 79, 81, 84, 82, 79, 82, 102, 123, 160, 182, 197, 203, 201, 192, 176, 164, 154, 151, 148, 147, 144, 139, 132, 125, 119, 119, 119, 123, 127, 131, 134, 135, 136, 135, 135, 134, 135, 133, 132, 131, 128, 126, 125, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 127, 127, 127, 125, 124, 122, 119, 117, 112, 106, 101, 96, 91, 84, 82, 81, 79, 77, 75, 74, 69, 63, 57, 87, 109, 140, 196, 215, 221, 221, 207, 174, 155, 139, 129, 127, 130, 130, 128, 123, 114, 115, 113, 120, 131, 139, 147, 152, 151, 146, 141, 134, 130, 127, 127, 125, 125, 123, 123, 122, 123, 125, 126, 129, 130, 130, 130, 129, 129, 129, 129, 128, 128, 128, 127, 127, 127, 126, 125, 124, 122, 118, 116, 111, 105, 99, 96, 90, 85, 82, 81, 80, 77, 75, 74, 73, 63, 57, 87, 97, 140, 196, 215, 220, 221, 207, 174, 161, 139, 129, 127, 129, 130, 128, 123, 116, 115, 113, 120, 127, 139, 147, 152, 152, 146, 141, 134, 131, 127, 127, 125, 124, 124, 123, 122, 123, 125, 127, 129, 130, 130, 130, 129, 129, 129, 129, 128, 128, 128, 128, 127, 127, 126, 125, 124, 122, 121, 117, 112, 107, 104, 97, 92, 86, 85, 82, 81, 78, 77, 74, 73, 65, 61, 60, 91, 123, 183, 203, 218, 221, 213, 197, 168, 147, 129, 128, 127, 131, 128, 128, 120, 113, 114, 114, 124, 135, 146, 149, 152, 148, 143, 139, 132, 128, 127, 126, 124, 125, 123, 122, 122, 124, 125, 128, 129, 129, 130, 129, 129, 129, 129, 128, 128, 128, 127, 127, 127, 126, 125, 124, 122, 119, 116, 111, 107, 102, 96, 90, 85, 83, 81, 80, 78, 76, 74, 73, 65, 59, 75, 97, 123, 183, 210, 221, 222, 214, 184, 161, 138, 127, 125, 127, 129, 126, 126, 115, 113, 112, 116, 129, 144, 152, 157, 159, 151, 146, 137, 129, 123, 121, 120, 119, 119, 118, 118, 119, 123, 125, 131, 135, 137, 138, 136, 134, 131, 131, 128, 128, 128, 128, 129, 129, 127, 124, 122, 118, 114, 109, 107, 101, 97, 93, 90, 89, 87, 87, 83, 76, 68, 56, 51, 44, 87, 109, 140, 196, 215, 221, 222, 208, 175, 155, 138, 127, 125, 128, 127, 125, 121, 111, 113, 112, 121, 134, 150, 155, 160, 157, 148, 142, 131, 124, 118, 118, 114, 114, 112, 113, 116, 122, 132, 139, 149, 154, 154, 151, 142, 133, 124, 119, 116, 114, 115, 115, 117, 117, 118, 117, 117, 116, 113, 110, 106, 101, 95, 89, 86, 82, 81, 80, 79, 77, 77, 80, 104, 138, 166, 203, 231, 230, 223, 199, 168, 140, 128, 115, 114, 111, 114, 108, 110, 112, 116, 128, 142, 157, 163, 165, 159, 147, 137, 122, 112, 107, 104, 105, 105, 108, 114, 121, 133, 147, 159, 166, 169, 163, 151, 141, 127, 116, 110, 108, 111, 112, 115, 116, 116, 118, 118, 117, 117, 114, 111, 108, 102, 96, 90, 87, 82, 81, 78, 77, 77, 78, 84, 103, 132, 174, 212, 234, 238, 224, 194, 162, 137, 116, 104, 107, 108, 112, 112, 110, 114, 121, 133, 151, 158, 169, 169, 160, 149, 132, 115, 103, 100, 99, 101, 104, 108, 114, 122, 135, 145, 159, 168, 171, 167, 153, 138, 123, 113, 110, 108, 110, 113, 113, 115, 118, 120, 121, 123, 122, 120, 116, 108, 100, 94, 90, 86, 86, 84, 83, 81, 74, 73, 78, 86, 123, 162, 198, 235, 242, 227, 209, 169, 136, 112, 104, 102, 113, 113, 113, 115, 113, 121, 136, 146, 162, 173, 170, 161, 146, 126, 110, 105, 99, 100, 103, 105, 108, 113, 122, 130, 145, 160, 168, 170, 164, 151, 135, 126, 114, 111, 111, 112, 115, 118, 118, 121, 122, 123, 125, 124, 122, 116, 110, 98, 93, 88, 81, 81, 82, 81, 81, 82, 82, 84, 92, 123, 153, 189, 230, 239, 233, 208, 167, 128, 109, 100, 102, 112, 117, 118, 115, 115, 117, 133, 150, 167, 174, 172, 156, 135, 117, 105, 99, 101, 105, 110, 114, 116, 119, 124, 134, 146, 162, 168, 169, 163, 148, 137, 122, 114, 110, 112, 116, 118, 122, 121, 121, 125, 126, 125, 124, 120, 112, 107, 99, 89, 84, 82, 82, 84, 85, 82, 80, 78, 77, 88, 109, 155, 194, 236, 243, 230, 202, 159, 130, 108, 101, 107, 112, 120, 117, 114, 115, 121, 138, 158, 168, 174, 167, 149, 134, 116, 105, 102, 107, 108, 112, 114, 116, 119, 128, 139, 151, 160, 166, 164, 156, 147, 134, 123, 116, 113, 115, 116, 117, 120, 121, 122, 126, 126, 126, 123, 118, 112, 104, 96, 88, 84, 82, 82, 85, 85, 82, 80, 78, 82, 88, 123, 169, 211, 236, 240, 220, 189, 158, 108, 102, 105, 112, 121, 119, 115, 117, 122, 132, 151, 166, 171, 167, 153, 133, 116, 109, 102, 106, 109, 111, 116, 119, 125, 131, 141, 152, 158, 159, 156, 150, 142, 135, 128, 122, 117, 116, 113, 113, 116, 121, 125, 129, 130, 126, 122, 115, 104, 97, 92, 84, 82, 81, 84, 87, 89, 84, 79, 76, 76, 90, 122, 181, 221, 254, 246, 214, 167, 128, 107, 100, 116, 119, 121, 124, 111, 108, 113, 129, 153, 172, 181, 169, 154, 126, 107, 100, 104, 110, 120, 125, 127, 124, 128, 129, 137, 147, 152, 151, 147, 139, 129, 125, 123, 123, 125, 126, 127, 122, 122, 121, 121, 123, 123, 121, 114, 106, 94, 90, 90, 90, 93, 95, 92, 84, 78, 74, 75, 81, 98, 123, 165, 204, 234, 233, 217, 179, 146, 129, 123, 120, 131, 117, 114, 102, 102, 111, 127, 154, 167, 171, 166, 146, 132, 121, 117, 114, 118, 119, 117, 119, 121, 125, 135, 139, 145, 146, 145, 142, 138, 133, 129, 128, 126, 124, 124, 125, 124, 124, 123, 123, 123, 122, 120, 115, 108, 98, 90, 90, 89, 91, 94, 94, 87, 80, 76, 73, 78, 93, 111, 165, 195, 222, 237, 217, 194, 155, 132, 124, 118, 131, 121, 113, 105, 100, 106, 129, 150, 169, 171, 162, 147, 130, 119, 119, 120, 123, 125, 115, 113, 115, 122, 136, 144, 154, 149, 141, 135, 127, 130, 134, 137, 134, 127, 115, 111, 116, 124, 134, 137, 133, 121, 106, 98, 97, 99, 97, 92, 86, 77, 76, 80, 85, 88, 90, 88, 89, 105, 129, 192, 214, 233, 216, 190, 162, 140, 142, 138, 134, 124, 101, 87, 93, 112, 133, 163, 169, 165, 150, 138, 135, 132, 135, 130, 118, 112, 106, 109, 120, 130, 141, 143, 143, 140, 135, 134, 134, 135, 135, 134, 130, 126, 120, 117, 121, 125, 132, 134, 128, 116, 107, 99, 96, 97, 97, 93, 83, 78, 77, 80, 87, 90, 90, 88, 95, 111, 129, 192, 219, 231, 215, 189, 150, 141, 143, 140, 133, 114, 99, 85, 92, 122, 136, 163, 166, 155, 144, 136, 140, 142, 142, 132, 113, 101, 103, 114, 131, 145, 142, 135, 124, 127, 138, 145, 143, 136, 125, 120, 125, 130, 134, 132, 125, 120, 115, 114, 114, 110, 102, 94, 89, 88, 90, 90, 89, 86, 84, 84, 85, 86, 92, 103, 119, 142, 197, 217, 223, 204, 185, 153, 153, 151, 143, 121, 101, 90, 89, 112, 135, 148, 149, 149, 145, 142, 147, 150, 141, 130, 123, 116, 116, 126, 130, 130, 128, 127, 125, 124, 131, 133, 134, 136, 136, 131, 131, 133, 134, 133, 133, 126, 115, 109, 102, 99, 93, 88, 80, 79, 83, 85, 86, 86, 88, 85, 87, 92, 110, 133, 159, 175, 188, 204, 201, 194, 174, 160, 149, 139, 128, 116, 114, 109, 114, 120, 128, 133, 141, 148, 150, 149, 149, 141, 136, 132, 131, 128, 128, 123, 121, 121, 121, 123, 123, 124, 126, 129, 132, 131, 132, 129, 130, 130, 127, 124, 122, 115, 107, 100, 93, 82, 77, 76, 78, 80, 83, 82, 82, 85, 93, 111, 134, 142, 170, 190, 205, 201, 196, 180, 162, 155, 144, 130, 120, 117, 112, 109, 118, 121, 135, 143, 152, 153, 150, 148, 143, 139, 130, 126, 120, 116, 117, 123, 128, 132, 137, 139, 134, 132, 134, 129, 124, 122, 116, 111, 112, 117, 115, 116, 117, 113, 114, 113, 109, 98, 93, 88, 82, 82, 79, 78, 81, 88, 88, 80, 139, 215, 235, 220, 189, 163, 141, 137, 156, 130, 107, 95, 108, 117, 124, 148, 144, 136, 151, 161, 162, 157, 148, 133, 117, 122, 130, 130, 125, 126, 123, 125, 133, 137, 136, 129, 124, 122, 123, 125, 123, 117, 107, 106, 108, 109, 110, 104, 97, 92, 91, 92, 91, 90, 83, 86, 91, 93, 81, 89, 133, 197, 212, 187, 171, 169, 164, 170, 159, 122, 100, 116, 135, 132, 123, 121, 125, 142, 160, 162, 149, 137, 142, 147, 147, 141, 129, 120, 123, 129, 125, 119, 116, 120, 129, 135, 129, 124, 123, 124, 117, 114, 108, 102, 101, 101, 93, 83, 87, 92, 97, 97, 98, 100, 102, 109, 94, 81, 100, 169, 197, 173, 152, 171, 189, 182, 154, 137, 125, 138, 149, 129, 103, 103, 139, 145, 133, 132, 138, 154, 159, 149, 139, 137, 144, 137, 123, 110, 112, 118, 117, 116, 118, 125, 130, 122, 118, 117, 120, 117, 107, 98, 92, 92, 90, 86, 84, 89, 95, 101, 103, 108, 105, 95, 107, 163, 190, 163, 151, 189, 207, 173, 138, 146, 148, 147, 134, 119, 121, 126, 136, 122, 123, 136, 153, 153, 148, 152, 152, 150, 140, 129, 121, 121, 116, 111, 110, 116, 119, 120, 117, 116, 117, 116, 112, 105, 104, 105, 105, 95, 93, 96, 100, 97, 91, 93, 97, 95, 89, 81, 93, 148, 173, 153, 154, 195, 207, 167, 156, 169, 163, 136, 129, 131, 129, 125, 124, 122, 132, 144, 142, 139, 144, 148, 146, 138, 138, 134, 130, 123, 115, 109, 106, 106, 106, 105, 106, 111, 117, 113, 113, 115, 110, 101, 102, 104, 97, 92, 97, 94, 93, 98, 98, 92, 102, 152, 162, 153, 165, 200, 198, 174, 169, 179, 166, 151, 134, 136, 131, 126, 119, 122, 131, 133, 132, 137, 150, 144, 138, 137, 139, 129, 121, 116, 111, 105, 103, 101, 104, 106, 108, 108, 110, 111, 109, 108, 105, 102, 99, 97, 95, 95, 98, 96, 98, 99, 93, 99, 136, 161, 164, 163, 194, 211, 194, 181, 181, 181, 156, 140, 139, 137, 119, 113, 118, 128, 128, 125, 139, 152, 147, 144, 146, 144, 131, 122, 116, 110, 105, 99, 95, 104, 107, 105, 107, 115, 110, 109, 112, 107, 105, 101, 99, 100, 101, 99, 100, 103, 103, 103, 100, 100, 100, 153, 169, 167, 165, 202, 210, 180, 175, 183, 178, 153, 142, 142, 135, 124, 118, 121, 123, 126, 130, 136, 141, 142, 140, 137, 134, 129, 117, 109, 107, 106, 101, 100, 103, 103, 108, 114, 111, 108, 113, 107, 103, 105, 107, 106, 104, 105, 96, 94, 104, 102, 93, 91, 123, 157, 162, 170, 188, 209, 204, 183, 187, 191, 177, 152, 153, 149, 133, 121, 118, 122, 121, 121, 126, 134, 138, 133, 130, 134, 133, 124, 118, 114, 113, 110, 106, 103, 105, 104, 102, 103, 101, 101, 103, 103, 101, 104, 113, 106, 98, 108, 110, 102, 102, 109, 105, 110, 135, 163, 185, 169, 190, 219, 205, 179, 187, 194, 162, 144, 145, 142, 122, 115, 120, 120, 125, 130, 133, 135, 140, 138, 134, 132, 129, 124, 116, 115, 111, 109, 106, 104, 105, 106, 104, 100, 104, 106, 108, 109, 105, 104, 113, 109, 108, 114, 116, 110, 107, 113, 104, 102, 116, 106, 172, 184, 167, 191, 222, 214, 166, 186, 191, 166, 142, 141, 137, 124, 126, 116, 115, 132, 139, 130, 129, 144, 147, 130, 128, 131, 125, 115, 112, 108, 107, 109, 106, 104, 113, 113, 108, 105, 110, 110, 110, 110, 109, 109, 117, 117, 118, 112, 115, 118, 119, 110, 110, 118, 123, 120, 194, 184, 167, 190, 226, 210, 166, 184, 180, 162, 141, 141, 132, 127, 129, 124, 127, 137, 139, 133, 135, 140, 139, 131, 128, 127, 124, 121, 121, 121, 123, 124, 126, 126, 126, 124, 119, 114, 109, 104, 96, 91, 88, 81, 77, 79, 82, 69, 76, 81, 72, 66, 102, 124, 105, 141, 172, 171, 157, 190, 188, 167, 170, 177, 165, 148, 151, 149, 142, 144, 142, 141, 141, 140, 138, 140, 136, 131, 131, 133, 127, 124, 127, 122, 121, 127, 127, 126, 130, 132, 129, 132, 132, 123, 120, 117, 108, 99, 95, 92, 82, 78, 75, 73, 71, 69, 65, 71, 72, 87, 111, 113, 133, 153, 165, 168, 188, 186, 180, 183, 188, 173, 166, 164, 157, 147, 147, 144, 137, 137, 135, 136, 133, 136, 134, 133, 132, 131, 129, 128, 128, 125, 125, 125, 126, 124, 126, 127, 127, 127, 128, 121, 120, 117, 110, 104, 96, 91, 83, 80, 74, 70, 67, 67, 62, 62, 64, 80, 96, 101, 126, 145, 155, 160, 181, 179, 184, 189, 193, 183, 184, 183, 170, 163, 159, 154, 143, 141, 135, 133, 133, 132, 129, 130, 130, 127, 126, 124, 124, 124, 124, 123, 124, 123, 122, 123, 124, 124, 125, 125, 124, 121, 118, 112, 107, 101, 92, 86, 82, 77, 72, 68, 65, 62, 60, 60, 74, 87, 98, 117, 137, 148, 158, 175, 181, 180, 189, 194, 189, 185, 186, 176, 168, 164, 158, 146, 142, 139, 134, 133, 133, 131, 129, 130, 127, 127, 125, 124, 124, 124, 123, 123, 124, 122, 122, 123, 124, 124, 124, 124, 122, 119, 116, 109, 103, 95, 90, 80, 77, 73, 67, 61, 60, 59, 57, 74, 85, 98, 116, 137, 146, 159, 174, 180, 184, 193, 196, 194, 195, 190, 183, 178, 172, 160, 150, 145, 139, 135, 134, 132, 129, 129, 127, 125, 124, 123, 121, 122, 121, 120, 122, 121, 120, 120, 121, 121, 122, 123, 122, 121, 118, 114, 109, 104, 96, 93, 88, 81, 76, 74, 68, 62, 58, 55, 58, 72, 83, 94, 116, 137, 150, 162, 177, 183, 194, 200, 203, 201, 201, 193, 190, 180, 169, 158, 152, 144, 137, 133, 130, 127, 125, 124, 121, 120, 119, 119, 119, 120, 120, 121, 121, 122, 123, 124, 124, 126, 127, 126, 125, 122, 117, 112, 108, 102, 95, 89, 86, 80, 73, 69, 62, 60, 57, 52, 56, 70, 86, 95, 116, 132, 145, 159, 177, 182, 190, 202, 208, 206, 206, 201, 195, 190, 178, 165, 155, 149, 139, 132, 126, 124, 123, 120, 117, 115, 115, 113, 112, 112, 113, 114, 114, 116, 117, 120, 124, 128, 129, 130, 130, 127, 124, 120, 113, 106, 101, 92, 86, 80, 75, 67, 63, 56, 54, 53, 50, 54, 68, 85, 95, 117, 135, 150, 163, 180, 187, 193, 202, 206, 202, 201, 197, 188, 180, 171, 158, 147, 138, 132, 127, 123, 119, 119, 117, 114, 112, 112, 112, 112, 113, 114, 116, 116, 118, 120, 122, 125, 129, 130, 131, 132, 130, 127, 122, 117, 109, 104, 96, 89, 83, 75, 69, 64, 58, 54, 53, 51, 50, 68, 81, 91, 109, 135, 147, 159, 176, 188, 191, 199, 205, 202, 199, 196, 187, 179, 173, 159, 147, 139, 132, 123, 121, 117, 115, 115, 114, 112, 111, 113, 113, 116, 119, 120, 123, 127, 130, 131, 134, 135, 137, 137, 137, 134, 130, 127, 122, 116, 109, 105, 96, 87, 79, 74, 67, 61, 56, 54, 52, 51, 50, 60, 81, 91, 109, 127, 147, 158, 175, 188, 191, 198, 204, 202, 198, 195, 188, 180, 173, 162, 151, 140, 135, 127, 123, 118, 117, 116, 114, 113, 113, 114, 116, 120, 122, 125, 130, 134, 136, 139, 141, 141, 141, 140, 136, 131, 126, 119, 111, 105, 96, 91, 83, 77, 72, 70, 66, 63, 65, 65, 66, 69, 70, 73, 91, 101, 107, 119, 142, 150, 155, 173, 189, 189, 192, 205, 202, 195, 193, 191, 179, 173, 169, 157, 144, 140, 133, 123, 118, 117, 114, 111, 112, 113, 113, 116, 121, 123, 127, 133, 137, 141, 144, 146, 146, 145, 144, 141, 135, 128, 123, 115, 107, 100, 94, 86, 79, 73, 71, 68, 64, 63, 64, 65, 65, 68, 70, 71, 84, 101, 106, 113, 135, 150, 152, 166, 186, 190, 190, 203, 206, 196, 195, 195, 184, 174, 170, 163, 148, 141, 133, 125, 118, 117, 112, 109, 110, 111, 111, 113, 118, 121, 126, 131, 136, 139, 145, 148, 149, 149, 149, 147, 143, 137, 130, 125, 116, 107, 99, 94, 85, 79, 75, 71, 69, 69, 68, 67, 68, 70, 71, 72, 74, 83, 97, 107, 112, 127, 144, 153, 160, 175, 183, 186, 191, 198, 193, 189, 190, 184, 174, 169, 165, 153, 143, 138, 133, 123, 121, 120, 117, 117, 120, 121, 121, 123, 127, 128, 130, 133, 134, 134, 135, 134, 131, 128, 125, 121, 115, 110, 105, 101, 97, 94, 90, 88, 87, 85, 84, 84, 87, 89, 92, 94, 98, 100, 107, 113, 118, 123, 135, 146, 150, 159, 170, 175, 178, 184, 187, 184, 183, 183, 177, 169, 166, 160, 150, 144, 141, 135, 127, 124, 122, 118, 114, 115, 114, 113, 114, 117, 117, 118, 122, 125, 126, 129, 132, 133, 135, 137, 137, 136, 134, 132, 128, 124, 119, 115, 110, 105, 99, 96, 93, 89, 87, 86, 85, 84, 85, 87, 89, 92, 95, 98, 100, 107, 115, 118, 122, 135, 146, 150, 159, 170, 175, 178, 185, 187, 184, 183, 181, 175, 167, 161, 156, 146, 140, 135, 130, 125, 122, 120, 118, 117, 117, 117, 117, 119, 120, 121, 121, 123, 123, 123, 124, 125, 123, 123, 123, 121, 120, 118, 117, 115, 113, 112, 111, 110, 109, 109, 110, 110, 111, 114, 116, 118, 121, 124, 126, 127, 130, 133, 135, 136, 139, 141, 142, 142, 143, 143, 144, 144, 143, 141, 140, 140, 138, 136, 135, 133, 131, 129, 128, 126, 125, 123, 122, 122, 121, 121, 121, 121, 122, 122, 123, 124, 124, 125, 126, 127, 128, 128, 129, 129, 129, 130, 129, 129, 129, 129, 129, 129, 128, 128, 128, 127, 126, 126, 125, 125, 124, 123, 123, 122, 122, 122, 122, 122, 123, 123, 123, 124, 124, 125, 125, 125, 126, 126, 126, 125, 126, 126, 126, 126, 126, 127, 126, 125, 123, 122, 122, 123, 123, 124, 125, 126, 127, 127, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 127, 126, 126, 125, 125, 124, 124, 123, 122, 122, 122, 122, 122, 123, 123, 123, 124, 124, 125, 125, 125, 126, 126, 126, 125, 126, 126, 126, 126, 126, 127, 127, 128, 127, 128, 128, 128, 128, 129, 129, 128, 128, 128, 127, 127, 128, 128, 126, 127, 128, 128, 128, 129, 129, 129, 128, 128, 128, 127, 126, 126, 125, 125, 124, 124, 123, 122, 122, 122, 122, 122, 123, 123, 123, 124, 124, 125, 125, 125, 126, 126, 126, 125, 126, 126, 126, 126, 126, 127, 127, 128, 127, 128, 128, 128, 128, 129, 129, 128, 128, 128, 127, 127, 128, 128, 126, 127, 128, 127, 127, 129, 130, 129, 129, 130, 156, 137, 100, 138, 190, 119, 97, 156, 137, 97, 116, 115, 130, 138, 110, 118, 124, 124, 124, 125, 125, 125, 126, 126, 126, 125, 126, 126, 126, 126, 126, 127, 127, 128, 128, 129, 130, 130, 131, 132, 132, 132, 133, 134, 132, 129, 129, 131, 130, 128, 129, 131, 130, 129, 130, 130, 129, 128, 141, 132, 115, 130, 149, 125, 118, 134, 127, 119, 124, 120, 123, 127, 120, 118, 123, 124, 124, 115, 117, 126, 122, 112, 113, 111, 110, 104, 95, 94, 93, 100, 118, 115, 108, 115, 127, 134, 134, 133, 139, 149, 147, 148, 147, 143, 145, 146, 142, 139, 133, 134, 135, 134, 132, 131, 136, 134, 133, 135, 135, 132, 129, 130, 131, 128, 125, 125, 126, 125, 123, 124, 122, 124, 124, 125, 116, 116, 122, 114, 119, 119, 117, 109, 112, 113, 110, 102, 98, 95, 93, 96, 96, 121, 122, 114, 120, 137, 148, 144, 139, 146, 156, 152, 148, 146, 145, 139, 140, 139, 135, 127, 129, 130, 130, 128, 130, 133, 136, 135, 135, 135, 133, 132, 133, 133, 128, 129, 128, 126, 123, 124, 122, 122, 121, 120, 119, 123, 120, 119, 112, 118, 119, 113, 107, 102, 98, 105, 92, 88, 76, 84, 101, 123, 122, 117, 124, 141, 155, 159, 152, 148, 161, 166, 156, 140, 142, 145, 140, 127, 125, 129, 128, 125, 128, 136, 137, 131, 135, 139, 139, 133, 136, 137, 133, 129, 130, 130, 127, 124, 126, 126, 123, 122, 125, 121, 117, 120, 124, 114, 113, 113, 115, 110, 93, 92, 97, 95, 92, 76, 66, 78, 106, 123, 122, 122, 142, 151, 155, 159, 159, 158, 161, 161, 161, 153, 139, 133, 137, 137, 127, 120, 123, 127, 134, 135, 133, 134, 140, 141, 139, 137, 136, 137, 135, 132, 131, 129, 127, 126, 126, 124, 122, 121, 120, 117, 117, 116, 110, 109, 103, 106, 101, 94, 90, 85, 85, 81, 79, 84, 89, 112, 125, 131, 135, 141, 152, 169, 174, 167, 155, 158, 163, 160, 144, 128, 130, 136, 133, 121, 120, 125, 131, 130, 133, 138, 142, 142, 141, 142, 144, 141, 136, 134, 133, 132, 128, 126, 124, 123, 120, 115, 116, 118, 109, 103, 103, 107, 103, 94, 89, 93, 87, 81, 74, 72, 75, 81, 94, 116, 137, 135, 137, 146, 168, 181, 171, 157, 159, 168, 167, 151, 134, 131, 135, 135, 127, 120, 121, 125, 130, 133, 135, 140, 141, 142, 144, 145, 143, 139, 137, 135, 134, 130, 128, 123, 120, 117, 117, 116, 110, 102, 102, 105, 103, 93, 89, 93, 92, 81, 74, 71, 71, 81, 94, 105, 134, 141, 137, 138, 158, 179, 171, 162, 158, 165, 168, 159, 140, 132, 135, 135, 129, 121, 120, 122, 128, 133, 135, 139, 141, 142, 146, 146, 144, 141, 140, 140, 139, 134, 127, 123, 120, 118, 114, 106, 100, 97, 95, 92, 88, 85, 87, 82, 80, 76, 67, 69, 76, 85, 107, 131, 139, 146, 148, 154, 171, 178, 174, 162, 159, 163, 166, 151, 136, 132, 133, 133, 126, 122, 120, 124, 130, 133, 137, 140, 144, 146, 146, 147, 146, 144, 140, 138, 136, 134, 129, 124, 117, 114, 109, 103, 96, 89, 81, 78, 75, 72, 69, 71, 71, 65, 67, 85, 100, 114, 133, 157, 157, 154, 164, 178, 174, 162, 154, 162, 166, 154, 138, 128, 131, 134, 129, 121, 119, 122, 128, 133, 134, 138, 142, 146, 147, 147, 147, 145, 144, 140, 138, 135, 132, 127, 120, 114, 110, 105, 98, 88, 82, 79, 75, 74, 69, 71, 72, 66, 67, 76, 97, 111, 133, 144, 157, 155, 154, 164, 178, 173, 157, 153, 161, 165, 148, 137, 127, 131, 132, 128, 120, 119, 124, 129, 133, 135, 140, 143, 148, 148, 147, 145, 145, 143, 139, 136, 135, 132, 128, 123, 120, 115, 107, 100, 95, 88, 86, 77, 69, 66, 70, 73, 67, 57, 63, 89, 101, 117, 138, 157, 163, 161, 161, 176, 182, 175, 157, 152, 158, 159, 142, 125, 123, 127, 129, 122, 118, 119, 126, 132, 134, 137, 143, 148, 147, 147, 146, 144, 142, 140, 137, 135, 132, 130, 126, 122, 117, 113, 105, 99, 91, 89, 86, 74, 68, 69, 73, 72, 61, 60, 72, 98, 110, 131, 143, 162, 164, 160, 167, 181, 178, 161, 154, 154, 158, 144, 133, 122, 123, 129, 130, 127, 126, 132, 136, 139, 140, 146, 151, 152, 151, 150, 148, 146, 143, 140, 137, 130, 128, 127, 124, 121, 115, 106, 98, 89, 84, 92, 92, 89, 86, 86, 85, 82, 78, 76, 75, 76, 83, 118, 157, 179, 193, 183, 164, 153, 142, 143, 138, 133, 127, 120, 115, 116, 123, 134, 138, 142, 145, 144, 142, 141, 142, 140, 139, 142, 141, 140, 138, 138, 136, 132, 130, 128, 126, 125, 124, 121, 118, 113, 109, 100, 96, 95, 95, 91, 89, 90, 89, 84, 80, 76, 76, 77, 86, 121, 164, 189, 194, 186, 167, 148, 141, 141, 139, 131, 124, 118, 115, 117, 125, 132, 138, 143, 145, 144, 143, 141, 142, 141, 138, 141, 141, 140, 139, 137, 136, 133, 130, 128, 126, 126, 125, 123, 118, 115, 112, 106, 100, 96, 96, 93, 91, 91, 92, 87, 81, 77, 77, 75, 94, 139, 171, 197, 198, 182, 168, 145, 142, 141, 138, 127, 118, 110, 109, 115, 129, 139, 144, 147, 147, 143, 141, 140, 138, 135, 134, 137, 139, 140, 139, 137, 134, 130, 129, 128, 127, 127, 127, 126, 122, 118, 115, 111, 106, 102, 97, 98, 95, 94, 92, 88, 79, 75, 72, 74, 86, 106, 155, 193, 199, 197, 174, 149, 138, 140, 142, 133, 126, 115, 107, 108, 122, 130, 140, 147, 144, 140, 139, 139, 139, 136, 136, 135, 138, 141, 142, 141, 137, 131, 127, 128, 129, 129, 128, 125, 124, 124, 124, 124, 120, 116, 113, 114, 111, 108, 103, 98, 92, 90, 93, 91, 82, 72, 68, 66, 88, 131, 168, 196, 199, 184, 163, 148, 143, 144, 139, 130, 120, 108, 105, 109, 122, 133, 143, 146, 146, 145, 143, 142, 136, 134, 129, 129, 131, 138, 138, 137, 135, 130, 127, 127, 128, 129, 128, 128, 126, 125, 126, 126, 125, 124, 121, 119, 118, 116, 111, 104, 99, 94, 92, 92, 89, 81, 75, 71, 72, 82, 108, 164, 191, 202, 195, 170, 151, 136, 141, 144, 137, 131, 109, 103, 100, 114, 125, 139, 145, 145, 143, 142, 143, 140, 136, 132, 129, 129, 134, 139, 140, 139, 134, 128, 126, 125, 127, 129, 129, 128, 127, 126, 125, 125, 126, 127, 125, 124, 123, 122, 121, 120, 114, 105, 96, 93, 92, 90, 84, 79, 72, 66, 69, 92, 118, 176, 198, 203, 191, 166, 142, 141, 146, 144, 135, 119, 107, 99, 104, 121, 127, 139, 144, 143, 142, 145, 146, 141, 138, 133, 128, 127, 131, 136, 139, 137, 134, 128, 126, 125, 127, 128, 129, 127, 127, 127, 126, 126, 125, 124, 125, 126, 126, 125, 124, 123, 122, 121, 115, 106, 97, 94, 92, 90, 84, 80, 72, 66, 69, 84, 118, 176, 198, 204, 191, 166, 142, 137, 147, 144, 135, 124, 107, 98, 104, 121, 127, 139, 144, 143, 142, 147, 148, 144, 140, 134, 127, 125, 127, 134, 138, 137, 134, 130, 127, 126, 127, 128, 129, 128, 127, 126, 126, 126, 126, 126, 125, 125, 125, 127, 126, 126, 124, 123, 123, 121, 117, 114, 107, 98, 92, 90, 87, 84, 80, 78, 73, 79, 102, 130, 173, 191, 193, 180, 161, 143, 143, 146, 141, 135, 119, 108, 101, 107, 121, 128, 141, 143, 143, 143, 144, 143, 139, 135, 130, 127, 126, 130, 133, 137, 136, 133, 130, 127, 128, 128, 129, 128, 127, 126, 126, 126, 126, 126, 126, 126, 125, 125, 126, 127, 128, 127, 127, 124, 123, 123, 121, 118, 115, 108, 99, 93, 90, 87, 84, 80, 78, 74, 79, 102, 130, 173, 190, 193, 175, 161, 143, 143, 146, 141, 135, 120, 106, 101, 106, 121, 132, 140, 143, 144, 142, 143, 142, 138, 133, 129, 126, 126, 129, 131, 136, 138, 136, 135, 132, 130, 129, 129, 129, 127, 126, 126, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, 127, 128, 128, 126, 125, 123, 121, 120, 123, 120, 118, 112, 104, 97, 97, 92, 86, 77, 72, 67, 69, 87, 104, 150, 188, 197, 194, 173, 155, 143, 147, 148, 140, 130, 113, 105, 99, 109, 122, 130, 144, 143, 143, 141, 143, 143, 141, 138, 131, 128, 126, 128, 130, 133, 135, 134, 132, 130, 129, 128, 129, 129, 127, 127, 126, 125, 125, 126, 126, 126, 125, 125, 125, 126, 126, 127, 127, 127, 127, 128, 128, 127, 126, 124, 123, 122, 123, 120, 118, 112, 105, 97, 97, 92, 86, 77, 72, 68, 70, 88, 104, 150, 188, 196, 194, 173, 155, 143, 147, 148, 140, 130, 113, 105, 99, 109, 121, 130, 145, 144, 143, 141, 144, 144, 143, 141, 134, 129, 125, 127, 128, 130, 133, 131, 130, 130, 128, 127, 128, 129, 129, 130, 129, 128, 127, 127, 126, 125, 125, 125, 124, 125, 125, 126, 126, 126, 127, 127, 127, 128, 128, 129, 130, 130, 128, 127, 126, 122, 117, 114, 109, 103, 101, 101, 102, 99, 96, 85, 83, 77, 73, 79, 87, 118, 160, 182, 192, 185, 174, 158, 156, 155, 146, 142, 126, 118, 105, 108, 112, 118, 130, 132, 135, 137, 141, 145, 148, 147, 140, 135, 130, 129, 128, 129, 129, 126, 127, 128, 128, 128, 129, 130, 129, 130, 129, 128, 128, 127, 126, 125, 125, 125, 124, 125, 125, 126, 126, 126, 126, 127, 127, 127, 127, 127, 128, 129, 129, 130, 130, 129, 129, 128, 126, 122, 117, 112, 107, 103, 100, 102, 101, 99, 93, 84, 82, 75, 74, 83, 92, 135, 167, 190, 190, 184, 168, 155, 156, 152, 145, 137, 123, 114, 107, 109, 116, 127, 128, 130, 135, 141, 146, 149, 152, 144, 139, 136, 130, 129, 127, 125, 120, 121, 124, 126, 130, 132, 132, 131, 130, 130, 130, 130, 130, 128, 127, 126, 125, 124, 124, 125, 125, 125, 125, 126, 126, 126, 126, 127, 128, 128, 129, 129, 129, 130, 131, 131, 131, 127, 123, 117, 114, 111, 108, 105, 103, 100, 99, 100, 101, 97, 90, 82, 78, 77, 89, 114, 138, 160, 185, 180, 177, 163, 160, 160, 156, 155, 140, 124, 110, 110, 110, 118, 126, 128, 129, 133, 134, 137, 139, 142, 142, 142, 140, 137, 133, 130, 126, 123, 119, 121, 126, 130, 132, 133, 131, 129, 130, 130, 130, 131, 130, 129, 127, 126, 126, 126, 126, 126, 126, 125, 125, 125, 126, 126, 126, 127, 127, 128, 128, 129, 131, 131, 130, 127, 125, 123, 123, 124, 123, 118, 114, 109, 105, 102, 101, 94, 88, 79, 74, 68, 64, 65, 74, 91, 140, 172, 195, 198, 197, 180, 170, 172, 165, 157, 146, 133, 111, 100, 103, 106, 118, 128, 128, 127, 128, 135, 142, 147, 150, 147, 141, 137, 133, 128, 126, 125, 120, 119, 120, 122, 126, 130, 132, 132, 132, 132, 131, 131, 131, 129, 127, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 126, 126, 127, 127, 128, 129, 130, 130, 131, 131, 129, 127, 125, 123, 123, 124, 121, 116, 111, 108, 104, 102, 97, 91, 86, 77, 71, 66, 65, 67, 79, 122, 154, 181, 198, 200, 191, 173, 170, 169, 161, 155, 141, 119, 105, 99, 103, 111, 122, 129, 127, 124, 128, 137, 147, 155, 155, 149, 140, 134, 130, 126, 125, 121, 116, 114, 113, 116, 124, 131, 138, 141, 140, 138, 134, 132, 132, 131, 130, 128, 126, 125, 124, 124, 125, 125, 125, 125, 126, 126, 127, 128, 128, 128, 129, 129, 129, 128, 125, 122, 120, 119, 119, 119, 116, 113, 111, 109, 106, 103, 100, 94, 93, 94, 94, 94, 91, 89, 88, 85, 98, 137, 156, 180, 191, 189, 179, 166, 170, 170, 170, 167, 151, 127, 112, 104, 103, 109, 117, 119, 116, 113, 120, 127, 139, 150, 151, 148, 141, 136, 132, 132, 129, 124, 118, 115, 114, 118, 125, 132, 136, 137, 137, 134, 133, 133, 132, 131, 129, 128, 126, 125, 125, 125, 125, 125, 125, 125, 125, 126, 127, 128, 128, 129, 130, 130, 130, 129, 126, 123, 121, 120, 119, 117, 116, 113, 110, 108, 106, 103, 99, 94, 93, 94, 94, 93, 92, 89, 87, 87, 98, 137, 164, 185, 191, 189, 174, 166, 170, 171, 170, 163, 152, 128, 109, 105, 103, 108, 117, 116, 113, 109, 116, 126, 140, 149, 152, 147, 141, 139, 136, 136, 137, 132, 124, 117, 113, 112, 114, 122, 128, 131, 134, 135, 135, 135, 136, 135, 134, 134, 131, 128, 126, 125, 124, 123, 123, 123, 124, 125, 126, 127, 129, 130, 131, 131, 130, 128, 125, 122, 120, 117, 114, 111, 108, 106, 107, 108, 109, 111, 107, 104, 103, 108, 111, 111, 109, 96, 82, 77, 76, 87, 123, 148, 161, 174, 176, 170, 166, 181, 191, 193, 185, 172, 144, 119, 113, 110, 110, 114, 111, 106, 100, 105, 114, 123, 139, 146, 146, 145, 144, 142, 140, 141, 136, 128, 121, 116, 113, 113, 119, 123, 128, 131, 133, 133, 134, 135, 135, 135, 134, 132, 129, 127, 126, 124, 124, 124, 123, 123, 124, 125, 126, 127, 129, 130, 130, 132, 132, 130, 128, 125, 122, 119, 117, 114, 110, 107, 106, 108, 107, 110, 110, 106, 104, 107, 110, 110, 111, 100, 91, 80, 76, 80, 110, 135, 156, 171, 176, 174, 167, 175, 190, 193, 194, 180, 155, 135, 116, 113, 109, 112, 113, 107, 99, 98, 105, 114, 130, 139, 146, 147, 147, 146, 144, 143, 141, 137, 129, 121, 114, 112, 111, 116, 120, 125, 128, 131, 132, 134, 135, 135, 136, 134, 133, 131, 129, 128, 127, 126, 124, 123, 122, 122, 123, 125, 126, 127, 129, 130, 130, 130, 129, 129, 128, 126, 123, 119, 115, 110, 108, 107, 109, 110, 110, 109, 110, 110, 112, 113, 115, 114, 112, 109, 104, 102, 99, 98, 101, 111, 127, 139, 153, 157, 160, 159, 163, 168, 172, 177, 174, 170, 157, 145, 136, 131, 127, 123, 120, 116, 112, 109, 108, 112, 116, 121, 124, 128, 129, 131, 133, 136, 138, 137, 135, 130, 126, 124, 124, 124, 125, 125, 125, 123, 124, 126, 128, 129, 131, 131, 131, 130, 130, 130, 129, 128, 127, 125, 125, 124, 124, 125, 125, 126, 126, 127, 128, 129, 129, 128, 128, 125, 123, 121, 119, 118, 117, 116, 115, 115, 117, 119, 120, 121, 121, 122, 122, 123, 123, 121, 119, 117, 115, 114, 114, 114, 114, 115, 119, 120, 126, 131, 137, 139, 139, 142, 144, 146, 150, 155, 156, 154, 151, 145, 140, 136, 136, 134, 130, 126, 121, 116, 115, 119, 121, 126, 127, 126, 124, 123, 126, 130, 133, 135, 134, 130, 127, 125, 124, 125, 126, 126, 126, 125, 125, 125, 125, 126, 127, 129, 130, 130, 130, 129, 128, 128, 129, 130, 130, 129, 127, 125, 123, 123, 123, 124, 124, 123, 122, 121, 120, 120, 120, 121, 121, 122, 122, 123, 124, 125, 126, 126, 125, 124, 121, 120, 118, 118, 118, 118, 117, 117, 119, 122, 125, 130, 134, 137, 137, 139, 141, 144, 147, 151, 153, 152, 151, 146, 141, 137, 136, 135, 132, 128, 124, 118, 115, 117, 120, 124, 127, 126, 125, 123, 125, 129, 132, 135, 135, 132, 128, 125, 124, 124, 126, 126, 126, 126, 125, 125, 125, 126, 127, 128, 130, 130, 130, 129, 128, 128, 129, 130, 130, 130, 128, 126, 123, 122, 122, 123, 124, 124, 123, 122, 121, 121, 122, 122, 123, 123, 123, 123, 125, 127, 128, 129, 128, 126, 123, 122, 121, 121, 121, 122, 121, 121, 122, 124, 125, 128, 130, 132, 133, 133, 134, 136, 138, 140, 141, 141, 140, 139, 138, 137, 137, 136, 135, 133, 131, 130, 128, 127, 127, 126, 125, 123, 123, 123, 123, 124, 123, 123, 123, 124, 125, 125, 126, 126, 125, 125, 125, 125, 126, 127, 127, 128, 128, 128, 128, 128, 129, 129, 130, 130, 130, 129, 128, 128, 128, 128, 129, 129, 128, 125, 124, 122, 122, 123, 123, 124, 123, 122, 121, 121, 121, 122, 123, 123, 123, 123, 124, 126, 128, 129, 128, 127, 124, 122, 122, 121, 121, 122, 121, 121, 122, 123, 124, 127, 130, 132, 132, 133, 134, 136, 138, 139, 141, 142, 140, 139, 138, 137, 137, 136, 134, 133, 131, 129, 128, 127, 127, 126, 125, 124, 123, 123, 123, 123, 123, 123, 123, 123, 122, 123, 123, 124, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 131, 131, 131, 131, 131, 130, 130, 129, 128, 127, 126, 125, 124, 124, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 123, 123, 124, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, 134, 134, 134, 134, 134, 134, 134, 133, 132, 131, 130, 129, 129, 128, 128, 127, 125, 125, 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 124, 125, 125, 125, 126, 127, 127, 128, 129, 130, 131, 131, 131, 131, 131, 131, 130, 129, 128, 128, 127, 126, 125, 124, 124, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 129, 129, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, 132, 132, 131, 131, 131, 130, 129, 129, 128, 127, 127, 127, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 126, 126, 126, 126, 125, 125, 126, 126, 126, 127, 127, 127, 127, 128, 129, 128, 128, 127, 127, 127, 127, 128, 129, 129, 126, 121, 119, 120, 122, 121, 120, 120, 139, 134, 121, 113, 124, 133, 127, 113, 113, 127, 129, 122, 115, 123, 131, 134, 127, 126, 130, 137, 134, 129, 128, 132, 134, 130, 129, 129, 132, 129, 128, 126, 128, 129, 128, 126, 126, 128, 129, 127, 127, 128, 129, 127, 143, 141, 126, 116, 126, 131, 124, 116, 116, 126, 127, 121, 115, 133, 144, 124, 110, 120, 139, 130, 114, 111, 143, 136, 115, 104, 127, 134, 124, 111, 119, 135, 131, 120, 115, 131, 135, 124, 117, 128, 136, 131, 122, 125, 132, 131, 124, }; const uint8_t main_chute[10388] = { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 129, 132, 135, 139, 141, 144, 146, 148, 149, 149, 150, 150, 150, 149, 147, 145, 144, 141, 139, 137, 135, 133, 130, 128, 126, 124, 122, 120, 119, 117, 116, 115, 115, 115, 115, 116, 116, 118, 119, 121, 122, 123, 125, 126, 127, 128, 128, 129, 129, 129, 129, 129, 128, 128, 127, 126, 125, 124, 122, 121, 120, 119, 118, 118, 117, 117, 117, 117, 118, 118, 119, 120, 121, 121, 122, 123, 124, 125, 125, 126, 127, 127, 128, 128, 129, 130, 130, 131, 132, 133, 133, 134, 135, 136, 137, 137, 138, 138, 138, 138, 138, 137, 136, 136, 135, 133, 132, 131, 130, 128, 127, 125, 124, 123, 122, 121, 121, 120, 120, 120, 121, 121, 122, 122, 123, 124, 125, 125, 126, 126, 126, 127, 127, 126, 126, 125, 125, 124, 123, 122, 121, 120, 119, 118, 118, 117, 117, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 125, 125, 126, 127, 127, 128, 128, 128, 129, 130, 131, 131, 132, 133, 133, 134, 135, 136, 137, 137, 138, 138, 139, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 137, 136, 135, 133, 132, 130, 129, 127, 125, 123, 121, 120, 118, 117, 116, 116, 115, 115, 115, 115, 115, 115, 115, 116, 116, 117, 117, 118, 119, 121, 122, 123, 124, 125, 126, 126, 127, 127, 124, 122, 119, 116, 115, 115, 116, 116, 117, 117, 118, 119, 121, 122, 123, 124, 125, 126, 127, 127, 127, 127, 127, 127, 126, 125, 124, 121, 119, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 127, 127, 127, 127, 126, 126, 125, 125, 125, 125, 125, 124, 124, 123, 123, 123, 124, 125, 126, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 130, 130, 131, 131, 132, 132, 132, 132, 132, 131, 131, 130, 130, 130, 130, 129, 129, 128, 128, 127, 127, 126, 126, 125, 123, 123, 122, 122, 121, 121, 119, 119, 121, 121, 121, 122, 124, 144, 125, 112, 132, 140, 112, 125, 131, 141, 119, 116, 121, 126, 127, 123, 128, 132, 122, 120, 121, 122, 124, 122, 119, 130, 131, 132, 115, 131, 120, 137, 132, 138, 137, 136, 126, 116, 138, 125, 134, 134, 131, 125, 133, 124, 130, 142, 127, 153, 130, 128, 137, 146, 132, 127, 133, 120, 132, 126, 127, 134, 123, 118, 111, 127, 125, 130, 108, 113, 107, 112, 100, 120, 104, 113, 99, 113, 113, 129, 102, 102, 99, 111, 105, 111, 102, 108, 124, 124, 128, 141, 157, 158, 173, 165, 178, 180, 180, 173, 172, 164, 158, 151, 138, 134, 131, 120, 120, 119, 119, 113, 120, 117, 120, 125, 129, 131, 138, 142, 146, 150, 153, 149, 146, 139, 132, 127, 118, 116, 109, 111, 101, 106, 98, 99, 94, 96, 93, 90, 96, 94, 92, 91, 84, 77, 78, 72, 62, 62, 60, 58, 60, 69, 83, 91, 117, 157, 164, 189, 208, 215, 220, 218, 213, 207, 199, 180, 165, 147, 133, 125, 110, 106, 104, 105, 103, 113, 124, 130, 140, 147, 152, 155, 154, 147, 139, 134, 123, 118, 111, 106, 109, 119, 125, 134, 141, 149, 158, 163, 162, 160, 153, 146, 138, 129, 115, 102, 96, 87, 78, 73, 74, 75, 76, 80, 83, 86, 89, 91, 89, 87, 88, 81, 85, 86, 91, 102, 119, 156, 168, 187, 216, 218, 220, 208, 210, 198, 192, 163, 145, 137, 118, 107, 94, 92, 96, 106, 105, 112, 129, 138, 149, 154, 155, 158, 153, 142, 128, 119, 107, 100, 94, 92, 100, 106, 122, 138, 154, 164, 177, 181, 177, 166, 156, 141, 121, 104, 96, 82, 75, 70, 67, 67, 73, 77, 80, 87, 92, 101, 100, 94, 93, 87, 83, 77, 70, 70, 77, 92, 107, 148, 160, 182, 204, 218, 221, 218, 212, 195, 185, 169, 144, 125, 105, 98, 90, 88, 91, 103, 114, 125, 142, 150, 162, 163, 162, 158, 154, 140, 123, 116, 105, 97, 92, 93, 100, 112, 127, 136, 155, 168, 176, 178, 176, 165, 153, 141, 124, 107, 94, 83, 80, 74, 71, 73, 77, 81, 87, 93, 94, 102, 97, 99, 92, 85, 81, 76, 70, 79, 91, 100, 137, 158, 170, 190, 213, 216, 217, 209, 199, 184, 175, 153, 126, 114, 101, 94, 90, 91, 101, 114, 127, 138, 149, 160, 161, 161, 156, 153, 138, 125, 111, 106, 101, 96, 101, 109, 119, 130, 150, 161, 167, 171, 171, 171, 161, 145, 130, 119, 108, 95, 88, 84, 85, 86, 87, 95, 105, 109, 110, 112, 116, 112, 101, 93, 88, 84, 72, 65, 67, 78, 92, 108, 143, 164, 187, 208, 213, 217, 211, 203, 187, 178, 154, 125, 115, 102, 95, 88, 92, 100, 115, 130, 136, 151, 162, 168, 166, 160, 154, 142, 131, 115, 104, 98, 94, 91, 96, 109, 118, 128, 145, 164, 170, 172, 172, 169, 157, 149, 132, 117, 107, 99, 90, 86, 88, 87, 90, 98, 107, 110, 111, 113, 116, 113, 107, 95, 90, 86, 76, 69, 70, 73, 87, 100, 142, 155, 175, 191, 209, 212, 212, 202, 184, 175, 160, 134, 115, 103, 97, 91, 95, 103, 114, 127, 138, 152, 160, 167, 165, 158, 153, 144, 127, 111, 104, 97, 91, 91, 93, 103, 120, 131, 138, 157, 171, 171, 170, 166, 158, 145, 130, 117, 107, 102, 94, 90, 93, 98, 101, 105, 110, 116, 118, 116, 113, 111, 104, 99, 85, 78, 76, 70, 64, 75, 88, 98, 118, 159, 171, 187, 206, 214, 214, 209, 196, 177, 162, 146, 121, 108, 95, 91, 91, 95, 104, 120, 131, 143, 157, 166, 169, 166, 159, 149, 139, 125, 109, 98, 93, 89, 90, 94, 101, 114, 133, 144, 151, 170, 175, 171, 170, 163, 148, 136, 127, 109, 104, 98, 93, 92, 96, 100, 105, 108, 113, 118, 118, 115, 113, 108, 102, 95, 81, 78, 74, 68, 66, 78, 87, 96, 134, 165, 178, 194, 211, 213, 214, 204, 189, 173, 155, 137, 111, 104, 92, 91, 91, 95, 110, 130, 140, 149, 164, 173, 174, 171, 159, 145, 138, 124, 102, 90, 87, 82, 82, 91, 99, 116, 140, 155, 162, 182, 186, 181, 177, 162, 145, 132, 121, 102, 95, 91, 87, 85, 90, 97, 103, 116, 120, 125, 129, 125, 115, 103, 94, 86, 75, 65, 59, 56, 61, 64, 69, 82, 125, 190, 190, 189, 207, 231, 228, 210, 189, 164, 166, 165, 135, 110, 105, 115, 105, 107, 101, 105, 120, 129, 133, 133, 149, 154, 158, 159, 155, 151, 146, 142, 129, 121, 113, 109, 107, 104, 104, 104, 111, 116, 119, 121, 124, 126, 124, 120, 113, 108, 104, 97, 89, 85, 82, 81, 83, 84, 89, 97, 146, 176, 163, 173, 197, 209, 200, 191, 169, 156, 166, 155, 123, 105, 114, 114, 108, 106, 104, 112, 126, 134, 132, 137, 152, 156, 157, 155, 151, 145, 143, 138, 124, 117, 113, 112, 111, 110, 108, 111, 118, 121, 122, 122, 124, 124, 124, 123, 121, 120, 119, 117, 115, 114, 113, 113, 114, 115, 116, 117, 118, 119, 121, 122, 123, 128, 133, 133, 133, 133, 135, 137, 138, 140, 140, 141, 143, 145, 144, 144, 144, 143, 143, 142, 141, 139, 137, 135, 134, 133, 131, 129, 129, 127, 126, 126, 125, 124, 123, 122, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 121, 121, 122, 122, 123, 124, 125, 126, 127, 128, 128, 129, 130, 131, 131, 132, 131, 131, 131, 130, 129, 128, 128, 127, 127, 126, 125, 125, 124, 123, 123, 122, 122, 121, 121, 121, 121, 121, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 125, 125, 125, 124, 124, 124, 125, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 136, 136, 136, 136, 136, 136, 136, 135, 135, 134, 134, 133, 133, 132, 131, 130, 130, 129, 128, 127, 126, 125, 124, 124, 123, 123, 123, 123, 123, 124, 124, 124, 125, 125, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 128, 128, 128, 127, 127, 127, 126, 126, 126, 125, 125, 126, 126, 126, 126, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 127, 127, 127, 127, 127, 126, 126, 126, 126, 127, 127, 127, 127, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 127, 127, 127, 127, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 126, 126, 125, 125, 124, 124, 124, 124, 124, 123, 123, 123, 123, 124, 125, 125, 125, 123, 132, 134, 156, 134, 127, 127, 156, 144, 126, 123, 137, 155, 131, 118, 114, 119, 115, 117, 134, 125, 127, 114, 124, 132, 131, 135, 132, 132, 134, 130, 134, 123, 126, 117, 114, 118, 115, 116, 111, 115, 122, 122, 122, 120, 124, 127, 127, 134, 126, 128, 125, 128, 129, 126, 121, 126, 125, 123, 124, 122, 124, 130, 132, 125, 128, 127, 127, 130, 130, 132, 127, 129, 133, 132, 133, 134, 126, 127, 132, 127, 127, 124, 124, 126, 127, 124, 131, 126, 129, 124, 127, 125, 124, 127, 122, 122, 122, 124, 130, 126, 130, 131, 126, 128, 127, 132, 126, 128, 130, 133, 134, 136, 131, 130, 127, 132, 133, 127, 132, 129, 126, 125, 125, 135, 128, 130, 132, 122, 125, 117, 124, 121, 134, 127, 130, 130, 127, 131, 131, 127, 126, 123, 121, 119, 133, 132, 128, 132, 124, 128, 124, 124, 129, 122, 131, 123, 124, 134, 119, 127, 120, 126, 123, 121, 125, 119, 130, 124, 133, 131, 130, 130, 123, 131, 123, 128, 130, 124, 128, 125, 135, 125, 126, 124, 128, 127, 126, 124, 127, 127, 122, 121, 121, 129, 121, 136, 126, 127, 121, 128, 126, 122, 125, 127, 127, 129, 126, 122, 124, 130, 125, 130, 132, 127, 126, 124, 131, 123, 131, 125, 127, 124, 124, 119, 121, 125, 125, 129, 132, 130, 132, 130, 133, 133, 127, 128, 128, 119, 128, 119, 126, 124, 124, 123, 131, 125, 125, 130, 130, 131, 133, 128, 127, 133, 127, 128, 126, 127, 126, 126, 127, 130, 128, 131, 134, 130, 129, 123, 128, 130, 126, 130, 127, 129, 137, 126, 130, 123, 122, 126, 129, 127, 120, 126, 128, 127, 127, 134, 121, 123, 123, 127, 123, 128, 127, 127, 125, 128, 122, 127, 135, 122, 130, 124, 127, 129, 128, 125, 131, 131, 117, 125, 117, 125, 122, 128, 125, 129, 126, 134, 126, 132, 129, 131, 129, 129, 132, 134, 123, 123, 122, 120, 123, 123, 132, 122, 125, 124, 127, 130, 133, 133, 127, 133, 129, 139, 127, 124, 125, 123, 116, 122, 114, 122, 120, 122, 126, 126, 125, 128, 130, 136, 127, 126, 124, 120, 126, 119, 123, 120, 122, 126, 117, 125, 129, 125, 132, 134, 128, 131, 123, 123, 121, 124, 123, 123, 121, 118, 131, 127, 137, 130, 139, 142, 139, 138, 145, 141, 136, 143, 138, 132, 128, 133, 137, 137, 135, 138, 138, 137, 136, 137, 139, 141, 137, 129, 122, 117, 115, 112, 114, 113, 109, 110, 117, 114, 122, 122, 123, 124, 120, 124, 117, 118, 112, 114, 101, 100, 97, 99, 100, 103, 107, 112, 123, 118, 122, 120, 117, 112, 106, 105, 109, 120, 126, 152, 164, 176, 178, 178, 174, 173, 170, 163, 161, 155, 150, 141, 134, 126, 125, 123, 125, 130, 132, 134, 135, 136, 132, 130, 122, 117, 111, 106, 103, 99, 100, 102, 106, 110, 116, 118, 120, 119, 113, 112, 105, 101, 95, 92, 84, 79, 76, 74, 78, 82, 86, 86, 87, 82, 96, 110, 135, 168, 191, 202, 205, 201, 185, 173, 163, 155, 152, 151, 148, 144, 136, 125, 122, 116, 117, 120, 125, 130, 136, 139, 140, 140, 139, 139, 139, 139, 136, 132, 130, 126, 124, 125, 126, 127, 127, 126, 126, 127, 127, 129, 129, 128, 128, 127, 125, 123, 120, 117, 111, 105, 97, 94, 87, 80, 77, 75, 74, 75, 73, 73, 71, 71, 61, 57, 73, 96, 141, 185, 213, 224, 226, 218, 188, 164, 140, 129, 127, 129, 131, 128, 127, 114, 112, 109, 114, 128, 144, 154, 159, 163, 155, 148, 142, 134, 127, 127, 125, 122, 121, 118, 117, 117, 122, 126, 131, 134, 135, 135, 134, 131, 131, 131, 128, 129, 128, 126, 125, 123, 119, 114, 109, 103, 96, 88, 83, 79, 77, 75, 76, 74, 73, 71, 71, 67, 59, 59, 90, 108, 164, 206, 222, 225, 222, 201, 171, 157, 132, 128, 128, 130, 129, 129, 118, 111, 112, 111, 123, 132, 149, 157, 163, 161, 153, 145, 135, 129, 126, 126, 122, 122, 120, 117, 117, 120, 122, 129, 134, 134, 136, 134, 132, 132, 131, 129, 129, 128, 127, 126, 125, 121, 117, 112, 105, 98, 94, 87, 81, 77, 75, 75, 75, 73, 72, 71, 71, 61, 55, 73, 96, 141, 198, 213, 224, 225, 211, 187, 164, 139, 129, 127, 129, 131, 128, 126, 114, 112, 109, 114, 128, 145, 155, 160, 162, 154, 147, 140, 133, 127, 126, 124, 122, 120, 118, 117, 118, 122, 127, 133, 134, 135, 134, 132, 131, 131, 130, 129, 128, 127, 126, 125, 122, 118, 112, 105, 100, 94, 87, 81, 77, 76, 75, 75, 74, 73, 71, 71, 63, 57, 73, 96, 123, 185, 213, 224, 224, 216, 186, 162, 138, 127, 125, 126, 127, 124, 123, 113, 114, 116, 123, 138, 154, 161, 164, 162, 151, 144, 134, 124, 117, 115, 113, 110, 112, 114, 117, 127, 135, 139, 146, 147, 143, 142, 138, 132, 131, 130, 130, 131, 129, 124, 123, 118, 111, 107, 103, 99, 92, 89, 86, 84, 84, 84, 83, 75, 68, 57, 52, 42, 73, 96, 123, 185, 213, 224, 225, 216, 186, 162, 147, 127, 125, 126, 126, 124, 122, 113, 114, 117, 124, 138, 152, 158, 161, 158, 148, 141, 130, 121, 115, 113, 112, 113, 117, 121, 128, 137, 143, 146, 148, 145, 140, 136, 129, 125, 121, 119, 117, 117, 117, 118, 117, 116, 115, 112, 110, 106, 100, 95, 90, 85, 82, 82, 80, 78, 75, 75, 79, 103, 123, 167, 205, 233, 235, 225, 201, 169, 147, 127, 114, 115, 111, 117, 114, 115, 116, 118, 126, 135, 143, 152, 157, 154, 149, 135, 121, 111, 107, 106, 112, 120, 127, 137, 144, 150, 149, 147, 143, 137, 131, 127, 125, 121, 121, 118, 116, 116, 114, 115, 116, 116, 116, 115, 112, 107, 102, 98, 91, 86, 81, 80, 78, 76, 76, 74, 80, 102, 132, 156, 205, 231, 240, 232, 205, 174, 137, 115, 106, 106, 108, 114, 114, 114, 119, 125, 129, 142, 151, 160, 160, 157, 144, 131, 121, 109, 102, 100, 101, 109, 120, 131, 140, 149, 154, 156, 154, 147, 140, 131, 127, 122, 117, 114, 113, 112, 113, 116, 119, 121, 123, 122, 119, 115, 107, 100, 93, 89, 86, 86, 83, 82, 79, 73, 72, 77, 85, 123, 163, 199, 238, 245, 229, 211, 170, 136, 111, 105, 101, 112, 114, 115, 118, 117, 124, 136, 144, 158, 166, 165, 157, 144, 127, 111, 106, 99, 99, 103, 106, 116, 124, 136, 145, 153, 159, 158, 155, 146, 136, 126, 121, 117, 115, 115, 116, 116, 117, 120, 122, 124, 124, 122, 120, 114, 106, 95, 89, 84, 80, 80, 81, 80, 81, 80, 80, 86, 99, 137, 176, 209, 241, 240, 219, 197, 152, 118, 101, 99, 104, 115, 119, 117, 117, 117, 128, 139, 155, 168, 171, 166, 148, 128, 111, 103, 100, 102, 107, 113, 115, 119, 127, 136, 144, 157, 165, 165, 162, 150, 135, 124, 118, 113, 114, 116, 117, 120, 121, 122, 124, 126, 125, 123, 120, 111, 104, 95, 89, 83, 81, 81, 83, 84, 81, 79, 76, 76, 87, 123, 170, 196, 239, 243, 223, 204, 159, 122, 103, 101, 106, 115, 120, 116, 113, 116, 125, 139, 159, 174, 174, 168, 149, 127, 112, 104, 101, 106, 109, 111, 113, 116, 121, 128, 140, 152, 164, 166, 165, 157, 143, 129, 123, 116, 113, 115, 115, 117, 120, 121, 122, 126, 126, 125, 123, 117, 108, 101, 95, 87, 83, 81, 81, 84, 83, 80, 79, 77, 80, 94, 123, 170, 213, 244, 243, 223, 190, 144, 115, 103, 102, 108, 119, 120, 115, 115, 119, 126, 159, 169, 174, 166, 147, 132, 115, 105, 103, 106, 109, 112, 115, 117, 122, 132, 144, 152, 160, 162, 157, 153, 144, 134, 126, 122, 117, 115, 113, 112, 115, 120, 125, 128, 130, 127, 122, 118, 107, 98, 91, 83, 81, 80, 83, 86, 87, 85, 78, 75, 73, 82, 122, 183, 206, 254, 249, 216, 183, 142, 107, 99, 108, 120, 120, 123, 112, 108, 114, 131, 146, 168, 183, 170, 159, 136, 112, 101, 100, 107, 114, 122, 125, 122, 127, 130, 139, 144, 151, 153, 148, 145, 134, 127, 123, 122, 123, 125, 127, 125, 122, 122, 120, 122, 123, 122, 116, 110, 102, 91, 89, 88, 90, 94, 93, 89, 80, 75, 72, 75, 86, 104, 144, 197, 213, 242, 229, 196, 167, 138, 126, 117, 124, 126, 115, 106, 100, 104, 118, 147, 161, 170, 171, 154, 142, 127, 119, 114, 113, 117, 116, 116, 119, 121, 128, 137, 142, 146, 148, 145, 141, 139, 133, 129, 126, 125, 123, 123, 124, 123, 124, 123, 122, 123, 122, 119, 112, 107, 97, 89, 89, 88, 90, 93, 91, 86, 79, 74, 74, 77, 92, 110, 166, 197, 224, 240, 220, 196, 155, 132, 124, 120, 130, 120, 113, 99, 100, 106, 130, 159, 170, 172, 164, 142, 130, 119, 118, 118, 121, 123, 115, 112, 114, 120, 134, 149, 155, 152, 144, 135, 130, 129, 133, 136, 135, 128, 118, 111, 113, 121, 132, 138, 133, 125, 110, 100, 96, 97, 97, 93, 85, 78, 76, 77, 83, 86, 90, 89, 88, 99, 116, 177, 217, 228, 226, 200, 163, 143, 142, 141, 134, 130, 106, 88, 83, 103, 128, 159, 173, 169, 153, 137, 135, 135, 140, 139, 120, 103, 96, 102, 115, 140, 151, 148, 137, 128, 127, 132, 148, 149, 143, 130, 119, 117, 121, 133, 134, 131, 126, 118, 115, 115, 116, 110, 101, 92, 89, 87, 89, 89, 87, 84, 83, 82, 84, 85, 91, 102, 118, 143, 199, 219, 225, 206, 186, 153, 153, 153, 143, 121, 99, 90, 89, 116, 141, 150, 153, 148, 141, 139, 148, 153, 139, 128, 112, 105, 110, 120, 130, 132, 132, 130, 132, 137, 140, 138, 137, 134, 132, 130, 131, 128, 129, 130, 130, 129, 128, 120, 114, 109, 103, 98, 91, 86, 83, 84, 85, 85, 84, 83, 84, 84, 87, 93, 110, 129, 164, 202, 219, 212, 201, 177, 154, 154, 151, 134, 116, 96, 91, 94, 127, 144, 155, 150, 146, 140, 145, 152, 149, 134, 116, 109, 104, 116, 128, 130, 131, 131, 131, 133, 140, 139, 136, 134, 132, 132, 134, 133, 129, 126, 129, 130, 133, 132, 124, 116, 108, 102, 97, 93, 88, 79, 77, 80, 83, 85, 85, 88, 84, 85, 95, 117, 134, 160, 186, 197, 206, 203, 191, 169, 160, 149, 133, 124, 117, 116, 111, 122, 125, 132, 140, 147, 150, 150, 148, 141, 134, 126, 120, 117, 117, 122, 125, 129, 133, 134, 133, 134, 135, 136, 136, 135, 130, 127, 125, 123, 123, 123, 125, 126, 124, 122, 121, 115, 108, 103, 92, 82, 76, 75, 76, 78, 82, 81, 80, 83, 92, 103, 125, 143, 171, 192, 197, 203, 197, 179, 167, 155, 143, 128, 123, 116, 113, 114, 124, 130, 140, 147, 150, 151, 148, 148, 142, 129, 119, 112, 108, 112, 122, 125, 126, 133, 139, 140, 145, 150, 146, 136, 132, 127, 119, 119, 119, 114, 109, 112, 119, 117, 120, 122, 114, 113, 111, 106, 95, 90, 86, 80, 80, 77, 77, 80, 87, 87, 79, 139, 218, 238, 223, 191, 165, 143, 139, 158, 131, 105, 89, 102, 112, 120, 148, 148, 140, 156, 170, 175, 164, 153, 135, 111, 113, 120, 117, 106, 108, 113, 119, 142, 157, 154, 146, 139, 133, 128, 130, 128, 117, 112, 115, 122, 123, 122, 119, 109, 110, 111, 112, 108, 97, 90, 88, 89, 90, 89, 83, 83, 89, 93, 85, 76, 109, 182, 217, 206, 179, 169, 166, 168, 167, 135, 99, 99, 124, 136, 125, 124, 127, 140, 161, 168, 160, 139, 138, 142, 137, 129, 121, 115, 111, 120, 134, 135, 135, 135, 140, 141, 137, 130, 121, 118, 121, 128, 127, 121, 121, 123, 121, 115, 112, 109, 103, 104, 101, 90, 82, 88, 93, 94, 95, 97, 100, 105, 105, 86, 73, 123, 190, 191, 161, 153, 188, 186, 165, 147, 128, 130, 146, 152, 118, 101, 129, 146, 137, 131, 136, 147, 149, 148, 130, 125, 137, 140, 131, 123, 127, 132, 137, 133, 126, 124, 125, 125, 120, 118, 118, 122, 124, 122, 120, 116, 117, 117, 117, 111, 100, 97, 93, 91, 87, 83, 84, 92, 98, 102, 104, 106, 97, 90, 130, 181, 178, 147, 160, 206, 187, 149, 137, 148, 150, 137, 132, 115, 123, 137, 133, 121, 127, 150, 150, 141, 142, 143, 144, 141, 134, 130, 133, 140, 133, 128, 130, 133, 126, 120, 122, 121, 116, 114, 118, 119, 120, 118, 115, 115, 115, 112, 105, 102, 104, 106, 99, 92, 95, 100, 99, 94, 89, 95, 96, 95, 87, 80, 128, 161, 171, 152, 183, 210, 191, 160, 164, 172, 158, 132, 137, 132, 131, 129, 116, 121, 130, 138, 128, 131, 143, 147, 140, 149, 154, 150, 144, 140, 133, 123, 122, 116, 114, 113, 115, 114, 114, 115, 112, 112, 114, 112, 110, 114, 118, 113, 109, 112, 107, 100, 97, 103, 97, 91, 94, 94, 92, 98, 99, 91, 101, 137, 161, 153, 166, 190, 207, 174, 170, 177, 177, 154, 138, 140, 136, 125, 116, 113, 124, 123, 122, 126, 139, 146, 144, 146, 153, 154, 148, 143, 139, 134, 124, 114, 112, 110, 106, 101, 101, 105, 106, 107, 108, 112, 116, 116, 115, 115, 113, 107, 107, 106, 100, 97, 95, 96, 98, 99, 94, 93, 101, 93, 95, 119, 151, 163, 165, 182, 203, 192, 180, 178, 187, 169, 142, 140, 141, 125, 111, 112, 122, 118, 117, 127, 142, 145, 149, 155, 158, 156, 149, 144, 135, 132, 121, 112, 109, 111, 108, 102, 105, 108, 110, 110, 109, 112, 119, 117, 113, 116, 116, 107, 108, 109, 104, 101, 99, 102, 100, 100, 103, 104, 102, 102, 104, 106, 98, 112, 152, 171, 161, 171, 197, 200, 173, 176, 181, 169, 145, 144, 142, 132, 121, 114, 116, 119, 121, 124, 134, 143, 146, 148, 151, 154, 149, 138, 135, 135, 127, 114, 113, 111, 105, 100, 103, 104, 103, 104, 111, 113, 116, 116, 117, 120, 122, 115, 111, 113, 106, 102, 103, 107, 107, 105, 105, 99, 97, 106, 103, 96, 94, 124, 159, 160, 166, 182, 204, 189, 178, 186, 177, 156, 148, 146, 133, 122, 114, 116, 117, 118, 124, 136, 142, 148, 150, 156, 158, 152, 142, 136, 132, 122, 111, 106, 104, 103, 102, 101, 102, 108, 114, 115, 116, 121, 123, 120, 118, 115, 109, 110, 101, 99, 104, 105, 101, 103, 110, 108, 107, 110, 112, 109, 111, 110, 107, 115, 129, 163, 166, 156, 182, 207, 199, 165, 181, 186, 166, 141, 136, 135, 125, 118, 108, 113, 127, 131, 130, 136, 154, 152, 148, 150, 149, 139, 128, 121, 117, 112, 106, 102, 104, 106, 109, 111, 115, 119, 120, 123, 122, 120, 119, 118, 115, 111, 110, 107, 107, 109, 109, 108, 112, 117, 118, 116, 116, 118, 119, 113, 108, 112, 117, 113, 129, 163, 166, 156, 182, 207, 199, 164, 180, 186, 166, 139, 136, 136, 127, 119, 112, 116, 129, 132, 131, 134, 146, 148, 144, 142, 143, 139, 133, 127, 123, 122, 117, 114, 111, 113, 114, 115, 116, 117, 119, 120, 119, 117, 117, 118, 117, 114, 112, 112, 110, 108, 106, 104, 105, 104, 100, 99, 103, 106, 106, 103, 103, 107, 113, 103, 96, 106, 151, 164, 150, 150, 185, 192, 169, 148, 171, 173, 146, 138, 149, 147, 136, 132, 133, 134, 134, 132, 126, 126, 133, 133, 129, 132, 140, 140, 136, 134, 135, 134, 131, 126, 123, 122, 121, 118, 117, 117, 118, 117, 117, 117, 116, 117, 116, 116, 114, 112, 111, 108, 106, 103, 103, 100, 99, 98, 99, 99, 98, 101, 104, 107, 109, 108, 106, 111, 123, 135, 143, 148, 158, 168, 167, 167, 169, 168, 163, 157, 156, 157, 151, 142, 141, 140, 137, 127, 125, 126, 124, 123, 125, 127, 127, 133, 136, 136, 134, 136, 137, 135, 132, 131, 131, 129, 127, 123, 122, 122, 121, 118, 117, 117, 118, 115, 114, 114, 113, 114, 116, 115, 113, 112, 112, 109, 106, 106, 105, 103, 103, 103, 104, 106, 107, 106, 106, 114, 119, 124, 129, 139, 146, 151, 155, 162, 165, 163, 162, 163, 162, 156, 153, 151, 148, 143, 139, 135, 131, 126, 126, 123, 122, 122, 123, 122, 123, 126, 127, 127, 130, 132, 132, 133, 135, 136, 135, 134, 132, 132, 129, 128, 126, 124, 122, 120, 117, 114, 113, 111, 109, 108, 108, 108, 108, 104, 102, 103, 104, 99, 98, 99, 100, 96, 95, 96, 95, 94, 101, 109, 117, 125, 141, 151, 157, 162, 171, 174, 172, 173, 175, 172, 169, 167, 162, 154, 150, 145, 136, 129, 128, 125, 122, 122, 122, 122, 121, 122, 121, 121, 124, 125, 126, 128, 132, 133, 135, 137, 139, 139, 139, 139, 138, 135, 133, 130, 126, 122, 119, 114, 109, 105, 101, 100, 98, 96, 94, 93, 92, 91, 90, 90, 90, 91, 90, 90, 88, 87, 87, 88, 97, 113, 124, 131, 146, 161, 168, 172, 179, 183, 183, 184, 184, 179, 173, 171, 164, 155, 147, 142, 132, 125, 122, 120, 118, 119, 120, 119, 119, 120, 119, 119, 121, 124, 125, 128, 130, 133, 136, 139, 140, 141, 142, 142, 141, 139, 137, 134, 131, 126, 121, 116, 112, 107, 103, 99, 98, 96, 94, 92, 91, 90, 89, 89, 89, 89, 90, 89, 88, 87, 86, 85, 89, 96, 113, 124, 136, 146, 163, 169, 177, 181, 186, 186, 188, 187, 182, 175, 171, 165, 156, 148, 139, 132, 125, 121, 118, 117, 118, 118, 118, 118, 118, 117, 117, 118, 120, 121, 125, 128, 131, 136, 139, 143, 145, 148, 148, 148, 147, 145, 142, 137, 134, 127, 121, 114, 109, 103, 98, 94, 92, 90, 88, 85, 85, 85, 85, 84, 84, 85, 85, 85, 84, 84, 83, 84, 100, 109, 120, 131, 145, 154, 164, 170, 177, 180, 182, 183, 185, 182, 178, 174, 167, 160, 151, 142, 133, 128, 125, 122, 120, 120, 120, 119, 118, 118, 116, 115, 115, 114, 114, 115, 116, 118, 121, 125, 128, 134, 139, 144, 148, 151, 154, 154, 153, 151, 149, 144, 139, 134, 129, 122, 115, 109, 105, 101, 97, 94, 93, 91, 90, 89, 89, 88, 87, 88, 88, 87, 86, 87, 87, 86, 86, 94, 106, 114, 126, 140, 155, 163, 172, 180, 184, 187, 190, 191, 189, 186, 182, 176, 167, 160, 149, 138, 129, 125, 120, 118, 117, 117, 115, 114, 112, 111, 109, 110, 111, 112, 113, 117, 118, 122, 125, 130, 134, 141, 145, 150, 154, 157, 158, 156, 155, 149, 145, 139, 135, 129, 124, 118, 114, 107, 100, 93, 89, 84, 81, 80, 81, 81, 83, 86, 87, 88, 88, 87, 86, 83, 83, 89, 95, 107, 123, 140, 150, 160, 170, 177, 179, 184, 190, 192, 193, 193, 191, 186, 178, 171, 159, 147, 136, 130, 124, 120, 117, 116, 113, 110, 107, 105, 104, 105, 106, 107, 110, 113, 116, 118, 121, 124, 129, 134, 138, 143, 151, 154, 156, 159, 160, 160, 156, 152, 147, 141, 137, 132, 126, 120, 116, 109, 103, 96, 91, 85, 81, 79, 79, 80, 80, 82, 84, 86, 87, 87, 86, 83, 82, 82, 87, 97, 112, 129, 141, 154, 165, 174, 178, 182, 188, 193, 194, 195, 195, 193, 186, 180, 170, 157, 144, 137, 128, 123, 119, 117, 114, 110, 106, 103, 101, 101, 102, 104, 107, 111, 114, 116, 120, 123, 128, 132, 137, 142, 149, 153, 156, 158, 161, 161, 159, 155, 151, 145, 142, 136, 129, 122, 117, 110, 103, 97, 94, 90, 88, 84, 82, 78, 75, 74, 74, 73, 73, 74, 75, 77, 79, 80, 83, 96, 112, 124, 130, 142, 157, 168, 175, 185, 196, 201, 203, 201, 196, 189, 183, 177, 168, 157, 147, 139, 132, 125, 121, 118, 117, 115, 115, 114, 113, 113, 115, 116, 117, 118, 119, 120, 122, 124, 126, 127, 129, 130, 132, 133, 134, 136, 137, 138, 138, 138, 138, 137, 136, 134, 132, 129, 127, 124, 120, 117, 114, 110, 106, 102, 99, 94, 89, 84, 81, 78, 77, 75, 75, 75, 77, 76, 77, 80, 87, 97, 108, 120, 130, 141, 152, 164, 175, 185, 193, 199, 201, 200, 199, 194, 190, 183, 173, 165, 152, 141, 132, 128, 122, 118, 115, 113, 110, 109, 109, 110, 113, 115, 115, 116, 117, 118, 121, 123, 126, 129, 130, 131, 133, 135, 137, 138, 140, 141, 141, 141, 140, 140, 139, 138, 137, 135, 133, 130, 127, 123, 117, 112, 109, 104, 99, 94, 91, 87, 84, 82, 81, 79, 77, 75, 76, 77, 77, 84, 92, 108, 120, 130, 137, 152, 164, 175, 181, 193, 199, 201, 201, 199, 194, 190, 185, 180, 167, 156, 145, 139, 131, 126, 121, 118, 112, 111, 108, 107, 108, 109, 108, 109, 109, 110, 111, 114, 118, 121, 124, 129, 134, 137, 142, 146, 150, 150, 153, 152, 151, 149, 147, 141, 136, 132, 124, 114, 107, 103, 95, 88, 83, 80, 75, 72, 71, 70, 68, 69, 71, 71, 71, 75, 77, 78, 85, 107, 115, 117, 126, 156, 164, 166, 176, 193, 194, 200, 208, 208, 200, 201, 203, 192, 178, 170, 164, 150, 141, 135, 130, 122, 118, 114, 109, 104, 101, 100, 97, 98, 98, 101, 104, 107, 112, 119, 126, 131, 138, 144, 150, 153, 158, 159, 159, 157, 155, 149, 142, 138, 132, 124, 115, 109, 101, 93, 85, 80, 72, 68, 65, 63, 60, 60, 61, 61, 65, 68, 68, 78, 94, 108, 110, 122, 142, 157, 164, 177, 189, 193, 200, 211, 213, 207, 208, 209, 204, 192, 182, 172, 162, 151, 141, 130, 123, 117, 111, 104, 100, 97, 96, 94, 94, 94, 97, 99, 104, 106, 112, 117, 125, 130, 137, 144, 149, 153, 156, 159, 159, 159, 156, 150, 143, 138, 128, 118, 108, 100, 90, 80, 73, 70, 68, 63, 59, 58, 59, 59, 59, 60, 63, 79, 91, 94, 100, 123, 140, 149, 160, 179, 186, 196, 205, 214, 210, 212, 213, 208, 195, 185, 178, 165, 152, 140, 134, 124, 118, 113, 111, 106, 104, 100, 99, 97, 97, 96, 96, 99, 103, 110, 114, 124, 138, 151, 157, 163, 169, 169, 166, 161, 152, 146, 136, 129, 117, 105, 93, 89, 86, 74, 67, 64, 58, 50, 46, 45, 39, 37, 34, 41, 89, 129, 139, 137, 167, 201, 208, 211, 208, 198, 197, 202, 200, 163, 147, 149, 152, 140, 127, 123, 122, 136, 142, 135, 131, 136, 145, 138, 129, 117, 112, 110, 105, 92, 89, 98, 109, 125, 139, 146, 157, 175, 180, 173, 170, 170, 161, 151, 144, 120, 109, 106, 98, 76, 70, 75, 66, 61, 58, 61, 58, 54, 43, 43, 51, 48, 41, 90, 174, 177, 162, 180, 221, 218, 186, 173, 172, 172, 163, 145, 124, 129, 147, 142, 135, 143, 158, 156, 150, 151, 150, 146, 134, 125, 118, 115, 107, 102, 104, 108, 111, 116, 121, 129, 145, 158, 160, 165, 165, 156, 150, 147, 140, 129, 126, 121, 115, 109, 98, 91, 93, 87, 76, 70, 66, 55, 51, 51, 47, 41, 50, 63, 84, 158, 181, 162, 184, 228, 202, 160, 164, 165, 139, 122, 122, 126, 134, 135, 143, 159, 176, 166, 162, 167, 161, 143, 133, 129, 119, 109, 104, 103, 107, 112, 118, 124, 132, 133, 139, 149, 158, 156, 159, 162, 149, 141, 140, 135, 124, 121, 120, 118, 110, 103, 100, 99, 93, 75, 73, 70, 61, 44, 46, 50, 50, 52, 74, 115, 153, 177, 175, 199, 212, 192, 161, 163, 159, 132, 116, 127, 131, 130, 139, 154, 165, 173, 171, 170, 169, 156, 139, 131, 127, 118, 109, 109, 111, 110, 112, 119, 127, 128, 134, 151, 155, 153, 156, 162, 149, 143, 145, 138, 130, 127, 122, 114, 106, 98, 93, 95, 83, 76, 79, 70, 50, 49, 47, 45, 41, 40, 69, 148, 176, 152, 181, 229, 197, 154, 169, 168, 131, 118, 122, 125, 124, 131, 140, 163, 170, 160, 163, 175, 161, 142, 139, 136, 124, 116, 115, 112, 111, 113, 115, 119, 130, 147, 153, 152, 154, 160, 154, 142, 139, 134, 128, 125, 122, 115, 106, 100, 96, 94, 84, 79, 78, 67, 53, 51, 48, 45, 43, 47, 84, 161, 160, 148, 198, 229, 177, 155, 178, 156, 124, 118, 127, 125, 126, 130, 146, 169, 167, 160, 168, 174, 155, 143, 141, 135, 121, 115, 114, 112, 111, 111, 113, 120, 132, 149, 155, 151, 154, 160, 151, 137, 137, 130, 123, 124, 123, 116, 110, 102, 96, 98, 92, 79, 77, 70, 64, 55, 50, 48, 49, 50, 96, 149, 152, 149, 198, 215, 170, 166, 184, 157, 124, 126, 130, 122, 124, 131, 151, 160, 158, 163, 170, 162, 154, 154, 148, 136, 127, 122, 115, 111, 110, 112, 121, 126, 135, 146, 151, 148, 152, 149, 142, 140, 132, 126, 127, 127, 117, 111, 108, 98, 92, 83, 76, 74, 73, 67, 67, 59, 57, 57, 52, 92, 138, 134, 144, 189, 197, 170, 174, 187, 164, 139, 136, 136, 122, 113, 118, 138, 143, 148, 159, 172, 169, 167, 163, 157, 146, 135, 124, 115, 107, 111, 117, 117, 138, 147, 144, 152, 159, 152, 143, 146, 136, 128, 124, 121, 113, 104, 91, 89, 84, 75, 71, 77, 67, 58, 61, 64, 56, 50, 60, 134, 149, 126, 162, 213, 175, 157, 192, 181, 139, 138, 149, 126, 115, 123, 126, 137, 142, 150, 160, 170, 165, 167, 167, 153, 141, 138, 132, 120, 120, 118, 117, 127, 134, 135, 143, 150, 144, 144, 147, 140, 134, 131, 126, 119, 105, 91, 89, 87, 71, 67, 70, 67, 60, 59, 66, 61, 50, 75, 133, 135, 124, 171, 195, 174, 161, 188, 164, 143, 144, 150, 131, 127, 131, 138, 140, 138, 148, 160, 159, 155, 163, 161, 151, 150, 148, 139, 129, 126, 129, 132, 132, 135, 141, 136, 134, 139, 136, 130, 131, 133, 128, 122, 113, 98, 90, 83, 71, 59, 58, 54, 44, 49, 53, 41, 56, 119, 128, 122, 157, 193, 184, 168, 191, 174, 156, 156, 159, 136, 129, 135, 136, 134, 139, 146, 151, 148, 155, 163, 159, 153, 156, 153, 143, 138, 135, 134, 135, 131, 132, 135, 130, 132, 133, 127, 128, 133, 128, 123, 119, 110, 101, 96, 85, 80, 68, 59, 51, 51, 39, 33, 40, 67, 107, 120, 133, 173, 184, 167, 181, 192, 163, 159, 163, 153, 136, 140, 140, 137, 139, 140, 144, 148, 146, 155, 160, 156, 158, 162, 158, 147, 143, 143, 140, 133, 132, 133, 131, 129, 132, 129, 127, 131, 128, 125, 125, 115, 104, 104, 92, 81, 71, 64, 50, 46, 46, 40, 38, 48, 100, 112, 118, 143, 176, 164, 175, 191, 177, 157, 165, 165, 143, 138, 142, 141, 134, 140, 146, 145, 144, 152, 154, 153, 156, 162, 157, 148, 146, 149, 140, 135, 138, 138, 124, 128, 133, 125, 123, 131, 128, 122, 126, 117, 108, 102, 97, 84, 76, 71, 62, 49, 49, 46, 38, 54, 95, 104, 107, 155, 170, 158, 174, 191, 166, 160, 170, 163, 147, 145, 145, 141, 140, 141, 144, 142, 142, 148, 152, 148, 153, 158, 154, 149, 150, 148, 142, 138, 138, 136, 127, 127, 127, 122, 118, 124, 122, 116, 121, 117, 104, 105, 104, 90, 78, 75, 67, 53, 53, 46, 39, 59, 95, 96, 110, 158, 152, 166, 189, 167, 163, 177, 168, 152, 151, 154, 143, 141, 145, 143, 137, 140, 145, 146, 145, 150, 153, 149, 149, 149, 147, 144, 144, 143, 140, 133, 132, 125, 120, 120, 120, 115, 116, 121, 114, 105, 109, 106, 91, 86, 80, 71, 59, 57, 49, 42, 58, 92, 94, 104, 145, 147, 151, 171, 180, 161, 171, 177, 163, 157, 159, 155, 148, 149, 145, 142, 138, 140, 144, 142, 142, 150, 148, 145, 148, 148, 141, 142, 143, 140, 135, 134, 133, 126, 125, 124, 124, 121, 120, 117, 111, 108, 105, 95, 87, 84, 73, 61, 58, 52, 42, 52, 80, 87, 94, 134, 145, 139, 163, 177, 165, 163, 179, 167, 160, 164, 158, 150, 151, 149, 141, 139, 137, 138, 141, 142, 146, 149, 148, 148, 150, 147, 145, 144, 142, 140, 135, 132, 128, 124, 123, 122, 119, 120, 118, 112, 107, 106, 103, 92, 86, 80, 68, 62, 57, 49, 44, 70, 85, 92, 111, 137, 138, 153, 171, 167, 160, 177, 175, 164, 166, 163, 156, 153, 155, 146, 141, 138, 140, 140, 139, 144, 147, 145, 146, 153, 147, 147, 149, 147, 142, 140, 136, 130, 126, 123, 121, 118, 115, 114, 108, 104, 103, 99, 89, 87, 82, 70, 63, 61, 53, 44, 65, 87, 90, 104, 134, 135, 141, 168, 166, 157, 168, 175, 164, 164, 169, 157, 155, 157, 150, 141, 139, 139, 141, 140, 143, 146, 144, 144, 150, 147, 145, 149, 150, 145, 143, 139, 134, 130, 128, 123, 120, 118, 116, 113, 106, 105, 101, 90, 87, 80, 70, 64, 61, 52, 46, 51, 82, 87, 90, 122, 135, 138, 154, 171, 161, 166, 176, 170, 165, 171, 163, 157, 159, 155, 145, 141, 141, 141, 139, 141, 145, 145, 144, 147, 148, 143, 147, 148, 145, 143, 141, 136, 131, 129, 125, 125, 120, 119, 118, 113, 106, 104, 97, 90, 86, 75, 65, 62, 57, 48, 46, 62, 79, 90, 102, 129, 135, 142, 164, 168, 161, 168, 176, 170, 166, 168, 166, 160, 158, 154, 149, 143, 141, 145, 143, 140, 145, 148, 142, 146, 148, 144, 145, 146, 143, 140, 137, 134, 129, 126, 123, 123, 121, 119, 114, 110, 104, 100, 91, 85, 77, 70, 61, 59, 53, 46, 49, 74, 90, 90, 115, 132, 140, 149, 165, 167, 163, 171, 180, 176, 169, 170, 173, 168, 157, 155, 152, 145, 142, 146, 144, 140, 143, 144, 143, 139, 138, 143, 143, 138, 141, 141, 135, 130, 129, 128, 121, 120, 123, 121, 117, 111, 109, 103, 97, 87, 83, 78, 70, 63, 60, 60, 53, 54, 74, 93, 91, 107, 128, 142, 146, 156, 163, 165, 167, 172, 176, 175, 168, 170, 172, 165, 156, 150, 147, 146, 145, 141, 145, 147, 144, 144, 143, 139, 140, 141, 139, 140, 139, 135, 132, 130, 126, 124, 123, 122, 124, 123, 122, 120, 113, 107, 104, 99, 90, 84, 79, 74, 71, 65, 62, 59, 63, 79, 85, 88, 102, 120, 127, 135, 141, 146, 155, 164, 165, 169, 174, 177, 180, 178, 170, 165, 163, 157, 155, 152, 150, 151, 150, 145, 141, 140, 137, 137, 139, 139, 136, 135, 135, 133, 130, 126, 125, 124, 123, 121, 118, 116, 111, 104, 98, 96, 89, 85, 83, 80, 75, 72, 69, 64, 62, 73, 84, 86, 92, 111, 123, 126, 137, 145, 150, 156, 167, 172, 175, 178, 181, 183, 176, 168, 166, 161, 156, 153, 151, 148, 147, 145, 141, 136, 135, 133, 133, 138, 137, 135, 136, 137, 130, 125, 125, 123, 122, 122, 121, 119, 118, 112, 107, 102, 96, 90, 87, 81, 78, 74, 70, 67, 64, 60, 64, 76, 85, 87, 107, 120, 127, 135, 145, 147, 156, 168, 173, 175, 181, 183, 184, 184, 177, 171, 167, 164, 161, 158, 154, 153, 151, 145, 138, 134, 131, 130, 131, 133, 134, 133, 136, 133, 129, 125, 123, 124, 123, 121, 122, 121, 119, 114, 108, 101, 98, 92, 85, 81, 80, 76, 72, 70, 68, 62, 58, 69, 79, 85, 92, 114, 125, 130, 140, 148, 152, 162, 173, 177, 183, 185, 186, 187, 180, 174, 169, 165, 160, 159, 158, 155, 153, 151, 145, 140, 134, 132, 132, 134, 133, 133, 136, 137, 134, 131, 130, 128, 126, 127, 128, 127, 125, 122, 116, 110, 105, 102, 96, 90, 88, 85, 82, 76, 72, 67, 64, 60, 57, 72, 80, 90, 104, 121, 125, 138, 146, 150, 163, 175, 178, 184, 190, 189, 190, 188, 177, 174, 172, 161, 156, 158, 153, 147, 147, 141, 136, 133, 130, 127, 128, 129, 128, 129, 130, 130, 129, 126, 123, 124, 124, 121, 122, 122, 121, 119, 113, 109, 104, 98, 92, 90, 90, 88, 86, 84, 81, 76, 72, 70, 68, 67, 78, 86, 92, 102, 119, 124, 131, 145, 152, 154, 165, 176, 177, 180, 186, 185, 184, 182, 174, 167, 163, 158, 155, 151, 148, 145, 141, 135, 131, 127, 126, 127, 127, 126, 128, 130, 128, 127, 127, 125, 124, 123, 123, 124, 125, 125, 124, 121, 116, 111, 107, 102, 99, 96, 94, 92, 91, 87, 84, 81, 79, 76, 76, 77, 76, 77, 86, 92, 98, 106, 119, 125, 133, 144, 152, 156, 164, 173, 175, 176, 179, 179, 176, 175, 171, 165, 160, 158, 151, 148, 145, 140, 138, 137, 131, 133, 130, 128, 125, 129, 126, 127, 122, 126, 124, 121, 117, 118, 123, 120, 113, 118, 124, 112, 116, 122, 117, 114, 115, 120, 119, 115, 125, 123, 112, 117, 131, 117, 113, 132, 120, 120, 128, 130, 118, 129, 135, 114, 128, 132, 119, 113, 134, 132, 120, 122, 133, 119, 122, 139, 128, 119, 131, 145, 116, 127, 139, 129, 125, 146, 144, 116, 131, 147, 126, 125, 138, 132, 136, 137, 131, 130, 139, 137, 132, 135, 133, 134, 141, 120, 126, 146, 130, 120, 128, 144, 135, 114, 139, 123, 127, 124, 119, 127, 130, 115, 115, 135, 121, 98, 125, 124, 129, 113, 107, 143, 131, 98, 119, 148, 116, 111, 135, 130, 101, 126, 136, 105, 111, 151, 105, 117, 148, 139, 96, 121, 156, 120, 102, 152, 153, 92, 130, 166, 114, 112, 143, 141, 119, 126, 140, 105, 139, 155, 97, 112, 171, 129, 96, 139, 156, 123, 103, 153, 134, 115, 113, 161, 120, 117, 147, 152, 106, 137, 149, 146, 106, 138, 163, 102, 129, 161, 109, 102, 150, 125, 103, 134, 136, 112, 119, 150, 113, 86, 155, 156, 76, 125, 134, 132, 105, 128, 131, 132, 108, 129, 142, 117, 106, 151, 132, 109, 136, 120, 144, 122, 114, 133, 125, 112, 127, 128, 117, 147, 120, 122, 114, 152, 108, 89, 158, 144, 85, 89, 175, 123, 92, 126, 170, 106, 120, 141, 108, 125, 156, 119, 117, 145, 135, 112, 108, 152, 151, 98, 106, 149, 143, 112, 117, 138, 134, 104, 123, 144, 136, 81, 142, 150, 114, 110, 143, 146, 87, 161, 147, 112, 107, 149, 138, 94, 141, 146, 119, 111, 155, 136, 110, 142, 136, 135, 127, 125, 125, 138, 147, 110, 121, 161, 125, 107, 132, 152, 99, 109, 160, 83, 139, 144, 103, 153, 149, 108, 134, 138, 136, 129, 120, 142, 102, 113, 152, 157, 79, 92, 171, 126, 115, 118, 150, 126, 93, 129, 134, 117, 117, 107, 121, 160, 138, 87, 150, 157, 112, 89, 143, 140, 115, 107, 134, 152, 111, 111, 144, 156, 110, 116, 128, 156, 111, 127, 128, 132, 139, 99, 118, 158, 126, 110, 112, 147, 113, 140, 123, 140, 127, 88, 143, 140, 124, 103, 116, 139, 135, 119, 122, 107, 157, 125, 111, 153, 133, 80, 165, 149, 87, 140, 166, 120, 112, 152, 115, 139, 149, 106, 128, 127, 123, 124, 137, 146, 99, 140, 167, 120, 100, 148, 140, 112, 123, 171, 80, 104, 177, 121, 64, 155, 171, 93, 108, 158, 147, 103, 120, 155, 137, 90, 140, 136, 89, 132, 144, 119, 83, 156, 144, 79, 155, 160, 91, 124, 157, 86, 125, 153, 95, 129, 144, 119, 117, 142, 135, 100, 137, 137, 105, 126, 153, 130, 101, 151, 138, 125, 125, 113, 136, 126, 109, 126, 128, 146, 120, 128, 150, 118, 97, 168, 121, 95, 128, 143, 114, 114, 154, 116, 132, 132, 117, 119, 133, 151, 99, 120, 163, 107, 96, 136, 165, 102, 110, 144, 133, 110, 84, 152, 148, 94, 113, 138, 131, 122, 123, 140, 115, 104, 141, 120, 128, 144, 109, 110, 154, 118, 107, 156, 126, 100, 120, 146, 122, 106, 144, 147, 101, 135, 125, 142, 127, 115, 134, 131, 113, 138, 144, 123, 122, 126, 129, 147, 102, 138, 133, 141, 131, 95, 149, 142, 87, 122, 169, 119, 92, 145, 147, 115, 133, 116, 142, 148, 102, 120, 129, 126, 97, 135, 138, 113, 95, 154, 127, 115, 106, 128, 109, 133, 146, 120, 132, 123, 106, 150, 114, 116, 128, 134, 137, 105, 142, 121, 128, 118, 137, 131, 126, 148, 123, 118, 129, 125, 116, 153, 145, 93, 150, 127, 117, 105, 165, 125, 113, 142, 139, 98, 170, 118, 110, 117, 154, 134, 101, 131, 148, 141, 108, 113, 139, 135, 106, 121, 141, 140, 112, 119, 156, 142, 92, 131, 157, 111, 106, 141, 145, 121, 111, 136, 147, 112, 126, 124, 127, 146, 119, 124, 140, 114, 107, 132, 131, 125, 90, 131, 155, 116, 116, 154, 118, 113, 143, 145, 94, 147, 136, 120, 120, 145, 132, 136, 95, 155, 155, 80, 131, 174, 115, 98, 142, 154, 107, 99, 136, 154, 121, 107, 145, 128, 121, 107, 140, 129, 121, 126, 146, 125, 113, 123, 136, 113, 123, 114, 130, 129, 130, 118, 140, 125, 102, 135, 144, 115, 136, 135, 130, 99, 109, 185, 113, 81, 141, 155, 115, 107, 157, 113, 108, 149, 115, 123, 119, 127, 130, 111, 140, 126, 114, 146, 118, 113, 143, 142, 146, 96, 146, 147, 99, 128, 149, 120, 113, 141, 119, 135, 112, 142, 115, 111, 143, 128, 108, 132, 140, 117, 90, 159, 135, 109, 136, 105, 129, 131, 151, 89, 118, 174, 108, 100, 161, 128, 125, 115, 155, 120, 101, 148, 137, 96, 118, 158, 113, 106, 161, 121, 107, 150, 133, 112, 130, 141, 96, 138, 147, 109, 113, 180, 71, 117, 166, 111, 98, 174, 122, 107, 130, 143, 131, 109, 146, 101, 117, 118, 137, 115, 101, 141, 141, 123, 128, 139, 117, 111, 132, 110, 141, 116, 134, 136, 119, 137, 146, 112, 130, 131, 120, 128, 147, 97, 112, 139, 143, 105, 115, 161, 107, 109, 163, 133, 98, 142, 153, 121, 116, 143, 131, 114, 111, 160, 109, 120, 131, 134, 113, 114, 138, 126, 110, 120, 139, 115, 128, 129, 128, 132, 120, 120, 124, 145, 112, 124, 143, 149, 110, 123, 151, 118, 115, 127, 145, 114, 134, 154, 116, 107, 143, 125, 121, 113, 134, 140, 111, 131, 126, 122, 135, 128, 115, 127, 157, 102, 124, 139, 121, 117, 116, 165, 93, 94, 157, 139, 99, 127, 146, 141, 120, 109, 153, 134, 87, 140, 151, 99, 116, 140, 122, 118, 139, 134, 113, 122, 132, 138, 123, 116, 142, 120, 131, 143, 104, 135, 145, 110, 113, 140, 121, 115, 108, 156, 130, 89, 136, 150, 127, 109, 147, 125, 109, 135, 148, 119, 112, 139, 128, 117, 116, 136, 122, 126, 125, 114, 125, 142, 109, 138, 127, 134, 130, 131, 142, 120, 131, 116, 149, 126, 92, 167, 140, 93, 131, 141, 135, 108, 144, 104, 121, 135, 119, 100, 165, 138, 91, 139, 158, 116, 113, 157, 122, 109, 129, 146, 116, 123, 126, 119, 140, 137, 125, 115, 140, 145, 106, 140, 128, 123, 125, 140, 112, 118, 144, 120, 107, 137, 151, 88, 138, 148, 125, 110, 140, 137, 131, 124, 127, 122, 148, 127, 109, 135, 146, 113, 116, 150, 141, 109, 139, 117, 128, 136, 117, 128, 136, 128, 125, 142, 120, 136, 143, 115, 118, 141, 117, 121, 121, 136, 113, 118, 152, 139, 114, 112, 159, 146, 93, 127, 157, 140, 83, 131, 163, 131, 94, 146, 137, 121, 125, 120, 140, 132, 119, 117, 158, 137, 93, 136, 161, 111, 104, 147, 136, 112, 127, 137, 125, 136, 131, 116, 127, 146, 123, 108, 136, 138, 112, 141, 125, 111, 134, 133, 116, 124, 129, 134, 119, 112, 145, 122, 115, 127, 141, 115, 134, 129, 107, 131, 137, 115, 115, 139, 125, 105, 121, 141, 112, 117, 138, 135, 116, 137, 136, 127, 119, 136, 128, 124, 125, 138, 126, 131, 129, 123, 148, 133, 125, 138, 137, 137, 130, 136, 144, 127, 130, 132, 137, 135, 119, 122, 128, 133, 125, 114, 127, 140, 120, 103, 131, 130, 120, 102, 123, 126, 94, 107, 125, 106, 95, 110, 109, 108, 100, 95, 100, 94, 86, 89, 108, 97, 87, 134, 143, 126, 155, 185, 178, 176, 195, 200, 189, 192, 192, 198, 176, 172, 171, 157, 140, 136, 128, 120, 118, 111, 108, 111, 116, 111, 113, 118, 118, 111, 107, 107, 104, 91, 85, 81, 76, 68, 66, 60, 64, 55, 62, 64, 63, 71, 69, 71, 77, 105, 115, 111, 140, 166, 169, 172, 195, 204, 199, 203, 205, 204, 190, 178, 175, 166, 150, 140, 134, 119, 116, 114, 112, 116, 117, 117, 124, 128, 129, 130, 136, 137, 136, 136, 138, 137, 136, 133, 133, 133, 132, 129, 128, 128, 126, 125, 123, 121, 119, 118, 115, 113, 111, 108, 105, 100, 98, 96, 90, 83, 79, 77, 71, 63, 57, 61, 57, 60, 68, 79, 108, 117, 134, 152, 181, 191, 200, 210, 219, 212, 208, 207, 200, 182, 168, 161, 147, 135, 124, 117, 113, 110, 108, 106, 109, 116, 118, 120, 124, 131, 132, 133, 136, 138, 137, 138, 138, 136, 135, 134, 132, 131, 131, 130, 128, 127, 127, 125, 125, 123, 121, 120, 118, 115, 113, 110, 109, 104, 100, 98, 95, 87, 83, 78, 75, 69, 61, 59, 61, 57, 63, 73, 100, 111, 119, 144, 175, 184, 192, 204, 219, 219, 208, 207, 203, 195, 176, 164, 151, 141, 130, 119, 113, 110, 108, 107, 106, 111, 117, 119, 124, 128, 133, 133, 136, 139, 138, 138, 138, 137, 134, 134, 133, 130, 129, 129, 129, 127, 126, 126, 126, 124, 123, 122, 120, 118, 117, 114, 112, 108, 107, 102, 98, 93, 88, 83, 76, 69, 65, 59, 58, 50, 58, 74, 78, 103, 122, 137, 149, 178, 199, 200, 212, 222, 219, 214, 208, 203, 179, 170, 159, 141, 127, 119, 114, 104, 102, 102, 105, 105, 109, 115, 120, 123, 128, 130, 134, 136, 137, 138, 136, 136, 135, 134, 131, 131, 130, 129, 128, 128, 127, 127, 128, 127, 126, 126, 126, 124, 125, 124, 121, 119, 121, 118, 114, 112, 110, 102, 99, 94, 84, 75, 73, 70, 61, 52, 55, 57, 71, 81, 92, 114, 134, 150, 164, 184, 200, 207, 212, 217, 214, 209, 197, 189, 172, 158, 142, 135, 120, 112, 107, 102, 101, 103, 105, 107, 115, 118, 122, 127, 133, 134, 136, 137, 139, 137, 137, 137, 134, 133, 131, 131, 128, 128, 128, 127, 127, 128, 127, 125, 126, 126, 122, 123, 123, 121, 119, 120, 119, 114, 113, 109, 104, 98, 93, 83, 74, 71, 65, 55, 51, 54, 61, 64, 74, 98, 117, 136, 152, 177, 190, 203, 214, 217, 217, 215, 214, 199, 183, 173, 158, 147, 134, 123, 112, 107, 107, 102, 102, 103, 111, 113, 120, 123, 128, 132, 133, 134, 137, 138, 137, 135, 135, 134, 132, 130, 129, 128, 127, 127, 126, 126, 126, 127, 126, 126, 126, 126, 125, 125, 124, 123, 123, 123, 122, 121, 120, 120, 117, 114, 109, 106, 100, 91, 86, 79, 74, 67, 61, 54, 52, 58, 70, 82, 96, 119, 138, 154, 167, 193, 205, 213, 217, 219, 215, 210, 204, 187, 172, 158, 147, 132, 119, 110, 104, 101, 100, 100, 101, 106, 113, 117, 124, 127, 132, 136, 139, 140, 141, 140, 139, 139, 137, 133, 131, 130, 128, 126, 125, 125, 124, 124, 125, 125, 125, 126, 126, 126, 125, 124, 123, 122, 121, 121, 119, 118, 118, 119, 118, 116, 114, 110, 106, 102, 95, 87, 80, 77, 72, 66, 61, 57, 59, 70, 82, 105, 120, 138, 153, 172, 188, 200, 211, 216, 216, 215, 212, 204, 192, 176, 162, 147, 138, 126, 115, 103, 101, 101, 99, 101, 106, 109, 114, 122, 127, 127, 132, 138, 140, 140, 141, 140, 139, 137, 135, 132, 130, 129, 127, 126, 125, 125, 124, 125, 125, 126, 126, 126, 126, 126, 126, 125, 124, 124, 123, 122, 122, 122, 121, 122, 121, 120, 120, 119, 114, 107, 104, 97, 87, 80, 77, 68, 61, 59, 55, 52, 63, 76, 85, 106, 130, 147, 160, 178, 196, 206, 214, 219, 216, 211, 208, 200, 183, 169, 159, 143, 129, 121, 114, 105, 101, 100, 100, 103, 107, 110, 115, 120, 125, 128, 132, 134, 136, 138, 140, 139, 138, 136, 135, 133, 132, 130, 129, 128, 127, 126, 126, 125, 125, 125, 125, 125, 126, 126, 126, 126, 126, 126, 126, 125, 125, 124, 123, 123, 122, 122, 121, 120, 119, 118, 116, 110, 107, 102, 97, 89, 84, 79, 73, 68, 65, 62, 59, 65, 73, 90, 112, 130, 137, 151, 170, 187, 197, 209, 213, 211, 210, 206, 197, 184, 168, 157, 142, 132, 123, 116, 109, 103, 101, 102, 106, 109, 112, 115, 119, 123, 127, 130, 132, 133, 133, 134, 135, 135, 135, 134, 132, 131, 131, 130, 130, 128, 127, 127, 126, 126, 126, 126, 125, 125, 126, 126, 126, 126, 126, 127, 127, 127, 128, 127, 127, 126, 125, 124, 123, 122, 120, 119, 117, 114, 111, 107, 102, 97, 94, 88, 81, 74, 71, 67, 63, 63, 67, 74, 90, 109, 126, 140, 154, 168, 177, 194, 207, 213, 210, 207, 199, 192, 186, 174, 157, 143, 132, 125, 118, 112, 106, 104, 103, 105, 108, 111, 116, 119, 121, 124, 127, 130, 132, 133, 132, 132, 133, 133, 134, 134, 132, 131, 130, 130, 130, 130, 128, 127, 127, 126, 126, 126, 125, 125, 125, 125, 125, 126, 126, 127, 127, 128, 128, 128, 129, 129, 128, 127, 126, 125, 124, 122, 119, 116, 114, 111, 107, 104, 100, 95, 91, 88, 88, 86, 83, 79, 77, 72, 69, 84, 94, 109, 122, 133, 144, 147, 165, 185, 196, 198, 201, 196, 189, 187, 183, 171, 156, 147, 132, 123, 120, 118, 112, 107, 104, 102, 107, 114, 117, 118, 121, 122, 124, 127, 130, 130, 130, 131, 131, 132, 134, 135, 134, 133, 132, 131, 131, 130, 129, 128, 128, 127, 126, 126, 126, 126, 125, 125, 125, 125, 126, 126, 126, 127, 128, 129, 129, 130, 130, 130, 131, 131, 130, 129, 127, 125, 124, 122, 120, 115, 111, 105, 102, 100, 98, 93, 90, 88, 86, 86, 87, 87, 86, 85, 90, 98, 112, 124, 131, 139, 147, 157, 170, 178, 185, 186, 186, 183, 180, 177, 172, 165, 153, 141, 132, 127, 121, 116, 110, 108, 107, 109, 112, 114, 116, 118, 120, 123, 126, 128, 129, 129, 129, 130, 131, 132, 132, 132, 132, 132, 132, 132, 132, 131, 130, 129, 128, 128, 128, 127, 127, 126, 126, 126, 126, 126, 125, 125, 126, 126, 126, 127, 127, 128, 128, 129, 130, 130, 130, 130, 130, 129, 129, 129, 128, 125, 122, 120, 117, 116, 112, 109, 105, 102, 102, 101, 100, 98, 97, 96, 97, 99, 99, 101, 102, 108, 115, 119, 126, 133, 141, 147, 157, 164, 167, 169, 169, 170, 169, 166, 162, 154, 146, 139, 136, 130, 124, 119, 117, 117, 116, 118, 118, 118, 120, 122, 123, 125, 126, 126, 126, 127, 129, 129, 130, 130, 130, 131, 131, 131, 131, 131, 130, 129, 129, 128, 128, 127, 127, 126, 126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 129, 129, 130, 131, 133, 134, 135, 136, 135, 134, 133, 131, 127, 123, 116, 112, 105, 96, 87, 83, 76, 70, 65, 65, 62, 72, 87, 96, 102, 113, 126, 141, 154, 171, 175, 180, 185, 188, 189, 189, 182, 168, 159, 155, 149, 139, 130, 119, 113, 111, 111, 105, 102, 102, 102, 105, 108, 111, 111, 115, 120, 124, 128, 133, 134, 135, 139, 142, 140, 138, 137, 135, 132, 132, 129, 125, 123, 123, 121, 121, 121, 120, 118, 119, 121, 121, 121, 122, 122, 123, 125, 127, 127, 127, 128, 129, 129, 130, 130, 129, 130, 131, 131, 130, 129, 130, 129, 129, 131, 130, 130, 130, 130, 129, 129, 129, 128, 126, 125, 125, 123, 123, 123, 122, 122, 123, 123, 125, 126, 126, 127, 129, 130, 130, 130, 130, 130, 130, 131, 131, 131, 130, 130, 131, 131, 130, 129, 129, 128, 127, 126, 125, 125, 124, 124, 124, 124, 123, 123, 124, 124, 124, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 128, 128, 128, 129, 129, 130, 130, 129, 129, 128, 127, 127, 126, 126, 125, 125, 124, 124, 124, 124, 124, 125, 125, 125, 126, 127, 127, 127, 127, 128, 128, 128, 127, 127, 126, 126, 126, 125, 126, 125, 125, 126, 126, 126, 126, 127, 127, 127, 126, 126, 126, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 126, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 125, 121, 125, 125, 122, 126, 129, 126, 124, 130, 130, 128, 130, 132, 130, 130, 132, 131, 131, 130, 130, 128, 127, 127, 128, 125, 125, 126, 124, 124, 126, 125, 125, 126, 125, 126, 128, 128, 128, 128, 128, 128, 128, 129, 129, 128, 128, 129, 128, 128, 128, 128, 127, 127, 127, 126, 126, 127, 126, 125, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 127, 126, 126, 126, 127, 126, 126, 127, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 127, 127, 127, 127, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 127, 127, 127, 127, 127, 127, 127, 126, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, };
7353f7c989c6b141f8f54a82150c2e17697434aa
14355f60733dce9b2f73daca94afe507981fb99d
/Hashes/RIPEMD_Const.h
cff27a9d5072649ac7d76eb7add8ad02982ed685
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
r4yan2/OpenPGP
86906fd33440b1c567b4fc0f13ad4f11a925d632
0299d96ee3b60d1d29b2d59f43610603a1135a5e
refs/heads/master
2021-12-31T09:19:32.855072
2018-02-13T12:36:55
2018-02-13T12:36:55
150,585,547
0
0
MIT
2018-09-27T12:45:55
2018-09-27T12:45:55
null
UTF-8
C
false
false
3,121
h
RIPEMD_Const.h
/* RIPEMD_Const.h Constant values shared by RIPEMD128 and RIPEMD160 Copyright (c) 2013 - 2017 Jason Lee @ calccrypto at gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __RIPEMD_CONST__ #define __RIPEMD_CONST__ const uint32_t RIPEMD_H0 = 0x67452301; const uint32_t RIPEMD_H1 = 0xEFCDAB89; const uint32_t RIPEMD_H2 = 0x98BADCFE; const uint32_t RIPEMD_H3 = 0x10325476; const uint32_t RIPEMD_H4 = 0xC3D2E1F0; const uint8_t RIPEMD_s[80] = {11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6}; const uint8_t RIPEMD_S[80] = {8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11}; const uint8_t RIPEMD_r[80] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13}; const uint8_t RIPEMD_R[80] = {5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11}; #endif
b3db385431a93b1d1bc70cf503f7c2a51e9fd4a7
1084b5d9270b1598982e814c76ec18c67ff9765f
/xwords/xwords4/common/server.c
95f8dc92b77e33ff0ce8baee9754da44f7b9044a
[]
no_license
fireworks-world/crossword-game
b5672022c1fe26bf1f8c8ed02ae38b0510a35a49
03946e5763d4c0db8750228f7a37793e8143b476
refs/heads/master
2022-12-22T04:51:37.521177
2020-08-25T06:29:57
2020-08-25T06:29:57
290,132,640
1
0
null
null
null
null
UTF-8
C
false
false
80,717
c
server.c
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */ /* * Copyright 1997-2009 by Eric House (xwords@eehouse.org). All rights * reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* #include <assert.h> */ #include "comtypes.h" #include "server.h" #include "util.h" #include "model.h" #include "comms.h" #include "memstream.h" #include "game.h" /* #include "board.h" */ #include "states.h" #include "xwproto.h" #include "util.h" #include "pool.h" #include "engine.h" #include "strutils.h" #include "LocalizedStrIncludes.h" #ifdef CPLUS extern "C" { #endif #define sEND 0x73454e44 #define LOCAL_ADDR NULL #define IS_ROBOT(p) ((p)->isRobot) #define IS_LOCAL(p) ((p)->isLocal) enum { END_REASON_USER_REQUEST, END_REASON_OUT_OF_TILES, END_REASON_TOO_MANY_PASSES }; typedef XP_U8 GameEndReason; typedef struct ServerPlayer { EngineCtxt* engine; /* each needs his own so don't interfere each other */ XP_S8 deviceIndex; /* 0 means local, -1 means unknown */ } ServerPlayer; #define UNKNOWN_DEVICE -1 #define SERVER_DEVICE 0 typedef struct RemoteAddress { XP_PlayerAddr channelNo; } RemoteAddress; /* These are the parts of the server's state that needs to be preserved across a reset/new game */ typedef struct ServerVolatiles { ModelCtxt* model; CommsCtxt* comms; XW_UtilCtxt* util; CurGameInfo* gi; TurnChangeListener turnChangeListener; void* turnChangeData; GameOverListener gameOverListener; void* gameOverData; XWStreamCtxt* prevMoveStream; /* save it to print later */ XW_State stateAfterShow; /* do I need to serialize this? What if someone quits before I can show the scores? PENDING(ehouse) */ XP_Bool showPrevMove; } ServerVolatiles; typedef struct ServerNonvolatiles { XP_U8 nDevices; XW_State gameState; XP_S8 currentTurn; /* invalid when game is over */ XP_U8 pendingRegistrations; XP_Bool showRobotScores; #ifdef XWFEATURE_SLOW_ROBOT XP_U16 robotThinkMin, robotThinkMax; /* not saved (yet) */ #endif RemoteAddress addresses[MAX_NUM_PLAYERS]; } ServerNonvolatiles; struct ServerCtxt { ServerVolatiles vol; ServerNonvolatiles nv; PoolContext* pool; BadWordInfo illegalWordInfo; #ifndef XWFEATURE_STANDALONE_ONLY XP_U16 lastMoveSource; #endif ServerPlayer players[MAX_NUM_PLAYERS]; XP_Bool serverDoing; #ifdef XWFEATURE_SLOW_ROBOT XP_Bool robotWaiting; #endif MPSLOT }; #ifdef XWFEATURE_SLOW_ROBOT # define ROBOTWAITING(s) (s)->robotWaiting #else # define ROBOTWAITING(s) XP_FALSE #endif #define NPASSES_OK(s) model_recentPassCountOk((s)->vol.model) /******************************* prototypes *******************************/ static void assignTilesToAll( ServerCtxt* server ); static void resetEngines( ServerCtxt* server ); static void nextTurn( ServerCtxt* server, XP_S16 nxtTurn ); static void doEndGame( ServerCtxt* server ); static void endGameInternal( ServerCtxt* server, GameEndReason why ); static void badWordMoveUndoAndTellUser( ServerCtxt* server, BadWordInfo* bwi ); static XP_Bool tileCountsOk( const ServerCtxt* server ); static void setTurn( ServerCtxt* server, XP_S16 turn ); #ifndef XWFEATURE_STANDALONE_ONLY static XP_Bool handleRegistrationMsg( ServerCtxt* server, XWStreamCtxt* stream ); static void registerRemotePlayer( ServerCtxt* server, XWStreamCtxt* stream ); static void server_sendInitialMessage( ServerCtxt* server ); static void sendBadWordMsgs( ServerCtxt* server ); static XP_Bool handleIllegalWord( ServerCtxt* server, XWStreamCtxt* incoming ); static void tellMoveWasLegal( ServerCtxt* server ); #endif #define PICK_NEXT -1 #if defined DEBUG && ! defined XWFEATURE_STANDALONE_ONLY static char* getStateStr( XW_State st ) { # define CASESTR(c) case c: return #c switch( st ) { CASESTR(XWSTATE_NONE); CASESTR(XWSTATE_BEGIN); CASESTR(XWSTATE_NEED_SHOWSCORE); CASESTR(XWSTATE_WAITING_ALL_REG); CASESTR(XWSTATE_RECEIVED_ALL_REG); CASESTR(XWSTATE_NEEDSEND_BADWORD_INFO); CASESTR(XWSTATE_MOVE_CONFIRM_WAIT); CASESTR(XWSTATE_MOVE_CONFIRM_MUSTSEND); CASESTR(XWSTATE_NEEDSEND_ENDGAME); CASESTR(XWSTATE_INTURN); CASESTR(XWSTATE_GAMEOVER); default: return "unknown"; } # undef CASESTR } #endif #if 0 static void logNewState( XW_State old, XW_State newst ) { if ( old != newst ) { char* oldStr = getStateStr(old); char* newStr = getStateStr(newst); XP_LOGF( "state transition %s => %s", oldStr, newStr ); } } # define SETSTATE( s, st ) { XW_State old = (s)->nv.gameState; \ (s)->nv.gameState = (st); \ logNewState(old, st); } #else # define SETSTATE( s, st ) (s)->nv.gameState = (st) #endif /***************************************************************************** * ****************************************************************************/ static void initServer( ServerCtxt* server ) { setTurn( server, -1 ); /* game isn't under way yet */ if ( 0 ) { #ifndef XWFEATURE_STANDALONE_ONLY } else if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) { SETSTATE( server, XWSTATE_NONE ); #endif } else { SETSTATE( server, XWSTATE_BEGIN ); } #ifndef XWFEATURE_STANDALONE_ONLY { XP_U16 ii; CurGameInfo* gi = server->vol.gi; LocalPlayer* lp = gi->players; ServerPlayer* player = server->players; for ( ii = 0; ii < gi->nPlayers; ++ii, ++lp, ++player ) { if ( !lp->isLocal/* && !lp->name */ ) { ++server->nv.pendingRegistrations; } player->deviceIndex = lp->isLocal? SERVER_DEVICE : UNKNOWN_DEVICE; } } #endif server->nv.nDevices = 1; /* local device (0) is always there */ } /* initServer */ ServerCtxt* server_make( MPFORMAL ModelCtxt* model, CommsCtxt* comms, XW_UtilCtxt* util ) { ServerCtxt* result = (ServerCtxt*)XP_MALLOC( mpool, sizeof(*result) ); if ( result != NULL ) { XP_MEMSET( result, 0, sizeof(*result) ); MPASSIGN(result->mpool, mpool); result->vol.model = model; result->vol.comms = comms; result->vol.util = util; result->vol.gi = util->gameInfo; initServer( result ); } return result; } /* server_make */ static void getNV( XWStreamCtxt* stream, ServerNonvolatiles* nv, XP_U16 nPlayers ) { XP_U16 i; /* This should go away when stream format changes */ (void)stream_getBits( stream, 3 ); /* was npassesinrow */ nv->nDevices = (XP_U8)stream_getBits( stream, NDEVICES_NBITS ); if ( stream_getVersion( stream ) > STREAM_VERS_41B4 ) { ++nv->nDevices; } XP_ASSERT( XWSTATE_GAMEOVER < 1<<4 ); nv->gameState = (XW_State)stream_getBits( stream, 4 ); nv->currentTurn = (XP_S8)stream_getBits( stream, NPLAYERS_NBITS ) - 1; nv->pendingRegistrations = (XP_U8)stream_getBits( stream, NPLAYERS_NBITS ); for ( i = 0; i < nPlayers; ++i ) { nv->addresses[i].channelNo = (XP_PlayerAddr)stream_getBits( stream, 16 ); } } /* getNV */ static void putNV( XWStreamCtxt* stream, ServerNonvolatiles* nv, XP_U16 nPlayers ) { XP_U16 i; stream_putBits( stream, 3, 0 ); /* was nPassesInRow */ /* number of players is upper limit on device count */ stream_putBits( stream, NDEVICES_NBITS, nv->nDevices-1 ); XP_ASSERT( XWSTATE_GAMEOVER < 1<<4 ); stream_putBits( stream, 4, nv->gameState ); /* +1: make -1 (NOTURN) into a positive number */ stream_putBits( stream, NPLAYERS_NBITS, nv->currentTurn+1 ); stream_putBits( stream, NPLAYERS_NBITS, nv->pendingRegistrations ); for ( i = 0; i < nPlayers; ++i ) { stream_putBits( stream, 16, nv->addresses[i].channelNo ); } } /* putNV */ ServerCtxt* server_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model, CommsCtxt* comms, XW_UtilCtxt* util, XP_U16 nPlayers ) { ServerCtxt* server; short i; CurGameInfo* gi = util->gameInfo; server = server_make( MPPARM(mpool) model, comms, util ); getNV( stream, &server->nv, nPlayers ); if ( stream_getBits(stream, 1) != 0 ) { server->pool = pool_makeFromStream( MPPARM(mpool) stream ); } for ( i = 0; i < nPlayers; ++i ) { ServerPlayer* player = &server->players[i]; player->deviceIndex = stream_getU8( stream ); if ( stream_getU8( stream ) != 0 ) { LocalPlayer* lp = &gi->players[i]; player->engine = engine_makeFromStream( MPPARM(mpool) stream, util, lp->isRobot ); } } if ( STREAM_VERS_ALWAYS_MULTI <= stream_getVersion(stream) #ifndef PREV_WAS_STANDALONE_ONLY || XP_TRUE #endif ) { server->lastMoveSource = (XP_U16)stream_getBits( stream, 2 ); } XP_ASSERT( stream_getU32( stream ) == sEND ); return server; } /* server_makeFromStream */ void server_writeToStream( ServerCtxt* server, XWStreamCtxt* stream ) { XP_U16 i; XP_U16 nPlayers = server->vol.gi->nPlayers; putNV( stream, &server->nv, nPlayers ); stream_putBits( stream, 1, server->pool != NULL ); if ( server->pool != NULL ) { pool_writeToStream( server->pool, stream ); } for ( i = 0; i < nPlayers; ++i ) { ServerPlayer* player = &server->players[i]; stream_putU8( stream, player->deviceIndex ); stream_putU8( stream, (XP_U8)(player->engine != NULL) ); if ( player->engine != NULL ) { engine_writeToStream( player->engine, stream ); } } #ifndef XWFEATURE_STANDALONE_ONLY stream_putBits( stream, 2, server->lastMoveSource ); #else stream_putBits( stream, 2, 0 ); #endif #ifdef DEBUG stream_putU32( stream, sEND ); #endif } /* server_writeToStream */ static void cleanupServer( ServerCtxt* server ) { XP_U16 i; for ( i = 0; i < VSIZE(server->players); ++i ){ ServerPlayer* player = &server->players[i]; if ( player->engine != NULL ) { engine_destroy( player->engine ); } } XP_MEMSET( server->players, 0, sizeof(server->players) ); if ( server->pool != NULL ) { pool_destroy( server->pool ); server->pool = (PoolContext*)NULL; } XP_MEMSET( &server->nv, 0, sizeof(server->nv) ); if ( !!server->vol.prevMoveStream ) { stream_destroy( server->vol.prevMoveStream ); server->vol.prevMoveStream = NULL; } } /* cleanupServer */ void server_reset( ServerCtxt* server, CommsCtxt* comms ) { ServerVolatiles vol = server->vol; cleanupServer( server ); vol.comms = comms; server->vol = vol; initServer( server ); } /* server_reset */ void server_destroy( ServerCtxt* server ) { cleanupServer( server ); XP_FREE( server->mpool, server ); } /* server_destroy */ #ifdef XWFEATURE_SLOW_ROBOT static int figureSleepTime( const ServerCtxt* server ) { int result = 0; XP_U16 min = server->nv.robotThinkMin; XP_U16 max = server->nv.robotThinkMax; if ( min < max ) { int diff = max - min + 1; result = XP_RANDOM() % diff; } result += min; return result; } #endif void server_prefsChanged( ServerCtxt* server, CommonPrefs* cp ) { server->nv.showRobotScores = cp->showRobotScores; #ifdef XWFEATURE_SLOW_ROBOT server->nv.robotThinkMin = cp->robotThinkMin; server->nv.robotThinkMax = cp->robotThinkMax; #endif } /* server_prefsChanged */ XP_S16 server_countTilesInPool( ServerCtxt* server ) { XP_S16 result = -1; PoolContext* pool = server->pool; if ( !!pool ) { result = pool_getNTilesLeft( pool ); } return result; } /* server_countTilesInPool */ /* I'm a client device. It's my job to start the whole conversation by * contacting the server and telling him that I exist (and some other stuff, * including what the players here want to be called.) */ #define NAME_LEN_NBITS 6 #define MAX_NAME_LEN ((1<<(NAME_LEN_NBITS-1))-1) #ifndef XWFEATURE_STANDALONE_ONLY void server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream ) { CurGameInfo* gi = server->vol.gi; XP_U16 nPlayers; LocalPlayer* lp; #ifdef DEBUG XP_U16 i = 0; #endif XP_ASSERT( gi->serverRole == SERVER_ISCLIENT ); XP_ASSERT( stream != NULL ); XP_ASSERT( server->nv.gameState == XWSTATE_NONE ); stream_open( stream ); stream_putBits( stream, XWPROTO_NBITS, XWPROTO_DEVICE_REGISTRATION ); nPlayers = gi->nPlayers; XP_ASSERT( nPlayers > 0 ); stream_putBits( stream, NPLAYERS_NBITS, nPlayers ); for ( lp = gi->players; nPlayers-- > 0; ++lp ) { XP_UCHAR* name; XP_U8 len; XP_ASSERT( i++ < MAX_NUM_PLAYERS ); stream_putBits( stream, 1, lp->isRobot ); /* better not to send this */ /* The first nPlayers players are the ones we'll use. The local flag doesn't matter when for SERVER_ISCLIENT. */ name = emptyStringIfNull(lp->name); len = XP_STRLEN(name); if ( len > MAX_NAME_LEN ) { len = MAX_NAME_LEN; } stream_putBits( stream, NAME_LEN_NBITS, len ); stream_putBytes( stream, name, len ); } stream_destroy( stream ); } /* server_initClientConnection */ #endif static void callTurnChangeListener( ServerCtxt* server ) { if ( server->vol.turnChangeListener != NULL ) { (*server->vol.turnChangeListener)( server->vol.turnChangeData ); } } /* callTurnChangeListener */ #ifndef XWFEATURE_STANDALONE_ONLY static XP_Bool handleRegistrationMsg( ServerCtxt* server, XWStreamCtxt* stream ) { XP_Bool success = XP_TRUE; XP_U16 playersInMsg, i; LOG_FUNC(); /* code will have already been consumed */ playersInMsg = (XP_U16)stream_getBits( stream, NPLAYERS_NBITS ); XP_ASSERT( playersInMsg > 0 ); if ( server->nv.pendingRegistrations < playersInMsg ) { util_userError( server->vol.util, ERR_REG_UNEXPECTED_USER ); success = XP_FALSE; } else { for ( i = 0; i < playersInMsg; ++i ) { registerRemotePlayer( server, stream ); /* This is abusing the semantics of turn change -- at least in the case where there is another device yet to register -- but we need to let the board know to redraw the scoreboard with more players there. */ callTurnChangeListener( server ); } if ( server->nv.pendingRegistrations == 0 ) { assignTilesToAll( server ); SETSTATE( server, XWSTATE_RECEIVED_ALL_REG ); } } return success; } /* handleRegistrationMsg */ #endif /* Just for grins....trade in all the tiles that weren't used in the * move the robot manage to make. This is not meant to be strategy, but * rather to force me to make the trade-communication stuff work well. */ #if 0 static void robotTradeTiles( ServerCtxt* server, MoveInfo* newMove ) { Tile tradeTiles[MAX_TRAY_TILES]; XP_S16 turn = server->nv.currentTurn; Tile* curTiles = model_getPlayerTiles( server->model, turn ); XP_U16 numInTray = model_getNumPlayerTiles( server->model, turn ); XP_MEMCPY( tradeTiles, curTiles, numInTray ); for ( i = 0; i < numInTray; ++i ) { /* for each tile in tray */ XP_Bool keep = XP_FALSE; for ( j = 0; j < newMove->numTiles; ++j ) { /* for each in move */ Tile movedTile = newMove->tiles[j].tile; if ( newMove->tiles[j].isBlank ) { movedTile |= TILE_BLANK_BIT; } if ( movedTile == curTiles[i] ) { /* it's in the move */ keep = XP_TRUE; break; } } if ( !keep ) { tradeTiles[numToTrade++] = curTiles[i]; } } } /* robotTradeTiles */ #endif #define FUDGE_RANGE 10 #define MINIMUM_SCORE 5 static XP_U16 figureTargetScore( ServerCtxt* server, XP_U16 turn ) { XP_S16 result = 1000; XP_S16 highScore = 0; ModelCtxt* model = server->vol.model; XP_U16 nPlayers = server->vol.gi->nPlayers; XP_U16 i; XP_ASSERT( IS_ROBOT(&server->vol.gi->players[turn]) ); if ( 1 /* server->nHumanPlayers > 0 */ ) { result = 0; /* find the highest score anybody but the current player has */ for ( i = 0; i < nPlayers; ++i ) { if ( i != turn ) { XP_S16 score = model_getPlayerScore( model, i ); XP_ASSERT( score >= 0 ); if ( highScore < score ) { highScore = score; } } } result = (XP_S16)(highScore - model_getPlayerScore( model, turn ) + (FUDGE_RANGE-(XP_RANDOM() % (FUDGE_RANGE*2)))); if ( result < 0 ) { result = MINIMUM_SCORE; } } return result; } /* figureTargetScore */ static XWStreamCtxt* mkServerStream( ServerCtxt* server ) { XWStreamCtxt* stream; stream = mem_stream_make( MPPARM(server->mpool) util_getVTManager(server->vol.util), NULL, CHANNEL_NONE, (MemStreamCloseCallback)NULL ); XP_ASSERT( !!stream ); return stream; } /* mkServerStream */ static XP_Bool makeRobotMove( ServerCtxt* server ) { XP_Bool result = XP_FALSE; XP_Bool finished; XP_S16 turn; const TrayTileSet* tileSet; MoveInfo newMove; ModelCtxt* model = server->vol.model; CurGameInfo* gi = server->vol.gi; XP_Bool timerEnabled = gi->timerEnabled; XP_Bool canMove; XP_U32 time = 0L; /* stupid compiler.... */ XP_U16 targetScore = NO_SCORE_LIMIT; XW_UtilCtxt* util = server->vol.util; if ( timerEnabled ) { time = util_getCurSeconds( util ); } turn = server->nv.currentTurn; XP_ASSERT( turn >= 0 ); /* If the player's been recently turned into a robot while he had some pending tiles on the board we'll have problems. It'd be best to detect this and put 'em back when that happens. But for now we'll just be paranoid. PENDING(ehouse) */ model_resetCurrentTurn( model, turn ); tileSet = model_getPlayerTiles( model, turn ); if ( gi->robotSmartness == DUMB_ROBOT ) { targetScore = figureTargetScore( server, turn ); } XP_ASSERT( !!server_getEngineFor( server, turn ) ); finished = engine_findMove( server_getEngineFor( server, turn ), model, model_getDictionary( model ), tileSet->tiles, tileSet->nTiles, #ifdef XWFEATURE_SEARCHLIMIT NULL, XP_FALSE, #endif targetScore, &canMove, &newMove ); if ( finished ) { const XP_UCHAR* str; XWStreamCtxt* stream = NULL; XP_Bool trade = (newMove.nTiles == 0) && canMove && (server_countTilesInPool( server ) >= MAX_TRAY_TILES); server->vol.showPrevMove = XP_TRUE; if ( server->nv.showRobotScores ) { stream = mkServerStream( server ); } /* trade if unable to find a move */ if ( trade ) { result = server_commitTrade( server, ALLTILES ); /* Quick hack to fix gremlin bug where all-robot game seen none able to trade for tiles to move and blowing the undo stack. This will stop them, and should have no effect if there are any human players making real moves. */ if ( !!stream ) { XP_UCHAR buf[64]; str = util_getUserString(util, STRD_ROBOT_TRADED); XP_SNPRINTF( buf, sizeof(buf), str, MAX_TRAY_TILES ); stream_catString( stream, buf ); XP_ASSERT( !server->vol.prevMoveStream ); server->vol.prevMoveStream = stream; } } else { /* if canMove is false, this is a fake move, a pass */ if ( canMove || NPASSES_OK(server) ) { model_makeTurnFromMoveInfo( model, turn, &newMove ); if ( !!stream ) { (void)model_checkMoveLegal( model, turn, stream, NULL ); XP_ASSERT( !server->vol.prevMoveStream ); server->vol.prevMoveStream = stream; } result = server_commitMove( server ); } else { result = XP_FALSE; } } } if ( timerEnabled ) { gi->players[turn].secondsUsed += (XP_U16)(util_getCurSeconds( util ) - time); } else { XP_ASSERT( gi->players[turn].secondsUsed == 0 ); } return result; /* always return TRUE after robot move? */ } /* makeRobotMove */ #ifdef XWFEATURE_SLOW_ROBOT static XP_Bool wakeRobotProc( void* closure, XWTimerReason XP_UNUSED_DBG(why) ) { XP_ASSERT( TIMER_SLOWROBOT == why ); ServerCtxt* server = (ServerCtxt*)closure; XP_ASSERT( ROBOTWAITING(server) ); server->robotWaiting = XP_FALSE; util_requestTime( server->vol.util ); return XP_FALSE; } #endif static XP_Bool robotMovePending( const ServerCtxt* server ) { XP_Bool result = XP_FALSE; XP_S16 turn = server->nv.currentTurn; if ( turn >= 0 && tileCountsOk(server) && NPASSES_OK(server) ) { CurGameInfo* gi = server->vol.gi; LocalPlayer* player = &gi->players[turn]; result = IS_ROBOT(player) && IS_LOCAL(player); } return result; } /* robotMovePending */ #ifdef XWFEATURE_SLOW_ROBOT static XP_Bool postponeRobotMove( ServerCtxt* server ) { XP_Bool result = XP_FALSE; XP_ASSERT( robotMovePending(server) ); if ( !ROBOTWAITING(server) ) { XP_U16 sleepTime = figureSleepTime(server); if ( 0 != sleepTime ) { server->robotWaiting = XP_TRUE; util_setTimer( server->vol.util, TIMER_SLOWROBOT, sleepTime, wakeRobotProc, server ); result = XP_TRUE; } } return result; } # define POSTPONEROBOTMOVE(s) postponeRobotMove(s) #else # define POSTPONEROBOTMOVE(s) XP_FALSE #endif static void showPrevScore( ServerCtxt* server ) { XW_UtilCtxt* util = server->vol.util; XWStreamCtxt* stream; const XP_UCHAR* str; CurGameInfo* gi = server->vol.gi; XP_U16 nPlayers = gi->nPlayers; XP_U16 prevTurn; XP_U16 strCode; LocalPlayer* lp; XP_Bool wasRobot; XP_Bool wasLocal; XP_ASSERT( server->nv.showRobotScores ); prevTurn = (server->nv.currentTurn + nPlayers - 1) % nPlayers; lp = &gi->players[prevTurn]; wasRobot = lp->isRobot; wasLocal = lp->isLocal; if ( wasLocal ) { XP_ASSERT( wasRobot ); strCode = STR_ROBOT_MOVED; } else { strCode = STR_REMOTE_MOVED; } stream = mkServerStream( server ); str = util_getUserString( util, strCode ); stream_catString( stream, str ); if ( !!server->vol.prevMoveStream ) { XWStreamCtxt* prevStream = server->vol.prevMoveStream; XP_U16 len = stream_getSize( prevStream ); XP_UCHAR* buf = XP_MALLOC( server->mpool, len ); stream_getBytes( prevStream, buf, len ); stream_destroy( prevStream ); server->vol.prevMoveStream = NULL; stream_putBytes( stream, buf, len ); XP_FREE( server->mpool, buf ); } (void)util_userQuery( util, QUERY_ROBOT_MOVE, stream ); stream_destroy( stream ); SETSTATE( server, server->vol.stateAfterShow ); } /* showPrevScore */ XP_Bool server_do( ServerCtxt* server ) { XP_Bool result = XP_TRUE; XP_Bool moreToDo = XP_FALSE; if ( server->serverDoing ) { return XP_FALSE; } server->serverDoing = XP_TRUE; switch( server->nv.gameState ) { case XWSTATE_BEGIN: if ( server->nv.pendingRegistrations == 0 ) { /* all players on device */ assignTilesToAll( server ); SETSTATE( server, XWSTATE_INTURN ); setTurn( server, 0 ); moreToDo = XP_TRUE; } break; case XWSTATE_NEEDSEND_BADWORD_INFO: XP_ASSERT( server->vol.gi->serverRole == SERVER_ISSERVER ); badWordMoveUndoAndTellUser( server, &server->illegalWordInfo ); #ifndef XWFEATURE_STANDALONE_ONLY sendBadWordMsgs( server ); #endif nextTurn( server, PICK_NEXT ); /* sets server->nv.gameState */ //moreToDo = XP_TRUE; /* why? */ break; #ifndef XWFEATURE_STANDALONE_ONLY case XWSTATE_RECEIVED_ALL_REG: server_sendInitialMessage( server ); /* PENDING isn't INTURN_OFFDEVICE possible too? Or just INTURN? */ SETSTATE( server, XWSTATE_INTURN ); setTurn( server, 0 ); moreToDo = XP_TRUE; break; case XWSTATE_MOVE_CONFIRM_MUSTSEND: XP_ASSERT( server->vol.gi->serverRole == SERVER_ISSERVER ); tellMoveWasLegal( server ); nextTurn( server, PICK_NEXT ); break; #endif /* XWFEATURE_STANDALONE_ONLY */ case XWSTATE_NEEDSEND_ENDGAME: endGameInternal( server, END_REASON_OUT_OF_TILES ); break; case XWSTATE_NEED_SHOWSCORE: showPrevScore( server ); moreToDo = XP_TRUE; /* either process turn or end game... */ break; case XWSTATE_INTURN: if ( robotMovePending( server ) && !ROBOTWAITING(server) ) { result = makeRobotMove( server ); /* if robot was interrupted, we need to schedule again */ moreToDo = !result || (robotMovePending( server ) && !POSTPONEROBOTMOVE(server)); } break; default: result = XP_FALSE; break; } if ( moreToDo ) { util_requestTime( server->vol.util ); } server->serverDoing = XP_FALSE; return result; } /* server_do */ #ifndef XWFEATURE_STANDALONE_ONLY static XP_S8 getIndexForDevice( ServerCtxt* server, XP_PlayerAddr channelNo ) { short i; XP_S8 result = -1; for ( i = 0; i < server->nv.nDevices; ++i ) { RemoteAddress* addr = &server->nv.addresses[i]; if ( addr->channelNo == channelNo ) { result = i; break; } } return result; } /* getIndexForDevice */ static LocalPlayer* findFirstPending( ServerCtxt* server, ServerPlayer** playerP ) { LocalPlayer* lp; CurGameInfo* gi = server->vol.gi; XP_U16 nPlayers = gi->nPlayers; XP_U16 nPending = server->nv.pendingRegistrations; XP_ASSERT( nPlayers > 0 ); lp = gi->players + nPlayers; while ( --lp >= gi->players ) { --nPlayers; if ( !lp->isLocal ) { if ( --nPending == 0 ) { break; } } } XP_ASSERT( lp >= gi->players ); /* did we find a slot? */ *playerP = server->players + nPlayers; return lp; } /* findFirstPending */ static void registerRemotePlayer( ServerCtxt* server, XWStreamCtxt* stream ) { XP_S8 deviceIndex; XP_PlayerAddr channelNo; XP_UCHAR* name; XP_U16 nameLen; LocalPlayer* lp; ServerPlayer* player = (ServerPlayer*)NULL; /* The player must already be there with a null name, or it's an error. Take the first empty slot. */ XP_ASSERT( server->nv.pendingRegistrations > 0 ); /* find the slot to use */ lp = findFirstPending( server, &player ); /* get data from stream */ lp->isRobot = stream_getBits( stream, 1 ); nameLen = stream_getBits( stream, NAME_LEN_NBITS ); name = (XP_UCHAR*)XP_MALLOC( server->mpool, nameLen + 1 ); stream_getBytes( stream, name, nameLen ); name[nameLen] = '\0'; replaceStringIfDifferent( server->mpool, &lp->name, name ); XP_FREE( server->mpool, name ); channelNo = stream_getAddress( stream ); deviceIndex = getIndexForDevice( server, channelNo ); --server->nv.pendingRegistrations; if ( deviceIndex == -1 ) { RemoteAddress* addr; addr = &server->nv.addresses[server->nv.nDevices]; deviceIndex = server->nv.nDevices++; XP_ASSERT( channelNo != 0 ); addr->channelNo = channelNo; } player->deviceIndex = deviceIndex; } /* registerRemotePlayer */ static void clearLocalRobots( ServerCtxt* server ) { XP_U16 i; CurGameInfo* gi = server->vol.gi; XP_U16 nPlayers = gi->nPlayers; for ( i = 0; i < nPlayers; ++i ) { LocalPlayer* player = &gi->players[i]; if ( IS_LOCAL( player ) ) { player->isRobot = XP_FALSE; } } } /* clearLocalRobots */ #endif /* Called in response to message from server listing all the names of * players in the game (in server-assigned order) and their initial * tray contents. */ #ifndef XWFEATURE_STANDALONE_ONLY static XP_Bool client_readInitialMessage( ServerCtxt* server, XWStreamCtxt* stream ) { XP_Bool accepted = 0 == server->nv.addresses[0].channelNo; /* We should never get this message a second time, but very rarely we do. Drop it in that case. */ if ( accepted ) { DictionaryCtxt* newDict; DictionaryCtxt* curDict; XP_U16 nPlayers, nCols; XP_PlayerAddr channelNo; short i; ModelCtxt* model = server->vol.model; CurGameInfo* gi = server->vol.gi; CurGameInfo localGI; XP_U32 gameID; PoolContext* pool; /* version */ XP_U8 streamVersion = stream_getU8( stream ); XP_ASSERT( streamVersion == STREAM_VERS_41B4 || streamVersion == STREAM_VERS_UTF8); if ( (streamVersion != STREAM_VERS_41B4) && (streamVersion != STREAM_VERS_UTF8) ) { return XP_FALSE; } stream_setVersion( stream, streamVersion ); gameID = stream_getU32( stream ); XP_STATUSF( "read gameID of %lx; calling comms_setConnID", gameID ); server->vol.gi->gameID = gameID; comms_setConnID( server->vol.comms, gameID ); XP_MEMSET( &localGI, 0, sizeof(localGI) ); gi_readFromStream( MPPARM(server->mpool) stream, &localGI ); localGI.serverRole = SERVER_ISCLIENT; /* so it's not lost (HACK!). Without this, a client won't have a default dict name when a new game is started. */ localGI.dictName = copyString( server->mpool, gi->dictName ); gi_copy( MPPARM(server->mpool) gi, &localGI ); nCols = localGI.boardSize; newDict = util_makeEmptyDict( server->vol.util ); dict_loadFromStream( newDict, stream ); channelNo = stream_getAddress( stream ); XP_ASSERT( channelNo != 0 ); server->nv.addresses[0].channelNo = channelNo; /* PENDING init's a bit harsh for setting the size */ model_init( model, nCols, nCols ); nPlayers = localGI.nPlayers; XP_STATUSF( "reading in %d players", localGI.nPlayers ); gi_disposePlayerInfo( MPPARM(server->mpool) &localGI ); gi->nPlayers = nPlayers; model_setNPlayers( model, nPlayers ); curDict = model_getDictionary( model ); XP_ASSERT( !!newDict ); if ( curDict == NULL ) { model_setDictionary( model, newDict ); } else if ( dict_tilesAreSame( newDict, curDict ) ) { /* keep the dict the local user installed */ dict_destroy( newDict ); } else { dict_destroy( curDict ); model_setDictionary( model, newDict ); util_userError( server->vol.util, ERR_SERVER_DICT_WINS ); clearLocalRobots( server ); } XP_ASSERT( !server->pool ); pool = server->pool = pool_make( MPPARM_NOCOMMA(server->mpool) ); pool_initFromDict( server->pool, model_getDictionary(model)); /* now read the assigned tiles for each player from the stream, and remove them from the newly-created local pool. */ for ( i = 0; i < nPlayers; ++i ) { TrayTileSet tiles; traySetFromStream( stream, &tiles ); XP_ASSERT( tiles.nTiles <= MAX_TRAY_TILES ); XP_STATUSF( "got %d tiles for player %d", tiles.nTiles, i ); model_assignPlayerTiles( model, i, &tiles ); /* remove what the server's assigned so we won't conflict later. */ pool_removeTiles( pool, &tiles ); } SETSTATE( server, XWSTATE_INTURN ); /* Give board a chance to redraw self with the full compliment of known players */ setTurn( server, 0 ); } else { XP_LOGF( "%s: wanted 0; got %d", __func__, server->nv.addresses[0].channelNo ); } return accepted; } /* client_readInitialMessage */ #endif /* For each remote device, send a message containing the dictionary and the * names of all the players in the game (including those on the device itself, * since they might have been changed in the case of conflicts), in the order * that all must use for the game. Then for each player on the device give * the starting tray. */ #ifndef XWFEATURE_STANDALONE_ONLY static void makeSendableGICopy( ServerCtxt* server, CurGameInfo* giCopy, XP_U16 deviceIndex ) { XP_U16 nPlayers; LocalPlayer* clientPl; XP_U16 i; XP_MEMCPY( giCopy, server->vol.gi, sizeof(*giCopy) ); nPlayers = giCopy->nPlayers; for ( clientPl = giCopy->players, i = 0; i < nPlayers; ++clientPl, ++i ) { /* adjust isLocal to client's perspective */ clientPl->isLocal = server->players[i].deviceIndex == deviceIndex; } giCopy->dictName = (XP_UCHAR*)NULL; /* so we don't sent the bytes; Isn't this a leak? PENDING */ } /* makeSendableGICopy */ static void server_sendInitialMessage( ServerCtxt* server ) { short i; XP_U16 deviceIndex; ModelCtxt* model = server->vol.model; XP_U16 nPlayers = server->vol.gi->nPlayers; CurGameInfo localGI; XP_U32 gameID = server->vol.gi->gameID; XP_STATUSF( "server_sendInitialMessage" ); for ( deviceIndex = 1; deviceIndex < server->nv.nDevices; ++deviceIndex ) { RemoteAddress* addr = &server->nv.addresses[deviceIndex]; XWStreamCtxt* stream = util_makeStreamFromAddr( server->vol.util, addr->channelNo ); DictionaryCtxt* dict = model_getDictionary(model); XP_ASSERT( !!stream ); stream_open( stream ); stream_putBits( stream, XWPROTO_NBITS, XWPROTO_CLIENT_SETUP ); /* write version for server's benefit; use old version until format changes */ stream_putU8( stream, dict_isUTF8(dict)? STREAM_VERS_UTF8:STREAM_VERS_41B4 ); XP_STATUSF( "putting gameID %lx into msg", gameID ); stream_putU32( stream, gameID ); makeSendableGICopy( server, &localGI, deviceIndex ); gi_writeToStream( stream, &localGI ); dict_writeToStream( dict, stream ); /* send tiles currently in tray */ for ( i = 0; i < nPlayers; ++i ) { model_trayToStream( model, i, stream ); } stream_destroy( stream ); } /* Set after messages are built so their connID will be 0, but all non-initial messages will have a non-0 connID. */ comms_setConnID( server->vol.comms, gameID ); } /* server_sendInitialMessage */ #endif static void freeBWI( MPFORMAL BadWordInfo* bwi ) { /* BadWordInfo* bwi = &server->illegalWordInfo; */ XP_U16 nWords = bwi->nWords; while ( nWords-- ) { XP_FREE( mpool, bwi->words[nWords] ); bwi->words[nWords] = (XP_UCHAR*)NULL; } bwi->nWords = 0; } /* freeBWI */ #ifndef XWFEATURE_STANDALONE_ONLY static void bwiToStream( XWStreamCtxt* stream, BadWordInfo* bwi ) { XP_U16 nWords = bwi->nWords; XP_UCHAR** sp; stream_putBits( stream, 4, nWords ); for ( sp = bwi->words; nWords > 0; --nWords, ++sp ) { stringToStream( stream, *sp ); } } /* bwiToStream */ static void bwiFromStream( MPFORMAL XWStreamCtxt* stream, BadWordInfo* bwi ) { XP_U16 nWords = stream_getBits( stream, 4 ); XP_UCHAR** sp = bwi->words; bwi->nWords = nWords; for ( sp = bwi->words; nWords; ++sp, --nWords ) { *sp = stringFromStream( mpool, stream ); } } /* bwiFromStream */ #ifdef DEBUG #define caseStr(var, s) case s: var = #s; break; static void printCode(char* intro, XW_Proto code) { char* str = (char*)NULL; switch( code ) { caseStr( str, XWPROTO_ERROR ); caseStr( str, XWPROTO_CHAT ); caseStr( str, XWPROTO_DEVICE_REGISTRATION ); caseStr( str, XWPROTO_CLIENT_SETUP ); caseStr( str, XWPROTO_MOVEMADE_INFO_CLIENT ); caseStr( str, XWPROTO_MOVEMADE_INFO_SERVER ); caseStr( str, XWPROTO_UNDO_INFO_CLIENT ); caseStr( str, XWPROTO_UNDO_INFO_SERVER ); caseStr( str, XWPROTO_BADWORD_INFO ); caseStr( str, XWPROTO_MOVE_CONFIRM ); caseStr( str, XWPROTO_CLIENT_REQ_END_GAME ); caseStr( str, XWPROTO_END_GAME ); } XP_STATUSF( "\t%s for %s", intro, str ); } /* printCode */ #undef caseStr #else #define printCode(intro, code) #endif static XWStreamCtxt* messageStreamWithHeader( ServerCtxt* server, XP_U16 devIndex, XW_Proto code ) { XWStreamCtxt* stream; XP_PlayerAddr channelNo = server->nv.addresses[devIndex].channelNo; printCode("making", code); stream = util_makeStreamFromAddr( server->vol.util, channelNo ); stream_open( stream ); stream_putBits( stream, XWPROTO_NBITS, code ); return stream; } /* messageStreamWithHeader */ /* Check that the message belongs to this game, whatever. Pull out the data * put in by messageStreamWithHeader -- except for the code, which will have * already come out. */ static XP_Bool readStreamHeader( ServerCtxt* XP_UNUSED(server), XWStreamCtxt* XP_UNUSED(stream) ) { return XP_TRUE; } /* readStreamHeader */ static void sendBadWordMsgs( ServerCtxt* server ) { XWStreamCtxt* stream; stream = messageStreamWithHeader( server, server->lastMoveSource, XWPROTO_BADWORD_INFO ); stream_putBits( stream, PLAYERNUM_NBITS, server->nv.currentTurn ); XP_ASSERT( server->illegalWordInfo.nWords > 0 ); bwiToStream( stream, &server->illegalWordInfo ); stream_destroy( stream ); freeBWI( MPPARM(server->mpool) &server->illegalWordInfo ); } /* sendBadWordMsgs */ #endif static void badWordMoveUndoAndTellUser( ServerCtxt* server, BadWordInfo* bwi ) { XP_U16 turn; ModelCtxt* model = server->vol.model; /* I'm the server. I need to send a message to everybody else telling them the move's rejected. Then undo it on this side, replacing it with model_commitRejectedPhony(); */ model_rejectPreviousMove( model, server->pool, &turn ); util_warnIllegalWord( server->vol.util, bwi, turn, XP_TRUE ); } /* badWordMoveUndoAndTellUser */ EngineCtxt* server_getEngineFor( ServerCtxt* server, XP_U16 playerNum ) { ServerPlayer* player; EngineCtxt* engine; XP_ASSERT( playerNum < server->vol.gi->nPlayers ); player = &server->players[playerNum]; engine = player->engine; if ( !engine && server->vol.gi->players[playerNum].isLocal ) { engine = engine_make( MPPARM(server->mpool) server->vol.util, server->vol.gi->players[playerNum].isRobot ); player->engine = engine; } return engine; } /* server_getEngineFor */ void server_resetEngine( ServerCtxt* server, XP_U16 playerNum ) { ServerPlayer* player = &server->players[playerNum]; if ( !!player->engine ) { XP_ASSERT( player->deviceIndex == 0 ); engine_reset( player->engine ); } } /* server_resetEngine */ static void resetEngines( ServerCtxt* server ) { XP_U16 i; XP_U16 nPlayers = server->vol.gi->nPlayers; for ( i = 0; i < nPlayers; ++i ) { server_resetEngine( server, i ); } } /* resetEngines */ #ifdef TEST_ROBOT_TRADE static void makeNotAVowel( ServerCtxt* server, Tile* newTile ) { char face[4]; Tile tile = *newTile; PoolContext* pool = server->pool; TrayTileSet set; DictionaryCtxt* dict = model_getDictionary( server->vol.model ); XP_U8 numGot = 1; set.nTiles = 1; for ( ; ; ) { XP_U16 len = dict_tilesToString( dict, &tile, 1, face ); if ( len == 1 ) { switch ( face[0] ) { case 'A': case 'E': case 'I': case 'O': case 'U': case '_': break; default: *newTile = tile; return; } } set.tiles[0] = tile; pool_replaceTiles( pool, &set ); pool_requestTiles( pool, &tile, &numGot ); } } /* makeNotAVowel */ #endif static void curTrayAsTexts( ServerCtxt* server, XP_U16 turn, const TrayTileSet* notInTray, XP_U16* nUsedP, const XP_UCHAR** curTrayText ) { const TrayTileSet* tileSet = model_getPlayerTiles( server->vol.model, turn ); DictionaryCtxt* dict = model_getDictionary( server->vol.model ); XP_U16 i, j; XP_U16 size = tileSet->nTiles; const Tile* tp = tileSet->tiles; XP_U16 tradedTiles[MAX_TRAY_TILES]; XP_U16 nNotInTray = 0; XP_U16 nUsed = 0; XP_MEMSET( tradedTiles, 0xFF, sizeof(tradedTiles) ); if ( !!notInTray ) { const Tile* tp = notInTray->tiles; nNotInTray = notInTray->nTiles; for ( i = 0; i < nNotInTray; ++i ) { tradedTiles[i] = *tp++; } } for ( i = 0; i < size; ++i ) { Tile tile = *tp++; XP_Bool toBeTraded = XP_FALSE; for ( j = 0; j < nNotInTray; ++j ) { if ( tradedTiles[j] == tile ) { tradedTiles[j] = 0xFFFF; toBeTraded = XP_TRUE; break; } } if ( !toBeTraded ) { curTrayText[nUsed++] = dict_getTileString( dict, tile ); } } *nUsedP = nUsed; } /* curTrayAsTexts */ /* Get tiles for one user. If picking is available, let user pick until * cancels. Otherwise, and after cancel, pick for 'im. */ static void fetchTiles( ServerCtxt* server, XP_U16 playerNum, XP_U16 nToFetch, const TrayTileSet* tradedTiles, TrayTileSet* resultTiles ) { XP_Bool ask; XP_U16 nSoFar = 0; XP_U16 nLeft; PoolContext* pool = server->pool; TrayTileSet oneTile; PickInfo pi; const XP_UCHAR* curTray[MAX_TRAY_TILES]; #ifdef FEATURE_TRAY_EDIT DictionaryCtxt* dict = model_getDictionary( server->vol.model ); #endif XP_ASSERT( !!pool ); #ifdef FEATURE_TRAY_EDIT ask = server->vol.gi->allowPickTiles && !server->vol.gi->players[playerNum].isRobot; #else ask = XP_FALSE; #endif nLeft = pool_getNTilesLeft( pool ); if ( nLeft < nToFetch ) { nToFetch = nLeft; } oneTile.nTiles = 1; pi.why = PICK_FOR_CHEAT; pi.nTotal = nToFetch; pi.thisPick = 0; pi.curTiles = curTray; curTrayAsTexts( server, playerNum, tradedTiles, &pi.nCurTiles, curTray ); #ifdef FEATURE_TRAY_EDIT /* good compiler would note ask==0, but... */ /* First ask until cancelled */ for ( nSoFar = 0; ask && nSoFar < nToFetch; ) { const XP_UCHAR* texts[MAX_UNIQUE_TILES]; Tile tiles[MAX_UNIQUE_TILES]; XP_S16 chosen; XP_U16 nUsed = MAX_UNIQUE_TILES; model_packTilesUtil( server->vol.model, pool, XP_TRUE, &nUsed, texts, tiles ); chosen = util_userPickTile( server->vol.util, &pi, playerNum, texts, nUsed ); if ( chosen == PICKER_PICKALL ) { ask = XP_FALSE; } else if ( chosen == PICKER_BACKUP ) { if ( nSoFar > 0 ) { TrayTileSet tiles; tiles.nTiles = 1; tiles.tiles[0] = resultTiles->tiles[--nSoFar]; pool_replaceTiles( server->pool, &tiles ); --pi.nCurTiles; --pi.thisPick; } } else { Tile tile = tiles[chosen]; oneTile.tiles[0] = tile; pool_removeTiles( pool, &oneTile ); curTray[pi.nCurTiles++] = dict_getTileString( dict, tile ); resultTiles->tiles[nSoFar++] = tile; ++pi.thisPick; } } #endif /* Then fetch the rest without asking */ if ( nSoFar < nToFetch ) { XP_U8 nLeft = nToFetch - nSoFar; Tile tiles[MAX_TRAY_TILES]; pool_requestTiles( pool, tiles, &nLeft ); XP_MEMCPY( &resultTiles->tiles[nSoFar], tiles, nLeft * sizeof(resultTiles->tiles[0]) ); nSoFar += nLeft; } XP_ASSERT( nSoFar < 0x00FF ); resultTiles->nTiles = (XP_U8)nSoFar; } /* fetchTiles */ static void assignTilesToAll( ServerCtxt* server ) { XP_U16 numAssigned; short i; ModelCtxt* model = server->vol.model; XP_U16 nPlayers = server->vol.gi->nPlayers; XP_ASSERT( server->vol.gi->serverRole != SERVER_ISCLIENT ); XP_ASSERT( model_getDictionary(model) != NULL ); if ( server->pool == NULL ) { server->pool = pool_make( MPPARM_NOCOMMA(server->mpool) ); XP_STATUSF( "initing pool" ); pool_initFromDict( server->pool, model_getDictionary(model)); } XP_STATUSF( "assignTilesToAll" ); model_setNPlayers( model, nPlayers ); numAssigned = pool_getNTilesLeft( server->pool ) / nPlayers; if ( numAssigned > MAX_TRAY_TILES ) { numAssigned = MAX_TRAY_TILES; } for ( i = 0; i < nPlayers; ++i ) { TrayTileSet newTiles; fetchTiles( server, i, numAssigned, NULL, &newTiles ); model_assignPlayerTiles( model, i, &newTiles ); } } /* assignTilesToAll */ #ifndef XWFEATURE_STANDALONE_ONLY static void getPlayerTime( ServerCtxt* server, XWStreamCtxt* stream, XP_U16 turn ) { CurGameInfo* gi = server->vol.gi; if ( gi->timerEnabled ) { XP_U16 secondsUsed = stream_getU16( stream ); gi->players[turn].secondsUsed = secondsUsed; } } /* getPlayerTime */ #endif static void nextTurn( ServerCtxt* server, XP_S16 nxtTurn ) { ServerPlayer* player; XP_U16 nPlayers = server->vol.gi->nPlayers; XP_U16 playerTilesLeft; XP_S16 currentTurn = server->nv.currentTurn; XP_Bool moreToDo = XP_FALSE; if ( nxtTurn == PICK_NEXT ) { XP_ASSERT( currentTurn >= 0 ); playerTilesLeft = model_getNumTilesTotal(server->vol.model, currentTurn); nxtTurn = (currentTurn+1) % nPlayers; } else { /* We're doing an undo, and so won't bother figuring out who the previous turn was or how many tiles he had: it's a sure thing he "has" enough to be allowed to take the turn just undone. */ playerTilesLeft = MAX_TRAY_TILES; } SETSTATE( server, XWSTATE_INTURN ); /* even if game over, if undoing */ if ( (playerTilesLeft > 0) && tileCountsOk(server) && NPASSES_OK(server) ){ player = &server->players[nxtTurn]; setTurn( server, nxtTurn ); } else { /* I discover that the game should end. If I'm the client, though, should I wait for the server to deduce this and send out a message? I think so. Yes, but be sure not to compute another PASS move. Just don't do anything! */ if ( server->vol.gi->serverRole != SERVER_ISCLIENT ) { SETSTATE( server, XWSTATE_NEEDSEND_ENDGAME ); moreToDo = XP_TRUE; } else { XP_LOGF( "Doing nothing; waiting for server to end game." ); /* I'm the client. Do ++nothing++. */ } } if ( server->vol.showPrevMove ) { server->vol.showPrevMove = XP_FALSE; if ( server->nv.showRobotScores ) { server->vol.stateAfterShow = server->nv.gameState; SETSTATE( server, XWSTATE_NEED_SHOWSCORE ); moreToDo = XP_TRUE; } } /* It's safer, if perhaps not always necessary, to do this here. */ resetEngines( server ); XP_ASSERT( server->nv.gameState != XWSTATE_GAMEOVER ); callTurnChangeListener( server ); if ( robotMovePending(server) && !POSTPONEROBOTMOVE(server) ) { moreToDo = XP_TRUE; } if ( moreToDo ) { util_requestTime( server->vol.util ); } } /* nextTurn */ void server_setTurnChangeListener( ServerCtxt* server, TurnChangeListener tl, void* data ) { server->vol.turnChangeListener = tl; server->vol.turnChangeData = data; } /* server_setTurnChangeListener */ void server_setGameOverListener( ServerCtxt* server, GameOverListener gol, void* data ) { server->vol.gameOverListener = gol; server->vol.gameOverData = data; } /* server_setTurnChangeListener */ static XP_Bool storeBadWords( XP_UCHAR* word, void* closure ) { ServerCtxt* server = (ServerCtxt*)closure; XP_STATUSF( "storeBadWords called with \"%s\"", word ); server->illegalWordInfo.words[server->illegalWordInfo.nWords++] = copyString( server->mpool, word ); return XP_TRUE; } /* storeBadWords */ static XP_Bool checkMoveAllowed( ServerCtxt* server, XP_U16 playerNum ) { CurGameInfo* gi = server->vol.gi; XP_ASSERT( server->illegalWordInfo.nWords == 0 ); if ( gi->phoniesAction == PHONIES_DISALLOW ) { WordNotifierInfo info; info.proc = storeBadWords; info.closure = server; (void)model_checkMoveLegal( server->vol.model, playerNum, (XWStreamCtxt*)NULL, &info ); } return server->illegalWordInfo.nWords == 0; } /* checkMoveAllowed */ #ifndef XWFEATURE_STANDALONE_ONLY static void sendMoveTo( ServerCtxt* server, XP_U16 devIndex, XP_U16 turn, XP_Bool legal, TrayTileSet* newTiles, TrayTileSet* tradedTiles ) /* null if a move, set if a trade */ { XWStreamCtxt* stream; XP_Bool isTrade = !!tradedTiles; CurGameInfo* gi = server->vol.gi; XW_Proto code = gi->serverRole == SERVER_ISCLIENT? XWPROTO_MOVEMADE_INFO_CLIENT : XWPROTO_MOVEMADE_INFO_SERVER; stream = messageStreamWithHeader( server, devIndex, code ); stream_putBits( stream, PLAYERNUM_NBITS, turn ); /* who made the move */ traySetToStream( stream, newTiles ); stream_putBits( stream, 1, isTrade ); if ( isTrade ) { traySetToStream( stream, tradedTiles ); } else { stream_putBits( stream, 1, legal ); model_currentMoveToStream( server->vol.model, turn, stream ); if ( gi->timerEnabled ) { stream_putU16( stream, gi->players[turn].secondsUsed ); XP_STATUSF("*** wrote secondsUsed for player %d: %d", turn, gi->players[turn].secondsUsed ); } else { XP_ASSERT( gi->players[turn].secondsUsed == 0 ); } if ( !legal ) { XP_ASSERT( server->illegalWordInfo.nWords > 0 ); bwiToStream( stream, &server->illegalWordInfo ); } } stream_destroy( stream ); } /* sendMoveTo */ static void readMoveInfo( ServerCtxt* server, XWStreamCtxt* stream, XP_U16* whoMovedP, XP_Bool* isTradeP, TrayTileSet* newTiles, TrayTileSet* tradedTiles, XP_Bool* legalP ) { XP_U16 whoMoved = stream_getBits( stream, PLAYERNUM_NBITS ); XP_Bool legalMove = XP_TRUE; XP_Bool isTrade; traySetFromStream( stream, newTiles ); isTrade = stream_getBits( stream, 1 ); if ( isTrade ) { traySetFromStream( stream, tradedTiles ); } else { legalMove = stream_getBits( stream, 1 ); model_makeTurnFromStream( server->vol.model, whoMoved, stream ); getPlayerTime( server, stream, whoMoved ); } pool_removeTiles( server->pool, newTiles ); *whoMovedP = whoMoved; *isTradeP = isTrade; *legalP = legalMove; } /* readMoveInfo */ static void sendMoveToClientsExcept( ServerCtxt* server, XP_U16 whoMoved, XP_Bool legal, TrayTileSet* newTiles, TrayTileSet* tradedTiles, XP_U16 skip ) { XP_U16 devIndex; for ( devIndex = 1; devIndex < server->nv.nDevices; ++devIndex ) { if ( devIndex != skip ) { sendMoveTo( server, devIndex, whoMoved, legal, newTiles, tradedTiles ); } } } /* sendMoveToClientsExcept */ static XWStreamCtxt* makeTradeReportIf( ServerCtxt* server, const TrayTileSet* tradedTiles ) { XWStreamCtxt* stream = NULL; if ( server->nv.showRobotScores ) { XP_UCHAR tradeBuf[64]; const XP_UCHAR* tradeStr = util_getUserString( server->vol.util, STRD_ROBOT_TRADED ); XP_SNPRINTF( tradeBuf, sizeof(tradeBuf), tradeStr, tradedTiles->nTiles ); stream = mkServerStream( server ); stream_catString( stream, tradeBuf ); } return stream; } /* makeTradeReportIf */ static XWStreamCtxt* makeMoveReportIf( ServerCtxt* server ) { XWStreamCtxt* stream = NULL; if ( server->nv.showRobotScores ) { stream = mkServerStream( server ); (void)model_checkMoveLegal( server->vol.model, server->nv.currentTurn, stream, NULL ); } return stream; } /* makeMoveReportIf */ /* Client is reporting a move made, complete with new tiles and time taken by * the player. Update the model with that information as a tentative move, * then sent info about it to all the clients, and finally commit the move * here. */ static XP_Bool reflectMoveAndInform( ServerCtxt* server, XWStreamCtxt* stream ) { ModelCtxt* model = server->vol.model; XP_U16 whoMoved; XP_U16 nTilesMoved = 0; /* trade case */ XP_Bool isTrade; XP_Bool isLegalMove; XP_Bool doRequest = XP_FALSE; TrayTileSet newTiles; TrayTileSet tradedTiles; CurGameInfo* gi = server->vol.gi; XP_U16 sourceClientIndex = getIndexForDevice( server, stream_getAddress( stream ) ); XWStreamCtxt* mvStream = NULL; XP_ASSERT( gi->serverRole == SERVER_ISSERVER ); readMoveInfo( server, stream, &whoMoved, &isTrade, &newTiles, &tradedTiles, &isLegalMove ); /* modifies model */ XP_ASSERT( isLegalMove ); /* client should always report as true */ isLegalMove = XP_TRUE; if ( isTrade ) { sendMoveToClientsExcept( server, whoMoved, XP_TRUE, &newTiles, &tradedTiles, sourceClientIndex ); model_makeTileTrade( model, whoMoved, &tradedTiles, &newTiles ); pool_replaceTiles( server->pool, &tradedTiles ); server->vol.showPrevMove = XP_TRUE; mvStream = makeTradeReportIf( server, &tradedTiles ); } else { nTilesMoved = model_getCurrentMoveCount( model, whoMoved ); isLegalMove = (nTilesMoved == 0) || checkMoveAllowed( server, whoMoved ); /* I don't think this will work if there are more than two devices in a palm game; need to change state and get out of here before returning to send additional messages. PENDING(ehouse) */ sendMoveToClientsExcept( server, whoMoved, isLegalMove, &newTiles, (TrayTileSet*)NULL, sourceClientIndex ); server->vol.showPrevMove = XP_TRUE; mvStream = makeMoveReportIf( server ); model_commitTurn( model, whoMoved, &newTiles ); resetEngines( server ); } if ( isLegalMove ) { XP_U16 nTilesLeft = model_getNumTilesTotal( model, whoMoved ); if ( (gi->phoniesAction == PHONIES_DISALLOW) && (nTilesMoved > 0) ) { server->lastMoveSource = sourceClientIndex; SETSTATE( server, XWSTATE_MOVE_CONFIRM_MUSTSEND ); doRequest = XP_TRUE; } else if ( nTilesLeft > 0 ) { nextTurn( server, PICK_NEXT ); } else { SETSTATE(server, XWSTATE_NEEDSEND_ENDGAME ); doRequest = XP_TRUE; } if ( !!mvStream ) { XP_ASSERT( !server->vol.prevMoveStream ); server->vol.prevMoveStream = mvStream; } } else { /* The client from which the move came still needs to be told. But we can't send a message now since we're burried in a message handler. (Palm, at least, won't manage.) So set up state to tell that client again in a minute. */ SETSTATE( server, XWSTATE_NEEDSEND_BADWORD_INFO ); server->lastMoveSource = sourceClientIndex; doRequest = XP_TRUE; } if ( doRequest ) { util_requestTime( server->vol.util ); } return XP_TRUE; } /* reflectMoveAndInform */ static XP_Bool reflectMove( ServerCtxt* server, XWStreamCtxt* stream ) { XP_Bool moveOk; XP_Bool isTrade; XP_Bool isLegal; XP_U16 whoMoved; TrayTileSet newTiles; TrayTileSet tradedTiles; ModelCtxt* model = server->vol.model; XWStreamCtxt* mvStream = NULL; moveOk = XWSTATE_INTURN == server->nv.gameState; if ( moveOk ) { readMoveInfo( server, stream, &whoMoved, &isTrade, &newTiles, &tradedTiles, &isLegal ); /* modifies model */ if ( isTrade ) { model_makeTileTrade( model, whoMoved, &tradedTiles, &newTiles ); pool_replaceTiles( server->pool, &tradedTiles ); server->vol.showPrevMove = XP_TRUE; mvStream = makeTradeReportIf( server, &tradedTiles ); } else { server->vol.showPrevMove = XP_TRUE; mvStream = makeMoveReportIf( server ); model_commitTurn( model, whoMoved, &newTiles ); } if ( !!mvStream ) { XP_ASSERT( !server->vol.prevMoveStream ); server->vol.prevMoveStream = mvStream; } resetEngines( server ); if ( !isLegal ) { XP_ASSERT( server->vol.gi->serverRole == SERVER_ISCLIENT ); handleIllegalWord( server, stream ); } } else { XP_LOGF( "%s: dropping move: state=%s", __func__, getStateStr(server->nv.gameState ) ); } return moveOk; } /* reflectMove */ #endif /* XWFEATURE_STANDALONE_ONLY */ /* A local player is done with his turn. If a client device, broadcast * the move to the server (after which a response should be coming soon.) * If the server, then that step can be skipped: go straight to doing what * the server does after learning of a move on a remote device. * * Second cut. Whether server or client, be responsible for checking the * basic legality of the move and taking new tiles out of the pool. If * client, send the move and new tiles to the server. If the server, fall * back to what will do after hearing from client: tell everybody who doesn't * already know what's happened: move and new tiles together. * * What about phonies when DISALLOW is set? The server's ultimately * responsible, since it has the dictionary, so the client can't check. So * when server, check and send move together with a flag indicating legality. * Client is responsible for first posting the move to the model and then * undoing it. When client, send the move and go into a state waiting to hear * if it was legal -- but only if DISALLOW is set. */ XP_Bool server_commitMove( ServerCtxt* server ) { XP_S16 turn = server->nv.currentTurn; ModelCtxt* model = server->vol.model; CurGameInfo* gi = server->vol.gi; TrayTileSet newTiles; XP_U16 nTilesMoved; XP_Bool isLegalMove = XP_TRUE; XP_Bool isClient = gi->serverRole == SERVER_ISCLIENT; #ifdef DEBUG if ( IS_ROBOT( &gi->players[turn] ) ) { XP_ASSERT( model_checkMoveLegal( model, turn, (XWStreamCtxt*)NULL, (WordNotifierInfo*)NULL ) ); } #endif /* commit the move. get new tiles. if server, send to everybody. if client, send to server. */ XP_ASSERT( turn >= 0 ); nTilesMoved = model_getCurrentMoveCount( model, turn ); fetchTiles( server, turn, nTilesMoved, NULL, &newTiles ); #ifndef XWFEATURE_STANDALONE_ONLY if ( isClient ) { /* just send to server */ sendMoveTo( server, SERVER_DEVICE, turn, XP_TRUE, &newTiles, (TrayTileSet*)NULL ); } else { isLegalMove = checkMoveAllowed( server, turn ); sendMoveToClientsExcept( server, turn, isLegalMove, &newTiles, (TrayTileSet*)NULL, SERVER_DEVICE ); } #else isLegalMove = checkMoveAllowed( server, turn ); #endif model_commitTurn( model, turn, &newTiles ); if ( !isLegalMove && !isClient ) { badWordMoveUndoAndTellUser( server, &server->illegalWordInfo ); /* It's ok to free these guys. I'm the server, and the move was made here, so I've notified all clients already by setting the flag (and passing the word) in sendMoveToClientsExcept. */ freeBWI( MPPARM(server->mpool) &server->illegalWordInfo ); } if ( 0 ) { #ifndef XWFEATURE_STANDALONE_ONLY } else if (isClient && (gi->phoniesAction == PHONIES_DISALLOW) && nTilesMoved > 0 ) { SETSTATE( server, XWSTATE_MOVE_CONFIRM_WAIT ); #endif } else { nextTurn( server, PICK_NEXT ); } return XP_TRUE; } /* server_commitMove */ static void removeTradedTiles( ServerCtxt* server, TileBit selBits, TrayTileSet* tiles ) { XP_U8 nTiles = 0; XP_S16 index; XP_S16 turn = server->nv.currentTurn; /* selBits: It's gross that server knows this much about tray's implementation. PENDING(ehouse) */ for ( index = 0; selBits != 0; selBits >>= 1, ++index ) { if ( (selBits & 0x01) != 0 ) { Tile tile = model_getPlayerTile( server->vol.model, turn, index ); tiles->tiles[nTiles++] = tile; } } tiles->nTiles = nTiles; } /* saveTradedTiles */ XP_Bool server_commitTrade( ServerCtxt* server, TileBit selBits ) { TrayTileSet oldTiles; TrayTileSet newTiles; XP_U16 turn = server->nv.currentTurn; removeTradedTiles( server, selBits, &oldTiles ); fetchTiles( server, turn, oldTiles.nTiles, &oldTiles, &newTiles ); #ifndef XWFEATURE_STANDALONE_ONLY if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) { /* just send to server */ sendMoveTo(server, SERVER_DEVICE, turn, XP_TRUE, &newTiles, &oldTiles); } else { sendMoveToClientsExcept( server, turn, XP_TRUE, &newTiles, &oldTiles, SERVER_DEVICE ); } #endif pool_replaceTiles( server->pool, &oldTiles ); model_makeTileTrade( server->vol.model, server->nv.currentTurn, &oldTiles, &newTiles ); nextTurn( server, PICK_NEXT ); return XP_TRUE; } /* server_commitTrade */ XP_S16 server_getCurrentTurn( ServerCtxt* server ) { return server->nv.currentTurn; } /* server_getCurrentTurn */ XP_Bool server_getGameIsOver( ServerCtxt* server ) { return server->nv.gameState == XWSTATE_GAMEOVER; } /* server_getGameIsOver */ static void doEndGame( ServerCtxt* server ) { SETSTATE( server, XWSTATE_GAMEOVER ); setTurn( server, -1 ); (*server->vol.gameOverListener)( server->vol.gameOverData ); } /* doEndGame */ /* Somebody wants to end the game. * * If I'm the server, I send a END_GAME message to all clients. If I'm a * client, I send the GAME_OVER_REQUEST message to the server. If I'm the * server and this is called in response to a GAME_OVER_REQUEST, send the * GAME_OVER message to all clients including the one that requested it. */ static void endGameInternal( ServerCtxt* server, GameEndReason XP_UNUSED(why) ) { XP_ASSERT( server->nv.gameState != XWSTATE_GAMEOVER ); if ( server->vol.gi->serverRole != SERVER_ISCLIENT ) { #ifndef XWFEATURE_STANDALONE_ONLY XP_U16 devIndex; for ( devIndex = 1; devIndex < server->nv.nDevices; ++devIndex ) { XWStreamCtxt* stream; stream = messageStreamWithHeader( server, devIndex, XWPROTO_END_GAME ); stream_destroy( stream ); } #endif doEndGame( server ); #ifndef XWFEATURE_STANDALONE_ONLY } else { XWStreamCtxt* stream; stream = messageStreamWithHeader( server, SERVER_DEVICE, XWPROTO_CLIENT_REQ_END_GAME ); stream_destroy( stream ); /* Do I want to change the state I'm in? I don't think so.... */ #endif } } /* endGameInternal */ void server_endGame( ServerCtxt* server ) { XW_State gameState = server->nv.gameState; if ( gameState < XWSTATE_GAMEOVER && gameState >= XWSTATE_INTURN ) { endGameInternal( server, END_REASON_USER_REQUEST ); } } /* server_endGame */ /* If game is about to end because one player's out of tiles, we don't want to * keep trying to move */ static XP_Bool tileCountsOk( const ServerCtxt* server ) { XP_Bool maybeOver = 0 == pool_getNTilesLeft( server->pool ); if ( maybeOver ) { ModelCtxt* model = server->vol.model; XP_U16 nPlayers = server->vol.gi->nPlayers; XP_Bool zeroFound = XP_FALSE; while ( nPlayers-- ) { XP_U16 count = model_getNumTilesTotal( model, nPlayers ); if ( count == 0 ) { zeroFound = XP_TRUE; break; } } maybeOver = zeroFound; } return !maybeOver; } /* tileCountsOk */ static void setTurn( ServerCtxt* server, XP_S16 turn ) { if ( server->nv.currentTurn != turn ) { server->nv.currentTurn = turn; callTurnChangeListener( server ); } } #ifndef XWFEATURE_STANDALONE_ONLY static void tellMoveWasLegal( ServerCtxt* server ) { XWStreamCtxt* stream; stream = messageStreamWithHeader( server, server->lastMoveSource, XWPROTO_MOVE_CONFIRM ); stream_destroy( stream ); } /* tellMoveWasLegal */ static XP_Bool handleIllegalWord( ServerCtxt* server, XWStreamCtxt* incoming ) { BadWordInfo bwi; XP_U16 whichPlayer; whichPlayer = stream_getBits( incoming, PLAYERNUM_NBITS ); bwiFromStream( MPPARM(server->mpool) incoming, &bwi ); badWordMoveUndoAndTellUser( server, &bwi ); freeBWI( MPPARM(server->mpool) &bwi ); return XP_TRUE; } /* handleIllegalWord */ static XP_Bool handleMoveOk( ServerCtxt* server, XWStreamCtxt* XP_UNUSED(incoming) ) { XP_Bool accepted = XP_TRUE; XP_ASSERT( server->vol.gi->serverRole == SERVER_ISCLIENT ); XP_ASSERT( server->nv.gameState == XWSTATE_MOVE_CONFIRM_WAIT ); nextTurn( server, PICK_NEXT ); return accepted; } /* handleMoveOk */ static void sendUndoTo( ServerCtxt* server, XP_U16 devIndex, XP_U16 nUndone, XP_U16 lastUndone ) { XWStreamCtxt* stream; CurGameInfo* gi = server->vol.gi; XW_Proto code = gi->serverRole == SERVER_ISCLIENT? XWPROTO_UNDO_INFO_CLIENT : XWPROTO_UNDO_INFO_SERVER; stream = messageStreamWithHeader( server, devIndex, code ); stream_putU16( stream, nUndone ); stream_putU16( stream, lastUndone ); stream_destroy( stream ); } /* sendUndoTo */ static void sendUndoToClientsExcept( ServerCtxt* server, XP_U16 skip, XP_U16 nUndone, XP_U16 lastUndone ) { XP_U16 devIndex; for ( devIndex = 1; devIndex < server->nv.nDevices; ++devIndex ) { if ( devIndex != skip ) { sendUndoTo( server, devIndex, nUndone, lastUndone ); } } } /* sendUndoToClientsExcept */ static XP_Bool reflectUndos( ServerCtxt* server, XWStreamCtxt* stream, XW_Proto code ) { XP_U16 nUndone, lastUndone; XP_S16 moveNum; XP_U16 turn; ModelCtxt* model = server->vol.model; XP_Bool success = XP_TRUE; nUndone = stream_getU16( stream ); lastUndone = stream_getU16( stream ); moveNum = lastUndone + nUndone - 1; success = model_undoLatestMoves(model, server->pool, nUndone, &turn, &moveNum); if ( success ) { XP_ASSERT( moveNum == lastUndone ); if ( code == XWPROTO_UNDO_INFO_CLIENT ) { /* need to inform */ XP_U16 sourceClientIndex = getIndexForDevice( server, stream_getAddress( stream ) ); sendUndoToClientsExcept( server, sourceClientIndex, nUndone, lastUndone ); } nextTurn( server, turn ); } return success; } /* reflectUndos */ #endif XP_Bool server_handleUndo( ServerCtxt* server ) { XP_Bool result = XP_FALSE; XP_U16 lastTurnUndone = 0; /* quiet compiler good */ XP_U16 nUndone = 0; ModelCtxt* model; CurGameInfo* gi; XP_U16 lastUndone = 0xFFFF; model = server->vol.model; gi = server->vol.gi; XP_ASSERT( !!model ); /* Undo until we find we've just undone a non-robot move. The point is not to stop with a robot about to act (since that's a bit pointless.) The exception is that if the first move was a robot move we'll stop there, and it will immediately move again. */ for ( ; ; ) { XP_S16 moveNum = -1; /* don't need it checked */ if ( !model_undoLatestMoves( model, server->pool, 1, &lastTurnUndone, &moveNum ) ) { break; } ++nUndone; XP_ASSERT( moveNum >= 0 ); lastUndone = moveNum; if ( !IS_ROBOT(&gi->players[lastTurnUndone]) ) { break; } } result = nUndone > 0 ; if ( result ) { #ifndef XWFEATURE_STANDALONE_ONLY XP_ASSERT( lastUndone != 0xFFFF ); if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) { sendUndoTo( server, SERVER_DEVICE, nUndone, lastUndone ); } else { sendUndoToClientsExcept( server, SERVER_DEVICE, nUndone, lastUndone ); } #endif nextTurn( server, lastTurnUndone ); } else { /* I'm a bit nervous about this. Is this the ONLY thing that cause nUndone to come back 0? */ util_userError( server->vol.util, ERR_CANT_UNDO_TILEASSIGN ); } return result; } /* server_handleUndo */ #ifndef XWFEATURE_STANDALONE_ONLY XP_Bool server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming ) { XW_Proto code; XP_Bool accepted = XP_FALSE; code = (XW_Proto)stream_getBits( incoming, XWPROTO_NBITS ); printCode("Receiving", code); if ( code == XWPROTO_DEVICE_REGISTRATION ) { /* This message is special: doesn't have the header that's possible once the game's in progress and communication's been established. */ XP_LOGF( "%s: somebody's registering!!!", __func__ ); accepted = handleRegistrationMsg( server, incoming ); } else if ( code == XWPROTO_CLIENT_SETUP ) { XP_STATUSF( "client got XWPROTO_CLIENT_SETUP" ); XP_ASSERT( server->vol.gi->serverRole == SERVER_ISCLIENT ); accepted = client_readInitialMessage( server, incoming ); } else if ( readStreamHeader( server, incoming ) ) { switch( code ) { /* case XWPROTO_MOVEMADE_INFO: */ /* accepted = client_reflectMoveMade( server, incoming ); */ /* if ( accepted ) { */ /* nextTurn( server ); */ /* } */ /* break; */ /* case XWPROTO_TRADEMADE_INFO: */ /* accepted = client_reflectTradeMade( server, incoming ); */ /* if ( accepted ) { */ /* nextTurn( server ); */ /* } */ /* break; */ /* case XWPROTO_CLIENT_MOVE_INFO: */ /* accepted = handleClientMoved( server, incoming ); */ /* break; */ /* case XWPROTO_CLIENT_TRADE_INFO: */ /* accepted = handleClientTraded( server, incoming ); */ /* break; */ case XWPROTO_MOVEMADE_INFO_CLIENT: /* client is reporting a move */ accepted = (XWSTATE_INTURN == server->nv.gameState) && reflectMoveAndInform( server, incoming ); break; case XWPROTO_MOVEMADE_INFO_SERVER: /* server telling me about a move */ accepted = reflectMove( server, incoming ); if ( accepted ) { nextTurn( server, PICK_NEXT ); } break; case XWPROTO_UNDO_INFO_CLIENT: case XWPROTO_UNDO_INFO_SERVER: accepted = reflectUndos( server, incoming, code ); /* nextTurn is called by reflectUndos */ break; case XWPROTO_BADWORD_INFO: accepted = handleIllegalWord( server, incoming ); if ( accepted && server->nv.gameState != XWSTATE_GAMEOVER ) { nextTurn( server, PICK_NEXT ); } break; case XWPROTO_MOVE_CONFIRM: accepted = handleMoveOk( server, incoming ); break; case XWPROTO_CLIENT_REQ_END_GAME: endGameInternal( server, END_REASON_USER_REQUEST ); accepted = XP_TRUE; break; case XWPROTO_END_GAME: doEndGame( server ); accepted = XP_TRUE; break; default: XP_WARNF( "Unknown code on incoming message: %d\n", code ); break; } /* switch */ } stream_close( incoming ); return accepted; } /* server_receiveMessage */ #endif void server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream, XP_U16 nCols ) { DictionaryCtxt* dict; Tile tile; XP_U16 nChars, nPrinted; XP_UCHAR buf[48]; const XP_UCHAR* fmt = util_getUserString( server->vol.util, STRS_VALUES_HEADER ); const XP_UCHAR* dname; XP_ASSERT( !!server->vol.model ); dict = model_getDictionary( server->vol.model ); dname = dict_getShortName( dict ); XP_SNPRINTF( buf, sizeof(buf), fmt, dname ); stream_catString( stream, buf ); nChars = dict_numTileFaces( dict ); for ( tile = 0, nPrinted = 0; ; ) { XP_UCHAR buf[24]; XP_U16 count, value; count = dict_numTiles( dict, tile ); if ( count > 0 ) { const XP_UCHAR* face = dict_getTileString( dict, tile ); value = dict_getTileValue( dict, tile ); XP_SNPRINTF( buf, sizeof(buf), (XP_UCHAR*)"%s: %d/%d", face, count, value ); stream_catString( stream, buf ); } if ( ++tile >= nChars ) { break; } else if ( count > 0 ) { if ( ++nPrinted % nCols == 0 ) { stream_catString( stream, XP_CR ); } else { stream_catString( stream, (void*)" " ); } } } } /* server_formatDictCounts */ /* Print the faces of all tiles left in the pool, including those currently in * trays !unless! player is >= 0, in which case his tiles get removed from the * pool. The idea is to show him what tiles are left in play. */ void server_formatRemainingTiles( ServerCtxt* server, XWStreamCtxt* stream, XP_S16 player ) { DictionaryCtxt* dict; Tile tile; XP_U16 nChars; XP_U16 counts[MAX_UNIQUE_TILES+1]; /* 1 for the blank */ PoolContext* pool = server->pool; if ( !pool ) { return; /* might want to print an explanation in the stream */ } XP_ASSERT( !!server->vol.model ); XP_MEMSET( counts, 0, sizeof(counts) ); model_countAllTrayTiles( server->vol.model, counts, player ); dict = model_getDictionary( server->vol.model ); nChars = dict_numTileFaces( dict ); for ( tile = 0; ; ) { XP_U16 count = pool_getNTilesLeftFor( pool, tile ) + counts[tile]; XP_Bool hasCount = count > 0; if ( hasCount ) { const XP_UCHAR* face = dict_getTileString( dict, tile ); for ( ; ; ) { stream_catString( stream, face ); if ( --count == 0 ) { break; } stream_catString( stream, "." ); } } if ( ++tile >= nChars ) { break; } else if ( hasCount ) { stream_catString( stream, (void*)" " ); } } } /* server_formatRemainingTiles */ #define IMPOSSIBLY_LOW_SCORE -1000 void server_writeFinalScores( ServerCtxt* server, XWStreamCtxt* stream ) { ScoresArray scores; ScoresArray tilePenalties; XP_S16 highestIndex; XP_S16 highestScore; XP_U16 place, nPlayers, ii; XP_S16 curScore; ModelCtxt* model = server->vol.model; const XP_UCHAR* addString = util_getUserString( server->vol.util, STRD_REMAINING_TILES_ADD ); const XP_UCHAR* subString = util_getUserString( server->vol.util, STRD_UNUSED_TILES_SUB ); XP_UCHAR timeBuf[16]; XP_UCHAR* timeStr; CurGameInfo* gi = server->vol.gi; XP_ASSERT( server->nv.gameState == XWSTATE_GAMEOVER ); model_figureFinalScores( model, &scores, &tilePenalties ); nPlayers = gi->nPlayers; for ( place = 1; ; ++place ) { XP_UCHAR tmpbuf[48]; XP_UCHAR buf[128]; XP_Bool firstDone; highestScore = IMPOSSIBLY_LOW_SCORE; highestIndex = -1; for ( ii = 0; ii < nPlayers; ++ii ) { if ( scores.arr[ii] > highestScore ) { highestIndex = ii; highestScore = scores.arr[ii]; } } if ( highestIndex == -1 ) { break; /* we're done */ } else if ( place > 1 ) { stream_catString( stream, XP_CR ); } scores.arr[highestIndex] = IMPOSSIBLY_LOW_SCORE; curScore = model_getPlayerScore( model, highestIndex ); timeStr = (XP_UCHAR*)""; if ( gi->timerEnabled ) { XP_U16 penalty = player_timePenalty( gi, highestIndex ); if ( penalty > 0 ) { XP_SNPRINTF( timeBuf, sizeof(timeBuf), util_getUserString( server->vol.util, STRD_TIME_PENALTY_SUB ), penalty ); /* positive for formatting */ timeStr = timeBuf; } } firstDone = model_getNumTilesTotal( model, highestIndex) == 0; XP_SNPRINTF( tmpbuf, sizeof(tmpbuf), (firstDone? addString:subString), firstDone? tilePenalties.arr[highestIndex]: -tilePenalties.arr[highestIndex] ); XP_SNPRINTF( buf, sizeof(buf), (XP_UCHAR*)"[%d] %s: %d" XP_CR " (%d %s%s)", place, emptyStringIfNull(gi->players[highestIndex].name), highestScore, curScore, tmpbuf, timeStr ); stream_catString( stream, buf ); } } /* server_writeFinalScores */ #ifdef CPLUS } #endif
988432bb94004a2f42d583bc4de5f2699b6c5342
2a5230f1a04cb6765deff0c49bf0eacb3ab7d385
/SYSTEM/MY_OS/os_msg.h
243917e90c80d4c12b27ccb380df511e468d4fcb
[]
no_license
RanChuan/WK_JZQ_V2.7
d98069bc022af200b74d1c723a8e379686f91592
af398298e7dbc436f83e46b4983e270782362a0b
refs/heads/master
2020-05-06T12:15:43.931082
2019-08-05T09:54:21
2019-08-05T09:54:21
180,113,105
0
1
null
null
null
null
GB18030
C
false
false
3,110
h
os_msg.h
#ifndef __OS_MSG_H #define __OS_MSG_H #ifdef __cplusplus extern "C" { #endif //命令缓冲区长度 #define MESSEG_NUM 30 //数据位长度 #define MESSEG_DATA 9 //系统消息类型 #define MSG_TYPE 0xff000000 #define SYS_MSG 0x01000000 #define TASK_MSG 0x02000000 #define SOFT_MSG 0x04000000 //软件设备,例如软件定时器 #define DELAY_END 0x80000000 #define IN_ONLYME 0x40000000 //处于不可调度宏之中,不能进行主动任务切换 #define GET_MSGTYPE(msg,type) (((msg)&(MSG_TYPE))==(type))//消息类型判定宏 //错误类型结构体 typedef struct { u8 msgfrom; u8 msgto; u16 errType;//返回错误类型 u16 extErrType;//扩展错误类型 char *errStr;//返回错误类型字符串 char *extErrStr;//扩展错误类型字符串 } msgerr; enum { msgNoneErr=0, //没有错误 msgUnknownErr=1, //未知的错误 msgQueueIsFull=2, //队列已满 msgAddrErr=3, //目标地址错误 msgMoreErr=4, //因其他执行结果造成的错误 msgSameType=5, //已有同类消息在队列中 msgNoneMsg=6, //没有消息 }; //消息内容联合体 typedef union { u8 u8dat[MESSEG_DATA]; u8 *u8ptr; u16 *u16ptr; u32 *u32ptr; void *voidptr; } msgdata; #define MSG_FLAG_SEND 0x08 //发送的消息 #define MSG_FLAG_RECV 0x80 //根据需要发送的执行结果返回消息 #define MSG_FLAG_ENRE 0x01 //此消息需要返回执行结果 #define MSG_FLAG_CEECK 0x02 //发送时检查队列中是否存在发送到该地址的消息,如果有返回错误 #define MSG_TYPE_U8 0x01 #define MSG_TYPE_U8PTR 0x02 #define MSG_TYPE_U16PTR 0x03 #define MSG_TYPE_U32PTR 0x04 #define MSG_TYPE_VOIDPTR 0x05 typedef struct { u8 msgto; //发送给谁的,为0,没内容 u8 msgfrom; //消息源头 u8 msgflag; //消息标志,是否等待返回等 u8 msgtype; //消息类型, u16 exterr; //执行错误的错误类型 char *exterrstr; //执行时错误的字符串形式 msgdata data; //消息的内容,消息内容根据具体的使用者确定 } messeg,*pmesseg; extern messeg my_messeg[MESSEG_NUM]; //发送消息,0,成功,1,失败 u8 send_messeg (u8 type,u8 *data); //接收消息,0,成功,1,失败 u8 get_messeg (u8 type,u8 *data); //找该类型的消息是否存在,1,有,0,无 u8 find_messeg(u8 type); //等待消息,0,成功,1,失败 u8 wait_messeg (u8 type,u8 *data); u8 SetFocus(u8 pro); u8 GetFocus (void); INT8U os_msg_init (void); ///////////////新增的消息函数2018.12.29//////////////////////// //获取错误类型的字符串形式 char *msgErrToStr (u16 errType); //复制消息结构体 void msgCopyMsg(msgdata *from,msgdata *to,u8 msgtype); msgerr Msg_Wait (u32 msg_type,msgdata *msg,u8 *datatype,u8 *msgflag); msgerr Msg_Send (u8 to_task_pro,msgdata *msg,u8 msgtype, u8 msgflag,u16 reterr,char *errstr); msgerr Msg_Get (u32 msg_type,msgdata *msg,u8 *datatype,u8 *msgflag); //初始化消息结构体 void msgInit(void); #ifdef __cplusplus } #endif #endif
6c0ae1cca4654db1edcee1e82108262255916d82
3735137780580a1145acee1519913c21fb08cbeb
/Chapter 5/5-6.c
1ffe113726efbdc4610fa6f082423e07d050614a
[]
no_license
Alh4zr3d/Practical-C-Exercises
38654cc5857f64c17defc10fba0a4b1168cb6309
4853093c33994c135a3eed9cae468bdb71a8ee01
refs/heads/master
2023-02-21T23:17:14.437417
2021-01-23T21:32:51
2021-01-23T21:32:51
259,214,785
0
1
null
2021-01-23T21:32:52
2020-04-27T05:30:54
C
UTF-8
C
false
false
330
c
5-6.c
#include <stdio.h> int main() { char line[100]; int minutes; int hours; int min; printf("Please enter the number of minutes: "); fgets(line, sizeof(line), stdin); sscanf_s(line, "%d", &minutes); hours = minutes / 60; min = minutes % 60; printf("Hours: %d\nMinutes: %d", hours, min); return (0); }
d0794964d6a9c6d21cb54fa570262508ea934f2e
dd15067122efe016e41d528cd209558c92d9cf59
/ECAL/SSD.h
0a2bde6f51421f8d4c7980a464164b7589c12476
[]
no_license
Mahmoud0Morgan0/TimerTriggred_Sebha
79419cb8883c8cd93e9c5d3b1aa0576673f0af94
cebd754e7320833568e2ee3355c15141c7c4de1c
refs/heads/master
2022-10-07T15:14:31.523307
2020-06-10T15:36:16
2020-06-10T15:36:16
269,127,427
0
0
null
null
null
null
UTF-8
C
false
false
1,492
h
SSD.h
/* * SSD.h * * Created on: May 20, 2020 * Author: jenki */ #ifndef ECAL_SSD_H_ #define ECAL_SSD_H_ /********************************************************************** * Includes **********************************************************************/ #include "../Config/SSD_cfg.h" #include"../HAL/os.h" /********************************************************************** * Preprocessor Constants **********************************************************************/ /********************************************************************** * Typedefs **********************************************************************/ /** \brief Enumerate the types of errors in the SSD module.*/ typedef enum { SSD_PASS, /**< There is no Error */ INCORRECT_SSD_ID, /**< Error IN SSD ID */ INCORRECT_SSD_SYMBOL, /**< Error IN SSD Symbol */ INCORRECT_SSD_STATE /**< Error IN SSD State */ }SSD_error_t; /********************************************************************** * Function Prototypes **********************************************************************/ SSD_error_t SSD_init(const SSD_Config_t const * config); void SSD_update(void); SSD_error_t SSD_setState(uint8 SSD_id,SSD_State_t state); SSD_error_t SSD_getState(uint8 SSD_id,SSD_State_t *state); SSD_error_t SSD_setSymbol(uint8 SSD_id,SSD_symbols_t symbol); SSD_error_t SSD_getSymbol(uint8 SSD_id,SSD_symbols_t *symbol); SSD_error_t SSD_out(uint8 SSD_id,SSD_symbols_t symbol); #endif /* ECAL_SSD_H_ */
b94d475471194497210488b956bfff887982dae1
d809b290d4a9661b5fa39f3f67a021d76730c20c
/GridrecApp/src/fftw_bench.c
924ad348988fcefaf8d6701247c3ea10b55a53a4
[]
no_license
CARS-UChicago/Gridrec
8cfd00bf6e4a724fecbe6b7ad864326ca5523aaf
8bad8ad337cd234f4c0f1afc2986ce14c8ae9ea7
refs/heads/master
2022-01-25T09:17:44.628022
2022-01-13T22:42:03
2022-01-13T22:42:03
90,881,819
1
0
null
null
null
null
UTF-8
C
false
false
9,065
c
fftw_bench.c
/* gcc fftw_test.c timer.c -I ~/lib/fftw-3.1.2/include/ -L ~/lib/fftw-3.1.2/lib/ -lfftw3f -lm -o a.serial */ /* gcc -DTHREADED fftw_test.c timer.c -I ~/lib/fftw-3.1.2/include/ -L ~/lib/fftw-3.1.2/lib/ -lfftw3f_threads -lfftw3f -lpthread -lm -o a.threads */ /* nvcc -DCUDA -I /usr/local/cuda/include -I ~/NVIDIA_CUDA_SDK/common/inc -L /usr/local/cuda/lib fftw_test.cu timer.cu -lcufft -o a.cuda */ // CUDA - use cuda, otherwise fftw // POW2 - use power of two transform, otherwise use non power of 2 // ONED | TWOD | THREED - exclusive, dimension of transform // THREADED - (!CUDA) - use threaded fftw // HOSTMEM - (CUDA) memory copy from host included in timing // INPLACE - transforms are done in place // FASTPLAN - use FFTW_ESTIMATE for FFTW plan creation rather than FFTW_MEASURE #include <stdlib.h> #include <stdio.h> #include <math.h> #ifdef CUDA #include <cufft.h> #include <cutil.h> #else #include <fftw3.h> const int N_THREADS = 4; #endif double dt( char ); #ifdef ONED #ifndef POW2 #define NNPOW2 22 int npow2[NNPOW2] = {6,9,12,15,18,24,36,80,108,210,504,1000,1960,4725,10368,27000,75600,165375,362880,1562500,3211264,6250000}; //,12250000,25401600}; #endif #endif #ifdef TWOD #ifdef POW2 #define NPOW2 18 int pow2[NPOW2][2] = { {4,4},{8,4},{4,8},{8,8},{16,16},{32,32},{64,64},{16,512},{128,64},{128,128},{256,128},{512,64},{64,1024},{256,256},{512,512},{1024,1024},{2048,2048},{4096,4096}}; //,{8192,8192} }; -- this fails when creating plan //int igrid[2][3] = { {0, 1, 2}, {3, 4, 5} }; #else #define NNPOW2 33 int npow2[NNPOW2][2] = { {5,5},{6,6},{7,7},{9,9},{10,10},{11,11},{12,12},{13,13},{14,14},{15,15},{25,24},{48,48},{49,49},{60,60},{72,56},{75,75},{80,80},{84,84},{96,96},{100,100},{105,105},{112,112},{120,120},{144,144},{180,180},{240,240},{360,360},{1000,1000},{1050,1050},{1458,1458},{1960,1960},{2916,2916},{4116,4116} }; // ,{5832,5832},{8400,8400},{10368,10368} }; #endif #endif #ifdef THREED #ifdef POW2 #define NPOW2 13 int pow2[NPOW2][3] = { {4,4,4},{8,8,8},{4,8,16},{16,16,16},{32,32,32},{64,64,64},{256,64,32},{16,1024,64},{128,128,128},{512,128,64},{256,128,256},{256,256,256},{512,64,1024} }; // this won't fit on card ,{512,512,512} } #else #define NNPOW2 28 int npow2[NNPOW2][3] = { {5,5,5},{6,6,6},{7,7,7},{9,9,9},{10,10,10},{11,11,11},{12,12,12},{13,13,13},{14,14,14},{15,15,15},{24,25,28},{48,48,48},{49,49,49},{60,60,60},{72,60,56},{75,75,75},{80,80,80},{84,84,84},{96,96,96},{100,100,100},{105,105,105},{112,112,112},{120,120,120},{144,144,144},{180,180,180},{210,210,210},{270,270,270},{324,324,324} }; // this won't fit on card ,{420,420,420} } #endif #endif int main( int argc, char** argv) { #ifdef CUDA cufftHandle plan; cufftComplex *data, *datao, *devdata, *devdatao; #else fftwf_complex *in, *out; fftwf_plan p; #endif int i,k,n_el,n_test,nx; #ifdef TWOD int ny; #endif #ifdef THREED int ny,nz; #endif double sec, mflops; #ifdef CUDA CUT_DEVICE_INIT(); #endif #ifdef ONED #ifdef POW2 for (k=2; k<24; k++) { nx = pow(2.0,(double)k); n_el = nx; #else for (k=0; k<NNPOW2; k++) { nx = npow2[k]; n_el = nx; #endif #endif #ifdef TWOD #ifdef POW2 for (k=0; k<NPOW2; k++) { nx = pow2[k][0]; ny = pow2[k][1]; n_el = nx*ny; #else for (k=0; k<NNPOW2; k++) { nx = npow2[k][0]; ny = npow2[k][1]; n_el = nx*ny; #endif #endif #ifdef THREED #ifdef POW2 for (k=0; k<NPOW2; k++) { nx = pow2[k][0]; ny = pow2[k][1]; nz = pow2[k][2]; n_el = nx*ny*nz; #else for (k=0; k<NNPOW2; k++) { nx = npow2[k][0]; ny = npow2[k][1]; nz = npow2[k][2]; n_el = nx*ny*nz; #endif #endif #ifdef CUDA size_t arraySize = sizeof(cufftComplex) * n_el; cudaMallocHost((void**) &data, arraySize); cudaMallocHost((void**) &datao, arraySize); #else in = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * n_el); out = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * n_el); #endif #ifdef THREADED fftwf_init_threads(); fftwf_plan_with_nthreads(N_THREADS); #endif // start plan creation #ifdef CUDA #ifdef ONED cufftPlan1d(&plan, n_el, CUFFT_C2C, 1); #endif #ifdef TWOD cufftPlan2d(&plan, nx, ny, CUFFT_C2C); #endif #ifdef THREED cufftPlan3d(&plan, nx, ny, nz, CUFFT_C2C); #endif #else #ifdef ONED #ifdef INPLACE #ifdef FASTPLAN p = fftwf_plan_dft_1d(n_el, in, in, FFTW_FORWARD, FFTW_ESTIMATE); #else p = fftwf_plan_dft_1d(n_el, in, in, FFTW_FORWARD, FFTW_MEASURE); #endif #else #ifdef FASTPLAN p = fftwf_plan_dft_1d(n_el, in, out, FFTW_FORWARD, FFTW_ESTIMATE); #else p = fftwf_plan_dft_1d(n_el, in, out, FFTW_FORWARD, FFTW_MEASURE); #endif #endif #endif #ifdef TWOD #ifdef INPLACE #ifdef FASTPLAN p = fftwf_plan_dft_2d(nx, ny, in, in, FFTW_FORWARD, FFTW_ESTIMATE); #else p = fftwf_plan_dft_2d(nx, ny, in, in, FFTW_FORWARD, FFTW_MEASURE); #endif #else #ifdef FASTPLAN p = fftwf_plan_dft_2d(nx, ny, in, out, FFTW_FORWARD, FFTW_ESTIMATE); #else p = fftwf_plan_dft_2d(nx, ny, in, out, FFTW_FORWARD, FFTW_MEASURE); #endif #endif #endif #ifdef THREED #ifdef INPLACE #ifdef FASTPLAN p = fftwf_plan_dft_3d(nx, ny, nz, in, in, FFTW_FORWARD, FFTW_ESTIMATE); #else p = fftwf_plan_dft_3d(nx, ny, nz, in, in, FFTW_FORWARD, FFTW_MEASURE); #endif #else #ifdef FASTPLAN p = fftwf_plan_dft_3d(nx, ny, nz, in, out, FFTW_FORWARD, FFTW_ESTIMATE); #else p = fftwf_plan_dft_3d(nx, ny, nz, in, out, FFTW_FORWARD, FFTW_MEASURE); #endif #endif #endif #endif // end plan creation //malloc arrays on device and populate input #ifdef CUDA cudaMalloc((void**)&devdata, arraySize); cudaMalloc((void**)&devdatao, arraySize); #endif for (i=0; i<n_el; i++) { #ifdef CUDA // data[i][0]=(float)i; // data[i][1]=(float)2*i; data[i].x=(float)i; data[i].y=(float)2*i; #else in[i][0]=(float)i; in[i][1]=(float)2*i; #endif } // start timer, transfer data to card #ifdef CUDA #ifndef HOSTMEM cudaMemcpy(devdata, data, arraySize, cudaMemcpyHostToDevice); #endif #endif dt('i'); //#ifdef HOSTMEM // dt('i'); // //#ifdef CUDA // cudaMemcpy(devdata, data, arraySize, cudaMemcpyHostToDevice); //#endif // //#else // //#ifdef CUDA // cudaMemcpy(devdata, data, arraySize, cudaMemcpyHostToDevice); //#endif // dt('i'); //#endif // calculate ffts for (n_test=0; n_test<N_FFTS; n_test++) { #ifdef CUDA #ifdef HOSTMEM cudaMemcpy(devdata, data, arraySize, cudaMemcpyHostToDevice); #endif #ifdef INPLACE cufftExecC2C(plan, devdata, devdata, CUFFT_FORWARD); #else cufftExecC2C(plan, devdata, devdatao, CUFFT_FORWARD); #endif #ifdef HOSTMEM #ifdef INPLACE cudaMemcpy(datao, devdata, arraySize, cudaMemcpyDeviceToHost); #else cudaMemcpy(datao, devdatao, arraySize, cudaMemcpyDeviceToHost); #endif #endif #else // for (i=0; i<N_FFTS ; i++) // { fftwf_execute(p); /* repeat as needed */ // } #endif } // copy data from card, end timer //#ifdef HOSTMEM // //#ifdef CUDA //#ifdef INPLACE // cudaMemcpy(datao, devdata, arraySize, cudaMemcpyDeviceToHost); //#else // cudaMemcpy(datao, devdatao, arraySize, cudaMemcpyDeviceToHost); //#endif //#endif // sec=dt('e'); //#else // sec=dt('e'); //#ifdef CUDA //#ifdef INPLACE // cudaMemcpy(datao, devdata, arraySize, cudaMemcpyDeviceToHost); //#else // cudaMemcpy(datao, devdatao, arraySize, cudaMemcpyDeviceToHost); //#endif //#endif //#endif sec=dt('e'); #ifdef CUDA #ifndef HOSTMEM #ifdef INPLACE cudaMemcpy(datao, devdata, arraySize, cudaMemcpyDeviceToHost); #else cudaMemcpy(datao, devdatao, arraySize, cudaMemcpyDeviceToHost); #endif #endif #endif //HERE // Have to change for 2d and 3d arrays mflops = 5. * (double) n_el * log( (double) n_el ) / log( 2.0 ) / sec * (double) N_FFTS / 1e+6; #ifdef ONED // printf("calculated %d ffts in %lf seconds = %lf mflops \n", N_FFTS, sec, mflops); printf("%ld\t%lf\t%lf\n", n_el, sec, mflops); #endif #ifdef TWOD printf("%ldx%ld\t%lf\t%lf\n", nx, ny, sec, mflops); #endif #ifdef THREED printf("%ldx%ldx%ld\t%lf\t%lf\n", nx, ny, nz, sec, mflops); #endif #ifdef THREADED fftwf_cleanup_threads(); #endif #ifdef CUDA cufftDestroy(plan); cudaFreeHost(data); cudaFreeHost(datao); cudaFree(devdata); cudaFree(devdatao); #else fftwf_destroy_plan(p); fftwf_free(in); fftwf_free(out); #endif } }
eabacebab0203bf6e1632e2206adcbde1334db7c
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/net/ethernet/intel/ixgbe/extr_ixgbe_main.c_ixgbe_get_parent_bus_info.c
ba2deb369c9083524f753fc057a9e2d43c5587f9
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
1,534
c
extr_ixgbe_main.c_ixgbe_get_parent_bus_info.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u16 ; struct TYPE_2__ {int /*<<< orphan*/ speed; int /*<<< orphan*/ width; int /*<<< orphan*/ type; } ; struct ixgbe_hw {TYPE_1__ bus; } ; struct ixgbe_adapter {struct ixgbe_hw hw; } ; typedef int s32 ; /* Variables and functions */ int /*<<< orphan*/ ixgbe_bus_type_pci_express ; int /*<<< orphan*/ ixgbe_convert_bus_speed (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ixgbe_convert_bus_width (int /*<<< orphan*/ ) ; int ixgbe_read_pci_cfg_word_parent (struct ixgbe_adapter*,int,int /*<<< orphan*/ *) ; __attribute__((used)) static s32 ixgbe_get_parent_bus_info(struct ixgbe_adapter *adapter) { struct ixgbe_hw *hw = &adapter->hw; u16 link_status = 0; int err; hw->bus.type = ixgbe_bus_type_pci_express; /* Get the negotiated link width and speed from PCI config space of the * parent, as this device is behind a switch */ err = ixgbe_read_pci_cfg_word_parent(adapter, 18, &link_status); /* assume caller will handle error case */ if (err) return err; hw->bus.width = ixgbe_convert_bus_width(link_status); hw->bus.speed = ixgbe_convert_bus_speed(link_status); return 0; }
30c518cab02664dcc9012f39b656738810ba64b7
eddb869bef42d88a98cc6e4de1d27d4bf820afc0
/Assets/Plugins/iOS/STAErrorCodes.h
92c371c4c86858f73b3c7c21e85702e9fe587c66
[ "Apache-2.0" ]
permissive
StartApp-SDK/unity-plugin-sample
ae61fdde0548678f80f64e0f83edb8504852ec30
15067ec747a6206a193fa6d10d0b1fc9c3207cf7
refs/heads/master
2022-11-20T23:43:57.728208
2020-04-21T14:46:38
2020-04-21T14:46:38
35,601,551
10
5
NOASSERTION
2021-11-26T05:13:42
2015-05-14T08:56:19
C#
UTF-8
C
false
false
1,443
h
STAErrorCodes.h
// // StartAppAd.h // StartAppAdSDK // // Copyright (c) 2013 StartApp. All rights reserved. // SDK version 4.3.0 typedef NS_ENUM(NSUInteger, STAError) { //Unexpected error occured STAErrorUnexpected = 0, //Connection issue occured STAErrorNoInternetConnection = 1, //Internal error occured STAErrorInternal = 2, //appID not set in STAStartAppSDK STAErrorAppIDNotSet = 3, //Invalid or insufficient params set when requesting ad STAErrorInvalidParams = 4, //Ad was not loaded because of internal rules STAErrorAdRules = 5, //Invalid or missing params in loaded ad STAErrorExpectedAdParamsMissingOrInvalid = 6, //Some of ad types are unsupported for old iOS versions STAErrorAdTypeNotSupported = 7, //Failed to show ad because another ad is being shown at the moment STAErrorAdAlreadyDisplayed = 8, //Failed to show ad because it has expired STAErrorAdExpired = 9, //Failed to show ad because it is not ready STAErrorAdNotReady = 10, //loadAd was called for native ad while it is in loading state STAErrorAdIsLoading = 11, //Demand issue which means that there are no active ads at current region for requested params STAErrorNoContent = 12, };
01ad627afa55a802b03a3e11a8d4163c83f39a4e
d17250c0c49d7dcebe7f77e50d9c3265c10b4cfb
/Engine/Vertex.h
d1eb26bfb3b0f4650728a7f0cef3bdbe5540baa5
[]
no_license
Atl4s/GameEngine
6a4219289ba542f4015cfb81deee07625557cb31
d9480fabde6461c7ad189e2a6c5758e8445fbee8
refs/heads/master
2020-12-30T13:39:38.487367
2017-05-14T12:11:08
2017-05-14T12:11:08
91,238,997
0
0
null
null
null
null
UTF-8
C
false
false
174
h
Vertex.h
#pragma once #include <GL/glew.h> #include <glm/glm.hpp> struct Vertex { glm::vec3 position; glm::vec4 color; glm::vec2 uv; glm::vec3 normal; glm::vec3 tangent; };
a66f8b91dc8478c757bff7acf9f03355cd5f907d
bbcda48854d6890ad029d5973e011d4784d248d2
/trunk/win/Source/Includes/QtIncludes/include/QtDesigner/private/qtresourceview_p.h
5a2f403357f9197f4e5aa3f818fb440417798d07
[ "MIT", "curl", "LGPL-2.1-or-later", "BSD-3-Clause", "BSL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "LGPL-2.1-only", "Zlib", "LicenseRef-scancode-unknown", "LicenseRef-scancode-unknown-license-reference", "MS-LPL" ]
permissive
dyzmapl/BumpTop
9c396f876e6a9ace1099b3b32e45612a388943ff
1329ea41411c7368516b942d19add694af3d602f
refs/heads/master
2020-12-20T22:42:55.100473
2020-01-25T21:00:08
2020-01-25T21:00:08
236,229,087
0
0
Apache-2.0
2020-01-25T20:58:59
2020-01-25T20:58:58
null
UTF-8
C
false
false
70
h
qtresourceview_p.h
#include "../../../tools/designer/src/lib/shared/qtresourceview_p.h"
95b8ee4f04d493245bf6e4c9f00a27ae14ba55a9
1497386b0fe450e6c3881c8c6d52d9e6ad9117ab
/trunk/libmiracl/source/BRUTE.C
90bbe82028b5a171232bcad31413a6f07a75e4a7
[ "Apache-2.0" ]
permissive
flomar/CrypTool-VS2015
403f538d6cad9b2f16fbf8846d94456c0944569b
6468257af2e1002418882f22a9ed9fabddde096d
refs/heads/master
2021-01-21T14:39:58.113648
2017-02-22T14:10:19
2017-02-22T14:10:19
57,972,666
0
5
null
null
null
null
UTF-8
C
false
false
1,192
c
BRUTE.C
/* * Program to factor numbers using brute force. * * Copyright (c) 1988-1997 Shamus Software Ltd. */ #include <stdio.h> #include <miracl.h> #define LIMIT 15000 int main() { /* find factors by brute force division */ big x,y; int n,p; miracl *mip=mirsys(50,0); x=mirvar(0); y=mirvar(0); gprime(LIMIT); printf("input number to be factored\n"); cinnum(x,stdin); if (isprime(x)) { printf("this number is prime!\n"); return 0; } n=0; p=mip->PRIMES[0]; printf("factors are \n"); forever { /* try division by each prime in turn */ if (subdiv(x,p,y)==0) { /* factor found */ copy(y,x); printf("prime factor "); printf("%d\n",p); if (size(x)==1) return 0; continue; } if (size(y)<=p) { /* must be prime */ printf("prime factor "); cotnum(x,stdout); return 0; } p=mip->PRIMES[++n]; if (p==0) break; } if (isprime(x)) printf("prime factor "); else printf("composite factor "); cotnum(x,stdout); return 0; }
9d4000bd8c15ed9c5969c14b64660598942e2962
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/RetroArch/input/drivers/extr_sdl_input.c_sdl_grab_mouse.c
b2e0855222e23b6da4a0b0d289288245d39a8d00
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
1,122
c
extr_sdl_input.c_sdl_grab_mouse.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ SDL_Window ; /* Variables and functions */ int /*<<< orphan*/ SDL_FALSE ; int /*<<< orphan*/ SDL_SetWindowGrab (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SDL_TRUE ; scalar_t__ string_is_not_equal (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ video_driver_get_ident () ; scalar_t__ video_driver_get_ptr (int) ; __attribute__((used)) static void sdl_grab_mouse(void *data, bool state) { #ifdef HAVE_SDL2 struct temp{ SDL_Window *w; }; if (string_is_not_equal(video_driver_get_ident(), "sdl2")) return; /* First member of sdl2_video_t is the window */ SDL_SetWindowGrab(((struct temp*)video_driver_get_ptr(false))->w, state ? SDL_TRUE : SDL_FALSE); #endif }
14e385666708b8da0bee9edf7f324b4340b11dc9
08d8035291407b061dfc3963548c7d62981ee157
/leetcode/100+/191. Number of 1 Bits.c
5188201624e6f37c09ccdf5747022403dac6ff5c
[]
no_license
wuhang-du/Data-Structures-and-Algorithms
98e79523f92ccb59f4bee720c2f6dfbdc33a4184
8b55af65f6e523f5edb617e185506fbe4a4d962a
refs/heads/master
2022-04-26T08:37:51.619338
2020-05-05T14:00:23
2020-05-05T14:00:23
88,315,014
0
0
null
null
null
null
UTF-8
C
false
false
182
c
191. Number of 1 Bits.c
// //date: 2017-5-7 //desc: 很经典的解法 // // int hammingWeight(uint32_t n) { int count = 0; while(n){ count++; n &= (n-1); } return count; }
7fab1b3695c817bfff563879f0d1b9389f6d4d1b
007853bab5f06fbf88ffcc97112012169acdedbd
/maze/src/draw_rectangle.c
403a19f0a4efb8cc633f06568bececbd3b1a4895
[]
no_license
electrachong/holbertonschool-low_level_programming
3a3f1224af3819161100de83d3dc1d2863ce2576
ef63c147282a514d8091d39db71d5062ce2d5b3a
refs/heads/master
2021-01-17T02:24:46.671631
2017-05-19T06:04:31
2017-05-19T06:04:31
50,863,900
0
1
null
null
null
null
UTF-8
C
false
false
566
c
draw_rectangle.c
#include "maze.h" /** * draw_rectangle - Draw a rectangle * @sdl_instance: SDL instance * @positions: array of values for rectangle * @colors: array of RGBA values for rectangle color */ void draw_rectangle(SDL_Instance sdl_instance, float positions[], int colors[]) { SDL_Rect rectangle; rectangle.x = positions[0]; rectangle.y = positions[1]; rectangle.w = positions[2]; rectangle.h = positions[3]; SDL_SetRenderDrawColor(sdl_instance.renderer, colors[0], colors[1], colors[2], colors[3]); SDL_RenderFillRect(sdl_instance.renderer, &rectangle); }
02a8d9a53374f2147515376bf1801abdc72c7090
14881fb9331a05fc8b6788bc66106964119813d1
/ucos_ii/my_test/my_test.c
197fbfdb61524e7e4f82558f1a84fe573075d6dd
[]
no_license
wpmyj/stm32f103zet6
6ac023fff3b96ca9f76a7dbb1f8fbef10166c479
eb618d55e6b9043a4d8f9520e45a230740c9c05c
refs/heads/master
2021-01-21T14:49:17.393932
2016-09-19T09:12:59
2016-09-19T09:12:59
null
0
0
null
null
null
null
UTF-8
C
false
false
122
c
my_test.c
#include "ucos_ii.h" #include "os_cpu.h" void test_os1(void) { OS_TCB *pcb1; } void test_os2(void) { OS_TCB *pcb2; }
d2eeab43c49aabd8476d9586cfe96e4195bf337d
cbf099be750beec781bfc53b395c98a3fcccae2e
/TASK CONFIGURATION.h
4aa71dbf70e6da3028bd7d8ada93a5a40a34ad16
[]
no_license
Mohamed-Farag/OS-Configurator
9a9dc987a4c43527fc8eb1082a2aeb23834fd748
d48f0beb5d022d1574cfb11c046292106dc15d3f
refs/heads/main
2023-06-18T13:38:56.824687
2021-07-12T19:02:24
2021-07-12T19:02:24
385,353,576
0
0
null
null
null
null
UTF-8
C
false
false
997
h
TASK CONFIGURATION.h
/* This file is Auto-Generated to configure the AUTOSAR OS */ /**************************** TASK CONFIGURATION ****************************/ #define OS_TASK_NAME_1 T1 #define OS_TASK_PRIORITY_1 3 #define OS_TASK_SCHEDULE_1 FULL #define OS_TASK_ACTIVATION_1 1 #define OS_TASK_AUTOSTART_1 TRUE #define OS_TASK_TYPE_1 EXTENDED #define OS_TASK_SIZE_1 128 #define TASK_1_NUMBER_OF_EVENT_IN_TASK 2 #define TASK_1_NUMBER_OF_RES_IN_TASK 2 #define TASK_1_EVENT_1 Ev1 #define TASK_1_EVENT_2 EV2 #define TASK_1_RESOURCE_1 Res1 #define TASK_1_RESOURCE_2 Res2 #define OS_TASK_NAME_2 T2 #define OS_TASK_PRIORITY_2 2 #define OS_TASK_SCHEDULE_2 FULL #define OS_TASK_ACTIVATION_2 1 #define OS_TASK_AUTOSTART_2 FALSE #define OS_TASK_TYPE_2 EXTENDED #define OS_TASK_SIZE_2 128 #define TASK_2_NUMBER_OF_EVENT_IN_TASK 1 #define TASK_2_NUMBER_OF_RES_IN_TASK 1 #define TASK_2_EVENT_1 Ev2 #define TASK_2_RESOURCE_1 Res2
3fe6369f1ee7b681415f241416e5a594e318bc40
f654ce9e570c52c9b7d8c2c4cff414c8b405b8ac
/Hardware/imu/imu.c
68e142daa75e5abee7d3cff29306c31b28b78bf5
[]
no_license
logeexpluoqi/BionicRobotFish
c67c0101f5d87b75b66b89b373fc1819977e0976
72a623b1b882eb7be3ded3ec87b6bc71fd36f911
refs/heads/main
2023-03-28T20:19:51.685360
2021-03-14T12:52:45
2021-03-14T12:52:45
326,543,230
2
0
null
2021-02-28T11:58:28
2021-01-04T02:00:30
C
UTF-8
C
false
false
901
c
imu.c
/* * @Author: luoqi * @Date: 2021-03-12 13:22:42 * @Last Modified by: luoqi * @Last Modified time: 2021-03-12 13:41:04 */ #include "imu.h" #include "stm32f4xx_gpio.h" #include "stm32f4xx_rcc.h" static void imu_pin_init(void); void imu_init() { imu_pin_init(); imu_stop(); } void imu_pin_init() { GPIO_InitTypeDef GPIO_InitStructure; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; GPIO_Init(GPIOB, &GPIO_InitStructure); } void imu_start() { GPIO_SetBits(GPIOB, GPIO_Pin_15); } void imu_stop() { GPIO_ResetBits(GPIOB, GPIO_Pin_15); }
6ae89a5037b28aba3c69493f9badde6dad411de9
2bd59e71b4d7cb4285a88abe53fdc89551fdc0f1
/operators/extract_nibble.c
0ff591a119c04f86bd6cfcee976b55494a1b5a8a
[]
no_license
Naveen-Kiran/c-training
9d9ef519c87ff2be99902453922d87fb20ec6800
a4432d0dc906ea2b86a8d28fb8deb54e9ad2235a
refs/heads/master
2020-04-16T06:10:02.826331
2019-01-13T04:30:51
2019-01-13T04:30:51
165,335,229
0
0
null
null
null
null
UTF-8
C
false
false
338
c
extract_nibble.c
#include <stdio.h> #define EXTRACT_LOWER_NIBBLE(number) (number & 0x0f) #define EXTRACT_HIGHER_NIBBLE(number) ((number>>4) & 0xf) int main() { char number = 0x56; printf("lower nibble in given number is %d\n",EXTRACT_LOWER_NIBBLE(number)); printf("higher nibble in given number is %d\n",EXTRACT_HIGHER_NIBBLE(number)); return 0; }
4869e02f6a9c78321ac346e3a6bb327a55d3190a
804a6c14aadf514c8b19241422be837928ca0bd5
/ft_toupper.c
66a0d9683291ca7f8970cae12e27562c8127187d
[]
no_license
julielesage/42-Libft
b1355fb55cd16f033e731e2904d8db7277718869
878d4e2e391b424393d3c903687c6941eca0d043
refs/heads/master
2020-09-08T08:55:40.836376
2020-07-01T15:25:37
2020-07-01T15:25:37
221,085,258
0
0
null
null
null
null
UTF-8
C
false
false
1,165
c
ft_toupper.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_toupper.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jlesage <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/05 19:14:42 by jlesage #+# #+# */ /* Updated: 2019/11/25 19:40:59 by jlesage ### ########.fr */ /* */ /* ************************************************************************** */ #include <ctype.h> /*toupper() convertit la lettre c en majuscule si c'est possible. La valeur renvoyée est celle de la lettre convertie, ou bien c si la conversion n'était pas possible. */ int ft_toupper(int c) { while (c > 96 && c < 123) c -= 32; return (c); }
ba2b211b0115cfd143693636168a3bd6b97fbf27
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/fastsocket/kernel/drivers/infiniband/hw/cxgb4/extr_qp.c_alloc_host_sq.c
e40bee8849bdced05078ddf88204d37295a02b93
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
1,428
c
extr_qp.c_alloc_host_sq.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct t4_sq {int /*<<< orphan*/ dma_addr; int /*<<< orphan*/ queue; int /*<<< orphan*/ phys_addr; int /*<<< orphan*/ memsize; } ; struct TYPE_4__ {TYPE_1__* pdev; } ; struct c4iw_rdev {TYPE_2__ lldi; } ; struct TYPE_3__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ dma_alloc_coherent (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mapping ; int /*<<< orphan*/ pci_unmap_addr_set (struct t4_sq*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ virt_to_phys (int /*<<< orphan*/ ) ; __attribute__((used)) static int alloc_host_sq(struct c4iw_rdev *rdev, struct t4_sq *sq) { sq->queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev), sq->memsize, &(sq->dma_addr), GFP_KERNEL); if (!sq->queue) return -ENOMEM; sq->phys_addr = virt_to_phys(sq->queue); pci_unmap_addr_set(sq, mapping, sq->dma_addr); return 0; }
19aed94f916f5c5b1005661c928040dac2f09376
f7795c8d90e884b72ac46994d3b40b825161cc03
/src/Game/System/platformLog.h
161f73665577abc72f18b2e3e51d3382a15320a3
[]
no_license
JesseRahikainen/Xturos
ee60bf0c92ec9233363202a64acb1fbdf0cbf670
7575a67c2d3750ddbfc7185723833e7b150ccced
refs/heads/master
2023-08-10T14:01:28.858135
2023-07-27T01:24:37
2023-07-27T01:24:37
34,029,022
1
0
null
2022-03-25T21:57:55
2015-04-16T02:05:38
C
UTF-8
C
false
false
1,368
h
platformLog.h
#ifndef PLATFORM_LOG #define PLATFORM_LOG // right now this is very basic, just chooses where to output it to based on the platform #if defined( __ANDROID__ ) /* typedef enum android_LogPriority { ANDROID_LOG_UNKNOWN = 0, ANDROID_LOG_DEFAULT, // only for SetMinPriority() ANDROID_LOG_VERBOSE, ANDROID_LOG_DEBUG, ANDROID_LOG_INFO, ANDROID_LOG_WARN, ANDROID_LOG_ERROR, ANDROID_LOG_FATAL, ANDROID_LOG_SILENT, // only for SetMinPriority(); must be last } android_LogPriority; */ #include <android/log.h> #define LOG_VERBOSE (int)ANDROID_LOG_VERBOSE #define LOG_DEBUG (int)ANDROID_LOG_DEBUG #define LOG_INFO (int)ANDROID_LOG_INFO #define LOG_WARN (int)ANDROID_LOG_WARN #define LOG_ERROR (int)ANDROID_LOG_ERROR #define LOG_CRITICAL (int)ANDROID_LOG_FATAL #else /* SDL_LOG_PRIORITY_VERBOSE = 1, SDL_LOG_PRIORITY_DEBUG, SDL_LOG_PRIORITY_INFO, SDL_LOG_PRIORITY_WARN, SDL_LOG_PRIORITY_ERROR, SDL_LOG_PRIORITY_CRITICAL, */ #include <SDL_log.h> #define LOG_VERBOSE (int)SDL_LOG_PRIORITY_VERBOSE #define LOG_DEBUG (int)SDL_LOG_PRIORITY_DEBUG #define LOG_INFO (int)SDL_LOG_PRIORITY_INFO #define LOG_WARN (int)SDL_LOG_PRIORITY_WARN #define LOG_ERROR (int)SDL_LOG_PRIORITY_ERROR #define LOG_CRITICAL (int)SDL_LOG_PRIORITY_CRITICAL #endif void llog( int priority, const char* fmt, ... ); #endif // inclusion guard
bb88154bd05f05cc603375c4e09b15524245560e
7eb8af2009b1b0cd85901e7ac7ea84837c3cc9e0
/src/gpio.c
c6e99ab64055932de776d8e6725469a16b3b4617
[]
no_license
hwidvorakinfo/bluepill_ov7670
6af5101e076c1e25227a3c6a422bf0efbf42ad09
57f164dc5598690b8fa6b89e2276f1f5219e5428
refs/heads/master
2020-07-08T01:34:42.747652
2019-11-09T05:51:08
2019-11-09T05:51:08
203,529,557
1
0
null
null
null
null
UTF-8
C
false
false
3,099
c
gpio.c
/* * gpio.c * * Created on: 14. 8. 2019 * Author: Petr Dvorak */ #include "gpio.h" #include "application.h" #include "misc.h" void gpio_init(void) { GPIO_InitTypeDef GPIO_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; RCC_APB2PeriphClockCmd(OUTPUT_CLOCKS, ENABLE); // GPIO vystupy na PAx #ifdef GPIOA_INIT GPIO_InitStructure.GPIO_Pin = OUT_PORT_A_OUTPUTS; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_Init(OUT_PORT_A, &GPIO_InitStructure); // inicializuj vystupy na PAx na spravne hodnoty #ifdef GPIOA_RESET_INIT GPIO_ResetBits(OUT_PORT_A, OUT_PORT_A_RESET_INIT); #endif #ifdef GPIOA_SET_INIT GPIO_SetBits(OUT_PORT_A, OUT_PORT_A_SET_INIT); #endif #endif // GPIO vystupy na PBx #ifdef GPIOB_INIT GPIO_InitStructure.GPIO_Pin = OUT_PORT_B_OUTPUTS; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_Init(OUT_PORT_B, &GPIO_InitStructure); // inicializuj vystupy na PBx na spravne hodnoty #ifdef GPIOB_RESET_INIT GPIO_ResetBits(OUT_PORT_B, OUT_PORT_B_RESET_INIT); #endif #ifdef GPIOB_SET_INIT GPIO_SetBits(OUT_PORT_B, OUT_PORT_B_SET_INIT); #endif #endif #ifdef GPIOC_INIT // GPIO vystupy na PCx GPIO_InitStructure.GPIO_Pin = OUT_PORT_C_OUTPUTS; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_Init(OUT_PORT_C, &GPIO_InitStructure); // inicializuj vystupy na PCx na spravne hodnoty #ifdef GPIOC_RESET_INIT GPIO_ResetBits(OUT_PORT_C, OUT_PORT_C_RESET_INIT); #endif #ifdef GPIOC_SET_INIT GPIO_SetBits(OUT_PORT_C, OUT_PORT_C_SET_INIT); #endif #endif #ifdef GPIOD_INIT // GPIO vystupy na PDx GPIO_InitStructure.GPIO_Pin = OUT_PORT_D_OUTPUTS; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_Init(OUT_PORT_D, &GPIO_InitStructure); // inicializuj vystupy na PDx na spravne hodnoty #ifdef GPIOD_RESET_INIT GPIO_ResetBits(OUT_PORT_D, OUT_PORT_D_RESET_INIT); #endif #ifdef GPIOD_SET_INIT GPIO_SetBits(OUT_PORT_D, OUT_PORT_D_SET_INIT); #endif #endif #ifdef GPIOA_INPUT // GPIO vstupy na PAx GPIO_InitStructure.GPIO_Pin = IN_PORT_A_INPUTS; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_Init(IN_PORT_A, &GPIO_InitStructure); #endif #ifdef GPIOB_INPUT // GPIO vstupy na PBx GPIO_InitStructure.GPIO_Pin = IN_PORT_B_INPUTS; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_Init(IN_PORT_B, &GPIO_InitStructure); #endif #ifdef GPIOC_INPUT // GPIO vstupy na PCx GPIO_InitStructure.GPIO_Pin = IN_PORT_C_INPUTS; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_Init(IN_PORT_C, &GPIO_InitStructure); #endif #ifdef GPIOD_INPUT // GPIO vstupy na PDx GPIO_InitStructure.GPIO_Pin = IN_PORT_D_INPUTS; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_Init(IN_PORT_D, &GPIO_InitStructure); #endif }
812baffceb831f0cec6a634b6e2d742bdfe1cd27
1cc5d45273d008e97497dad9ec004505cc68c765
/cheatsheet/ops_doc-master/Service/cfaq/example_c/group_varint/gvarint.h
d690dbbbf04fe2b4f2a170f08e69255395bba229
[]
no_license
wangfuli217/ld_note
6efb802989c3ea8acf031a10ccf8a8a27c679142
ad65bc3b711ec00844da7493fc55e5445d58639f
refs/heads/main
2023-08-26T19:26:45.861748
2023-03-25T08:13:19
2023-03-25T08:13:19
375,861,686
5
6
null
null
null
null
UTF-8
C
false
false
30,144
h
gvarint.h
/****************************************************************** * Created on: 2011-4-26 * Author: yewang@taobao.com clm971910@gmail.com * * Desc : 提供uint32的 varint 压缩和解压功能 * 提供group varint的高效实现 * ******************************************************************/ #ifndef VARINT_H_ #define VARINT_H_ #include <stdint.h> #include <stddef.h> #include <limits.h> #ifndef UNLIKELY #define UNLIKELY(x) __builtin_expect((x), 1) #define LIKELY(x) __builtin_expect((x), 0) #endif #define UINT24_MAX 0xFFFFFF #define UINT8_MAX 0xFF #define UINT16_MAX 0xFFFF #pragma pack(1) typedef struct { uint32_t value : 24; } UINT24_T; #pragma pack() /** * group varint 的索引表, 单位:(byte) * * 第0列: 第2整数 和 当前索引单元第一个字节的距离 * 第1列: 第3整数 和 当前索引单元第一个字节的距离 * 第2列: 第4整数 和 当前索引单元第一个字节的距离 * 第3列: 第1整数 占用的字节数 * 第4列: 第2整数 占用的字节数 * 第5列: 第3整数 占用的字节数 * 第6列: 第4整数 占用的字节数 * 第7列: 下一个索引单元(4个整数) 和 当前索引单元第一个字节的距离 * * 第一个整数和 索引单元的距离总是 1 */ static const uint8_t GROUP_VARINT_IDX_ARR[256][8] = { /* 00 00 00 00 */ { 2, 3, 4, 1, 1, 1, 1, 5}, /* 00 00 00 01 */ { 2, 3, 4, 1, 1, 1, 2, 6}, /* 00 00 00 10 */ { 2, 3, 4, 1, 1, 1, 3, 7}, /* 00 00 00 11 */ { 2, 3, 4, 1, 1, 1, 4, 8}, /* 00 00 01 00 */ { 2, 3, 5, 1, 1, 2, 1, 6}, /* 00 00 01 01 */ { 2, 3, 5, 1, 1, 2, 2, 7}, /* 00 00 01 10 */ { 2, 3, 5, 1, 1, 2, 3, 8}, /* 00 00 01 11 */ { 2, 3, 5, 1, 1, 2, 4, 9}, /* 00 00 10 00 */ { 2, 3, 6, 1, 1, 3, 1, 7}, /* 00 00 10 01 */ { 2, 3, 6, 1, 1, 3, 2, 8}, /* 00 00 10 10 */ { 2, 3, 6, 1, 1, 3, 3, 9}, /* 00 00 10 11 */ { 2, 3, 6, 1, 1, 3, 4, 10}, /* 00 00 11 00 */ { 2, 3, 7, 1, 1, 4, 1, 8}, /* 00 00 11 01 */ { 2, 3, 7, 1, 1, 4, 2, 9}, /* 00 00 11 10 */ { 2, 3, 7, 1, 1, 4, 3, 10}, /* 00 00 11 11 */ { 2, 3, 7, 1, 1, 4, 4, 11}, /* 00 01 00 00 */ { 2, 4, 5, 1, 2, 1, 1, 6}, /* 00 01 00 01 */ { 2, 4, 5, 1, 2, 1, 2, 7}, /* 00 01 00 10 */ { 2, 4, 5, 1, 2, 1, 3, 8}, /* 00 01 00 11 */ { 2, 4, 5, 1, 2, 1, 4, 9}, /* 00 01 01 00 */ { 2, 4, 6, 1, 2, 2, 1, 7}, /* 00 01 01 01 */ { 2, 4, 6, 1, 2, 2, 2, 8}, /* 00 01 01 10 */ { 2, 4, 6, 1, 2, 2, 3, 9}, /* 00 01 01 11 */ { 2, 4, 6, 1, 2, 2, 4, 10}, /* 00 01 10 00 */ { 2, 4, 7, 1, 2, 3, 1, 8}, /* 00 01 10 01 */ { 2, 4, 7, 1, 2, 3, 2, 9}, /* 00 01 10 10 */ { 2, 4, 7, 1, 2, 3, 3, 10}, /* 00 01 10 11 */ { 2, 4, 7, 1, 2, 3, 4, 11}, /* 00 01 11 00 */ { 2, 4, 8, 1, 2, 4, 1, 9}, /* 00 01 11 01 */ { 2, 4, 8, 1, 2, 4, 2, 10}, /* 00 01 11 10 */ { 2, 4, 8, 1, 2, 4, 3, 11}, /* 00 01 11 11 */ { 2, 4, 8, 1, 2, 4, 4, 12}, /* 00 10 00 00 */ { 2, 5, 6, 1, 3, 1, 1, 7}, /* 00 10 00 01 */ { 2, 5, 6, 1, 3, 1, 2, 8}, /* 00 10 00 10 */ { 2, 5, 6, 1, 3, 1, 3, 9}, /* 00 10 00 11 */ { 2, 5, 6, 1, 3, 1, 4, 10}, /* 00 10 01 00 */ { 2, 5, 7, 1, 3, 2, 1, 8}, /* 00 10 01 01 */ { 2, 5, 7, 1, 3, 2, 2, 9}, /* 00 10 01 10 */ { 2, 5, 7, 1, 3, 2, 3, 10}, /* 00 10 01 11 */ { 2, 5, 7, 1, 3, 2, 4, 11}, /* 00 10 10 00 */ { 2, 5, 8, 1, 3, 3, 1, 9}, /* 00 10 10 01 */ { 2, 5, 8, 1, 3, 3, 2, 10}, /* 00 10 10 10 */ { 2, 5, 8, 1, 3, 3, 3, 11}, /* 00 10 10 11 */ { 2, 5, 8, 1, 3, 3, 4, 12}, /* 00 10 11 00 */ { 2, 5, 9, 1, 3, 4, 1, 10}, /* 00 10 11 01 */ { 2, 5, 9, 1, 3, 4, 2, 11}, /* 00 10 11 10 */ { 2, 5, 9, 1, 3, 4, 3, 12}, /* 00 10 11 11 */ { 2, 5, 9, 1, 3, 4, 4, 13}, /* 00 11 00 00 */ { 2, 6, 7, 1, 4, 1, 1, 8}, /* 00 11 00 01 */ { 2, 6, 7, 1, 4, 1, 2, 9}, /* 00 11 00 10 */ { 2, 6, 7, 1, 4, 1, 3, 10}, /* 00 11 00 11 */ { 2, 6, 7, 1, 4, 1, 4, 11}, /* 00 11 01 00 */ { 2, 6, 8, 1, 4, 2, 1, 9}, /* 00 11 01 01 */ { 2, 6, 8, 1, 4, 2, 2, 10}, /* 00 11 01 10 */ { 2, 6, 8, 1, 4, 2, 3, 11}, /* 00 11 01 11 */ { 2, 6, 8, 1, 4, 2, 4, 12}, /* 00 11 10 00 */ { 2, 6, 9, 1, 4, 3, 1, 10}, /* 00 11 10 01 */ { 2, 6, 9, 1, 4, 3, 2, 11}, /* 00 11 10 10 */ { 2, 6, 9, 1, 4, 3, 3, 12}, /* 00 11 10 11 */ { 2, 6, 9, 1, 4, 3, 4, 13}, /* 00 11 11 00 */ { 2, 6, 10 , 1, 4, 4, 1, 11}, /* 00 11 11 01 */ { 2, 6, 10 , 1, 4, 4, 2, 12 }, /* 00 11 11 10 */ { 2, 6, 10 , 1, 4, 4, 3, 13 }, /* 00 11 11 11 */ { 2, 6, 10 , 1, 4, 4, 4, 14 }, /* 01 00 00 00 */ { 3, 4, 5, 2, 1, 1, 1, 6}, /* 01 00 00 01 */ { 3, 4, 5, 2, 1, 1, 2, 7}, /* 01 00 00 10 */ { 3, 4, 5, 2, 1, 1, 3, 8}, /* 01 00 00 11 */ { 3, 4, 5, 2, 1, 1, 4, 9}, /* 01 00 01 00 */ { 3, 4, 6, 2, 1, 2, 1, 7}, /* 01 00 01 01 */ { 3, 4, 6, 2, 1, 2, 2, 8}, /* 01 00 01 10 */ { 3, 4, 6, 2, 1, 2, 3, 9}, /* 01 00 01 11 */ { 3, 4, 6, 2, 1, 2, 4, 10}, /* 01 00 10 00 */ { 3, 4, 7, 2, 1, 3, 1, 8}, /* 01 00 10 01 */ { 3, 4, 7, 2, 1, 3, 2, 9}, /* 01 00 10 10 */ { 3, 4, 7, 2, 1, 3, 3, 10}, /* 01 00 10 11 */ { 3, 4, 7, 2, 1, 3, 4, 11}, /* 01 00 11 00 */ { 3, 4, 8, 2, 1, 4, 1, 9}, /* 01 00 11 01 */ { 3, 4, 8, 2, 1, 4, 2, 10}, /* 01 00 11 10 */ { 3, 4, 8, 2, 1, 4, 3, 11}, /* 01 00 11 11 */ { 3, 4, 8, 2, 1, 4, 4, 12}, /* 01 01 00 00 */ { 3, 5, 6, 2, 2, 1, 1, 7}, /* 01 01 00 01 */ { 3, 5, 6, 2, 2, 1, 2, 8}, /* 01 01 00 10 */ { 3, 5, 6, 2, 2, 1, 3, 9}, /* 01 01 00 11 */ { 3, 5, 6, 2, 2, 1, 4, 10}, /* 01 01 01 00 */ { 3, 5, 7, 2, 2, 2, 1, 8}, /* 01 01 01 01 */ { 3, 5, 7, 2, 2, 2, 2, 9}, /* 01 01 01 10 */ { 3, 5, 7, 2, 2, 2, 3, 10}, /* 01 01 01 11 */ { 3, 5, 7, 2, 2, 2, 4, 11}, /* 01 01 10 00 */ { 3, 5, 8, 2, 2, 3, 1, 9}, /* 01 01 10 01 */ { 3, 5, 8, 2, 2, 3, 2, 10}, /* 01 01 10 10 */ { 3, 5, 8, 2, 2, 3, 3, 11}, /* 01 01 10 11 */ { 3, 5, 8, 2, 2, 3, 4, 12}, /* 01 01 11 00 */ { 3, 5, 9, 2, 2, 4, 1, 10}, /* 01 01 11 01 */ { 3, 5, 9, 2, 2, 4, 2, 11}, /* 01 01 11 10 */ { 3, 5, 9, 2, 2, 4, 3, 12}, /* 01 01 11 11 */ { 3, 5, 9, 2, 2, 4, 4, 13}, /* 01 10 00 00 */ { 3, 6, 7, 2, 3, 1, 1, 8}, /* 01 10 00 01 */ { 3, 6, 7, 2, 3, 1, 2, 9}, /* 01 10 00 10 */ { 3, 6, 7, 2, 3, 1, 3, 10}, /* 01 10 00 11 */ { 3, 6, 7, 2, 3, 1, 4, 11}, /* 01 10 01 00 */ { 3, 6, 8, 2, 3, 2, 1, 9}, /* 01 10 01 01 */ { 3, 6, 8, 2, 3, 2, 2, 10}, /* 01 10 01 10 */ { 3, 6, 8, 2, 3, 2, 3, 11}, /* 01 10 01 11 */ { 3, 6, 8, 2, 3, 2, 4, 12}, /* 01 10 10 00 */ { 3, 6, 9, 2, 3, 3, 1, 10}, /* 01 10 10 01 */ { 3, 6, 9, 2, 3, 3, 2, 11}, /* 01 10 10 10 */ { 3, 6, 9, 2, 3, 3, 3, 12}, /* 01 10 10 11 */ { 3, 6, 9, 2, 3, 3, 4, 13}, /* 01 10 11 00 */ { 3, 6, 10 , 2, 3, 4, 1 , 11}, /* 01 10 11 01 */ { 3, 6, 10 , 2, 3, 4, 2 , 12}, /* 01 10 11 10 */ { 3, 6, 10 , 2, 3, 4, 3 , 13}, /* 01 10 11 11 */ { 3, 6, 10 , 2, 3, 4, 4 , 14}, /* 01 11 00 00 */ { 3, 7, 8, 2, 4, 1, 1, 9}, /* 01 11 00 01 */ { 3, 7, 8, 2, 4, 1, 2, 10}, /* 01 11 00 10 */ { 3, 7, 8, 2, 4, 1, 3, 11}, /* 01 11 00 11 */ { 3, 7, 8, 2, 4, 1, 4, 12}, /* 01 11 01 00 */ { 3, 7, 9, 2, 4, 2, 1, 10}, /* 01 11 01 01 */ { 3, 7, 9, 2, 4, 2, 2, 11}, /* 01 11 01 10 */ { 3, 7, 9, 2, 4, 2, 3, 12}, /* 01 11 01 11 */ { 3, 7, 9, 2, 4, 2, 4, 13}, /* 01 11 10 00 */ { 3, 7, 10 , 2, 4, 3, 1 , 11}, /* 01 11 10 01 */ { 3, 7, 10 , 2, 4, 3, 2 , 12}, /* 01 11 10 10 */ { 3, 7, 10 , 2, 4, 3, 3 , 13}, /* 01 11 10 11 */ { 3, 7, 10 , 2, 4, 3, 4 , 14}, /* 01 11 11 00 */ { 3, 7, 11 , 2, 4, 4, 1 , 12}, /* 01 11 11 01 */ { 3, 7, 11 , 2, 4, 4, 2 , 13}, /* 01 11 11 10 */ { 3, 7, 11 , 2, 4, 4, 3 , 14}, /* 01 11 11 11 */ { 3, 7, 11 , 2, 4, 4, 4 , 15}, /* 10 00 00 00 */ { 4, 5, 6, 3, 1, 1, 1, 7}, /* 10 00 00 01 */ { 4, 5, 6, 3, 1, 1, 2, 8}, /* 10 00 00 10 */ { 4, 5, 6, 3, 1, 1, 3, 9}, /* 10 00 00 11 */ { 4, 5, 6, 3, 1, 1, 4, 10}, /* 10 00 01 00 */ { 4, 5, 7, 3, 1, 2, 1, 8}, /* 10 00 01 01 */ { 4, 5, 7, 3, 1, 2, 2, 9}, /* 10 00 01 10 */ { 4, 5, 7, 3, 1, 2, 3, 10}, /* 10 00 01 11 */ { 4, 5, 7, 3, 1, 2, 4, 11}, /* 10 00 10 00 */ { 4, 5, 8, 3, 1, 3, 1, 9}, /* 10 00 10 01 */ { 4, 5, 8, 3, 1, 3, 2, 10}, /* 10 00 10 10 */ { 4, 5, 8, 3, 1, 3, 3, 11}, /* 10 00 10 11 */ { 4, 5, 8, 3, 1, 3, 4, 12}, /* 10 00 11 00 */ { 4, 5, 9, 3, 1, 4, 1, 10}, /* 10 00 11 01 */ { 4, 5, 9, 3, 1, 4, 2, 11}, /* 10 00 11 10 */ { 4, 5, 9, 3, 1, 4, 3, 12}, /* 10 00 11 11 */ { 4, 5, 9, 3, 1, 4, 4, 13}, /* 10 01 00 00 */ { 4, 6, 7, 3, 2, 1, 1, 8}, /* 10 01 00 01 */ { 4, 6, 7, 3, 2, 1, 2, 9}, /* 10 01 00 10 */ { 4, 6, 7, 3, 2, 1, 3, 10}, /* 10 01 00 11 */ { 4, 6, 7, 3, 2, 1, 4, 11}, /* 10 01 01 00 */ { 4, 6, 8, 3, 2, 2, 1, 9}, /* 10 01 01 01 */ { 4, 6, 8, 3, 2, 2, 2, 10}, /* 10 01 01 10 */ { 4, 6, 8, 3, 2, 2, 3, 11}, /* 10 01 01 11 */ { 4, 6, 8, 3, 2, 2, 4, 12}, /* 10 01 10 00 */ { 4, 6, 9, 3, 2, 3, 1, 10}, /* 10 01 10 01 */ { 4, 6, 9, 3, 2, 3, 2, 11}, /* 10 01 10 10 */ { 4, 6, 9, 3, 2, 3, 3, 12}, /* 10 01 10 11 */ { 4, 6, 9, 3, 2, 3, 4, 13}, /* 10 01 11 00 */ { 4, 6, 10 , 3, 2, 4, 1, 11 }, /* 10 01 11 01 */ { 4, 6, 10 , 3, 2, 4, 2, 12 }, /* 10 01 11 10 */ { 4, 6, 10 , 3, 2, 4, 3, 13 }, /* 10 01 11 11 */ { 4, 6, 10 , 3, 2, 4, 4, 14 }, /* 10 10 00 00 */ { 4, 7, 8, 3, 3, 1, 1, 9}, /* 10 10 00 01 */ { 4, 7, 8, 3, 3, 1, 2, 10}, /* 10 10 00 10 */ { 4, 7, 8, 3, 3, 1, 3, 11}, /* 10 10 00 11 */ { 4, 7, 8, 3, 3, 1, 4, 12}, /* 10 10 01 00 */ { 4, 7, 9, 3, 3, 2, 1, 10}, /* 10 10 01 01 */ { 4, 7, 9, 3, 3, 2, 2, 11}, /* 10 10 01 10 */ { 4, 7, 9, 3, 3, 2, 3, 12}, /* 10 10 01 11 */ { 4, 7, 9, 3, 3, 2, 4, 13}, /* 10 10 10 00 */ { 4, 7, 10 , 3, 3, 3, 1, 11 }, /* 10 10 10 01 */ { 4, 7, 10 , 3, 3, 3, 2, 12 }, /* 10 10 10 10 */ { 4, 7, 10 , 3, 3, 3, 3, 13 }, /* 10 10 10 11 */ { 4, 7, 10 , 3, 3, 3, 4, 14 }, /* 10 10 11 00 */ { 4, 7, 11 , 3, 3, 4, 1, 12 }, /* 10 10 11 01 */ { 4, 7, 11 , 3, 3, 4, 2, 13 }, /* 10 10 11 10 */ { 4, 7, 11 , 3, 3, 4, 3, 14 }, /* 10 10 11 11 */ { 4, 7, 11 , 3, 3, 4, 4, 15 }, /* 10 11 00 00 */ { 4, 8, 9, 3, 4, 1, 1, 10}, /* 10 11 00 01 */ { 4, 8, 9, 3, 4, 1, 2, 11}, /* 10 11 00 10 */ { 4, 8, 9, 3, 4, 1, 3, 12}, /* 10 11 00 11 */ { 4, 8, 9, 3, 4, 1, 4, 13}, /* 10 11 01 00 */ { 4, 8, 10 , 3, 4, 2, 1, 11 }, /* 10 11 01 01 */ { 4, 8, 10 , 3, 4, 2, 2, 12 }, /* 10 11 01 10 */ { 4, 8, 10 , 3, 4, 2, 3, 13 }, /* 10 11 01 11 */ { 4, 8, 10 , 3, 4, 2, 4, 14 }, /* 10 11 10 00 */ { 4, 8, 11 , 3, 4, 3, 1, 12 }, /* 10 11 10 01 */ { 4, 8, 11 , 3, 4, 3, 2, 13 }, /* 10 11 10 10 */ { 4, 8, 11 , 3, 4, 3, 3, 14 }, /* 10 11 10 11 */ { 4, 8, 11 , 3, 4, 3, 4, 15 }, /* 10 11 11 00 */ { 4, 8, 12 , 3, 4, 4, 1, 13 }, /* 10 11 11 01 */ { 4, 8, 12 , 3, 4, 4, 2, 14 }, /* 10 11 11 10 */ { 4, 8, 12 , 3, 4, 4, 3, 15 }, /* 10 11 11 11 */ { 4, 8, 12 , 3, 4, 4, 4, 16 }, /* 11 00 00 00 */ { 5, 6, 7, 4, 1, 1, 1, 8}, /* 11 00 00 01 */ { 5, 6, 7, 4, 1, 1, 2, 9}, /* 11 00 00 10 */ { 5, 6, 7, 4, 1, 1, 3, 10}, /* 11 00 00 11 */ { 5, 6, 7, 4, 1, 1, 4, 11}, /* 11 00 01 00 */ { 5, 6, 8, 4, 1, 2, 1, 9}, /* 11 00 01 01 */ { 5, 6, 8, 4, 1, 2, 2, 10}, /* 11 00 01 10 */ { 5, 6, 8, 4, 1, 2, 3, 11}, /* 11 00 01 11 */ { 5, 6, 8, 4, 1, 2, 4, 12}, /* 11 00 10 00 */ { 5, 6, 9, 4, 1, 3, 1, 10}, /* 11 00 10 01 */ { 5, 6, 9, 4, 1, 3, 2, 11}, /* 11 00 10 10 */ { 5, 6, 9, 4, 1, 3, 3, 12}, /* 11 00 10 11 */ { 5, 6, 9, 4, 1, 3, 4, 13}, /* 11 00 11 00 */ { 5, 6, 10 , 4, 1, 4, 1, 11 }, /* 11 00 11 01 */ { 5, 6, 10 , 4, 1, 4, 2, 12 }, /* 11 00 11 10 */ { 5, 6, 10 , 4, 1, 4, 3, 13 }, /* 11 00 11 11 */ { 5, 6, 10 , 4, 1, 4, 4, 14 }, /* 11 01 00 00 */ { 5, 7, 8, 4, 2, 1, 1, 9}, /* 11 01 00 01 */ { 5, 7, 8, 4, 2, 1, 2, 10}, /* 11 01 00 10 */ { 5, 7, 8, 4, 2, 1, 3, 11}, /* 11 01 00 11 */ { 5, 7, 8, 4, 2, 1, 4, 12}, /* 11 01 01 00 */ { 5, 7, 9, 4, 2, 2, 1, 10}, /* 11 01 01 01 */ { 5, 7, 9, 4, 2, 2, 2, 11}, /* 11 01 01 10 */ { 5, 7, 9, 4, 2, 2, 3, 12}, /* 11 01 01 11 */ { 5, 7, 9, 4, 2, 2, 4, 13}, /* 11 01 10 00 */ { 5, 7, 10 , 4, 2, 3, 1 , 11}, /* 11 01 10 01 */ { 5, 7, 10 , 4, 2, 3, 2 , 12}, /* 11 01 10 10 */ { 5, 7, 10 , 4, 2, 3, 3 , 13}, /* 11 01 10 11 */ { 5, 7, 10 , 4, 2, 3, 4 , 14}, /* 11 01 11 00 */ { 5, 7, 11 , 4, 2, 4, 1 , 12}, /* 11 01 11 01 */ { 5, 7, 11 , 4, 2, 4, 2 , 13}, /* 11 01 11 10 */ { 5, 7, 11 , 4, 2, 4, 3 , 14}, /* 11 01 11 11 */ { 5, 7, 11 , 4, 2, 4, 4 , 15}, /* 11 10 00 00 */ { 5, 8, 9, 4, 3, 1, 1, 10}, /* 11 10 00 01 */ { 5, 8, 9, 4, 3, 1, 2, 11}, /* 11 10 00 10 */ { 5, 8, 9, 4, 3, 1, 3, 12}, /* 11 10 00 11 */ { 5, 8, 9, 4, 3, 1, 4, 13}, /* 11 10 01 00 */ { 5, 8, 10 , 4, 3, 2, 1 , 11}, /* 11 10 01 01 */ { 5, 8, 10 , 4, 3, 2, 2 , 12}, /* 11 10 01 10 */ { 5, 8, 10 , 4, 3, 2, 3 , 13}, /* 11 10 01 11 */ { 5, 8, 10 , 4, 3, 2, 4 , 14}, /* 11 10 10 00 */ { 5, 8, 11 , 4, 3, 3, 1 , 12}, /* 11 10 10 01 */ { 5, 8, 11 , 4, 3, 3, 2 , 13}, /* 11 10 10 10 */ { 5, 8, 11 , 4, 3, 3, 3 , 14}, /* 11 10 10 11 */ { 5, 8, 11 , 4, 3, 3, 4 , 15}, /* 11 10 11 00 */ { 5, 8, 12 , 4, 3, 4, 1, 13 }, /* 11 10 11 01 */ { 5, 8, 12 , 4, 3, 4, 2, 14 }, /* 11 10 11 10 */ { 5, 8, 12 , 4, 3, 4, 3, 15 }, /* 11 10 11 11 */ { 5, 8, 12 , 4, 3, 4, 4, 16 }, /* 11 11 00 00 */ { 5, 9, 10 , 4, 4, 1, 1, 11 }, /* 11 11 00 01 */ { 5, 9, 10 , 4, 4, 1, 2, 12 }, /* 11 11 00 10 */ { 5, 9, 10 , 4, 4, 1, 3, 13 }, /* 11 11 00 11 */ { 5, 9, 10 , 4, 4, 1, 4, 14 }, /* 11 11 01 00 */ { 5, 9, 11 , 4, 4, 2, 1, 12 }, /* 11 11 01 01 */ { 5, 9, 11 , 4, 4, 2, 2, 13 }, /* 11 11 01 10 */ { 5, 9, 11 , 4, 4, 2, 3, 14 }, /* 11 11 01 11 */ { 5, 9, 11 , 4, 4, 2, 4, 15 }, /* 11 11 10 00 */ { 5, 9, 12 , 4, 4, 3, 1, 13 }, /* 11 11 10 01 */ { 5, 9, 12 , 4, 4, 3, 2, 14 }, /* 11 11 10 10 */ { 5, 9, 12 , 4, 4, 3, 3, 15 }, /* 11 11 10 11 */ { 5, 9, 12 , 4, 4, 3, 4, 16 }, /* 11 11 11 00 */ { 5, 9, 13 , 4, 4, 4, 1, 14 }, /* 11 11 11 01 */ { 5, 9, 13 , 4, 4, 4, 2, 15 }, /* 11 11 11 10 */ { 5, 9, 13 , 4, 4, 4, 3, 16 }, /* 11 11 11 11 */ { 5, 9, 13 , 4, 4, 4, 4, 17} }; /** * 将一个uint32整数 做 varint 编码 输出到 buf中 * * @param value 输出的值 * @param target 输出的缓冲 , 需确保buf 空间是够用的 * * @return target中下一个可用的字节位置 */ inline uint8_t * varint_encode_uint32 ( uint32_t value, uint8_t * target ) { if ( value >= (1 << 7) ) { target[0] = (uint8_t)(value | 0x80); // 取低7位, 前面补 1 if ( value >= (1 << 14) ) { target[1] = (uint8_t)( (value >> 7) | 0x80 ); // 取次低7位,前面补 1 if ( value >= (1 << 21) ) { // 取第3个 低7位,前面补 1 target[2] = (uint8_t)( (value >> 14) | 0x80 ); if ( value >= (1 << 28) ) { // 取第4个 低7位,前面补 1 target[3] = (uint8_t)((value >> 21) | 0x80); // 剩余的高4位 target[4] = (uint8_t)(value >> 28); return target + 5; } else { target[3] = (uint8_t)( value >> 21 ); return target + 4; } } else { target[2] = (uint8_t)( value >> 14 ); return target + 3; } } else { target[1] = (uint8_t)( value >> 7 ); return target + 2; } } else { target[0] = (uint8_t) value; return target + 1; } } /** * 从buf中 将 varint压缩编码的值 还原读取出来 * 需要确保输入的buf 从 输出的指针到结尾 超过 5个byte, 避免出现core * 函数内部不做边界检查 * * @param buffer 输入的buf * @param value 输出的值 * * @return target中下一个可读的字节位置 */ inline const uint8_t * varint_decode_uint32( const uint8_t * buffer, uint32_t & value ) { register const uint8_t * ptr = buffer; // 低7位, 小于 128 的数字 register uint8_t b0 = ptr[ 0 ]; register uint32_t r0 = (b0 & 0x7F); if (UNLIKELY( !(b0 & 0x80) )) { value = r0; return ptr + 1; } // 低14位, 小于 16384 的数字 register uint8_t b1 = ptr[ 1 ]; register uint32_t r1 = (b1 & 0x7F) << 7; if (UNLIKELY( !(b1 & 0x80) )) { value = ( r1 | r0 ); return ptr + 2; } // 低21位, 小于 2097152 的数字 register uint8_t b2 = ptr[ 2 ]; register uint32_t r2 = (b2 & 0x7F) << 14; if (UNLIKELY( !(b2 & 0x80) )) { value = ( r2 | r1 | r0 ); return ptr + 3; } // 低28位, 小于 268435456 的数字 register uint8_t b3 = ptr[ 3 ]; register uint32_t r3 = (b3 & 0x7F) << 21; if ( !(b3 & 0x80) ) { value = ( r3 | r2 | r1 | r0 ); return ptr + 4; } // 完整的32位 value = ( ((ptr[ 4 ]) << 28) | r3 | r2 | r1 | r0 ); return ptr + 5; } /** * 从buf中 指定的字节数中 将 varint压缩编码的值 还原读取出来 * 指定的字节数 也许是 不足的, 比如: 截断掉了, 这样就返回NULL * * @param buffer 输入的buf * @param value 输出的值 * * @return target中下一个可读的字节位置, 如果buffer异常 返回NULL */ inline const uint8_t * varint_decode_uint32( const uint8_t * buffer, uint32_t len, uint32_t & value ) { if ( len >= 5 ) // len == 0 就不考虑了 return varint_decode_uint32( buffer, value ); register const uint8_t * ptr = buffer; // 低7位, 小于 128 的数字 register uint8_t b0 = ptr[ 0 ]; register uint32_t r0 = (b0 & 0x7F); if (UNLIKELY( !(b0 & 0x80) )) { value = r0; return ptr + 1; } if (UNLIKELY( len < 2 )) return NULL; // 低14位, 小于 16384 的数字 register uint8_t b1 = ptr[ 1 ]; register uint32_t r1 = (b1 & 0x7F) << 7; if (UNLIKELY( !(b1 & 0x80) )) { value = ( r1 | r0 ); return ptr + 2; } if (UNLIKELY( len < 3 )) return NULL; // 低21位, 小于 2097152 的数字 register uint8_t b2 = ptr[ 2 ]; register uint32_t r2 = (b2 & 0x7F) << 14; if (UNLIKELY( !(b2 & 0x80) )) { value = ( r2 | r1 | r0 ); return ptr + 3; } if (UNLIKELY( len < 4 )) return NULL; // 低28位, 小于 268435456 的数字 register uint8_t b3 = ptr[ 3 ]; register uint32_t r3 = (b3 & 0x7F) << 21; if ( !(b3 & 0x80) ) { value = ( r3 | r2 | r1 | r0 ); return ptr + 4; } if ( len < 5 ) return NULL; // 完整的32位 value = ( ((ptr[ 4 ]) << 28) | r3 | r2 | r1 | r0 ); return ptr + 5; } /** 解压时 并不把实际值取得, 只获取下一个可解压位置, 一次忽略 1个 uint32 */ inline const uint8_t * varint_decode_uint32_skip( const uint8_t * buffer ) { if (UNLIKELY( !(buffer[ 0 ] & 0x80) )) return buffer + 1; if (UNLIKELY( !(buffer[ 1 ] & 0x80) )) return buffer + 2; if (UNLIKELY( !(buffer[ 2 ] & 0x80) )) return buffer + 3; if ( !(buffer[ 3 ] & 0x80) ) return buffer + 4; return buffer + 5; } /** * 将一个uint64整数 做 varint 编码 输出到 buf中 * * @param value 输出的值 * @param target 输出的缓冲 , 需确保buf 空间是够用的 * * @return target中下一个可用的字节位置 */ inline uint8_t * varint_encode_uint64 ( uint64_t value, uint8_t * target ) { // 拆分成高32位和低32位 target = varint_encode_uint32( value >> 32, target ); return varint_encode_uint32( value & 0xFFFFFFFF, target ); } /** * 从buf中 将 varint压缩编码的值 还原读取出来 * 需要确保输入的buf 从 输出的指针到结尾 超过 5个byte, 避免出现core * 函数内部不做边界检查 * * @param buffer 输入的buf * @param value 输出的值 * * @return target中下一个可读的字节位置 */ inline const uint8_t * varint_decode_uint64(const uint8_t * buffer, uint64_t & value) { uint32_t high = 0; uint32_t low = 0; buffer = varint_decode_uint32( buffer, high ); buffer = varint_decode_uint32( buffer, low ); value = ((uint64_t)high << 32) + low ; return buffer; } /** 解压时 并不把实际值取得, 只获取下一个可解压位置, 一次忽略 1个uint64 */ inline const uint8_t * varint_decode_uint64_skip( const uint8_t * buffer ) { buffer = varint_decode_uint32_skip( buffer ); return varint_decode_uint32_skip( buffer ); } /** * 对整数数组进行 group varint编码, 一次处理 4个整数 * * @param valueArr 无符号整数的数组 元素个数, 必须是4的倍数。 多余不处理 * @param target 用于输出的buf . 需要确够大 , 4个整数最多用 17个byte * * @return target下一个可写byte */ inline uint8_t * group_varint_encode_uint32( const uint32_t * valueArr, uint8_t * target) { register uint8_t len1; // 第 1 个数字用的 字节数 register uint8_t len2; // 第 2 个数字用的 字节数 register uint8_t len3; // 第 3 个数字用的 字节数 register uint8_t len4; // 第 4 个数字用的 字节数 register uint32_t val1 = valueArr[0]; register uint32_t val2 = valueArr[1]; register uint32_t val3 = valueArr[2]; register uint32_t val4 = valueArr[3]; register uint8_t * buf = target + 1; if ( val1 > UINT24_MAX ) { len1 = 4; ((uint32_t *)(buf))[0] = val1; } else if ( val1 > UINT16_MAX ) { len1 = 3; ((uint32_t *)(buf))[0] = val1; } else if ( val1 > UINT8_MAX ) { len1 = 2; ((uint16_t *)(buf))[0] = (uint16_t) val1; } else { len1 = 1; buf[0] = (uint8_t) val1; } register uint8_t len = len1; // 4个数字总共用的 字节数 /* 处理第二个数字 */ if (UNLIKELY( val2 > UINT24_MAX )) { len2 = 4; ((uint32_t *)(buf + len))[0] = val2; } else if ( val2 > UINT16_MAX ) { len2 = 3; ((uint32_t *)(buf + len))[0] = val2; } else if ( val2 > UINT8_MAX ) { len2 = 2; ((uint16_t *)(buf + len))[0] = (uint16_t) val2; } else { len2 = 1; buf[len] = (uint8_t) val2; } len += len2; /* 处理第3个数字 */ if (UNLIKELY( val3 > UINT24_MAX )) { len3 = 4; ((uint32_t *)(buf + len))[0] = val3; } else if ( val3 > UINT16_MAX ) { len3 = 3; ((uint32_t *)(buf + len))[0] = val3; } else if ( val3 > UINT8_MAX ) { len3 = 2; ((uint16_t *)(buf + len))[0] = (uint16_t) val3; } else { len3 = 1; buf[len] = (uint8_t) val3; } len += len3; /* 处理第4个数字 */ if (UNLIKELY( val4 > UINT24_MAX )) { len4 = 4; ((uint32_t *)(buf + len))[0] = val4; } else if ( val4 > UINT16_MAX ) { len4 = 3; ((uint32_t *)(buf + len))[0] = val4; } else if ( val4 > UINT8_MAX ) { len4 = 2; ((uint16_t *)(buf + len))[0] = (uint16_t) val4; } else { len4 = 1; buf[len] = (uint8_t) val4; } len += len4; /* 处理第一个索引字节 */ target[0] = ((len1 - 1) << 6) | ((len2 - 1) << 4) | ((len3 - 1) << 2) | (len4 - 1); return buf + len; } /** * 对输入的buf进行解压, 每次一定解压出4个整数 * * @param buf 输入的buf * @param valueArr 输出的数组, 需要预先开辟为4个整数的数组 * * @return target下一个可读byte */ inline const uint8_t * group_varint_decode_uint32 ( const uint8_t * buf, uint32_t * valueArr) { register uint8_t idx = buf[ 0 ]; const uint8_t * star1 = buf + 1; const uint8_t * star2 = buf + GROUP_VARINT_IDX_ARR[idx][0]; const uint8_t * star3 = buf + GROUP_VARINT_IDX_ARR[idx][1]; const uint8_t * star4 = buf + GROUP_VARINT_IDX_ARR[idx][2]; switch ( GROUP_VARINT_IDX_ARR[idx][3] ) { case 1 : valueArr[ 0 ] = *(uint8_t *) star1; break; case 2 : valueArr[ 0 ] = *(uint16_t *) star1; break; case 3 : valueArr[ 0 ] = (*(UINT24_T *)star1).value ; break; default: valueArr[ 0 ] = *(uint32_t *) star1; } switch ( GROUP_VARINT_IDX_ARR[idx][4] ) { case 1 : valueArr[ 1 ] = *(uint8_t *) star2; break; case 2 : valueArr[ 1 ] = *(uint16_t *) star2; break; case 3 : valueArr[ 1 ] = (*(UINT24_T *)star2).value; break; default: valueArr[ 1 ] = *(uint32_t *) star2; } switch ( GROUP_VARINT_IDX_ARR[idx][5] ) { case 1 : valueArr[ 2 ] = *(uint8_t *) star3; break; case 2 : valueArr[ 2 ] = *(uint16_t *) star3; break; case 3 : valueArr[ 2 ] = (*(UINT24_T *)star3).value; break; default: valueArr[ 2 ] = *(uint32_t *) star3; } switch ( GROUP_VARINT_IDX_ARR[idx][6] ) { case 1 : valueArr[ 3 ] = *(uint8_t *) star4; break; case 2 : valueArr[ 3 ] = *(uint16_t *) star4; break; case 3 : valueArr[ 3 ] = (*(UINT24_T *)star4).value; break; default: valueArr[ 3 ] = *(uint32_t *) star4; } return buf + GROUP_VARINT_IDX_ARR[ idx ][ 7 ]; } /** 解压时 并不把实际值取得, 只获取下一个可解压位置, 一次忽略 4个uint32 */ inline const uint8_t * group_varint_decode_uint32_skip ( const uint8_t * buf ) { return buf + GROUP_VARINT_IDX_ARR[ buf[ 0 ] ][ 7 ]; } /** * 对整数数组进行 group varint编码, 一次处理 2个 uint64整数 * * @param valueArr 无符号整数的数组 元素个数, 必须是2的倍数。 多余不处理 * @param target 用于输出的buf . 需要确够大 , 2个uint64整数最多用 17个byte * * @return target下一个可写byte */ inline uint8_t * group_varint_encode_uint64 ( const uint64_t * valueArr, uint8_t * target) { uint32_t arr[ 4 ] = { valueArr[0] >> 32, (valueArr[0] << 32) >> 32, valueArr[1] >> 32, (valueArr[1] << 32) >> 32 }; return group_varint_encode_uint32( arr, target); } inline uint8_t * group_varint_encode_uint32 ( uint32_t v1,uint32_t v2, uint32_t v3, uint32_t v4, uint8_t * target) { uint32_t valueArr[ 4 ] = {v1, v2 ,v3 ,v4}; return group_varint_encode_uint32( valueArr, target); } inline uint8_t * group_varint_encode_uint64 ( uint64_t v1, uint64_t v2, uint8_t * target) { uint32_t valueArr[ 4 ] = { v1 >> 32, (v1 << 32) >> 32, v2 >> 32, (v2 << 32) >> 32 }; return group_varint_encode_uint32( valueArr, target); } /** * 对输入的buf进行解压, 每次一定解压出2个uint64整数 * * @param buf 输入的buf * @param valueArr 输出的数组, 需要预先开辟为2个uint64整数的数组 * * @return buf 下一个可读byte */ inline const uint8_t * group_varint_decode_uint64 ( const uint8_t * buf, uint64_t * valueArr ) { uint32_t int_arr[ 4 ] = {0}; buf = group_varint_decode_uint32 ( buf, int_arr ); valueArr[ 0 ] = (((uint64_t)(int_arr[0])) << 32) + int_arr[1]; valueArr[ 1 ] = (((uint64_t)(int_arr[2])) << 32) + int_arr[3]; return buf; } /** 解压时 并不把实际值取得, 只获取下一个可解压位置 , 一次忽略2个 uint64 */ inline const uint8_t * group_varint_decode_uint64_skip( const uint8_t * buf ) { return group_varint_decode_uint32_skip ( buf ); } /** * 对整数进行 zigZag编码, 有符号数 转换为 无符号数 * * @param n 有符号数 * * @return 无符号数 */ inline uint32_t zigZag_encode32(int32_t n) { return (n << 1) ^ (n >> 31); } inline uint64_t zigZag_encode64(int64_t n) { return (n << 1) ^ (n >> 63); } /** * 对整数进行 zigZag 解码, 无符号数 转换为 有符号数 * * @param n 无符号数 * * @return 有符号数 */ inline int32_t zigZag_decode32(uint32_t n) { return (n >> 1) ^ -(int32_t)(n & 1); } inline int64_t zigZag_decode64(uint64_t n) { return (n >> 1) ^ -(int64_t)(n & 1); } #endif /* VARINT_H_ */
81fe1a596f85417690cb2e4bfc26ea1a2774ea4b
c2cedcf36667730f558ab354bea4505b616c90d2
/players/nooneelse/black/lib/translate_item.h
a7bfa71b01f6b9c373a4a1d766e5bce249a7e964
[]
no_license
wugouzi/Nirvlp312mudlib
965ed876c7080ab00e28c5d8cd5ea9fc9e46258f
616cad7472279cc97c9693f893940f5336916ff8
refs/heads/master
2023-03-16T03:45:05.510851
2017-09-21T17:05:00
2017-09-21T17:05:00
null
0
0
null
null
null
null
UTF-8
C
false
false
4,156
h
translate_item.h
/* translate_item.h */ #include "defs.h" int recurse_flag; /* -------- sell an item to vamp shop at a distance ---------- */ translate_item(str) { object obj, guild_shop_obj, guild_store_obj, next_obj; int item_value, item_weight; string these; if (!str) return 0; if (MY_LEVEL < 5 || MY_GUILD_EXP < 668) { write("You can't use that abilitiy yet.\n"); return 1; } if (MY_SPELL_POINTS < 20) { write("You don't have enough spell points.\n"); return 1; } if (str=="all") { write("To translate all, you must use 'translate everything'.\n"+ "It was changed to prevent accidents with the\n"+ "'translate all <item>' command.\n"); return 1; } /* sell all */ if (str=="everything") { obj = first_inventory(MY_PLAYER); while(obj) { next_obj = next_inventory(obj); if (!obj->drop() && obj->query_value()) do_sell(obj); obj = next_obj; } MY_PLAYER->add_spell_point(- 20); write("Ok.\n"); return 1; } /* sell all of a particular item */ if (sscanf(str, "all %s", these) == 1) { sell_all_these(these); MY_PLAYER->add_spell_point(- 20); write("Ok.\n"); return 1; } obj=present(str, MY_PLAYER); if (!obj) { write("But, you don't have a '"+str+"'.\n"); return 1; } item_value = obj->query_value(); if (!item_value) { write(capitalize(str)+" has no value.\n"); return 1; } if (environment(obj)==MY_PLAYER) { if (obj->drop()) { write("The bat squeaks: I can't take it from you!\n"); return 1; } item_weight = obj->query_weight(); this_player()->add_weight(- item_weight); } if (item_value > 1000) { write("The shop is low on money...\n"); item_value = 950 + random(150); } MY_FANGS->tell_my_room( MY_NAME_CAP+ " summons a strong-looking, gold colored bat which takes\n"+ obj->short()+" and flys off to someplace unknown.\n\n"+ "After a few moments, it returns, gives "+ MY_PLAYER->query_objective()+" some gold, and flys away."); write("A gold-colored bat takes the "+str+ ", flys away with it and returns after a\n"+ "few moments to give you "+item_value+" gold coins.\n"); MY_PLAYER->add_money(item_value); if (item_value > SHOP_DESTROY_VALUE) destruct(obj); call_other(GUILD_SHOP_STOREROOM, "???"); guild_store_obj = find_object(GUILD_SHOP_STOREROOM); guild_store_obj->store(obj); if (!recurse_flag) MY_PLAYER->add_spell_point(- 20); return 1; } /* handle the selling of the item */ do_sell(obj) { object guild_store_obj; int item_value, do_destroy, item_weight; item_value = obj->query_value(); if (!item_value) { write("The gold bat squeaks: "+obj->short()+" has no value.\n"); return 1; } if (environment(obj)==MY_PLAYER) { if (obj->drop()) { write("The gold bat squeaks: I can't take it from you!\n"); return 1; } item_weight = obj->query_weight(); MY_PLAYER->add_weight(- item_weight); } if (item_value > SHOP_DESTROY_VALUE) do_destroy = 1; if (item_value > 1000) item_value = 950 + random(150); MY_FANGS->tell_my_room( MY_NAME_CAP+ " summons a strong-looking, gold-colored bat which takes\n"+ obj->short()+" and flys off to the Guild's shop.\n\n"+ "After a few moments, it returns, gives "+ MY_PLAYER->query_objective()+" some gold, and flys away."); write("A gold-colored bat takes the "+obj->short()+ ", flys away with it and returns after a\n"+ "few moments to give you "+item_value+" gold coins.\n"); MY_PLAYER->add_money(item_value); if (do_destroy) { destruct(obj); return 1; } call_other(GUILD_SHOP_STOREROOM, "???"); guild_store_obj = find_object(GUILD_SHOP_STOREROOM); guild_store_obj->store(obj); return 1; } sell_all_these(these) { object list; int i; list = all_inventory(MY_PLAYER); for (i = 0; i < sizeof(list); i++) { if (list[i]->id(these)==0) continue; recurse_flag = 1; command("translate " + these, MY_PLAYER); recurse_flag = 0; } }
1dc36e718bd8fb26ecd013fb89b9310031789dda
89ce354ba63c4d8e02415a06cef5d642baff3ccb
/maven/myjniapp/QtJpeg/qtjpeg_global.h
0cc5bb4c1e2ba1eab7c1926666e6a6093f220585
[]
no_license
hempnall/codeexamples
d71b152c4cf2329b6909f10adf1df9b8986589e4
3374ffc7ecff7f8da3fede4e6e0884e6d73219e6
refs/heads/master
2021-01-10T10:39:38.710619
2017-02-03T20:00:59
2017-02-03T20:00:59
44,268,256
0
0
null
null
null
null
UTF-8
C
false
false
234
h
qtjpeg_global.h
#ifndef QTJPEG_GLOBAL_H #define QTJPEG_GLOBAL_H #include <QtCore/qglobal.h> #if defined(QTJPEG_LIBRARY) # define QTJPEGSHARED_EXPORT Q_DECL_EXPORT #else # define QTJPEGSHARED_EXPORT Q_DECL_IMPORT #endif #endif // QTJPEG_GLOBAL_H
b93971516f4d5d53c7db4c73b54ebfb4c5b643aa
ce628b0394e496c375cad3db3f752f4579d252c0
/mpc_set_mp_int.c
8f3a7290e1d5d4eb0ac72381b376db85f5613c09
[ "MIT", "LicenseRef-scancode-public-domain" ]
permissive
czurnieden/libczcomplex
6caaa176eea30833fffc758e9ca07c1115966094
74e970ee045c8e5bd7f112ae590827064556bfa2
refs/heads/master
2021-01-10T22:05:15.515440
2015-03-29T04:32:31
2015-03-29T04:32:31
32,954,425
0
0
null
null
null
null
UTF-8
C
false
false
298
c
mpc_set_mp_int.c
#include <czcomplex.h> int mpc_set_mp_int(mp_int * a, mp_int * b, mp_complex * c) { int err; err = MP_OKAY; if ((err = mpc_set_real_mp_int(a, c)) != MP_OKAY) { return err; } if ((err = mpc_set_imag_mp_int(b, c)) != MP_OKAY) { return err; } return err; }
bedf77a8b7812ab9a222d07d7933a6634ff8d102
3681734e67f295bc5054cf28d861eccb79a1e5a0
/TP2/LSB_Errores.h
66c7df8765fc35c4bd0b163c6eb0a3cdaa662ad7
[ "MIT" ]
permissive
LucasRob/7542-fiuba
65dde5b3f66e0084f0bd96b88d895e1be521d039
0203cd0ac4f8913a75f3760ba178ee9439b8aea4
refs/heads/master
2020-03-31T06:20:33.698303
2018-10-07T19:40:31
2018-10-07T19:40:31
151,978,051
0
0
null
null
null
null
UTF-8
C
false
false
968
h
LSB_Errores.h
/* *LSB_ERRORES * * Created on: 1-4-2012 * Author: Robles Lucas Jose * Padrón: 87944 */ #ifndef __LSB_ERRORES_H__ #define __LSB_ERRORES_H__ // ERRORES: // // LSB_IGUAL: Devuelve este valor si la comparación // de los dos elementos dió igual // // LSB_INSERTADO: Si pudo insertar el elemento // LSB_BORRADO: Si pudo borrar el elemento // LSB_MOVIDO: Si pudo mover el elemento // LSB_ENCONTRADO: Si pudo encontrar el elemento // ERR_LSB_NO_EXISTE: Si no existe el elemento a buscar // ERR_LSB_NO_MEMORIA: Si no pudo reservar memoria para alocar // LSB_MAYOR: Devuelve este valor si la comparación // de los dos elementos dió mayor // // LSB_MENOR: Devuelve este valor si la comparación // de los dos elementos dió menor #define LSB_IGUAL 0 #define LSB_INSERTADO 0 #define LSB_BORRADO 0 #define LSB_MOVIDO 0 #define LSB_ENCONTRADO 0 #define ERR_LSB_NO_EXISTE 1 #define ERR_LSB_NO_MEMORIA 1 #define LSB_MAYOR 1 #define LSB_MENOR -1 #endif
e4ad069f285b57811497fdc1c3a2cfb444e8381f
d969c92304c88672a38c45d86317b849125c23a8
/PiscineReloaded/ex21/ft_range.c
9786f618131daa97fd08b0595682097846cf3d34
[]
no_license
Baavril2/Piscine42
eb4b62030787e2d2db85c3adfba94e20af38fdc1
850423379261fcd079627c3f81842e09882db593
refs/heads/master
2020-03-29T06:46:14.530526
2018-11-04T23:08:19
2018-11-04T23:08:19
149,639,714
0
0
null
null
null
null
UTF-8
C
false
false
344
c
ft_range.c
#include <stdio.h> #include <stdlib.h> int *ft_range(int min, int max) { int i; int *tab; i = 0; if(min >= max) return(0); if(!(tab = malloc(sizeof(int) * (max - min)))) return(0); while (min < max) { tab[i] = min; printf("%d", tab[i]); min++; i++; } printf("%ls", tab); return (tab); } int main() { ft_range(5, 9); }
3a298f7249335cf5281ae280441c3ccc0f89255d
3aa377e04360e25512121bfbd65e79903d26fa2d
/SDK_framework/linux/ebdrip/core/trapping/src/notrap.c
db4ad1629a5d0fe052b062d15421ca766a1b4c7b
[]
no_license
jo244305wipro/RipSDK4.05
a89057d1fac8342acadc0ed611569421ce3cdb12
3291e528abebae9c59aad0c3387bc81cfc1b95e9
refs/heads/master
2021-01-19T22:32:53.359118
2014-10-22T03:05:14
2014-10-22T03:05:14
25,907,736
1
0
null
null
null
null
UTF-8
C
false
false
2,075
c
notrap.c
/** \file * \ingroup trapping * * $HopeName: COREtrapping!src:notrap.c(EBDSDK_P.1) $ * * Copyright (C) 2005-2012 Global Graphics Software Ltd. All rights reserved. * Global Graphics Software Ltd. Confidential Information. * * \brief * Stubs for trapping functions when compiled out. */ #include "core.h" #include "swerrors.h" #include "displayt.h" #include "trap.h" #include "taskh.h" void trapping_C_globals(struct core_init_fns *fns) { UNUSED_PARAM(struct core_init_fns *, fns) ; /* Nothing to do */ } void trapSetTrappingEffort(int32 effort) { UNUSED_PARAM(int32, effort) ; } Bool isTrappingActive(DL_STATE *page) { UNUSED_PARAM(DL_STATE *, page); return FALSE ; } void trapShapeBoundingBox(trap_RLE_shape_t *shape, dbbox_t *bbox) { UNUSED_PARAM(trap_RLE_shape_t *, shape) ; UNUSED_PARAM(dbbox_t *, bbox) ; } Bool trapZoneReset(DL_STATE *page, Bool page_zones_only) { UNUSED_PARAM(DL_STATE *,page); UNUSED_PARAM(Bool, page_zones_only) ; return TRUE ; } Bool trapPrepare(ps_context_t *pscontext, DL_STATE *dl_state, trap_context_t **ptc, task_t *trap_complete_task) { UNUSED_PARAM(ps_context_t *, pscontext) ; UNUSED_PARAM(DL_STATE *, dl_state) ; UNUSED_PARAM(task_t *, trap_complete_task) ; *ptc = NULL ; return TRUE ; } Bool trapGenerate(trap_context_t *tc) { UNUSED_PARAM(trap_context_t *, tc) ; return TRUE ; } Bool trapRequirements(DL_STATE *page) { UNUSED_PARAM(DL_STATE *, page) ; return FALSE ; } void trapDispose(trap_context_t **tc) { UNUSED_PARAM(trap_context_t **, tc) ; } Bool trapBackdropColorValues( render_info_t *ri , LISTOBJECT *lobj, const dbbox_t *bounds ) { UNUSED_PARAM(render_info_t *, ri); UNUSED_PARAM(LISTOBJECT *, lobj); UNUSED_PARAM(const dbbox_t *, bounds); return TRUE; } void surface_set_trap_builtin(surface_set_t *set, const surface_t *index[]) { UNUSED_PARAM(surface_set_t *, set); UNUSED_PARAM(const surface_t **, index); return; } /* Log stripped */
6a092cef4eb4063199da53dc846a0c5d3d093ada
641fdcdf259bffb4a6865c8b3f4478d72179e081
/days/day5/macro2.c
999c6348a7999d1ac3379af80ba9b47be7fdf85c
[]
no_license
Beeraswamy/Kernel
91734b768403885e38607262ff434306b388de80
7fbff77ab79ab10c0c8ebd3d3a3a069c8393bd65
refs/heads/master
2020-09-06T13:00:56.651809
2019-11-11T18:57:12
2019-11-11T18:57:12
220,430,184
0
0
null
null
null
null
UTF-8
C
false
false
66
c
macro2.c
main() { int i; #if !defined MAC i=1; #endif printf("%d",i); }
0a9a8305ef13067a7f86d19b838fb3d5a4be41bc
62c8d47803da82bc6b7a276e0c54796601c66276
/packages/go/HFS_XFer_DA/mytype.h
c30e71cbde875d035c18edd8be3e2213c357affa
[ "MIT", "GPL-2.0-or-later", "GPL-1.0-or-later", "LicenseRef-scancode-unknown-license-reference" ]
permissive
autc04/executor
a01d1c5081251a331067596141422568159a7596
ada40683c14d9dfb2a660e52378e9864e0d51357
refs/heads/master
2023-07-21T14:33:48.612380
2023-05-07T21:33:31
2023-05-07T21:33:31
106,850,181
125
9
MIT
2023-07-07T14:12:07
2017-10-13T16:48:51
C++
UTF-8
C
false
false
190
h
mytype.h
typedef char BOOLEAN; typedef short INTEGER; typedef long LONGINT; #define LONGORPTR Ptr typedef unsigned short ushort; typedef unsigned long ulong; #define PRIVATE static #define PUBLIC
b8e736dd7bd68113baa5fdf2885f0c16b922a2ae
008060072ef30e7ee7920e92e32cce337d85030d
/feeds/ipq807x/qca-nss-drv/src/exports/nss_igs.h
651fea4e9ee4e7097631bdd2e1977ec9b747ed61
[ "BSD-3-Clause" ]
permissive
Kenneth-Lu/wlan-ap
2859803835876137427da3fc94d828c9f99a7cce
4468e90d2c0edf4d4b68b33e7b22259f8501ba40
refs/heads/plume/dev
2023-07-14T20:23:04.325249
2021-02-26T14:14:27
2021-03-01T15:44:14
357,393,186
1
1
BSD-3-Clause
2021-06-09T04:51:30
2021-04-13T01:54:40
null
UTF-8
C
false
false
6,447
h
nss_igs.h
/* ************************************************************************** * Copyright (c) 2019, The Linux Foundation. All rights reserved. * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all copies. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************** */ /** * @file nss_igs.h * NSS ingress shaper interface definitions. */ #ifndef _NSS_IGS_H_ #define _NSS_IGS_H_ #ifndef DOXYGEN_SHOULD_SKIP_THIS #ifdef CONFIG_NET_CLS_ACT #include <net/act_api.h> #endif #endif /** * @addtogroup nss_ingress_shaper_subsystem * @{ */ /** * Maximum number of supported ingress shaping interfaces. */ #define NSS_MAX_IGS_DYNAMIC_INTERFACES 8 /** * nss_igs_msg_types * Message types for ingress shaper requests and responses. */ enum nss_igs_msg_types { NSS_IGS_MSG_SYNC_STATS = NSS_IF_MAX_MSG_TYPES + 1, NSS_IGS_MSG_MAX }; /** * nss_igs_node_stats * Ingress shaping node debug statistics structure. */ struct nss_igs_node_stats { uint32_t tx_dropped; /**< Dropped post shaping. */ uint32_t shaper_drop; /**< Dropped during shaper enqueue. */ uint32_t ipv4_parse_fail; /**< IPv4 parse fail. */ uint32_t ipv4_unknown_gre_type; /**< IPv4 unknown GRE type. */ uint32_t ipv4_unknown_l4; /**< IPv4 unknown L4 type. */ uint32_t ipv4_no_cme; /**< IPv4 connection match entry not found. */ uint32_t ipv4_frag_initial; /**< IPv4 initial fragment. */ uint32_t ipv4_frag_non_initial; /**< Ipv4 subsequent fragment. */ uint32_t ipv4_malformed_udp; /**< Incomplete IPv4 UDP packet. */ uint32_t ipv4_malformed_tcp; /**< Incomplete IPv4 TCP packet. */ uint32_t ipv4_malformed_udpl; /**< Incomplete IPv4 UDP-Lite packet. */ uint32_t ipv4_malformed_gre; /**< Incomplete IPv4 GRE packet. */ uint32_t ipv6_parse_fail; /**< IPv6 parse fail. */ uint32_t ipv6_unknown_l4; /**< IPv6 unknown L4 type. */ uint32_t ipv6_no_cme; /**< IPv6 connection match entry not found. */ uint32_t ipv6_frag_initial; /**< IPv6 initial fragment. */ uint32_t ipv6_frag_non_initial; /**< Ipv6 subsequent fragment. */ uint32_t ipv6_malformed_udp; /**< Incomplete IPv6 UDP packet. */ uint32_t ipv6_malformed_tcp; /**< Incomplete IPv6 TCP packet. */ uint32_t ipv6_malformed_udpl; /**< Incomplete IPv6 UDP-Lite packet. */ uint32_t ipv6_malformed_frag; /**< Incomplete IPv6 fragment. */ uint32_t event_no_si; /**< No shaper configured. */ uint32_t eth_parse_fail; /**< Ethernet header parse failed. */ uint32_t eth_unknown_type; /**< Non-IP/PPPoE ether type. */ uint32_t pppoe_non_ip; /**< Non-IP PPPoE packet. */ uint32_t pppoe_malformed; /**< Incomplete PPPoE packet. */ }; /** * nss_igs_stats_sync_msg * Message information for ingress shaping synchronization statistics. */ struct nss_igs_stats_sync_msg { struct nss_cmn_node_stats node_stats; /**< Common node statistics. */ struct nss_igs_node_stats igs_stats; /**< Debug statistics for ingress shaping. */ }; /** * nss_igs_msg * Data for sending and receiving ingress shaper messages. */ struct nss_igs_msg { struct nss_cmn_msg cm; /**< Common message header. */ /** * Payload of a ingress shaper message. */ union { union nss_if_msgs if_msg; /**< NSS interface base message. */ struct nss_igs_stats_sync_msg stats; /**< Statistics message to host. */ } msg; /**< Message payload. */ }; /** * Callback function for receiving ingress shaper messages. * * @datatypes * nss_cmn_msg * * @param[in] app_data Pointer to the application context of the message. * @param[in] msg Pointer to the message data. */ typedef void (*nss_igs_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); /** * nss_igs_get_context * Gets the ingress shaper context. * * @return * Pointer to the NSS core context. */ extern struct nss_ctx_instance *nss_igs_get_context(void); /** * nss_igs_register_if * Registers a ingress shaper interface with the NSS for sending and receiving messages. * * @datatypes * nss_igs_msg_callback_t \n * net_device * * @param[in] if_num NSS interface number. * @param[in] type NSS interface type. * @param[in] msg_callback Callback for the ingress shaper message. * @param[in] netdev Pointer to the associated network device. * @param[in] features Data socket buffer types supported by this interface. * * @return * Pointer to the NSS core context. */ extern struct nss_ctx_instance *nss_igs_register_if(uint32_t if_num, uint32_t type, nss_igs_msg_callback_t msg_callback, struct net_device *netdev, uint32_t features); /** * nss_igs_unregister_if * Deregisters a ingress shaper interface from the NSS. * * @param[in] if_num NSS interface number. * * @return * None. */ extern void nss_igs_unregister_if(uint32_t if_num); /** * nss_igs_verify_if_num * Verify whether interface is an ingress shaper interface or not. * * @param[in] if_num NSS interface number. * * @return * True if interface is an ingress shaper interface. */ extern bool nss_igs_verify_if_num(uint32_t if_num); #ifdef CONFIG_NET_CLS_ACT /* * nss_igs_module_save() * Save the ingress shaping module reference. * * @datatypes * tc_action_ops \n * module * * @param[in] act Operation structure for ingress shaping action. * @param[in] module Module structure of ingress shaping module. * * @return * None. */ extern void nss_igs_module_save(struct tc_action_ops *act, struct module *module); #endif /* * nss_igs_module_get() * Get the ingress shaping module reference. * * @return * False if not able to take the ingress shaping module reference, otherwise true. * */ extern bool nss_igs_module_get(void); /* * nss_igs_module_put() * Release the ingress shaping module reference. * * @return * None. */ extern void nss_igs_module_put(void); /** * @} */ #endif
e8a064ef174939494c208f7df05deb7405d1fb65
2bf91c966f6bff66137ca1456dc1ea886d72b976
/taint_bunny/src/taint_engines/taint_analysis/tb_simd_taint_analysis/tb_ta_simd_byt/tb_ta_simd_byt_src_srcdst.c
6e650d78d506639a87743392c1bdb7b051b5f881
[]
no_license
asdyxcyxc/Dynamic-Rabbits
4a85f467af200739a48e13a73f5211ba4ee92db3
5b0c487545c4779cb9d72fc7dcd04562e34e2535
refs/heads/master
2022-12-24T16:44:18.303337
2020-09-27T21:51:38
2020-09-27T21:51:38
null
0
0
null
null
null
null
UTF-8
C
false
false
36,484
c
tb_ta_simd_byt_src_srcdst.c
/* * tb_ta_simd_byt_src_srcdst.c * * Author: john */ #include "tb_ta_simd_byt_src_srcdst.h" #include "../tb_ta_simd_byt_functionality.h" #include "../../taint_maps/memory_maps/tb_raw_mem_maps/tb_raw_umbra_mem_maps/tb_raw_umbra_mem_map.h" #include "../../taint_maps/register_map/tb_raw_reg_maps/tb_raw_array_reg_maps/tb_raw_array_reg_map.h" #include <stdint.h> #include "utility_bunny.h" #include "../../tb_raw_taint_analysis/tb_ta_raw_byt/tb_ta_raw_byt_src_srcdst.h" #include "../../tb_raw_taint_analysis/tb_ta_raw_byt_functionality.h" /************************************************************************************** * HELPERS */ static void tb_simd_handle_whole_src_srcdst_dreg_propagate( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t dsize, size_t ssize, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, bool is_src_faulty, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_raw_clear_pre_post_propagate_flags(instr_hndlr_info, drcontext, ilist, where); tb_simd_meet_from_1_src(instr_hndlr_info->tb_ctx, 0, ssize, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), is_src_faulty, spill_info->scaler_regs[3], src_reg_id, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2]); reg_id_t meet_reg2 = src_reg_id; tb_simd_meet_from_1_src(instr_hndlr_info->tb_ctx, 0, dsize, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), false, meet_reg2, srcdst_reg_id, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2]); // Broadcast it to xmm register tb_simd_broadcast_meet(drcontext, ilist, where, spill_info->xmm_regs[0], spill_info->scaler_regs[3]); // Broadcast it to xmm register tb_simd_broadcast_meet(drcontext, ilist, where, spill_info->xmm_regs[1], meet_reg2); tb_simd_apply_to_1_reg_from_2_src(instr_hndlr_info, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), srcdst_reg_id, 0, dsize, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->xmm_regs[2], spill_info->xmm_regs[3], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); // We check whether we perform the post propagation call. tb_simd_check_post_propagate(instr_hndlr_info, drcontext, ilist, where, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); } /************************************************************************************** * SRC SRCDST - DREG SREG SREG (WHOLE) */ static void tb_simd_handle_whole_src_srcdst_dreg_sreg_sreg( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t dsize, size_t ssize, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { DR_ASSERT(spill_info->scaler_cnt > 3); DR_ASSERT(spill_info->xmm_cnt > 3); // Load reg map tb_raw_arraymap_insert_load_reg_map(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2]); // Translation: tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], src_reg_id); tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], srcdst_reg_id); tb_simd_handle_whole_src_srcdst_dreg_propagate(instr_hndlr_info, dsize, ssize, drcontext, ilist, where, app_instr, false, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_1_sreg_1_sreg_1( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DONT USE SIMD **/ tb_raw_byt_handle_src_srcdst_whole_dreg_1_sreg_1_sreg_1(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_2_sreg_2_sreg_2( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DONT USE SIMD **/ tb_raw_byt_handle_src_srcdst_whole_dreg_2_sreg_2_sreg_2(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_4_sreg_4_sreg_4( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_src_srcdst_dreg_sreg_sreg(instr_hndlr_info, 4, 4, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_8_sreg_8_sreg_8( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_src_srcdst_dreg_sreg_sreg(instr_hndlr_info, 8, 8, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_16_sreg_16_sreg_16( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_src_srcdst_dreg_sreg_sreg(instr_hndlr_info, 16, 16, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } static void tb_simd_handle_whole_src_srcdst_dreg_sreg_sreg_1( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t dsize, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { DR_ASSERT(spill_info->scaler_cnt > 3); DR_ASSERT(spill_info->xmm_cnt > 3); // Load reg map tb_raw_arraymap_insert_load_reg_map(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2]); // Translation: tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], src_reg_id); tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], srcdst_reg_id); tb_raw_clear_pre_post_propagate_flags(instr_hndlr_info, drcontext, ilist, where); tb_raw_meet_from_1_src(instr_hndlr_info->tb_ctx, 0, 1, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), spill_info->scaler_regs[3], src_reg_id, spill_info->scaler_regs[2]); reg_id_t meet_reg2 = src_reg_id; tb_simd_meet_from_1_src(instr_hndlr_info->tb_ctx, 0, dsize, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), false, meet_reg2, srcdst_reg_id, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2]); // Broadcast it to xmm register tb_simd_broadcast_meet(drcontext, ilist, where, spill_info->xmm_regs[0], spill_info->scaler_regs[3]); // Broadcast it to xmm register tb_simd_broadcast_meet(drcontext, ilist, where, spill_info->xmm_regs[1], meet_reg2); tb_simd_apply_to_1_reg_from_2_src(instr_hndlr_info, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), srcdst_reg_id, 0, dsize, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->xmm_regs[2], spill_info->xmm_regs[3], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); // We check whether we perform the post propagation call. tb_simd_check_post_propagate(instr_hndlr_info, drcontext, ilist, where, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); } void tb_simd_byt_handle_src_srcdst_whole_dreg_2_sreg_2_sreg_1( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_raw_byt_handle_src_srcdst_whole_dreg_2_sreg_2_sreg_1(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_4_sreg_4_sreg_1( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_src_srcdst_dreg_sreg_sreg_1(instr_hndlr_info, 4, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_8_sreg_8_sreg_1( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_src_srcdst_dreg_sreg_sreg_1(instr_hndlr_info, 8, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } /************************************************************************************** * SRC SRCDST - DREG SMEM DREG (WHOLE) */ static void tb_simd_handle_whole_dreg_smem_sreg( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t dsize, size_t ssize, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id, tb_spill_info_t *spill_info) { DR_ASSERT(spill_info->scaler_cnt > 3); DR_ASSERT(spill_info->xmm_cnt > 3); // Load reg map tb_raw_arraymap_insert_load_reg_map(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2]); // Translation: tb_umbra_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, src_mem_id, spill_info->scaler_regs[3]); tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], srcdst_reg_id); tb_simd_handle_whole_src_srcdst_dreg_propagate(instr_hndlr_info, dsize, ssize, drcontext, ilist, where, app_instr, true, srcdst_reg_id, src_mem_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_1_smem_1_sreg_1( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_raw_byt_handle_src_srcdst_whole_dreg_1_smem_1_sreg_1(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_reg_id, src_mem_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_2_smem_2_sreg_2( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_raw_byt_handle_src_srcdst_whole_dreg_2_smem_2_sreg_2(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_reg_id, src_mem_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_4_smem_4_sreg_4( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_dreg_smem_sreg(instr_hndlr_info, 4, 4, drcontext, ilist, where, app_instr, srcdst_reg_id, src_mem_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_8_smem_8_sreg_8( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_dreg_smem_sreg(instr_hndlr_info, 8, 8, drcontext, ilist, where, app_instr, srcdst_reg_id, src_mem_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dreg_16_smem_16_sreg_16( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_dreg_smem_sreg(instr_hndlr_info, 16, 16, drcontext, ilist, where, app_instr, srcdst_reg_id, src_mem_id, spill_info); } /************************************************************************************** * SRC SRCDST - DMEM SREG DMEM (WHOLE) */ static void tb_simd_handle_whole_dmem_propagate( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t dsize, size_t ssize, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_raw_clear_pre_post_propagate_flags(instr_hndlr_info, drcontext, ilist, where); tb_simd_meet_from_1_src(instr_hndlr_info->tb_ctx, 0, ssize, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), false, spill_info->scaler_regs[3], src_reg_id, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2]); reg_id_t meet_reg2 = src_reg_id; tb_simd_meet_from_1_src(instr_hndlr_info->tb_ctx, 0, dsize, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), true, meet_reg2, srcdst_mem_id, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2]); // Broadcast it to xmm register tb_simd_broadcast_meet(drcontext, ilist, where, spill_info->xmm_regs[0], spill_info->scaler_regs[3]); // Broadcast it to xmm register tb_simd_broadcast_meet(drcontext, ilist, where, spill_info->xmm_regs[1], meet_reg2); tb_simd_apply_to_1_mem_from_2_src(instr_hndlr_info, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), true, srcdst_mem_id, 0, dsize, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->xmm_regs[2], spill_info->xmm_regs[3], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); // We check whether we perform the post propagation call. tb_simd_check_post_propagate(instr_hndlr_info, drcontext, ilist, where, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); } static void tb_simd_handle_whole_dmem_sreg_smem( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t dsize, size_t ssize, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { DR_ASSERT(spill_info->scaler_cnt > 3); DR_ASSERT(spill_info->xmm_cnt > 3); // Load reg map tb_raw_arraymap_insert_load_reg_map(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2]); // Translation: tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], src_reg_id); tb_umbra_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, srcdst_mem_id, spill_info->scaler_regs[3]); tb_simd_handle_whole_dmem_propagate(instr_hndlr_info, dsize, ssize, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dmem_1_sreg_1_smem_1( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DONT USE SIMD **/ tb_raw_byt_handle_src_srcdst_whole_dmem_1_sreg_1_smem_1(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dmem_2_sreg_2_smem_2( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DONT USE SIMD **/ tb_raw_byt_handle_src_srcdst_whole_dmem_2_sreg_2_smem_2(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dmem_4_sreg_4_smem_4( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_dmem_sreg_smem(instr_hndlr_info, 4, 4, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dmem_8_sreg_8_smem_8( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_dmem_sreg_smem(instr_hndlr_info, 8, 8, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dmem_16_sreg_16_smem_16( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_whole_dmem_sreg_smem(instr_hndlr_info, 16, 16, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } static void tb_simd_handle_whole_dmem_sreg_1_smem( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t dsize, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { DR_ASSERT(spill_info->scaler_cnt > 3); DR_ASSERT(spill_info->xmm_cnt > 3); // Load reg map tb_raw_arraymap_insert_load_reg_map(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2]); // Translation: tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], src_reg_id); tb_umbra_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, srcdst_mem_id, spill_info->scaler_regs[3]); tb_raw_clear_pre_post_propagate_flags(instr_hndlr_info, drcontext, ilist, where); tb_raw_meet_from_1_src(instr_hndlr_info->tb_ctx, 0, 1, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), spill_info->scaler_regs[3], src_reg_id, spill_info->scaler_regs[2]); reg_id_t meet_reg2 = src_reg_id; tb_simd_meet_from_1_src(instr_hndlr_info->tb_ctx, 0, dsize, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), true, meet_reg2, srcdst_mem_id, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2]); // Broadcast it to xmm register tb_simd_broadcast_meet(drcontext, ilist, where, spill_info->xmm_regs[0], spill_info->scaler_regs[3]); // Broadcast it to xmm register tb_simd_broadcast_meet(drcontext, ilist, where, spill_info->xmm_regs[1], meet_reg2); tb_simd_apply_to_1_mem_from_2_src(instr_hndlr_info, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), true, srcdst_mem_id, 0, dsize, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->xmm_regs[2], spill_info->xmm_regs[3], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); // We check whether we perform the post propagation call. tb_simd_check_post_propagate(instr_hndlr_info, drcontext, ilist, where, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); } void tb_simd_byt_handle_src_srcdst_whole_dmem_2_sreg_1_smem_2( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_raw_byt_handle_src_srcdst_whole_dmem_2_sreg_1_smem_2(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dmem_4_sreg_1_smem_4( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_simd_handle_whole_dmem_sreg_1_smem(instr_hndlr_info, 4, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_whole_dmem_8_sreg_1_smem_8( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_simd_handle_whole_dmem_sreg_1_smem(instr_hndlr_info, 8, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } /************************************************************************************** * SRC SRCDST - DREG SREG SREG */ static void tb_simd_handle_src_srcdst_dreg_propagate( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t size, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, bool is_src_faulty, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_raw_clear_pre_post_propagate_flags(instr_hndlr_info, drcontext, ilist, where); for (size_t i = 0; i < size; i += sizeof(void *)) { // Set partial size int partial_size = tb_simd_calculate_partial_size(size, i) * sizeof(void *); opnd_t src1_tl_opnd = opnd_create_base_disp(src_reg_id, DR_REG_NULL, 1, sizeof(void *) * i, opnd_size_from_bytes(partial_size)); opnd_t srcdst_tl_opnd = opnd_create_base_disp(srcdst_reg_id, DR_REG_NULL, 1, sizeof(void *) * i, opnd_size_from_bytes(partial_size)); // Get new label. tb_simd_insert_get_new_label_from_2_src(instr_hndlr_info->tb_ctx, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), is_src_faulty, spill_info->xmm_regs[0], &src1_tl_opnd, &srcdst_tl_opnd, spill_info->xmm_regs[1], spill_info->scaler_regs[2]); tb_simd_insert_prop_reg(instr_hndlr_info, drcontext, ilist, where, &srcdst_tl_opnd, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); } // We check whether we perform the post propagation call. tb_simd_check_post_propagate(instr_hndlr_info, drcontext, ilist, where, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); } static void tb_simd_handle_src_srcdst_dreg_sreg_sreg( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t size, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { DR_ASSERT(spill_info->scaler_cnt > 3); DR_ASSERT(spill_info->xmm_cnt > 1); // Load reg map tb_raw_arraymap_insert_load_reg_map(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2]); // Translation: tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], src_reg_id); tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], srcdst_reg_id); tb_simd_handle_src_srcdst_dreg_propagate(instr_hndlr_info, size, drcontext, ilist, where, app_instr, false, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_dreg_1_sreg_1_sreg_1( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_raw_byt_handle_src_srcdst_dreg_1_sreg_1_sreg_1(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_dreg_2_sreg_2_sreg_2( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_raw_byt_handle_src_srcdst_dreg_2_sreg_2_sreg_2(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_dreg_4_sreg_4_sreg_4( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_src_srcdst_dreg_sreg_sreg(instr_hndlr_info, 4, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_dreg_8_sreg_8_sreg_8( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_src_srcdst_dreg_sreg_sreg(instr_hndlr_info, 8, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_dreg_16_sreg_16_sreg_16( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_src_srcdst_dreg_sreg_sreg(instr_hndlr_info, 16, drcontext, ilist, where, app_instr, srcdst_reg_id, src_reg_id, spill_info); } /************************************************************************************** * SRC SRCDST - DREG SMEM DREG */ static void tb_simd_handle_dreg_smem_sreg( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t size, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id1, tb_spill_info_t *spill_info) { DR_ASSERT(spill_info->scaler_cnt > 3); DR_ASSERT(spill_info->xmm_cnt > 1); // Load reg map tb_raw_arraymap_insert_load_reg_map(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2]); // Translation: tb_umbra_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, src_mem_id1, spill_info->scaler_regs[3]); tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], srcdst_reg_id); tb_simd_handle_src_srcdst_dreg_propagate(instr_hndlr_info, size, drcontext, ilist, where, app_instr, true, srcdst_reg_id, src_mem_id1, spill_info); } void tb_simd_byt_handle_src_srcdst_dreg_1_smem_1_sreg_1( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id1, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_raw_byt_handle_src_srcdst_dreg_1_smem_1_sreg_1(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_reg_id, src_mem_id1, spill_info); } void tb_simd_byt_handle_src_srcdst_dreg_2_smem_2_sreg_2( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id1, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_raw_byt_handle_src_srcdst_dreg_2_smem_2_sreg_2(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_reg_id, src_mem_id1, spill_info); } void tb_simd_byt_handle_src_srcdst_dreg_4_smem_4_sreg_4( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id1, tb_spill_info_t *spill_info) { tb_simd_handle_dreg_smem_sreg(instr_hndlr_info, 4, drcontext, ilist, where, app_instr, srcdst_reg_id, src_mem_id1, spill_info); } void tb_simd_byt_handle_src_srcdst_dreg_8_smem_8_sreg_8( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id1, tb_spill_info_t *spill_info) { tb_simd_handle_dreg_smem_sreg(instr_hndlr_info, 8, drcontext, ilist, where, app_instr, srcdst_reg_id, src_mem_id1, spill_info); } void tb_simd_byt_handle_src_srcdst_dreg_16_smem_16_sreg_16( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_reg_id, reg_id_t src_mem_id1, tb_spill_info_t *spill_info) { tb_simd_handle_dreg_smem_sreg(instr_hndlr_info, 16, drcontext, ilist, where, app_instr, srcdst_reg_id, src_mem_id1, spill_info); } /************************************************************************************** * SRC SRCDST - DMEM SREG DMEM */ static void tb_simd_handle_dmem_propagate( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t size, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_raw_clear_pre_post_propagate_flags(instr_hndlr_info, drcontext, ilist, where); for (size_t i = 0; i < size; i += sizeof(void *)) { // Set partial size int partial_size = tb_simd_calculate_partial_size(size, i) * sizeof(void *); opnd_t src1_tl_opnd = opnd_create_base_disp(src_reg_id, DR_REG_NULL, 1, sizeof(void *) * i, opnd_size_from_bytes(partial_size)); opnd_t srcdst_tl_opnd = opnd_create_base_disp(srcdst_mem_id, DR_REG_NULL, 1, sizeof(void *) * i, opnd_size_from_bytes(partial_size)); // Get new label. tb_simd_insert_get_new_label_from_2_src(instr_hndlr_info->tb_ctx, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), true, spill_info->xmm_regs[0], &srcdst_tl_opnd, &src1_tl_opnd, spill_info->xmm_regs[1], spill_info->scaler_regs[2]); tb_simd_insert_prop_mem(instr_hndlr_info, drcontext, ilist, where, tb_raw_get_app_pc(app_instr), &srcdst_tl_opnd, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); } // We check whether we perform the post propagation call. tb_simd_check_post_propagate(instr_hndlr_info, drcontext, ilist, where, spill_info->xmm_regs[0], spill_info->xmm_regs[1], spill_info->scaler_regs[2], spill_info->scaler_regs[3]); } static void tb_simd_handle_dmem_sreg_smem( tb_raw_instr_hndlr_info_t *instr_hndlr_info, size_t size, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { DR_ASSERT(spill_info->scaler_cnt > 3); DR_ASSERT(spill_info->xmm_cnt > 1); // Load reg map tb_raw_arraymap_insert_load_reg_map(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2]); // Translation: tb_raw_arraymap_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, spill_info->scaler_regs[2], src_reg_id); tb_umbra_insert_translate_address(instr_hndlr_info->tb_ctx, drcontext, ilist, where, srcdst_mem_id, spill_info->scaler_regs[3]); tb_simd_handle_dmem_propagate(instr_hndlr_info, size, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_dmem_1_sreg_1_smem_1( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_raw_byt_handle_src_srcdst_dmem_1_sreg_1_smem_1(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_dmem_2_sreg_2_smem_2( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { /** DON'T USE SIMD **/ tb_raw_byt_handle_src_srcdst_dmem_2_sreg_2_smem_2(instr_hndlr_info, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_dmem_4_sreg_4_smem_4( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_dmem_sreg_smem(instr_hndlr_info, 4, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_dmem_8_sreg_8_smem_8( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_dmem_sreg_smem(instr_hndlr_info, 8, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); } void tb_simd_byt_handle_src_srcdst_dmem_16_sreg_16_smem_16( tb_raw_instr_hndlr_info_t *instr_hndlr_info, void *drcontext, instrlist_t *ilist, instr_t *where, instr_t *app_instr, reg_id_t srcdst_mem_id, reg_id_t src_reg_id, tb_spill_info_t *spill_info) { tb_simd_handle_dmem_sreg_smem(instr_hndlr_info, 16, drcontext, ilist, where, app_instr, srcdst_mem_id, src_reg_id, spill_info); }
bdddb6836893ad4d095249e964f49101004cb9fc
341c974ba9870231217fec31b59cefbc8d48d318
/src/print.c
5069b82209e2ec23c8823785e5ec62791178d87e
[]
no_license
Rozinoer/Philosophers
1e46918d57da79c5527042ac0503eb3a0c4ed0d5
6896ed363f244544e041013185e59cd9717594fa
refs/heads/main
2023-06-18T18:46:53.643416
2021-07-21T19:48:42
2021-07-21T19:48:42
386,233,022
0
0
null
null
null
null
UTF-8
C
false
false
2,096
c
print.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dmyesha <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/07/18 17:01:58 by dmyesha #+# #+# */ /* Updated: 2021/07/18 17:02:00 by dmyesha ### ########.fr */ /* */ /* ************************************************************************** */ #include "Philosophers.h" int str_err(char *str, int code) { printf("%s", str); return (code); } void stop_sim(long int time, int pos, int type) { if (type == OVER) printf ("\033[0;31mOVER\033[0m\n"); else if (type == DEAD) printf ("\033[0;31m%ld %d is DEAD!\033[0m\n", time, pos); } void sim(long int time, int pos, int type) { if (type == TAKE_FORKS) printf ("%ld %d has token a fork!\n", time, pos); else if (type == SLEEP) printf ("%ld %d is sleeping!\n", time, pos); else if (type == THINK) printf ("%ld %d is thinking!\n", time, pos); else if (type == EAT) printf ("%ld %d is eating!\n", time, pos); } int action(t_philo *philo, int type) { static int done; long int time; done = 1; pthread_mutex_lock(&philo->main->str); time = get_time() - philo->main->start; if (philo->main->flag) { if (type == DEAD || type == OVER) { philo->main->flag = 0; pthread_mutex_unlock(&philo->main->str); if (philo->lfork == philo->rfork) pthread_mutex_unlock(&philo->main->forks[philo->rfork]); stop_sim(time, philo->pos, type); ph_sleep(philo->main->time_to_die); } sim(time, philo->pos, type); } pthread_mutex_unlock(&philo->main->str); return (0); }
423872a2a3437691d2d420a7a24d6b53822b9689
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/fastsocket/kernel/drivers/media/common/tuners/extr_mt20xx.c_mt2032_check_lo_lock.c
691970bc4f321ab371782e4b67f6858dd6d649bc
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
1,269
c
extr_mt20xx.c_mt2032_check_lo_lock.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct microtune_priv {int /*<<< orphan*/ i2c_props; } ; struct dvb_frontend {struct microtune_priv* tuner_priv; } ; /* Variables and functions */ int /*<<< orphan*/ tuner_dbg (char*,unsigned char) ; int /*<<< orphan*/ tuner_i2c_xfer_recv (int /*<<< orphan*/ *,unsigned char*,int) ; int /*<<< orphan*/ tuner_i2c_xfer_send (int /*<<< orphan*/ *,unsigned char*,int) ; int /*<<< orphan*/ udelay (int) ; __attribute__((used)) static int mt2032_check_lo_lock(struct dvb_frontend *fe) { struct microtune_priv *priv = fe->tuner_priv; int try,lock=0; unsigned char buf[2]; for(try=0;try<10;try++) { buf[0]=0x0e; tuner_i2c_xfer_send(&priv->i2c_props,buf,1); tuner_i2c_xfer_recv(&priv->i2c_props,buf,1); tuner_dbg("mt2032 Reg.E=0x%02x\n",buf[0]); lock=buf[0] &0x06; if (lock==6) break; tuner_dbg("mt2032: pll wait 1ms for lock (0x%2x)\n",buf[0]); udelay(1000); } return lock; }
c1c1059d9a4918181363fece39aa3be44c6d0386
4f443ffe59cf6fc5e77786a92d7dea8d709bf51e
/utility.h
e9b478422facbe80539ba3782bd3289bf2adbd4c
[]
no_license
valebes/Chatty
6af0a4febad160af5379806d40b3d558fa797d0c
8a537666fbca47ffe1de2649dd5de9bca67f90bf
refs/heads/master
2020-04-20T16:13:05.381208
2019-02-03T14:13:21
2019-02-03T14:13:21
168,952,385
1
0
null
null
null
null
UTF-8
C
false
false
1,482
h
utility.h
/* * chatterbox Progetto del corso di LSO 2017 * * Dipartimento di Informatica Università di Pisa * Docenti: Prencipe, Torquati * */ /** * @author Valerio Besozzi 543685 * Si dichiara che il contenuto di questo file e' in ogni sua parte opera * originale dell'autore */ /** * @file utility.h * @brief file contenente funzioni per la scrittura e lettura socket */ #ifndef UTILITY_H_ #define UTILITY_H_ #include <sys/types.h> #include <unistd.h> // Codice visto su: // // Unix Network Programming, Volume 1 // // http://www.unpbook.com // // Socket, read e write non vanno molto d'accordo, // // potrebbe succedere che vengano letti/scritti // // meno bytes di quelli richiesti. // /* Abbiamo visto la stessa cosa su conn.h su assegnamento 10 e 11 durante il corso */ /** * @function readn * @brief legge fd * * @param filedes fd da leggere * @param buff puntatore al buffer dove scrivere quello che leggo * @param nbytes bytes da leggere * @return bytes letti, -1 in caso di errore */ ssize_t readn(int filedes, void *buff, size_t nbytes); /** * @function writen * @brief scrive fd * * @param filedes fd in cui scrivere * @param buff puntatore al buffer contenente quello che che scrivo * @param nbytes bytes da scrivere * @return bytes scritti, -1 in caso di errore */ ssize_t writen(int filedes, const void *buff, size_t nbytes); #endif /* UTILITY_H_ */
e7708b3f238b1aff2da226e6b6050e94c463e2bc
289a4a219fa9b8007a647c3e47adcc3e2cddaf5d
/pombos_cartas_condicao.c
90e617d8a92fae9116718c5a86e430431ae1cf2e
[]
no_license
plaisteixo-5/PC
384782d9ba00a95ae658e89bbf44654d55760b81
138190faf5864a05d17567c8e373437f8a195b0e
refs/heads/main
2023-09-05T00:02:09.287884
2021-11-01T00:46:23
2021-11-01T00:46:23
394,484,964
0
0
null
null
null
null
UTF-8
C
false
false
2,661
c
pombos_cartas_condicao.c
#include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <semaphore.h> #include "unistd.h" #define N 10 //número de usuários #define CARTAS 20 //quantidade de cartas na mochila void *f_usuario(void *arg); void *f_pombo(void *arg); int cont_cartas = CARTAS; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t cond_usuario = PTHREAD_COND_INITIALIZER; pthread_cond_t cond_pombo = PTHREAD_COND_INITIALIZER; int main(int argc, char **argv) { int i; pthread_t usuario[N]; int *id; for (i = 0; i < N; i++) { id = (int *)malloc(sizeof(int)); *id = i; pthread_create(&(usuario[i]), NULL, f_usuario, (void *)(id)); } pthread_t pombo; id = (int *)malloc(sizeof(int)); *id = 0; pthread_create(&(pombo), NULL, f_pombo, (void *)(id)); pthread_join(pombo, NULL); } void *f_pombo(void *arg) { while (1) { pthread_mutex_lock(&mutex); while (cont_cartas != 0) { pthread_cond_wait(&cond_pombo, &mutex); } printf("O pombo acordou e foi entregar as cartas\n"); sleep(2); printf("PRU PRU PRU!!\n"); printf("O pombo voltou!!\n"); cont_cartas = CARTAS; pthread_cond_broadcast(&cond_usuario); pthread_mutex_unlock(&mutex); //Inicialmente está em A, aguardar/dorme a mochila ficar cheia (20 cartas) //Leva as cartas para B e volta para A //Acordar os usuários } } void *f_usuario(void *arg) { int id = *((int *)arg); sleep(3); while (1) { pthread_mutex_lock(&mutex); printf("O usuário %d quer enviar uma carta\n", id); while (cont_cartas == 0) { printf("O usuário %d está esperando o pombo voltar\n", id); pthread_cond_wait(&cond_usuario, &mutex); } cont_cartas--; printf("Quantidade de vagas na bolsa: %d\n", cont_cartas); pthread_mutex_unlock(&mutex); printf("O usuário %d escreveu uma carta e deu ao pombo!\n", id); sleep(1); pthread_mutex_lock(&mutex); if (cont_cartas == 0) { printf("A bolsa do pombo está cheia. Acordando ele para trabalhar!\n"); pthread_cond_broadcast(&cond_pombo); } pthread_mutex_unlock(&mutex); //Escreve uma carta //Caso o pombo não esteja em A ou a mochila estiver cheia, então dorme //Posta sua carta na mochila do pombo //Caso a mochila fique cheia, acorda o ṕombo } }
481192e7af7a13b093625362d3535f9cd1bb442d
62c75785ed67f53e660fe052454ca6bb851876b5
/assignment2/BalanceLoad/matmul.c
da84e2d25ed10d451c414b2f954a345dbf6c071c
[]
no_license
gungun1010/haha
4d93547377126ca05f80116f3bf6d2a1e99f3c16
2b09615074700fdd872fd646b975b5fa3c0b5344
refs/heads/master
2021-03-12T23:24:08.215412
2014-12-16T10:22:06
2014-12-16T10:22:06
24,517,824
1
0
null
null
null
null
UTF-8
C
false
false
3,293
c
matmul.c
#include "matmul.h" //#include "timing.h" #define MIN(a,b) (((a)<(b))?(a):(b)) //avoid implicit declaration void timing(double* wcTime, double* cpuTime); void printMat(int size, double** mat){ int i,j; for(i=0; i<size; i++){ for(j=0; j<size; j++){ printf(" %.5f ",(*mat)[i*size+j]); } printf("\n"); } } int calcSize(int rank, int blockSize) { int n; int sizeAB; n = (rank+1)*blockSize; sizeAB = n*(1+n)/2 - (n-blockSize)*(1+n-blockSize)/2; return sizeAB; } void initRowBlk(int sizeA, int sizeC, double** A, double** C) { int i; *A = (double *) calloc(sizeA,sizeof(double));//lower triangular mat *C = (double *) calloc(sizeC,sizeof(double));//result mat srand(12345); // This assumes A is stored by rows, and B is stored by columns for (i=0; i<sizeA; i++) (*A)[i] = ((double) rand()/(double)RAND_MAX); //for (i=0; i<sizeA; i++) (*A)[i] = 1.0; } void initColBlk(int sizeB, double** B) { int i; *B = (double *) calloc(sizeB,sizeof(double));//upper triangular mat srand(12345); // This assumes A is stored by rows, and B is stored by columns for (i=0; i<sizeB; i++) (*B)[i] = ((double) rand()/(double)RAND_MAX); //for (i=0; i<sizeB; i++) (*B)[i] = 2.0; } void updateIndx(int* i, int procNum){ if(*i != 0){ (*i)--; }else{ *i = procNum-1; } } void matFree(double* A, double* B, double* C) { free(A); free(B); free(C); } void initAnC(int rank, int blockSize, int N, int* sizeAref,int* sizeCref, double** A, double** C){ //init A row block and C row block for this process (rank 0) //C row block has constant size, calculated insize initRowBlk() *sizeAref = calcSize(rank, blockSize); *sizeCref = blockSize * N; //init row block A and C based on sizeA and sizeC initRowBlk(*sizeAref, *sizeCref, A, C); } void debugPrints(double** matRef, int size, int rank){ int i; printf("%d : ",rank); for(i = 0; i<size; i++){ printf("%.2f ", (*matRef)[i]); } printf("\n"); } double matmul(int rankB, int cCol, int blockSize, int sizeA, int sizeB, double** A, double** B, double** C) { int i, j, k; int iA, jB, iC; int a1,b1; double wctime0, wctime1, cputime; timing(&wctime0, &cputime); //this algorithm is modified from the serial version //a1 and b1 are the first element of a number series [1,2,3,4,5...n] //the a1 and b1 equation are drived from arithmatic sequence equation: //an = a1 + (n-1)*d; Sn = n*(a1+an)/2; // n -> blockSize; d -> 1; Sn -> sizeAB; a1 = (2*sizeA/blockSize - blockSize + 1)/2; b1 = (2*sizeB/blockSize - blockSize + 1)/2; iA = rankB;//col entry in each block depends on the tag of B mat iC = iA*blockSize;//row entry offset based on the blocksize for (i=a1; i<a1+blockSize; i++, iA++) { jB =0; for (j=b1; j<b1+blockSize; j++,jB++) { (*C)[iC+jB] = 0.; for (k=0; k<MIN(i,j); k++) (*C)[iC+jB] += (*A)[k] * (*B)[k]; //printf("%.1f %.1f %.1f\n",(*C)[iC+jB],(*A)[k],(*B)[k]); } iC+=cCol;//line up the offsets for next result if available } //debugPrints(C, blockSize * 3, rankB); timing(&wctime1, &cputime); return(wctime1 - wctime0); }
bc7a3000dab70707c2153931404068cd5099b2a0
130b341c0cba330f683d8ea6162091ed3c2f529b
/svn_sensor/sensor/volt_cal/trunk/ad7799_vcal_filter.h
a495a723dc15a587fa47eb693a117a32e27e223a
[ "MIT" ]
permissive
GliderWinchItems/embed
c7ffdd7f94bb600a3de7c240c03a7c41f56d5646
cc72aa7d8208db3871a15e38185e1e125fa7de47
refs/heads/master
2021-06-24T07:02:46.434139
2021-06-18T15:55:22
2021-06-18T15:55:22
75,445,872
1
2
null
null
null
null
UTF-8
C
false
false
2,872
h
ad7799_vcal_filter.h
/****************************************************************************** * File Name : ad7799_vcal_filter.h * Date First Issued : 10/09/2015 * Board : STM32F103VxT6_pod_mm * Description : ad7799 filtering--multiple channels *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __AD7799_FILTER #define __AD7799_FILTER #include <stdint.h> #define AD7799NUMCHANNELS 3 // Number of channels #define CHANNELAIN_1 0 // Channel number for first array position #define CHANNELAIN_2 1 // Channel number for second array position #define CHANNELAIN_3 2 // Channel number for third array position #define READSUMCT 96 // Number of readings to sum /* Parameters for reading a mux channel. (There WILL be three of these.) */ struct AD7799CHAN { uint16_t mode; // Mode register setting (for readings) uint16_t calibzero; // Calibration (mode) setting zero (0x0ff0 = skip) uint16_t calibfs; // Calibration (mode) setting fullscale (0x0ff0 = skip) uint16_t config; // Configuraton register setting uint16_t ct; // Number of readings to sum (0 = skip channel) uint16_t ctr; // Number of readings summed (working counter) int32_t sum; // Summation of readings, working (for interrupt) int32_t sum_save; // Summation saved (for mainline) uint16_t chanflag; // Channel flag (increment when data ready) uint8_t mux; // Mux channel number }; /******************************************************************************/ void ad7799_vcal_poll_rdy (void); /* @brief : Check /RDY and complete a ready when ready *******************************************************************************/ void ad7799_vcal_filter (int nInput); /* @brief : Do three sinc filters * @param : nInput = ad7799 reading, bipolar and adjusted *******************************************************************************/ void ad7799_vcal_filter_start(struct AD7799CHAN* p); /* @brief : Start interrupt driven ad7799 readings; sequence though channels * @param : p = pointer to array of parameters for channels *******************************************************************************/ void ad7799_vcal_filter_init_param(struct AD7799CHAN* p); /* @brief : Initialize channel parameters * @param : p = pointer to array of parameters for channels *******************************************************************************/ /* When all channels have been read & summed, save in buffer and set this flag. */ extern uint16_t ad7799_ready_flag; // Flag showing new 'sum_save' data ready /* Address this routine will go to upon completion of 'comm calls. */ extern void (*ad7799_vcal_filterdone_ptr)(void); /* Completed sequence of channel readings saved for mainline */ extern int32_t sum_save[AD7799NUMCHANNELS]; #endif
560e61cfd66ea6727f788607f3d29e7c527b5546
fff3f3e01882c759c90243fcdef3eed68552b55b
/asq9.c
82f7357427cd12fae992e989a1eca44ebe475a85
[]
no_license
saswatmukund/C-Programming-Preplacement
d021a7b2c9c161fe7d86c89efd9649b87ccd6ddd
41e04fe38f0572cdeefa91ce0fa0c4567d31f429
refs/heads/main
2023-08-16T03:14:13.752228
2021-10-16T08:00:27
2021-10-16T08:00:27
417,757,023
0
1
null
null
null
null
UTF-8
C
false
false
369
c
asq9.c
#include<stdio.h> void main() { char ch; printf("\nEnter the a alphabet\n"); scanf("%c",&ch); if(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z') { printf("%c is a alphabet",ch); } else if(ch>='1'&&ch<='9') { printf("%c is a digit",ch); } else { printf("%c is a special character",ch); } }
ad1195eb66e6b23087500a3468e05839953efb4b
13b290ec6bb898583c666e36efa0dc1fa5db93e2
/Phase5/phase5part2/proc.c
481d7f4e0e951c59be0cbb5de85fca87fe61fa6d
[]
no_license
enggsudarshan/Basic-Operating-System
733374adb4e8ead2d422796420bd2eea0476a166
dae0e61ec183eb4a45ea6634399cd37589f54a3c
refs/heads/master
2020-12-10T03:18:50.867755
2017-06-26T20:16:46
2017-06-26T20:16:46
95,486,360
3
0
null
null
null
null
UTF-8
C
false
false
2,516
c
proc.c
// proc.c, 159 // processes are coded here //In Real Kernel (Kernel Process and User Process) //Code defined here /********************************************************************/ #include "spede.h" // for IO_DELAY() needed here below #include "extern.h" // for currently-running pid needed below #include "proc.h" // for prototypes of process functions #include "syscall.h" #include "tools.h" /********************************************************************/ void IdleProc() { int i; while(1) { if(cons_kbhit() && cons_getchar() == 'b') breakpoint(); cons_printf("0.."); for(i=0;i< 1666667;i++) IO_DELAY(); } } void TermProc() { char a_str[101]; int i,k=0,baud_rate,remote,local, divisor; local=GetPid()-1; remote=(local+1)%2; term[local].out_q_sem=SemReq(); for(i = 0; i <Q_SIZE ; i++) { SemPost(term[local].out_q_sem); } term[local].in_q_sem=SemReq(); term[local].out_flag =1; term[local].echo_flag=1; term[remote].out_flag =1; term[remote].echo_flag=1; for(k =0;k<2;k++) { baud_rate = 9600; // Mr. Baud invented this divisor = 115200 / baud_rate; // time period of each baud outportb(term[k].io_base+CFCR, CFCR_DLAB); // CFCR_DLAB 0x80 outportb(term[k].io_base+BAUDLO, LOBYTE(divisor)); outportb(term[k].io_base+BAUDHI, HIBYTE(divisor)); outportb(term[k].io_base+CFCR, CFCR_PEVEN|CFCR_PENAB|CFCR_7BITS); outportb(term[k].io_base+IER, 0); outportb(term[k].io_base+MCR, MCR_DTR|MCR_RTS|MCR_IENABLE); IO_DELAY(); outportb(term[k].io_base+IER, IER_ERXRDY|IER_ETXRDY); // enable TX, RX events Sleep(50); } for(i=0;i<24;i++) TermOut("\n",local); while(1) { TermIn(a_str,local); cons_printf( "\nTerm %d Name: %s...",GetPid(),a_str); TermOut("(Remote)",remote); TermOut(a_str,remote); TermOut("\n",remote); } } void TermIn(char *str,int which) { char ch, *p; int ch_count=0; p = str; while(1) { SemWait(term[which].in_q_sem); ch = DeQ(&term[which].in_q); if(ch == '\r') { break; } else { *p++ = ch; } ch_count++; if(ch_count==100) break; } *p = '\0'; } void TermOut(char *str,int which) { char *p; p=str; while(*p) { SemWait(term[which].out_q_sem); EnQ(*p,&term[which].out_q); if(*p=='\n') { SemWait(term[which].out_q_sem); EnQ('\r',&term[which].out_q); } TripTermIRQ(); p++; } }
1c0fa53f2b2f59cb3adf789fe461957864b2a47f
9b040c4e3b1211ca8dfc769030bca432866feb88
/src/textybits.c
6d8013d56ba44753e04883eb108aa812dd3ea04c
[ "MIT" ]
permissive
LukeStorry/SudukuSolver
5a494bf517b6f99c34d57069f09269a176978e88
3c600374aa484febdbc8e2324009d9b9bbb3a441
refs/heads/master
2020-04-22T06:00:46.058496
2014-11-25T14:57:07
2014-11-25T14:57:07
null
0
0
null
null
null
null
UTF-8
C
false
false
2,013
c
textybits.c
//this function is used by all files, so to prevent "-Wall" errors, it has to be in it's own file. #include <stdio.h> #include <stdlib.h> void intro (void) { system("clear"); //Thanks to http://patorjk.com/software/taag/ for this awesome ASCII art. //Font: Mega-relief by Nick Bryant 12/9 printf("______/\\\\\\\\\\\\\\\\\\\\\\____/\\\\\\________/\\\\\\__/\\\\\\\\\\\\\\\\\\\\\\\\_____/\\\\\\________/\\\\\\__/\\\\\\________/\\\\\\__/\\\\\\________/\\\\\\_ \n"); printf(" ____/\\\\\\/////////\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\////////\\\\\\__\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\_____/\\\\\\//__\\/\\\\\\_______\\/\\\\\\_ \n"); printf(" __\\//\\\\\\______\\///__\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\______\\//\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\__/\\\\\\//_____\\/\\\\\\_______\\/\\\\\\_ \n"); printf(" ___\\////\\\\\\_________\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\\\\\\\//\\\\\\_____\\/\\\\\\_______\\/\\\\\\_ \n"); printf(" ______\\////\\\\\\______\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\//_\\//\\\\\\____\\/\\\\\\_______\\/\\\\\\_ \n"); printf(" _________\\////\\\\\\___\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\____\\//\\\\\\___\\/\\\\\\_______\\/\\\\\\_ \n"); printf(" __/\\\\\\______\\//\\\\\\__\\//\\\\\\______/\\\\\\__\\/\\\\\\_______/\\\\\\__\\//\\\\\\______/\\\\\\__\\/\\\\\\_____\\//\\\\\\__\\//\\\\\\______/\\\\\\__ \n"); printf(" _\\///\\\\\\\\\\\\\\\\\\\\\\/____\\///\\\\\\\\\\\\\\\\\\/___\\/\\\\\\\\\\\\\\\\\\\\\\\\/____\\///\\\\\\\\\\\\\\\\\\/___\\/\\\\\\______\\//\\\\\\__\\///\\\\\\\\\\\\\\\\\\/___ \n"); printf(" ___\\///////////________\\/////////_____\\////////////________\\/////////_____\\///________\\///_____\\/////////_____\n"); printf("\n\n A work in progress... \n\n Written by Luke Storry\n\n\n\n"); }
551d9c96c36e4021c118df366d24c0fd00a628c3
397de467115775da05ae98426bca4583711df0c6
/minigui/libminigui-gpl-3.0.12/src/newgdi/polygon.c
2ef907e4749840647109997ee1e5bffd33bff7d7
[ "Unlicense", "GPL-3.0-only", "GPL-1.0-or-later", "LGPL-2.1-or-later", "LGPL-2.0-or-later", "LicenseRef-scancode-unknown-license-reference", "GPL-2.0-only", "LicenseRef-scancode-commercial-license", "LicenseRef-scancode-proprietary-license" ]
permissive
hyller/GladiatorLibrary
d6f6dfae0026464950f67fd97877baeeb40b6c9a
f6b0b1576afae27ecd042055db5f655ccd41710b
refs/heads/master
2023-04-27T11:26:09.118078
2022-03-31T08:22:16
2022-03-31T08:22:16
39,110,689
7
6
Unlicense
2023-04-21T20:51:57
2015-07-15T02:00:05
C
UTF-8
C
false
false
22,516
c
polygon.c
/* ** $Id: polygon.c 11435 2009-03-28 09:10:52Z weiym $ ** ** polygon.c: monoton vertical polygon and general polygon generators. ** ** Copyright (C) 2003 ~ 2007 Feynman Software. ** Copyright (C) 2001 ~ 2002 Wei Yongming. ** ** Monotone vertical polygon generator comes from ** "Michael Abrash's Graphics Programming Black Book Special Edition" ** by Michael Abrash. ** ** General polygon generator comes from Allegro by ** Shawn Hargreaves and others. ** Thank them for their great work and good copyright statement. ** ** "Allegro is a gift-software" ** ** Current maintainer: Wei Yongming. ** ** Create date: 2001/10/31. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include "common.h" #include "minigui.h" #include "gdi.h" #include "window.h" #include "fixedmath.h" #include "cliprect.h" #include "gal.h" #include "internals.h" #include "ctrlclass.h" #include "dc.h" #include "pixel_ops.h" #include "cursor.h" #include "polygon.h" /* * Returns TRUE if polygon described by passed-in vertex list is * monotone with respect to a vertical line, FALSE otherwise. * Doesn't matter if polygon is simple (non-self-intersecting) or not. */ #define SIGNUM(a) ((a>0)?1:((a<0)?-1:0)) BOOL GUIAPI PolygonIsMonotoneVertical (const POINT* pts, int vertices) { int i, delta_y, prev_delta_y; int nr_yreversals = 0; /* Three or fewer points can't make a non-vertical-monotone polygon */ if (vertices < 4) return TRUE; /* The polygon must be a closed one */ if (pts[0].x != pts[vertices-1].x || pts[0].y != pts[vertices-1].y) return FALSE; /* Scan to the first non-horizontal edge */ prev_delta_y = SIGNUM(pts[vertices-1].y - pts[0].y); i = 0; while ((prev_delta_y == 0) && (i < (vertices-1))) { prev_delta_y = SIGNUM(pts[i].y - pts[i+1].y); i++; } if (i == (vertices-1)) return TRUE; /* polygon is a flat line */ /* * Now count Y reversals. Might miss one reversal, at the last vertex, * but because reversal counts must be even, being off by one * isn't a problem */ do { if ((delta_y = SIGNUM(pts[i].y - pts[i+1].y)) != 0) { if (delta_y != prev_delta_y) { /* Switched Y direction; not vertical-monotone if reversed Y direction as many as three times */ if (++nr_yreversals > 2) return FALSE; prev_delta_y = delta_y; } } } while (i++ < (vertices-1)); return TRUE; /* it's a vertical-monotone polygon */ } typedef struct _hline { int x1, x2; } HLINE; /* * Scan converts an edge from (x1, y1) to (x2, y2), not including * the point at (x2, y2). This avoids overlapping the end of * one line with the start of the next, and causes the bottom * scan line of the polygon not to be drawn. If skip_first != 0, * the point at (x1, y1) isn't drawn. For each scan line, * the pixel closest to the scanned line without being to the * left of the scanned line is chosen */ static void scan_edge (int x1, int y1, int x2, int y2, int set_x1, int skip_first, HLINE** hlines_p) { #ifdef _MGHAVE_FIXED_MATH int y, delta_x, delta_y, dir; fixed inverse_slope; HLINE* hlines; /* Calculate x and y lengths of the line and the inverse slope */ delta_x = x2 - x1; if ((delta_y = y2 - y1) <= 0) return; /* guard against 0-length and horizontal edges */ if (delta_x < 0) { dir = -1; inverse_slope = fixdiv (itofix (-delta_x), itofix (delta_y)); } else { dir = 1; inverse_slope = fixdiv (itofix (delta_x), itofix (delta_y)); } /* * Store the x coordinate of the pixel closest to but not to * the left of the line for each y coordinate between y1 and y2, * not including y2 and also not including y1 if skip_first != 0 */ hlines = *hlines_p; for (y = y1 + skip_first; y < y2; y++, hlines++) { if (set_x1) hlines->x1 = x1 + fixceil (fixmul (itofix (y-y1), inverse_slope)) * dir; else hlines->x2 = x1 + fixceil (fixmul (itofix (y-y1), inverse_slope)) * dir; } *hlines_p = hlines; #else int y, delta_x, delta_y; double inverse_slope; HLINE* hlines; /* Calculate x and y lengths of the line and the inverse slope */ delta_x = x2 - x1; if ((delta_y = y2 - y1) <= 0) return; /* guard against 0-length and horizontal edges */ inverse_slope = (double)delta_x / (double)delta_y; /* * Store the x coordinate of the pixel closest to but not to * the left of the line for each y coordinate between y1 and y2, * not including y2 and also not including y1 if skip_first != 0 */ hlines = *hlines_p; for (y = y1 + skip_first; y < y2; y++, hlines++) { if (set_x1) hlines->x1 = x1 + (int)ceil ((y-y1) * inverse_slope); else hlines->x2 = x1 + (int)ceil ((y-y1) * inverse_slope); } *hlines_p = hlines; #endif } /* * "Monoton vertical" means "monotone with respect to a vertical line"; * that is, every horizontal line drawn through the polygon at any point * would cross exactly two active edges (neither horizontal lines * nor zero-length edges count as active edges; both are acceptable * anywhere in the polygon). Right & left edges may cross (polygons may be nonsimple). * Polygons that are not convex according to this definition won't be drawn properly. */ /* Advances the index by one vertex forward through the vertex list, wrapping at the end of the list */ #define INDEX_FORWARD(Index) \ Index = (Index + 1) % vertices; /* Advances the index by one vertex backward through the vertex list, wrapping at the start of the list */ #define INDEX_BACKWARD(Index) \ Index = (Index - 1 + vertices) % vertices; /* Advances the index by one vertex either forward or backward through the vertex list, wrapping at either end of the list */ #define INDEX_MOVE(Index,Direction) \ if (Direction > 0) \ Index = (Index + 1) % vertices; \ else \ Index = (Index - 1 + vertices) % vertices; /* Monotone vertical polygon generator */ BOOL GUIAPI MonotoneVerticalPolygonGenerator (void* context, const POINT* pts, int vertices, CB_POLYGON cb) { int i, min_index, max_index, min_point_y, max_point_y; int cur_index, prev_index; HLINE *hlines, *working_hlines; int nr_hlines; if (vertices < 3) return TRUE; /* reject null polygons */ /* Scan the list to find the top and bottom of the polygon */ max_point_y = min_point_y = pts[min_index = max_index = 0].y; for (i = 1; i < vertices; i++) { if (pts[i].y < min_point_y) min_point_y = pts[min_index = i].y; /* new top */ else if (pts[i].y > max_point_y) max_point_y = pts[max_index = i].y; /* new bottom */ } /* Set the # of scan lines in the polygon, skipping the bottom edge */ if ((nr_hlines = max_point_y - min_point_y) <= 0) { return TRUE; /* there's nothing to draw, so we're done */ } /* Get memory in which to store the line list we generate */ if ((hlines = (HLINE*) (malloc (sizeof (HLINE) * nr_hlines))) == NULL) { return FALSE; /* couldn't get memory for the line list */ } /* Scan the first edge and store the boundary points in the list */ /* Initial pointer for storing scan converted first-edge coords */ working_hlines = hlines; prev_index = cur_index = min_index; /* Start from the top of the first edge */ /* Scan convert each line in the first edge from top to bottom */ do { INDEX_BACKWARD(cur_index); scan_edge (pts[prev_index].x, pts[prev_index].y, pts[cur_index].x, pts[cur_index].y, 1, 0, &working_hlines); prev_index = cur_index; } while (cur_index != max_index); /* Scan the second edge and store the boundary points in the list */ working_hlines = hlines; prev_index = cur_index = min_index; /* Scan convert the second edge, top to bottom */ do { INDEX_FORWARD(cur_index); scan_edge (pts[prev_index].x, pts[prev_index].y, pts[cur_index].x, pts[cur_index].y, 0, 0, &working_hlines); prev_index = cur_index; } while (cur_index != max_index); for (i = 0; i < nr_hlines; i++) { cb (context, hlines [i].x1, hlines [i].x2, i + min_point_y); } /* Release the line list's memory and we're successfully done */ free (hlines); return TRUE; } #ifdef POLYGON_64_SUPPORT static void Neg64( POLYGON_Int64 *x ) { /* Remember that -(0x80000000) == 0x80000000 with 2-complement! */ /* We take care of that here. */ x->hi ^= 0xFFFFFFFFUL; x->lo ^= 0xFFFFFFFFUL; x->lo++; if ( !x->lo ) { x->hi++; if ( x->hi == 0x80000000UL ) /* Check -MaxInt32 - 1 */ { x->lo--; x->hi--; /* We return 0x7FFFFFFF! */ } } } static POLYGON_Int32 Div64by32( POLYGON_Int64 *x, POLYGON_Int32 y ) { POLYGON_Int64 tmp; POLYGON_Int32 s; POLYGON_Word32 q, r, i, lo; tmp.hi = x->hi; tmp.lo = x->lo; s = tmp.hi; if ( s < 0 ) Neg64( &tmp ); s ^= y; y = ABS( y ); /* Shortcut */ if ( tmp.hi == 0 ){ q = tmp.lo / y; return ( s < 0 ) ? -(POLYGON_Int32)q : (POLYGON_Int32)q; } r = tmp.hi; lo = tmp.lo; if ( r >= (POLYGON_Word32)y ) /* we know y is to be treated as unsigned here */ return ( s < 0 ) ? 0x80000001UL : 0x7FFFFFFFUL; /* Return Max/Min Int32 if divide overflow */ /* This includes division by zero! */ q = 0; for ( i = 0; i < 32; i++ ){ r <<= 1; q <<= 1; r |= lo >> 31; if ( r >= (POLYGON_Word32)y ){ r -= y; q |= 1; } lo <<= 1; } return ( s < 0 ) ? -(POLYGON_Int32)q : (POLYGON_Int32)q; } void Add64( POLYGON_Int64* x, POLYGON_Int64* y, POLYGON_Int64* z ) { register POLYGON_Word32 lo, hi; lo = x->lo + y->lo; hi = x->hi + y->hi + ( lo < x->lo ); z->lo = lo; z->hi = hi; } void Sub64( POLYGON_Int64* x, POLYGON_Int64* y, POLYGON_Int64* z ) { register POLYGON_Word32 lo, hi; lo = x->lo - y->lo; hi = x->hi - y->hi - ( (POLYGON_Int32)lo < 0 ); z->lo = lo; z->hi = hi; } void MulTo64( POLYGON_Int32 x, POLYGON_Int32 y, POLYGON_Int64* z ) { POLYGON_Int32 s; POLYGON_Word32 lo1, hi1, lo2, hi2, lo, hi, i1, i2; s = x; x = ABS( x ); s ^= y; y = ABS( y ); lo1 = x & 0x0000FFFF; hi1 = x >> 16; lo2 = y & 0x0000FFFF; hi2 = y >> 16; lo = lo1*lo2; i1 = lo1*hi2; i2 = lo2*hi1; hi = hi1*hi2; /* Check carry overflow of i1 + i2 */ if ( i2 ) { if ( i1 >= (POLYGON_Word32)-(POLYGON_Int32)i2 ) hi += 1L << 16; i1 += i2; } i2 = i1 >> 16; i1 = i1 << 16; /* Check carry overflow of i1 + lo */ if ( i1 ) { if ( lo >= (POLYGON_Word32)-(POLYGON_Int32)i1 ) hi++; lo += i1; } hi += i2; z->lo = lo; z->hi = hi; if ( s < 0 ) Neg64( z ); } void Int64AddInt32(POLYGON_Int64 *x, POLYGON_Int32 y, POLYGON_Int64 *z) { POLYGON_Int64 tmp; MulTo64(y, 1, &tmp); Add64(x, &tmp, z); } BOOL IsSmall(POLYGON_Int64 *x, POLYGON_Int32 x_off, POLYGON_Int64 *y, POLYGON_Int32 y_off) { POLYGON_Int64 z1, z2, z3; int i; Int64AddInt32(x, x_off, &z1); Int64AddInt32(y, y_off, &z2); Sub64(&z1, &z2, &z3); i = Div64by32(&z3, 1); if (i<0) return TRUE; else return FALSE; } #endif /* _fill_edge_structure: * Polygon helper function: initialises an edge structure for the 2d * rasteriser. */ void _fill_edge_structure (POLYGON_EDGE *edge, const int *i1, const int *i2) { #ifdef POLYGON_64_SUPPORT POLYGON_Int64 dx64; #endif if (i2[1] < i1[1]) { const int *it; it = i1; i1 = i2; i2 = it; } edge->top = i1[1]; edge->bottom = i2[1] - 1; #ifndef POLYGON_64_SUPPORT edge->dx = ((i2[0] - i1[0]) << POLYGON_FIX_SHIFT) / (i2[1] - i1[1]); edge->x = (i1[0] << POLYGON_FIX_SHIFT) + (1<<(POLYGON_FIX_SHIFT-1)) - 1; #else MulTo64(i2[0] - i1[0], 1<<POLYGON_FIX_SHIFT, &dx64); edge->dx = Div64by32(&dx64, (i2[1] - i1[1])); MulTo64(i1[0], 1<<POLYGON_FIX_SHIFT, &(edge->x)); #endif edge->prev = NULL; edge->next = NULL; #ifndef POLYGON_64_SUPPORT if (edge->dx < 0) edge->x += MIN(edge->dx+(1<<POLYGON_FIX_SHIFT), 0); edge->w = MAX(ABS(edge->dx)-(1<<POLYGON_FIX_SHIFT), 0); #else if (edge->dx < 0) Int64AddInt32(&(edge->x), MIN(edge->dx+(1<<POLYGON_FIX_SHIFT), 0), &(edge->x)); edge->w = MAX(ABS(edge->dx)-(1<<POLYGON_FIX_SHIFT), 0); #endif } /* _add_edge: * Adds an edge structure to a linked list, returning the new head pointer. */ POLYGON_EDGE *_add_edge (POLYGON_EDGE *list, POLYGON_EDGE *edge, int sort_by_x) { POLYGON_EDGE *pos = list; POLYGON_EDGE *prev = NULL; if (sort_by_x) { while ( (pos) && #ifndef POLYGON_64_SUPPORT (pos->x + (pos->w + pos->dx) /2 ) < (edge->x + (edge->w + edge->dx)/2)){ #else IsSmall(&(pos->x), (pos->w + pos->dx)/2, &(edge->x), (edge->w + edge->dx)/2)) { #endif prev = pos; pos = pos->next; } } else { while ((pos) && (pos->top < edge->top)) { prev = pos; pos = pos->next; } } edge->next = pos; edge->prev = prev; if (pos) pos->prev = edge; if (prev) { prev->next = edge; return list; } else return edge; } /* _remove_edge: * Removes an edge structure from a list, returning the new head pointer. */ POLYGON_EDGE *_remove_edge(POLYGON_EDGE *list, POLYGON_EDGE *edge) { if (edge->next) edge->next->prev = edge->prev; if (edge->prev) { edge->prev->next = edge->next; return list; } else return edge->next; } /* General polygon generator */ BOOL GUIAPI PolygonGeneratorEx (void* context, const POINT* pts, int vertices, CB_POLYGON cb, RECT* rc_output) { int c; int top = INT_MAX; int bottom = INT_MIN; const int *i1, *i2; void* _scratch_mem; const int* points = (int*) pts; POLYGON_EDGE *edge, *next_edge; POLYGON_EDGE *active_edges = NULL; POLYGON_EDGE *inactive_edges = NULL; /* allocate some space and fill the edge table */ _scratch_mem = malloc (sizeof(POLYGON_EDGE) * vertices); if (!(edge = (POLYGON_EDGE *)_scratch_mem)) return FALSE; i1 = points; i2 = points + (vertices-1) * 2; for (c=0; c<vertices; c++) { if (i1[1] != i2[1]) { _fill_edge_structure (edge, i1, i2); if (edge->bottom >= edge->top) { if (edge->top < top) top = edge->top; if (edge->bottom > bottom) bottom = edge->bottom; inactive_edges = _add_edge(inactive_edges, edge, FALSE); edge++; } } i2 = i1; i1 += 2; } /* if rc_output not NULL, the scanlines's range is * limit in the RECT. */ if(rc_output){ _MG_PRINTF("rc_output:(%d,%d)\n", rc_output->top, rc_output->bottom); edge = inactive_edges; while ((edge)) { next_edge = edge->next; /* add the edge between the rc_ouput. */ if(edge->top < rc_output->top && edge->bottom > rc_output->top) { inactive_edges = _remove_edge(inactive_edges, edge); active_edges = _add_edge(active_edges, edge, TRUE); #ifndef POLYGON_64_SUPPORT edge->x += (edge->dx * (rc_output->top - edge->top)); #else Int64AddInt32(&(edge->x), edge->dx * (rc_output->top - edge->top), &(edge->x)); #endif _MG_PRINTF("start check newly active edes c=%d,top=%d," "bottom=%d.\n", c, edge->top, edge->bottom); } /* add the edge outside the rc_ouput. */ else if(edge->bottom < rc_output->top || edge->top > rc_output->bottom){ inactive_edges = _remove_edge(inactive_edges, edge); _MG_PRINTF("start delete edes c=%d,top=%d," "bottom=%d.\n", c, edge->top, edge->bottom); } edge = next_edge; } /* limit the scanlines inside the rc_ouput. */ top = rc_output->top; bottom = rc_output->bottom; } /* for each scanline in the polygon... */ for (c=top; c<=bottom; c++) { /* check for newly active edges */ edge = inactive_edges; while ((edge) && (edge->top == c)) { next_edge = edge->next; inactive_edges = _remove_edge(inactive_edges, edge); active_edges = _add_edge(active_edges, edge, TRUE); _MG_PRINTF("check newly active edes c=%d,top=%d," "bottom=%d.\n", c, edge->top, edge->bottom); edge = next_edge; } /* draw horizontal line segments */ edge = active_edges; while ((edge) && (edge->next)) { #ifndef POLYGON_64_SUPPORT int x1 = edge->x>>POLYGON_FIX_SHIFT; int x2 = ((edge->next->x+edge->next->w)>>POLYGON_FIX_SHIFT); #else int x1 = Div64by32(&(edge->x), 1<<POLYGON_FIX_SHIFT); POLYGON_Int64 tmp; int x2; Int64AddInt32(&(edge->next->x), (edge->next->w), &tmp); x2 = Div64by32(&tmp, 1<<POLYGON_FIX_SHIFT); #endif cb (context, x1, x2, c); edge = edge->next->next; } /* update edges, sorting and removing dead ones */ edge = active_edges; while (edge) { next_edge = edge->next; if (c >= edge->bottom) { active_edges = _remove_edge(active_edges, edge); _MG_PRINTF("delete edes c=%d,top=%d," "bottom=%d.\n", c, edge->top, edge->bottom); } else { #ifndef POLYGON_64_SUPPORT edge->x += edge->dx; #else Int64AddInt32(&(edge->x), edge->dx, &(edge->x)); #endif while ((edge->prev) && #ifndef POLYGON_64_SUPPORT (edge->x+edge->w/2 < edge->prev->x+edge->prev->w/2)) { #else IsSmall(&(edge->x), edge->w/2, &(edge->prev->x), edge->prev->w/2)) { #endif if (edge->next) edge->next->prev = edge->prev; edge->prev->next = edge->next; edge->next = edge->prev; edge->prev = edge->prev->prev; edge->next->prev = edge; if (edge->prev) edge->prev->next = edge; else active_edges = edge; } } edge = next_edge; } } free (_scratch_mem); return TRUE; } static POINT* convert_vertices (PDC pdc, const POINT* pts, int vertices, RECT* rcOutput) { int i; POINT* points; if (vertices < 3) return NULL; if (!(points = malloc (sizeof (POINT) * vertices))) { return NULL; } /* Transfer logical to device to screen and find rcOutput here. */ points [0] = pts [0]; coor_LP2SP (pdc, &points [0].x, &points [0].y); rcOutput->left = rcOutput->right = points [0].x; rcOutput->top = rcOutput->bottom = points [0].y; for (i = 1; i < vertices; i++) { points [i] = pts [i]; coor_LP2SP (pdc, &points [i].x, &points [i].y); if (points [i].x < rcOutput->left) { rcOutput->left = points [i].x; } else if (points [i].x > rcOutput->right) { rcOutput->right = points [i].x; } if (points [i].y < rcOutput->top) { rcOutput->top = points [i].y; } else if (points [i].y > rcOutput->bottom) { rcOutput->bottom = points [i].y; } } return points; } BOOL GUIAPI FillPolygon (HDC hdc, const POINT* pts, int vertices) { PDC pdc; RECT rc_tmp; POINT* points; BOOL is_mv; if (vertices < 3) return FALSE; if (!(pdc = __mg_check_ecrgn (hdc))) return TRUE; is_mv = PolygonIsMonotoneVertical (pts, vertices); if (!(points = convert_vertices (pdc, pts, vertices, &pdc->rc_output))) return FALSE; pdc->cur_pixel = pdc->brushcolor; pdc->cur_ban = NULL; rc_tmp = pdc->rc_output; pdc->rc_output.right ++; pdc->rc_output.bottom ++; ENTER_DRAWING (pdc); if (rc_tmp.left == rc_tmp.right) { _dc_draw_vline_clip (pdc, rc_tmp.top, rc_tmp.bottom, rc_tmp.left); } else if (rc_tmp.top == rc_tmp.bottom) { _dc_draw_hline_clip (pdc, rc_tmp.left, rc_tmp.right, rc_tmp.top); } else { #ifdef _MGHAVE_ADV_2DAPI if (pdc->brush_type == BT_SOLID) { if (is_mv) MonotoneVerticalPolygonGenerator (pdc, points, vertices, _dc_draw_hline_clip); else PolygonGeneratorEx(pdc, points, vertices, _dc_draw_hline_clip, &pdc->rc_output); } else { if (is_mv) MonotoneVerticalPolygonGenerator (pdc, points, vertices, _dc_fill_hline_clip); else PolygonGeneratorEx(pdc, points, vertices, _dc_draw_hline_clip, &pdc->rc_output); } #else if (is_mv) MonotoneVerticalPolygonGenerator (pdc, points, vertices, _dc_draw_hline_clip); else PolygonGeneratorEx(pdc, points, vertices, _dc_draw_hline_clip, &pdc->rc_output); #endif } LEAVE_DRAWING (pdc); UNLOCK_GCRINFO (pdc); free (points); return TRUE; }
bbcf463d50e2638cfb8323c99ff477689a5b59ea
00d203cf98dcba490be1ed169116b57a2fbf9802
/src/pwconv.c
4f388d256a9cb052aacbfdba15ef37b6da027e0d
[ "BSD-3-Clause" ]
permissive
sailfishos-mirror/shadow
4c71740d06a03d78ee64f50bf7f831d62823e99a
9514a841bc90d2a8f6b66768f79c995fe77514f3
refs/heads/master
2023-09-03T19:07:59.306925
2023-08-31T13:36:20
2023-09-01T07:39:23
253,771,000
0
0
null
null
null
null
UTF-8
C
false
false
8,409
c
pwconv.c
/* * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz * SPDX-FileCopyrightText: 2002 - 2006, Tomasz Kłoczko * SPDX-FileCopyrightText: 2009 - 2012, Nicolas François * * SPDX-License-Identifier: BSD-3-Clause */ /* * pwconv - create or update /etc/shadow with information from * /etc/passwd. * * It is more like SysV pwconv, slightly different from the original Shadow * pwconv. Depends on "x" as password in /etc/passwd which means that the * password has already been moved to /etc/shadow. There is no need to move * /etc/npasswd to /etc/passwd, password files are updated using library * routines with proper locking. * * Can be used to update /etc/shadow after adding/deleting users by editing * /etc/passwd. There is no man page yet, but this program should be close * to pwconv(1M) on Solaris 2.x. * * Warning: make sure that all users have "x" as the password in /etc/passwd * before running this program for the first time on a system which already * has shadow passwords. Anything else (like "*" from old versions of the * shadow suite) will replace the user's encrypted password in /etc/shadow. * * Doesn't currently support pw_age information in /etc/passwd, and doesn't * support DBM files. Add it if you need it... * */ #include <config.h> #ident "$Id$" #include <errno.h> #include <fcntl.h> #include <pwd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <time.h> #include <unistd.h> #include <getopt.h> #include "defines.h" #include "getdef.h" #include "prototypes.h" #include "pwio.h" #include "shadowio.h" #include "nscd.h" #include "sssd.h" #include "shadowlog.h" /* * exit status values */ /*@-exitarg@*/ #define E_SUCCESS 0 /* success */ #define E_NOPERM 1 /* permission denied */ #define E_USAGE 2 /* invalid command syntax */ #define E_FAILURE 3 /* unexpected failure, nothing done */ #define E_MISSING 4 /* unexpected failure, passwd file missing */ #define E_PWDBUSY 5 /* passwd file(s) busy */ #define E_BADENTRY 6 /* bad shadow entry */ /* * Global variables */ const char *Prog; static bool spw_locked = false; static bool pw_locked = false; /* local function prototypes */ static void fail_exit (int status); static void usage (int status); static void process_flags (int argc, char **argv); static void fail_exit (int status) { if (pw_locked) { if (pw_unlock () == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); /* continue */ } } if (spw_locked) { if (spw_unlock () == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); /* continue */ } } exit (status); } static void usage (int status) { FILE *usageout = (E_SUCCESS != status) ? stderr : stdout; (void) fprintf (usageout, _("Usage: %s [options]\n" "\n" "Options:\n"), Prog); (void) fputs (_(" -h, --help display this help message and exit\n"), usageout); (void) fputs (_(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout); (void) fputs ("\n", usageout); exit (status); } /* * process_flags - parse the command line options * * It will not return if an error is encountered. */ static void process_flags (int argc, char **argv) { /* * Parse the command line options. */ int c; static struct option long_options[] = { {"help", no_argument, NULL, 'h'}, {"root", required_argument, NULL, 'R'}, {NULL, 0, NULL, '\0'} }; while ((c = getopt_long (argc, argv, "hR:", long_options, NULL)) != -1) { switch (c) { case 'h': usage (E_SUCCESS); /*@notreached@*/break; case 'R': /* no-op, handled in process_root_flag () */ break; default: usage (E_USAGE); } } if (optind != argc) { usage (E_USAGE); } } int main (int argc, char **argv) { const struct passwd *pw; struct passwd pwent; const struct spwd *sp; struct spwd spent; Prog = Basename (argv[0]); log_set_progname(Prog); log_set_logfd(stderr); (void) setlocale (LC_ALL, ""); (void) bindtextdomain (PACKAGE, LOCALEDIR); (void) textdomain (PACKAGE); process_root_flag ("-R", argc, argv); OPENLOG ("pwconv"); process_flags (argc, argv); #ifdef WITH_TCB if (getdef_bool("USE_TCB")) { fprintf (stderr, _("%s: can't work with tcb enabled\n"), Prog); exit (E_FAILURE); } #endif /* WITH_TCB */ if (pw_lock () == 0) { fprintf (stderr, _("%s: cannot lock %s; try again later.\n"), Prog, pw_dbname ()); fail_exit (E_PWDBUSY); } pw_locked = true; if (pw_open (O_CREAT | O_RDWR) == 0) { fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ()); fail_exit (E_MISSING); } if (spw_lock () == 0) { fprintf (stderr, _("%s: cannot lock %s; try again later.\n"), Prog, spw_dbname ()); fail_exit (E_PWDBUSY); } spw_locked = true; if (spw_open (O_CREAT | O_RDWR) == 0) { fprintf (stderr, _("%s: cannot open %s\n"), Prog, spw_dbname ()); fail_exit (E_FAILURE); } /* * Remove /etc/shadow entries for users not in /etc/passwd. */ (void) spw_rewind (); while ((sp = spw_next ()) != NULL) { if (pw_locate (sp->sp_namp) != NULL) { continue; } if (spw_remove (sp->sp_namp) == 0) { /* * This shouldn't happen (the entry exists) but... */ fprintf (stderr, _("%s: cannot remove entry '%s' from %s\n"), Prog, sp->sp_namp, spw_dbname ()); fail_exit (E_FAILURE); } (void) spw_rewind(); } /* * Update shadow entries which don't have "x" as pw_passwd. Add any * missing shadow entries. */ (void) pw_rewind (); while ((pw = pw_next ()) != NULL) { sp = spw_locate (pw->pw_name); if (NULL != sp) { /* do we need to update this entry? */ if (strcmp (pw->pw_passwd, SHADOW_PASSWD_STRING) == 0) { continue; } /* update existing shadow entry */ spent = *sp; } else { /* add new shadow entry */ bzero(&spent, sizeof spent); spent.sp_namp = pw->pw_name; spent.sp_min = getdef_num ("PASS_MIN_DAYS", -1); spent.sp_max = getdef_num ("PASS_MAX_DAYS", -1); spent.sp_warn = getdef_num ("PASS_WARN_AGE", -1); spent.sp_inact = -1; spent.sp_expire = -1; spent.sp_flag = SHADOW_SP_FLAG_UNSET; } spent.sp_pwdp = pw->pw_passwd; spent.sp_lstchg = gettime () / SCALE; if (0 == spent.sp_lstchg) { /* Better disable aging than requiring a password * change */ spent.sp_lstchg = -1; } if (spw_update (&spent) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), Prog, spw_dbname (), spent.sp_namp); fail_exit (E_FAILURE); } /* remove password from /etc/passwd */ pwent = *pw; pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */ if (pw_update (&pwent) == 0) { fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), Prog, pw_dbname (), pwent.pw_name); fail_exit (E_FAILURE); } } if (spw_close () == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ())); fail_exit (E_FAILURE); } if (pw_close () == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); fail_exit (E_FAILURE); } /* /etc/passwd- (backup file) */ errno = 0; if ((chmod (PASSWD_FILE "-", 0600) != 0) && (errno != ENOENT)) { fprintf (stderr, _("%s: failed to change the mode of %s to 0600\n"), Prog, PASSWD_FILE "-"); SYSLOG ((LOG_ERR, "failed to change the mode of %s to 0600", PASSWD_FILE "-")); /* continue */ } if (pw_unlock () == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); /* continue */ } if (spw_unlock () == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); /* continue */ } nscd_flush_cache ("passwd"); sssd_flush_cache (SSSD_DB_PASSWD); return E_SUCCESS; }
0322114ab1a4d16bcc1604665eda4b285780a627
d95c96829d1d914c092623c0348e5e1a8d908273
/src/util.c
182c900cbf51428f6b8fd07ae80dfd39be2349ea
[]
no_license
rieck/jassi
feeda93900dc4f6c13d2471aab2f2bb0e0c11e49
793640e563f531e1d9598d9a71c64d976f7966ae
refs/heads/master
2016-09-06T17:38:34.187478
2015-12-23T19:26:36
2015-12-23T19:26:36
10,995,345
4
1
null
null
null
null
UTF-8
C
false
false
2,949
c
util.c
/* * jassi - A Simple and Robust JavaScript Lexer * Copyright 2011 (c) Konrad Rieck (konrad@mlsec.org) */ /** * @defgroup util Utility functions * The module contains utility functions. * @author Konrad Rieck (konrad.rieck@tu-berlin.de) * @{ */ #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <stdarg.h> #include <errno.h> #include <string.h> #include "config.h" #include "util.h" /* External variable */ extern int verbose; /** * Loads a textual file into a string. The string is allocated * and need to be free'd later by the caller. * @param path Path to file * @param name File name or NULL * @return string data */ char *load_file(char *path, char *name) { assert(path); long len, read, i; char *x = NULL, file[512]; struct stat st; /* snprintf is not necessary thread-safe. good to know. */ if (name) snprintf(file, 512, "%s/%s", path, name); else snprintf(file, 512, "%s", path); /* Open file */ FILE *fptr = fopen(file, "r"); if (!fptr) { error("Could not open file '%s'", file); return NULL; } /* Allocate memory */ stat(file, &st); len = st.st_size; if (!(x = malloc((len + 1) * sizeof(char)))) { error("Could not allocate memory for file data"); return NULL; } /* Read data */ read = fread(x, sizeof(char), len, fptr); fclose(fptr); if (len != read) warning("Could not read all data from file '%s'", file); /* Replace null bytes by space */ for (i = 0; i < len; i++) if (x[i] == 0) x[i] = ' '; /* Terminate string */ x[len] = '\0'; return x; } /** * Loads a data from stdin into a string. The string is allocated * and need to be free'd later by the caller. * @return string data */ char *load_stdin() { long len = 0, read = 0, i; char *p, *x = NULL; /* Open file */ while(!feof(stdin)) { len += BLOCK_SIZE; x = realloc(x, len); p = x + len - BLOCK_SIZE; if (!x) { error("Could not allocate data"); return NULL; } read += fread(p, sizeof(char), BLOCK_SIZE, stdin); } /* Replace null bytes by space */ for (i = 0; i < read; i++) if (x[i] == 0) x[i] = ' '; /* Terminate string */ x[read] = '\0'; return x; } /** * Print a formated error/warning message. See the macros error and * warning in util.h * @param p Prefix string, e.g. "Error" * @param f Function name * @param m Format string */ void err_msg(char *p, const char *f, char *m, ...) { va_list ap; char s[256] = { " " }; va_start(ap, m); vsnprintf(s, 256, m, ap); va_end(ap); fprintf(stderr, "%s: %s (", p, s); if (errno) fprintf(stderr, "%s, ", strerror(errno)); fprintf(stderr, "%s)\n", f); errno = 0; } /** @} */
0239ca10bcd635083c01cae7cf80e2694dc0763d
b80920fa0c1e501d4e80d5209605fd6df1d0cc3d
/Inc/RB/RB_EXTI.h
f16bc252caaf61fc0fdc7ca0f185506824a0d466
[]
no_license
AnnaJiang1308/E2509
dc05dbc8f924bf32809c2cf7985111415e901601
ddbc504fa246f9aa78519cd68dc811f273c0e82f
refs/heads/main
2023-03-21T02:54:27.449087
2021-03-05T11:49:15
2021-03-05T11:49:15
342,019,247
0
0
null
2021-02-24T19:57:40
2021-02-24T19:57:39
null
UTF-8
C
false
false
1,291
h
RB_EXTI.h
// // RB_EXTI.h // #ifndef __RB_EXTI_H__ # define __RB_EXTI_H__ # include <Compiler.h> /// EXTI register bank. /// STM32F103 EXTernal Interrupta (EXTI). See reference manual, chapter 9 typedef struct __reg_bank_EXTI { WORD IMR; ///< Interrupt mask register. WORD EMR; ///< Event mask register. WORD RTSR; ///< Rising trigger selection register. WORD FTSR; ///< Falling trigger selection register. WORD SWIER; ///< Software interrupt event register. WORD PR; ///< Pending register. } RegisterBankEXTI; // EXTI # define INDX_EXTI_PVD 16 # define INDX_EXTI_IMR_PVD INDX_EXTI_PVD # define INDX_EXTI_EMR_PVD INDX_EXTI_PVD # define INDX_EXTI_FTSR_PVD INDX_EXTI_PVD # define INDX_EXTI_RTSR_PVD INDX_EXTI_PVD # define INDX_EXTI_PR_PVD INDX_EXTI_PVD # define MASK_EXTI_PR_PVD (1U << INDX_EXTI_PR_PVD) #endif
61a5f42d90425290ea1a7013bdc9d1add42a1b08
c25e032c23f0822f72de7d3e2b0f6eac41b8554c
/projects/choiwoo/dominion/unittest4.c
3995a30b965da4e7f50fb848ef8da5b492a62134
[]
no_license
famorted/cs362f15
864e9292bd9d5bdb07d72d064ddd4517d82fbd55
2279cdbfb5f299f9b7673078d1095e5c7c8c30a5
refs/heads/master
2020-04-01T10:05:05.231169
2016-01-02T22:01:38
2016-01-02T22:01:38
45,072,675
0
0
null
2015-10-27T22:00:24
2015-10-27T22:00:24
null
UTF-8
C
false
false
25
c
unittest4.c
//Woo Choi //unittest4.c
fe7dd7f1d32c556a5c2c1365f1b57292ae382c5b
e9fb3905a6baa65cd3765d0d6d18ebe3d2b07934
/Src/OSF/BDB/openflags.c
be9de6ca506f0d39c1f2d514530746eee92043cf
[]
no_license
Shulikov-v/OpenPapyrus
bb2e26bdff669af58a1268ef84793ff9f25bb648
272cee0df983fb1d9cb0627ac627dbb15b2800cf
refs/heads/master
2021-01-21T07:10:46.251906
2017-02-26T15:27:53
2017-02-26T15:27:53
null
0
0
null
null
null
null
UTF-8
C
false
false
1,127
c
openflags.c
/*- * See the file LICENSE for redistribution information. * * Copyright (c) 1997, 2011 Oracle and/or its affiliates. All rights reserved. * * $Id$ */ #include "db_config.h" #include "db_int.h" // @v9.5.5 #include "dbinc/db_page.h" // @v9.5.5 #include "dbinc/lock.h" // @v9.5.5 #include "dbinc/mp.h" // @v9.5.5 #include "dbinc/crypto.h" // @v9.5.5 #include "dbinc/btree.h" // @v9.5.5 #include "dbinc/hash.h" #pragma hdrstop /* * __db_openflags -- * Convert open(2) flags to DB flags. * * PUBLIC: uint32 __db_openflags(int); */ uint32 __db_openflags(int oflags) { uint32 dbflags; dbflags = 0; if(oflags&O_CREAT) dbflags |= DB_CREATE; if(oflags&O_TRUNC) dbflags |= DB_TRUNCATE; /* * !!! * Convert POSIX 1003.1 open(2) mode flags to DB flags. This isn't * an exact science as few POSIX implementations have a flag value * for O_RDONLY, it's simply the lack of a write flag. */ #ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY|O_RDWR|O_WRONLY) #endif switch(oflags&O_ACCMODE) { case O_RDWR: case O_WRONLY: break; default: dbflags |= DB_RDONLY; break; } return dbflags; }
3a08dc5e8ee82733edcfcf9fac819258ce01aea1
3a56b1155d39c8e4dfaff52f0ec2e43b64304c28
/frames/02724.c
8275bc6ae04d04778eac05c5438f75f86bcacb53
[]
no_license
RippedOrigami/GBA-Rick
6a610bde18e8dda978730b2d754565e9cdcbfe1d
0953de71ad0a392f5d3a0bcedc54d55e478925b7
refs/heads/master
2021-05-28T17:10:33.260039
2014-11-28T17:14:04
2014-11-28T17:14:04
null
0
0
null
null
null
null
UTF-8
C
false
false
7,059
c
02724.c
//{{BLOCK(_2724) //====================================================================== // // _2724, 40x40@8, // + palette 256 entries, not compressed // + 25 tiles lz77 compressed // Total size: 512 + 1608 = 2120 // // Time-stamp: 2014-11-28, 05:19:56 // Exported by Cearn's GBA Image Transmogrifier, v0.8.12 // ( http://www.coranac.com/projects/#grit ) // //====================================================================== const unsigned int _2724Tiles[402] __attribute__((aligned(4))) __attribute__((visibility("hidden")))= { 0x00064010,0x07070700,0x84021C8B,0x0600828B,0xC8021C5F,0xC8074084,0x8B076094,0xD11F008B, 0x1C5F0710,0x00D06820,0x025FF617,0xD100B024,0x845F0707,0x00D04D68,0xD6A1E59C,0xA9E1A9E1, 0x23E57600,0x0BE176A9,0x72A5002C,0xF74AE1E5,0xEA00E1A6,0xD4F7E572,0x00F7D491,0x9123E5A5, 0x7DA5B4D4,0xFAA1BE00,0xD456562C,0x057D0017,0xDEDEAAD3,0xE50070DE,0xAA0AFDE5,0x00AA2272, 0xEF0B2770,0xEA15C40B,0x2C5D2C00,0x2CC40C98,0x2788002C,0x528D0527,0x6C004F95,0x5D83A923, 0x00870C88,0x1858D388,0xA6884FFA,0xBE668700,0x95959D2F,0xFDD4006C,0xD44A727D,0x56000BD4, 0x4AAA7DD3,0x000BB476,0x66226176,0x87618741,0x6D885200,0xB5D3D35B,0x6652004E,0xF988D3A1, 0x1E004EE6,0xFD5BAA86,0x00F9C7CF,0x87AA616C,0x58C74E61,0x31C76100,0x526F614F,0xEA9D0087, 0xE541FADE,0x70003170,0x41FA2296,0x0070232E,0x96585223,0x33FD56D3,0x587DB300,0xD323FDC7, 0x52400033,0xFD17964F,0x4000DAA1,0xFDC7956C,0x0033A158,0x967D6CD0,0x77FA6166,0xD34FD000, 0xF741D3FA,0x31D00033,0xA6097070,0x9C08B3A1,0x00230909,0xF69C4007,0xC55FF601,0xBCB04D68, 0x84000700,0xBCD14DB0,0x25C5F639,0x0F004D54,0x07003939,0x900700BC,0x9CBC0F10,0xE2C52700, 0xD128BC60,0xB02F00B0,0xE3020700,0xF29C00D0,0xDF770404,0x0500CEE5,0xE5D605CA,0x000305A1, 0x878D8D5D,0x2E0566FD,0x5B5DCE00,0x3C5D8D5D,0x18D80063,0xD80A0AD8,0x2100437F,0x18D843D8, 0x00BFBF18,0xD0BFD821,0x0E9C1821,0x04336000,0x60779CB0,0x77330060,0x77DFB004,0x5E00FAA1, 0xD456B44A,0x001723F7,0x56B4FB34,0xFDA191B4,0xE1663400,0x83A951A9,0x31830083,0xDEAA3422, 0xAC0033D8,0x0A0A6DAC,0x00D03305,0x6D6D7FBF,0xD19CCA72,0x6B6BF200,0x9C776B6B,0x6BB000D1, 0x77047777,0x910222A3,0xA1A5E7A5,0xA307004A,0x51EA9100,0x62224AA6,0xD37000E7,0x7CD65BE5, 0x65005E5E,0x5B181870,0x002F3CAC,0xAC7FDC08,0x3CD918DC,0x7FB74300,0x029C937F,0x93DF008C, 0x77773377,0x9C00F2DF,0x669CF28C,0x00A94A51,0x9C9CE77D,0xD3A556FB,0x9C23A600,0xFDA1D69C, 0xCA990009,0xD898D0D0,0x6D006572,0x7FD0E343,0x00211818,0xA0E3BF7F,0x21D87F7F,0xE3820800, 0x777777E3,0xA06000F2,0x9C9CB054,0xE300D19C,0x3CB08484,0x003C3B3B,0x2F502F7B,0x3B3C3BAC, 0xBDBD2F02,0x003C63BD,0x3B043B07,0x3C3CD964,0x3B3B0900,0x2A796300,0xEEC2C2F1,0x622F00A4, 0x86146AC2,0xF1001414,0xC071DB6A,0x006E6EC0,0x71F090C2,0x1919353E,0x2FBDBD00,0x920E3C50, 0xBDB7007B,0x937BB7B7,0x3B007B93,0xAF64FFED,0x00714893,0xED642FED,0xAD48F571,0xB1F07400, 0x44471BF3,0x818F001B,0x473DA7A7,0x32002514,0x32498E49,0x00E98E5A,0x6949EB32,0x6E694B32, 0x368C9400,0x5CBDED64,0x50AF00BD,0x7BED6450,0x710064BD,0x71BBDBDB,0x00454571,0x1274FCAD, 0xDD75AD1F,0x8FDB8F00,0x80FC4735,0xD7A70044,0x258147BB,0x8E008125,0x8EAEAE19,0x001D808E, 0xAE3219CD,0x6E696E6E,0x0E94FF00,0xFFFFEDBA,0xF5FF00FF,0x94F5368C,0x7500B2F5,0xADDD1A75, 0x0016AD1F,0x3636BAFE,0x1F1FDDDD,0x19454500,0x3E759E45,0x571B0016,0x9F9F2D81,0x9E003DA7, 0x9E80800D,0x00D75335,0x0D459769,0x7474E8DD,0x633C3C00,0x08CC9A63,0xEE0080EC,0xCC9A9A63, 0x00FF94CC,0x9AB22994,0xFFBA019A,0x9A36BA00,0x3E9A9A9A,0xAFBA00A2,0x292929AF,0x5C007444, 0xC99055C1,0x00DBF0BA,0x53A4A471,0xD7C2F8E4,0xBABA7100,0xE736DDBA,0x45B10086,0xF428AEAE, 0x9F008651,0x9B9BAE47,0x008686F4,0xE949E04C,0x90903AC3,0x10F34C00,0x3F2B3A7E,0x1D2B003D, 0x4646E9E9,0x1D00F875,0x80E96EC6,0x00EBF480,0x6EC6ABC3,0xEB85148F,0xC6201D00,0x4B2538F3, 0x6E690028,0xEBF44B5A,0x9B009B4B,0xAE4B5A9B,0x00AB286E,0x4B9B3A3A,0x304910EB,0x32E97E00, 0x9EC3EB4B,0xC6E8003E,0x6EC6CB97,0x8F009E75,0x8E0D803D,0x00EDFC7E,0xDDDDBA94,0x8A5E1A75, 0xFEAD1600,0xAB3E45FE,0x20850069,0x808E6EEB,0x5A0085EB,0xE9EB6969,0x00ABC357,0x191930AE, 0xE93AF3E0,0x572B6E00,0xE946577E,0xA84600C6,0xB1B1B146,0x57006EF3,0xD79F3DA8,0x00C0E81B, 0x81813D1B,0xFEADF0D7,0xB6910180,0x0D69F0F0,0x45009E3E,0x9E13F1FC,0x00351932,0xC214B13E, 0x42459735,0x03599400,0xAF3E8003,0xAF940035,0x3544D562,0xAF0044E4,0x4490C25C,0x00444447, 0x13535C5C,0xD21BFC44,0xA25CE400,0x1B4744A2,0xA2A2001B,0x2E86A259,0x850045AF,0xD5119732, 0x007547C2,0x11CB5A5A,0xACCE036F,0x04ECEC00,0x6F2E99F2,0x069D009D,0x13B63C78,0x3700B54E, 0xF07A2673,0x001ECFA4,0xCE2637E6,0x9DB88E6E,0x8889E600,0x058E8E5B,0x26890099,0xABF46F7D, 0x190085AB,0x85B6554C,0x0020EB0F,0xA414A81D,0xC3C3AB0F,0xB9575700,0x2B3A10B9,0xD257032B, 0x00005353,0x059001F0,0x48934800,0xADFE1A48,0x93FF0075,0x8C8CBA36,0x5900BAFE,0x36AF5C50, 0x0050ED94,0xC95953B9,0xFCFC5048,0xB031F0C0,0x741A1F03,0x0014C138,0xAD751B74,0xEEC1C167, 0xFC1BDB00,0x38C17471,0xDBDB00D7,0xA7FCBB74,0x7430F038,0xB031F0DB,0x8F474403,0x1701808F, 0x3E478F59,0x00359445,0x8F535353,0x8F5C4235,0x8F2AF103,0x008F1BF0,0x80BFF00D,0x448002C0, 0x1E899D5D,0x475800C7,0x89588D47,0x58006189,0x524EFC74,0x00D42689,0x26D7F04F,0x4F26C7C7, 0x31F0E160,0x00E301B0, }; const unsigned short _2724Pal[256] __attribute__((aligned(4))) __attribute__((visibility("hidden")))= { 0x0000,0x29B0,0x0CA9,0x4E98,0x1D2C,0x4213,0x571A,0x0866, 0x256D,0x4615,0x35B0,0x6F3D,0x5AB8,0x2171,0x14EB,0x21B4, 0x3217,0x192F,0x35B4,0x4657,0x4E9A,0x6B1B,0x2971,0x5EDB, 0x2D6F,0x2DD4,0x18ED,0x3E37,0x08A8,0x3216,0x6F9E,0x212F, 0x25B3,0x252C,0x3DD2,0x4E77,0x10CA,0x5B1E,0x675B,0x5698, 0x2173,0x216F,0x3E15,0x3E79,0x5ED9,0x4EBC,0x4656,0x35D2, 0x2DF6,0x41F4,0x1D51,0x1D0B,0x3591,0x2DB3,0x1D2E,0x77BE, 0x5AFD,0x0885,0x3A39,0x31B1,0x2D90,0x4679,0x2992,0x4699, 0x14A9,0x6F7F,0x2170,0x254D,0x35F5,0x2571,0x3E38,0x31D4, 0x254F,0x29B5,0x671D,0x150F,0x4ABB,0x10EA,0x5AF9,0x5EFA, 0x35F3,0x5699,0x6B5D,0x3E36,0x0CC8,0x635F,0x62FB,0x3A37, 0x631B,0x3A15,0x1930,0x4635,0x31D3,0x4E76,0x35B2,0x0887, 0x190B,0x739F,0x4A57,0x296F,0x31B2,0x292D,0x5ABA,0x4217, 0x0CC9,0x2593,0x4E78,0x212D,0x6F7E,0x318F,0x29B4,0x52B8, 0x3DD3,0x2D92,0x39D2,0x7BFF,0x39F5,0x2150,0x62DA,0x1D0C, 0x4235,0x3E14,0x4653,0x2DB1,0x2D4F,0x673D,0x3617,0x296E, 0x31D5,0x4EBB,0x1D0A,0x3190,0x0CA8,0x1D72,0x5299,0x56B8, 0x5AD9,0x6B7C,0x2D71,0x0867,0x14EC,0x5297,0x2DD5,0x3A16, 0x52BA,0x5EBA,0x1D0D,0x212E,0x2570,0x673C,0x779F,0x1D50, 0x2D4E,0x56D9,0x258F,0x1D52,0x14CA,0x633C,0x2572,0x467A, 0x14E9,0x4A56,0x35F4,0x735F,0x4257,0x6F5E,0x6B3D,0x56DC, 0x4279,0x5277,0x39B2,0x29D5,0x2D8F,0x2550,0x2172,0x2DB2, 0x10C9,0x4238,0x2990,0x18CA,0x66FC,0x73BF,0x52BB,0x31D1, 0x4234,0x3E56,0x214F,0x31B3,0x14EA,0x31D2,0x6B5E,0x212C, 0x2D93,0x5F1E,0x4A78,0x3638,0x62F9,0x08A7,0x29B3,0x77BF, 0x10A8,0x31F3,0x3DF2,0x150E,0x258E,0x29D4,0x4655,0x56D8, 0x14C9,0x10A9,0x3A36,0x5298,0x671C,0x52B9,0x4A35,0x4658, 0x294D,0x254E,0x210C,0x3E16,0x39F2,0x1D2F,0x41F3,0x190C, 0x35F6,0x5AB9,0x10E9,0x10C8,0x31F4,0x4214,0x73BE,0x5278, 0x2993,0x31F6,0x737F,0x25B4,0x214D,0x2D91,0x4A79,0x358F, 0x4237,0x4236,0x18EB,0x3E58,0x2193,0x2970,0x0886,0x5EDA, 0x2591,0x5F1A,0x5EFB,0x62FC,0x35D4,0x56B9,0x190E,0x2991, }; //}}BLOCK(_2724)
bf7ab00310942e4a12081fff51eb72b6d09a8b1d
157efac4c5792109b8b0feb66cae6683b57a5c11
/src/TaskPool.h
5e8a31799d4862f4e10c859ea9eea59b382e45d3
[]
no_license
Raugharr/TaskPool
94b25c1627dcb9864c916ef5837788069111f969
4c31442b8bed826fc537ae1f3d02ff0d1d1311e8
refs/heads/master
2021-01-16T21:54:24.450215
2016-10-26T03:48:49
2016-10-26T03:48:49
65,261,125
0
0
null
null
null
null
UTF-8
C
false
false
1,004
h
TaskPool.h
/* * File: TaskPool.h * Author: David Brotz */ #ifndef __TASKPOOL_H #define __TASKPOOL_H #include <SDL2/SDL.h> #define TASKPOOL_SZ (1 << 11) #define TASKPOOL_MASK (TASKPOOL_SZ - 1) #define TASK_NOPARENT (-1) struct Task; typedef struct SDL_Thread SDL_Thread; typedef struct SDL_con SDL_con; typedef struct SDL_mutex SDL_mutex; typedef void(*TaskFunc)(int, void*); struct Task { TaskFunc Callback; struct Task* Parent; SDL_atomic_t UnfinishedJobs; uint8_t Padding[]; }; struct TaskQueue { struct Task** Queue; SDL_SpinLock Lock; int Front; int Back; int RandNum; unsigned int AllocSz; void* Allocator; }; struct TaskPool { struct TaskQueue* Queues; SDL_Thread** Threads; size_t DataSz; size_t TaskSz; uint8_t ThreadCt; uint8_t IsAlive; }; void InitTaskPool(); void QuitTaskPool(); /** * \note If no parent is desired use TASK_NOPARENT. */ int TaskPoolAdd(int _ParentId, TaskFunc _Callback, void* _Data, size_t _Size); void TaskPoolExecute(int _Id); void RunTasks(); #endif
f771d63d96eb28b05bf3cd0f1bb1cbb25334dc90
c7069860791c01e0be556c37ebf098ef866aaee8
/obsrd/clicmd.c
2067edc6d72938845c7067dbc0f52a31834cb769
[]
no_license
cleverfox/obsr
a0955ded5718a4c71f2b5e9252c03fe3143be275
1337be267c2a023bc247d1baf799efaa95225943
refs/heads/master
2016-09-10T00:33:16.234809
2012-09-11T11:47:44
2012-09-11T11:50:32
1,089,521
1
0
null
null
null
null
UTF-8
C
false
false
19,708
c
clicmd.c
#include <sys/types.h> #include <sys/socket.h> #include <sys/param.h> #include <netinet/in.h> #include <arpa/inet.h> #include <time.h> #include <string.h> #include <radlib.h> #include <radlib_vs.h> #include <sys/stat.h> #include <unistd.h> #include <netgraph.h> #include "obsrd.h" #include "ippool.h" #include "clicmd.h" #include "cliconfig.h" #include "log.h" #include "session.h" #include "../kernel_module/ng_obsr.h" #define LOG(loglevel, ...) LOG_WRITE(LF_CMD|loglevel, __VA_ARGS__) extern struct sessions *usessions; extern int sock[4]; extern struct ngm_connect cn; extern struct pools *pools; extern int errno; // показываем все текущие сессии int cmd_show_sessions(struct cli_client *cc, char *command, char *argv[], int argc) { if (argc != 0) { cli_print(cc, "usage:\nshow active sessions"); return CLI_OK; } cli_print(cc," %15s %15s %15s %10s %6s %s", "sessionid","LAN IP","WAN IP","Pool","SID","start"); struct usersession *us; TAILQ_FOREACH(us,&usessions->head,entries) { char lan[INET_ADDRSTRLEN]; char wan[INET_ADDRSTRLEN]; char xtime[32]; time_t t = us->start.tv_sec; strftime(xtime,32,"%Y-%m-%d %T",localtime(&t)); cli_print(cc," %15s %15s %15s %10s %6d %s", us->sessionid, inet_ntop(AF_INET,&us->lan,lan,INET_ADDRSTRLEN), inet_ntop(AF_INET,&us->wan,wan,INET_ADDRSTRLEN), us->poolname,us->sid,xtime); } cli_print(cc, "-end-of-list-"); return CLI_OK; } // убиваем сессию int cmd_close_session(struct cli_client *cc, char *command, char *argv[], int argc) { if (argc != 1 || (argc == 1 && argv[0][strlen(argv[0])-1] == '?')) { cli_print(cc, "usage:\nclose session sessionid/SID"); return CLI_OK; } // проверяем формат аргумента: у нас sid или sessionid? int is_sid; int sid; is_sid = sscanf(argv[0], "%i-%i", &sid, &sid); // пробуем найти сессию struct usersession *us; int is_killed = 0; TAILQ_FOREACH(us,&usessions->head,entries) { if((is_sid == 1 && sid == us->sid) || (us->sessionid && strcmp(us->sessionid, argv[0])==0)) { struct usersession *user_session=get_session(usessions,us->sid); if (user_session) { user_session->clear=RAD_TERM_ADMIN_RESET; struct getsession_req r; r.sid=us->sid; r.userdata=SES_UPDATE; NgSendMsg(sock[SOCK_NG], cn.path, NGM_ZZNAT_COOKIE,NGM_ZZNAT_GET_SESSION, (void *)&r, sizeof(r)); cli_print(cc, "killing session sid: %d, sessid: %s", us->sid, us->sessionid); LOG(LL_INFO,"killing session (%p) sid: %d, sessid: %s", us, us->sid, us->sessionid); is_killed = 1; } break; } } if (!is_killed) { if (is_sid == 1) { cli_print(cc, "Session with sid '%d' not found", sid); } else { cli_print(cc, "Session with sess_id '%s' not found", argv[0]); } } return CLI_OK; } int dump_log_config(struct cli_client *cc, FILE *fh){ int c=0; int d=0; if(progname){ fprintf(fh,"syslogname %s\r\n",progname); } for(;;d++){ if(log_facilities[d]==NULL) break; for(c=0;c<LOG_LEVELS;c++){ if(log_labels[c]==NULL) break; if(faclogavail[d]&(1<<c)){ if(facloglevel[d]&(1<<c)){ fprintf(fh,"loglevel %s %s\r\n",log_facilities[d],log_labels[c]); }else{ fprintf(fh,"loglevel %s %s no\r\n",log_facilities[d],log_labels[c]); } } } if(!faclog2syslog[d]){ fprintf(fh,"syslog %s no\r\n",log_facilities[d]); }else{ for(c=0;;c++){ if(syslog_facility[c].c_name==NULL) break; if(syslog_facility[c].c_val==faclog2syslog[d]){ fprintf(fh,"syslog %s %s\r\n",log_facilities[d],syslog_facility[c].c_name); break; } } } } return CLI_OK; } void config_generator_2cli(struct cli_client* cli,FILE* fh,char* string){ cli_print(cli,"%s",string); } // показываем конфиги int cmd_show_config(struct cli_client *cc, char *command, char *argv[], int argc) { dump_running_config(cc, cc->client); #if 0 int showmask=0xffff; if(argc==1){ int p=0; int slen=strlen(argv[0]); while(config_sections[p].name!=NULL){ if(strncasecmp(argv[0],config_sections[p].name,slen)==0){ showmask=(1<<config_sections[p].mask); break; } p++; } } #endif cli_print(cc, "#-end-of-config-"); return CLI_OK; } // сохраняем конфиги int cmd_save_config(struct cli_client *cc, char *command, char *argv[], int argc) { if (argc == 1 && argv[0][strlen(argv[0])-1] == '?') { cli_print(cc, "usage:\nsave config [filename]"); return CLI_OK; } char * config_name; char resolved_path[PATH_MAX + 1]; config_name = (argc == 0)?"obsr.conf":argv[0]; config_name = realpath(config_name, resolved_path);; if (!config_name) { cli_print(cc, "invalid config name. GURU meditation 0x0003"); return CLI_ERROR; } // sanity check. пока сохраняем конфиги только в текущую директорию char *working_dir; if((working_dir = getwd(NULL)) == NULL) { cli_print(cc, "internal error. GURU meditation 0x0006"); return CLI_ERROR; } if (strncmp(working_dir, config_name, strlen(working_dir))) { cli_print(cc, "ERROR: you can save configs only to current dir"); if (working_dir) free(working_dir); if (config_name) free(config_name); return CLI_ERROR; } if (working_dir) free(working_dir); cli_print(cc, "saving configs to '%s'", config_name); FILE *fh; if (!(fh = fopen(config_name, "w"))) { // для errorstr не нужно делать free char * errorstr = strerror(errno); cli_print(cc, "can't write config: %s", errorstr); if (config_name) free(config_name); return CLI_ERROR; } dump_running_config(cc, fh); fclose(fh); cli_print(cc, "done"); return CLI_OK; } // добавляем pool ip адресов int cmd_pool_add(struct cli_client *cc, char *command, char *argv[], int argc) { char * pool_name; if ((argc!=2 && argc!=3)|| argv[0][strlen(argv[0])-1] == '?') { cli_print(cc, "usage:\npool add first_ip last_ip [pool_name]"); return CLI_OK; } // проверяем валидность аргументов struct in_addr xip; struct in_addr yip; if (!inet_aton(argv[0], &xip)) { cli_print(cc, "invalid ip address: '%s'", argv[0]); return CLI_OK; } if (!inet_aton(argv[1], &yip)) { cli_print(cc, "invalid ip address: '%s'", argv[1]); return CLI_OK; } pool_name = (argc==3)?argv[2]:"default"; struct ippool *p = get_pool(pools, pool_name); if (!p) { cli_print(cc, "can't find pool '%s'", pool_name); return CLI_OK; } cli_print(cc, "pool %s: added %d ips\n", pool_name, pool_add_range(p, xip, yip)); return CLI_OK; } // показывает пул ip адресов int cmd_show_pool(struct cli_client *cc, char *command, char *argv[], int argc) { if (argc > 1 || (argc == 1 && argv[0][strlen(argv[0])-1] == '?')) { cli_print(cc, "usage:\nshow pool [name]"); return CLI_OK; } char *pool_name; pool_name = (argc==0)? "default" : argv[0]; struct ippool *pool = get_pool(pools, pool_name); if (!pool) { cli_print(cc, "pool '%s' not found", pool_name); return CLI_OK; } long used_ips = 0; long sessions = 0; long allocated = 0; struct in_addr one_ip; if(inet_aton("0.0.0.1",&one_ip)!=1) { cli_print(cc, "internal error: guru meditation 0x0001"); return CLI_OK; } struct in_addr last_ip; struct in_addr pool_from_ip; struct ip_entry *e; last_ip.s_addr = 0; TAILQ_FOREACH(e,&pool->head,entries){ used_ips++; if (e->sess) sessions++; if (e->allocated) allocated++; struct in_addr next_ip; next_ip.s_addr = last_ip.s_addr + one_ip.s_addr; if (last_ip.s_addr == 0) { pool_from_ip.s_addr = e->ip.s_addr; last_ip.s_addr = e->ip.s_addr; continue; } if (next_ip.s_addr != e->ip.s_addr) { char pool_from[16]; char pool_to[16]; inet_ntoa_r(pool_from_ip, pool_from, sizeof(pool_from)); inet_ntoa_r(last_ip, pool_to, sizeof(pool_to)); cli_print(cc, "pool %s: %s - %s", pool_name, pool_from, pool_to); pool_from_ip.s_addr = e->ip.s_addr; } last_ip.s_addr = e->ip.s_addr; } if (last_ip.s_addr != 0) { char pool_from[16]; char pool_to[16]; inet_ntoa_r(pool_from_ip, pool_from, sizeof(pool_from)); inet_ntoa_r(last_ip, pool_to, sizeof(pool_to)); cli_print(cc, "pool %s: %s - %s", pool_name, pool_from, pool_to); } cli_print(cc, "pool %s: size=%ld allocated=%ld sessions=%ld\n", pool_name, used_ips, allocated, sessions); return CLI_OK; } // Прописываем ip'шник нашего сервака. int cmd_this_server(struct cli_client *cc, char *command, char *argv[], int argc) { if (argc > 1 || (argc == 1 && argv[0][strlen(argv[0])-1] == '?')) { cli_print(cc, "usage:\nthis server ip_address"); return CLI_OK; } if (!inet_aton(argv[0], &global_config->thisserver)) { cli_print(cc, "invalid argument: %s\nEPIC FAIL. can't configure ip address of this server", argv[0]); return CLI_ERROR; } if (!global_config->initial_boot) { cli_print(cc, "This is boot only command! You must save config now and restart the daemon"); } return CLI_OK; } int cmd_radius_config(struct cli_client *cc, char *command, char *argv[], int argc) { if (argc > 1 || (argc == 1 && argv[0][strlen(argv[0])-1] == '?')) { cli_print(cc, "usage:\nradius config file_name"); return CLI_OK; } if (!global_config->initial_boot) { cli_print(cc, "This is boot only command!"); return CLI_ERROR; } // проверяем существование файла struct stat tmp; if (stat(argv[0], &tmp)) { perror("can't stat radius config"); return CLI_ERROR; } global_config->radius_config = strdup(argv[0]); return CLI_OK; } int cmd_radius_client(struct cli_client *cc, char *command, char *argv[], int argc) { if (argc >2 || (argc == 1 && argv[0][strlen(argv[0])-1] == '?')) { cli_print(cc, "usage:\nradius client ip_address password"); return CLI_OK; } struct in_addr tmp; // проверяем валидность адреса if (!inet_aton(argv[0], &tmp)) { cli_print(cc, "invalid argument: %s\nEPIC FAIL. can't configure ip address of radius client", argv[0]); return CLI_ERROR; } struct radius_client *rad = NULL; rad = malloc(sizeof(struct radius_client)); if (!rad) { cli_print(cc, "out of memory in cmd_radius_client"); return CLI_ERROR; } rad->client = strdup(argv[0]); rad->password = strdup(argv[1]); TAILQ_INSERT_TAIL(&global_config->radius_head, rad, entries); return CLI_OK; } // удаляем из пула один или несколько ip адресов int cmd_pool_remove(struct cli_client *cc, char *command, char *argv[], int argc) { if ((argc<1 || argc>3)|| argv[0][strlen(argv[0])-1] == '?') { cli_print(cc, "usage:\npool remove first_ip [last_ip] [pool_name]"); return CLI_OK; } // проверяем валидность аргументов struct in_addr xip; struct in_addr yip; struct ippool *pool = NULL; xip.s_addr = 0; yip.s_addr = 0; // первый аргумент -- ip'шник, он есть всегда if (!inet_aton(argv[0], &xip)) { cli_print(cc, "invalid ip address: '%s'", argv[0]); return CLI_OK; } // еще могут быть 2 необязательных аргумента switch(argc) { case 2: // в качестве второго аргумента может быть last_ip или pool_name // сначала попробуем интерпретировать второй аргумент как ip адрес if (!inet_aton(argv[1], &yip)) { // теперь как pool name pool = get_pool(pools, argv[1]); if (!pool) { cli_print(cc, "invalid argument: '%s' is nether ip address nor pool name", argv[1]); return CLI_ERROR; } } break; // если передано 3 аргумента, то 2-й -- ip адрес, 3-й аргумент -- pool_name case 3: if (!inet_aton(argv[1], &yip)) { cli_print(cc, "invalid ip address: '%s'", argv[1]); return CLI_ERROR; } pool = get_pool(pools, argv[2]); if (!pool) { cli_print(cc, "invalid pool name '%s'", argv[2]); return CLI_ERROR; } break; default: break; } if (!pool) { pool = get_pool(pools, "default"); if (!pool) { cli_print(cc, "can't get default pool. GURU meditation code #0007"); return CLI_ERROR; } } if (yip.s_addr && xip.s_addr > yip.s_addr) { cli_print(cc, "invalid ip range: from '%s' to '%s'", argv[0], argv[1]); return CLI_ERROR; } if (!yip.s_addr) yip.s_addr = xip.s_addr; struct in_addr tmpip; int ip_count = 0; if(yip.s_addr<=xip.s_addr) { tmpip.s_addr = xip.s_addr; xip.s_addr = yip.s_addr; yip.s_addr = tmpip.s_addr; } struct ip_entry *e; int has_locked = 0; TAILQ_FOREACH(e,&pool->head,entries) { if(e->ip.s_addr >= xip.s_addr && e->ip.s_addr <= yip.s_addr) { char tmp[16]; inet_ntoa_r(e->ip, tmp, sizeof(tmp)); if (e->sess) { e->mark_for_remove = 1; cli_print(cc, "active session (id '%s') for ip '%s'. Address marked for future removing\n", e->sess->sessionid, tmp); LOG_WRITE(LF_IPPOOL|LL_INFO,"active session (id '%s') for ip '%s'. Address marked for future removing", e->sess->sessionid, tmp); has_locked = 1; } else { // LOG(LL_INFO,"remove ip address %s from pool '%s'", tmp, pool->name); ip_count++; pool->members--; pool->free--; TAILQ_REMOVE(&pool->head, e, entries); free(e); } } } cli_print(cc, "removed %d addresses%s", ip_count, has_locked?" (some ips is locked by openned sessions)":""); return CLI_OK; } int cmd_show_allocated(struct cli_client *cc, char *command, char *argv[], int argc) { if (argc > 1 || (argc == 1 && argv[0][strlen(argv[0])-1] == '?')) { cli_print(cc, "usage:\nshow alloacated [pool_name]"); return CLI_OK; } // sanity check struct ippool *pool = get_pool(pools, argc==1?argv[0]:"default"); if (!pool) { if (argc==1) { cli_print(cc, "can't locate pool '%s'", argv[0]); } else { cli_print(cc, "Internal error. Can't locate pool 'default'. GURU meditation code #0008"); } return CLI_ERROR; } cli_print(cc, "allocated addresses for pool %s:", pool->name); LOG(LL_INFO,"allocated addreses for pool %s:", pool->name); struct ip_entry *e; TAILQ_FOREACH(e,&pool->head,entries) { if (e->allocated) { char tmp[16]; inet_ntoa_r(e->ip, tmp, sizeof(tmp)); if (e->sess) { LOG(LL_INFO,"%s ip %p session %p session_id %s sid %d", tmp, e, e->sess, e->sess->sessionid, e->sess->sid); cli_print(cc, "%s session_id %s", tmp, e->sess->sessionid); } else { LOG(LL_INFO,"%s ip %p session NULL", tmp, e); cli_print(cc, "%s (NULL session)", tmp); } } } cli_print(cc, "-end-of-list-"); return CLI_OK; } int cmd_log_ippool(struct cli_client *cc, char *command, char *argv[], int argc) { if (argc != 1 || (argc == 1 && argv[0][strlen(argv[0])-1] == '?')) { cli_print(cc, "usage:\nlog ippool log_level"); return CLI_OK; } return CLI_OK; } int cmd_log_session(struct cli_client *cc, char *command, char *argv[], int argc) { if (argc != 1 || (argc == 1 && argv[0][strlen(argv[0])-1] == '?')) { cli_print(cc, "usage:\nlog session log_level"); return CLI_OK; } return CLI_OK; } int cmd_log_set(struct cli_client *cli, char *command, char *argv[], int argc) { int res=CLI_OK; int i=0; int fac=0; char* f=index(command,' '); f++; char* s=index(f,' '); *s=0; s++; int c=0; for(;;c++) { if(log_facilities[c]==NULL) break; if(strcmp(f,log_facilities[c])==0) { fac=c; } } for(c=0;;c++) { if(log_labels[c]==NULL) break; if(strcmp(s,log_labels[c])==0) { i=(1<<c); } } if(argc>0 && strncasecmp("no",argv[0],2)==0) { facloglevel[fac]&=~i; } else { facloglevel[fac]|=i; } return res; } int cmd_syslog_set(struct cli_client *cli, char *command, char *argv[], int argc) { int res=CLI_OK; int fac=0; char* f=index(command,' '); f++; char* s=index(f,' '); *s=0; s++; int c=0; for(c=0;;c++) { if(log_facilities[c]==NULL) break; if(strcmp(f,log_facilities[c])==0) fac=c; } if(strcmp(s,"no")==0) { faclog2syslog[fac]=0; } else { for(c=0;;c++) { if(syslog_facility[c].c_name==NULL) break; if(strcmp(s,syslog_facility[c].c_name)==0) { faclog2syslog[fac]=syslog_facility[c].c_val; break; } } } return res; } int cmd_set_logname(struct cli_client *cli, char *command, char *argv[], int argc) { if(argc<1) { cli_print(cli, " syslogname <filename>"); return CLI_ERROR; } char* oprog=progname; progname=strdup(argv[0]); if(oprog) free(oprog); openlog(progname,LOG_PID,lastfac); return CLI_OK; }
8d28bf12969d3f551325f8389a5427d0f872a970
fabe99681059e802cf836e038fb16977c90e558c
/slas/raw/scary/scaryamos/scary.c
307e99704194dbbfae8e5d1d2d2c8d0cf6f9f0ca
[]
no_license
Thanh-Truong/aqit
641fcea0e608ee9f197bbb8535b764c4094dc3d1
729c403f756766668373474686de896e9aac8fe0
refs/heads/master
2022-11-23T07:14:06.010667
2020-07-28T11:50:54
2020-07-28T11:50:54
280,381,212
0
0
null
null
null
null
UTF-8
C
false
false
7,810
c
scary.c
#include "scary.h" /*Clear the 1st bit of the status*/ unsigned char get_slots(unsigned char *pa) { return (unsigned char)(*pa & ~((1<<7))); } /*Return if the array is compressed or not*/ unsigned char is_compressed(unsigned char *pa) { return (unsigned char)(*pa & (1 << 7)); } /*Return if the array is compressed or not*/ void clear_compressed(unsigned char *pa) { *pa = (unsigned char)(*pa & ~(1 << 7)); } /*Set array is compressed*/ void set_compressed(unsigned char *pa) { *pa = (unsigned char)(*pa | (1 << 7)); } /*Increase slots*/ void increase_slots(unsigned char *pa){ unsigned char compressed = (unsigned char)(*pa & (1<<7)); unsigned slots = get_slots(pa); *pa = slots + 1; if (compressed != 0) { set_compressed(pa); } } /*Move to values array*/ unsigned int* values_array(unsigned char *pa) { return (unsigned int*)(pa + DESC_STATUS_SIZE + DESC_POINTER_SIZE); } /*Preva is previous array of newa*/ void link_previous(unsigned char* newa, unsigned char* preva) { memcpy(newa + DESC_STATUS_SIZE, &preva, DESC_POINTER_SIZE); } /*Get previous array of pa and put it into preva*/ void get_previous(unsigned char* pa, unsigned char** preva) { memcpy(preva, pa + DESC_STATUS_SIZE, DESC_POINTER_SIZE); } /*====================================================================== Public API ======================================================================== */ struct Scary* scary_create(unsigned int arraysize) { if ((arraysize % 32) == 0) { // Allocate head struct Scary* head; _scary_block_size_ = 32; head= (struct Scary*) malloc(sizeof(*head)); head->arraysize = arraysize; head->count = 1; // Here pa is a pointer of unsigned char. It enables accessing // any byte gned char status = *(pa + DESC_STATUS_SIZE); allocate_array(head->pa, arraysize); return head; } return NULL; } /*- In: Add new (unsigned int) into a linked list of compressed array, representing by head _ _ _ _ _ | len | Head _ _ _ _ | | pre,pa| --> #(1 2 3 4 5 6 . . . ) | | | |_ |_ _ | | | \/ _ _ _ _ _ | len | _ _ _ _ | | pre,pa| --> #(1 2 3 4 5 6 . . . ) | | | |_ |_ _ | | | \/ NIL Case a) if Head.pa still has space - insert the new arriving element - Check b) b) if Head.pa is full -b.1 Compress Head.pa using PFORDELTA algorithm -b.2 Reclaim the unused space -b.3 Update Head.len = actual size used by Head.pa -b.4 Make a new Scary node newScarynode _b.5 Update the new head newScaryNode.id = head.id + 1; newScaryNode.prev = Head Head = newScaryNode Return Head - Out: Return a new head if compression was taken place */ void compress_array(struct Scary *head, unsigned int arraysize){ unsigned char *ca; // compressed array unsigned int newsize; printf("======compress======= "); allocate_array(ca, arraysize); // compress newsize = compress_pfordelta(values_array(head->pa), values_array(ca), arraysize, _scary_block_size_); // reallocate to shrinking the unused space ca = (unsigned char *) realloc(ca, newsize * sizeof(unsigned int) + DESC_STATUS_SIZE + DESC_POINTER_SIZE); // copy it status memcpy(ca, head->pa, DESC_STATUS_SIZE + DESC_POINTER_SIZE); printf("Status (slots %u , compressed %u)\n", get_slots(ca), is_compressed(ca)); // free uncompressed array free(head->pa); head->pa = ca; // update status set_compressed(ca); } struct Scary* scary_insert(struct Scary* head, unsigned int element) { if (head != NULL) { unsigned char slots = get_slots(head->pa); unsigned int *vla = values_array(head->pa); unsigned int arraysize = head->arraysize; unsigned char *newa; if (slots < arraysize) { //printf("Before vla[%u]= %u ", slots, vla[slots]); vla[slots] = element; //printf("After vla[%u] = %u", slots, vla[slots]); if (slots == arraysize - 1) { // Pro-active compression + spawn // Array is full ( slot 127 --> 0) printf(" Array is full !!\n"); // Compress array, head->pa points to a new compressed array compress_array(head, arraysize); // Spawn a new array allocate_array(newa, arraysize); // link them link_previous(newa, head->pa); head->pa = newa; head->count++; } else { increase_slots(head->pa); } } } return head; } /*Release all pointers, space occuppied by scary*/ void array_release(unsigned char*pa) { unsigned char**prev; prev = (unsigned char**) malloc(sizeof(unsigned char*)); get_previous(pa, prev); free(pa); if (prev != NULL) { array_release(*prev); } free(prev); } void scary_release(struct Scary* head) { if (head != NULL) { unsigned char * pa = head->pa; free(head); if (pa != NULL) { array_release(pa); } } } /*Print out the linked list of compressed array*/ void array_print(unsigned char* pa, int headcount) { unsigned char **prev = malloc(sizeof(unsigned char*)); printf("[Array #%d ", headcount); if (is_compressed(pa)) { printf(" Compressed"); } else { printf(" Uncompressed"); } printf(" used slots: %d] \n", get_slots(pa)); get_previous(pa, prev); if (prev != NULL && *prev != NULL) { printf(" |\n"); printf(" | \n"); array_print(*prev, headcount - 1); } free(prev); } /*Print out the linked list of compressed array in the reversed order which they were inserted*/ void scary_print(struct Scary* head) { if (head != NULL && head->pa != NULL) { printf("|--------| \n"); printf("| SCARY | \n"); printf("|--------| \n"); printf(" |\n"); printf(" | \n"); array_print(head->pa, head->count); } } /*Get element at index. This operation will unpack the compressed array Options a) - should we KEEP the uncompressed array and DISCARD the compressed array ? b) - should we DISCARD the uncompressed array and KEEP the compressed array? 2013 - 09 -26 I go with option a */ void decompress_array(unsigned char *pa, unsigned char *output, unsigned int arraysize) { unsigned int decompsize; memcpy(output, pa, DESC_STATUS_SIZE + DESC_POINTER_SIZE); printf("Decompressed \n"); decompsize = decompress_pfordelta(values_array(pa), values_array(output), arraysize, _scary_block_size_); clear_compressed(output); //free(pa); // no longer needed } int scary_get(struct Scary* head, unsigned int index){ unsigned int value = -1; if (head != NULL) { int arrayindex = index / head->arraysize; int remainder = index - (arrayindex * head->arraysize); unsigned char* pa = head->pa; // Pointer to array whose position == arrayindex unsigned char**prev = (unsigned char**) malloc(sizeof(unsigned char*)); int prevpos = head->count - 2;// If there is 1 array, prevpos --> -1 get_previous(pa, prev); // If there is 1 array, prev -->NULL while(prevpos > arrayindex && prev != NULL && *prev !=NULL){ prevpos --; pa = *prev; get_previous(pa, prev); } // The top array is always uncompressed, just return value if (prevpos < arrayindex) { value = values_array(pa)[remainder]; } else if (is_compressed(*prev)) { unsigned char *output; allocate_array(output, head->arraysize); decompress_array(*prev, output, head->arraysize); get_previous(pa, prev); free(*prev); link_previous(pa, output); get_previous(pa, prev); value = values_array(output)[remainder]; } else { value = values_array(*prev)[remainder]; } free(prev); } return value; }
5db1f010c9966e6031f337149626c26eb0d81766
9eb2245869dcc3abd3a28c6064396542869dab60
/benchspec/CPU/507.cactuBSSN_r/build/build_base_mytest-64.0000/include/iobasicGH.h
a5b464a0d957087cf2c424484892cbbfa87410e7
[]
no_license
lapnd/CPU2017
882b18d50bd88e0a87500484a9d6678143e58582
42dac4b76117b1ba4a08e41b54ad9cfd3db50317
refs/heads/master
2023-03-23T23:34:58.350363
2021-03-24T10:01:03
2021-03-24T10:01:03
null
0
0
null
null
null
null
UTF-8
C
false
false
2,236
h
iobasicGH.h
/*@@ @header iobasicGH.h @date Friday 18th September 1999 @author Gabrielle Allen @desc The extensions to the GH structure from IOBasic. @enddesc @version $Header$ @@*/ #ifndef _IOBASIC_IOBASICGH_H_ #define _IOBASIC_IOBASICGH_H_ 1 #include "StoreNamedData.h" typedef struct IOBASIC_REDUCTION { int handle; char *name; char is_valid; CCTK_REAL value; struct IOBASIC_REDUCTION *next; } iobasic_reduction_t; typedef struct IOBASIC_REDUCTIONLIST { unsigned int num_reductions; iobasic_reduction_t *reductions; } iobasic_reductionlist_t; typedef struct IOBASIC_PARSEINFO { const char *reductions_string; iobasic_reductionlist_t *reduction_list; } iobasic_parseinfo_t; typedef struct IOBASIC_GH { /* how often to output */ int outScalar_every, outInfo_every; CCTK_REAL outScalar_dt, outInfo_dt; char info_reductions_changed; /* directory in which to place scalar output */ char *out_dir; /* The last iteration output */ int *outInfo_last, *outScalar_last; /* The reduction lists for info and scalar output for all variables */ iobasic_reductionlist_t *info_reductions, *scalar_reductions; /* database for names of output files that were already created */ pNamedData *filenameListScalar; /* stop on I/O parameter parsing errors ? */ int stop_on_parse_errors; } iobasicGH; /* prototypes of functions to be registered */ int IOBasic_InfoOutputGH (const cGH *GH); int IOBasic_OutputVarAs (const cGH *GH, const char *fullname,const char *alias); int IOBasic_TriggerInfoOutput (const cGH *GH, int vindex); int IOBasic_TimeForInfoOutput (const cGH *GH, int vindex); int IOBasic_ScalarOutputGH (const cGH *GH); int IOBasic_TriggerScalarOutput (const cGH *GH, int vindex); int IOBasic_TimeForScalarOutput (const cGH *GH, int vindex); /* other function prototypes */ void IOBasic_AssignReductionList (int vindex, const char *optstring, void *arg); int IOBasic_WriteInfo (const cGH *GH, int vindex); int IOBasic_WriteScalar (const cGH *GH, int vindex, const char *alias); void IOBasic_CheckSteerableInfoParameters (iobasicGH *myGH); void IOBasic_CheckSteerableScalarParameters (iobasicGH *myGH); #endif /* _IOBASIC_IOBASICGH_H_ */
bc874ecf04e9b15d62f0ff52d0b828940d97f091
e9fd1b631c3ca976b4bcea6694652effcf0026c6
/wx/wx-dev/usr/local/include/wx-2.8/wx/module.h
aac907768ecbd2fc5ea92d8fcdaf226ac296821d
[]
no_license
msgpo/tinycore
aa309ded0304702b05690cdbf3146a6ffc80df74
3a858f6afba503b65b0f65582f97e6a250779e71
refs/heads/master
2021-06-18T21:17:21.852395
2011-12-27T10:33:19
2011-12-27T10:33:19
null
0
0
null
null
null
null
UTF-8
C
false
false
27
h
module.h
/tmp/wx/include/wx/module.h
da798a9e73cec6a2a9e12a3e69027d1ddef927cc
1fabbdfd1ca9ea1b6808893e12bd907eb74de414
/xcode/Classes/Native/UnityEngine_UnityEngine_SocialPlatforms_Impl_AchievementMethodDeclarations.h
5ca4f6912407a6e4058a67f6d6ad9270961a37cb
[]
no_license
Klanly/TutorialPackageClient
6f889e96c40ab13c97d107708ae8f3c71a484301
b9d61ba2f287c491c9565b432f852980ec3fee28
refs/heads/master
2020-12-03T01:42:35.256114
2016-11-01T02:40:21
2016-11-01T02:40:21
null
0
0
null
null
null
null
UTF-8
C
false
false
2,620
h
UnityEngine_UnityEngine_SocialPlatforms_Impl_AchievementMethodDeclarations.h
#pragma once #include <stdint.h> #include <assert.h> #include <exception> #include "codegen/il2cpp-codegen.h" // UnityEngine.SocialPlatforms.Impl.Achievement struct Achievement_t7447; // System.String struct String_t; // System.DateTime #include "mscorlib_System_DateTime.h" // System.Void UnityEngine.SocialPlatforms.Impl.Achievement::.ctor(System.String,System.Double,System.Boolean,System.Boolean,System.DateTime) void Achievement__ctor_m51539 (Achievement_t7447 * __this, String_t* ___id, double ___percentCompleted, bool ___completed, bool ___hidden, DateTime_t1171 ___lastReportedDate, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void UnityEngine.SocialPlatforms.Impl.Achievement::.ctor(System.String,System.Double) void Achievement__ctor_m51540 (Achievement_t7447 * __this, String_t* ___id, double ___percent, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void UnityEngine.SocialPlatforms.Impl.Achievement::.ctor() void Achievement__ctor_m51541 (Achievement_t7447 * __this, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String UnityEngine.SocialPlatforms.Impl.Achievement::ToString() String_t* Achievement_ToString_m51542 (Achievement_t7447 * __this, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String UnityEngine.SocialPlatforms.Impl.Achievement::get_id() String_t* Achievement_get_id_m51543 (Achievement_t7447 * __this, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void UnityEngine.SocialPlatforms.Impl.Achievement::set_id(System.String) void Achievement_set_id_m51544 (Achievement_t7447 * __this, String_t* ___value, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Double UnityEngine.SocialPlatforms.Impl.Achievement::get_percentCompleted() double Achievement_get_percentCompleted_m51545 (Achievement_t7447 * __this, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void UnityEngine.SocialPlatforms.Impl.Achievement::set_percentCompleted(System.Double) void Achievement_set_percentCompleted_m51546 (Achievement_t7447 * __this, double ___value, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean UnityEngine.SocialPlatforms.Impl.Achievement::get_completed() bool Achievement_get_completed_m51547 (Achievement_t7447 * __this, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean UnityEngine.SocialPlatforms.Impl.Achievement::get_hidden() bool Achievement_get_hidden_m51548 (Achievement_t7447 * __this, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.DateTime UnityEngine.SocialPlatforms.Impl.Achievement::get_lastReportedDate() DateTime_t1171 Achievement_get_lastReportedDate_m51549 (Achievement_t7447 * __this, MethodInfo* method) IL2CPP_METHOD_ATTR;
350f323a77ea11a14a284d0310e8ea9ae8a94d95
825a5d93151d2337d82c36dedc49935cd7971896
/src/unuran-src/methods/pinv_struct.h
60821b35122f656f575f55eb5139c20f0ed78a35
[]
no_license
cran/Runuran
bb5c9300d236fb9ad149e9f79ef849f186940778
3a7d1e7409fe97a4ac272e571698bc9984e3f506
refs/heads/master
2023-01-24T19:12:22.159869
2023-01-17T12:10:02
2023-01-17T12:10:02
17,693,454
1
0
null
null
null
null
UTF-8
C
false
false
1,165
h
pinv_struct.h
/* Copyright (c) 2000-2023 Wolfgang Hoermann and Josef Leydold */ /* Department of Statistics and Mathematics, WU Wien, Austria */ struct unur_pinv_par { int order; int smooth; double u_resolution; double bleft; double bright; int sleft; int sright; int max_ivs; int n_extra_testpoints; }; struct unur_pinv_interval { double *ui; double *zi; double xi; double cdfi; #ifdef UNUR_COOKIES unsigned cookie; #endif }; struct unur_pinv_gen { int order; int *guide; int guide_size; double Umax; double u_resolution; int n_extra_testpoints; int smooth; double bleft; double bright; struct unur_pinv_interval *iv; int n_ivs; int max_ivs; double bleft_par; double bright_par; double dleft; double dright; int sleft; int sright; double area; struct unur_lobatto_table *aCDF; };