// File: /workspace/github_c_makefile_star2_O0/gaultier[P]lox-c/parse.c
// Function: precedence
static void precedence(Parser* parser, Precedence precedence, Vm* vm) {
    LOG("precedence=%s previous_type=%s current_type=%s\n",
        precedence_str[precedence], token_type_str[parser->previous.type],
        token_type_str[parser->current.type]);
    advance(parser);
    LOG("precedence=%s previous_type=%s current_type=%s\n",
        precedence_str[precedence], token_type_str[parser->previous.type],
        token_type_str[parser->current.type]);

    const ParseFn prefix_rule = rules[parser->previous.type].prefix;
    if (!prefix_rule) {
        error_str_nul(parser, &parser->previous, "Expected expression");
        return;
    }

    const bool canAssign = precedence <= PREC_ASSIGNMENT;
    LOG("precedence=%d canAssign=%d previous_type=%d\n", precedence, canAssign,
        parser->previous.type);
    prefix_rule(parser, vm, canAssign);
    LOG("precedence=%d canAssign=%d\n", precedence, canAssign);

    while (!peek(parser, TOKEN_EOF) &&
           (precedence <= rules[parser->current.type].precedence)) {
        LOG("precedence=%d\n", precedence);
        advance(parser);

        const ParseFn infix_rule = rules[parser->previous.type].infix;

        infix_rule(parser, vm, canAssign);
    }

    if (canAssign && peek(parser, TOKEN_EQUAL)) {
        error_str_nul(parser, &parser->previous,
                      "Expression cannot be assigned");
        return;
    }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movq %rdx, 0x20(%rsp)
jmp 0x4074
movq 0x30(%rsp), %rdi
callq 0x2f50
jmp 0x4080
movq 0x30(%rsp), %rax
movl 0x78(%rax), %eax
movl %eax, %ecx
leaq 0xb96f(%rip), %rax      # 0xfa00
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x40c7
movq 0x30(%rsp), %rdi
movq 0x30(%rsp), %rsi
addq $0x58, %rsi
leaq 0x778e(%rip), %rdx      # 0xb84b
callq 0x3bb0
jmp 0x41c7
cmpl $0x1, 0x2c(%rsp)
setbe %al
andb $0x1, %al
movb %al, 0x17(%rsp)
jmp 0x40d7
movq 0x18(%rsp), %rax
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rsi
movb 0x17(%rsp), %cl
andb $0x1, %cl
movzbl %cl, %edx
callq *%rax
jmp 0x40f4
jmp 0x40f6
movq 0x30(%rsp), %rdi
movl $0x28, %esi
callq 0x31d0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x7(%rsp)
jne 0x4138
movl 0x2c(%rsp), %eax
movq 0x30(%rsp), %rcx
movl 0x50(%rcx), %ecx
movl %ecx, %edx
leaq 0xb8d9(%rip), %rcx      # 0xfa00
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
setbe %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x4142
jmp 0x4191
jmp 0x4144
jmp 0x4146
movq 0x30(%rsp), %rdi
callq 0x2f50
movq 0x30(%rsp), %rax
movl 0x78(%rax), %eax
movl %eax, %ecx
leaq 0xb89f(%rip), %rax      # 0xfa00
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rsi
movb 0x17(%rsp), %cl
andb $0x1, %cl
movzbl %cl, %edx
callq *%rax
jmp 0x40f6
testb $0x1, 0x17(%rsp)
je 0x41c7
movq 0x30(%rsp), %rdi
movl $0xe, %esi
callq 0x31d0
testb $0x1, %al
jne 0x41ad
jmp 0x41c7
movq 0x30(%rsp), %rdi
movq 0x30(%rsp), %rsi
addq $0x58, %rsi
leaq 0x769d(%rip), %rdx      # 0xb85f
callq 0x3bb0
addq $0x38, %rsp
retq
nopl (%rax)