LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: match(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Token match(string expected) {
    Token tmp = ptoken;
    // cout << "ptoken.type = " << ptoken.type << " ptoken.val = " << ptoken.value << endl;
    // cout << "expected: " << expected << endl;
    // 匹配一个类型
    if (ptoken.type == expected) {
        // cout << "match: " << ptoken.value << endl;
        if (ptoken.type != "EndFile") ptoken = getToken();
    } else {
        error();
    }
    return tmp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x12616(%rip), %r15     # 0x164c0
movq %r15, %rsi
callq 0x3d1c
movq %r15, %rdi
movq %r14, %rsi
callq 0x3bd3
testb %al, %al
je 0x3f00
leaq 0x125f8(%rip), %rdi     # 0x164c0
leaq 0xb232(%rip), %rsi      # 0xf101
callq 0x7005
testb %al, %al
je 0x3f05
leaq 0x8(%rsp), %rdi
callq 0x312b
leaq 0x125d7(%rip), %rdi     # 0x164c0
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x7010
movq %r14, %rdi
callq 0x2ee6
jmp 0x3f05
callq 0x3e44
movq %rbx, %rax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x3f14
movq %rax, %r14
movq %rbx, %rdi
callq 0x2ee6
movq %r14, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: param_list(TreeNode*)
TreeNode* param_list(TreeNode* k) {
    // TODO: 到这里暂停, 明天再写. 完善函数的操作
    TreeNode* t = param(k);  // 先读一个参数
    TreeNode* p = t;
    k           = NULL;
    while (ptoken.type == "Comma") {  // 如果读到逗号, 说明还有下一个参数
        match("Comma");
        TreeNode* q = param(k);
        if (q != NULL) {
            if (t == NULL) {  // ! 是否多余
                t = p = q;
            } else {
                p->sibling = q;
                p          = q;
            }
        }
    }
    return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
callq 0x3f27
movq %rax, %rbx
leaq 0x12285(%rip), %r14     # 0x164c0
leaq 0xaf2c(%rip), %r15      # 0xf16e
leaq 0x10(%rsp), %r12
leaq 0x7(%rsp), %r13
leaq 0x30(%rsp), %rbp
movq %rax, 0x8(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x368e
testb %al, %al
je 0x429e
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x2efc
movq %rbp, %rdi
movq %r12, %rsi
callq 0x3e94
movq %rbp, %rdi
callq 0x2ee6
movq %r12, %rdi
callq 0x2358
xorl %edi, %edi
callq 0x3f27
movq %rax, 0x20(%rbx)
movq %rax, %rbx
jmp 0x4256
movq 0x8(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2358
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: params()
TreeNode* params() {
    TreeNode* t = new TreeNode("Params");  // 根节点, 参数s
    TreeNode* p = NULL;
    if (ptoken.type == "void") {
        p = new TreeNode("void");
        match("void");
        if (ptoken.type == "RightBracket") {
            if (t != NULL) {
                t->child[0]  = p;
                t->child_cnt = 1;
            }
        } else {
            t->child[0]  = param_list(p);
            t->child_cnt = 1;
        }
    } else {
        t->child[0]  = param_list(p);
        t->child_cnt = 1;
    }
    return t;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbx
leaq 0xaf44(%rip), %rsi      # 0xf22b
leaq 0x48(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2efc
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0x48(%rsp), %rdi
callq 0x2358
leaq 0x121ac(%rip), %rdi     # 0x164c0
leaq 0xae5d(%rip), %rsi      # 0xf178
callq 0x368e
testb %al, %al
je 0x43b7
movl $0xe0, %edi
callq 0x21c0
movq %rax, %r14
leaq 0xae3c(%rip), %rsi      # 0xf178
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2efc
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x703e
leaq 0x28(%rsp), %rdi
callq 0x2358
leaq 0xae0f(%rip), %rsi      # 0xf178
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2efc
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3e94
leaq 0x68(%rsp), %rdi
callq 0x2ee6
leaq 0x8(%rsp), %rdi
callq 0x2358
leaq 0x1211e(%rip), %rdi     # 0x164c0
leaq 0xad8f(%rip), %rsi      # 0xf138
callq 0x368e
testb %al, %al
jne 0x43c1
movq %r14, %rdi
jmp 0x43b9
xorl %edi, %edi
callq 0x421e
movq %rax, %r14
movq %r14, (%rbx)
movl $0x1, 0x28(%rbx)
movq %rbx, %rax
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r15
leaq 0x8(%rsp), %rdi
callq 0x2358
jmp 0x442a
movq %rax, %r15
jmp 0x442a
movq %rax, %r15
leaq 0x28(%rsp), %rdi
callq 0x2358
jmp 0x4401
movq %rax, %r15
movl $0xe0, %esi
movq %r14, %rdi
jmp 0x4425
movq %rax, %r15
leaq 0x48(%rsp), %rdi
callq 0x2358
jmp 0x441d
movq %rax, %r15
movl $0xe0, %esi
movq %rbx, %rdi
callq 0x21d0
movq %r15, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: statement_list()
TreeNode* statement_list() {
    /**
     * 一系列的语句
     */
    TreeNode* t = statement();
    TreeNode* p = t;
    // 判断哪些token可以做为statement的开始
    while (ptoken.type == "if" || ptoken.type == "Id" || ptoken.type == "while" ||
           ptoken.type == "return" || ptoken.type == "semicolon" || ptoken.type == "input" ||
           ptoken.type == "output") {
        TreeNode* q;
        // cout << "ptoken.type == " << ptoken.type << endl;
        q = statement();
        if (q != NULL) {
            if (t == NULL) {
                t = p = q;
            } else {
                p->sibling = q;
                p          = q;
            }
        }
    }
    return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x5ec2
movq %rax, %rbx
leaq 0x11498(%rip), %r14     # 0x164c0
leaq 0xa14e(%rip), %r15      # 0xf17d
leaq 0xa1f2(%rip), %r12      # 0xf228
leaq 0xa148(%rip), %r13      # 0xf185
leaq 0xa147(%rip), %rbp      # 0xf18b
movq %rbx, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x368e
testb %al, %al
jne 0x50bd
movq %r14, %rdi
movq %r12, %rsi
callq 0x368e
testb %al, %al
jne 0x50bd
movq %r14, %rdi
movq %r13, %rsi
callq 0x368e
testb %al, %al
jne 0x50bd
movq %r14, %rdi
movq %rbp, %rsi
callq 0x368e
testb %al, %al
jne 0x50bd
movq %r14, %rdi
leaq 0xa206(%rip), %rsi      # 0xf294
callq 0x368e
testb %al, %al
jne 0x50bd
movq %r14, %rdi
leaq 0xa0f1(%rip), %rsi      # 0xf192
callq 0x368e
testb %al, %al
jne 0x50bd
movq %r14, %rdi
leaq 0xa0e4(%rip), %rsi      # 0xf198
callq 0x368e
testb %al, %al
je 0x50e2
callq 0x5ec2
testq %rax, %rax
je 0x5048
cmpq $0x0, (%rsp)
je 0x50da
movq %rax, 0x20(%rbx)
movq %rax, %rbx
jmp 0x5048
movq %rax, %rbx
jmp 0x5044
movq (%rsp), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: iteration_stmt()
TreeNode* iteration_stmt() {
    TreeNode* t = new TreeNode("Iteration");
    match("while");
    match("LeftBracket");
    if (t != NULL) {
        t->child[0] = expression();
    }
    match("RightBracket");
    match("LeftBigBkt");
    if (t != NULL) {
        t->child[1] = statement_list();
    }
    match("RightBigBkt");
    return t;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbx
leaq 0xa134(%rip), %rsi      # 0xf247
leaq 0xb0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0xb0(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0xb0(%rsp), %rdi
callq 0x2358
leaq 0xa03c(%rip), %rsi      # 0xf185
leaq 0x90(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x1f0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x3e94
leaq 0x1f0(%rsp), %rdi
callq 0x2ee6
leaq 0x90(%rsp), %rdi
callq 0x2358
leaq 0x9f9b(%rip), %rsi      # 0xf12c
leaq 0x70(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x1a8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x3e94
leaq 0x1a8(%rsp), %rdi
callq 0x2ee6
leaq 0x70(%rsp), %rdi
callq 0x2358
callq 0x4c1b
movq %rax, (%rbx)
leaq 0x9f60(%rip), %rsi      # 0xf138
leaq 0x50(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x160(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x3e94
leaq 0x160(%rsp), %rdi
callq 0x2ee6
leaq 0x50(%rsp), %rdi
callq 0x2358
leaq 0x9f40(%rip), %rsi      # 0xf157
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x118(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3e94
leaq 0x118(%rsp), %rdi
callq 0x2ee6
leaq 0x30(%rsp), %rdi
callq 0x2358
callq 0x500e
movq %rax, 0x8(%rbx)
leaq 0x9f03(%rip), %rsi      # 0xf162
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0xd0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x3e94
leaq 0xd0(%rsp), %rdi
callq 0x2ee6
leaq 0x10(%rsp), %rdi
callq 0x2358
movq %rbx, %rax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r14
retq
movq %rax, %r14
leaq 0x10(%rsp), %rdi
jmp 0x52e0
jmp 0x52e7
movq %rax, %r14
leaq 0x30(%rsp), %rdi
jmp 0x52e0
jmp 0x52e7
movq %rax, %r14
leaq 0x50(%rsp), %rdi
jmp 0x52e0
jmp 0x52e7
movq %rax, %r14
leaq 0x70(%rsp), %rdi
jmp 0x52e0
jmp 0x52e7
movq %rax, %r14
leaq 0x90(%rsp), %rdi
callq 0x2358
jmp 0x530e
movq %rax, %r14
jmp 0x530e
movq %rax, %r14
leaq 0xb0(%rsp), %rdi
callq 0x2358
jmp 0x5301
movq %rax, %r14
movl $0xe0, %esi
movq %rbx, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: var()
TreeNode* var() {
    TreeNode* t = NULL;
    TreeNode* p = NULL;
    if (ptoken.type == "Id") {
        p       = new TreeNode("Id");
        p->name = ptoken.value;
        p->line = ptoken.line;
        match("Id");
        // TODO: 添加数组
        t = p;  // 非数组时
    }
    return t;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x98, %rsp
leaq 0x11199(%rip), %rdi     # 0x164c0
leaq 0x9efa(%rip), %rsi      # 0xf228
callq 0x368e
testb %al, %al
je 0x53cf
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbx
leaq 0x9ed9(%rip), %rsi      # 0xf228
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0x30(%rsp), %rdi
callq 0x2358
movq %rbx, %rdi
addq $0xc0, %rdi
leaq 0x1115a(%rip), %rsi     # 0x164e0
callq 0x2110
movl 0x1116f(%rip), %eax     # 0x16500
movl %eax, 0x50(%rbx)
leaq 0x9e8d(%rip), %rsi      # 0xf228
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x3e94
leaq 0x50(%rsp), %rdi
callq 0x2ee6
leaq 0x10(%rsp), %rdi
callq 0x2358
jmp 0x53d1
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x2358
jmp 0x5412
movq %rax, %r14
jmp 0x5412
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x2358
jmp 0x5405
movq %rax, %r14
movl $0xe0, %esi
movq %rbx, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: args()
TreeNode* args() {
    TreeNode* t = new TreeNode("Args");
    TreeNode *s = NULL, *p = NULL;
    if (ptoken.type != "RightBracket") {
        s = expression();
        p = s;
        while (ptoken.type == "Comma") {
            TreeNode* q;
            match("Comma");
            q = expression();
            if (q != NULL) {
                if (s == NULL) {
                    s = p = q;
                } else {
                    p->sibling = q;
                    p          = q;
                }
            }
        }
    }
    if (s != NULL) {
        t->child[0] = s;
    }
    return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbx
leaq 0x9e12(%rip), %rsi      # 0xf251
leaq 0x20(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %rax, 0x10(%rsp)
callq 0x2efc
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0x20(%rsp), %rdi
callq 0x2358
leaq 0x1104f(%rip), %rdi     # 0x164c0
leaq 0x9cc0(%rip), %rsi      # 0xf138
callq 0x7005
testb %al, %al
je 0x5518
callq 0x4c1b
movq %rax, %r14
leaq 0x1102c(%rip), %r15     # 0x164c0
leaq 0x9cd3(%rip), %r12      # 0xf16e
leaq 0x40(%rsp), %r13
leaq 0xf(%rsp), %rbp
leaq 0x60(%rsp), %rbx
movq %r14, 0x18(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x368e
testb %al, %al
je 0x550b
movq %r13, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x2efc
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3e94
movq %rbx, %rdi
callq 0x2ee6
movq %r13, %rdi
callq 0x2358
callq 0x4c1b
testq %rax, %rax
je 0x54af
testq %r14, %r14
je 0x5506
movq 0x18(%rsp), %rcx
movq %rax, 0x20(%rcx)
movq %rax, 0x18(%rsp)
jmp 0x54af
movq %rax, %r14
jmp 0x54aa
testq %r14, %r14
je 0x5518
movq 0x10(%rsp), %rax
movq %r14, (%rax)
movq 0x10(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2358
jmp 0x5541
movq %rax, %rbx
movl $0xe0, %esi
movq 0x10(%rsp), %rdi
callq 0x21d0
jmp 0x5564
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2358
jmp 0x5564
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: call(TreeNode*)
TreeNode* call(TreeNode* k) {
    TreeNode* t = new TreeNode("Call");
    if (k != NULL) {
        t->child[0] = k;
    }
    match("LeftBracket");
    if (ptoken.type == "RightBracket") {
        match("RightBracket");
        return t;
    } else if (k != NULL) {
        t->child[1] = args();
        match("RightBracket");
    }
    return t;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdi, %r14
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbx
leaq 0x9cc9(%rip), %rsi      # 0xf256
leaq 0x70(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x70(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0x70(%rsp), %rdi
callq 0x2358
testq %r14, %r14
je 0x55bb
movq %r14, (%rbx)
leaq 0x9b6a(%rip), %rsi      # 0xf12c
leaq 0x50(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x120(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x3e94
leaq 0x120(%rsp), %rdi
callq 0x2ee6
leaq 0x50(%rsp), %rdi
callq 0x2358
leaq 0x10ebf(%rip), %rdi     # 0x164c0
leaq 0x9b30(%rip), %rsi      # 0xf138
callq 0x368e
testb %al, %al
je 0x564d
leaq 0x9b20(%rip), %rsi      # 0xf138
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0xd8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3e94
leaq 0xd8(%rsp), %rdi
callq 0x2ee6
leaq 0x30(%rsp), %rdi
jmp 0x5695
testq %r14, %r14
je 0x569a
callq 0x541a
movq %rax, 0x8(%rbx)
leaq 0x9ad6(%rip), %rsi      # 0xf138
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x90(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x3e94
leaq 0x90(%rsp), %rdi
callq 0x2ee6
leaq 0x10(%rsp), %rdi
callq 0x2358
movq %rbx, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r14
retq
movq %rax, %r14
leaq 0x10(%rsp), %rdi
jmp 0x56c8
jmp 0x56cf
movq %rax, %r14
leaq 0x30(%rsp), %rdi
jmp 0x56c8
jmp 0x56cf
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x2358
jmp 0x56f3
movq %rax, %r14
jmp 0x56f3
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0x2358
jmp 0x56e6
movq %rax, %r14
movl $0xe0, %esi
movq %rbx, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: term(TreeNode*)
TreeNode* term(TreeNode* k) {
    TreeNode* t = factor(k);
    k           = NULL;
    while (ptoken.type == "MDOP") {
        TreeNode* q = new TreeNode("MDOp");
        q->op       = ptoken.value;
        q->child[0] = t;
        match(ptoken.type);
        q->child[1] = term(k);
        t           = q;
    }
    return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
callq 0x56fb
movq %rax, %rbp
leaq 0x10b21(%rip), %rbx     # 0x164c0
leaq 0x30(%rsp), %r12
leaq 0x10(%rsp), %r15
leaq 0x50(%rsp), %r14
movq %rbx, %rdi
leaq 0x976f(%rip), %rsi      # 0xf127
callq 0x368e
testb %al, %al
je 0x5a4c
movl $0xe0, %edi
callq 0x21c0
movq %rax, %r13
movq %r12, %rdi
leaq 0x988f(%rip), %rsi      # 0xf26b
leaq 0xf(%rsp), %rdx
callq 0x2efc
movq %r13, %rdi
movq %r12, %rsi
callq 0x703e
movq %r12, %rdi
callq 0x2358
movq %r13, %rdi
addq $0x98, %rdi
leaq 0x10ad6(%rip), %rsi     # 0x164e0
callq 0x2110
movq %rbp, (%r13)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2250
movq %r14, %rdi
movq %r15, %rsi
callq 0x3e94
movq %r14, %rdi
callq 0x2ee6
movq %r15, %rdi
callq 0x2358
xorl %edi, %edi
callq 0x597f
movq %rax, 0x8(%r13)
movq %r13, %rbp
jmp 0x59ae
movq %rbp, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2358
jmp 0x5a8f
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2358
jmp 0x5a82
movq %rax, %rbx
movl $0xe0, %esi
movq %r13, %rdi
callq 0x21d0
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: additive_expression(TreeNode*)
TreeNode* additive_expression(TreeNode* k) {
    TreeNode* t = term(k);
    k           = NULL;
    while (ptoken.type == "PMOP") {  // 加减
        TreeNode* q = new TreeNode("PMOp");
        q->op       = ptoken.value;
        q->child[0] = t;
        match("PMOP");
        q->child[1] = term(k);
        t           = q;
    }
    return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
callq 0x597f
movq %rax, %r14
leaq 0x30(%rsp), %r12
leaq 0xf(%rsp), %r13
leaq 0x10(%rsp), %r15
leaq 0x50(%rsp), %rbx
leaq 0x109f5(%rip), %rdi     # 0x164c0
leaq 0x9650(%rip), %rsi      # 0xf122
callq 0x368e
testb %al, %al
je 0x5b6b
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbp
movq %r12, %rdi
leaq 0x977a(%rip), %rsi      # 0xf270
movq %r13, %rdx
callq 0x2efc
movq %rbp, %rdi
movq %r12, %rsi
callq 0x703e
movq %r12, %rdi
callq 0x2358
movq %rbp, %rdi
addq $0x98, %rdi
leaq 0x109be(%rip), %rsi     # 0x164e0
callq 0x2110
movq %r14, (%rbp)
movq %r15, %rdi
leaq 0x95ed(%rip), %rsi      # 0xf122
movq %r13, %rdx
callq 0x2efc
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3e94
movq %rbx, %rdi
callq 0x2ee6
movq %r15, %rdi
callq 0x2358
xorl %edi, %edi
callq 0x597f
movq %rax, 0x8(%rbp)
movq %rbp, %r14
jmp 0x5ac4
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2358
jmp 0x5bb3
movq %rax, %rbx
jmp 0x5bb3
movq %rax, %rbx
jmp 0x5ba6
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2358
movl $0xe0, %esi
movq %rbp, %rdi
callq 0x21d0
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: simple_expression(TreeNode*)
TreeNode* simple_expression(TreeNode* k) {
    // 这里会处理只有一个整数的情况
    TreeNode* t = additive_expression(k);
    k           = NULL;
    if (ptoken.type == "CompareOp") {  // 比较
        TreeNode* q = new TreeNode("CompareOp");
        q->line     = ptoken.line;
        q->op       = ptoken.value;
        q->child[0] = t;
        t           = q;
        match(ptoken.type);
        t->child[1] = additive_expression(k);
        return t;
    }
    return t;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
callq 0x5a97
movq %rax, %r14
leaq 0x108ea(%rip), %rdi     # 0x164c0
leaq 0x9530(%rip), %rsi      # 0xf10d
callq 0x368e
testb %al, %al
je 0x5c8b
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbx
leaq 0x950f(%rip), %rsi      # 0xf10d
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2efc
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0x8(%rsp), %rdi
callq 0x2358
leaq 0x10895(%rip), %r15     # 0x164c0
movl 0x108cf(%rip), %eax     # 0x16500
movl %eax, 0x50(%rbx)
movq %rbx, %rdi
addq $0x98, %rdi
leaq 0x1089b(%rip), %rsi     # 0x164e0
callq 0x2110
movq %r14, (%rbx)
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x2250
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
callq 0x3e94
leaq 0x48(%rsp), %rdi
callq 0x2ee6
leaq 0x28(%rsp), %rdi
callq 0x2358
xorl %edi, %edi
callq 0x5a97
movq %rax, 0x8(%rbx)
jmp 0x5c8e
movq %r14, %rbx
movq %rbx, %rax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x2358
jmp 0x5ccc
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x2358
jmp 0x5cbf
movq %rax, %r14
movl $0xe0, %esi
movq %rbx, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: return_stmt()
TreeNode* return_stmt() {
    TreeNode* t = new TreeNode("ReturnStmt");
    match("return");
    // cout << "exp 之前 -- 0" << endl;
    if (ptoken.type == "Semicolon") {
        match("Semicolon");
        return t;
    } else {
        if (t != NULL) {
            // cout << "exp 之前" << endl;
            t->child[0]  = expression();
            t->child_cnt = 1;
        }
    }
    match("Semicolon");
    return t;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbx
leaq 0x9590(%rip), %rsi      # 0xf282
leaq 0x70(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x70(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0x70(%rsp), %rdi
callq 0x2358
leaq 0x946c(%rip), %rsi      # 0xf18b
leaq 0x50(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x120(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x3e94
leaq 0x120(%rsp), %rdi
callq 0x2ee6
leaq 0x50(%rsp), %rdi
callq 0x2358
leaq 0x10762(%rip), %rdi     # 0x164c0
leaq 0x93e0(%rip), %rsi      # 0xf145
callq 0x368e
testb %al, %al
je 0x5daa
leaq 0x93d0(%rip), %rsi      # 0xf145
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0xd8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3e94
leaq 0xd8(%rsp), %rdi
callq 0x2ee6
leaq 0x30(%rsp), %rdi
jmp 0x5df3
callq 0x4c1b
movq %rax, (%rbx)
movl $0x1, 0x28(%rbx)
leaq 0x9385(%rip), %rsi      # 0xf145
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2efc
leaq 0x90(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x3e94
leaq 0x90(%rsp), %rdi
callq 0x2ee6
leaq 0x10(%rsp), %rdi
callq 0x2358
movq %rbx, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r14
retq
movq %rax, %r14
leaq 0x10(%rsp), %rdi
jmp 0x5e26
movq %rax, %r14
leaq 0x30(%rsp), %rdi
jmp 0x5e26
jmp 0x5e2d
jmp 0x5e2d
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x2358
jmp 0x5e51
movq %rax, %r14
jmp 0x5e51
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0x2358
jmp 0x5e44
movq %rax, %r14
movl $0xe0, %esi
movq %rbx, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: expression_stmt()
TreeNode* expression_stmt() {
    TreeNode* t = NULL;
    t           = expression();
    match("Semicolon");
    return t;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
callq 0x4c1b
movq %rax, %rbx
leaq 0x92d6(%rip), %rsi      # 0xf145
leaq 0x10(%rsp), %r14
leaq 0xf(%rsp), %rdx
movq %r14, %rdi
callq 0x2efc
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x3e94
leaq 0x30(%rsp), %rdi
callq 0x2ee6
leaq 0x10(%rsp), %rdi
callq 0x2358
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2358
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: statement()
TreeNode* statement() {
    TreeNode* t = NULL;
    if (ptoken.type == "if") {
        t = selection_stmt();
    } else if (ptoken.type == "while") {
        t = iteration_stmt();
    } else if (ptoken.type == "return") {
        t = return_stmt();
    } else if (ptoken.type == "Id") {
        t = expression_stmt();
    } else if (ptoken.type == "intput" || ptoken.type == "output") {
        t = expression_stmt();
    }
    return t;
}

// Assembly:
pushq %rax
leaq 0x105f6(%rip), %rdi     # 0x164c0
leaq 0x92ac(%rip), %rsi      # 0xf17d
callq 0x368e
testb %al, %al
je 0x5ee0
popq %rax
jmp 0x4885
leaq 0x105d9(%rip), %rdi     # 0x164c0
leaq 0x9297(%rip), %rsi      # 0xf185
callq 0x368e
testb %al, %al
je 0x5efd
popq %rax
jmp 0x50f5
leaq 0x105bc(%rip), %rdi     # 0x164c0
leaq 0x9280(%rip), %rsi      # 0xf18b
callq 0x368e
testb %al, %al
je 0x5f1a
popq %rax
jmp 0x5cd4
leaq 0x1059f(%rip), %rdi     # 0x164c0
leaq 0x9300(%rip), %rsi      # 0xf228
callq 0x368e
testb %al, %al
jne 0x5f5f
leaq 0x10588(%rip), %rdi     # 0x164c0
leaq 0x934e(%rip), %rsi      # 0xf28d
callq 0x368e
testb %al, %al
jne 0x5f5f
leaq 0x10571(%rip), %rdi     # 0x164c0
leaq 0x9242(%rip), %rsi      # 0xf198
callq 0x368e
testb %al, %al
je 0x5f65
popq %rax
jmp 0x5e59
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: compound_stmt()
TreeNode* compound_stmt() {                  // * 解析函数体
    TreeNode* t = new TreeNode("Compound");  // 函数体
    match("LeftBigBkt");
    t->child[0] = local_declaration();  // 声明都在前面, 以sibling连接
    t->child[1] = statement_list();     // 下面是各种语句, 以sibling连接
    if (t->child[0] == NULL) {
        t->child[0] = t->child[1];
        t->child[1] = NULL;
    }
    t->child_cnt = 2;
    match("RightBigBkt");
    return t;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xf8, %rsp
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbx
leaq 0x9317(%rip), %rsi      # 0xf29e
leaq 0x48(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2efc
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0x48(%rsp), %rdi
callq 0x2358
leaq 0x91a3(%rip), %rsi      # 0xf157
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2efc
leaq 0xb0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x3e94
leaq 0xb0(%rsp), %rdi
callq 0x2ee6
leaq 0x28(%rsp), %rdi
callq 0x2358
callq 0x4432
movq %rax, (%rbx)
callq 0x500e
movq %rax, 0x8(%rbx)
cmpq $0x0, (%rbx)
jne 0x600b
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movl $0x2, 0x28(%rbx)
leaq 0x9149(%rip), %rsi      # 0xf162
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2efc
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3e94
leaq 0x68(%rsp), %rdi
callq 0x2ee6
leaq 0x8(%rsp), %rdi
callq 0x2358
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
leaq 0x8(%rsp), %rdi
jmp 0x606d
jmp 0x6074
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x2358
jmp 0x6098
movq %rax, %r14
jmp 0x6098
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x2358
jmp 0x608b
movq %rax, %r14
movl $0xe0, %esi
movq %rbx, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: declaration_list()
TreeNode* declaration_list() {
    /**
     * 不断检测声明
     * 包括函数声明和变量声明.
     */
    TreeNode* t = declaration();  // 检测一个声明
    TreeNode* p = t;
    // while (ptoken.type != "int" && ptoken.type != "void" && ptoken.type != "EndFile") {
    //     ptoken = getToken();
    //     if (ptoken.type == "EndFile") break;
    // }
    while (ptoken.type == "int" || ptoken.type == "void") {  // 检测到int整形, void函数
        // cout << "声明的类型 ................... : " << ptoken.type << endl;
        TreeNode* q;
        q = declaration();
        if (q != NULL) {
            if (t == NULL) {  // ! 似乎不正常, 前面t为NULL说明没有检测到decl, 可以报错
                t = p = q;
            } else {
                p->sibling = q;  // *每个声明是并列的, 用兄弟结点连接.
                p          = q;
            }
        }
    }
    match("EndFile");
    // cout << "hehe\n";
    return t;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
callq 0x60a0
movq %rax, %rbx
leaq 0xfd7a(%rip), %r14      # 0x164c0
leaq 0x8a27(%rip), %r15      # 0xf174
leaq 0x8a24(%rip), %r12      # 0xf178
movq %rax, %r13
movq %r14, %rdi
movq %r15, %rsi
callq 0x368e
testb %al, %al
jne 0x6775
movq %r14, %rdi
movq %r12, %rsi
callq 0x368e
testb %al, %al
je 0x6780
callq 0x60a0
movq %rax, 0x20(%r13)
jmp 0x6754
leaq 0x897a(%rip), %rsi      # 0xf101
leaq 0x8(%rsp), %r14
leaq 0x7(%rsp), %rdx
movq %r14, %rdi
callq 0x2efc
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x3e94
leaq 0x28(%rsp), %rdi
callq 0x2ee6
leaq 0x8(%rsp), %rdi
callq 0x2358
movq %rbx, %rax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2358
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: printParse(TreeNode*)
void printParse(TreeNode* t) {
    out << "Program:{\n"
        << "  type: program,\n"
        << "  body: [\n";
    string indent = "    ";
    preOrder(t, indent);
    out << "  ]\n"
        << "}\n";
    out.close();
    // ifstream in("parse.txt", ios::in);
    // 输出到控制台
    // string s;
    // while (getline(in, s)) {
    //     cout << s << endl;
    // }
    cout << "error cnt: " << error_cnt << endl;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0xf65a(%rip), %rdi      # 0x16508
leaq 0x84b2(%rip), %rsi      # 0xf367
callq 0x21b0
leaq 0x84b1(%rip), %rsi      # 0xf372
movq %rax, %rdi
callq 0x21b0
leaq 0x846d(%rip), %rsi      # 0xf33d
movq %rax, %rdi
callq 0x21b0
leaq 0x846b(%rip), %rsi      # 0xf34a
leaq 0x28(%rsp), %r14
leaq 0x7(%rsp), %rdx
movq %r14, %rdi
callq 0x2efc
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x2250
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x67e0
leaq 0x8(%rsp), %rdi
callq 0x2358
leaq 0xf5ec(%rip), %rdi      # 0x16508
leaq 0x842e(%rip), %rsi      # 0xf351
callq 0x21b0
leaq 0x8429(%rip), %rsi      # 0xf358
movq %rax, %rdi
callq 0x21b0
leaq 0xf5ca(%rip), %rdi      # 0x16508
callq 0x2260
movq 0xf07e(%rip), %rdi      # 0x15fc8
leaq 0x8433(%rip), %rsi      # 0xf384
callq 0x21b0
movl 0xf7ac(%rip), %esi      # 0x16708
movq %rax, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x20f0
leaq 0x28(%rsp), %rdi
callq 0x2358
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2358
jmp 0x6f90
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2358
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: parse(bool)
TreeNode* parse(bool print) {
    TreeNode* t;
    ptoken = getToken();          // 获取第一个token, 开始语法分析
    t      = declaration_list();  // 获取声明列表, c-由一系列整数/函数声明组成
    if (print) {
        printParse(t);
        cout << "parse print over !" << endl;
    }
    return t;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x48, %rsp
movl %edi, %ebp
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x312b
leaq 0xf504(%rip), %rdi      # 0x164c0
movq %rbx, %rsi
callq 0x7010
movq %rbx, %rdi
callq 0x2ee6
callq 0x672a
movq %rax, %rbx
testl %ebp, %ebp
je 0x6ffb
movq %rbx, %rdi
callq 0x6e9d
movq 0xefe1(%rip), %rdi      # 0x15fc8
leaq 0x83a2(%rip), %rsi      # 0xf390
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/analyze.cpp
// Function: buildSymtab(TreeNode*)
void buildSymtab(TreeNode *syntaxTree) {
    traverse(syntaxTree, insertNode, nullProc);
    if (not isError) {
        cout << "\nprinting symtab ..." << endl;
        printSymtab();
        cout << "print over !\n"
                  << endl;
        cout << "symtab build over, everything is ok! congratulations!" << endl
                  << endl;
    } else {
        cout << "you have " << isError << " errors in symtab, please check!" << endl
                  << endl;
    }
}

// Assembly:
pushq %rbx
leaq 0xec(%rip), %rsi        # 0x72d4
leaq 0x507(%rip), %rdx       # 0x76f6
callq 0x7284
cmpl $0x0, 0xf71d(%rip)      # 0x16918
je 0x722a
movq 0xedc4(%rip), %rdi      # 0x15fc8
leaq 0x8208(%rip), %rsi      # 0xf413
callq 0x21b0
movl 0xf702(%rip), %esi      # 0x16918
movq %rax, %rdi
callq 0x22f0
leaq 0x81f8(%rip), %rsi      # 0xf41d
movq %rax, %rdi
jmp 0x726e
movq 0xed97(%rip), %rbx      # 0x15fc8
leaq 0x8182(%rip), %rsi      # 0xf3ba
movq %rbx, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
callq 0x8387
leaq 0x817b(%rip), %rsi      # 0xf3cf
movq %rbx, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
leaq 0x8172(%rip), %rsi      # 0xf3dd
movq %rbx, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
movq %rax, %rdi
popq %rbx
jmp 0x20f0
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/analyze.cpp
// Function: traverse(TreeNode*, void (*)(TreeNode*), void (*)(TreeNode*))
static void traverse(TreeNode *t, void (*preProc)(TreeNode *), void (*postProc)(TreeNode *)) {
    if (t != NULL) {
        preProc(t);
        for (int i = 0; i < MAX_CHILDREN; ++i) {
            traverse(t->child[i], preProc, postProc);
        }
        postProc(t);
        traverse(t->sibling, preProc, postProc);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testq %r15, %r15
je 0x72c8
movq %r15, %rdi
callq *%r14
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x72bd
movq (%r15,%r12,8), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x7284
incq %r12
jmp 0x72a3
movq %r15, %rdi
callq *%rbx
movq 0x20(%r15), %r15
jmp 0x7295
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/analyze.cpp
// Function: typeCheck(TreeNode*)
void typeCheck(TreeNode *syntaxTree) {
    traverse(syntaxTree, nullProc, checkNode);
    if (typeError) {
        cout << "type check over, your have " << typeError << " errors, please check!" << endl
             << endl;
    } else {
        cout << "type check over, everything is ok! congratulations!" << endl
             << endl;
    }
}

// Assembly:
pushq %rax
leaq -0x9(%rip), %rsi        # 0x76f6
leaq 0x5f(%rip), %rdx        # 0x7765
callq 0x7284
cmpl $0x0, 0xf20a(%rip)      # 0x1691c
je 0x7741
movq 0xe8ad(%rip), %rdi      # 0x15fc8
leaq 0x7d1c(%rip), %rsi      # 0xf43e
callq 0x21b0
movl 0xf1ef(%rip), %esi      # 0x1691c
movq %rax, %rdi
callq 0x22f0
leaq 0x7d1e(%rip), %rsi      # 0xf45a
movq %rax, %rdi
jmp 0x774f
movq 0xe880(%rip), %rdi      # 0x15fc8
leaq 0x7d22(%rip), %rsi      # 0xf471
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
movq %rax, %rdi
popq %rax
jmp 0x20f0
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/symtab.cpp
// Function: st_insert(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int, int)
void st_insert(string name, int lineno, int loc, int rank) {
    if (count(fun_names.begin(), fun_names.end(), name) != 0) return;
    if (rank == 2 || rank == 3) {
        // symtabOut << "insert: " << name << endl;
        if (loc == -1) {  // 当这个变量存在在符号表中时
            symtabs[name].line.push_back(lineno);
        } else if (lineno != -1) {  // 不在符号表
            SymtabOne s(lineno, loc, rank);
            s.addr = ++address;
            symtabs[name] = s;
        } else if (lineno != -1) {  // 不在符号表, 只建立key, 不在vector中插入
            SymtabOne s(loc);
            s.addr = ++address;
            symtabs[name] = s;
        }
    } else if (rank == 1) {
        // symtabOut << "insert: " << name << endl;
        if (loc == -1) {  // 当这个变量存在在符号表中时
            symtabs[name].line.push_back(lineno);
        } else {  // 不在符号表
            SymtabOne s(lineno, loc, rank);
            s.addr = ++address;
            symtabs[name] = s;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %ecx, %r15d
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
movl %esi, 0x4(%rsp)
leaq 0xe6af(%rip), %rax      # 0x16920
movq (%rax), %rdi
movq 0x8(%rax), %rsi
movq %rbx, %rdx
callq 0x3b94
testq %rax, %rax
je 0x8292
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %r15d, %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x82f2
cmpl $-0x1, %ebp
je 0x834f
cmpl $-0x1, %r14d
je 0x8285
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %r15d, %ecx
callq 0x86ba
movl 0xe6f9(%rip), %eax      # 0x169c0
incl %eax
movl %eax, 0xe6f1(%rip)      # 0x169c0
movl %eax, 0x20(%r12)
leaq 0xe6b5(%rip), %rdi      # 0x16990
movq %rbx, %rsi
callq 0x8636
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x86fc
jmp 0x8340
cmpl $0x1, %r15d
jne 0x8285
cmpl $-0x1, %ebp
je 0x834f
leaq 0x8(%rsp), %r15
pushq $0x1
popq %rcx
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x86ba
movl 0xe6a8(%rip), %eax      # 0x169c0
incl %eax
movl %eax, 0xe6a0(%rip)      # 0x169c0
movl %eax, 0x20(%r15)
leaq 0xe665(%rip), %rdi      # 0x16990
movq %rbx, %rsi
callq 0x8636
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x86fc
leaq 0x8(%rsp), %rdi
callq 0x87e0
jmp 0x8285
leaq 0xe63a(%rip), %rdi      # 0x16990
movq %rbx, %rsi
callq 0x8636
leaq 0x4(%rsp), %rsi
movq %rax, %rdi
callq 0x869c
jmp 0x8285
jmp 0x8372
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x87e0
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/assembly.cpp
// Function: getParams(TreeNode*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void getParams(TreeNode* params, string func_name) {
    if (params == NULL) return;
    // debug("params->child[0]->nodekind : " + params->child[0]->nodekind);
    if (params->child[0]->nodekind == "void") {
        // debug("param void");
        return;
    }

    vector<string> param_stack;
    map<string, string> var2stack;
    // 接下来是有参数的
    TreeNode* param = params->child[0];
    while (param != NULL) {
        // debug("param: " + param->nodekind);
        // debug(param->child[0]->nodekind + " " + param->child[1]->name);
        param_stack.push_back(param->child[1]->name);
        param = param->sibling;
    }

    // * 给参数分配栈空间
    int bias = 8;
    while (not param_stack.empty()) {
        var2stack[param_stack.front()] = to_string(bias) + "(%ebp)";
        param_stack.erase(param_stack.begin());
        bias += 4;
    }

    fun2param[func_name] = var2stack;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, 0x20(%rsp)
testq %rdi, %rdi
je 0xa69d
movq %rdi, %rbx
movq (%rdi), %rdi
addq $0x30, %rdi
leaq 0x4bdb(%rip), %rsi      # 0xf178
callq 0x368e
testb %al, %al
jne 0xa69d
movq %rsp, %r14
andq $0x0, 0x10(%r14)
leaq 0x30(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movl $0xc0, %r15d
movq (%rbx), %rbx
testq %rbx, %rbx
je 0xa5f6
movq 0x8(%rbx), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x3662
addq $0x20, %rbx
jmp 0xa5d9
pushq $0x8
popq %rbp
leaq 0x58(%rsp), %r14
leaq 0x5102(%rip), %r15      # 0xf707
leaq 0x78(%rsp), %r12
leaq 0x28(%rsp), %r13
movq %rsp, %rbx
movq (%rsp), %rax
cmpq 0x8(%rsp), %rax
je 0xa66d
movq %r14, %rdi
movl %ebp, %esi
callq 0x7cbf
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x7c7c
movq (%rsp), %rsi
movq %r13, %rdi
callq 0x7c16
movq %rax, %rdi
movq %r12, %rsi
callq 0x2230
movq %r12, %rdi
callq 0x2358
movq %r14, %rdi
callq 0x2358
movq (%rsp), %rsi
movq %rbx, %rdi
callq 0x8726
addl $0x4, %ebp
jmp 0xa612
leaq 0xc76c(%rip), %rdi      # 0x16de0
movq 0x20(%rsp), %rsi
callq 0xce3e
leaq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0xcfaa
leaq 0x28(%rsp), %rdi
callq 0x7b9c
movq %rsp, %rdi
callq 0x3640
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa6d3
jmp 0xa6d3
movq %rax, %rbx
jmp 0xa6c5
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x2358
leaq 0x58(%rsp), %rdi
callq 0x2358
jmp 0xa6d6
jmp 0xa6d3
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x7b9c
movq %rsp, %rdi
callq 0x3640
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/assembly.cpp
// Function: genLocVarDecl(TreeNode*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int genLocVarDecl(TreeNode* vars, string func_name) {
    if (vars == NULL) return 0;
    // debug(vars->child[0]->name);

    // ! 需要统计有多少个局部变量, 以分配初始的栈空间
    stack<string> var_stack;
    map<string, string> var2stack;
    int var_cnt   = 0;
    TreeNode* var = vars;
    while (var != NULL) {
        var_cnt += 1;
        // debug("var " + var->child[1]->name);
        var_stack.push(var->child[1]->name);
        var = var->sibling;
    }
    // debug("\tvar cnt: " + to_string(var_cnt));

    // * 给局部变量分配栈空间
    int bias = -4;
    while (not var_stack.empty()) {
        var2stack[var_stack.top()] = to_string(bias) + "(%ebp)";
        var_stack.pop();
        bias -= 4;
    }

    fun2var[func_name] = var2stack;
    return var_cnt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
testq %rdi, %rdi
je 0xa825
movq %rdi, %r14
movq %rsi, (%rsp)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xcea4
leaq 0x60(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
xorl %ebx, %ebx
movl $0xc0, %r12d
testq %r14, %r14
je 0xa75c
movq 0x8(%r14), %rsi
addq %r12, %rsi
movq %r15, %rdi
callq 0xdb1a
incl %ebx
movq 0x20(%r14), %r14
jmp 0xa740
pushq $-0x4
popq %rbp
leaq 0x88(%rsp), %r15
leaq 0xa8(%rsp), %r13
leaq 0x58(%rsp), %r14
leaq 0x8(%rsp), %r12
movq 0x38(%rsp), %rax
cmpq 0x18(%rsp), %rax
je 0xa7f2
movq %r15, %rdi
movl %ebp, %esi
callq 0x7cbf
movq %r13, %rdi
movq %r15, %rsi
leaq 0x4f6b(%rip), %rdx      # 0xf707
callq 0x7c7c
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
jne 0xa7be
movq 0x50(%rsp), %rax
movq -0x8(%rax), %rsi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0x7c16
movq %rax, %rdi
movq %r13, %rsi
callq 0x2230
movq %r13, %rdi
callq 0x2358
movq %r15, %rdi
callq 0x2358
movq %r12, %rdi
callq 0xdd90
addl $-0x4, %ebp
jmp 0xa779
leaq 0xc617(%rip), %rdi      # 0x16e10
movq (%rsp), %rsi
callq 0xce3e
leaq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0xcfaa
leaq 0x58(%rsp), %rdi
callq 0x7b9c
leaq 0x8(%rsp), %rdi
callq 0xd2a2
jmp 0xa827
xorl %ebx, %ebx
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa863
jmp 0xa863
movq %rax, %rbx
jmp 0xa854
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x2358
leaq 0x88(%rsp), %rdi
callq 0x2358
jmp 0xa866
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x7b9c
leaq 0x8(%rsp), %rdi
callq 0xd2a2
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/assembly.cpp
// Function: genInput(TreeNode*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void genInput(TreeNode* input, string left_loc) {
    // debug(input->nodekind);
    assout << "\tmovl\t$.LC1, %eax" << endl
           << "\tleal\t" << left_loc << ", %edx" << endl
           << "\tmovl\t"
           << "%edx, 4(%esp)" << endl
           << "\tmovl\t%eax, (%esp)" << endl
           << "\tcall\t__isoc99_scanf" << endl;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0xbc59(%rip), %rdi      # 0x16be0
leaq 0x47d5(%rip), %rsi      # 0xf763
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
leaq 0x47d3(%rip), %rsi      # 0xf775
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21a0
leaq 0x489c(%rip), %rsi      # 0xf858
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
leaq 0x4743(%rip), %rsi      # 0xf716
movq %rax, %rdi
callq 0x21b0
leaq 0x479a(%rip), %rsi      # 0xf77c
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
leaq 0x474a(%rip), %rsi      # 0xf743
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
leaq 0x477a(%rip), %rsi      # 0xf78a
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
popq %rbx
jmp 0x20f0
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/assembly.cpp
// Function: genReturn(TreeNode*, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>)
void genReturn(TreeNode* returnStmt, map<string, string> var2stack) {
    // debug("return: " + returnStmt->child[0]->nodekind);
    if (returnStmt->child[0]->nodekind == "Id") {
        assout << "\tmovl\t" << var2stack[returnStmt->child[0]->name] << ", %eax" << endl;
    } else if (returnStmt->child[0]->nodekind == "Const") {
        assout << "\tmovl\t$" << to_string(returnStmt->child[0]->val) << ", %eax" << endl;
    } else if (returnStmt->child[0]->nodekind == "Call") {
        // debug("return call: " + returnStmt->child[0]->nodekind);
        genCall(returnStmt->child[0], var2stack);
    }
    // TODO: 除了直接返回Id, 还有其他返回形式. 如 a + b, input() 这种
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rdi
addq $0x30, %rdi
leaq 0x399b(%rip), %rsi      # 0xf228
callq 0x368e
testb %al, %al
je 0xb8e7
leaq 0xb343(%rip), %rdi      # 0x16be0
leaq 0x3e72(%rip), %rsi      # 0xf716
callq 0x21b0
movq %rax, %r15
movl $0xc0, %esi
addq (%rbx), %rsi
movq %r14, %rdi
callq 0x7c16
movq %r15, %rdi
movq %rax, %rsi
callq 0x21a0
leaq 0x3e6e(%rip), %rsi      # 0xf73c
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x20f0
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0x3970(%rip), %rsi      # 0xf265
callq 0x368e
testb %al, %al
je 0xb954
leaq 0xb2db(%rip), %rdi      # 0x16be0
leaq 0x3e93(%rip), %rsi      # 0xf79f
callq 0x21b0
movq %rax, %r14
movq (%rbx), %rax
movl 0xb8(%rax), %esi
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x7cbf
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21a0
leaq 0x3e02(%rip), %rsi      # 0xf73c
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
movq %rsp, %rdi
callq 0x2358
jmp 0xb993
movq (%rbx), %rdi
addq $0x30, %rdi
leaq 0x38f4(%rip), %rsi      # 0xf256
callq 0x368e
testb %al, %al
je 0xb993
movq (%rbx), %rbx
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xd3ce
movq %rbx, %rdi
movq %r15, %rsi
callq 0xabcd
leaq 0x20(%rsp), %rdi
callq 0x7b9c
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x7b9c
jmp 0xb9b7
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2358
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/assembly.cpp
// Function: solveCompare(TreeNode*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>)
void solveCompare(TreeNode* root, string reg, map<string, string> var2stack) {
    // debug(root->nodekind);
    // TODO: 最好有一个通用处理的函数, 专门计算 exp等
    if (root->nodekind == "Const") {
        assout << "\tmovl\t$" << to_string(root->val) << ", " << reg << endl;
    } else if (root->nodekind == "Id") {
        assout << "\tmovl\t" << var2stack[root->name] << ", " << reg << endl;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rdi), %r12
leaq 0x313b(%rip), %rsi      # 0xf265
movq %r12, %rdi
callq 0x368e
testb %al, %al
je 0xc199
leaq 0xaaa3(%rip), %rdi      # 0x16be0
leaq 0x365b(%rip), %rsi      # 0xf79f
callq 0x21b0
movq %rax, %r15
movl 0xb8(%r14), %esi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x7cbf
movq %r15, %rdi
movq %r14, %rsi
callq 0x21a0
leaq 0x36a5(%rip), %rsi      # 0xf817
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq 0x8(%rsp), %rdi
callq 0x2358
jmp 0xc20c
leaq 0x3088(%rip), %rsi      # 0xf228
movq %r12, %rdi
callq 0x368e
testb %al, %al
je 0xc20c
leaq 0xaa2d(%rip), %rdi      # 0x16be0
leaq 0x355c(%rip), %rsi      # 0xf716
callq 0x21b0
movq %rax, %r12
addq $0xc0, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x7c16
movq %r12, %rdi
movq %rax, %rsi
callq 0x21a0
leaq 0x3631(%rip), %rsi      # 0xf817
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21a0
movq %rax, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x20f0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2358
movq %rbx, %rdi
callq 0x2300