// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl 0x9a1f(%rip), %eax      # 0xc3d0
cmpl $0x38, %eax
je 0x2a19
cmpl $0x13, %eax
jne 0x2a41
movq 0x9612(%rip), %r15      # 0xbfd8
movq (%r15), %rdi
callq 0x31f4
movq %rax, 0x99f3(%rip)      # 0xc3c8
movl %edx, 0x99f5(%rip)      # 0xc3d0
leaq 0x99ce(%rip), %rdi      # 0xc3b0
movq %rax, %rsi
callq 0x1722
cmpl $0x32, 0x99df(%rip)     # 0xc3d0
jne 0x2a5d
movq (%r15), %rdi
callq 0x31f4
movq %rax, 0x99c6(%rip)      # 0xc3c8
movl %edx, 0x99c8(%rip)      # 0xc3d0
leaq 0x99a1(%rip), %rdi      # 0xc3b0
movq %rax, %rsi
callq 0x1722
jmp 0x2a6e
movq 0x95b8(%rip), %rax      # 0xbfd8
movq (%rax), %rdi
callq 0x31f4
movq %rax, 0x9999(%rip)      # 0xc3c8
movl %edx, 0x999b(%rip)      # 0xc3d0
leaq 0x9974(%rip), %rdi      # 0xc3b0
jmp 0x2b1f
leaq 0x9968(%rip), %rsi      # 0xc3b0
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x42d0
leaq 0x994c(%rip), %rsi      # 0xc3b0
movl $0x2, %edi
callq 0x42d0
leaq 0x9963(%rip), %rbx      # 0xc3d8
movq %rbx, %rdi
callq 0x16a3
leaq 0x992c(%rip), %r14      # 0xc3b0
movabsq $0xa03c00b0fc6, %r12    # imm = 0xA03C00B0FC6
movl 0x993c(%rip), %edx      # 0xc3d0
cmpq $0x38, %rdx
ja 0x2ad7
btq %rdx, %r12
jae 0x2ad1
movq 0x9921(%rip), %rsi      # 0xc3c8
movq %rbx, %rdi
callq 0x1722
movq (%r15), %rdi
callq 0x31f4
movq %rax, 0x990a(%rip)      # 0xc3c8
movl %edx, 0x990c(%rip)      # 0xc3d0
movq %r14, %rdi
movq %rax, %rsi
callq 0x1722
jmp 0x2a8e
cmpq $0x38, %rdx
je 0x2ae6
movl $0x2, %edi
movq %r14, %rsi
callq 0x42d0
jmp 0x2a8e
leaq 0x98eb(%rip), %rbx      # 0xc3d8
leaq 0x98bc(%rip), %r14      # 0xc3b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7bf8
movq %rbx, %rdi
callq 0x16b2
movq (%r15), %rdi
callq 0x31f4
movq %rax, 0x98b2(%rip)      # 0xc3c8
movl %edx, 0x98b4(%rip)      # 0xc3d0
movq %r14, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1722