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

    itr_stmt_node->declaration_nodes = create_vector();
    
    const Token* token = vec->elements[*index];
    switch (token->type) {
    case TK_WHILE: {
        itr_stmt_node->itr_type = ITR_WHILE;
        ++(*index);

        // '('
        token = vec->elements[*index];
        if (token->type != TK_LPAREN) {
            error("Invalid token[%d]=\"%s\".\n", *index, decode_token_type(token->type));
            return NULL;
        }
        ++(*index);

        // expression
        itr_stmt_node->expr_node_0 = create_expr_node(vec, index);
        if (itr_stmt_node->expr_node_0 == NULL) {
            error("Failed to create expression-node.\n");
            return NULL;
        }

        // ')'
        token = vec->elements[*index];
        if (token->type != TK_RPAREN) {
            error("Invalid token type=\"%s\"\n", decode_token_type(token->type));
            return NULL;
        }
        ++(*index);

        // statement
        itr_stmt_node->stmt_node = create_stmt_node(vec, index); 
        if (itr_stmt_node->stmt_node == NULL) {
            error("Failed to create statement-node.\n");
            return NULL;
        }

        break;
    }
    case TK_FOR: {
        itr_stmt_node->itr_type = ITR_FOR;
        ++(*index);

        // '('
        token = vec->elements[*index];
        if (token->type != TK_LPAREN) {
            error("Invalid token type=\"%s\"\n", decode_token_type(token->type));
            return NULL;
        }
        ++(*index);

        token = vec->elements[*index];
        if (token->type == TK_SEMICOL) {
            ++(*index);
        } 
        // {declaration}* ;
        else if (is_declaration_specifier(vec, *index)) {
            while (is_declaration_specifier(vec, *index)) {
                DeclarationNode* declaration_node = create_declaration_node(vec, index);
                if (declaration_node == NULL) {
                    error("Failed to create declaration-node.\n");
                    return NULL;
                }
                vector_push_back(itr_stmt_node->declaration_nodes, declaration_node);
            }
        } 
        // {expression}? ;
        else {
            itr_stmt_node->expr_node_0 = create_expr_node(vec, index);
            if (itr_stmt_node->expr_node_0 == NULL) {
                error("Failed to create expression-node.\n");
                return NULL;
            }

            // ';'
            token = vec->elements[*index];
            if (token->type != TK_SEMICOL) {
                error("Invalid token type=\"%s\"\n", decode_token_type(token->type));
                return NULL;
            }
            ++(*index);
        }

        // {expression}? ;
        token = vec->elements[*index];
        if (token->type == TK_SEMICOL) {
            ++(*index);
        } else {
            itr_stmt_node->expr_node_1 = create_expr_node(vec, index);
            if (itr_stmt_node->expr_node_1 == NULL) {
                error("Failed to create expression-node.\n");
                return NULL;
            }

            // ';'
            token = vec->elements[*index];
            if (token->type != TK_SEMICOL) {
                error("Invalid token type=\"%s\"\n", decode_token_type(token->type));
                return NULL;
            }
            ++(*index);
        }

        // {expression}? )
        token = vec->elements[*index];
        if (token->type == TK_RPAREN) {
            ++(*index);
        } else {
            itr_stmt_node->expr_node_2 = create_expr_node(vec, index);
            if (itr_stmt_node->expr_node_2 == NULL) {
                error("Failed to create expression-node.\n");
                return NULL;
            }

            // ')'
            token = vec->elements[*index];
            if (token->type != TK_RPAREN) {
                error("Invalid token type=\"%s\"\n", decode_token_type(token->type));
                return NULL;
            }
            ++(*index);
        }

        // statement
        itr_stmt_node->stmt_node = create_stmt_node(vec, index); 
        if (itr_stmt_node->stmt_node == NULL) {
            error("Failed to create statement-node.\n");
            return NULL;
        }

        break;
    }
    default: {
        break;
    }
    }

    return itr_stmt_node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x1, %edi
movl $0x30, %esi
callq 0x10b0
movq %rax, -0x20(%rbp)
xorl %eax, %eax
callq 0xe5c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%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
movl %eax, -0x34(%rbp)
subl $0xf, %eax
je 0xb535
jmp 0xb3df
movl -0x34(%rbp), %eax
subl $0x10, %eax
jne 0xb890
jmp 0xb3ed
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
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)
movq -0x28(%rbp), %rax
cmpl $0x21, (%rax)
je 0xb456
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 0x4aee(%rip), %rdi      # 0xff30
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x91a0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xb49f
leaq 0x50b2(%rip), %rdi      # 0x1053d
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
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 $0x22, (%rax)
je 0xb4e7
movq -0x28(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movq %rax, %rsi
leaq 0x52bf(%rip), %rdi      # 0x10792
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xaf30
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xb530
leaq 0x528f(%rip), %rdi      # 0x107ab
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
jmp 0xb892
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
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)
movq -0x28(%rbp), %rax
cmpl $0x21, (%rax)
je 0xb592
movq -0x28(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movq %rax, %rsi
leaq 0x5214(%rip), %rdi      # 0x10792
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
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)
movq -0x28(%rbp), %rax
cmpl $0x1f, (%rax)
jne 0xb5cc
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xb6d6
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
callq 0x7eb0
testb $0x1, %al
jne 0xb5e1
jmp 0xb643
jmp 0xb5e3
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
callq 0x7eb0
testb $0x1, %al
jne 0xb5f8
jmp 0xb63e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x7bf0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xb62b
leaq 0x51b6(%rip), %rdi      # 0x107cd
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0xe610
jmp 0xb5e3
jmp 0xb6d4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x91a0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xb681
leaq 0x4ed0(%rip), %rdi      # 0x1053d
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
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 0xb6c9
movq -0x28(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movq %rax, %rsi
leaq 0x50dd(%rip), %rdi      # 0x10792
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xb6d6
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)
jne 0xb705
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xb796
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x91a0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0xb743
leaq 0x4e0e(%rip), %rdi      # 0x1053d
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
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 0xb78b
movq -0x28(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movq %rax, %rsi
leaq 0x501b(%rip), %rdi      # 0x10792
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
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)
movq -0x28(%rbp), %rax
cmpl $0x22, (%rax)
jne 0xb7c5
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xb853
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x91a0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xb803
leaq 0x4d4e(%rip), %rdi      # 0x1053d
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
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 $0x22, (%rax)
je 0xb848
movq -0x28(%rbp), %rax
movl (%rax), %edi
callq 0xe050
movq %rax, %rsi
leaq 0x4f5b(%rip), %rdi      # 0x10792
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xaf30
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xb88e
leaq 0x4f2e(%rip), %rdi      # 0x107ab
movb $0x0, %al
callq 0xe4e0
movq $0x0, -0x8(%rbp)
jmp 0xb89a
jmp 0xb892
jmp 0xb892
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)