// File: /workspace/github_cpp_makefile_star2_O3/philpoore[P]Math/./src/Parser.cpp
// Function: Parser::parseExpr(int)
AstExpr* Parser::parseExpr(int precedence_level) {
    AstExpr* left;
    consumeWhiteSpace();
    if (peekIs(TOKEN_EOF) || peekIs(TOKEN_RCURLY)) {
        return nullptr;
    } else if (peekIs(TOKEN_LPAREN)) {
        expect(TOKEN_LPAREN);
        left = parseExpr();
        expect(TOKEN_RPAREN, "Unmatched parentheses");
    } else {
        left = parseSubExpr();
    }

    while (true) {
        consumeWhiteSpace();
        Token t = peek();
        if (t.type == TOKEN_SEMI) {
            break;
        }
        if (!t.isBinOp()) {
            break;
        }

        int p = precedence(Token_to_bin_op(t.type));

        if (p <= precedence_level) {
            break;
        }

        Token bin_op_token = consume();
        AstBinaryOp* bin_op = new AstBinaryOp(bin_op_token.type);

        bin_op->left = left;
        bin_op->right = parseExpr(p);
        assert(bin_op->right != nullptr);
        left = (AstExpr*)bin_op;
    }
    return left;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %esi, -0x34(%rbp)
movq %rdi, %r14
callq 0x88a6
movq %r14, %rdi
movl $0x112, %esi            # imm = 0x112
callq 0x82c0
testb %al, %al
jne 0x9593
movq %r14, %rdi
movl $0x10d, %esi            # imm = 0x10D
callq 0x82c0
testb %al, %al
je 0x95a0
movq $0x0, -0x30(%rbp)
jmp 0x981c
movq %r14, %rdi
movl $0x10a, %esi            # imm = 0x10A
callq 0x82c0
testb %al, %al
je 0x96ba
leaq -0xc8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x3ee6(%rip), %rdx      # 0xd4ad
leaq -0xd8(%rbp), %rbx
movq %rbx, %rdi
movq %rdx, %rsi
callq 0xb494
leaq -0x138(%rbp), %rdi
movq %r14, %rsi
movl $0x10a, %edx            # imm = 0x10A
movq %rbx, %rcx
callq 0x839c
leaq -0x120(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x960f
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x962a
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x3240
movq %r14, %rdi
movl $0xffffd8f1, %esi       # imm = 0xFFFFD8F1
callq 0x9552
movq %rax, %rbx
leaq -0xa8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x3d6d(%rip), %rsi      # 0xd3ba
leaq 0x3d7b(%rip), %rdx      # 0xd3cf
leaq -0xb8(%rbp), %r15
movq %r15, %rdi
callq 0xb494
leaq -0x108(%rbp), %rdi
movq %r14, %rsi
movl $0x10b, %edx            # imm = 0x10B
movq %r15, %rcx
callq 0x839c
leaq -0xf0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9699
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0xb8(%rbp), %rdi
cmpq %r12, %rdi
movq %rbx, -0x30(%rbp)
je 0x96c6
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x3240
jmp 0x96c6
movq %r14, %rdi
callq 0x9e5e
movq %rax, -0x30(%rbp)
leaq -0x80(%rbp), %r12
movq %r14, %rdi
callq 0x88a6
movslq 0x1c(%r14), %rax
movq (%r14), %rbx
leaq (%rax,%rax,2), %r15
shlq $0x4, %r15
movl (%rbx,%r15), %eax
movl %eax, -0x98(%rbp)
movq %r12, -0x90(%rbp)
movq 0x8(%rbx,%r15), %rsi
movq 0x10(%rbx,%r15), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rdi
callq 0xb26a
movq 0x28(%rbx,%r15), %rax
movq %rax, -0x70(%rbp)
movslq -0x98(%rbp), %rax
leal -0x104(%rax), %ecx
cmpl $0x5, %ecx
ja 0x97f8
leaq 0x39e7(%rip), %rcx      # 0xd118
movl -0x410(%rcx,%rax,4), %r13d
cmpl -0x34(%rbp), %r13d
jle 0x97f8
movslq 0x1c(%r14), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x1c(%r14)
movq (%r14), %r15
leaq (%rax,%rax,2), %rbx
shlq $0x4, %rbx
movl (%r15,%rbx), %eax
movl %eax, -0x68(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq 0x8(%r15,%rbx), %rsi
movq 0x10(%r15,%rbx), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %rdi
callq 0xb26a
addq %rbx, %r15
movq 0x28(%r15), %rax
movq %rax, -0x40(%rbp)
movl $0x18, %edi
callq 0x3230
movq %rax, %r15
movl -0x68(%rbp), %eax
movl $0x5, (%r15)
leal -0x104(%rax), %ecx
addl $0xffffff06, %eax       # imm = 0xFFFFFF06
cmpl $0x6, %ecx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovael %ecx, %eax
movl %eax, 0x4(%r15)
movq -0x30(%rbp), %rax
movq %rax, 0x8(%r15)
movq %r14, %rdi
movl %r13d, %esi
callq 0x9552
movq %rax, 0x10(%r15)
testq %rax, %rax
je 0x9832
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x97ef
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x3240
movb $0x1, %r13b
movq %r15, -0x30(%rbp)
jmp 0x97fb
xorl %r13d, %r13d
movq -0x90(%rbp), %rdi
cmpq %r12, %rdi
je 0x9813
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x3240
testb %r13b, %r13b
jne 0x96ca
movq -0x30(%rbp), %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3bce(%rip), %rdi      # 0xd407
leaq 0x3be0(%rip), %rsi      # 0xd420
leaq 0x3bea(%rip), %rcx      # 0xd431
movl $0x104, %edx            # imm = 0x104
callq 0x3170
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r12, %rdi
je 0x98ba
movq -0xa8(%rbp), %rsi
jmp 0x98b2
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x98ba
movq -0xc8(%rbp), %rsi
jmp 0x98b2
movq %rax, %rbx
jmp 0x98a2
movq %rax, %rbx
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x98a2
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0x90(%rbp), %rdi
cmpq %r12, %rdi
je 0x98ba
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x3240
movq %rbx, %rdi
callq 0x3370