// File: /workspace/github_c_makefile_star2_O0/MartinNovotny25[P]VUT-FIT-IFJ2020/parser.c
// Function: def_func
void def_func() {
    // terminal ID
    if (token.type != t_IDENTIFIER) { error_call(ERR_SYN, &tokens); }
    else { token = get_next_token(stdin); TDLLInsertLast(&tokens, token); }

    // token (
    if (token.type != t_LEFT_BRACKET) { error_call(ERR_SYN, &tokens); }
    else { token = get_next_token(stdin); TDLLInsertLast(&tokens, token); }

    // neterminal <params> -- Vstupne parametre funkcie
    // Zoznam parametrov moze byt prazdny, preto može ist za lavou zatvorkou hned pravá
    if (token.type != t_IDENTIFIER && token.type != t_RIGHT_BRACKET) { error_call(ERR_SYN, &tokens); }
    else {
        //token = get_next_token(stdin);
        //TDLLInsertLast(&tokens, token);
        rule_params();
    }

    // Nasleduje typy návratového listu a za ním telo -- preto RETLIST_BODY
    if (token.type != t_LEFT_BRACKET && token.type != t_BRACES_L) { error_call(ERR_SYN, &tokens); }
    else {
        rule_func_retlist_body();
    }


    // Ak funckia mala mat return, ale v kode sa nenachadza -- ERROR
    if (was_return == false && is_return == true) {error_call(ERR_SEM_RETURN, &tokens);}

    // nastavime flagy na povodnu hodnotu pre dalsie mozne def_func
    was_return = false;
    is_return = false;

    global_brace_count--;

    // Nepovinne EOLy
    if (token.type == t_EOL)
    {
        rule_eol();
    }

    // Ak sa za def func nenachaza ukoncovacia mnozinova zatvorka
    if (token.type != t_BRACES_R) {error_call(ERR_SYN, &tokens);}
    else {token = get_next_token(stdin); TDLLInsertLast(&tokens, token);}

    //Nepovinne eoly medzi blokmi
    if (token.type == t_EOL)
    {
        between_def = true;
        rule_eol();
        between_def = false;
    }

    //Ak dôjde k dalsej definicii, znova def_func
    if (token.type == t_FUNC)
    {
        token = get_next_token(stdin);
        TDLLInsertLast(&tokens, token);
        def_func();
    }


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
cmpl $0x13, 0xe761(%rip)     # 0x103d0
je 0x1c84
movl $0x2, %edi
leaq 0xe733(%rip), %rsi      # 0x103b0
callq 0x64e0
jmp 0x1cc9
movq 0xe34d(%rip), %rax      # 0xffd8
movq (%rax), %rdi
callq 0x4840
movq %rax, -0x10(%rbp)
movl %edx, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, 0xe723(%rip)      # 0x103c8
movq -0x8(%rbp), %rax
movq %rax, 0xe720(%rip)      # 0x103d0
movq 0xe711(%rip), %rsi      # 0x103c8
movl 0xe713(%rip), %edx      # 0x103d0
leaq 0xe6ec(%rip), %rdi      # 0x103b0
callq 0x1450
cmpl $0x6, 0xe700(%rip)      # 0x103d0
je 0x1ce5
movl $0x2, %edi
leaq 0xe6d2(%rip), %rsi      # 0x103b0
callq 0x64e0
jmp 0x1d2a
movq 0xe2ec(%rip), %rax      # 0xffd8
movq (%rax), %rdi
callq 0x4840
movq %rax, -0x20(%rbp)
movl %edx, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq %rax, 0xe6c2(%rip)      # 0x103c8
movq -0x18(%rbp), %rax
movq %rax, 0xe6bf(%rip)      # 0x103d0
movq 0xe6b0(%rip), %rsi      # 0x103c8
movl 0xe6b2(%rip), %edx      # 0x103d0
leaq 0xe68b(%rip), %rdi      # 0x103b0
callq 0x1450
cmpl $0x13, 0xe69f(%rip)     # 0x103d0
je 0x1d4f
cmpl $0x7, 0xe696(%rip)      # 0x103d0
je 0x1d4f
movl $0x2, %edi
leaq 0xe668(%rip), %rsi      # 0x103b0
callq 0x64e0
jmp 0x1d54
callq 0x3340
cmpl $0x6, 0xe675(%rip)      # 0x103d0
je 0x1d79
cmpl $0x34, 0xe66c(%rip)     # 0x103d0
je 0x1d79
movl $0x2, %edi
leaq 0xe63e(%rip), %rsi      # 0x103b0
callq 0x64e0
jmp 0x1d7e
callq 0x1eb0
movb 0xe626(%rip), %al       # 0x103aa
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x1daf
movb 0xe615(%rip), %al       # 0x103a9
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x1daf
movl $0x6, %edi
leaq 0xe606(%rip), %rsi      # 0x103b0
callq 0x64e0
movb $0x0, 0xe5f4(%rip)      # 0x103aa
movb $0x0, 0xe5ec(%rip)      # 0x103a9
movl 0xe5e9(%rip), %eax      # 0x103ac
addl $-0x1, %eax
movl %eax, 0xe5e0(%rip)      # 0x103ac
cmpl $0x2f, 0xe5fd(%rip)     # 0x103d0
jne 0x1dda
callq 0x43d0
cmpl $0x33, 0xe5ef(%rip)     # 0x103d0
je 0x1df6
movl $0x2, %edi
leaq 0xe5c1(%rip), %rsi      # 0x103b0
callq 0x64e0
jmp 0x1e3b
movq 0xe1db(%rip), %rax      # 0xffd8
movq (%rax), %rdi
callq 0x4840
movq %rax, -0x30(%rbp)
movl %edx, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq %rax, 0xe5b1(%rip)      # 0x103c8
movq -0x28(%rbp), %rax
movq %rax, 0xe5ae(%rip)      # 0x103d0
movq 0xe59f(%rip), %rsi      # 0x103c8
movl 0xe5a1(%rip), %edx      # 0x103d0
leaq 0xe57a(%rip), %rdi      # 0x103b0
callq 0x1450
cmpl $0x2f, 0xe58e(%rip)     # 0x103d0
jne 0x1e57
movb $0x1, 0xe560(%rip)      # 0x103ab
callq 0x43d0
movb $0x0, 0xe554(%rip)      # 0x103ab
cmpl $0x1c, 0xe572(%rip)     # 0x103d0
jne 0x1eaa
movq 0xe171(%rip), %rax      # 0xffd8
movq (%rax), %rdi
callq 0x4840
movq %rax, -0x40(%rbp)
movl %edx, -0x38(%rbp)
movq -0x40(%rbp), %rax
movq %rax, 0xe547(%rip)      # 0x103c8
movq -0x38(%rbp), %rax
movq %rax, 0xe544(%rip)      # 0x103d0
movq 0xe535(%rip), %rsi      # 0x103c8
movl 0xe537(%rip), %edx      # 0x103d0
leaq 0xe510(%rip), %rdi      # 0x103b0
callq 0x1450
callq 0x1c60
addq $0x40, %rsp
popq %rbp
retq