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

    type_specifier_node->type_specifier = TYPE_NONE;

    const Token* token = vec->elements[*index];
    switch (token->type) {
    case TK_VOID:   { type_specifier_node->type_specifier = TYPE_VOID;   ++(*index); break; }
    case TK_CHAR:   { type_specifier_node->type_specifier = TYPE_CHAR;   ++(*index); break; }
    case TK_INT:    { type_specifier_node->type_specifier = TYPE_INT;    ++(*index); break; }
    case TK_DOUBLE: { type_specifier_node->type_specifier = TYPE_DOUBLE; ++(*index); break; }
    case TK_STRUCT: {
        type_specifier_node->type_specifier = TYPE_STRUCT;
        type_specifier_node->struct_specifier_node = create_struct_specifier_node(vec, index);
        if (type_specifier_node->struct_specifier_node == NULL) {
            error("Failed to create struct-or-union-specifier node.\n");
            return NULL;
        }
        break; 
    } 
    case TK_IDENT: { 
        type_specifier_node->type_specifier = TYPE_TYPEDEFNAME;
        type_specifier_node->struct_name = strptrmap_get(typedef_map, token->str);
        if (type_specifier_node->struct_name == NULL) {
            error("Invalid token[%d]=\"%s\".\n", *index, decode_token_type(token->type));
            return NULL;
        }
        ++(*index);

        break;
    }
    default: {
        error("Invalid token[%d]=\"%s\".\n", *index, decode_token_type(token->type));
        return NULL;
    }
    }

    return type_specifier_node;
}

// 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), %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 $-0x3, %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x7, %eax
ja 0x83f7
movq -0x30(%rbp), %rax
leaq 0x7876(%rip), %rcx      # 0xfb3c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x8429
movq -0x20(%rbp), %rax
movl $0x2, (%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x8429
movq -0x20(%rbp), %rax
movl $0x3, (%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x8429
movq -0x20(%rbp), %rax
movl $0x4, (%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x8429
movq -0x20(%rbp), %rax
movl $0x5, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x8440
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x837f
leaq 0x7d2a(%rip), %rdi      # 0x10095
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x8431
jmp 0x8429
movq -0x20(%rbp), %rax
movl $0x7, (%rax)
movq 0xcdf3(%rip), %rdi      # 0x15188
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xeb80
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x83ea
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 0x7b57(%rip), %rdi      # 0xff30
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x8431
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x8429
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 0x7b18(%rip), %rdi      # 0xff30
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x8431
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)