// File: /workspace/github_c_makefile_star2_O3/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 $0x3b8, %rsp            # imm = 0x3B8
movl %r8d, 0x70(%rsp)
movl %ecx, 0x48(%rsp)
movss %xmm2, 0x44(%rsp)
movss %xmm1, 0x6c(%rsp)
movss %xmm0, 0x64(%rsp)
movl %edx, 0x68(%rsp)
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x316bc
movq %rax, 0x88(%rsp)
movq %rax, %rdi
movl $0x1, %esi
callq 0x320a7
xorl %edi, %edi
callq 0x32c0
movl %eax, %edi
callq 0x3220
movl $0x43b, %edi            # imm = 0x43B
movl $0x4, %esi
callq 0x3250
movq %rax, %r12
movss 0xda5e(%rip), %xmm2     # 0x55008
movss (%r12,%rbx,4), %xmm0
movss 0x5a4(%r12,%rbx,4), %xmm1
movss %xmm1, (%r12,%rbx,4)
movss %xmm0, 0x5a4(%r12,%rbx,4)
movaps %xmm2, %xmm0
subss 0xb48(%r12,%rbx,4), %xmm0
movss %xmm0, 0xb48(%r12,%rbx,4)
incq %rbx
cmpq $0x169, %rbx            # imm = 0x169
jne 0x475aa
movl $0x43b, %edi            # imm = 0x43B
movl $0x4, %esi
callq 0x3250
movq %rax, 0x50(%rsp)
movl $0x43b, %edi            # imm = 0x43B
movl $0x4, %esi
callq 0x3250
movq %rax, %r13
xorl %eax, %eax
leaq 0x7c(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x78(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x74(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x13752(%rip), %rbx     # 0x5ad83
leaq 0x1b0(%rsp), %rbp
movl $0x0, 0x40(%rsp)
movl $0x0, 0x30(%rsp)
movl $0x0, 0x3c(%rsp)
movl $0x0, 0x34(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x0, 0x2c(%rsp)
xorl %r14d, %r14d
movq $0x0, 0x10(%rsp)
testl %r14d, %r14d
jne 0x478a7
movl $0x0, 0x4c(%rsp)
movq %rbx, %rdi
leaq 0x4c(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movl %eax, %r15d
leaq 0x113db(%rip), %rdi     # 0x58a7b
movq %rbp, %rsi
xorl %eax, %eax
callq 0x33f0
movq 0x24927(%rip), %rax     # 0x6bfd8
movq (%rax), %rdi
callq 0x3290
testl %eax, %eax
jne 0x4853b
movq 0x24930(%rip), %rax     # 0x6bff8
movq (%rax), %rdi
leaq 0x113d8(%rip), %rsi     # 0x58aaa
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3270
movl 0x4c(%rsp), %edx
leaq 0x2b0(%rsp), %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3420
cmpl $0x1, %r15d
je 0x47700
movb $0x0, 0x2b0(%rsp)
movq 0x1b8(%rsp), %rax
movabsq $0x6e6f69737265765f, %rcx # imm = 0x6E6F69737265765F
xorq %rcx, %rax
movq 0x1b0(%rsp), %rcx
movabsq $0x6c6f636f746f7270, %rdx # imm = 0x6C6F636F746F7270
xorq %rdx, %rcx
movzbl 0x1c0(%rsp), %edx
orq %rcx, %rdx
orq %rax, %rdx
je 0x477ea
movl 0x1b0(%rsp), %eax
movl $0x656d616e, %ecx       # imm = 0x656D616E
xorl %ecx, %eax
movzbl 0x1b4(%rsp), %ecx
orl %eax, %ecx
je 0x477f9
movq 0x1b0(%rsp), %rax
movabsq $0x7465735f656d6974, %rcx # imm = 0x7465735F656D6974
xorq %rcx, %rax
movq 0x1b6(%rsp), %rcx
movabsq $0x73676e69747465, %rdx # imm = 0x73676E69747465
xorq %rdx, %rcx
orq %rax, %rcx
je 0x47813
movq 0x1b0(%rsp), %rax
movabsq $0x66656c5f656d6974, %rcx # imm = 0x66656C5F656D6974
xorq %rcx, %rax
movzwl 0x1b8(%rsp), %ecx
xorq $0x74, %rcx
orq %rax, %rcx
je 0x47832
movq 0x1b0(%rsp), %rax
movabsq $0x6e6f6973726576, %rcx # imm = 0x6E6F6973726576
cmpq %rcx, %rax
jne 0x478e1
cmpl $0x0, 0x48(%rsp)
je 0x47baa
xorl %r14d, %r14d
leaq 0x12e91(%rip), %rdi     # 0x5a676
jmp 0x47fa9
xorl %r14d, %r14d
leaq 0x12e27(%rip), %rdi     # 0x5a61b
jmp 0x47fa9
cmpl $0x0, 0x48(%rsp)
je 0x478d2
xorl %r14d, %r14d
leaq 0x12e1a(%rip), %rdi     # 0x5a628
jmp 0x47fa9
leaq 0x12e39(%rip), %rdi     # 0x5a653
leaq 0x7c(%rsp), %rsi
leaq 0x78(%rsp), %rdx
leaq 0x74(%rsp), %rcx
xorl %eax, %eax
callq 0x33f0
jmp 0x4789b
xorl %eax, %eax
movl %eax, 0x58(%rsp)
movl %eax, 0x1c(%rsp)
leaq 0x12e2a(%rip), %rdi     # 0x5a66d
leaq 0xb0(%rsp), %rsi
leaq 0x58(%rsp), %rdx
leaq 0x1c(%rsp), %rcx
xorl %eax, %eax
callq 0x33f0
movb 0xb0(%rsp), %al
andb $-0x21, %al
cmpb $0x42, %al
movl 0x58(%rsp), %eax
movl 0x1c(%rsp), %ecx
movl 0x40(%rsp), %edx
cmovnel %ecx, %edx
movl %edx, 0x40(%rsp)
movl 0x30(%rsp), %edx
cmovnel %eax, %edx
movl %edx, 0x30(%rsp)
movl 0x3c(%rsp), %edx
cmovel %ecx, %edx
movl %edx, 0x3c(%rsp)
movl 0x34(%rsp), %ecx
cmovel %eax, %ecx
movl %ecx, 0x34(%rsp)
leaq 0x12dba(%rip), %rdi     # 0x5a65c
jmp 0x47fa9
movq 0x10(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq %r12, %rdx
movq %r13, %rcx
movl %r14d, %r8d
movss 0x44(%rsp), %xmm0
callq 0x9f39
movq %rax, 0x10(%rsp)
jmp 0x4767f
xorl %r14d, %r14d
leaq 0x12d5c(%rip), %rdi     # 0x5a638
jmp 0x47fa9
movq 0x1b0(%rsp), %rcx
movabsq $0x6f635f6e776f6e6b, %rdx # imm = 0x6F635F6E776F6E6B
xorq %rdx, %rcx
movq 0x1b6(%rsp), %rdx
movabsq $0x646e616d6d6f63, %rsi # imm = 0x646E616D6D6F63
xorq %rsi, %rdx
orq %rcx, %rdx
movq 0x10(%rsp), %r14
je 0x47bb9
movq 0x1b0(%rsp), %rcx
movabsq $0x6d6f635f7473696c, %rdx # imm = 0x6D6F635F7473696C
xorq %rdx, %rcx
movq 0x1b6(%rsp), %rdx
movabsq $0x73646e616d6d6f, %rsi # imm = 0x73646E616D6D6F
xorq %rsi, %rdx
orq %rcx, %rdx
je 0x47e76
movl 0x1b0(%rsp), %ecx
movl $0x74697571, %edx       # imm = 0x74697571
xorl %edx, %ecx
movzbl 0x1b4(%rsp), %edx
orl %ecx, %edx
je 0x4853b
movq 0x1b0(%rsp), %rcx
movabsq $0x7a69736472616f62, %rdx # imm = 0x7A69736472616F62
xorq %rdx, %rcx
movzwl 0x1b8(%rsp), %edx
xorq $0x65, %rdx
orq %rcx, %rdx
je 0x47e85
movq 0x1b0(%rsp), %rcx
movabsq $0x61685f6465786966, %rdx # imm = 0x61685F6465786966
xorq %rdx, %rcx
movq 0x1b7(%rsp), %rdx
movabsq $0x70616369646e61, %rsi # imm = 0x70616369646E61
xorq %rsi, %rdx
orq %rcx, %rdx
je 0x47f36
movq 0x1b0(%rsp), %rcx
movabsq $0x6f625f7261656c63, %rdx # imm = 0x6F625F7261656C63
xorq %rdx, %rcx
movl 0x1b8(%rsp), %edx
xorq $0x647261, %rdx         # imm = 0x647261
orq %rcx, %rdx
je 0x47fe1
movl 0x1b0(%rsp), %ecx
movl $0x696d6f6b, %edx       # imm = 0x696D6F6B
xorl %edx, %ecx
movzbl 0x1b4(%rsp), %edx
orl %ecx, %edx
je 0x48087
movq 0x1b0(%rsp), %rcx
movabsq $0x72616f62776f6873, %rdx # imm = 0x72616F62776F6873
xorq %rdx, %rcx
movzwl 0x1b8(%rsp), %edx
xorq $0x64, %rdx
orq %rcx, %rdx
je 0x480b0
movl 0x1b0(%rsp), %ecx
movl $0x79616c70, %edx       # imm = 0x79616C70
xorl %edx, %ecx
movzbl 0x1b4(%rsp), %edx
orl %ecx, %edx
je 0x4810f
movl 0x1b0(%rsp), %ecx
movl $0x63616c62, %edx       # imm = 0x63616C62
xorl %edx, %ecx
movzwl 0x1b4(%rsp), %edx
xorl $0x6b, %edx
orl %ecx, %edx
je 0x480f1
movl 0x1b0(%rsp), %ecx
movl $0x74696877, %edx       # imm = 0x74696877
xorl %edx, %ecx
movzwl 0x1b4(%rsp), %edx
xorl $0x65, %edx
orl %ecx, %edx
je 0x480f1
movabsq $0x65766f6d6e6567, %rcx # imm = 0x65766F6D6E6567
cmpq %rcx, %rax
je 0x482e5
movq 0x1b0(%rsp), %rcx
movabsq $0x5f65766f6d6e6567, %rsi # imm = 0x5F65766F6D6E6567
xorq %rsi, %rcx
movq 0x1b6(%rsp), %rdx
movabsq $0x6b63616c625f65, %rdi # imm = 0x6B63616C625F65
xorq %rdi, %rdx
orq %rcx, %rdx
je 0x4831e
movq 0x1b0(%rsp), %rcx
xorq %rsi, %rcx
movq 0x1b6(%rsp), %rdx
movabsq $0x65746968775f65, %rsi # imm = 0x65746968775F65
xorq %rsi, %rdx
orq %rcx, %rdx
je 0x4832a
xorl %r14d, %r14d
cmpw $0x70, %ax
je 0x47fb8
movzwl 0x1c0(%rsp), %eax
movd %eax, %xmm0
movdqa 0x1b0(%rsp), %xmm1
pcmpeqb 0x1291c(%rip), %xmm1    # 0x5a450
pcmpeqb 0x12924(%rip), %xmm0    # 0x5a460
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x48511
movd 0x1c0(%rsp), %xmm0
pcmpeqb 0x12910(%rip), %xmm0    # 0x5a470
movdqa 0x1b0(%rsp), %xmm1
pcmpeqb 0x1290f(%rip), %xmm1    # 0x5a480
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x48526
movq 0x2444d(%rip), %rax     # 0x6bfd8
movq (%rax), %rdi
callq 0xe948
movq %rax, %rdi
callq 0x3040
xorl %r14d, %r14d
leaq 0x12d71(%rip), %rdi     # 0x5a916
jmp 0x47fa9
xorl %r14d, %r14d
leaq 0x12acf(%rip), %rdi     # 0x5a683
jmp 0x47fa9
leaq 0x10ebb(%rip), %rdi     # 0x58a7b
leaq 0xb0(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movq 0xb8(%rsp), %rax
movabsq $0x6e6f69737265765f, %rcx # imm = 0x6E6F69737265765F
xorq %rcx, %rax
movq 0xb0(%rsp), %rcx
movabsq $0x6c6f636f746f7270, %rdx # imm = 0x6C6F636F746F7270
xorq %rdx, %rcx
movzbl 0xc0(%rsp), %edx
orq %rcx, %rdx
orq %rax, %rdx
leaq 0x12b67(%rip), %r8      # 0x5a775
movq %r8, %rdi
je 0x47fa6
movl 0xb0(%rsp), %eax
movl $0x656d616e, %ecx       # imm = 0x656D616E
xorl %ecx, %eax
movzbl 0xb4(%rsp), %ecx
orl %eax, %ecx
sete %cl
movq 0xb0(%rsp), %rax
movabsq $0x6e6f6973726576, %rdx # imm = 0x6E6F6973726576
cmpq %rdx, %rax
sete %dl
orb %cl, %dl
movq %r8, %rdi
jne 0x47fa6
movq 0xb0(%rsp), %rcx
movabsq $0x6f635f6e776f6e6b, %rdx # imm = 0x6F635F6E776F6E6B
xorq %rdx, %rcx
movq 0xb6(%rsp), %rdx
movabsq $0x646e616d6d6f63, %rsi # imm = 0x646E616D6D6F63
xorq %rsi, %rdx
orq %rcx, %rdx
movq %r8, %rdi
je 0x47fa6
movq 0xb0(%rsp), %rcx
movabsq $0x6d6f635f7473696c, %rdx # imm = 0x6D6F635F7473696C
xorq %rdx, %rcx
movq 0xb6(%rsp), %rdx
movabsq $0x73646e616d6d6f, %rsi # imm = 0x73646E616D6D6F
xorq %rsi, %rdx
orq %rcx, %rdx
movq %r8, %rdi
je 0x47fa6
movl 0xb0(%rsp), %ecx
movl $0x74697571, %edx       # imm = 0x74697571
xorl %edx, %ecx
movzbl 0xb4(%rsp), %edx
orl %ecx, %edx
movq %r8, %rdi
je 0x47fa6
movq 0xb0(%rsp), %rcx
movabsq $0x7a69736472616f62, %rdx # imm = 0x7A69736472616F62
xorq %rdx, %rcx
movzwl 0xb8(%rsp), %edx
xorq $0x65, %rdx
orq %rcx, %rdx
movq %r8, %rdi
je 0x47fa6
movq 0xb0(%rsp), %rcx
movabsq $0x6f625f7261656c63, %rdx # imm = 0x6F625F7261656C63
xorq %rdx, %rcx
movl 0xb8(%rsp), %edx
xorq $0x647261, %rdx         # imm = 0x647261
orq %rcx, %rdx
movq %r8, %rdi
je 0x47fa6
movl 0xb0(%rsp), %ecx
movl $0x696d6f6b, %edx       # imm = 0x696D6F6B
xorl %edx, %ecx
movzbl 0xb4(%rsp), %edx
orl %ecx, %edx
movq %r8, %rdi
je 0x47fa6
movzwl 0xc0(%rsp), %ecx
movd %ecx, %xmm0
movdqa 0xb0(%rsp), %xmm1
pcmpeqb 0x126d4(%rip), %xmm1    # 0x5a450
pcmpeqb 0x126dc(%rip), %xmm0    # 0x5a460
pand %xmm1, %xmm0
pmovmskb %xmm0, %ecx
movq %r8, %rdi
cmpl $0xffff, %ecx           # imm = 0xFFFF
je 0x47fa6
movl 0xb0(%rsp), %ecx
movl $0x79616c70, %edx       # imm = 0x79616C70
xorl %edx, %ecx
movzbl 0xb4(%rsp), %edx
orl %ecx, %edx
movq %r8, %rdi
je 0x47fa6
movq 0xb0(%rsp), %rcx
movabsq $0x5f65766f6d6e6567, %rdx # imm = 0x5F65766F6D6E6567
xorq %rdx, %rcx
movq 0xb6(%rsp), %rdx
movabsq $0x65746968775f65, %rsi # imm = 0x65746968775F65
xorq %rsi, %rdx
orq %rcx, %rdx
movq %r8, %rdi
je 0x47fa6
movq 0xb0(%rsp), %rcx
movabsq $0x5f65766f6d6e6567, %rdx # imm = 0x5F65766F6D6E6567
xorq %rdx, %rcx
movq 0xb6(%rsp), %rdx
movabsq $0x6b63616c625f65, %rsi # imm = 0x6B63616C625F65
xorq %rsi, %rdx
orq %rcx, %rdx
movq %r8, %rdi
je 0x47fa6
movq 0xb0(%rsp), %rcx
movabsq $0x61685f6465786966, %rdx # imm = 0x61685F6465786966
xorq %rdx, %rcx
movq 0xb7(%rsp), %rdx
movabsq $0x70616369646e61, %rsi # imm = 0x70616369646E61
xorq %rsi, %rdx
movabsq $0x65766f6d6e6567, %rsi # imm = 0x65766F6D6E6567
cmpq %rsi, %rax
leaq 0x1291a(%rip), %rdi     # 0x5a780
cmoveq %r8, %rdi
orq %rcx, %rdx
cmoveq %r8, %rdi
jmp 0x47fa6
xorl %r14d, %r14d
leaq 0x1290c(%rip), %rdi     # 0x5a78c
jmp 0x47fa9
movl $0x0, 0xb0(%rsp)
movq %rbx, %rdi
leaq 0xb0(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
cmpl $0x13, 0xb0(%rsp)
jne 0x47f9f
movq %r14, %rdi
callq 0x4653b
movl $0x10ec, %edx           # imm = 0x10EC
movq %r12, %rdi
xorl %esi, %esi
callq 0x31c0
movq $-0x5a4, %rax           # imm = 0xFA5C
movss 0xd132(%rip), %xmm2     # 0x55008
movss 0x5a4(%r12,%rax), %xmm0
movss 0xb48(%r12,%rax), %xmm1
movss %xmm1, 0x5a4(%r12,%rax)
movss %xmm0, 0xb48(%r12,%rax)
movaps %xmm2, %xmm0
subss 0x10ec(%r12,%rax), %xmm0
movss %xmm0, 0x10ec(%r12,%rax)
addq $0x4, %rax
jne 0x47ed6
movq $0x0, 0x20(%rsp)
leaq 0x12731(%rip), %rdi     # 0x5a65c
movq $0x0, 0x10(%rsp)
jmp 0x47fa6
movl $0x0, 0xb0(%rsp)
movq %rbx, %rdi
leaq 0xb0(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movslq 0xb0(%rsp), %rax
testq %rax, %rax
jle 0x47f92
leaq (,%rax,4), %rcx
xorl %edx, %edx
leaq 0x12aef(%rip), %rdi     # 0x5aa60
movslq (%rdx,%rdi), %rsi
movl $0x3f800000, (%r12,%rsi,4) # imm = 0x3F800000
addq $0x4, %rdx
cmpq %rdx, %rcx
jne 0x47f71
movq 0x20(%rsp), %rcx
addl %eax, %ecx
movq %rcx, 0x20(%rsp)
movq %r14, %rdi
callq 0x4653b
jmp 0x48073
leaq 0x1289a(%rip), %rdi     # 0x5a840
xorl %r14d, %r14d
leaq 0x2b0(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movq %r13, %r15
movq 0x2400e(%rip), %rax     # 0x6bfd0
movq (%rax), %rdi
callq 0x3310
movq 0x24027(%rip), %rax     # 0x6bff8
movq (%rax), %rdi
callq 0x3310
movq %r15, %r13
jmp 0x47676
movl $0x10ec, %edx           # imm = 0x10EC
movq %r12, %rdi
xorl %esi, %esi
callq 0x31c0
movq $-0x5a4, %rax           # imm = 0xFA5C
movss 0xd009(%rip), %xmm2     # 0x55008
movss 0x5a4(%r12,%rax), %xmm0
movss 0xb48(%r12,%rax), %xmm1
movss %xmm1, 0x5a4(%r12,%rax)
movss %xmm0, 0xb48(%r12,%rax)
movaps %xmm2, %xmm0
subss 0x10ec(%r12,%rax), %xmm0
movss %xmm0, 0x10ec(%r12,%rax)
addq $0x4, %rax
jne 0x47fff
movq %r14, %rdi
callq 0x4653b
movq $0x0, 0x20(%rsp)
leaq 0x12600(%rip), %rdi     # 0x5a65c
leaq 0x2b0(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movl $0x0, 0x2c(%rsp)
xorl %r14d, %r14d
movq %r13, %r15
movq $0x0, 0x10(%rsp)
jmp 0x47fbb
movl $0x0, 0xb0(%rsp)
xorl %r14d, %r14d
leaq 0x10a40(%rip), %rdi     # 0x58adc
leaq 0xb0(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
jmp 0x4789b
xorl %r14d, %r14d
leaq 0x127a8(%rip), %rdi     # 0x5a862
leaq 0x2b0(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movq 0x23f00(%rip), %rax     # 0x6bfd0
movq (%rax), %rdi
movq %r12, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x45d3f
movl $0xa, %edi
callq 0x3060
jmp 0x47fb8
leaq 0x123be(%rip), %rdi     # 0x5a4b6
xorl %eax, %eax
callq 0x33f0
movb 0x1b0(%rsp), %al
movb %al, 0xb0(%rsp)
jmp 0x48125
leaq 0x12752(%rip), %rdi     # 0x5a868
leaq 0xb0(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movq 0x20(%rsp), %rax
incl %eax
movq %rax, 0x20(%rsp)
leaq 0x12734(%rip), %rdi     # 0x5a86c
leaq 0xf(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
xorl %eax, %eax
callq 0x33f0
movb 0xb0(%rsp), %dl
andb $-0x21, %dl
xorl %ecx, %ecx
cmpb $0x42, %dl
sete %dl
movb 0xf(%rsp), %sil
cmpl $0x1, %eax
jg 0x481dd
movl %esi, %eax
andb $-0x21, %al
cmpb $0x50, %al
jne 0x481dd
movq %r14, %r15
xorl %r14d, %r14d
leaq 0x124e2(%rip), %rdi     # 0x5a65c
leaq 0x2b0(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movq 0x23e48(%rip), %rax     # 0x6bfd8
movq (%rax), %rdi
callq 0xe948
movq %rax, %rdi
callq 0x3040
movq 0x23e29(%rip), %rax     # 0x6bfd0
movq (%rax), %rdi
callq 0x3310
movq 0x23e42(%rip), %rax     # 0x6bff8
movq (%rax), %rdi
callq 0x3310
movq %r15, %rdi
movl $0x169, %esi            # imm = 0x169
callq 0x46f29
movq %rax, 0x10(%rsp)
movl $0x1, 0x2c(%rsp)
jmp 0x47676
leal -0x41(%rsi), %eax
cmpb $0x19, %al
ja 0x481ea
movb %al, 0xf(%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 0x48217
cmpb $0x8, %al
setge %sil
subb %sil, %al
movb %al, 0xf(%rsp)
movl %eax, %esi
movb %dl, %cl
movl $0x13, %edx
subl 0x1c(%rsp), %edx
leal -0x1(,%rcx,2), %r14d
movl %edx, 0x1c(%rsp)
movq 0x23dc3(%rip), %rax     # 0x6bff8
movq (%rax), %rdi
movsbl %sil, %ecx
leaq 0x1262e(%rip), %rsi     # 0x5a871
xorl %eax, %eax
callq 0x3270
movl 0x1c(%rsp), %edx
movsbl 0xf(%rsp), %ecx
movq %r12, %rdi
movl %r14d, %esi
callq 0x46164
movl $0x43b, %edi            # imm = 0x43B
movq %r12, %rsi
movl $0x1, %edx
movq %r13, %rcx
movl $0x1, %r8d
callq 0x29fe0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
jne 0x48293
callq 0xa3c8
movq $0x0, 0x10(%rsp)
jmp 0x482b5
leaq 0x1c(%rsp), %rsi
leaq 0xf(%rsp), %rdx
leaq 0x58(%rsp), %rcx
callq 0xa301
testb $0x1, %al
jne 0x48283
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0x0, 0x2c(%rsp)
leaq 0x12398(%rip), %rdi     # 0x5a65c
leaq 0x2b0(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
xorl %r14d, %r14d
movq 0x50(%rsp), %r15
movq %r13, 0x50(%rsp)
jmp 0x47fbb
leaq 0x1078f(%rip), %rdi     # 0x58a7b
leaq 0xb0(%rsp), %rsi
xorl %eax, %eax
callq 0x33f0
movb 0xb0(%rsp), %al
andb $-0x21, %al
xorl %ecx, %ecx
cmpb $0x42, %al
sete %cl
movl 0x30(%rsp), %eax
cmovel 0x34(%rsp), %eax
leal -0x1(,%rcx,2), %r15d
jmp 0x48334
movl $0x1, %r15d
movl 0x34(%rsp), %eax
jmp 0x48334
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl 0x30(%rsp), %eax
movss 0x120ec(%rip), %xmm0    # 0x5a428
movss %xmm0, 0x28(%rsp)
cmpl $0x1f, %eax
jl 0x48353
movss 0x64(%rsp), %xmm0
movss %xmm0, 0x28(%rsp)
movq 0x20(%rsp), %rax
incl %eax
movl %eax, 0x38(%rsp)
movl %r15d, %r14d
negl %r14d
xorl %eax, %eax
callq 0xe79c
movsd %xmm0, 0x90(%rsp)
movq 0x10(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq %r12, %rdx
movq %r13, %rcx
movl %r15d, %r8d
movl 0x68(%rsp), %r9d
movss 0x44(%rsp), %xmm0
movss 0x28(%rsp), %xmm1
callq 0x46d4b
movq %rax, 0x10(%rsp)
movq 0x23c4c(%rip), %rax     # 0x6bff8
movl %r15d, 0x28(%rsp)
movq (%rax), %r15
xorl %eax, %eax
callq 0xe79c
subsd 0x90(%rsp), %xmm0
movq %r15, %rdi
leaq 0x13241(%rip), %rsi     # 0x5b60f
movb $0x1, %al
callq 0x3270
movq 0x10(%rsp), %rdi
movss 0x6c(%rsp), %xmm0
movl 0x28(%rsp), %esi
callq 0x9c72
movaps %xmm0, 0x90(%rsp)
leal (%rax,%rax,8), %ecx
leal (%rax,%rcx,2), %esi
movq %rax, 0x80(%rsp)
shrq $0x20, %rax
movq %rax, 0xa8(%rsp)
addl %eax, %esi
movq 0x10(%rsp), %rdi
callq 0x46f29
movaps 0x90(%rsp), %xmm2
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
cmpl 0x70(%rsp), %eax
jl 0x48466
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
movsd 0x10242(%rip), %xmm1    # 0x58680
ucomisd %xmm0, %xmm1
jbe 0x48466
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
movsd 0x10229(%rip), %xmm1    # 0x58680
ucomisd %xmm0, %xmm1
jbe 0x48466
leaq 0x12448(%rip), %rdi     # 0x5a8ac
jmp 0x48482
movq 0x80(%rsp), %rdx
cmpl $0x13, %edx
jne 0x4849f
movl $0x0, 0x2c(%rsp)
leaq 0x12437(%rip), %rdi     # 0x5a8b9
leaq 0x2b0(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movl 0x38(%rsp), %eax
movq %rax, 0x20(%rsp)
jmp 0x47fb8
movq %r12, %rdi
movl 0x28(%rsp), %esi
movq 0xa8(%rsp), %r15
movl %r15d, %ecx
callq 0x46164
movl $0x43b, %edi            # imm = 0x43B
movq %r12, %rsi
movl $0x1, %edx
movq %r13, %rcx
movl $0x1, %r8d
callq 0x29fe0
movl $0x13, %ecx
subl 0x80(%rsp), %ecx
xorl %eax, %eax
cmpl $0x8, %r15d
setge %al
leal (%r15,%rax), %edx
addl $0x41, %edx
leaq 0x123d0(%rip), %rdi     # 0x5a8c4
leaq 0x2b0(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movl 0x38(%rsp), %eax
movq %rax, 0x20(%rsp)
jmp 0x482d6
movq %r12, %rdi
leaq 0x2b0(%rsp), %rsi
callq 0xa1cc
jmp 0x47fb8
movq %r12, %rdi
leaq 0x2b0(%rsp), %rsi
callq 0xa0b0
jmp 0x47fb8
leaq 0x12f61(%rip), %rdi     # 0x5b4a3
movl 0x2c(%rsp), %esi
movl 0x3c(%rsp), %edx
movl 0x40(%rsp), %ecx
xorl %eax, %eax
callq 0x3160
addq $0x3b8, %rsp            # imm = 0x3B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq