// File: /workspace/github_cpp_makefile_star2_O1/KJTang[P]SimpleCompiler/Parser.cpp
// Function: Parser::parseIdentifier()
ASTNode *Parser::parseIdentifier() {
    #ifdef DEBUG
    std::cout<<curToken.second<<"\tparseIdentifier"<<std::endl;
    #endif
    std::string identifier = curToken.second;
    getNextToken();
    // variable name
    if (curToken.first != static_cast<Token>('(')) {
        return new VariableAST(identifier);
    }
    // function call
    getNextToken(); // eat '('
    std::vector<ASTNode*> args;
    while (true) {
        ASTNode *arg = parseExpression();
        if (arg) {
            args.push_back(arg);
        }
        if (curToken.first == static_cast<Token>(')')) {
            getNextToken(); // eat ')'
            break;
        }
    }
    return new CallFuncAST(identifier, args);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x60(%rdi), %r14
leaq -0x50(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x60(%rdi), %rsi
movq 0x68(%rdi), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %rdi
callq 0x42ce
movslq 0x80(%rbx), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x80(%rbx)
movq (%rbx), %rcx
leaq (%rax,%rax,4), %rax
leaq 0x8(%rcx,%rax,8), %rsi
movl -0x8(%rsi), %eax
movl %eax, 0x58(%rbx)
movq %r14, %rdi
callq 0x3130
cmpl $0x28, 0x58(%rbx)
jne 0xa41c
movslq 0x80(%rbx), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x80(%rbx)
movq (%rbx), %rcx
leaq (%rax,%rax,4), %rax
leaq 0x8(%rcx,%rax,8), %rsi
movl -0x8(%rsi), %eax
movl %eax, 0x58(%rbx)
movq %r14, %rdi
callq 0x3130
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %r15
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
leaq -0x68(%rbp), %r12
movq %rbx, %rdi
callq 0x9b7a
movq %rax, -0x68(%rbp)
testq %rax, %rax
je 0xa3b1
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0xa3a6
movq %rax, (%rsi)
addq $0x8, -0x38(%rbp)
jmp 0xa3b1
movq %r15, %rdi
movq %r12, %rdx
callq 0xb060
movl 0x58(%rbx), %r13d
cmpl $0x29, %r13d
jne 0xa381
movslq 0x80(%rbx), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x80(%rbx)
movq (%rbx), %rcx
leaq (%rax,%rax,4), %rax
leaq 0x8(%rcx,%rax,8), %rsi
movl -0x8(%rsi), %eax
movl %eax, 0x58(%rbx)
movq %r14, %rdi
callq 0x3130
cmpl $0x29, %r13d
jne 0xa381
movl $0x48, %edi
callq 0x31e0
movq %rax, %rbx
leaq -0x60(%rbp), %rsi
leaq -0x40(%rbp), %rdx
movq %rax, %rdi
leaq -0x50(%rbp), %r15
callq 0xad28
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xa45d
callq 0x31c0
jmp 0xa45d
movl $0x30, %edi
callq 0x31e0
movq %rax, %rbx
movl $0x0, 0x8(%rax)
leaq 0x96d9(%rip), %rax      # 0x13b10
addq $0x10, %rax
movq %rax, (%rbx)
leaq 0x10(%rbx), %rdi
movq %rbx, %rax
addq $0x20, %rax
movq %rax, 0x10(%rbx)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
addq %rsi, %rdx
callq 0x42ce
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0xa46b
callq 0x31c0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x31c0
jmp 0xa49c
jmp 0xa499
movq %rax, %r14
movq %rbx, %rdi
jmp 0xa4a5
movq %rax, %r14
jmp 0xa4aa
movq %rax, %r14
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xa4aa
callq 0x31c0
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xa4bc
callq 0x31c0
movq %r14, %rdi
callq 0x3330