// File: /workspace/github_cpp_makefile_star2_O2/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 $0x108, %rsp            # imm = 0x108
movl %esi, -0x2c(%rbp)
movq %rdi, %r14
callq 0x5ebc
movq %r14, %rdi
movl $0x112, %esi            # imm = 0x112
callq 0x5c4e
testb %al, %al
jne 0x66af
movq %r14, %rdi
movl $0x10d, %esi            # imm = 0x10D
callq 0x5c4e
testb %al, %al
je 0x66b7
xorl %r12d, %r12d
jmp 0x6823
movq %r14, %rdi
movl $0x10a, %esi            # imm = 0x10A
callq 0x5c4e
testb %al, %al
je 0x6769
leaq 0x3e10(%rip), %rsi      # 0xa4e3
leaq -0xa0(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x7692
leaq -0x130(%rbp), %rdi
leaq -0xa0(%rbp), %rcx
movq %r14, %rsi
movl $0x10a, %edx            # imm = 0x10A
callq 0x5cb2
leaq -0x128(%rbp), %rdi
callq 0x3110
leaq -0xa0(%rbp), %rdi
callq 0x3110
movq %r14, %rdi
movl $0xffffd8f1, %esi       # imm = 0xFFFFD8F1
callq 0x666e
movq %rax, %r12
leaq 0x3cc3(%rip), %rsi      # 0xa3f0
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x7692
leaq -0x100(%rbp), %rdi
leaq -0x80(%rbp), %rcx
movq %r14, %rsi
movl $0x10b, %edx            # imm = 0x10B
callq 0x5cb2
leaq -0xf8(%rbp), %rdi
callq 0x3110
leaq -0x80(%rbp), %rdi
callq 0x3110
jmp 0x6774
movq %r14, %rdi
callq 0x6c4a
movq %rax, %r12
leaq -0x60(%rbp), %r13
movq %r14, %rdi
callq 0x5ebc
xorl %ebx, %ebx
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x5b68
movl -0x60(%rbp), %edi
leal -0x104(%rdi), %eax
cmpl $0x5, %eax
ja 0x6812
callq 0x506f
addl $-0xa, %eax
pushq $-0x1
popq %rbx
cmpl $0x5, %eax
ja 0x67b9
movl %eax, %eax
leaq 0x3962(%rip), %rcx      # 0xa118
movl (%rcx,%rax,4), %ebx
cmpl -0x2c(%rbp), %ebx
jle 0x6810
leaq -0xd0(%rbp), %rdi
movq %r14, %rsi
callq 0x5c86
pushq $0x18
popq %rdi
callq 0x3200
movq %rax, %r15
movl -0xd0(%rbp), %esi
movq %rax, %rdi
callq 0x7d6a
movq %r12, 0x8(%r15)
movq %r14, %rdi
movl %ebx, %esi
callq 0x666e
movq %rax, 0x10(%r15)
testq %rax, %rax
je 0x6838
leaq -0xc8(%rbp), %rdi
callq 0x3110
movb $0x1, %bl
movq %r15, %r12
jmp 0x6812
xorl %ebx, %ebx
leaq -0x58(%rbp), %rdi
callq 0x3110
testb %bl, %bl
jne 0x6778
movq %r12, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3bfe(%rip), %rdi      # 0xa43d
leaq 0x3c10(%rip), %rsi      # 0xa456
leaq 0x3c1a(%rip), %rcx      # 0xa467
movl $0x104, %edx            # imm = 0x104
callq 0x3170
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
jmp 0x688b
jmp 0x686e
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
jmp 0x688b
movq %rax, %rbx
jmp 0x6890
movq %rax, %rbx
jmp 0x6887
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x3110
leaq -0x58(%rbp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3370