// File: /workspace/github_cpp_makefile_star2_O2/taurheim[P]AgNES/parser.cpp
// Function: Parser::expression()
ASTNode * Parser::expression() {
    /*
        "-" <expression>
        | "!" <expression>
        | "(" <expression> ")"
        | <number>
        | <character>
        | <string>
        | <identifier> "(" [ <expression> { "," <expression> }] ")" 
        | <identifier>  "[" <expression> "]"
        | <identifier>
        | <expression> <binaryOperation> <expression>
    */
    ASTNode * node = new ASTNode(AST_EXPRESSION);

    switch(t.type) {
        case T_INTVALUE: {
            ASTNode * numberNode = number();
            if (t.type == T_PLUS || t.type == T_MINUS) {
                ASTNode * expressionNode = new ASTNode(AST_EXPRESSION);
                expressionNode->children.push_back(numberNode);
                node->children.push_back(expressionNode);
            } else {
                node->children.push_back(numberNode);
            }
            break;
        }
        case T_CHARVALUE: {
            ASTNode * charNode = character();
            node->children.push_back(charNode);
            break;
        }
        case T_IDENT: {
            ASTNode * identNode = identifier();
            if (t.type == T_PLUS || t.type == T_MINUS) {
                ASTNode * expressionNode = new ASTNode(AST_EXPRESSION);
                expressionNode->children.push_back(identNode);
                node->children.push_back(expressionNode);
            } else {
                node->children.push_back(identNode);
            }
            break;
        }
        case T_LPAREN: {
            expect(T_LPAREN);
            node->children.push_back(expression());
            expect(T_RPAREN);
            break;
        }
        default: {
            reject("Expression expected T_IDENT or T_INTVALUE");
        }
    }

    if(t.type == T_PLUS || t.type == T_MINUS) {
        node->children.push_back(op());
        node->children.push_back(expression());
    } else if (t.type == T_LPAREN) {
        // Function call
    }

    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
pushq $0x20
popq %rdi
callq 0x3250
movq %rax, %r14
leaq 0x8(%rax), %r15
xorps %xmm0, %xmm0
andq $0x0, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movl $0xb, (%rax)
movl 0x18(%rbx), %eax
cmpl $0x4, %eax
je 0x8fd4
cmpl $0x9, %eax
je 0x9018
cmpl $0x11, %eax
je 0x8fc0
cmpl $0xf, %eax
jne 0x90be
movq %rbx, %rdi
callq 0x8f18
jmp 0x9020
movq %rbx, %rdi
callq 0x922a
leaq -0x40(%rbp), %rsi
movq %rax, (%rsi)
jmp 0x9069
leaq -0x40(%rbp), %r12
movl $0x4, (%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x875c
movq %rbx, %rdi
callq 0x8f68
movq %rax, (%r12)
movq %r15, %rdi
movq %r12, %rsi
callq 0xa5a2
movl $0x5, (%r12)
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x875c
jmp 0x9071
movq %rbx, %rdi
callq 0x88aa
movq %rax, -0x40(%rbp)
movl 0x18(%rbx), %eax
decl %eax
cmpl $0x1, %eax
ja 0x9065
pushq $0x20
popq %rdi
callq 0x3250
leaq 0x8(%rax), %rdi
xorps %xmm0, %xmm0
andq $0x0, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movl $0xb, (%rax)
leaq -0x48(%rbp), %r12
movq %rax, (%r12)
leaq -0x40(%rbp), %rsi
callq 0x9976
movq %r15, %rdi
movq %r12, %rsi
jmp 0x906c
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x9976
movl 0x18(%rbx), %eax
decl %eax
cmpl $0x1, %eax
ja 0x90ae
movq %rbx, %rdi
callq 0x927a
leaq -0x40(%rbp), %r12
movq %rax, (%r12)
movq %r15, %rdi
movq %r12, %rsi
callq 0xa5a2
movq %rbx, %rdi
callq 0x8f68
movq %rax, (%r12)
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0xa5a2
movq %r14, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x73c6(%rip), %rsi      # 0x1048b
leaq -0x40(%rbp), %r14
leaq -0x48(%rbp), %rdx
movq %r14, %rdi
callq 0x3110
movq %rbx, %rdi
movq %r14, %rsi
callq 0x841c
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x33e0