// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %edi
movl $0x18, %esi
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 0x5c1e
leaq 0x3fcd(%rip), %rcx      # 0x9a04
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x7, (%rbx)
movq 0x8713(%rip), %rdi      # 0xe160
movq 0x8(%r13), %rsi
callq 0x8a1e
movq %rax, 0x10(%rbx)
movl (%r14), %ebp
testq %rax, %rax
je 0x5c61
incl %ebp
movl %ebp, (%r14)
jmp 0x5caa
movl $0x2, (%rbx)
jmp 0x5c47
movl $0x5, (%rbx)
movl $0x10, %edi
callq 0x1100
movq %rax, %r13
xorl %eax, %eax
callq 0x8738
movq %rax, 0x8(%r13)
movq (%r15), %r12
movslq (%r14), %rbp
movq (%r12,%rbp,8), %rcx
movl (%rcx), %edi
cmpl $0xa, %edi
jne 0x5c51
movq %r13, (%rsp)
leaq 0x1(%rbp), %r13
movl %r13d, (%r14)
movq 0x8(%r12,%rbp,8), %rdx
movl (%rdx), %edi
cmpl $0x3, %edi
jne 0x5c81
movq %rax, 0x10(%rsp)
leaq 0x2(%rbp), %rcx
movl %ecx, (%r14)
movq 0x8(%rdx), %rdi
callq 0x1190
movq (%rsp), %r13
movq %rax, (%r13)
movq 0x10(%r12,%rbp,8), %rax
cmpl $0x23, (%rax)
jne 0x5cc1
leal 0x3(%rbp), %eax
movl %eax, (%r14)
movq 0x18(%r12,%rbp,8), %rcx
cmpl $0x24, (%rcx)
je 0x5cbc
movl $0x1, %edi
movl $0x18, %esi
callq 0x10c0
movq %rax, %rbp
xorl %eax, %eax
callq 0x8738
movq %rax, (%rbp)
movq (%r15), %rdi
movslq (%r14), %rsi
movq (%rdi,%rsi,8), %r13
callq 0x59c5
testb %al, %al
jne 0x5b3f
cmpl $0xc, (%r13)
jne 0x5b81
movl (%r14), %esi
movq (%r15), %rdi
callq 0x59c5
testb %al, %al
jne 0x5b55
cmpl $0xc, (%r13)
jne 0x5b81
movq %r15, %rdi
movq %r14, %rsi
callq 0x5d1b
testq %rax, %rax
je 0x5cc7
movq (%rbp), %rdi
movq %rax, %rsi
callq 0x876b
movq (%r15), %rdi
movslq (%r14), %rsi
movq (%rdi,%rsi,8), %r13
jmp 0x5b45
movq (%r15), %rcx
movslq (%r14), %r12
movq (%rcx,%r12,8), %rax
movl (%rax), %edi
cmpl $0x1a, %edi
jne 0x5bbc
movq %rcx, %rdi
movq %r14, %rsi
callq 0x5db0
movq %rax, 0x8(%rbp)
testq %rax, %rax
movq (%rsp), %r13
je 0x5d12
movq (%r15), %rcx
movslq (%r14), %r12
movq (%rcx,%r12,8), %rax
movl (%rax), %edi
jmp 0x5bc0
movq (%rsp), %r13
cmpl $0x3, %edi
jne 0x5ce5
movq 0x8(%rax), %rdi
movq %rcx, 0x8(%rsp)
callq 0x1190
movq %rax, 0x10(%rbp)
leal 0x1(%r12), %ecx
movl %ecx, (%r14)
movslq %r12d, %rax
movq 0x8(%rsp), %rdx
movq 0x8(%rdx,%rax,8), %rax
movl (%rax), %edi
cmpl $0x1f, %edi
jne 0x5cf6
addl $0x2, %r12d
movl %r12d, (%r14)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x876b
movq (%r15), %rcx
movslq (%r14), %rax
movq (%rcx,%rax,8), %rcx
jmp 0x5aff
callq 0x8681
leaq 0x41c6(%rip), %rdi      # 0x9df0
xorl %ebx, %ebx
movl %r12d, %esi
jmp 0x5c75
movl $0x1, (%rbx)
jmp 0x5c47
movl $0x3, (%rbx)
jmp 0x5c47
movl $0x4, (%rbx)
leal 0x1(%r12), %eax
movl %eax, (%r14)
jmp 0x5caa
callq 0x8681
leaq 0x4193(%rip), %rdi      # 0x9df0
movl %ebp, %esi
jmp 0x5c90
movl (%r13), %edi
callq 0x8681
leaq 0x417f(%rip), %rdi      # 0x9df0
xorl %ebx, %ebx
movl %ebp, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x86ac
jmp 0x5caa
callq 0x8681
leaq 0x4163(%rip), %rdi      # 0x9df0
movl %r13d, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x86ac
leaq 0x42b4(%rip), %rdi      # 0x9f55
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x86ac
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incl %eax
movl %eax, (%r14)
movq %r13, 0x8(%rbx)
jmp 0x5caa
leaq 0x42e4(%rip), %rdi      # 0x9fb2
xorl %eax, %eax
callq 0x86ac
leaq 0x42ab(%rip), %rdi      # 0x9f87
xorl %eax, %eax
callq 0x86ac
jmp 0x5c9a
callq 0x8681
leaq 0x40ff(%rip), %rdi      # 0x9df0
movl %r12d, %esi
jmp 0x5d06
movl %ecx, %ebx
callq 0x8681
leaq 0x40ec(%rip), %rdi      # 0x9df0
movl %ebx, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x86ac
jmp 0x5cd5
leaq 0x42c5(%rip), %rdi      # 0x9fde
jmp 0x5cce