// File: /workspace/github_c_makefile_star2_O0/chgzm[P]minic/parser.c
// Function: create_declaration_node
static DeclarationNode* create_declaration_node(const Vector* vec, int* index) {
    DeclarationNode* declaration_node = malloc(sizeof(DeclarationNode));

    declaration_node->decl_specifier_nodes  = create_vector();
    declaration_node->init_declarator_nodes = create_vector();

    const Token* token = vec->elements[*index];
    while (is_declaration_specifier(vec, *index) && token->type != TK_SEMICOL) {
        DeclSpecifierNode* decl_specifier_node = create_decl_specifier_node(vec, index);
        if (decl_specifier_node == NULL) {
            error("Failed to create declaration-specifier node.\n");
            return NULL;
        }

        vector_push_back(declaration_node->decl_specifier_nodes, decl_specifier_node);
    }

    token = vec->elements[*index];
    while (token->type != TK_SEMICOL) {
        InitDeclaratorNode* init_declarator_node = create_init_declarator_node(vec, index);
        if (init_declarator_node == NULL) {
            error("Failed to create init-declarator node.\n");
            return NULL;
        }

        vector_push_back(declaration_node->init_declarator_nodes, init_declarator_node);

        token = vec->elements[*index];
        if (token->type == TK_COMMA) {
            ++(*index);
            token = vec->elements[*index];
        } 
    }
    ++(*index);

    return declaration_node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x10, %edi
callq 0x10f0
movq %rax, -0x20(%rbp)
movb $0x0, %al
callq 0xe5c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movb $0x0, %al
callq 0xe5c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%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 -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
callq 0x7eb0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x39(%rbp)
jne 0x7c64
jmp 0x7c71
movq -0x28(%rbp), %rax
cmpl $0x1f, (%rax)
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x7c7a
jmp 0x7cbf
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x7f20
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x7cad
leaq 0x835a(%rip), %rdi      # 0xfff3
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x7d7b
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0xe610
jmp 0x7c47
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 $0x1f, (%rax)
je 0x7d68
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xc000
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x7d12
leaq 0x8af0(%rip), %rdi      # 0x107f1
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0x7d7b
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0xe610
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 $0x30, (%rax)
jne 0x7d63
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)
jmp 0x7cd5
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)