// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: declaration()
TreeNode* declaration() {
    /**
     * 对声明(函数/变量)的递归下降分析
     */
    TreeNode* t;
    TreeNode* p;
    // cout << ptoken.type << ": " << ptoken.value << endl;
    if (ptoken.type == "int") {
        p = new TreeNode("int");
        match("int");
    } else {
        p = new TreeNode("void");
        match("void");
    }
    if (p != NULL && ptoken.type == "Id") {  // 变量/函数名
        TreeNode* q = new TreeNode("Id");
        q->name     = ptoken.value;
        q->line     = ptoken.line;
        match("Id");
        // TODO: 需要增加数组
        if (ptoken.type == "Semicolon") {  // 检测到分号, 变量声明
            t            = new TreeNode("VarDecl");
            t->child[0]  = p;
            t->child[1]  = q;
            t->child_cnt = 2;  // 记录子节点的个数
            match("Semicolon");
        } else if (ptoken.type == "Assign") {  // 初始化变量并赋值
            match("Assign");
            Token tmp = match("Num");
            match("Semicolon");
            int val      = stoi(tmp.value);
            t            = new TreeNode("VarAssign");
            t->child[0]  = p;
            t->child[1]  = q;
            t->child_cnt = 2;
            q->val       = val;
        } else if (ptoken.type == "LeftBracket") {  // 左括号, 说明是函数
            match("LeftBracket");
            t           = new TreeNode("FunDecl");
            t->child[0] = p;
            t->child[1] = q;
            t->child[2] = params();  // ! 解析函数的参数
            match("RightBracket");
            t->child[3]  = compound_stmt();
            t->child_cnt = 4;
        } else {
            error();
        }
    }
    return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x470, %rsp            # imm = 0x470
leaq 0x1040a(%rip), %rdi     # 0x164c0
leaq 0x90b7(%rip), %rsi      # 0xf174
callq 0x368e
movl %eax, %ebp
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbx
testb %bpl, %bpl
je 0x6151
leaq 0x9097(%rip), %rsi      # 0xf174
leaq 0x210(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x210(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0x210(%rsp), %rdi
callq 0x2358
leaq 0x9061(%rip), %rsi      # 0xf174
leaq 0x1f0(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x428(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x3e94
leaq 0x428(%rsp), %rdi
callq 0x2ee6
leaq 0x1f0(%rsp), %rdi
jmp 0x61ca
leaq 0x9020(%rip), %rsi      # 0xf178
leaq 0x1d0(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x1d0(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0x1d0(%rsp), %rdi
callq 0x2358
leaq 0x8fea(%rip), %rsi      # 0xf178
leaq 0x1b0(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x3e0(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x3e94
leaq 0x3e0(%rsp), %rdi
callq 0x2ee6
leaq 0x1b0(%rsp), %rdi
callq 0x2358
leaq 0x102ea(%rip), %rdi     # 0x164c0
leaq 0x904b(%rip), %r15      # 0xf228
movq %r15, %rsi
callq 0x368e
movl $0xe0, %edi
callq 0x21c0
movq %rax, %r14
leaq 0x190(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %r15, %rsi
callq 0x2efc
leaq 0x190(%rsp), %rsi
movq %r14, %rdi
callq 0x703e
leaq 0x190(%rsp), %rdi
callq 0x2358
movq %r14, %rdi
addq $0xc0, %rdi
leaq 0x102ab(%rip), %rsi     # 0x164e0
callq 0x2110
movl 0x102c0(%rip), %eax     # 0x16500
movl %eax, 0x50(%r14)
leaq 0x8fdd(%rip), %rsi      # 0xf228
leaq 0x170(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x398(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x3e94
leaq 0x398(%rsp), %rdi
callq 0x2ee6
leaq 0x170(%rsp), %rdi
callq 0x2358
leaq 0x1022d(%rip), %rdi     # 0x164c0
leaq 0x8eab(%rip), %rsi      # 0xf145
callq 0x368e
testb %al, %al
je 0x6349
movl $0xe0, %edi
callq 0x21c0
movq %rax, %r12
leaq 0x8f7a(%rip), %rsi      # 0xf235
leaq 0x150(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x150(%rsp), %rsi
movq %r12, %rdi
callq 0x703e
leaq 0x150(%rsp), %rdi
callq 0x2358
movq %rbx, (%r12)
movq %r14, 0x8(%r12)
movl $0x2, 0x28(%r12)
leaq 0x8e42(%rip), %rsi      # 0xf145
leaq 0x130(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x350(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x3e94
leaq 0x350(%rsp), %rdi
callq 0x2ee6
leaq 0x130(%rsp), %rdi
callq 0x2358
jmp 0x65aa
leaq 0x10170(%rip), %rdi     # 0x164c0
leaq 0x8f53(%rip), %rsi      # 0xf2aa
callq 0x368e
testb %al, %al
je 0x64a8
leaq 0x8f3f(%rip), %rsi      # 0xf2aa
leaq 0x110(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x308(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x3e94
leaq 0x308(%rsp), %rdi
callq 0x2ee6
leaq 0x110(%rsp), %rdi
callq 0x2358
leaq 0x8d56(%rip), %rsi      # 0xf109
leaq 0xf0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2efc
leaq 0x8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x3e94
leaq 0xf0(%rsp), %rdi
callq 0x2358
leaq 0x8d5a(%rip), %rsi      # 0xf145
leaq 0xd0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2efc
leaq 0x2c0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x3e94
leaq 0x2c0(%rsp), %rdi
callq 0x2ee6
leaq 0xd0(%rsp), %rdi
callq 0x2358
leaq 0x28(%rsp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x70c9
movl %eax, %ebp
movl $0xe0, %edi
callq 0x21c0
movq %rax, %r12
leaq 0x8e56(%rip), %rsi      # 0xf2a7
leaq 0xb0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2efc
leaq 0xb0(%rsp), %rsi
movq %r12, %rdi
callq 0x703e
leaq 0xb0(%rsp), %rdi
callq 0x2358
movq %rbx, (%r12)
movq %r14, 0x8(%r12)
movl $0x2, 0x28(%r12)
movl %ebp, 0xb8(%r14)
leaq 0x8(%rsp), %rdi
callq 0x2ee6
jmp 0x65aa
leaq 0x10011(%rip), %rdi     # 0x164c0
leaq 0x8c76(%rip), %rsi      # 0xf12c
callq 0x368e
testb %al, %al
je 0x65bd
leaq 0x8c62(%rip), %rsi      # 0xf12c
leaq 0x90(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x278(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x3e94
leaq 0x278(%rsp), %rdi
callq 0x2ee6
leaq 0x90(%rsp), %rdi
callq 0x2358
movl $0xe0, %edi
callq 0x21c0
movq %rax, %r12
leaq 0x8d92(%rip), %rsi      # 0xf2b1
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x70(%rsp), %rsi
movq %r12, %rdi
callq 0x703e
leaq 0x70(%rsp), %rdi
callq 0x2358
movq %rbx, (%r12)
movq %r14, 0x8(%r12)
callq 0x42c7
movq %rax, 0x10(%r12)
leaq 0x8bd9(%rip), %rsi      # 0xf138
leaq 0x50(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2efc
leaq 0x230(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x3e94
leaq 0x230(%rsp), %rdi
callq 0x2ee6
leaq 0x50(%rsp), %rdi
callq 0x2358
callq 0x5f69
movq %rax, 0x18(%r12)
movl $0x4, 0x28(%r12)
movq %r12, %rax
addq $0x470, %rsp            # imm = 0x470
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x3e44
movq %rax, %r15
leaq 0xb0(%rsp), %rdi
callq 0x2358
jmp 0x65d7
movq %rax, %r15
movl $0xe0, %esi
movq %r12, %rdi
callq 0x21d0
jmp 0x665a
movq %rax, %r15
leaq 0x50(%rsp), %rdi
jmp 0x66f4
movq %rax, %r15
leaq 0xd0(%rsp), %rdi
callq 0x2358
jmp 0x665a
jmp 0x66fb
jmp 0x6657
movq %rax, %r15
leaq 0x70(%rsp), %rdi
jmp 0x6686
movq %rax, %r15
leaq 0xf0(%rsp), %rdi
jmp 0x66f4
jmp 0x668d
jmp 0x66fb
movq %rax, %r15
leaq 0x90(%rsp), %rdi
jmp 0x66f4
movq %rax, %r15
leaq 0x110(%rsp), %rdi
jmp 0x66f4
jmp 0x66fb
jmp 0x66fb
movq %rax, %r15
leaq 0x8(%rsp), %rdi
callq 0x2ee6
jmp 0x6722
movq %rax, %r15
leaq 0x130(%rsp), %rdi
jmp 0x66f4
jmp 0x66fb
movq %rax, %r15
leaq 0x150(%rsp), %rdi
callq 0x2358
jmp 0x6690
movq %rax, %r15
movl $0xe0, %esi
movq %r12, %rdi
jmp 0x671d
movq %rax, %r15
leaq 0x1b0(%rsp), %rdi
jmp 0x66f4
movq %rax, %r15
leaq 0x1f0(%rsp), %rdi
jmp 0x66f4
jmp 0x66fb
jmp 0x66fb
movq %rax, %r15
leaq 0x1d0(%rsp), %rdi
jmp 0x66d3
movq %rax, %r15
leaq 0x210(%rsp), %rdi
callq 0x2358
jmp 0x66df
jmp 0x66dc
movq %rax, %r15
movl $0xe0, %esi
movq %rbx, %rdi
jmp 0x671d
movq %rax, %r15
leaq 0x170(%rsp), %rdi
callq 0x2358
jmp 0x6722
movq %rax, %r15
jmp 0x6722
movq %rax, %r15
leaq 0x190(%rsp), %rdi
callq 0x2358
jmp 0x6715
movq %rax, %r15
movl $0xe0, %esi
movq %r14, %rdi
callq 0x21d0
movq %r15, %rdi
callq 0x2300