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

    postfix_expr_node->assign_expr_nodes = create_vector();
    postfix_expr_node->postfix_expr_type = PS_PRIMARY;

    postfix_expr_node->primary_expr_node = create_primary_expr_node(vec, index);
    if (postfix_expr_node->primary_expr_node == NULL) {
        error("Failed to create primary-expression node.\n");
        return NULL;
    }

    PostfixExprNode* current = postfix_expr_node;
    const Token* token = vec->elements[*index];
    while (token->type == TK_LSQUARE || token->type == TK_LPAREN || token->type == TK_DOT
        || token->type == TK_ARROW   || token->type == TK_INC    || token->type == TK_DEC) {
        
        PostfixExprNode* p_postfix_expr_node = NULL;
        switch (token->type) {
        case TK_LSQUARE: {
            ++(*index);

            p_postfix_expr_node                     = calloc(1, sizeof(PostfixExprNode));
            p_postfix_expr_node->postfix_expr_node  = current;
            p_postfix_expr_node->assign_expr_nodes  = create_vector();
            p_postfix_expr_node->postfix_expr_type  = PS_LSQUARE;
            p_postfix_expr_node->expr_node          = create_expr_node(vec, index);
            if (p_postfix_expr_node->expr_node == NULL) {
                error("Failed to create assignment-expression node.\n");
                return NULL;
            }

            token = vec->elements[*index];
            if (token->type != TK_RSQUARE) {
                error("Invalid token[%d]=\"%s\".\n", *index, decode_token_type(token->type));
                return NULL;    
            }
            ++(*index);

            break;
        }
        case TK_LPAREN: {
            ++(*index);

            p_postfix_expr_node                     = calloc(1, sizeof(PostfixExprNode));
            p_postfix_expr_node->postfix_expr_node  = current;
            p_postfix_expr_node->assign_expr_nodes  = create_vector();
            p_postfix_expr_node->postfix_expr_type  = PS_LPAREN;

            token = vec->elements[*index];
            while (token->type != TK_RPAREN) {
                AssignExprNode* assign_expr_node = create_assign_expr_node(vec, index);
                if (assign_expr_node == NULL) {
                    error("Failed to create assignment-expression node.\n");
                    return NULL;
                }

                vector_push_back(p_postfix_expr_node->assign_expr_nodes, assign_expr_node); 
                token = vec->elements[*index];

                if (token->type == TK_COMMA) {
                    ++(*index);   
                    token = vec->elements[*index];
                }
            }

            ++(*index);
            break;
        }
        case TK_DOT: {
            ++(*index);

            p_postfix_expr_node                     = calloc(1, sizeof(PostfixExprNode));
            p_postfix_expr_node->postfix_expr_node  = current;
            p_postfix_expr_node->assign_expr_nodes  = create_vector();
            p_postfix_expr_node->postfix_expr_type  = PS_DOT;

            token = vec->elements[*index];
            if (token->type != TK_IDENT) {
                error("Invalid token[%d]=\"%s\".\n", *index, decode_token_type(token->type));
                return NULL;    
            }
            p_postfix_expr_node->identifier = strdup(token->str);

            ++(*index);

            break;
        }
        case TK_ARROW: {
            ++(*index);

            p_postfix_expr_node                     = calloc(1, sizeof(PostfixExprNode));
            p_postfix_expr_node->postfix_expr_node  = current;
            p_postfix_expr_node->assign_expr_nodes  = create_vector();
            p_postfix_expr_node->postfix_expr_type  = PS_ARROW;
            
            token = vec->elements[*index];
            if (token->type != TK_IDENT) {
                error("Invalid token[%d]=\"%s\".\n", *index, decode_token_type(token->type));
                return NULL;    
            }
            p_postfix_expr_node->identifier = strdup(token->str);

            ++(*index);

            break;
        }
        case TK_INC: {
            ++(*index);
            p_postfix_expr_node                    = calloc(1, sizeof(PostfixExprNode));
            p_postfix_expr_node->assign_expr_nodes = create_vector();
            p_postfix_expr_node->postfix_expr_node = current;
            p_postfix_expr_node->postfix_expr_type = PS_INC;
            break;
        }
        case TK_DEC: {
            ++(*index);
            p_postfix_expr_node                    = calloc(1, sizeof(PostfixExprNode));
            p_postfix_expr_node->assign_expr_nodes = create_vector();
            p_postfix_expr_node->postfix_expr_node = current;
            p_postfix_expr_node->postfix_expr_type = PS_DEC;
            break;
        }
        default: {
            error("Invalid token[%d]=\"%s\".\n", *index, decode_token_type(token->type));
            return NULL;
        }
        }

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

    return current;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x1, %edi
movl $0x30, %esi
callq 0x10b0
movq %rax, -0x20(%rbp)
movb $0x0, %al
callq 0xe5c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x28(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xa6c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xa19c
leaq 0x633b(%rip), %rdi      # 0x104c3
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa6ae
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 $0x25, (%rcx)
movb %al, -0x41(%rbp)
je 0xa20d
movq -0x30(%rbp), %rcx
movb $0x1, %al
cmpl $0x21, (%rcx)
movb %al, -0x41(%rbp)
je 0xa20d
movq -0x30(%rbp), %rcx
movb $0x1, %al
cmpl $0x31, (%rcx)
movb %al, -0x41(%rbp)
je 0xa20d
movq -0x30(%rbp), %rcx
movb $0x1, %al
cmpl $0x32, (%rcx)
movb %al, -0x41(%rbp)
je 0xa20d
movq -0x30(%rbp), %rcx
movb $0x1, %al
cmpl $0x3b, (%rcx)
movb %al, -0x41(%rbp)
je 0xa20d
movq -0x30(%rbp), %rax
cmpl $0x3c, (%rax)
sete %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0xa219
jmp 0xa6a6
movq $0x0, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
addl $-0x21, %eax
movl %eax, %ecx
movq %rcx, -0x50(%rbp)
subl $0x1b, %eax
ja 0xa651
movq -0x50(%rbp), %rax
leaq 0x59b0(%rip), %rcx      # 0xfbf4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x1, %edi
movl $0x30, %esi
callq 0x10b0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movb $0x0, %al
callq 0xe5c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rax
movl $0x1, 0x28(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x91a0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xa2d2
leaq 0x6230(%rip), %rdi      # 0x104ee
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa6ae
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), %rax
cmpl $0x26, (%rax)
je 0xa326
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movl -0x54(%rbp), %esi
movq %rax, %rdx
leaq 0x5c1e(%rip), %rdi      # 0xff30
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa6ae
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xa683
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x1, %edi
movl $0x30, %esi
callq 0x10b0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movb $0x0, %al
callq 0xe5c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rax
movl $0x2, 0x28(%rax)
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), %rax
cmpl $0x22, (%rax)
je 0xa429
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xa880
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xa3d3
leaq 0x612f(%rip), %rdi      # 0x104ee
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa6ae
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0xe610
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), %rax
cmpl $0x30, (%rax)
jne 0xa424
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
jmp 0xa393
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xa683
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x1, %edi
movl $0x30, %esi
callq 0x10b0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movb $0x0, %al
callq 0xe5c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rax
movl $0x3, 0x28(%rax)
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), %rax
cmpl $0x3, (%rax)
je 0xa4d4
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movl -0x58(%rbp), %esi
movq %rax, %rdx
leaq 0x5a70(%rip), %rdi      # 0xff30
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa6ae
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1170
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xa683
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x1, %edi
movl $0x30, %esi
callq 0x10b0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movb $0x0, %al
callq 0xe5c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rax
movl $0x4, 0x28(%rax)
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), %rax
cmpl $0x3, (%rax)
je 0xa597
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movl -0x5c(%rbp), %esi
movq %rax, %rdx
leaq 0x59ad(%rip), %rdi      # 0xff30
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa6ae
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1170
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xa683
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x1, %edi
movl $0x30, %esi
callq 0x10b0
movq %rax, -0x38(%rbp)
movb $0x0, %al
callq 0xe5c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movl $0x5, 0x28(%rax)
jmp 0xa683
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl $0x1, %edi
movl $0x30, %esi
callq 0x10b0
movq %rax, -0x38(%rbp)
movb $0x0, %al
callq 0xe5c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movl $0x6, 0x28(%rax)
jmp 0xa683
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movl -0x60(%rbp), %esi
movq %rax, %rdx
leaq 0x58be(%rip), %rdi      # 0xff30
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa6ae
movq -0x38(%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)
jmp 0xa1ba
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)