// File: /workspace/github_c_makefile_star2_O2/MartinNovotny25[P]VUT-FIT-IFJ2020/parser.c
// Function: rule_for_def
void rule_for_def() {
    switch (token.type) {
        case t_IDENTIFIER:
            token = get_next_token(stdin);
            TDLLInsertLast(&tokens, token);
            //kontrola, ci pride inicializacia alebo definicia -- Neviem ci je IBA priradenie hodnoty možné, ak áno, iteračná premenná musí byť definovaná dopredu
            if (token.type != t_DEFINITION_2) {error_call(ERR_SYN, &tokens);}
            else {token = get_next_token(stdin);  TDLLInsertLast(&tokens, token);}

            TDLLInitList(&psa_list);

            while (token.type != T_SEMICOLON) {
                if ((token.type == t_PLUS)
                    || (token.type == t_MINUS)
                    || (token.type == t_DIVIDE)
                    || (token.type == t_MULTIPLY)
                    || (token.type == t_RIGHT_BRACKET)
                    || (token.type == t_LEFT_BRACKET)
                    || (token.type == t_LESS)
                    || (token.type == t_LESSOREQUAL)
                    || (token.type == t_GREATER)
                    || (token.type == t_GREATEROREQUAL)
                    || (token.type == t_EQUAL)
                    || (token.type == t_NOT_EQUAL)
                    || (token.type == t_IDENTIFIER)
                    || (token.type == t_FLOAT)
                    || (token.type == t_INT_NON_ZERO)
                    || (token.type == t_INT_ZERO)
                    || (token.type == t_STRING)) {

                    TDLLInsertLast(&psa_list, token);
                    token = get_next_token(stdin); TDLLInsertLast(&tokens, token);
                    

                } else { error_call(ERR_SYN, &tokens); }
            }

            evaluation(&psa_list, &tokens);
            TDLLDisposeList(&psa_list);
            token = get_next_token(stdin);
            TDLLInsertLast(&tokens, token);
            break;
            // Definicia je vynechaná
        case T_SEMICOLON:
            token = get_next_token(stdin);
            TDLLInsertLast(&tokens, token);
            break;
        default:
            //hocico ine -- ERROR
            error_call(ERR_SYN, &tokens);
    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl 0x9e58(%rip), %eax      # 0xc3e0
cmpl $0x38, %eax
je 0x25f0
cmpl $0x13, %eax
jne 0x2618
movq 0x9a3b(%rip), %r15      # 0xbfd8
movq (%r15), %rdi
callq 0x2dbc
movq %rax, 0x9e2c(%rip)      # 0xc3d8
movl %edx, 0x9e2e(%rip)      # 0xc3e0
leaq 0x9e07(%rip), %rdi      # 0xc3c0
movq %rax, %rsi
callq 0x1345
cmpl $0x32, 0x9e18(%rip)     # 0xc3e0
jne 0x262f
movq (%r15), %rdi
callq 0x2dbc
movq %rax, 0x9dff(%rip)      # 0xc3d8
movl %edx, 0x9e01(%rip)      # 0xc3e0
leaq 0x9dda(%rip), %rdi      # 0xc3c0
movq %rax, %rsi
callq 0x1345
jmp 0x263e
movq 0x99e1(%rip), %rax      # 0xbfd8
movq (%rax), %rdi
callq 0x2dbc
movq %rax, 0x9dd2(%rip)      # 0xc3d8
movl %edx, 0x9dd4(%rip)      # 0xc3e0
leaq 0x9dad(%rip), %rdi      # 0xc3c0
jmp 0x26ef
leaq 0x9da1(%rip), %rsi      # 0xc3c0
pushq $0x2
popq %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3ac4
leaq 0x9d8a(%rip), %rsi      # 0xc3c0
pushq $0x2
popq %rdi
callq 0x3ac4
leaq 0x9da3(%rip), %rbx      # 0xc3e8
movq %rbx, %rdi
callq 0x12d4
leaq 0x9d6c(%rip), %r14      # 0xc3c0
pushq $0x2
popq %rbp
movabsq $0xa03c00b0fc6, %r12    # imm = 0xA03C00B0FC6
movl 0x9d79(%rip), %edx      # 0xc3e0
cmpq $0x38, %rdx
ja 0x26aa
btq %rdx, %r12
jae 0x26a4
movq 0x9d5e(%rip), %rsi      # 0xc3d8
movq %rbx, %rdi
callq 0x1345
movq (%r15), %rdi
callq 0x2dbc
movq %rax, 0x9d47(%rip)      # 0xc3d8
movl %edx, 0x9d49(%rip)      # 0xc3e0
movq %r14, %rdi
movq %rax, %rsi
callq 0x1345
jmp 0x2661
cmpq $0x38, %rdx
je 0x26b6
movl %ebp, %edi
movq %r14, %rsi
callq 0x3ac4
jmp 0x2661
leaq 0x9d2b(%rip), %rbx      # 0xc3e8
leaq 0x9cfc(%rip), %r14      # 0xc3c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7282
movq %rbx, %rdi
callq 0x12e0
movq (%r15), %rdi
callq 0x2dbc
movq %rax, 0x9cf2(%rip)      # 0xc3d8
movl %edx, 0x9cf4(%rip)      # 0xc3e0
movq %r14, %rdi
movq %rax, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1345