// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %r12
movl $0x1, %edi
movl $0x18, %esi
callq 0x10c0
movq %rax, %rbx
movl $0x0, (%rax)
movq (%r12), %rax
movslq (%r14), %r15
movq (%rax,%r15,8), %r13
movl (%r13), %edi
leal -0x3(%rdi), %eax
cmpl $0x7, %eax
ja 0x5d7c
leaq 0x4ec7(%rip), %rcx      # 0xaa04
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x7, (%rbx)
movq 0x960d(%rip), %rdi      # 0xf160
movq 0x8(%r13), %rsi
callq 0x8def
movq %rax, 0x10(%rbx)
movl (%r14), %ebp
testq %rax, %rax
je 0x5dc2
incl %ebp
movl %ebp, (%r14)
jmp 0x5e21
movl $0x2, (%rbx)
jmp 0x5da5
movl $0x5, (%rbx)
movl $0x10, %edi
callq 0x1100
movq %rax, %r15
xorl %eax, %eax
callq 0x8b08
movq %r15, 0x8(%rsp)
movq %rax, 0x8(%r15)
movq (%r12), %rbp
movslq (%r14), %r13
movq (%rbp,%r13,8), %rax
movl (%rax), %edi
cmpl $0xa, %edi
jne 0x5dae
leaq 0x1(%r13), %r15
movl %r15d, (%r14)
movq 0x8(%rbp,%r13,8), %rax
movl (%rax), %edi
cmpl $0x3, %edi
jne 0x5de2
leaq 0x2(%r13), %rcx
movl %ecx, (%r14)
movq 0x8(%rax), %rdi
callq 0x1190
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq 0x10(%rbp,%r13,8), %rax
cmpl $0x23, (%rax)
jne 0x5e03
leal 0x3(%r13), %eax
movl %eax, (%r14)
movq 0x18(%rbp,%r13,8), %rax
cmpl $0x24, (%rax)
je 0x5e00
movq %rax, 0x10(%rsp)
movl $0x1, %edi
movl $0x18, %esi
callq 0x10c0
movq %rax, %rbp
xorl %eax, %eax
callq 0x8b08
movq %rax, (%rbp)
movq (%r12), %rax
movslq (%r14), %rsi
movq (%rax,%rsi,8), %r13
movq %r12, %rdi
callq 0x5ac1
testb %al, %al
jne 0x5c4d
cmpl $0xc, (%r13)
jne 0x5ca7
movl (%r14), %esi
movq %r12, %rdi
callq 0x5ac1
testb %al, %al
jne 0x5c63
cmpl $0xc, (%r13)
jne 0x5ca7
movq %r12, %rdi
movq %r14, %rsi
callq 0x5e33
movq %rax, %r15
testq %rax, %rax
je 0x5c8f
movq (%rbp), %rdi
movq %r15, %rsi
callq 0x8b3b
movq (%r12), %rax
movslq (%r14), %rcx
movq (%rax,%rcx,8), %r13
jmp 0x5c9d
leaq 0x531c(%rip), %rdi      # 0xafb2
xorl %eax, %eax
callq 0x8a7c
testq %r15, %r15
jne 0x5c4d
jmp 0x5d33
movq (%r12), %rax
movslq (%r14), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x1a, (%rax)
jne 0x5ccb
movq %r12, %rdi
movq %r14, %rsi
callq 0x5ecb
movq %rax, 0x8(%rbp)
testq %rax, %rax
je 0x5d25
movq (%r12), %r13
movslq (%r14), %r15
movq (%r13,%r15,8), %rax
movl (%rax), %edi
cmpl $0x3, %edi
jne 0x5d0a
movq 0x8(%rax), %rdi
callq 0x1190
movq %rax, 0x10(%rbp)
leaq 0x1(%r15), %rcx
movl %ecx, (%r14)
movq 0x8(%r13,%r15,8), %rax
movl (%rax), %edi
cmpl $0x1f, %edi
jne 0x5d07
addl $0x2, %r15d
movl %r15d, (%r14)
jmp 0x5d35
movq %rcx, %r15
callq 0x8a51
leaq 0x50da(%rip), %rdi      # 0xadf0
movl %r15d, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x8a7c
jmp 0x5d33
leaq 0x52b2(%rip), %rdi      # 0xafde
xorl %eax, %eax
callq 0x8a7c
xorl %ebp, %ebp
testq %rbp, %rbp
je 0x5d58
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
movq %rbp, %rsi
callq 0x8b3b
movq (%r12), %rax
movslq (%r14), %rcx
movq (%rax,%rcx,8), %rax
jmp 0x5d6b
leaq 0x5228(%rip), %rdi      # 0xaf87
xorl %eax, %eax
callq 0x8a7c
movq 0x10(%rsp), %rax
testq %rbp, %rbp
jne 0x5c04
xorl %r14d, %r14d
jmp 0x5e08
callq 0x8a51
leaq 0x5068(%rip), %rdi      # 0xadf0
xorl %ebx, %ebx
movl %r15d, %esi
jmp 0x5dd6
movl $0x1, (%rbx)
jmp 0x5da5
movl $0x3, (%rbx)
jmp 0x5da5
movl $0x4, (%rbx)
leal 0x1(%r15), %eax
movl %eax, (%r14)
jmp 0x5e21
callq 0x8a51
leaq 0x5036(%rip), %rdi      # 0xadf0
xorl %r14d, %r14d
movl %r13d, %esi
jmp 0x5df4
movl (%r13), %edi
callq 0x8a51
leaq 0x501e(%rip), %rdi      # 0xadf0
xorl %ebx, %ebx
movl %ebp, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x8a7c
jmp 0x5e21
callq 0x8a51
leaq 0x5002(%rip), %rdi      # 0xadf0
xorl %r14d, %r14d
movl %r15d, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x8a7c
jmp 0x5e08
incl (%r14)
movq 0x8(%rsp), %r14
movq %r14, 0x8(%rbx)
testq %r14, %r14
jne 0x5e21
leaq 0x513d(%rip), %rdi      # 0xaf55
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x8a7c
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq