// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: engine_go
void engine_go(char *filename, char *weightfile, int mcts_iters, float secs, float temp, float cpuct, int anon, int resign)
{
    mcts_tree *root = 0;
    network *net = load_network(filename, weightfile, 0);
    set_batch_network(net, 1);
    srand(time(0));
    float *board = calloc(19*19*3, sizeof(float));
    flip_board(board);
    float *one = calloc(19*19*3, sizeof(float));
    float *two = calloc(19*19*3, sizeof(float));
    int ponder_player = 0;
    int passed = 0;
    int move_num = 0;
    int main_time = 0;
    int byo_yomi_time = 0;
    int byo_yomi_stones = 0;
    int black_time_left = 0;
    int black_stones_left = 0;
    int white_time_left = 0;
    int white_stones_left = 0;
    float orig_time = secs;
    int old_ponder = 0;
    while(1){
        if(ponder_player){
            root = ponder(root, net, board, two, ponder_player, cpuct);
        }
        old_ponder = ponder_player;
        ponder_player = 0;
        char buff[256];
        int id = 0;
        int has_id = (scanf("%d", &id) == 1);
        scanf("%s", buff);
        if (feof(stdin)) break;
        fprintf(stderr, "%s\n", buff);
        char ids[256];
        sprintf(ids, "%d", id);
        //fprintf(stderr, "%s\n", buff);
        if (!has_id) ids[0] = 0;
        if (!strcmp(buff, "protocol_version")){
            printf("=%s 2\n\n", ids);
        } else if (!strcmp(buff, "name")){
            if(anon){
                printf("=%s The Fool!\n\n", ids);
            }else{
                printf("=%s DarkGo\n\n", ids);
            }
        } else if (!strcmp(buff, "time_settings")){
            ponder_player = old_ponder;
            scanf("%d %d %d", &main_time, &byo_yomi_time, &byo_yomi_stones);
            printf("=%s \n\n", ids);
        } else if (!strcmp(buff, "time_left")){
            ponder_player = old_ponder;
            char color[256];
            int time = 0, stones = 0;
            scanf("%s %d %d", color, &time, &stones);
            if (color[0] == 'b' || color[0] == 'B'){
                black_time_left = time;
                black_stones_left = stones;
            } else {
                white_time_left = time;
                white_stones_left = stones;
            }
            printf("=%s \n\n", ids);
        } else if (!strcmp(buff, "version")){
            if(anon){
                printf("=%s :-DDDD\n\n", ids);
            }else {
                printf("=%s 1.0. Want more DarkGo? You can find me on OGS, unlimited games, no waiting! https://online-go.com/user/view/434218\n\n", ids);
            }
        } else if (!strcmp(buff, "known_command")){
            char comm[256];
            scanf("%s", comm);
            int known = (!strcmp(comm, "protocol_version") || 
                    !strcmp(comm, "name") || 
                    !strcmp(comm, "version") || 
                    !strcmp(comm, "known_command") || 
                    !strcmp(comm, "list_commands") || 
                    !strcmp(comm, "quit") || 
                    !strcmp(comm, "boardsize") || 
                    !strcmp(comm, "clear_board") || 
                    !strcmp(comm, "komi") || 
                    !strcmp(comm, "final_status_list") || 
                    !strcmp(comm, "play") || 
                    !strcmp(comm, "genmove_white") || 
                    !strcmp(comm, "genmove_black") || 
                    !strcmp(comm, "fixed_handicap") || 
                    !strcmp(comm, "genmove"));
            if(known) printf("=%s true\n\n", ids);
            else printf("=%s false\n\n", ids);
        } else if (!strcmp(buff, "list_commands")){
            printf("=%s protocol_version\nshowboard\nname\nversion\nknown_command\nlist_commands\nquit\nboardsize\nclear_board\nkomi\nplay\ngenmove_black\ngenmove_white\ngenmove\nfinal_status_list\nfixed_handicap\n\n", ids);
        } else if (!strcmp(buff, "quit")){
            break;
        } else if (!strcmp(buff, "boardsize")){
            int boardsize = 0;
            scanf("%d", &boardsize);
            //fprintf(stderr, "%d\n", boardsize);
            if(boardsize != 19){
                printf("?%s unacceptable size\n\n", ids);
            } else {
                root = move_mcts(root, -1);
                memset(board, 0, 3*19*19*sizeof(float));
                flip_board(board);
                move_num = 0;
                printf("=%s \n\n", ids);
            }
        } else if (!strcmp(buff, "fixed_handicap")){
            int handicap = 0;
            scanf("%d", &handicap);
            int indexes[] = {72, 288, 300, 60, 180, 174, 186, 66, 294};
            int i;
            for(i = 0; i < handicap; ++i){
                board[indexes[i]] = 1;   
                ++move_num;
            }
            root = move_mcts(root, -1);
        } else if (!strcmp(buff, "clear_board")){
            passed = 0;
            memset(board, 0, 3*19*19*sizeof(float));
            flip_board(board);
            move_num = 0;
            root = move_mcts(root, -1);
            printf("=%s \n\n", ids);
        } else if (!strcmp(buff, "komi")){
            float komi = 0;
            scanf("%f", &komi);
            printf("=%s \n\n", ids);
        } else if (!strcmp(buff, "showboard")){
            printf("=%s \n", ids);
            print_board(stdout, board, 1, 0);
            printf("\n");
        } else if (!strcmp(buff, "play") || !strcmp(buff, "black") || !strcmp(buff, "white")){
            ++move_num;
            char color[256];
            if(!strcmp(buff, "play"))
            {
                scanf("%s ", color);
            } else {
                scanf(" ");
                color[0] = buff[0];
            }
            char c;
            int r;
            int count = scanf("%c%d", &c, &r);
            int player = (color[0] == 'b' || color[0] == 'B') ? 1 : -1;
            if((c == 'p' || c == 'P') && count < 2) {
                passed = 1;
                printf("=%s \n\n", ids);
                char *line = fgetl(stdin);
                free(line);
                fflush(stdout);
                fflush(stderr);
                root = move_mcts(root, 19*19);
                continue;
            } else {
                passed = 0;
            }
            if(c >= 'A' && c <= 'Z') c = c - 'A';
            if(c >= 'a' && c <= 'z') c = c - 'a';
            if(c >= 8) --c;
            r = 19 - r;
            fprintf(stderr, "move: %d %d\n", r, c);

            float *swap = two;
            two = one;
            one = swap;
            move_go(board, player, r, c);
            copy_cpu(19*19*3, board, 1, one, 1);
            if(root) fprintf(stderr, "Prior: %f\n", root->prior[r*19 + c]);
            if(root) fprintf(stderr, "Mean: %f\n", root->mean[r*19 + c]);
            if(root) fprintf(stderr, "Result: %f\n", root->result);
            root = move_mcts(root, r*19 + c);
            if(root) fprintf(stderr, "Visited: %d\n", root->total_count);
            else fprintf(stderr, "NOT VISITED\n");

            printf("=%s \n\n", ids);
            //print_board(stderr, board, 1, 0);
        } else if (!strcmp(buff, "genmove") || !strcmp(buff, "genmove_black") || !strcmp(buff, "genmove_white")){
            ++move_num;
            int player = 0;
            if(!strcmp(buff, "genmove")){
                char color[256];
                scanf("%s", color);
                player = (color[0] == 'b' || color[0] == 'B') ? 1 : -1;
            } else if (!strcmp(buff, "genmove_black")){
                player = 1;
            } else {
                player = -1;
            }
            if(player > 0){
                if(black_time_left <= 30) secs = 2.5;
                else secs = orig_time;
            } else {
                if(white_time_left <= 30) secs = 2.5;
                else secs = orig_time;
            }
            ponder_player = -player;

            //tree = generate_move(net, player, board, multi, .1, two, 1);
            double t = what_time_is_it_now();
            root = run_mcts(root, net, board, two, player, mcts_iters, cpuct, secs);
            fprintf(stderr, "%f Seconds\n", what_time_is_it_now() - t);
            move m = pick_move(root, temp, player);
            root = move_mcts(root, m.row*19 + m.col);


            if(move_num > resign && m.value < .1 && m.mcts < .1){
                printf("=%s resign\n\n", ids);
            } else if(m.row == 19){
                printf("=%s pass\n\n", ids);
                passed = 0;
            } else {
                int row = m.row;
                int col = m.col;

                float *swap = two;
                two = one;
                one = swap;

                move_go(board, player, row, col);
                copy_cpu(19*19*3, board, 1, one, 1);
                row = 19 - row;
                if (col >= 8) ++col;
                printf("=%s %c%d\n\n", ids, 'A' + col, row);
            }

        } else if (!strcmp(buff, "p")){
            //print_board(board, 1, 0);
        } else if (!strcmp(buff, "final_status_list")){
            char type[256];
            scanf("%s", type);
            fprintf(stderr, "final_status\n");
            char *line = fgetl(stdin);
            free(line);
            if(type[0] == 'd' || type[0] == 'D'){
                int i;
                FILE *f = fopen("game.txt", "w");
                int count = print_game(board, f);
                fprintf(f, "%s final_status_list dead\n", ids);
                fclose(f);
                FILE *p = popen("./gnugo --mode gtp < game.txt", "r");
                for(i = 0; i < count; ++i){
                    free(fgetl(p));
                    free(fgetl(p));
                }
                char *l = 0;
                while((l = fgetl(p))){
                    printf("%s\n", l);
                    free(l);
                }
            } else {
                printf("?%s unknown command\n\n", ids);
            }
        } else if (!strcmp(buff, "kgs-genmove_cleanup")){
            char type[256];
            scanf("%s", type);
            fprintf(stderr, "kgs-genmove_cleanup\n");
            char *line = fgetl(stdin);
            free(line);
            int i;
            FILE *f = fopen("game.txt", "w");
            int count = print_game(board, f);
            fprintf(f, "%s kgs-genmove_cleanup %s\n", ids, type);
            fclose(f);
            FILE *p = popen("./gnugo --mode gtp < game.txt", "r");
            for(i = 0; i < count; ++i){
                free(fgetl(p));
                free(fgetl(p));
            }
            char *l = 0;
            while((l = fgetl(p))){
                printf("%s\n", l);
                free(l);
            }
        } else {
            char *line = fgetl(stdin);
            free(line);
            printf("?%s unknown command\n\n", ids);
        }
        fflush(stdout);
        fflush(stderr);
    }
    printf("%d %d %d\n",passed, black_stones_left, white_stones_left);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x398, %rsp            # imm = 0x398
movl %r8d, 0x68(%rsp)
movl %ecx, 0x3c(%rsp)
movss %xmm2, 0x40(%rsp)
movss %xmm1, 0x64(%rsp)
movss %xmm0, 0x5c(%rsp)
movl %edx, 0x60(%rsp)
xorl %edx, %edx
callq 0x22658
pushq $0x1
popq %rsi
movq %rax, 0x78(%rsp)
movq %rax, %rdi
callq 0x22f00
xorl %edi, %edi
callq 0x32c0
movl %eax, %edi
callq 0x3220
pushq $0x4
popq %rbx
movl $0x43b, %edi            # imm = 0x43B
movq %rbx, %rsi
callq 0x3250
movq %rax, 0x20(%rsp)
movq %rax, %rdi
callq 0x3a26f
movl $0x43b, %edi            # imm = 0x43B
movq %rbx, %rsi
callq 0x3250
movq %rax, 0x50(%rsp)
movl $0x43b, %edi            # imm = 0x43B
movq %rbx, %rsi
callq 0x3250
leaq 0x74(%rsp), %rcx
andl $0x0, (%rcx)
leaq 0x70(%rsp), %rcx
andl $0x0, (%rcx)
leaq 0x6c(%rsp), %rcx
andl $0x0, (%rcx)
movq %rax, %rbx
leaq 0x16313(%rip), %r15     # 0x51c43
leaq 0x290(%rsp), %rbp
movl $0x0, 0x38(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x0, 0x34(%rsp)
movl $0x0, 0x2c(%rsp)
movq $0x0, 0x10(%rsp)
movl $0x0, 0x1c(%rsp)
xorl %r14d, %r14d
xorl %r12d, %r12d
testl %r14d, %r14d
je 0x3b995
movq %r12, %rdi
movq 0x78(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %rbx, %rcx
movl %r14d, %r8d
movss 0x40(%rsp), %xmm0
callq 0x3b7c4
movq %rax, %r12
andl $0x0, 0x44(%rsp)
movq %r15, %rdi
leaq 0x44(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movl %eax, %r13d
leaq 0x14018(%rip), %rdi     # 0x4f9cb
movq %rbp, %rsi
xorl %eax, %eax
callq 0x33f0
movq 0x28614(%rip), %rax     # 0x63fd8
movq (%rax), %rdi
callq 0x3290
testl %eax, %eax
jne 0x3c7a1
movq 0x2861d(%rip), %rax     # 0x63ff8
movq (%rax), %rdi
leaq 0x14015(%rip), %rsi     # 0x4f9fa
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3270
movl 0x44(%rsp), %edx
leaq 0x90(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x3420
cmpl $0x1, %r13d
je 0x3ba13
movb $0x0, 0x90(%rsp)
movq %rbp, %rdi
leaq 0x15aa5(%rip), %rsi     # 0x514c2
pushq $0x11
popq %rdx
callq 0x3330
testl %eax, %eax
leaq 0x15bff(%rip), %r13     # 0x5162d
je 0x3baa7
movq %rbp, %rdi
leaq 0x15aa1(%rip), %rsi     # 0x514db
pushq $0x5
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3bab6
movq %rbp, %rdi
leaq 0x15aad(%rip), %rsi     # 0x514fd
pushq $0xe
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3bad0
movq %rbp, %rdi
leaq 0x15ab5(%rip), %rsi     # 0x5151b
pushq $0xa
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3baef
movq 0x290(%rsp), %r15
movabsq $0x6e6f6973726576, %rax # imm = 0x6E6F6973726576
cmpq %rax, %r15
jne 0x3bb73
cmpl $0x0, 0x3c(%rsp)
je 0x3bd56
xorl %r14d, %r14d
leaq 0x15a8c(%rip), %rdi     # 0x5152e
jmp 0x3c01e
xorl %r14d, %r14d
leaq 0x15a22(%rip), %rdi     # 0x514d3
jmp 0x3c01e
cmpl $0x0, 0x3c(%rsp)
je 0x3bb64
xorl %r14d, %r14d
leaq 0x15a15(%rip), %rdi     # 0x514e0
jmp 0x3c01e
leaq 0x15a34(%rip), %rdi     # 0x5150b
leaq 0x74(%rsp), %rsi
leaq 0x70(%rsp), %rdx
leaq 0x6c(%rsp), %rcx
xorl %eax, %eax
callq 0x33f0
jmp 0x3bb58
andl $0x0, 0xc(%rsp)
andl $0x0, 0x8(%rsp)
leaq 0x15a25(%rip), %rdi     # 0x51525
leaq 0x190(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x33f0
movb 0x190(%rsp), %al
andb $-0x21, %al
cmpb $0x42, %al
movl 0xc(%rsp), %eax
movl 0x8(%rsp), %ecx
movl 0x38(%rsp), %edx
cmovnel %ecx, %edx
movl %edx, 0x38(%rsp)
movl 0x28(%rsp), %edx
cmovnel %eax, %edx
movl %edx, 0x28(%rsp)
movl 0x34(%rsp), %edx
cmovel %ecx, %edx
movl %edx, 0x34(%rsp)
movl 0x2c(%rsp), %ecx
cmovel %eax, %ecx
movl %ecx, 0x2c(%rsp)
leaq 0x159b5(%rip), %rdi     # 0x51514
jmp 0x3c01e
xorl %r14d, %r14d
leaq 0x15982(%rip), %rdi     # 0x514f0
jmp 0x3c01e
movq %rbp, %rdi
leaq 0x15a37(%rip), %rsi     # 0x515b4
pushq $0xe
popq %r14
movq %r14, %rdx
callq 0x3330
testl %eax, %eax
je 0x3bd65
movq %rbp, %rdi
leaq 0x15a27(%rip), %rsi     # 0x515c2
movq %r14, %rdx
callq 0x3330
testl %eax, %eax
pushq $0x6
popq %r13
je 0x3bf2c
movq %rbp, %rdi
leaq 0x15a17(%rip), %rsi     # 0x515d0
pushq $0x5
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3c7a1
movq %rbp, %rdi
leaq 0x15a02(%rip), %rsi     # 0x515d5
pushq $0xa
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3bf3b
movq %rbp, %rdi
leaq 0x15a31(%rip), %rsi     # 0x5161e
pushq $0xf
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3bfa0
movq %rbp, %rdi
leaq 0x159d8(%rip), %rsi     # 0x515df
pushq $0xc
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3c05d
movq %rbp, %rdi
leaq 0x159ca(%rip), %rsi     # 0x515eb
pushq $0x5
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3c0b6
movq %rbp, %rdi
leaq 0x15ad5(%rip), %rsi     # 0x51710
pushq $0xa
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3c0dc
movq %rbp, %rdi
leaq 0x1540b(%rip), %rsi     # 0x51060
pushq $0x5
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3c139
movq %rbp, %rdi
leaq 0x159a9(%rip), %rsi     # 0x51618
movq %r13, %rdx
callq 0x3330
testl %eax, %eax
je 0x3c11b
movq %rbp, %rdi
leaq 0x15981(%rip), %rsi     # 0x5160a
movq %r13, %rdx
callq 0x3330
testl %eax, %eax
je 0x3c11b
movabsq $0x65766f6d6e6567, %rax # imm = 0x65766F6D6E6567
cmpq %rax, %r15
je 0x3c396
movq %rbp, %rdi
leaq 0x1595a(%rip), %rsi     # 0x51610
movq %r14, %rdx
callq 0x3330
movl 0x2c(%rsp), %ecx
pushq $0x1
popq %rdx
testl %eax, %eax
je 0x3c3cc
movq %rbp, %rdi
leaq 0x1592b(%rip), %rsi     # 0x51602
movq %r14, %rdx
callq 0x3330
movl 0x28(%rsp), %ecx
pushq $-0x1
popq %rdx
testl %eax, %eax
je 0x3c3cc
xorl %r14d, %r14d
cmpw $0x70, %r15w
je 0x3c02d
movq %rbp, %rdi
leaq 0x158ea(%rip), %rsi     # 0x515f0
pushq $0x12
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3c584
movq %rbp, %rdi
leaq 0x15ac4(%rip), %rsi     # 0x517e4
pushq $0x14
popq %rdx
callq 0x3330
testl %eax, %eax
je 0x3c697
movq 0x282a1(%rip), %rax     # 0x63fd8
movq (%rax), %rdi
callq 0x3d32
movq %rax, %rdi
callq 0x3040
xorl %r14d, %r14d
leaq 0x15a7d(%rip), %rdi     # 0x517ce
jmp 0x3c01e
xorl %r14d, %r14d
leaq 0x157db(%rip), %rdi     # 0x5153b
jmp 0x3c01e
leaq 0x13c5f(%rip), %rdi     # 0x4f9cb
leaq 0x190(%rsp), %r15
movq %r15, %rsi
xorl %eax, %eax
callq 0x33f0
movq %r15, %rdi
leaq 0x1573a(%rip), %rsi     # 0x514c2
pushq $0x11
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x15736(%rip), %rsi     # 0x514db
pushq $0x5
popq %rdx
callq 0x3330
testl %eax, %eax
sete %al
movq 0x190(%rsp), %r14
movabsq $0x6e6f6973726576, %rcx # imm = 0x6E6F6973726576
cmpq %rcx, %r14
sete %cl
orb %al, %cl
movq %r13, %rdi
jne 0x3c01b
movq %r15, %rdi
leaq 0x157d5(%rip), %rsi     # 0x515b4
pushq $0xe
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x157c6(%rip), %rsi     # 0x515c2
pushq $0xe
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x157b7(%rip), %rsi     # 0x515d0
pushq $0x5
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x1579f(%rip), %rsi     # 0x515d5
pushq $0xa
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x1578c(%rip), %rsi     # 0x515df
pushq $0xc
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x1577b(%rip), %rsi     # 0x515eb
pushq $0x5
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x15763(%rip), %rsi     # 0x515f0
pushq $0x12
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x151b6(%rip), %rsi     # 0x51060
pushq $0x5
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x1573b(%rip), %rsi     # 0x51602
pushq $0xe
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x1572c(%rip), %rsi     # 0x51610
pushq $0xe
popq %rdx
callq 0x3330
movq %r13, %rdi
testl %eax, %eax
je 0x3c01b
movq %r15, %rdi
leaq 0x1571d(%rip), %rsi     # 0x5161e
pushq $0xf
popq %rdx
callq 0x3330
movabsq $0x65766f6d6e6567, %rcx # imm = 0x65766F6D6E6567
cmpq %rcx, %r14
leaq 0x1571b(%rip), %rdi     # 0x51638
cmoveq %r13, %rdi
testl %eax, %eax
cmoveq %r13, %rdi
jmp 0x3c01b
xorl %r14d, %r14d
leaq 0x1570e(%rip), %rdi     # 0x51644
jmp 0x3c01e
andl $0x0, 0x190(%rsp)
leaq 0x15cf9(%rip), %rdi     # 0x51c43
leaq 0x190(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
cmpl $0x13, 0x190(%rsp)
jne 0x3c014
movq %r12, %rdi
callq 0x3a82e
movq $0x0, 0x10(%rsp)
movl $0x10ec, %edx           # imm = 0x10EC
movq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x31c0
movq %r14, %rdi
callq 0x3a26f
leaq 0x15579(%rip), %rdi     # 0x51514
xorl %r12d, %r12d
jmp 0x3c01b
andl $0x0, 0x190(%rsp)
leaq 0x15c94(%rip), %rdi     # 0x51c43
leaq 0x190(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movl 0x190(%rsp), %eax
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
leaq (,%rax,4), %rcx
xorl %edx, %edx
leaq 0x15940(%rip), %r8      # 0x51920
cmpq %rdx, %rcx
je 0x3bffb
movslq (%rdx,%r8), %rsi
movq 0x20(%rsp), %rdi
movl $0x3f800000, (%rdi,%rsi,4) # imm = 0x3F800000
addq $0x4, %rdx
jmp 0x3bfe0
movq 0x10(%rsp), %rcx
addl %eax, %ecx
movq %rcx, 0x10(%rsp)
movq %r12, %rdi
callq 0x3a82e
jmp 0x3c0a8
leaq 0x156dd(%rip), %rdi     # 0x516f8
xorl %r14d, %r14d
leaq 0x90(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movq %rbx, %r15
movq 0x27f99(%rip), %rax     # 0x63fd0
movq (%rax), %rdi
callq 0x3310
movq 0x27fb2(%rip), %rax     # 0x63ff8
movq (%rax), %rdi
callq 0x3310
movq %r15, %rbx
leaq 0x15beb(%rip), %r15     # 0x51c43
jmp 0x3b96f
movq $0x0, 0x10(%rsp)
movl $0x10ec, %edx           # imm = 0x10EC
movq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x31c0
movq %r14, %rdi
callq 0x3a26f
movq %r12, %rdi
callq 0x3a82e
leaq 0x15483(%rip), %rdi     # 0x51514
leaq 0x90(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movl $0x0, 0x1c(%rsp)
xorl %r14d, %r14d
movq %rbx, %r15
xorl %r12d, %r12d
jmp 0x3c030
andl $0x0, 0x190(%rsp)
xorl %r14d, %r14d
leaq 0x13964(%rip), %rdi     # 0x4fa2c
leaq 0x190(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
jmp 0x3bb58
xorl %r14d, %r14d
leaq 0x15634(%rip), %rdi     # 0x5171a
leaq 0x90(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movq 0x27ed4(%rip), %rax     # 0x63fd0
movq (%rax), %rdi
movq 0x20(%rsp), %rsi
pushq $0x1
popq %rdx
xorl %ecx, %ecx
callq 0x3a0b6
pushq $0xa
popq %rdi
callq 0x3060
jmp 0x3c02d
leaq 0x1524c(%rip), %rdi     # 0x5136e
xorl %eax, %eax
callq 0x33f0
movb 0x290(%rsp), %al
movb %al, 0x190(%rsp)
jmp 0x3c14f
leaq 0x155e0(%rip), %rdi     # 0x51720
leaq 0x190(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movq 0x10(%rsp), %rax
incl %eax
movq %rax, 0x10(%rsp)
leaq 0x155c2(%rip), %rdi     # 0x51724
leaq 0x8(%rsp), %rsi
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x33f0
movb 0x190(%rsp), %dl
andb $-0x21, %dl
xorl %ecx, %ecx
cmpb $0x42, %dl
sete %dl
movb 0x8(%rsp), %sil
cmpl $0x1, %eax
leaq 0x15aaf(%rip), %r15     # 0x51c43
jg 0x3c208
movl %esi, %eax
andb $-0x21, %al
cmpb $0x50, %al
jne 0x3c208
xorl %r14d, %r14d
leaq 0x1536c(%rip), %rdi     # 0x51514
leaq 0x90(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movq 0x27e1a(%rip), %rax     # 0x63fd8
movq (%rax), %rdi
callq 0x3d32
movq %rax, %rdi
callq 0x3040
movq 0x27dfb(%rip), %rax     # 0x63fd0
movq (%rax), %rdi
callq 0x3310
movq 0x27e14(%rip), %rax     # 0x63ff8
movq (%rax), %rdi
callq 0x3310
movq %r12, %rdi
movl $0x169, %esi            # imm = 0x169
callq 0x3b04e
movq %rax, %r12
pushq $0x1
popq %rax
movl %eax, 0x1c(%rsp)
jmp 0x3b96f
leal -0x41(%rsi), %eax
cmpb $0x19, %al
ja 0x3c215
movb %al, 0x8(%rsp)
movl %eax, %esi
leal -0x61(%rsi), %eax
cmpb $0x1a, %al
movzbl %sil, %edi
movzbl %al, %eax
cmovael %edi, %eax
setae %dil
cmpb $0x8, %al
setl %r8b
testb %r8b, %dil
jne 0x3c242
cmpb $0x8, %al
setge %sil
subb %sil, %al
movb %al, 0x8(%rsp)
movl %eax, %esi
movb %dl, %cl
pushq $0x13
popq %rdx
subl 0xc(%rsp), %edx
leal -0x1(,%rcx,2), %r14d
movl %edx, 0xc(%rsp)
movq 0x27d9a(%rip), %r13     # 0x63ff8
movq (%r13), %rdi
movsbl %sil, %ecx
leaq 0x154bc(%rip), %rsi     # 0x51729
xorl %eax, %eax
callq 0x3270
movl 0xc(%rsp), %edx
movsbl 0x8(%rsp), %ecx
movq 0x20(%rsp), %r15
movq %r15, %rdi
movl %r14d, %esi
movq %r13, %r14
callq 0x3a4b9
movl $0x43b, %edi            # imm = 0x43B
movq %r15, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
movl %edx, %r8d
callq 0x1b5a3
testq %r12, %r12
je 0x3c31d
movq (%r14), %rdi
movq 0x10(%r12), %rax
movslq 0xc(%rsp), %rcx
imulq $0x13, %rcx, %rcx
movsbq 0x8(%rsp), %rdx
addq %rcx, %rdx
cvtss2sd (%rax,%rdx,4), %xmm0
leaq 0x15465(%rip), %rsi     # 0x51736
movb $0x1, %al
callq 0x3270
movq (%r14), %rdi
movq 0x28(%r12), %rax
movslq 0xc(%rsp), %rcx
imulq $0x13, %rcx, %rcx
movsbq 0x8(%rsp), %rdx
addq %rcx, %rdx
cvtss2sd (%rax,%rdx,4), %xmm0
leaq 0x15443(%rip), %rsi     # 0x51741
movb $0x1, %al
callq 0x3270
movq (%r14), %rdi
cvtss2sd 0x3c(%r12), %xmm0
leaq 0x15435(%rip), %rsi     # 0x5174b
movb $0x1, %al
callq 0x3270
imull $0x13, 0xc(%rsp), %eax
movsbl 0x8(%rsp), %esi
addl %eax, %esi
movq %r12, %rdi
callq 0x3b04e
movq %rax, %r12
movq (%r14), %rcx
testq %rax, %rax
jne 0x3c350
leaq 0x15414(%rip), %rdi     # 0x51757
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
callq 0x3440
jmp 0x3c366
movl 0x38(%r12), %edx
movq %rcx, %rdi
leaq 0x150e9(%rip), %rsi     # 0x51448
xorl %eax, %eax
callq 0x3270
movl $0x0, 0x1c(%rsp)
leaq 0x1519f(%rip), %rdi     # 0x51514
leaq 0x90(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
xorl %r14d, %r14d
movq 0x50(%rsp), %r15
movq %rbx, 0x50(%rsp)
jmp 0x3c030
leaq 0x1362e(%rip), %rdi     # 0x4f9cb
leaq 0x190(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movb 0x190(%rsp), %al
andb $-0x21, %al
xorl %edx, %edx
cmpb $0x42, %al
sete %dl
movl 0x28(%rsp), %ecx
cmovel 0x2c(%rsp), %ecx
leal -0x1(,%rdx,2), %edx
movss 0x14f54(%rip), %xmm0    # 0x51328
movss %xmm0, 0x80(%rsp)
cmpl $0x1f, %ecx
jl 0x3c3f1
movss 0x5c(%rsp), %xmm0
movss %xmm0, 0x80(%rsp)
movq 0x10(%rsp), %rax
incl %eax
movl %eax, 0x30(%rsp)
movl %edx, %r14d
negl %r14d
xorl %eax, %eax
movl %edx, %r13d
callq 0x3bc0
movsd %xmm0, 0x48(%rsp)
movq %r12, %rdi
movq 0x78(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %rbx, %rcx
movl %r13d, %r8d
movl 0x60(%rsp), %r9d
movss 0x40(%rsp), %xmm0
movss 0x80(%rsp), %xmm1
callq 0x3af25
movq %rax, %r15
movq 0x27bb0(%rip), %rax     # 0x63ff8
movq (%rax), %r12
xorl %eax, %eax
callq 0x3bc0
subsd 0x48(%rsp), %xmm0
movq %r12, %rdi
leaq 0x1606d(%rip), %rsi     # 0x524cf
movb $0x1, %al
callq 0x3270
movq %r15, %rdi
movss 0x64(%rsp), %xmm0
movl %r13d, 0x58(%rsp)
movl %r13d, %esi
callq 0x3b089
movaps %xmm0, 0x80(%rsp)
movq %rax, %r13
imull $0x13, %r13d, %esi
movq %rax, 0x48(%rsp)
shrq $0x20, %r13
addl %r13d, %esi
movq %r15, %rdi
callq 0x3b04e
movaps 0x80(%rsp), %xmm2
movq %rax, %r12
movq 0x10(%rsp), %rax
cmpl 0x68(%rsp), %eax
jl 0x3c4e9
cvtss2sd %xmm2, %xmm0
movsd 0x1310c(%rip), %xmm1    # 0x4f5d0
ucomisd %xmm0, %xmm1
jbe 0x3c4e9
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
cvtss2sd %xmm2, %xmm0
movsd 0x130f6(%rip), %xmm1    # 0x4f5d0
ucomisd %xmm0, %xmm1
jbe 0x3c4e9
leaq 0x1527d(%rip), %rdi     # 0x51764
jmp 0x3c502
movq 0x48(%rsp), %rdx
cmpl $0x13, %edx
jne 0x3c51f
movl $0x0, 0x1c(%rsp)
leaq 0x1526f(%rip), %rdi     # 0x51771
leaq 0x90(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movl 0x30(%rsp), %eax
movq %rax, 0x10(%rsp)
jmp 0x3c02d
movq 0x20(%rsp), %r15
movq %r15, %rdi
movl 0x58(%rsp), %esi
movl %r13d, %ecx
callq 0x3a4b9
movl $0x43b, %edi            # imm = 0x43B
movq %r15, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
movl %edx, %r8d
callq 0x1b5a3
pushq $0x13
popq %rcx
subl 0x48(%rsp), %ecx
xorl %eax, %eax
cmpl $0x8, %r13d
setge %al
leal (%rax,%r13), %edx
addl $0x41, %edx
leaq 0x15215(%rip), %rdi     # 0x5177c
leaq 0x90(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movl 0x30(%rsp), %eax
movq %rax, 0x10(%rsp)
jmp 0x3c387
leaq 0x13440(%rip), %rdi     # 0x4f9cb
leaq 0x190(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movq 0x27a57(%rip), %rax     # 0x63ff8
movq (%rax), %rcx
leaq 0x151dc(%rip), %rdi     # 0x51787
pushq $0xd
popq %rsi
pushq $0x1
popq %rdx
callq 0x3440
movq 0x27a1b(%rip), %rax     # 0x63fd8
movq (%rax), %rdi
callq 0x3d32
movq %rax, %rdi
callq 0x3040
movb 0x190(%rsp), %al
andb $-0x21, %al
cmpb $0x44, %al
jne 0x3bd4a
leaq 0x151e0(%rip), %rdi     # 0x517c5
leaq 0x15bfb(%rip), %rsi     # 0x521e7
callq 0x3390
movq %rax, %r15
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x3b635
movl %eax, %r13d
movq %r15, %rdi
leaq 0x15187(%rip), %rsi     # 0x51795
leaq 0x90(%rsp), %rdx
xorl %eax, %eax
callq 0x3270
movq %r15, %rdi
movl %r13d, %r15d
callq 0x3130
leaq 0x15181(%rip), %rdi     # 0x517b0
leaq 0x156b3(%rip), %rsi     # 0x51ce9
callq 0x3380
movq %rax, %r13
testl %r15d, %r15d
movl $0x0, %eax
cmovlel %eax, %r15d
subl $0x1, %r15d
jb 0x3c685
movq %r13, %rdi
callq 0x3d32
movq %rax, %rdi
callq 0x3040
movq %r13, %rdi
callq 0x3d32
movq %rax, %rdi
callq 0x3040
jmp 0x3c64a
movq %rax, %r15
movq %rax, %rdi
callq 0x30b0
movq %r15, %rdi
callq 0x3040
movq %r13, %rdi
callq 0x3d32
testq %rax, %rax
jne 0x3c672
jmp 0x3c02d
leaq 0x1332d(%rip), %rdi     # 0x4f9cb
leaq 0x190(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movq 0x27944(%rip), %rax     # 0x63ff8
movq (%rax), %rcx
leaq 0x1513a(%rip), %rdi     # 0x517f8
pushq $0x14
popq %rsi
pushq $0x1
popq %rdx
callq 0x3440
movq 0x27908(%rip), %rax     # 0x63fd8
movq (%rax), %rdi
callq 0x3d32
movq %rax, %rdi
callq 0x3040
leaq 0x150de(%rip), %rdi     # 0x517c5
leaq 0x15af9(%rip), %rsi     # 0x521e7
callq 0x3390
movq %rax, %r15
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x3b635
movl %eax, %r13d
movq %r15, %rdi
leaq 0x150fd(%rip), %rsi     # 0x5180d
leaq 0x90(%rsp), %rdx
leaq 0x190(%rsp), %rcx
xorl %eax, %eax
callq 0x3270
movq %r15, %rdi
movl %r13d, %r15d
callq 0x3130
leaq 0x15077(%rip), %rdi     # 0x517b0
leaq 0x155a9(%rip), %rsi     # 0x51ce9
callq 0x3380
movq %rax, %r13
testl %r15d, %r15d
movl $0x0, %eax
cmovlel %eax, %r15d
subl $0x1, %r15d
jb 0x3c78f
movq %r13, %rdi
callq 0x3d32
movq %rax, %rdi
callq 0x3040
movq %r13, %rdi
callq 0x3d32
movq %rax, %rdi
callq 0x3040
jmp 0x3c754
movq %rax, %r15
movq %rax, %rdi
callq 0x30b0
movq %r15, %rdi
callq 0x3040
movq %r13, %rdi
callq 0x3d32
testq %rax, %rax
jne 0x3c77c
jmp 0x3c02d
leaq 0x15bbb(%rip), %rdi     # 0x52363
movl 0x1c(%rsp), %esi
movl 0x34(%rsp), %edx
movl 0x38(%rsp), %ecx
xorl %eax, %eax
callq 0x3160
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq