// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]csmile/parse.cpp
// Function: factor(TreeNode*)
TreeNode* factor(TreeNode* k) {
    TreeNode* t = NULL;
    if (k != NULL) {
        if (ptoken.type == "LeftBracket" && k->nodekind != "ArrayElem") {  // TODO: 数组元素
            t = call(k);
        } else {
            t = k;
        }
    } else {
        if (ptoken.type == "LeftBracket") {
            match("LeftBracket");
            t = expression();
            match("RightBracket");
        } else if (ptoken.type == "Id") {
            k = var();
            if (ptoken.type == "LeftBracket" && k->nodekind != "ArrayElem") {
                t = call(k);
            } else {
                t = k;
            }
        } else if (ptoken.type == "Num") {
            t = new TreeNode("Const");
            if ((t != NULL) && (ptoken.type == "Num")) {
                t->val = stoi(ptoken.value);
            }
            match("Num");
        } else {
            ptoken = getToken();
        }
    }
    return t;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %rbx
leaq 0x10db1(%rip), %rdi     # 0x164c0
leaq 0x9a16(%rip), %rsi      # 0xf12c
callq 0x368e
testq %rbx, %rbx
je 0x5752
testb %al, %al
je 0x57e6
leaq 0x30(%rbx), %rdi
leaq 0x9b28(%rip), %rsi      # 0xf25b
callq 0x7005
testb %al, %al
je 0x57e6
movq %rbx, %rdi
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
jmp 0x556c
testb %al, %al
je 0x57f4
leaq 0x99cb(%rip), %rsi      # 0xf12c
leaq 0x68(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x2efc
leaq 0x160(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3e94
leaq 0x160(%rsp), %rdi
callq 0x2ee6
leaq 0x68(%rsp), %rdi
callq 0x2358
callq 0x4c1b
movq %rax, %rbx
leaq 0x998d(%rip), %rsi      # 0xf138
leaq 0x48(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x2efc
leaq 0x118(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x3e94
leaq 0x118(%rsp), %rdi
callq 0x2ee6
leaq 0x48(%rsp), %rdi
callq 0x2358
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
retq
leaq 0x10cc5(%rip), %rdi     # 0x164c0
leaq 0x9a26(%rip), %rsi      # 0xf228
callq 0x368e
testb %al, %al
je 0x5836
callq 0x5316
movq %rax, %rbx
leaq 0x10ca6(%rip), %rdi     # 0x164c0
leaq 0x990b(%rip), %rsi      # 0xf12c
callq 0x368e
testb %al, %al
je 0x57e6
movq %rbx, %rdi
addq $0x30, %rdi
jmp 0x572c
leaq 0x10c83(%rip), %rdi     # 0x164c0
leaq 0x98c5(%rip), %rsi      # 0xf109
callq 0x368e
testb %al, %al
je 0x58fe
movl $0xe0, %edi
callq 0x21c0
movq %rax, %rbx
leaq 0x9a00(%rip), %rsi      # 0xf265
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x2efc
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x703e
leaq 0x28(%rsp), %rdi
callq 0x2358
leaq 0x10c2b(%rip), %rdi     # 0x164c0
leaq 0x986d(%rip), %rsi      # 0xf109
callq 0x368e
testb %al, %al
je 0x58bc
leaq 0x10c34(%rip), %rdi     # 0x164e0
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x70c9
movl %eax, 0xb8(%rbx)
leaq 0x9846(%rip), %rsi      # 0xf109
leaq 0x8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x2efc
leaq 0xd0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3e94
leaq 0xd0(%rsp), %rdi
callq 0x2ee6
leaq 0x8(%rsp), %rdi
jmp 0x57e1
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
callq 0x312b
leaq 0x10bab(%rip), %rdi     # 0x164c0
movq %rbx, %rsi
callq 0x7010
movq %rbx, %rdi
callq 0x2ee6
xorl %ebx, %ebx
jmp 0x57e6
movq %rax, %r14
leaq 0x8(%rsp), %rdi
jmp 0x596d
jmp 0x5974
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x2358
jmp 0x594a
movq %rax, %r14
movl $0xe0, %esi
movq %rbx, %rdi
callq 0x21d0
jmp 0x5977
movq %rax, %r14
leaq 0x48(%rsp), %rdi
jmp 0x596d
jmp 0x5974
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0x2358
jmp 0x5977
movq %rax, %r14
movq %r14, %rdi
callq 0x2300