// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/main.c
// Function: main
int
main(void)
{
    int w, h;
    display_init();
    device_terminal_size(&w, &h);
    if (w < DISPLAY_WIDTH || h < DISPLAY_HEIGHT) {
        display_free();
        printf("Goblin-COM requires a terminal of at least %dx%d characters!\n"
               "I see %dx%d\n"
               "Press enter to exit ...\n",
               DISPLAY_WIDTH, DISPLAY_HEIGHT, w, h);
        fflush(stdout);
        getchar();
        exit(EXIT_FAILURE);
    }
    device_entropy(&rand_state, sizeof(rand_state));
    device_title("Goblin-COM");

    panel_t loading;
    uint8_t loading_message[] = "Initializing world ...";
    panel_center_init(&loading, sizeof(loading_message), 1);
    display_push(&loading);
    panel_puts(&loading, 0, 0, FONT_DEFAULT, (char *)loading_message);
    display_refresh();
    game_t *game;
    FILE *save = fopen(PERSIST_FILE, "rb");
    if (save) {
        game = game_load(save);
        fclose(save);
        game->speed = SPEED_FACTOR;
        unlink(PERSIST_FILE);
    } else {
        game = game_create(xorshift(&rand_state));
        game->speed = SPEED_FACTOR;
    }
    atexit_save_game = game;
    atexit(atexit_save);
    display_pop_free();

    panel_t sidemenu;
    panel_init(&sidemenu, DISPLAY_WIDTH - SIDEMENU_WIDTH, 0,
               SIDEMENU_WIDTH, DISPLAY_HEIGHT);
    display_push(&sidemenu);

    panel_t terrain;
    panel_init(&terrain, 0, 0, MAP_WIDTH, MAP_HEIGHT);
    display_push(&terrain);

    panel_t buildings;
    panel_init(&buildings, 0, 0, MAP_WIDTH, MAP_HEIGHT);
    display_push(&buildings);

    panel_t units;
    panel_init(&units, 0, 0, MAP_WIDTH, MAP_HEIGHT);
    display_push(&units);

    /* Main Loop */
    bool running = true;
    while (running) {
        yield_t diff;
        for (int i = 0; running && i < game->speed; i++) {
            diff = game_step(game);
            enum game_event event;
            while ((event = game_event_pop(game)) != EVENT_NONE) {
                sidemenu_draw(&sidemenu, game, diff);
                display_refresh();
                switch (event) {
                case EVENT_LOSE:
                    atexit_save_game = NULL;
                    running = false;
                    ui_gameover(game, &terrain);
                break;
                case EVENT_PROGRESS_1:
                    ui_halfway(game, &terrain);
                    break;
                case EVENT_WIN:
                    atexit_save_game = NULL;
                    running = false;
                    ui_win(game, &terrain);
                    break;
                case EVENT_BATTLE:
                    ui_apology(game, &terrain);
                    break;
                case EVENT_NONE:
                    break;
                }
            }
        }

        sidemenu_draw(&sidemenu, game, diff);
        map_draw_terrain(game->map, &terrain);
        panel_clear(&buildings);
        map_draw_buildings(game->map, &buildings);
        panel_clear(&units);
        game_draw_units(game, &units, false);
        display_refresh();
        uint64_t wait = device_uepoch() % PERIOD;
        if (device_kbhit(wait)) {
            int key = device_getch();
            switch (key) {
            case 'b':
                ui_build(game, &terrain);
                break;
            case 's':
                ui_squads(game, &terrain, &units);
                break;
            case 'h':
                ui_heroes(game, &terrain);
                break;
            case 't':
                ui_story(game, &terrain);
                break;
            case 'p':
                ui_help(game, &terrain);
                break;
            case '>':
            case '.':
                if (game->speed < SPEED_MAX)
                    game->speed *= SPEED_FACTOR;
                break;
            case '<':
            case ',':
                game->speed /= SPEED_FACTOR;
                if (game->speed == 0)
                    game->speed = 1;
                break;
            case 'R':
                display_invalidate();
                break;
            case 'q':
                running = !popup_quit(true);
                break;
            case 'Q':
                running = !popup_quit(false);
                if (!running)
                    atexit_save_game = NULL;
                break;
            default:
                break;
            }
        }
    };

    atexit_save();
    atexit_save_game = NULL;
    game_free(game);

    display_pop(); // units
    display_pop(); // buildings
    display_pop(); // terrain
    display_pop(); // sidemenu
    panel_free(&units);
    panel_free(&buildings);
    panel_free(&terrain);
    panel_free(&sidemenu);
    display_free();
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a7b8, %rsp          # imm = 0x1A7B8
callq 0x2dac
leaq 0x5c(%rsp), %rbx
leaq 0x3c(%rsp), %rsi
movq %rbx, %rdi
callq 0x5612
cmpl $0x50, (%rbx)
jl 0x262a
cmpl $0x17, 0x3c(%rsp)
jle 0x262a
leaq 0x11e39(%rip), %rdi     # 0x131e8
pushq $0x8
popq %rsi
callq 0x5650
leaq 0x4d1c(%rip), %rdi      # 0x60da
callq 0x5601
movapd 0x5215(%rip), %xmm0     # 0x65e0
leaq 0x2e0(%rsp), %rbx
movapd %xmm0, (%rbx)
movabsq $0x2e2e2e20646c72, %rax # imm = 0x2E2E2E20646C72
movq %rax, 0xf(%rbx)
leaq 0x16ba0(%rsp), %r14
pushq $0x17
popq %rsi
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %edx
callq 0x30ec
movq %r14, %rdi
callq 0x3077
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl $0x10007, %ecx          # imm = 0x10007
movq %rbx, %r8
callq 0x3168
callq 0x2eea
leaq 0x4cc0(%rip), %rdi      # 0x60e5
leaq 0x4cc6(%rip), %rsi      # 0x60f2
callq 0x1210
testq %rax, %rax
je 0x1462
movq %rax, %rbx
movq %rax, %rdi
callq 0x4177
movq %rax, %r14
movq %rbx, %rdi
callq 0x10b0
movl $0x6, 0x10(%r14)
leaq 0x4c8a(%rip), %rdi      # 0x60e5
callq 0x1040
jmp 0x1480
leaq 0x11d7f(%rip), %rdi     # 0x131e8
callq 0x5110
movq %rax, %rdi
callq 0x404a
movq %rax, %r14
movl $0x6, 0x10(%rax)
movq %r14, 0xb3f9(%rip)      # 0xc880
leaq 0x11da(%rip), %rdi      # 0x2668
callq 0x5700
callq 0x30ab
leaq 0xf370(%rsp), %rbx
pushq $0x3c
popq %r15
pushq $0x14
popq %rcx
pushq $0x18
popq %r12
movq %rbx, %rdi
movl %r15d, %esi
xorl %edx, %edx
movl %r12d, %r8d
callq 0x2e1a
movq %rbx, %rdi
callq 0x3077
leaq 0x7b40(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x2e1a
movq %rbx, %rdi
callq 0x3077
leaq 0x12f88(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x2e1a
movq %rbx, %rdi
callq 0x3077
leaq 0xb758(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x2e1a
movq %rbx, %rdi
callq 0x3077
leaq 0x3cc(%r14), %rax
movq %rax, 0x48(%rsp)
leaq 0x2c8(%r14), %rax
movq %rax, 0x40(%rsp)
movb $0x1, %al
movl %eax, 0x14(%rsp)
testb $0x1, 0x14(%rsp)
je 0x25b4
xorl %r12d, %r12d
testb $0x1, 0x14(%rsp)
je 0x165f
cmpl 0x10(%r14), %r12d
jge 0x165f
movq %r14, %rdi
callq 0x48ed
movq %rax, %rbx
movl %edx, %r15d
movq %r14, %rdi
callq 0x4702
testl %eax, %eax
je 0x1657
movl %eax, %r13d
leaq 0xf370(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl %r15d, %ecx
callq 0x26b5
callq 0x2eea
decl %r13d
cmpl $0x3, %r13d
ja 0x1578
leaq 0x4ab2(%rip), %rcx      # 0x6068
movslq (%rcx,%r13,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
leaq 0x9bba(%rip), %rdx      # 0xb18b
pushq $0x10
popq %rcx
callq 0x28ff
jmp 0x1578
cmpb $0x0, 0x1dec(%r14)
jne 0x15ff
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
leaq 0xafdc(%rip), %rdx      # 0xc5d3
pushq $0xe
popq %rcx
callq 0x28ff
movb $0x1, 0x1dec(%r14)
jmp 0x1578
andq $0x0, 0xb26c(%rip)      # 0xc880
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
leaq 0x983e(%rip), %rdx      # 0xae64
jmp 0x1642
andq $0x0, 0xb250(%rip)      # 0xc880
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
leaq 0xa471(%rip), %rdx      # 0xbab3
pushq $0x10
popq %rcx
callq 0x28ff
movl $0x0, 0x14(%rsp)
jmp 0x1578
incl %r12d
jmp 0x1555
leaq 0xf370(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl %r15d, %ecx
callq 0x26b5
movq 0x38(%r14), %rdi
leaq 0x7b40(%rsp), %rsi
callq 0x3d13
leaq 0x12f88(%rsp), %r12
movq %r12, %rdi
callq 0x35bf
movq 0x38(%r14), %rdi
movq %r12, %rsi
callq 0x3ef0
leaq 0xb758(%rsp), %r12
movq %r12, %rdi
callq 0x35bf
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x4e95
callq 0x2eea
callq 0x55de
xorl %edx, %edx
movl $0x1046a, %ecx          # imm = 0x1046A
divq %rcx
movq %rdx, %rdi
callq 0x5587
testb %al, %al
je 0x1547
callq 0x5522
leal -0x70(%rax), %ecx
cmpl $0x4, %ecx
jbe 0x1bde
cmpl $0x2c, %eax
je 0x1c0d
cmpl $0x2e, %eax
je 0x1c2b
cmpl $0x3c, %eax
je 0x1c0d
cmpl $0x3e, %eax
je 0x1c2b
cmpl $0x51, %eax
je 0x1dc6
cmpl $0x52, %eax
je 0x1de6
cmpl $0x68, %eax
je 0x1df0
cmpl $0x62, %eax
jne 0x1547
leaq 0x300(%rsp), %r13
movq %r13, %rdi
pushq $0x38
popq %rsi
pushq $0x14
popq %rdx
callq 0x30ec
movq %r13, %rdi
callq 0x3077
movq %r13, %rdi
pushq $0x7
popq %rsi
callq 0x3629
leaq 0x3f20(%rsp), %r12
movq %r12, %rdi
pushq $0x19
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x45ad
leaq 0xd0(%rsp), %rdi
xorl %esi, %esi
pushq $0x5
popq %rdx
pushq $0x1
popq %rbp
movl %ebp, %ecx
callq 0x45ad
movq %r13, %rdi
movl %ebp, %esi
movl %ebp, %edx
leaq 0x4ab2(%rip), %rcx      # 0x6253
movq %r12, %r8
xorl %eax, %eax
callq 0x32c4
movq %r13, %rdi
pushq $0x5
popq %r12
movl %r12d, %esi
pushq $0x2
popq %rdx
leaq 0x4ab0(%rip), %rcx      # 0x626f
leaq 0xd0(%rsp), %r8
xorl %eax, %eax
callq 0x32c4
movl $0x2663, %edi           # imm = 0x2663
callq 0x2ca5
movq %r13, %rdi
movl %r12d, %esi
pushq $0x3
popq %rdx
leaq 0x4a95(%rip), %rcx      # 0x627d
movq %rax, %r8
xorl %eax, %eax
callq 0x32c4
leaq 0x3f20(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
pushq $0x14
popq %rdx
xorl %ecx, %ecx
callq 0x45ad
leaq 0xd0(%rsp), %rdi
movabsq $0x400000000, %rsi      # imm = 0x400000000
xorl %edx, %edx
movl %ebp, %ecx
callq 0x45ad
movq %r13, %rdi
movl %ebp, %esi
pushq $0x4
popq %rdx
leaq 0x4a62(%rip), %rcx      # 0x6295
movq %r12, %r8
xorl %eax, %eax
callq 0x32c4
movq %r13, %rdi
pushq $0x5
popq %rdx
movl %edx, %esi
movl %edx, %r12d
leaq 0x4a20(%rip), %rcx      # 0x626f
leaq 0xd0(%rsp), %r8
xorl %eax, %eax
callq 0x32c4
pushq $0x2e
popq %rdi
callq 0x2ca5
movq %rax, %r13
movl $0x2663, %edi           # imm = 0x2663
callq 0x2ca5
leaq 0x300(%rsp), %rdi
movl %r12d, %esi
pushq $0x6
popq %rdx
leaq 0x4a23(%rip), %rcx      # 0x62ab
movq %r13, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0x32c4
leaq 0x3f20(%rsp), %rdi
movq %rdi, %r13
pushq $0x46
popq %rsi
pushq $0x46
popq %rdx
xorl %ecx, %ecx
callq 0x45ad
leaq 0xd0(%rsp), %rdi
movabsq $-0x200000000, %rsi     # imm = 0xFFFFFFFE00000000
xorl %edx, %edx
movl %ebp, %ecx
callq 0x45ad
leaq 0x300(%rsp), %r12
movq %r12, %rdi
movl %ebp, %esi
pushq $0x7
popq %rdx
leaq 0x49f4(%rip), %rcx      # 0x62d3
movq %r13, %r8
xorl %eax, %eax
callq 0x32c4
movq %r12, %rdi
movq %r12, %r13
pushq $0x5
popq %r12
movl %r12d, %esi
pushq $0x8
popq %rdx
leaq 0x49eb(%rip), %rcx      # 0x62eb
leaq 0xd0(%rsp), %r8
pushq $0x2
popq %r9
xorl %eax, %eax
callq 0x32c4
pushq $0x2e
popq %rdi
callq 0x2ca5
movq %r13, %rdi
movl %r12d, %esi
pushq $0x9
popq %rdx
leaq 0x49e6(%rip), %rcx      # 0x6311
movq %rax, %r8
xorl %eax, %eax
callq 0x32c4
leaq 0x3f20(%rsp), %rdi
movq %rdi, %r12
xorl %esi, %esi
pushq $0x64
popq %rdx
xorl %ecx, %ecx
callq 0x45ad
leaq 0xd0(%rsp), %rdi
pushq $0x5
popq %rsi
pushq $-0x1
popq %rdx
movl %ebp, %ecx
callq 0x45ad
movq %r13, %rdi
movl %ebp, %esi
pushq $0xa
popq %rdx
leaq 0x49bc(%rip), %rcx      # 0x632c
movq %r12, %r8
xorl %eax, %eax
callq 0x32c4
movq %r13, %rdi
movq %r13, %r12
pushq $0x5
popq %r13
movl %r13d, %esi
pushq $0xb
popq %rdx
leaq 0x48de(%rip), %rcx      # 0x626f
leaq 0xd0(%rsp), %r8
xorl %eax, %eax
callq 0x32c4
movl $0x2229, %edi           # imm = 0x2229
callq 0x2ca5
movq %r12, %rdi
movl %r13d, %esi
pushq $0xc
popq %rdx
leaq 0x4988(%rip), %rcx      # 0x6342
movq %rax, %r8
xorl %eax, %eax
callq 0x32c4
leaq 0x3f20(%rsp), %r13
movq %r13, %rdi
xorl %esi, %esi
pushq $0x1e
popq %rdx
xorl %ecx, %ecx
callq 0x45ad
movabsq $-0x200000000, %rax     # imm = 0xFFFFFFFE00000000
leaq 0x2(%rax), %rsi
leaq 0xd0(%rsp), %rdi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x45ad
movq %r12, %rdi
movl %ebp, %esi
pushq $0xd
popq %rdx
leaq 0x494f(%rip), %rcx      # 0x6358
movq %r13, %r8
xorl %eax, %eax
callq 0x32c4
movq %r12, %rdi
pushq $0x5
popq %rsi
pushq $0xe
popq %rdx
leaq 0x494d(%rip), %rcx      # 0x6370
leaq 0xd0(%rsp), %r8
movl $0xc8, %r9d
xorl %eax, %eax
callq 0x32c4
pushq $0x2e
popq %rdi
callq 0x2ca5
movq %rax, 0x8(%rsp)
movl $0x2663, %edi           # imm = 0x2663
callq 0x2ca5
movq %rax, %r13
movl $0x2229, %edi           # imm = 0x2229
callq 0x2ca5
movq %rax, %r10
subq $0x8, %rsp
movq %r12, %rdi
pushq $0x5
popq %rsi
pushq $0xf
popq %rdx
leaq 0x491d(%rip), %rcx      # 0x6390
movq 0x10(%rsp), %r8
movq %r13, %r9
xorl %eax, %eax
pushq %r10
callq 0x32c4
popq %rax
popq %rcx
leaq 0x3f20(%rsp), %r13
movq %r13, %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x45ad
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0xd0(%rsp), %rdi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x45ad
movq %r12, %rdi
movl %ebp, %esi
pushq $0x10
popq %rdx
leaq 0x4901(%rip), %rcx      # 0x63c3
movq %r13, %r8
xorl %eax, %eax
callq 0x32c4
movq %r12, %rdi
pushq $0x5
popq %r13
movl %r13d, %esi
pushq $0x11
popq %rdx
leaq 0x48f9(%rip), %rcx      # 0x63d9
leaq 0xd0(%rsp), %r8
xorl %eax, %eax
callq 0x32c4
movq %r12, %rdi
movl %r13d, %esi
pushq $0x12
popq %rdx
leaq 0x4908(%rip), %rcx      # 0x6407
xorl %eax, %eax
callq 0x32c4
xorl %ecx, %ecx
testw %cx, %cx
jne 0x1b5a
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
callq 0x2b22
cmpl $0x1b, %eax
je 0x1b55
movl %eax, %r13d
cmpl $0x51, %eax
je 0x1b55
cmpl $0x71, %r13d
je 0x1b55
leaq 0x48e7(%rip), %rdi      # 0x641e
movl %r13d, %esi
pushq $0x7
popq %rdx
callq 0x1140
xorl %ecx, %ecx
testq %rax, %rax
je 0x1b08
movl %r13d, %edi
callq 0x1050
movl %eax, %ecx
jmp 0x1b08
xorl %r13d, %r13d
jmp 0x1b67
cmpw $0x52, %cx
pushq $0x2b
popq %rax
cmovel %eax, %ecx
movq %rcx, %r13
callq 0x30ab
testw %r13w, %r13w
je 0x1547
movzwl %r13w, %r12d
movl %r12d, %edi
callq 0x442d
movq %rax, %rcx
shrq $0x20, %rcx
je 0x1b9b
movsd 0x28(%r14), %xmm0
cvtsi2sd %ecx, %xmm1
ucomisd %xmm1, %xmm0
jb 0x1bcb
testl %edx, %edx
je 0x1baf
movsd 0x20(%r14), %xmm0
cvtsi2sd %edx, %xmm1
ucomisd %xmm1, %xmm0
jb 0x1bcb
testl %eax, %eax
je 0x2325
movsd 0x18(%r14), %xmm0
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jae 0x2325
leaq 0x4648(%rip), %rsi      # 0x621a
xorl %eax, %eax
callq 0x2b64
jmp 0x173c
leaq 0x441f(%rip), %rdx      # 0x6004
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
leaq 0x88e4(%rip), %rdx      # 0xa4e4
pushq $0x13
popq %rcx
callq 0x28ff
jmp 0x1547
movl 0x10(%r14), %ecx
movl %ecx, %eax
cltd
pushq $0x6
popq %rsi
idivl %esi
addl $0x5, %ecx
cmpl $0xb, %ecx
cmovbl %ebp, %eax
movl %eax, 0x10(%r14)
jmp 0x1547
movl 0x10(%r14), %eax
cmpl $0x1e5f, %eax           # imm = 0x1E5F
jg 0x1547
imull $0x6, %eax, %eax
movl %eax, 0x10(%r14)
jmp 0x1547
leaq 0x3f20(%rsp), %r12
movq %r12, %rdi
pushq $0x1d
popq %rsi
pushq $0x13
popq %rdx
callq 0x30ec
movq %r12, %rdi
pushq $0x7
popq %rsi
callq 0x3629
xorl %r13d, %r13d
movq %r12, %rdi
movl %ebp, %esi
movl %ebp, %edx
leaq 0x47d6(%rip), %rcx      # 0x644e
xorl %eax, %eax
callq 0x32c4
movq %r12, %rdi
callq 0x3077
addl $-0x61, %r13d
cmpl $0x10, %r13d
jb 0x2525
movl $0x2d4, %r12d           # imm = 0x2D4
pushq $0x41
popq %rax
movl %eax, %r13d
cmpq $0x3d4, %r12            # imm = 0x3D4
je 0x1d61
movl (%r14,%r12), %r9d
testl %r9d, %r9d
je 0x1cea
movl -0x4(%r14,%r12), %edx
testl %edx, %edx
leaq 0x300(%rsp), %r10
js 0x1d13
addl $0x41, %edx
movq %r10, %rdi
leaq 0x47aa(%rip), %rsi      # 0x647f
xorl %eax, %eax
callq 0x1230
leaq 0x300(%rsp), %r10
movl (%r14,%r12), %r9d
jmp 0x1d2c
movabsq $0x7974706d457b6b4b, %rax # imm = 0x7974706D457B6B4B
movq %rax, 0x300(%rsp)
movw $0x7d, 0x308(%rsp)
xorl %r9d, %r9d
leaq 0x300(%rsp), %r10
jmp 0x1d2c
movupd 0x4753(%rip), %xmm0     # 0x646e
movapd %xmm0, 0x300(%rsp)
movb $0x0, 0x310(%rsp)
leal -0x3f(%r13), %edx
subq $0x8, %rsp
leaq 0x3f28(%rsp), %rdi
movl %ebp, %esi
leaq 0x474e(%rip), %rcx      # 0x6493
movl %r13d, %r8d
xorl %eax, %eax
pushq %r10
callq 0x32c4
addq $0x10, %rsp
addq $0x10, %r12
incl %r13d
jmp 0x1ca1
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
callq 0x2b22
cmpl $0x1b, %eax
je 0x25aa
movl %eax, %r13d
cmpl $0x51, %eax
je 0x25aa
cmpl $0x71, %r13d
jne 0x1c87
jmp 0x25aa
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
leaq 0x83a1(%rip), %rdx      # 0xa148
pushq $0x14
popq %rcx
callq 0x28ff
jmp 0x1547
movl %ebp, %edi
callq 0x2886
xorb $0x1, %al
movl %eax, 0x14(%rsp)
jmp 0x1547
xorl %edi, %edi
callq 0x2886
xorb $0x1, %al
movl %eax, 0x14(%rsp)
jne 0x1547
andq $0x0, 0xaa9f(%rip)      # 0xc880
jmp 0x1547
callq 0x30cd
jmp 0x1547
leaq 0x3f20(%rsp), %r12
movq %r12, %rdi
pushq $0x32
popq %rsi
pushq $0x16
popq %rdx
callq 0x30ec
movq %r12, %rdi
callq 0x3077
xorl %r13d, %r13d
movl $0x0, 0x24(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x28(%rsp)
leaq 0x3f20(%rsp), %r12
movq %r12, %rdi
movl $0x10007, %esi          # imm = 0x10007
pushq $0x20
popq %rdx
callq 0x3122
movq %r12, %rdi
pushq $0x7
popq %rsi
callq 0x3629
movq %r12, %rdi
movl %ebp, %esi
movl %ebp, %r12d
movl %ebp, %edx
leaq 0x4665(%rip), %rcx      # 0x64b9
xorl %eax, %eax
callq 0x32c4
movl %r13d, %esi
movl 0x24(%rsp), %r13d
movslq %r13d, %rax
cmpl $0xd, %esi
je 0x1f60
cmpl $0x2b, %esi
movl %r12d, %ebp
movq 0x28(%rsp), %r12
je 0x1ec0
cmpl $0x2d, %esi
je 0x1ec0
cmpl $0x3c, %esi
je 0x1f4b
cmpl $0x3d, %esi
je 0x1ec0
cmpl $0x3e, %esi
je 0x1f3c
cmpl $0x142, %esi            # imm = 0x142
je 0x1f25
cmpl $0x141, %esi            # imm = 0x141
jne 0x216c
xorl %eax, %eax
testl %r13d, %r13d
setg %al
subl %eax, %r13d
jmp 0x216c
imulq $0x34, %rax, %rax
movq 0x48(%rsp), %rcx
cmpb $0x1, (%rcx,%rax)
jne 0x216c
addq %rcx, %rax
movl 0x30(%rax), %ecx
xorl %edx, %edx
cmpl $0x2d, %esi
setne %dl
leal (%rcx,%rdx,2), %esi
cmpl $0x10, %esi
ja 0x216c
testl %ecx, %ecx
js 0x1f01
movq %rcx, %rsi
shlq $0x4, %rsi
movq 0x40(%rsp), %rdi
decl 0xc(%rdi,%rsi)
leal (%rcx,%rdx,2), %ecx
decl %ecx
movl %ecx, 0x30(%rax)
testl %ecx, %ecx
js 0x216c
movl %ecx, %eax
shlq $0x4, %rax
movq 0x40(%rsp), %rcx
incl 0xc(%rcx,%rax)
jmp 0x216c
imull $0x13, %r12d, %eax
addl $0x12, %eax
xorl %ecx, %ecx
cmpl %eax, %r13d
setl %cl
addl %ecx, %r13d
jmp 0x216c
cmpl $0x5, %r12d
jg 0x216c
incl %r12d
jmp 0x1f57
testl %r12d, %r12d
jle 0x216c
decl %r12d
imull $0x13, %r12d, %r13d
jmp 0x216c
imulq $0x34, %rax, %rcx
movq 0x48(%rsp), %rax
cmpb $0x0, (%rax,%rcx)
je 0x1f77
movl %r12d, %ebp
jmp 0x2167
cmpl 0x3c8(%r14), %r13d
movl %r12d, %ebp
jge 0x2167
addq %rax, %rcx
movq %rcx, 0x50(%rsp)
leaq 0x300(%rsp), %r12
movq %r12, %rdi
pushq $0x2e
popq %rsi
pushq $0xe
popq %rdx
callq 0x30ec
movq %r12, %rdi
callq 0x3077
movq %r12, %rdi
movl $0x10007, %esi          # imm = 0x10007
pushq $0x20
popq %rdx
callq 0x3122
movq %r12, %rdi
movl $0x10003, %esi          # imm = 0x10003
callq 0x3629
movq %r12, %rdi
pushq $0x10
popq %rsi
movl %ebp, %edx
leaq 0x4540(%rip), %rcx      # 0x6519
xorl %eax, %eax
callq 0x32c4
movq %r12, %rdi
movl %ebp, %esi
pushq $0x2
popq %rdx
leaq 0x453c(%rip), %rcx      # 0x652b
xorl %eax, %eax
callq 0x32c4
pushq $0x41
popq %rax
movl %eax, %r13d
xorl %r12d, %r12d
cmpq $0x208, %r12            # imm = 0x208
je 0x20f3
leaq 0x9c(%rsp), %rdi
callq 0x3fc4
movl 0xcc(%rsp), %eax
movl %eax, 0x100(%rsp,%r12)
movupd 0x9c(%rsp), %xmm0
movupd 0xac(%rsp), %xmm1
movups 0xbc(%rsp), %xmm2
movups %xmm2, 0xf0(%rsp,%r12)
movupd %xmm1, 0xe0(%rsp,%r12)
movupd %xmm0, 0xd0(%rsp,%r12)
movapd %xmm1, 0x70(%rsp)
movaps %xmm2, 0x80(%rsp)
movapd %xmm0, 0x60(%rsp)
movl %eax, 0x90(%rsp)
movl 0x78(%rsp), %eax
movq %rax, 0x8(%rsp)
movl 0x80(%rsp), %eax
movq %rax, 0x18(%rsp)
movl 0x84(%rsp), %eax
movq %rax, 0x30(%rsp)
movl 0x88(%rsp), %r11d
movl 0x8c(%rsp), %r10d
leal -0x3e(%r13), %edx
subq $0x8, %rsp
leaq 0x308(%rsp), %rdi
movl %ebp, %esi
leaq 0x4497(%rip), %rcx      # 0x655b
movl %r13d, %r8d
leaq 0x69(%rsp), %r9
xorl %eax, %eax
pushq %r10
pushq %r11
pushq 0x48(%rsp)
pushq 0x38(%rsp)
pushq 0x30(%rsp)
callq 0x32c4
addq $0x30, %rsp
addq $0x34, %r12
incl %r13d
jmp 0x1fff
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
callq 0x2b22
cmpl $0x1b, %eax
je 0x2156
cmpl $0x51, %eax
je 0x2156
cmpl $0x71, %eax
je 0x2156
addl $-0x61, %eax
cmpl $0x9, %eax
ja 0x20f3
movl %eax, %eax
imulq $0x34, %rax, %rax
movl 0x100(%rsp,%rax), %ecx
movq 0x50(%rsp), %rdx
movl %ecx, 0x30(%rdx)
movupd 0xd0(%rsp,%rax), %xmm0
movupd 0xe0(%rsp,%rax), %xmm1
movups 0xf0(%rsp,%rax), %xmm2
movups %xmm2, 0x20(%rdx)
movupd %xmm1, 0x10(%rdx)
movupd %xmm0, (%rdx)
callq 0x30ab
movq 0x28(%rsp), %r12
movl 0x24(%rsp), %r13d
jmp 0x216c
movq 0x28(%rsp), %r12
leal 0x1(%r12), %r8d
leaq 0x3f20(%rsp), %rdi
movl %ebp, %esi
pushq $0x15
popq %rdx
leaq 0x4368(%rip), %rcx      # 0x64ed
xorl %eax, %eax
callq 0x32c4
movq %r12, 0x28(%rsp)
imull $0x13, %r12d, %eax
movslq %eax, %rcx
movl %r13d, 0x24(%rsp)
movslq %r13d, %rax
movq %rcx, %rdx
subq %rax, %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, 0x30(%rsp)
imulq $0x34, %rcx, %r13
addq 0x48(%rsp), %r13
xorl %r12d, %r12d
cmpq $0x13, %r12
je 0x22e9
movq 0x30(%rsp), %rax
leaq (%rax,%r12), %rcx
cmpq $0x80, %rcx
jg 0x22e9
movq 0x50(%rsp), %rax
movups 0x4437(%rip), %xmm0     # 0x661f
movups %xmm0, 0x31f(%rsp)
movaps 0x4419(%rip), %xmm0     # 0x6610
movaps %xmm0, 0x310(%rsp)
movapd 0x43f9(%rip), %xmm0     # 0x6600
movapd %xmm0, 0x300(%rsp)
addq %r12, %rax
jne 0x222d
movb $0x72, 0x301(%rsp)
movb $0x2d, 0x30d(%rsp)
movb $0x2b, 0x319(%rsp)
cmpb $0x0, (%r13)
jne 0x2276
movb $0x4b, 0x300(%rsp)
movb $0x0, 0x309(%rsp)
movslq 0x3c8(%r14), %rsi
leaq 0x1(%r13), %rdx
cmpq %rsi, %rcx
jge 0x2273
movupd 0x42a9(%rip), %xmm0     # 0x6505
movupd %xmm0, (%rdx)
movl $0x296572, 0x10(%rdx)   # imm = 0x296572
testq %rax, %rax
jne 0x2276
movb $0x72, 0x3(%r13)
jmp 0x2276
movb $0x0, (%rdx)
leaq 0x1(%r13), %r8
movl 0x30(%r13), %eax
leal 0x41(%rax), %r9d
testl %eax, %eax
pushq $0x20
popq %rax
cmovsl %eax, %r9d
movl 0x18(%r13), %eax
movq %rax, 0x8(%rsp)
movl 0x20(%r13), %eax
movq %rax, 0x18(%rsp)
movl 0x24(%r13), %ebp
movl 0x28(%r13), %r10d
movl 0x2c(%r13), %r11d
leal 0x2(%r12), %edx
subq $0x8, %rsp
leaq 0x3f28(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x308(%rsp), %rcx
xorl %eax, %eax
pushq %r11
pushq %r10
pushq %rbp
pushq 0x38(%rsp)
pushq 0x30(%rsp)
callq 0x32c4
addq $0x30, %rsp
incq %r12
addq $0x34, %r13
jmp 0x21bc
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
callq 0x2b22
cmpl $0x1b, %eax
pushq $0x1
popq %rbp
movq 0x28(%rsp), %rcx
je 0x25aa
movl %eax, %r13d
cmpl $0x71, %eax
je 0x25aa
cmpl $0x51, %r13d
jne 0x1e1b
jmp 0x25aa
movl %r12d, 0x30(%rsp)
movl $0x1e, 0xd0(%rsp)
movl $0xc, 0x60(%rsp)
pushq $0xc
popq %rax
movl %eax, 0x18(%rsp)
pushq $0x1e
popq %rax
movl %eax, 0x8(%rsp)
leaq 0x300(%rsp), %r13
movq %r13, %rdi
leaq 0x40c8(%rip), %rsi      # 0x6425
callq 0x2d38
xorl %r12d, %r12d
movq %r13, %rdi
pushq $0x6
popq %rsi
pushq $0xc
popq %rdx
leaq 0x40c4(%rip), %rcx      # 0x6439
xorl %eax, %eax
callq 0x32c4
leaq 0x3f20(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
pushq $0x3c
popq %rcx
pushq $0x18
popq %r8
callq 0x2e1a
leaq 0x7b40(%rsp), %rdi
movl 0x8(%rsp), %esi
movl 0x18(%rsp), %r13d
movl %r13d, %edx
callq 0x3606
movzwl %ax, %r8d
leaq 0x3f20(%rsp), %rdi
movl 0x8(%rsp), %esi
movl %r13d, %edx
movl $0x10107, %ecx          # imm = 0x10107
callq 0x2ea2
leaq 0x3f20(%rsp), %rdi
callq 0x3077
movl 0x8(%rsp), %r13d
testb $0x1, %r12b
jne 0x24de
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
callq 0x2b22
cmpl $0x1b, %eax
movl 0x18(%rsp), %r12d
je 0x251b
cmpl $0x51, %eax
je 0x251b
cmpl $0x71, %eax
je 0x251b
leaq 0x3f20(%rsp), %rdi
movq %rax, 0x8(%rsp)
movl %r13d, %esi
movl %r12d, %edx
callq 0x35a9
movq 0x8(%rsp), %rax
addl $0xfffffecf, %eax       # imm = 0xFFFFFECF
cmpl $0x13, %eax
ja 0x249c
leaq 0x3bd4(%rip), %rcx      # 0x6018
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
leaq 0x60(%rsp), %rax
pushq $-0x1
popq %rcx
jmpq *%rdx
decl %r13d
jmp 0x2485
incl %r13d
jmp 0x2476
leaq 0xd0(%rsp), %rax
jmp 0x247e
leaq 0xd0(%rsp), %rax
jmp 0x248d
decl %r13d
movl %r13d, 0xd0(%rsp)
movl %ebp, %ecx
jmp 0x248d
incl %r13d
movl %r13d, 0xd0(%rsp)
addl %ecx, (%rax)
movl 0xd0(%rsp), %r13d
movl 0x60(%rsp), %r12d
leaq 0x7b40(%rsp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x3606
movzwl %ax, %r8d
leaq 0x3f20(%rsp), %rdi
movl %r13d, %esi
movl %r12d, 0x18(%rsp)
movl %r12d, %edx
movl $0x10107, %ecx          # imm = 0x10107
callq 0x2ea2
cmpl $0xd, 0x8(%rsp)
sete %r12b
jmp 0x23dc
callq 0x30ab
callq 0x30ab
movq %r14, %rdi
movl 0x30(%rsp), %esi
movl %r13d, %edx
movl 0x18(%rsp), %ecx
callq 0x41ec
testb %al, %al
jne 0x1547
leaq 0x3d2e(%rip), %rsi      # 0x6238
xorl %eax, %eax
callq 0x2b64
movl %r13d, 0x8(%rsp)
jmp 0x234b
callq 0x30ab
jmp 0x25aa
movl %r13d, %r12d
callq 0x308d
leaq 0x300(%rsp), %rdi
leaq 0x3f6b(%rip), %rsi      # 0x64a7
callq 0x2d38
xorl %r13d, %r13d
addl $-0x61, %r13d
cmpl $0x10, %r13d
jb 0x2587
movq %r14, %rdi
leaq 0xb758(%rsp), %rsi
movl %ebp, %edx
callq 0x4e95
movq %r14, %rdi
leaq 0x7b40(%rsp), %rsi
callq 0x2b22
cmpl $0x1b, %eax
je 0x2583
movl %eax, %r13d
cmpl $0x71, %eax
je 0x2583
cmpl $0x51, %r13d
jne 0x2544
pushq $-0x1
popq %r13
callq 0x30ab
movl %r12d, %eax
shlq $0x4, %rax
movq 0x40(%rsp), %rcx
movl %r13d, 0x8(%rcx,%rax)
leaq 0x3f20(%rsp), %rdi
callq 0x3077
callq 0x30ab
jmp 0x1547
callq 0x2668
andq $0x0, 0xa2bf(%rip)      # 0xc880
movq %r14, %rdi
callq 0x41d6
callq 0x308d
callq 0x308d
callq 0x308d
callq 0x308d
leaq 0xb758(%rsp), %rdi
callq 0x304c
leaq 0x12f88(%rsp), %rdi
callq 0x304c
leaq 0x7b40(%rsp), %rdi
callq 0x304c
leaq 0xf370(%rsp), %rdi
callq 0x304c
callq 0x3005
xorl %eax, %eax
addq $0x1a7b8, %rsp          # imm = 0x1A7B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3005
movl 0x5c(%rsp), %ecx
movl 0x3c(%rsp), %r8d
leaq 0x3a39(%rip), %rdi      # 0x6078
pushq $0x50
popq %rsi
pushq $0x18
popq %rdx
xorl %eax, %eax
callq 0x10c0
movq 0x798d(%rip), %rax      # 0x9fe0
movq (%rax), %rdi
callq 0x11d0
callq 0x1170
pushq $0x1
popq %rdi
callq 0x1240