// File: /workspace/github_c_makefile_star2_O1/MartinNovotny25[P]VUT-FIT-IFJ2020/semantics.c
// Function: assign_func_params_control
void assign_func_params_control(TDLList *L,tBSTNodePtrLocal *node, char *func_name){
    int type;
    if(!(strcmp(func_name, "inputs"))){
        TDLLSucc(L);
        TDLLSucc(L);
        if(L->Act->tdata.type != t_RIGHT_BRACKET){
            BSTDisposeLocal(node);
            error_call(ERR_SEM_DATATYPE, L);
        } 
    }else if(!(strcmp(func_name, "inputi"))){
        TDLLSucc(L);
        TDLLSucc(L);
        if(L->Act->tdata.type != t_RIGHT_BRACKET){
            BSTDisposeLocal(node);
            error_call(ERR_SEM_DATATYPE, L);
        } 
    }else if(!(strcmp(func_name, "inputf"))){
        TDLLSucc(L);
        TDLLSucc(L);
        if(L->Act->tdata.type != t_RIGHT_BRACKET){
            BSTDisposeLocal(node);
            error_call(ERR_SEM_DATATYPE, L);
        } 
    }else if(!(strcmp(func_name, "int2float"))){
        TDLLSucc(L);
        TDLLSucc(L);
        if(L->Act->tdata.type == t_INT_NON_ZERO || L->Act->tdata.type == t_INT_ZERO || L->Act->tdata.type == t_INT_ID){

        }else if(L->Act->tdata.type == t_IDENTIFIER){
            if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_UNDEF,L);
            }else{
                if(type == t_INT_ID){}
                else{
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_DATATYPE, L);
                }
            }
        }else{
            BSTDisposeLocal(node);
            error_call(ERR_SEM_DATATYPE, L);
        }
    }else if(!(strcmp(func_name, "float2int"))){
        TDLLSucc(L);
        TDLLSucc(L);
        if(L->Act->tdata.type == t_FLOAT64 || L->Act->tdata.type == t_FLOAT){

        }else if(L->Act->tdata.type == t_IDENTIFIER){
            if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_UNDEF, L);
            }else{
                if(type == t_FLOAT64){}
                else{
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_DATATYPE, L);
                }
            }
        }else{
            BSTDisposeLocal(node);
            error_call(ERR_SEM_DATATYPE, L);
        }
    }else if(!(strcmp(func_name, "len"))){
        TDLLSucc(L);
        TDLLSucc(L);
        if(L->Act->tdata.type == t_STRING_ID || L->Act->tdata.type == t_STRING){

        }else if(L->Act->tdata.type == t_IDENTIFIER){
            if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_UNDEF, L);
            }else{
                if(type == t_STRING_ID){}
                else{
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_DATATYPE, L);
                }
            }
        }else{
            BSTDisposeLocal(node);
            error_call(ERR_SEM_DATATYPE, L);
        }
    }else if(!(strcmp(func_name, "substr"))){
        TDLLSucc(L);
        TDLLSucc(L);
        if(L->Act->tdata.type == t_STRING || L->Act->tdata.type == t_STRING_ID){
            TDLLSucc(L);
            if(L->Act->tdata.type != t_COMMA){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_DATATYPE, L);
            }
            TDLLSucc(L);
            if(L->Act->tdata.type == t_INT_ID || L->Act->tdata.type == t_INT_NON_ZERO || L->Act->tdata.type == t_INT_ZERO){
                TDLLSucc(L);
                if(L->Act->tdata.type != t_COMMA){
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_DATATYPE, L);
                }
                TDLLSucc(L);
                if(L->Act->tdata.type == t_INT_ID || L->Act->tdata.type == t_INT_NON_ZERO || L->Act->tdata.type == t_INT_ZERO){
                
                }else if(L->Act->tdata.type == t_IDENTIFIER){
                    if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                        BSTDisposeLocal(node);
                        error_call(ERR_SEM_UNDEF, L);
                    }else{
                        if(type == t_INT_ID){}
                        else{
                            BSTDisposeLocal(node);
                            error_call(ERR_SEM_DATATYPE, L);
                        }
                    }
                }else{
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_DATATYPE, L);
                }
            }else if(L->Act->tdata.type == t_IDENTIFIER){
                if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_UNDEF, L);
                }else{
                    if(type == t_INT_ID){}
                    else{
                        BSTDisposeLocal(node);
                        error_call(ERR_SEM_DATATYPE, L);
                    }
                }
            }else{
                BSTDisposeLocal(node);
                error_call(ERR_SEM_DATATYPE, L);
            }
        }else if(L->Act->tdata.type == t_IDENTIFIER){
            if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_UNDEF, L);
            }else{
                if(type == t_STRING_ID){
                    TDLLSucc(L);
                    if(L->Act->tdata.type != t_COMMA){
                        BSTDisposeLocal(node);
                        error_call(ERR_SEM_DATATYPE, L);
                    }
                    TDLLSucc(L);
                    if(L->Act->tdata.type == t_INT_ID || L->Act->tdata.type == t_INT_NON_ZERO || L->Act->tdata.type == t_INT_ZERO){
                        TDLLSucc(L);
                        if(L->Act->tdata.type != t_COMMA){
                            BSTDisposeLocal(node);
                            error_call(ERR_SEM_DATATYPE, L);
                        }
                        TDLLSucc(L);
                        if(L->Act->tdata.type == t_INT_ID || L->Act->tdata.type == t_INT_NON_ZERO || L->Act->tdata.type == t_INT_ZERO){
                
                        }else if(L->Act->tdata.type == t_IDENTIFIER){
                            if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                                BSTDisposeLocal(node);
                                error_call(ERR_SEM_UNDEF, L);
                            }else{
                                if(type == t_INT_ID){}
                                else{
                                    BSTDisposeLocal(node);
                                    error_call(ERR_SEM_DATATYPE, L);
                                }
                            }
                        }else{
                            BSTDisposeLocal(node);
                            error_call(ERR_SEM_DATATYPE, L);
                        }
                    }else if(L->Act->tdata.type == t_IDENTIFIER){
                        if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                            BSTDisposeLocal(node);
                            error_call(ERR_SEM_UNDEF, L);
                        }else{
                            if(type == t_INT_ID){}
                            else{
                                BSTDisposeLocal(node);
                                error_call(ERR_SEM_DATATYPE, L);
                            }
                        }
                    }else{
                        BSTDisposeLocal(node);
                        error_call(ERR_SEM_DATATYPE, L);
                    }
                }
                else{
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_DATATYPE,L);
                }
            }
        }else{
            BSTDisposeLocal(node);
            error_call(ERR_SEM_DATATYPE, L);
        }
    }else if(!(strcmp(func_name, "ord"))){
        TDLLSucc(L);
        TDLLSucc(L);
        if(L->Act->tdata.type == t_STRING_ID || L->Act->tdata.type == t_STRING){
            TDLLSucc(L);
            if(L->Act->tdata.type != t_COMMA){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_DATATYPE, L);
            }
            TDLLSucc(L);
            if(L->Act->tdata.type == t_INT_ZERO || L->Act->tdata.type == t_INT_NON_ZERO || L->Act->tdata.type == t_INT_ID){

            }else if(L->Act->tdata.type == t_IDENTIFIER){
            if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_UNDEF, L);
            }else{
                if(type == t_INT_ID){}
                else{
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_DATATYPE, L);
                }
            }
        }else{
                BSTDisposeLocal(node);
                error_call(ERR_SEM_DATATYPE, L);
            }
        }else if(L->Act->tdata.type == t_IDENTIFIER){
            if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_UNDEF, L);
            }else{
                if(type == t_STRING_ID){}
                else{
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_DATATYPE, L);
                }
            }
        }else{
            BSTDisposeLocal(node);
            error_call(ERR_SEM_DATATYPE, L);
        }
    }else if(!(strcmp(func_name, "chr"))){
        TDLLSucc(L);
        TDLLSucc(L);
        if(L->Act->tdata.type == t_INT_ID || L->Act->tdata.type == t_INT_ZERO || L->Act->tdata.type == t_INT_NON_ZERO){

        }else if(L->Act->tdata.type == t_IDENTIFIER){
            if(!(MainStackSearch(mainstack, L->Act->tdata.lex, &type))){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_UNDEF, L);
            }else{
                if(type == t_INT_ID){}
                else{
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_DATATYPE, L);
                }
            }
        }else{
            BSTDisposeLocal(node);
            error_call(ERR_SEM_DATATYPE, L);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1f58, %rsp           # imm = 0x1F58
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18e6(%rip), %rsi      # 0x853b
movq %rdx, %rdi
callq 0x1080
testl %eax, %eax
je 0x6d82
leaq 0x18d6(%rip), %rsi      # 0x8542
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6d82
leaq 0x18c6(%rip), %rsi      # 0x8549
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6d82
leaq 0x18b6(%rip), %rsi      # 0x8550
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6d19
leaq 0x18ad(%rip), %rsi      # 0x855a
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6dc1
leaq 0x18a0(%rip), %rsi      # 0x8564
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6e27
leaq 0x188d(%rip), %rsi      # 0x8568
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6e66
leaq 0x187d(%rip), %rsi      # 0x856f
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6eea
leaq 0x186a(%rip), %rsi      # 0x8573
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
jne 0x6db3
movq %rbx, %rdi
callq 0x1695
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
leal -0x10(%rcx), %edx
cmpl $0x2, %edx
jb 0x6db3
cmpl $0x18, %ecx
je 0x6db3
movl $0x4, %ebp
cmpl $0x13, %ecx
jne 0x6da1
movq (%rax), %rax
leaq 0x5737(%rip), %rsi      # 0xc488
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1f54(%rsp), %rsi
movq %rax, %rdi
callq 0x471e
movl $0x3, %ebp
testb %al, %al
je 0x6da1
cmpl $0x18, 0x1f54(%rsp)
jmp 0x70ad
movq %rbx, %rdi
callq 0x1695
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
movl $0x4, %ebp
cmpl $0x7, 0x8(%rax)
je 0x6db3
movq %r14, %rdi
callq 0x46ab
movl %ebp, %edi
movq %rbx, %rsi
callq 0x42c8
addq $0x1f58, %rsp           # imm = 0x1F58
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x1695
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
cmpl $0x29, %ecx
je 0x6db3
cmpl $0x17, %ecx
je 0x6db3
movl $0x4, %ebp
cmpl $0x13, %ecx
jne 0x6da1
movq (%rax), %rax
leaq 0x5692(%rip), %rsi      # 0xc488
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1f54(%rsp), %rsi
movq %rax, %rdi
callq 0x471e
movl $0x3, %ebp
testb %al, %al
je 0x6da1
cmpl $0x17, 0x1f54(%rsp)
jmp 0x70ad
movq %rbx, %rdi
callq 0x1695
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
cmpl $0x2b, %ecx
je 0x6db3
cmpl $0x14, %ecx
je 0x6db3
movl $0x4, %ebp
cmpl $0x13, %ecx
jne 0x6da1
movq (%rax), %rax
jmp 0x7076
movq %rbx, %rdi
callq 0x1695
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rcx
movl 0x8(%rcx), %eax
movl $0x4, %ebp
cmpl $0x13, %eax
je 0x6f6d
cmpl $0x2b, %eax
je 0x6e99
cmpl $0x14, %eax
jne 0x6da1
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
cmpl $0x5, 0x8(%rax)
je 0x6ec0
movq %r14, %rdi
callq 0x46ab
movl $0x4, %edi
movq %rbx, %rsi
callq 0x42c8
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
leal -0x10(%rcx), %edx
cmpl $0x2, %edx
jb 0x6f1d
cmpl $0x13, %ecx
je 0x6d47
cmpl $0x18, %ecx
je 0x6f1d
jmp 0x6da1
movq %rbx, %rdi
callq 0x1695
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rcx
movl 0x8(%rcx), %eax
movl $0x4, %ebp
cmpl $0x13, %eax
je 0x7073
cmpl $0x2b, %eax
je 0x6f1d
cmpl $0x14, %eax
jne 0x6da1
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
cmpl $0x5, 0x8(%rax)
je 0x6f44
movq %r14, %rdi
callq 0x46ab
movl $0x4, %edi
movq %rbx, %rsi
callq 0x42c8
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
leal -0x10(%rcx), %edx
cmpl $0x2, %edx
jb 0x6db3
cmpl $0x18, %ecx
jne 0x6d42
jmp 0x6db3
movq (%rcx), %rax
leaq 0x5511(%rip), %rsi      # 0xc488
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1f54(%rsp), %rsi
movq %rax, %rdi
callq 0x471e
movl $0x3, %ebp
testb %al, %al
je 0x6da1
cmpl $0x14, 0x1f54(%rsp)
jne 0x70bd
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
cmpl $0x5, 0x8(%rax)
je 0x6fd4
movq %r14, %rdi
callq 0x46ab
movl $0x4, %edi
movq %rbx, %rsi
callq 0x42c8
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
leal -0x10(%rcx), %edx
cmpl $0x2, %edx
jb 0x6ff9
cmpl $0x13, %ecx
je 0x7049
cmpl $0x18, %ecx
jne 0x70bd
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
cmpl $0x5, 0x8(%rax)
je 0x7020
movq %r14, %rdi
callq 0x46ab
movl $0x4, %edi
movq %rbx, %rsi
callq 0x42c8
movq %rbx, %rdi
callq 0x1695
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
leal -0x10(%rcx), %edx
cmpl $0x2, %edx
jb 0x6db3
cmpl $0x18, %ecx
je 0x6db3
cmpl $0x13, %ecx
jne 0x70bd
movq (%rax), %rax
leaq 0x5435(%rip), %rsi      # 0xc488
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1f54(%rsp), %rsi
movq %rax, %rdi
callq 0x471e
jmp 0x6d71
movq (%rcx), %rax
leaq 0x540b(%rip), %rsi      # 0xc488
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1f54(%rsp), %rsi
movq %rax, %rdi
callq 0x471e
movl $0x3, %ebp
testb %al, %al
je 0x6da1
cmpl $0x14, 0x1f54(%rsp)
movl $0x4, %ebp
jne 0x6da1
jmp 0x6db3
movl $0x4, %ebp
jmp 0x6da1