// File: /workspace/github_c_makefile_star2_O0/MartinNovotny25[P]VUT-FIT-IFJ2020/semantics.c
// Function: for_control
void for_control(TDLList *L, tBSTNodePtrLocal *node, functionData params){   
    TDLLSucc(L);
	// ak je prvy lexem bodkociarka
	if(L->Act->tdata.type == T_SEMICOLON){
		TDLLSucc(L); // chod za bodkociarku (ma byt identifikator alebo vyraz)
		// Skontroluj podmienku
		if_control(L, node, params);

		if(L->Act->tdata.type != T_SEMICOLON){
            error_call(ERR_SEM_OTHER, L);
            BSTDisposeLocal(node);
        } 
        TDLLSucc(L);
        if(!(L->Act->tdata.type == t_BRACES_L)) {assign_vals_control(L, node, params);}
        TDLLPred(L);
	// Ak prvy lexem nie je bodkociarka
	}else if(L->Act->tdata.type == t_IDENTIFIER){
	
		dec_var_control(L, node, params);
	
        TDLLSucc(L);

		if_control(L, node, params);
		
		if(L->Act->tdata.type != T_SEMICOLON){
            error_call(ERR_SEM_OTHER, L);
                BSTDisposeLocal(node);
        } 
		TDLLSucc(L);
		// ak nechyba vyraz skontroluj ho
		if(!(L->Act->tdata.type == t_BRACES_L)) assign_vals_control(L, node, params);
        TDLLPred(L);
	// ak chyba bodkociarka aj deklaracia
	}else
	{
        error_call(ERR_SEM_OTHER, L);
        BSTDisposeLocal(node);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1070, %rsp           # imm = 0x1070
leaq 0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x12e0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x38, 0x8(%rax)
jne 0xa821
movq -0x8(%rbp), %rdi
callq 0x12e0
movq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq %rsp, %rdi
movl $0x201, %ecx            # imm = 0x201
rep  movsq (%rsi), %es:(%rdi)
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdi
callq 0x7de0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x38, 0x8(%rax)
je 0xa7d0
movq -0x8(%rbp), %rsi
movl $0x7, %edi
callq 0x64e0
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rdi
callq 0x12e0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x34, 0x8(%rax)
je 0xa813
movq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq %rsp, %rdi
movl $0x201, %ecx            # imm = 0x201
rep  movsq (%rsi), %es:(%rdi)
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x8810
movq -0x8(%rbp), %rdi
callq 0x1ab0
jmp 0xa920
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x13, 0x8(%rax)
jne 0xa907
movq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movq %rsp, %rdi
movl $0x201, %ecx            # imm = 0x201
rep  movsq (%rsi), %es:(%rdi)
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0x9940
movq -0x8(%rbp), %rdi
callq 0x12e0
movq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %rsp, %rdi
movl $0x201, %ecx            # imm = 0x201
rep  movsq (%rsi), %es:(%rdi)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdi
callq 0x7de0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x38, 0x8(%rax)
je 0xa8b9
movq -0x8(%rbp), %rsi
movl $0x7, %edi
callq 0x64e0
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rdi
callq 0x12e0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x34, 0x8(%rax)
je 0xa8fc
movq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq %rsp, %rdi
movl $0x201, %ecx            # imm = 0x201
rep  movsq (%rsi), %es:(%rdi)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdi
callq 0x8810
movq -0x8(%rbp), %rdi
callq 0x1ab0
jmp 0xa91e
movq -0x8(%rbp), %rsi
movl $0x7, %edi
callq 0x64e0
movq -0x10(%rbp), %rdi
callq 0x6d90
jmp 0xa920
addq $0x1070, %rsp           # imm = 0x1070
popq %rbp
retq
nopl (%rax)