// File: taurheim[P]AgNES/irGenerator.cpp
// Function: IRGenerator::genTACStatement(ASTNode*)
void IRGenerator::genTACStatement(ASTNode * node) {
    StatementNode * statementNode = (StatementNode *)node;
    switch(statementNode->type) {
        case STMT_NES_WAITFORFRAME: {
            intermediateCode.push_back({ IR_NES_WAITFORFRAME });
            break;
        }
        case STMT_NES_SETSPRITEX: {
            IdentifierNode * globalIdentifier = (IdentifierNode*) node->children[0];
            std::string varName = globalIdentifier->name;

            intermediateCode.push_back({ IR_NES_SETSPRITEX, varName });
            break;
        }
        case STMT_NES_SETSPRITEY: {
            IdentifierNode * globalIdentifier = (IdentifierNode*) node->children[0];
            std::string varName = globalIdentifier->name;

            intermediateCode.push_back({ IR_NES_SETSPRITEY, varName });
            break;
        }
        case STMT_RETURN: {
            std::string returnValueRegister = genTACExpression(node->children[0]);
            intermediateCode.push_back({ IR_RETURN, returnValueRegister });
            break;
        }
        case STMT_FUNCTIONCALL: {
            IdentifierNode * functionIdentifier = (IdentifierNode*) node->children[0];
            std::string functionName = functionIdentifier->name;

            // Push params to the stack
            int parameterCount = 0;
            auto i = node->children.begin() + 1;
            while (i != node->children.end()) {
                ASTNode * argument = *i;
                std::string paramReg = genTACExpression(argument);
                intermediateCode.push_back({ IR_PUSHPARAM, paramReg });
                parameterCount++;
                i++;
            }

            // Call the function
            intermediateCode.push_back({ IR_CALL, functionName});

            // Pop the params off the stack
            intermediateCode.push_back({ IR_POPPARAMS, std::to_string(parameterCount)});
            break;
        }
        case (STMT_WHILE): {
            std::string labelBefore = genLabel();
            std::string labelAfter = genLabel();
            intermediateCode.push_back({ IR_NEWLABEL, labelBefore});
            std::string condition = genTACExpression(node->children[0]);
            intermediateCode.push_back({ IR_IFFALSEGOTO, condition, labelAfter });
            genTACStatement(node->children[1]);
            intermediateCode.push_back({ IR_GOTO, labelBefore });
            intermediateCode.push_back({ IR_NEWLABEL, labelAfter });
            break;
        }
        case (STMT_BLOCK): {
            for (auto & child : statementNode->children) {
                genTACStatement(child);
            }
            break;
        }
        case (STMT_ASSIGN): {
            ASTNode * assignmentNode = node->children[0];
            IdentifierNode * assignTo = (IdentifierNode*) assignmentNode->children[0];
            std::string tempRegister = genTACExpression(assignmentNode->children[1]);
            // TODO scope
            intermediateCode.push_back({ IR_ASSIGN, assignTo->name, tempRegister});
            break;
        }
        case (STMT_IF): {
            ASTNode * condition = node->children[0];
            ASTNode * ifBlock = node->children[1];
            ASTNode * elseBlock = nullptr;
            if (node->children.size() > 2) {
                // Future: handle more than just the else block
                elseBlock = node->children[2];
            }
            std::string falseLabel = genLabel();
            std::string outLabel = genLabel();
            std::string conditionRegister = genTACExpression(condition);
            intermediateCode.push_back({ IR_IFFALSEGOTO, conditionRegister, falseLabel });
            genTACStatement(ifBlock);
            intermediateCode.push_back({ IR_GOTO, outLabel });
            intermediateCode.push_back({ IR_NEWLABEL, falseLabel });
            if (elseBlock != nullptr) {
                genTACStatement(elseBlock);
            }
            intermediateCode.push_back({ IR_NEWLABEL, outLabel });
            break;
        }
        default: {
            return;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x980, %rsp            # imm = 0x980
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x8c8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movq %rax, -0x8c0(%rbp)
subq $0xa, %rax
ja 0x1de09
movq -0x8c0(%rbp), %rax
leaq 0x7974(%rip), %rcx      # 0x24800
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x8d0(%rbp)
movl $0xe, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x3410
leaq -0x58(%rbp), %rdi
callq 0x3410
leaq -0x38(%rbp), %rdi
callq 0x3410
movq -0x8d0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x1e430
jmp 0x1cedb
leaq -0x80(%rbp), %rdi
callq 0x94e0
jmp 0x1de0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x94e0
jmp 0x1de14
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19310
movq (%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rsi
addq $0x20, %rsi
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x8e0(%rbp)
callq 0x3140
movq -0x8c8(%rbp), %rax
movq -0x8e0(%rbp), %rsi
addq $0x10, %rax
movq %rax, -0x8d8(%rbp)
movl $0xf, -0x120(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x3140
jmp 0x1cf73
leaq -0xf8(%rbp), %rdi
callq 0x3410
leaq -0xd8(%rbp), %rdi
callq 0x3410
movq -0x8d8(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x1e430
jmp 0x1cfa0
leaq -0x120(%rbp), %rdi
callq 0x94e0
leaq -0xb8(%rbp), %rdi
callq 0x31d0
jmp 0x1de0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1cfef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x94e0
leaq -0xb8(%rbp), %rdi
callq 0x31d0
jmp 0x1de14
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19310
movq (%rax), %rax
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rsi
addq $0x20, %rsi
leaq -0x148(%rbp), %rdi
movq %rdi, -0x8f0(%rbp)
callq 0x3140
movq -0x8c8(%rbp), %rax
movq -0x8f0(%rbp), %rsi
addq $0x10, %rax
movq %rax, -0x8e8(%rbp)
movl $0x10, -0x1b0(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x3140
jmp 0x1d06a
leaq -0x188(%rbp), %rdi
callq 0x3410
leaq -0x168(%rbp), %rdi
callq 0x3410
movq -0x8e8(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x1e430
jmp 0x1d097
leaq -0x1b0(%rbp), %rdi
callq 0x94e0
leaq -0x148(%rbp), %rdi
callq 0x31d0
jmp 0x1de0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1d0e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x94e0
leaq -0x148(%rbp), %rdi
callq 0x31d0
jmp 0x1de14
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19310
movq -0x8c8(%rbp), %rsi
movq (%rax), %rdx
leaq -0x1d0(%rbp), %rdi
movq %rdi, -0x900(%rbp)
callq 0x1cae0
movq -0x8c8(%rbp), %rax
movq -0x900(%rbp), %rsi
addq $0x10, %rax
movq %rax, -0x8f8(%rbp)
movl $0xd, -0x238(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x3140
jmp 0x1d156
leaq -0x210(%rbp), %rdi
callq 0x3410
leaq -0x1f0(%rbp), %rdi
callq 0x3410
movq -0x8f8(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x1e430
jmp 0x1d183
leaq -0x238(%rbp), %rdi
callq 0x94e0
leaq -0x1d0(%rbp), %rdi
callq 0x31d0
jmp 0x1de0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1d1d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x94e0
leaq -0x1d0(%rbp), %rdi
callq 0x31d0
jmp 0x1de14
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19310
movq (%rax), %rax
movq %rax, -0x240(%rbp)
movq -0x240(%rbp), %rsi
addq $0x20, %rsi
leaq -0x260(%rbp), %rdi
callq 0x3140
movl $0x0, -0x264(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x14e60
movq %rax, -0x278(%rbp)
leaq -0x278(%rbp), %rdi
movl $0x1, %esi
callq 0x19330
movq %rax, -0x270(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x14ed0
movq %rax, -0x280(%rbp)
leaq -0x270(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x14e90
testb $0x1, %al
jne 0x1d27b
jmp 0x1d3a6
leaq -0x270(%rbp), %rdi
callq 0x14f70
movq -0x8c8(%rbp), %rsi
movq (%rax), %rax
movq %rax, -0x288(%rbp)
movq -0x288(%rbp), %rdx
leaq -0x2a8(%rbp), %rdi
callq 0x1cae0
jmp 0x1d2ad
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x908(%rbp)
movl $0xa, -0x310(%rbp)
leaq -0x308(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x3140
jmp 0x1d2de
leaq -0x2e8(%rbp), %rdi
callq 0x3410
leaq -0x2c8(%rbp), %rdi
callq 0x3410
movq -0x908(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x1e430
jmp 0x1d30b
leaq -0x310(%rbp), %rdi
callq 0x94e0
movl -0x264(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x264(%rbp)
leaq -0x270(%rbp), %rdi
xorl %esi, %esi
callq 0x19370
movq %rax, -0x318(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x31d0
jmp 0x1d24b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1d4c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1d395
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x94e0
leaq -0x2a8(%rbp), %rdi
callq 0x31d0
jmp 0x1d4c8
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x910(%rbp)
movl $0x9, -0x380(%rbp)
leaq -0x378(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x3140
jmp 0x1d3d7
leaq -0x358(%rbp), %rdi
callq 0x3410
leaq -0x338(%rbp), %rdi
callq 0x3410
movq -0x910(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x1e430
jmp 0x1d404
leaq -0x380(%rbp), %rdi
callq 0x94e0
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x918(%rbp)
movl $0xb, -0x3e8(%rbp)
leaq -0x3e0(%rbp), %rdi
movl -0x264(%rbp), %esi
callq 0x14c90
jmp 0x1d440
leaq -0x3c0(%rbp), %rdi
callq 0x3410
leaq -0x3a0(%rbp), %rdi
callq 0x3410
movq -0x918(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
callq 0x1e430
jmp 0x1d46d
leaq -0x3e8(%rbp), %rdi
callq 0x94e0
leaq -0x260(%rbp), %rdi
callq 0x31d0
jmp 0x1de0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x94e0
jmp 0x1d4c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x94e0
leaq -0x260(%rbp), %rdi
callq 0x31d0
jmp 0x1de14
movq -0x8c8(%rbp), %rsi
leaq -0x408(%rbp), %rdi
callq 0x1e310
movq -0x8c8(%rbp), %rsi
leaq -0x428(%rbp), %rdi
callq 0x1e310
jmp 0x1d501
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x920(%rbp)
movl $0x3, -0x490(%rbp)
leaq -0x488(%rbp), %rdi
leaq -0x408(%rbp), %rsi
callq 0x3140
jmp 0x1d532
leaq -0x468(%rbp), %rdi
callq 0x3410
leaq -0x448(%rbp), %rdi
callq 0x3410
movq -0x920(%rbp), %rdi
leaq -0x490(%rbp), %rsi
callq 0x1e430
jmp 0x1d55f
leaq -0x490(%rbp), %rdi
callq 0x94e0
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19310
movq -0x8c8(%rbp), %rsi
movq (%rax), %rdx
leaq -0x4b0(%rbp), %rdi
callq 0x1cae0
jmp 0x1d594
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x930(%rbp)
movl $0x6, -0x518(%rbp)
leaq -0x510(%rbp), %rdi
movq %rdi, -0x928(%rbp)
leaq -0x4b0(%rbp), %rsi
callq 0x3140
jmp 0x1d5cc
leaq -0x4f0(%rbp), %rdi
leaq -0x428(%rbp), %rsi
callq 0x3140
jmp 0x1d5e1
leaq -0x4d0(%rbp), %rdi
callq 0x3410
movq -0x930(%rbp), %rdi
leaq -0x518(%rbp), %rsi
callq 0x1e430
jmp 0x1d602
leaq -0x518(%rbp), %rdi
callq 0x94e0
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x19310
movq -0x8c8(%rbp), %rdi
movq (%rax), %rsi
callq 0x1ce40
jmp 0x1d631
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x938(%rbp)
movl $0x4, -0x580(%rbp)
leaq -0x578(%rbp), %rdi
leaq -0x408(%rbp), %rsi
callq 0x3140
jmp 0x1d662
leaq -0x558(%rbp), %rdi
callq 0x3410
leaq -0x538(%rbp), %rdi
callq 0x3410
movq -0x938(%rbp), %rdi
leaq -0x580(%rbp), %rsi
callq 0x1e430
jmp 0x1d68f
leaq -0x580(%rbp), %rdi
callq 0x94e0
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x940(%rbp)
movl $0x3, -0x5e8(%rbp)
leaq -0x5e0(%rbp), %rdi
leaq -0x428(%rbp), %rsi
callq 0x3140
jmp 0x1d6cc
leaq -0x5c0(%rbp), %rdi
callq 0x3410
leaq -0x5a0(%rbp), %rdi
callq 0x3410
movq -0x940(%rbp), %rdi
leaq -0x5e8(%rbp), %rsi
callq 0x1e430
jmp 0x1d6f9
leaq -0x5e8(%rbp), %rdi
callq 0x94e0
leaq -0x4b0(%rbp), %rdi
callq 0x31d0
leaq -0x428(%rbp), %rdi
callq 0x31d0
leaq -0x408(%rbp), %rdi
callq 0x31d0
jmp 0x1de0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1d829
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1d81d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x490(%rbp), %rdi
callq 0x94e0
jmp 0x1d81d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1d811
movq -0x928(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
callq 0x31d0
jmp 0x1d811
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x518(%rbp), %rdi
callq 0x94e0
jmp 0x1d811
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x580(%rbp), %rdi
callq 0x94e0
jmp 0x1d811
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x5e8(%rbp), %rdi
callq 0x94e0
leaq -0x4b0(%rbp), %rdi
callq 0x31d0
leaq -0x428(%rbp), %rdi
callq 0x31d0
leaq -0x408(%rbp), %rdi
callq 0x31d0
jmp 0x1de14
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x5f0(%rbp)
movq -0x5f0(%rbp), %rdi
callq 0x14e60
movq %rax, -0x5f8(%rbp)
movq -0x5f0(%rbp), %rdi
callq 0x14ed0
movq %rax, -0x600(%rbp)
leaq -0x5f8(%rbp), %rdi
leaq -0x600(%rbp), %rsi
callq 0x14e90
testb $0x1, %al
jne 0x1d888
jmp 0x1d8bf
leaq -0x5f8(%rbp), %rdi
callq 0x14f70
movq -0x8c8(%rbp), %rdi
movq %rax, -0x608(%rbp)
movq -0x608(%rbp), %rax
movq (%rax), %rsi
callq 0x1ce40
leaq -0x5f8(%rbp), %rdi
callq 0x14f90
jmp 0x1d86f
jmp 0x1de0b
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
movq %rsi, -0x958(%rbp)
callq 0x19310
movq -0x958(%rbp), %rsi
movq (%rax), %rax
movq %rax, -0x610(%rbp)
movq -0x610(%rbp), %rdi
addq $0x8, %rdi
callq 0x19310
movq (%rax), %rax
movq %rax, -0x618(%rbp)
movq -0x610(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x19310
movq -0x8c8(%rbp), %rsi
movq (%rax), %rdx
leaq -0x638(%rbp), %rdi
callq 0x1cae0
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x950(%rbp)
movl $0x2, -0x6a0(%rbp)
leaq -0x698(%rbp), %rdi
movq %rdi, -0x948(%rbp)
movq -0x618(%rbp), %rsi
addq $0x20, %rsi
callq 0x3140
jmp 0x1d96e
leaq -0x678(%rbp), %rdi
leaq -0x638(%rbp), %rsi
callq 0x3140
jmp 0x1d983
leaq -0x658(%rbp), %rdi
callq 0x3410
movq -0x950(%rbp), %rdi
leaq -0x6a0(%rbp), %rsi
callq 0x1e430
jmp 0x1d9a4
leaq -0x6a0(%rbp), %rdi
callq 0x94e0
leaq -0x638(%rbp), %rdi
callq 0x31d0
jmp 0x1de0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1da13
movq -0x948(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
callq 0x31d0
jmp 0x1da13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x6a0(%rbp), %rdi
callq 0x94e0
leaq -0x638(%rbp), %rdi
callq 0x31d0
jmp 0x1de14
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19310
movq (%rax), %rax
movq %rax, -0x6a8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x19310
movq (%rax), %rax
movq %rax, -0x6b0(%rbp)
movq $0x0, -0x6b8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x17d80
cmpq $0x2, %rax
jbe 0x1da95
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
movl $0x2, %esi
callq 0x19310
movq (%rax), %rax
movq %rax, -0x6b8(%rbp)
movq -0x8c8(%rbp), %rsi
leaq -0x6d8(%rbp), %rdi
callq 0x1e310
movq -0x8c8(%rbp), %rsi
leaq -0x6f8(%rbp), %rdi
callq 0x1e310
jmp 0x1dabd
movq -0x8c8(%rbp), %rsi
movq -0x6a8(%rbp), %rdx
leaq -0x718(%rbp), %rdi
callq 0x1cae0
jmp 0x1dad9
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x968(%rbp)
movl $0x6, -0x780(%rbp)
leaq -0x778(%rbp), %rdi
movq %rdi, -0x960(%rbp)
leaq -0x718(%rbp), %rsi
callq 0x3140
jmp 0x1db11
leaq -0x758(%rbp), %rdi
leaq -0x6d8(%rbp), %rsi
callq 0x3140
jmp 0x1db26
leaq -0x738(%rbp), %rdi
callq 0x3410
movq -0x968(%rbp), %rdi
leaq -0x780(%rbp), %rsi
callq 0x1e430
jmp 0x1db47
leaq -0x780(%rbp), %rdi
callq 0x94e0
movq -0x8c8(%rbp), %rdi
movq -0x6b0(%rbp), %rsi
callq 0x1ce40
jmp 0x1db68
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x970(%rbp)
movl $0x4, -0x7e8(%rbp)
leaq -0x7e0(%rbp), %rdi
leaq -0x6f8(%rbp), %rsi
callq 0x3140
jmp 0x1db99
leaq -0x7c0(%rbp), %rdi
callq 0x3410
leaq -0x7a0(%rbp), %rdi
callq 0x3410
movq -0x970(%rbp), %rdi
leaq -0x7e8(%rbp), %rsi
callq 0x1e430
jmp 0x1dbc6
leaq -0x7e8(%rbp), %rdi
callq 0x94e0
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x978(%rbp)
movl $0x3, -0x850(%rbp)
leaq -0x848(%rbp), %rdi
leaq -0x6d8(%rbp), %rsi
callq 0x3140
jmp 0x1dc03
leaq -0x828(%rbp), %rdi
callq 0x3410
leaq -0x808(%rbp), %rdi
callq 0x3410
movq -0x978(%rbp), %rdi
leaq -0x850(%rbp), %rsi
callq 0x1e430
jmp 0x1dc30
leaq -0x850(%rbp), %rdi
callq 0x94e0
cmpq $0x0, -0x6b8(%rbp)
je 0x1dd35
movq -0x8c8(%rbp), %rdi
movq -0x6b8(%rbp), %rsi
callq 0x1ce40
jmp 0x1dc5f
jmp 0x1dd35
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1ddfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1ddef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1dde3
movq -0x960(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
callq 0x31d0
jmp 0x1dde3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x780(%rbp), %rdi
callq 0x94e0
jmp 0x1dde3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x7e8(%rbp), %rdi
callq 0x94e0
jmp 0x1dde3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x850(%rbp), %rdi
callq 0x94e0
jmp 0x1dde3
movq -0x8c8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x980(%rbp)
movl $0x3, -0x8b8(%rbp)
leaq -0x8b0(%rbp), %rdi
leaq -0x6f8(%rbp), %rsi
callq 0x3140
jmp 0x1dd66
leaq -0x890(%rbp), %rdi
callq 0x3410
leaq -0x870(%rbp), %rdi
callq 0x3410
movq -0x980(%rbp), %rdi
leaq -0x8b8(%rbp), %rsi
callq 0x1e430
jmp 0x1dd93
leaq -0x8b8(%rbp), %rdi
callq 0x94e0
leaq -0x718(%rbp), %rdi
callq 0x31d0
leaq -0x6f8(%rbp), %rdi
callq 0x31d0
leaq -0x6d8(%rbp), %rdi
callq 0x31d0
jmp 0x1de0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x8b8(%rbp), %rdi
callq 0x94e0
leaq -0x718(%rbp), %rdi
callq 0x31d0
leaq -0x6f8(%rbp), %rdi
callq 0x31d0
leaq -0x6d8(%rbp), %rdi
callq 0x31d0
jmp 0x1de14
jmp 0x1de0b
addq $0x980, %rsp            # imm = 0x980
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x3520