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

    relational_expr_node->cmp_type             = CMP_NONE;
    relational_expr_node->shift_expr_node      = create_shift_expr(vec, index);
    if (relational_expr_node->shift_expr_node == NULL) {
        error("Failed to create shift-expression node.\n");
        return NULL;
    }
    
    RelationalExprNode* current = relational_expr_node;
    const Token* token = vec->elements[*index];
    while (token->type == TK_LANGLE || token->type == TK_RANGLE || token->type == TK_LE || token->type == TK_GE) {
        ++(*index);
    
        RelationalExprNode* parent = calloc(1, sizeof(EqualityExprNode));

        parent->relational_expr_node = current;
        parent->shift_expr_node      = create_shift_expr(vec, index);
        if (parent->shift_expr_node == NULL) {
            error("Failed to create shif-texpression node.\n");
            return NULL;
        }

        if      (token->type == TK_LANGLE) { parent->cmp_type = CMP_LT; }
        else if (token->type == TK_RANGLE) { parent->cmp_type = CMP_GT; }
        else if (token->type == TK_LE)     { parent->cmp_type = CMP_LE; }
        else if (token->type == TK_GE)     { parent->cmp_type = CMP_GE; }
     
        token = vec->elements[*index];
        current = parent;
    }

    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 0x98b0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x974b
leaq 0x6c19(%rip), %rdi      # 0x10350
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x9897
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 $0x27, (%rcx)
movb %al, -0x39(%rbp)
je 0x97a0
movq -0x30(%rbp), %rcx
movb $0x1, %al
cmpl $0x28, (%rcx)
movb %al, -0x39(%rbp)
je 0x97a0
movq -0x30(%rbp), %rcx
movb $0x1, %al
cmpl $0x35, (%rcx)
movb %al, -0x39(%rbp)
je 0x97a0
movq -0x30(%rbp), %rax
cmpl $0x36, (%rax)
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x97ac
jmp 0x988f
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 0x98b0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x9814
leaq 0x6b79(%rip), %rdi      # 0x10379
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x9897
movq -0x30(%rbp), %rax
cmpl $0x27, (%rax)
jne 0x9829
movq -0x38(%rbp), %rax
movl $0x1, (%rax)
jmp 0x986c
movq -0x30(%rbp), %rax
cmpl $0x28, (%rax)
jne 0x983e
movq -0x38(%rbp), %rax
movl $0x2, (%rax)
jmp 0x986a
movq -0x30(%rbp), %rax
cmpl $0x35, (%rax)
jne 0x9853
movq -0x38(%rbp), %rax
movl $0x5, (%rax)
jmp 0x9868
movq -0x30(%rbp), %rax
cmpl $0x36, (%rax)
jne 0x9866
movq -0x38(%rbp), %rax
movl $0x6, (%rax)
jmp 0x9868
jmp 0x986a
jmp 0x986c
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 0x9769
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)