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

    unary_expr_node->type = UN_NONE;

    const Token* token = vec->elements[*index];
    switch (token->type) {
    case TK_INC: {
        unary_expr_node->type = UN_INC;
        ++(*index);

        unary_expr_node->unary_expr_node = create_unary_expr_node(vec, index);
        if (unary_expr_node->unary_expr_node == NULL) {
            error("Failed to create unary-expression node.\n");
            return NULL;
        }

        break;
    }
    case TK_DEC: {
        unary_expr_node->type = UN_DEC;
        ++(*index);

        unary_expr_node->unary_expr_node = create_unary_expr_node(vec, index);
        if (unary_expr_node->unary_expr_node == NULL) {
            error("Failed to create unary-expression node.\n");
            return NULL;
        }

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

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

        token = vec->elements[*index];
        //
        // sizeof ( identifier )
        //
        if (token->type == TK_IDENT &&  !strptrmap_contains(typedef_map, token->str)) {
            unary_expr_node->type        = UN_SIZEOF_IDENT;
            unary_expr_node->sizeof_name = strdup(token->str);
            ++(*index);
        }
        //
        // sizeof ( type-name )
        //
        else {
            unary_expr_node->type = UN_SIZEOF_TYPE;

            unary_expr_node->type_name_node = create_type_name_node(vec, index);
            if (unary_expr_node->type_name_node == NULL) {
                error("Failed to create type-name node.\n");
                return NULL;
            }
        }

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

        break;
    }
    case TK_AMP:   case TK_ASTER:
    case TK_PLUS:  case TK_MINUS:
    case TK_TILDE: case TK_EXCLA: {
        unary_expr_node->type = UN_OP;
        if      (token->type == TK_AMP)   { unary_expr_node->op_type = OP_AND;   }
        else if (token->type == TK_ASTER) { unary_expr_node->op_type = OP_MUL;   }
        else if (token->type == TK_PLUS)  { unary_expr_node->op_type = OP_ADD;   }
        else if (token->type == TK_MINUS) { unary_expr_node->op_type = OP_SUB;   }
        else if (token->type == TK_TILDE) { unary_expr_node->op_type = OP_TILDE; }
        else if (token->type == TK_EXCLA) { unary_expr_node->op_type = OP_EXCLA; }

        ++(*index);

        unary_expr_node->cast_expr_node = create_cast_expr_node(vec, index);
        if (unary_expr_node->cast_expr_node == NULL) {
            error("Failed to create cast-expression node.\n");
            return NULL;
        }

        break;
    }
    default: {
        unary_expr_node->type = UN_NONE;

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

        break;
    }
    }

    return unary_expr_node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x1, %edi
movl $0x30, %esi
callq 0x10b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
addl $-0x17, %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x25, %eax
ja 0xa021
movq -0x30(%rbp), %rax
leaq 0x5e55(%rip), %rcx      # 0xfb5c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
movl $0x1, 0x20(%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9ca0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x9d64
leaq 0x66d1(%rip), %rdi      # 0x10421
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa06f
jmp 0xa067
movq -0x20(%rbp), %rax
movl $0x2, 0x20(%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9ca0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x9dbd
leaq 0x6678(%rip), %rdi      # 0x10421
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa06f
jmp 0xa067
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, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x21, (%rax)
je 0x9e21
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movl -0x34(%rbp), %esi
movq %rax, %rdx
leaq 0x6123(%rip), %rdi      # 0xff30
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa06f
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, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x9e93
movq 0xb336(%rip), %rdi      # 0x15188
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xeae0
testb $0x1, %al
jne 0x9e93
movq -0x20(%rbp), %rax
movl $0x4, 0x20(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1170
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x9ede
movq -0x20(%rbp), %rax
movl $0x5, 0x20(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xa080
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x9edc
leaq 0x6582(%rip), %rdi      # 0x1044a
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa06f
jmp 0x9ede
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x22, (%rax)
je 0x9f32
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movl -0x38(%rbp), %esi
movq %rax, %rdx
leaq 0x6012(%rip), %rdi      # 0xff30
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa06f
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xa067
movq -0x20(%rbp), %rax
movl $0x3, 0x20(%rax)
movq -0x28(%rbp), %rax
cmpl $0x2b, (%rax)
jne 0x9f63
movq -0x20(%rbp), %rax
movl $0xa, 0x24(%rax)
jmp 0x9fd9
movq -0x28(%rbp), %rax
cmpl $0x1a, (%rax)
jne 0x9f79
movq -0x20(%rbp), %rax
movl $0xd, 0x24(%rax)
jmp 0x9fd7
movq -0x28(%rbp), %rax
cmpl $0x18, (%rax)
jne 0x9f8f
movq -0x20(%rbp), %rax
movl $0xb, 0x24(%rax)
jmp 0x9fd5
movq -0x28(%rbp), %rax
cmpl $0x19, (%rax)
jne 0x9fa5
movq -0x20(%rbp), %rax
movl $0xc, 0x24(%rax)
jmp 0x9fd3
movq -0x28(%rbp), %rax
cmpl $0x2d, (%rax)
jne 0x9fbb
movq -0x20(%rbp), %rax
movl $0x10, 0x24(%rax)
jmp 0x9fd1
movq -0x28(%rbp), %rax
cmpl $0x29, (%rax)
jne 0x9fcf
movq -0x20(%rbp), %rax
movl $0x11, 0x24(%rax)
jmp 0x9fd1
jmp 0x9fd3
jmp 0x9fd5
jmp 0x9fd7
jmp 0x9fd9
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9c30
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xa01f
leaq 0x63eb(%rip), %rdi      # 0x103f9
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa06f
jmp 0xa067
movq -0x20(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xa120
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xa065
leaq 0x6418(%rip), %rdi      # 0x1046c
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xa06f
jmp 0xa067
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)