// File: /workspace/github_c_makefile_star2_O2/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, %r15
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x10c0
movq %rax, %rbx
movq (%r15), %rax
movslq (%r14), %r12
movq (%rax,%r12,8), %r13
movl (%r13), %edi
leal -0x3(%rdi), %eax
cmpl $0x7, %eax
ja 0x587d
leaq 0x435a(%rip), %rcx      # 0x9a04
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x7, (%rbx)
movq 0x8aa0(%rip), %rdi      # 0xe160
movq 0x8(%r13), %rsi
callq 0x8412
movq %rax, 0x10(%rbx)
movl (%r14), %ebp
testq %rax, %rax
je 0x58c0
incl %ebp
movl %ebp, (%r14)
jmp 0x5909
movl $0x2, (%rbx)
jmp 0x58a6
movl $0x5, (%rbx)
pushq $0x10
popq %rdi
callq 0x1100
movq %rax, %r13
xorl %eax, %eax
callq 0x812e
movq %rax, 0x8(%r13)
movq (%r15), %r12
movslq (%r14), %rbp
movq (%r12,%rbp,8), %rcx
movl (%rcx), %edi
cmpl $0xa, %edi
jne 0x58b0
movq %r13, 0x8(%rsp)
leaq 0x1(%rbp), %r13
movl %r13d, (%r14)
movq 0x8(%r12,%rbp,8), %rdx
movl (%rdx), %edi
cmpl $0x3, %edi
jne 0x58e0
movq %rax, 0x10(%rsp)
leaq 0x2(%rbp), %rcx
movl %ecx, (%r14)
movq 0x8(%rdx), %rdi
callq 0x1190
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq 0x10(%r12,%rbp,8), %rax
cmpl $0x23, (%rax)
jne 0x593e
addl $0x3, %ebp
movl %ebp, (%r14)
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
movslq %ebp, %rax
movq (%r12,%rax,8), %rax
cmpl $0x24, (%rax)
je 0x5939
callq 0x10c0
movq %rax, %rbp
xorl %eax, %eax
callq 0x812e
movq %rax, (%rbp)
movq (%r15), %rax
movslq (%r14), %rsi
movq (%rax,%rsi,8), %r12
movq %r15, %rdi
callq 0x5639
testb %al, %al
jne 0x57b2
cmpl $0xc, (%r12)
jne 0x57f4
movl (%r14), %esi
movq %r15, %rdi
callq 0x5639
testb %al, %al
jne 0x57c8
cmpl $0xc, (%r12)
jne 0x57f4
movq %r15, %rdi
movq %r14, %rsi
callq 0x597a
testq %rax, %rax
je 0x591b
movq (%rbp), %rdi
movq %rax, %rsi
callq 0x8167
movq (%r15), %rax
movslq (%r14), %rsi
movq (%rax,%rsi,8), %r12
jmp 0x57b5
movq (%r15), %r12
movslq (%r14), %r13
movq (%r12,%r13,8), %rax
movl (%rax), %edi
cmpl $0x1a, %edi
jne 0x5829
movq %r15, %rdi
movq %r14, %rsi
callq 0x5a0e
movq %rax, 0x8(%rbp)
testq %rax, %rax
je 0x5971
movq (%r15), %r12
movslq (%r14), %r13
movq (%r12,%r13,8), %rax
movl (%rax), %edi
cmpl $0x3, %edi
jne 0x5944
movq 0x8(%rax), %rdi
callq 0x1190
movq %rax, 0x10(%rbp)
leal 0x1(%r13), %ecx
movl %ecx, (%r14)
movslq %r13d, %rax
movq 0x8(%r12,%rax,8), %rax
movl (%rax), %edi
cmpl $0x1f, %edi
jne 0x5955
addl $0x2, %r13d
movl %r13d, (%r14)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x8167
movq (%r15), %r12
movl (%r14), %ebp
movq 0x8(%rsp), %rcx
jmp 0x576c
callq 0x807a
leaq 0x4567(%rip), %rdi      # 0x9df0
xorl %ebx, %ebx
movl %r12d, %esi
jmp 0x58d4
movl $0x1, (%rbx)
jmp 0x58a6
movl $0x3, (%rbx)
jmp 0x58a6
movl $0x4, (%rbx)
leal 0x1(%r12), %eax
movl %eax, (%r14)
jmp 0x5909
callq 0x807a
leaq 0x4534(%rip), %rdi      # 0x9df0
movl %ebp, %esi
jmp 0x58ef
movl (%r13), %edi
callq 0x807a
leaq 0x4520(%rip), %rdi      # 0x9df0
xorl %ebx, %ebx
movl %ebp, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x80a8
jmp 0x5909
callq 0x807a
leaq 0x4504(%rip), %rdi      # 0x9df0
movl %r13d, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x80a8
leaq 0x4655(%rip), %rdi      # 0x9f55
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x80a8
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4690(%rip), %rdi      # 0x9fb2
xorl %eax, %eax
callq 0x80a8
leaq 0x4657(%rip), %rdi      # 0x9f87
xorl %eax, %eax
callq 0x80a8
jmp 0x58f9
incl %ebp
movl %ebp, (%r14)
movq %rcx, 0x8(%rbx)
jmp 0x5909
callq 0x807a
leaq 0x44a0(%rip), %rdi      # 0x9df0
movl %r13d, %esi
jmp 0x5965
movl %ecx, %ebx
callq 0x807a
leaq 0x448d(%rip), %rdi      # 0x9df0
movl %ebx, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x80a8
jmp 0x5929
leaq 0x4666(%rip), %rdi      # 0x9fde
jmp 0x5922