// File: s0sasaki[P]ExecutableBlockchain/compiler.cpp
// Function: Compiler::compile(int*, char const*, unsigned int)
void Compiler::compile(int32_t *bin_data, const char *src_data, uint32_t bc_length) {
    std::vector<std::string> strtable;
    int32_t rsp = 0;
    int32_t rspbuf[256];
    int32_t i    = 0;
    int32_t midx = 2; 
    bool capture = false;
    std::string recur = "";
    read(strtable, src_data);
    while(i < strtable.size()) {
        std::string wordstr = strtable[i++];

        if(var_dict.count(wordstr)>0){
            bin_data[midx++] = VM::OP_PUSH;
            bin_data[midx++] = var_dict[wordstr];
            continue;
        }
        
        if(wordstr == "VARIABLE"){
            var_dict[strtable[i]] = (int32_t) stoi(strtable[i+1]);
            i+=2;
            continue;
        }

        if(capture) {
            func_dict[wordstr] = std::make_pair(midx, bc_length);
            capture = false;
            recur = wordstr;
            continue;
        }

        if(wordstr == ":")    {
            capture = true;
            continue;
        }

        if(wordstr == ";")    {
            bin_data[midx++] = VM::OP_RET;
            recur       = "";
            continue;
        }

        if(func_dict.count(wordstr) > 0){
            if(recur == wordstr && strtable[i] == "THEN" && strtable[i+1] == ";") {
                bin_data[midx++] = VM::OP_JMP;
                bin_data[midx++] = func_dict[wordstr].first;
                continue;
            }
            bin_data[midx++] = VM::OP_CALL;
            bin_data[midx++] = func_dict[wordstr].second;
            bin_data[midx++] = func_dict[wordstr].first;
            continue;
        }

        if(isNum(wordstr.c_str())) {
            bin_data[midx++] = VM::OP_PUSH;
            int32_t val = stoi(wordstr);
            bin_data[midx++] = val;
            continue;
        }

        if(wordstr == "IF") {
            bin_data[midx++] = VM::OP_JZ;
            rspbuf[++rsp] = midx++;
            continue;
        }

        if(wordstr == "ELSE") {
            int32_t rsptemp = rspbuf[rsp--];
            bin_data[midx++] = VM::OP_JMP;
            rspbuf[++rsp] = midx++;
            bin_data[rsptemp] = midx;
            continue;
        }

        if(wordstr == "THEN") {
            int32_t rsptemp = rspbuf[rsp--];
            bin_data[rsptemp] = midx;
            continue;
        }

        if(wordstr == "+")    { bin_data[midx++] = VM::OP_ADD;   continue; }
        if(wordstr == "-")    { bin_data[midx++] = VM::OP_SUB;   continue; }
        if(wordstr == "*")    { bin_data[midx++] = VM::OP_MUL;   continue; }
        if(wordstr == "/")    { bin_data[midx++] = VM::OP_DIV;   continue; }
        if(wordstr == ".")    { bin_data[midx++] = VM::OP_DOT;   continue; }
        if(wordstr == "<=")   { bin_data[midx++] = VM::OP_GE;    continue; }
        if(wordstr == ">=")   { bin_data[midx++] = VM::OP_LE;    continue; }
        if(wordstr == "<")    { bin_data[midx++] = VM::OP_GNE;   continue; }
        if(wordstr == ">")    { bin_data[midx++] = VM::OP_LNE;   continue; }
        if(wordstr == "HALT") { bin_data[midx++] = VM::OP_HALT;  continue; }
        if(wordstr == "POP")  { bin_data[midx++] = VM::OP_POP;   continue; }
        if(wordstr == "DROP") { bin_data[midx++] = VM::OP_DROP;  continue; }
        if(wordstr == "DUP")  { bin_data[midx++] = VM::OP_DUP;   continue; }
        if(wordstr == "OVER") { bin_data[midx++] = VM::OP_OVER;  continue; }
        if(wordstr == "SWAP") { bin_data[midx++] = VM::OP_SWAP;  continue; }
        if(wordstr == "@")    { bin_data[midx++] = VM::OP_LOAD;  continue; }
        if(wordstr == "!")    { bin_data[midx++] = VM::OP_STORE; continue; }

        std::cout << "ERROR UNKNOWN WORD: " << wordstr << std::endl;
        for(int32_t i = 0; i < Block::DATA_SIZE; i++) {
            bin_data[i] = VM::OP_HALT;
        }
        return;
    }
    if (func_dict.count("MAIN") > 0 && func_dict["MAIN"].second == bc_length ){
        bin_data[0]  = VM::OP_JMP;
        bin_data[1]  = func_dict["MAIN"].first;
    } else {
        bin_data[0]  = VM::OP_HALT;
        bin_data[1]  = VM::OP_HALT;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x640, %rsp            # imm = 0x640
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x550(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4b40
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x444(%rbp)
movl $0x2, -0x448(%rbp)
movb $0x0, -0x449(%rbp)
leaq -0x471(%rbp), %rdi
movq %rdi, -0x548(%rbp)
callq 0x2360
movq -0x548(%rbp), %rdx
leaq 0x898c(%rip), %rsi      # 0xc35d
leaq -0x470(%rbp), %rdi
callq 0x22d0
jmp 0x39df
leaq -0x471(%rbp), %rdi
callq 0x2260
movq -0x550(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x38(%rbp), %rsi
callq 0x37c0
jmp 0x3a01
jmp 0x3a03
movslq -0x444(%rbp), %rax
movq %rax, -0x558(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4b60
movq %rax, %rcx
movq -0x558(%rbp), %rax
cmpq %rcx, %rax
jae 0x4786
movslq -0x444(%rbp), %rsi
movl %esi, %eax
incl %eax
movl %eax, -0x444(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4b80
movq %rax, %rsi
leaq -0x4a8(%rbp), %rdi
callq 0x20e0
jmp 0x3a58
movq -0x550(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x4ba0
movq %rax, -0x560(%rbp)
jmp 0x3a74
movq -0x560(%rbp), %rax
cmpq $0x0, %rax
jbe 0x3b4d
movq -0x550(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x448(%rbp), %rcx
movl %ecx, %edx
incl %edx
movl %edx, -0x448(%rbp)
movl $0x9, (%rax,%rcx,4)
leaq -0x4a8(%rbp), %rsi
callq 0x4c00
movq %rax, -0x568(%rbp)
jmp 0x3abd
movq -0x568(%rbp), %rax
movl (%rax), %edx
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x448(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x480(%rbp)
movl %eax, -0x484(%rbp)
leaq -0x471(%rbp), %rdi
callq 0x2260
jmp 0x4aa3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x480(%rbp)
movl %eax, -0x484(%rbp)
jmp 0x4a97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x480(%rbp)
movl %eax, -0x484(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x2140
jmp 0x4a97
leaq 0x85da(%rip), %rsi      # 0xc12e
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x569(%rbp)
jmp 0x3b68
movb -0x569(%rbp), %al
testb $0x1, %al
jne 0x3b77
jmp 0x3bf9
movl -0x444(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x4b80
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x4d10
movl %eax, -0x570(%rbp)
jmp 0x3ba4
movslq -0x444(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x4b80
movq -0x550(%rbp), %rdi
movq %rax, %rsi
callq 0x4c00
movq %rax, -0x578(%rbp)
jmp 0x3bcc
movq -0x578(%rbp), %rax
movl -0x570(%rbp), %ecx
movl %ecx, (%rax)
movl -0x444(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x444(%rbp)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
testb $0x1, -0x449(%rbp)
je 0x3c8d
leaq -0x448(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x4d50
movq %rax, -0x580(%rbp)
jmp 0x3c1f
movq -0x550(%rbp), %rdi
movq -0x580(%rbp), %rax
movq %rax, -0x4b4(%rbp)
addq $0x30, %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x4d80
movq %rax, -0x588(%rbp)
jmp 0x3c4d
movq -0x588(%rbp), %rdi
leaq -0x4b4(%rbp), %rsi
callq 0x4e60
jmp 0x3c62
movb $0x0, -0x449(%rbp)
leaq -0x470(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x2040
jmp 0x3c7e
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x84a3(%rip), %rsi      # 0xc137
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x589(%rbp)
jmp 0x3ca8
movb -0x589(%rbp), %al
testb $0x1, %al
jne 0x3cb4
jmp 0x3cca
movb $0x1, -0x449(%rbp)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x8468(%rip), %rsi      # 0xc139
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x58a(%rbp)
jmp 0x3ce5
movb -0x58a(%rbp), %al
testb $0x1, %al
jne 0x3cf1
jmp 0x3d31
movq -0x10(%rbp), %rax
movslq -0x448(%rbp), %rcx
movl %ecx, %edx
incl %edx
movl %edx, -0x448(%rbp)
movl $0x0, (%rax,%rcx,4)
leaq 0x8649(%rip), %rsi      # 0xc35d
leaq -0x470(%rbp), %rdi
callq 0x22c0
jmp 0x3d22
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
movq -0x550(%rbp), %rdi
addq $0x30, %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x4e90
movq %rax, -0x598(%rbp)
jmp 0x3d51
movq -0x598(%rbp), %rax
cmpq $0x0, %rax
jbe 0x3f0b
leaq -0x470(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x4ef0
testb $0x1, %al
jne 0x3d7e
jmp 0x3e5a
movslq -0x444(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x4b80
movq %rax, %rdi
leaq 0x83a3(%rip), %rsi      # 0xc13b
callq 0x4ce0
movb %al, -0x599(%rbp)
jmp 0x3da5
movb -0x599(%rbp), %al
testb $0x1, %al
jne 0x3db4
jmp 0x3e5a
movl -0x444(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x4b80
movq %rax, %rdi
leaq 0x8367(%rip), %rsi      # 0xc139
callq 0x4ce0
movb %al, -0x59a(%rbp)
jmp 0x3ddf
movb -0x59a(%rbp), %al
testb $0x1, %al
jne 0x3deb
jmp 0x3e5a
movq -0x550(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x448(%rbp), %rcx
movl %ecx, %edx
incl %edx
movl %edx, -0x448(%rbp)
movl $0x2, (%rax,%rcx,4)
addq $0x30, %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x4d80
movq %rax, -0x5a8(%rbp)
jmp 0x3e27
movq -0x5a8(%rbp), %rax
movl (%rax), %edx
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x448(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
movq -0x550(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x448(%rbp), %rcx
movl %ecx, %edx
incl %edx
movl %edx, -0x448(%rbp)
movl $0x1, (%rax,%rcx,4)
addq $0x30, %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x4d80
movq %rax, -0x5b0(%rbp)
jmp 0x3e96
movq -0x550(%rbp), %rdi
movq -0x5b0(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x10(%rbp), %rax
movslq -0x448(%rbp), %rcx
movl %ecx, %esi
incl %esi
movl %esi, -0x448(%rbp)
movl %edx, (%rax,%rcx,4)
addq $0x30, %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x4d80
movq %rax, -0x5b8(%rbp)
jmp 0x3ed8
movq -0x5b8(%rbp), %rax
movl (%rax), %edx
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x448(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq -0x4a8(%rbp), %rdi
callq 0x20d0
movq -0x550(%rbp), %rdi
movq %rax, %rsi
callq 0x4f80
movb %al, -0x5b9(%rbp)
jmp 0x3f2e
movb -0x5b9(%rbp), %al
testb $0x1, %al
jne 0x3f3a
jmp 0x3faf
movq -0x10(%rbp), %rax
movslq -0x448(%rbp), %rcx
movl %ecx, %edx
incl %edx
movl %edx, -0x448(%rbp)
movl $0x9, (%rax,%rcx,4)
xorl %eax, %eax
movl %eax, %esi
leaq -0x4a8(%rbp), %rdi
movl $0xa, %edx
callq 0x4d10
movl %eax, -0x5c0(%rbp)
jmp 0x3f73
movl -0x5c0(%rbp), %eax
movl %eax, -0x4b8(%rbp)
movl -0x4b8(%rbp), %edx
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x448(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x818a(%rip), %rsi      # 0xc140
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5c1(%rbp)
jmp 0x3fca
movb -0x5c1(%rbp), %al
testb $0x1, %al
jne 0x3fd6
jmp 0x4027
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x3, (%rax,%rcx,4)
movl -0x448(%rbp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, -0x448(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
cltq
movl %ecx, -0x440(%rbp,%rax,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x8115(%rip), %rsi      # 0xc143
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5c2(%rbp)
jmp 0x4042
movb -0x5c2(%rbp), %al
testb $0x1, %al
jne 0x404e
jmp 0x40cd
movl -0x3c(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x3c(%rbp)
cltq
movl -0x440(%rbp,%rax,4), %eax
movl %eax, -0x4bc(%rbp)
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x2, (%rax,%rcx,4)
movl -0x448(%rbp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, -0x448(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
cltq
movl %ecx, -0x440(%rbp,%rax,4)
movl -0x448(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x4bc(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x8067(%rip), %rsi      # 0xc13b
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5c3(%rbp)
jmp 0x40e8
movb -0x5c3(%rbp), %al
testb $0x1, %al
jne 0x40f4
jmp 0x4131
movl -0x3c(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x3c(%rbp)
cltq
movl -0x440(%rbp,%rax,4), %eax
movl %eax, -0x4c0(%rbp)
movl -0x448(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x4c0(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x8010(%rip), %rsi      # 0xc148
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5c4(%rbp)
jmp 0x414c
movb -0x5c4(%rbp), %al
testb $0x1, %al
jne 0x4158
jmp 0x4186
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0xf, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7fbd(%rip), %rsi      # 0xc14a
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5c5(%rbp)
jmp 0x41a1
movb -0x5c5(%rbp), %al
testb $0x1, %al
jne 0x41ad
jmp 0x41db
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x10, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7f6a(%rip), %rsi      # 0xc14c
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5c6(%rbp)
jmp 0x41f6
movb -0x5c6(%rbp), %al
testb $0x1, %al
jne 0x4202
jmp 0x4230
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x11, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7f17(%rip), %rsi      # 0xc14e
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5c7(%rbp)
jmp 0x424b
movb -0x5c7(%rbp), %al
testb $0x1, %al
jne 0x4257
jmp 0x4285
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x12, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7ec4(%rip), %rsi      # 0xc150
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5c8(%rbp)
jmp 0x42a0
movb -0x5c8(%rbp), %al
testb $0x1, %al
jne 0x42ac
jmp 0x42da
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x13, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7e71(%rip), %rsi      # 0xc152
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5c9(%rbp)
jmp 0x42f5
movb -0x5c9(%rbp), %al
testb $0x1, %al
jne 0x4301
jmp 0x432f
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x5, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7e1f(%rip), %rsi      # 0xc155
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5ca(%rbp)
jmp 0x434a
movb -0x5ca(%rbp), %al
testb $0x1, %al
jne 0x4356
jmp 0x4384
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x6, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7dcd(%rip), %rsi      # 0xc158
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5cb(%rbp)
jmp 0x439f
movb -0x5cb(%rbp), %al
testb $0x1, %al
jne 0x43ab
jmp 0x43d9
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x7, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7d7a(%rip), %rsi      # 0xc15a
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5cc(%rbp)
jmp 0x43f4
movb -0x5cc(%rbp), %al
testb $0x1, %al
jne 0x4400
jmp 0x442e
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x8, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7d27(%rip), %rsi      # 0xc15c
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5cd(%rbp)
jmp 0x4449
movb -0x5cd(%rbp), %al
testb $0x1, %al
jne 0x4455
jmp 0x4483
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x14, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7cd7(%rip), %rsi      # 0xc161
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5ce(%rbp)
jmp 0x449e
movb -0x5ce(%rbp), %al
testb $0x1, %al
jne 0x44aa
jmp 0x44d8
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0xa, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7c86(%rip), %rsi      # 0xc165
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5cf(%rbp)
jmp 0x44f3
movb -0x5cf(%rbp), %al
testb $0x1, %al
jne 0x44ff
jmp 0x452d
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0xe, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7c36(%rip), %rsi      # 0xc16a
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5d0(%rbp)
jmp 0x4548
movb -0x5d0(%rbp), %al
testb $0x1, %al
jne 0x4554
jmp 0x4582
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0xb, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7be5(%rip), %rsi      # 0xc16e
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5d1(%rbp)
jmp 0x459d
movb -0x5d1(%rbp), %al
testb $0x1, %al
jne 0x45a9
jmp 0x45d7
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0xc, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7b95(%rip), %rsi      # 0xc173
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5d2(%rbp)
jmp 0x45f2
movb -0x5d2(%rbp), %al
testb $0x1, %al
jne 0x45fe
jmp 0x462c
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0xd, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7b45(%rip), %rsi      # 0xc178
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5d3(%rbp)
jmp 0x4647
movb -0x5d3(%rbp), %al
testb $0x1, %al
jne 0x4653
jmp 0x4681
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x16, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
leaq 0x7af2(%rip), %rsi      # 0xc17a
leaq -0x4a8(%rbp), %rdi
callq 0x4ce0
movb %al, -0x5d4(%rbp)
jmp 0x469c
movb -0x5d4(%rbp), %al
testb $0x1, %al
jne 0x46a8
jmp 0x46d6
movq -0x10(%rbp), %rax
movl -0x448(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x448(%rbp)
movslq %ecx, %rcx
movl $0x17, (%rax,%rcx,4)
movl $0x2, -0x4ac(%rbp)
jmp 0x4766
movq 0xd8f3(%rip), %rdi      # 0x11fd0
leaq 0x7a98(%rip), %rsi      # 0xc17c
callq 0x2210
movq %rax, -0x5e0(%rbp)
jmp 0x46f2
movq -0x5e0(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x21c0
movq %rax, -0x5e8(%rbp)
jmp 0x470e
movq -0x5e8(%rbp), %rdi
movq 0xd8a4(%rip), %rsi      # 0x11fc0
callq 0x2250
jmp 0x4723
movl $0x0, -0x4c4(%rbp)
cmpl $0x400, -0x4c4(%rbp)    # imm = 0x400
jge 0x475c
movq -0x10(%rbp), %rax
movslq -0x4c4(%rbp), %rcx
movl $0x14, (%rax,%rcx,4)
movl -0x4c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c4(%rbp)
jmp 0x472d
movl $0x1, -0x4ac(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x2140
movl -0x4ac(%rbp), %eax
subl $0x2, %eax
je 0x3a03
jmp 0x4a79
movq -0x550(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x5f8(%rbp)
leaq -0x4e9(%rbp), %rdi
movq %rdi, -0x5f0(%rbp)
callq 0x2360
movq -0x5f0(%rbp), %rdx
movb $0x0, -0x512(%rbp)
movb $0x0, -0x513(%rbp)
leaq 0x79ca(%rip), %rsi      # 0xc191
leaq -0x4e8(%rbp), %rdi
callq 0x22d0
jmp 0x47d5
movq -0x5f8(%rbp), %rdi
leaq -0x4e8(%rbp), %rsi
callq 0x4e90
movq %rax, -0x600(%rbp)
jmp 0x47f1
movq -0x600(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x601(%rbp)
jbe 0x488b
movq -0x550(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x618(%rbp)
leaq -0x511(%rbp), %rdi
movq %rdi, -0x610(%rbp)
callq 0x2360
movq -0x610(%rbp), %rdx
movb $0x1, -0x512(%rbp)
leaq 0x794d(%rip), %rsi      # 0xc191
leaq -0x510(%rbp), %rdi
callq 0x22d0
jmp 0x4852
movq -0x618(%rbp), %rdi
movb $0x1, -0x513(%rbp)
leaq -0x510(%rbp), %rsi
callq 0x4fd0
movq %rax, -0x620(%rbp)
jmp 0x4875
movq -0x620(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x1c(%rbp), %eax
sete %al
movb %al, -0x601(%rbp)
movb -0x601(%rbp), %al
movb %al, -0x621(%rbp)
testb $0x1, -0x513(%rbp)
jne 0x48a2
jmp 0x48ae
leaq -0x510(%rbp), %rdi
callq 0x2140
testb $0x1, -0x512(%rbp)
jne 0x48b9
jmp 0x48c5
leaq -0x511(%rbp), %rdi
callq 0x2260
leaq -0x4e8(%rbp), %rdi
callq 0x2140
leaq -0x4e9(%rbp), %rdi
callq 0x2260
movb -0x621(%rbp), %al
testb $0x1, %al
jne 0x48ec
jmp 0x4a5a
movq -0x550(%rbp), %rax
movq -0x10(%rbp), %rcx
movl $0x2, (%rcx)
addq $0x30, %rax
movq %rax, -0x638(%rbp)
leaq -0x539(%rbp), %rdi
movq %rdi, -0x630(%rbp)
callq 0x2360
movq -0x630(%rbp), %rdx
leaq 0x7868(%rip), %rsi      # 0xc191
leaq -0x538(%rbp), %rdi
callq 0x22d0
jmp 0x4937
movq -0x638(%rbp), %rdi
leaq -0x538(%rbp), %rsi
callq 0x4fd0
movq %rax, -0x640(%rbp)
jmp 0x4953
movq -0x640(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
leaq -0x538(%rbp), %rdi
callq 0x2140
leaq -0x539(%rbp), %rdi
callq 0x2260
jmp 0x4a6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x480(%rbp)
movl %eax, -0x484(%rbp)
jmp 0x4a0c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x480(%rbp)
movl %eax, -0x484(%rbp)
jmp 0x4a00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x480(%rbp)
movl %eax, -0x484(%rbp)
jmp 0x49e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x480(%rbp)
movl %eax, -0x484(%rbp)
testb $0x1, -0x513(%rbp)
jne 0x49d9
jmp 0x49e5
leaq -0x510(%rbp), %rdi
callq 0x2140
jmp 0x49e7
testb $0x1, -0x512(%rbp)
jne 0x49f2
jmp 0x49fe
leaq -0x511(%rbp), %rdi
callq 0x2260
jmp 0x4a00
leaq -0x4e8(%rbp), %rdi
callq 0x2140
leaq -0x4e9(%rbp), %rdi
callq 0x2260
jmp 0x4a97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x480(%rbp)
movl %eax, -0x484(%rbp)
jmp 0x4a4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x480(%rbp)
movl %eax, -0x484(%rbp)
leaq -0x538(%rbp), %rdi
callq 0x2140
leaq -0x539(%rbp), %rdi
callq 0x2260
jmp 0x4a97
movq -0x10(%rbp), %rax
movl $0x14, (%rax)
movq -0x10(%rbp), %rax
movl $0x14, 0x4(%rax)
movl $0x0, -0x4ac(%rbp)
leaq -0x470(%rbp), %rdi
callq 0x2140
leaq -0x38(%rbp), %rdi
callq 0x50b0
addq $0x640, %rsp            # imm = 0x640
popq %rbp
retq
leaq -0x470(%rbp), %rdi
callq 0x2140
leaq -0x38(%rbp), %rdi
callq 0x50b0
movq -0x480(%rbp), %rdi
callq 0x2350
nopl (%rax,%rax)