// File: /workspace/github_c_makefile_star2_O0/chgzm[P]minic/parser.c
// Function: create_additive_expr_node
static AdditiveExprNode* create_additive_expr_node(const Vector* vec, int* index) {
    AdditiveExprNode* additive_expr_node = calloc(1, sizeof(AdditiveExprNode));

    additive_expr_node->operator_type            = OP_NONE;
    additive_expr_node->multiplicative_expr_node = create_multiplicative_expr_node(vec, index);
    if (additive_expr_node->multiplicative_expr_node == NULL) {
        error("Failed to create multiplicative-expression node.\n");
        return NULL;
    }

    AdditiveExprNode* current = additive_expr_node;
    const Token* token = vec->elements[*index];
    while (token->type == TK_PLUS || token->type == TK_MINUS) {
        ++(*index);

        AdditiveExprNode* p_additive_expr_node = malloc(sizeof(AdditiveExprNode));

        p_additive_expr_node->operator_type            = (token->type == TK_PLUS) ? OP_ADD: OP_SUB;
        p_additive_expr_node->additive_expr_node       = current;
        p_additive_expr_node->multiplicative_expr_node = create_multiplicative_expr_node(vec, index);
        if (p_additive_expr_node->multiplicative_expr_node == NULL) {
            error("Failed to create multiplicative-expression node.\n");
            return NULL;
        }

        token = vec->elements[*index];
        current = p_additive_expr_node;
    }

    return current;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x1, %edi
movl $0x18, %esi
callq 0x10b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9a90
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x998b
leaq 0x6a50(%rip), %rdi      # 0x103c7
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x9a77
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movb $0x1, %al
cmpl $0x18, (%rcx)
movb %al, -0x39(%rbp)
je 0x99c4
movq -0x30(%rbp), %rax
cmpl $0x19, (%rax)
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x99d0
jmp 0x9a6f
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x18, %edi
callq 0x10f0
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %edx
movl $0xc, %ecx
movl $0xb, %eax
cmpl $0x18, %edx
cmovel %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9a90
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x9a4c
leaq 0x698c(%rip), %rdi      # 0x103c7
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x9a77
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x99a9
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)