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

    equality_expr_node->cmp_type             = CMP_NONE;
    equality_expr_node->relational_expr_node = create_relational_expr_node(vec, index);
    if (equality_expr_node->relational_expr_node == NULL) {
        error("Failed to create relational-expression node.\n");
        return NULL;
    }

    EqualityExprNode* current = equality_expr_node;
    const Token* token = vec->elements[*index];
    while (token->type == TK_EQ || token->type == TK_NE) {
        ++(*index);
    
        EqualityExprNode* p_equality_expr_node = calloc(1, sizeof(EqualityExprNode));

        p_equality_expr_node->equality_expr_node   = current;
        p_equality_expr_node->relational_expr_node = create_relational_expr_node(vec, index);
        if (equality_expr_node->relational_expr_node == NULL) {
            error("Failed to create relational-expression node.\n");
            return NULL;
        }

        if      (token->type == TK_EQ) { p_equality_expr_node->cmp_type = CMP_EQ; }
        else if (token->type == TK_NE) { p_equality_expr_node->cmp_type = CMP_NE; }

        token = vec->elements[*index];
        current = p_equality_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 0x96e0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x95cb
leaq 0x6d6b(%rip), %rdi      # 0x10322
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x96ca
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 $0x33, (%rcx)
movb %al, -0x39(%rbp)
je 0x9604
movq -0x30(%rbp), %rax
cmpl $0x34, (%rax)
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x9610
jmp 0x96c2
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x1, %edi
movl $0x18, %esi
callq 0x10b0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x96e0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x9675
leaq 0x6cbe(%rip), %rdi      # 0x10322
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x96ca
movq -0x30(%rbp), %rax
cmpl $0x33, (%rax)
jne 0x968a
movq -0x38(%rbp), %rax
movl $0x3, (%rax)
jmp 0x969f
movq -0x30(%rbp), %rax
cmpl $0x34, (%rax)
jne 0x969d
movq -0x38(%rbp), %rax
movl $0x4, (%rax)
jmp 0x969f
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 0x95e9
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)