// File: KJTang[P]SimpleCompiler/AST.cpp
// Function: FunctionAST::eval[abi:cxx11]()
std::string FunctionAST::eval() {
    std::string argsStr;
    for (auto it = mArgs.rbegin(); it != mArgs.rend(); ++it) {
        // TODO: only "int" here, maybe more type in the future
        if (it->first == Token::TYPE_INT) {
            argsStr += "INT " + it->second + insEnd + "SAVE " + it->second + insEnd;
        }
    }
    return "FUNC " + mFunc.second + insEnd + argsStr + blockAST->eval() + "ENDF" + insEnd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x1c8(%rbp)
movq %rdi, %rax
movq %rax, -0x1c0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1b8(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x33a0
movq -0x1b8(%rbp), %rsi
addq $0x38, %rsi
leaq -0x38(%rbp), %rdi
callq 0xe2a0
movq -0x1b8(%rbp), %rsi
addq $0x38, %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0xe320
movq -0x1d8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0xe2f0
movb %al, -0x1c9(%rbp)
jmp 0xd9ff
movb -0x1c9(%rbp), %al
testb $0x1, %al
jne 0xda0e
jmp 0xdbd7
leaq -0x38(%rbp), %rdi
callq 0xe370
movq %rax, -0x1e0(%rbp)
jmp 0xda20
movq -0x1e0(%rbp), %rax
cmpl $0xa, (%rax)
jne 0xdbc5
leaq -0x38(%rbp), %rdi
callq 0xe370
movq %rax, -0x1e8(%rbp)
jmp 0xda42
movq -0x1e8(%rbp), %rdx
addq $0x8, %rdx
leaq 0xd8bb(%rip), %rsi      # 0x1b30f
leaq -0xf0(%rbp), %rdi
callq 0xdf60
jmp 0xda62
leaq 0x1a837(%rip), %rdx     # 0x282a0
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xdf10
jmp 0xda7e
leaq 0xd88f(%rip), %rdx      # 0x1b314
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xe180
jmp 0xda9a
leaq -0x38(%rbp), %rdi
callq 0xe370
movq %rax, -0x1f0(%rbp)
jmp 0xdaac
movq -0x1f0(%rbp), %rdx
addq $0x8, %rdx
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0xdf10
jmp 0xdacc
leaq 0x1a7cd(%rip), %rdx     # 0x282a0
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xdf10
jmp 0xdae5
leaq -0x30(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3360
jmp 0xdaf4
leaq -0x70(%rbp), %rdi
callq 0x34f8
leaq -0x90(%rbp), %rdi
callq 0x34f8
leaq -0xb0(%rbp), %rdi
callq 0x34f8
leaq -0xd0(%rbp), %rdi
callq 0x34f8
leaq -0xf0(%rbp), %rdi
callq 0x34f8
jmp 0xdbc5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xdd9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xdbb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xdba8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xdb9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xdb90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x34f8
leaq -0x90(%rbp), %rdi
callq 0x34f8
leaq -0xb0(%rbp), %rdi
callq 0x34f8
leaq -0xd0(%rbp), %rdi
callq 0x34f8
leaq -0xf0(%rbp), %rdi
callq 0x34f8
jmp 0xdd9b
jmp 0xdbc7
leaq -0x38(%rbp), %rdi
callq 0xe3b0
jmp 0xdbd2
jmp 0xd9cc
movq -0x1b8(%rbp), %rdx
addq $0x18, %rdx
leaq 0xd771(%rip), %rsi      # 0x1b35a
leaq -0x190(%rbp), %rdi
callq 0xdf60
jmp 0xdbf7
leaq 0x1a6a2(%rip), %rdx     # 0x282a0
leaq -0x170(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0xdf10
jmp 0xdc13
leaq -0x150(%rbp), %rdi
leaq -0x170(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0xdf10
jmp 0xdc2c
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rsi
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x1b0(%rbp), %rdi
callq *%rax
jmp 0xdc49
leaq -0x130(%rbp), %rdi
leaq -0x150(%rbp), %rsi
leaq -0x1b0(%rbp), %rdx
callq 0xe070
jmp 0xdc65
leaq 0xd414(%rip), %rdx      # 0x1b080
leaq -0x110(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0xe180
jmp 0xdc81
movq -0x1c8(%rbp), %rdi
leaq 0x1a611(%rip), %rdx     # 0x282a0
leaq -0x110(%rbp), %rsi
callq 0xdf10
jmp 0xdc9d
leaq -0x110(%rbp), %rdi
callq 0x34f8
leaq -0x130(%rbp), %rdi
callq 0x34f8
leaq -0x1b0(%rbp), %rdi
callq 0x34f8
leaq -0x150(%rbp), %rdi
callq 0x34f8
leaq -0x170(%rbp), %rdi
callq 0x34f8
leaq -0x190(%rbp), %rdi
callq 0x34f8
leaq -0x30(%rbp), %rdi
callq 0x34f8
movq -0x1c0(%rbp), %rax
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xdd8f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xdd83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xdd77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xdd6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xdd5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x34f8
leaq -0x130(%rbp), %rdi
callq 0x34f8
leaq -0x1b0(%rbp), %rdi
callq 0x34f8
leaq -0x150(%rbp), %rdi
callq 0x34f8
leaq -0x170(%rbp), %rdi
callq 0x34f8
leaq -0x190(%rbp), %rdi
callq 0x34f8
leaq -0x30(%rbp), %rdi
callq 0x34f8
movq -0x48(%rbp), %rdi
callq 0x3470
nopl (%rax)