// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
subq $0x1f50, %rsp           # imm = 0x1F50
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18f5(%rip), %rsi      # 0x8533
movq %rdx, %rdi
callq 0x1080
testl %eax, %eax
je 0x6d6b
leaq 0x18e5(%rip), %rsi      # 0x853a
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6d6b
leaq 0x18d5(%rip), %rsi      # 0x8541
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6d6b
leaq 0x18c5(%rip), %rsi      # 0x8548
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6d02
leaq 0x18bc(%rip), %rsi      # 0x8552
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6d96
leaq 0x18af(%rip), %rsi      # 0x855c
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6dfc
leaq 0x189c(%rip), %rsi      # 0x8560
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6e36
leaq 0x188c(%rip), %rsi      # 0x8567
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
je 0x6eb2
leaq 0x1879(%rip), %rsi      # 0x856b
movq %r15, %rdi
callq 0x1080
testl %eax, %eax
jne 0x6d89
movq %rbx, %rdi
callq 0x1691
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
leal -0x10(%rcx), %edx
cmpl $0x2, %edx
jb 0x6d89
cmpl $0x18, %ecx
je 0x6d89
cmpl $0x13, %ecx
jne 0x6f0c
movq (%rax), %rax
leaq 0x574f(%rip), %rsi      # 0xc488
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1f4c(%rsp), %rsi
movq %rax, %rdi
callq 0x46d5
testb %al, %al
je 0x7054
cmpl $0x18, 0x1f4c(%rsp)
je 0x6d89
jmp 0x7045
movq %rbx, %rdi
callq 0x1691
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
cmpl $0x7, 0x8(%rax)
jne 0x6f0c
addq $0x1f50, %rsp           # imm = 0x1F50
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x1691
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
cmpl $0x29, %ecx
je 0x6d89
cmpl $0x17, %ecx
je 0x6d89
cmpl $0x13, %ecx
jne 0x6f0c
movq (%rax), %rax
leaq 0x56be(%rip), %rsi      # 0xc488
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1f4c(%rsp), %rsi
movq %rax, %rdi
callq 0x46d5
testb %al, %al
je 0x7054
cmpl $0x17, 0x1f4c(%rsp)
je 0x6d89
jmp 0x7045
movq %rbx, %rdi
callq 0x1691
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
cmpl $0x2b, %ecx
je 0x6d89
cmpl $0x14, %ecx
je 0x6d89
cmpl $0x13, %ecx
jne 0x6f0c
movq (%rax), %rax
jmp 0x7011
movq %rbx, %rdi
callq 0x1691
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rcx
movl 0x8(%rcx), %eax
cmpl $0x13, %eax
je 0x6f2d
cmpl $0x2b, %eax
je 0x6e64
cmpl $0x14, %eax
jne 0x6f0c
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
cmpl $0x5, 0x8(%rax)
je 0x6e8b
movq %r14, %rdi
callq 0x4662
movl $0x4, %edi
movq %rbx, %rsi
callq 0x42d0
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
leal -0x10(%rcx), %edx
cmpl $0x2, %edx
jb 0x6edc
cmpl $0x13, %ecx
je 0x6d2f
cmpl $0x18, %ecx
je 0x6edc
jmp 0x6f0c
movq %rbx, %rdi
callq 0x1691
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rcx
movl 0x8(%rcx), %eax
cmpl $0x13, %eax
je 0x700e
cmpl $0x2b, %eax
je 0x6edc
cmpl $0x14, %eax
jne 0x6f0c
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
cmpl $0x5, 0x8(%rax)
je 0x6d0a
movq %r14, %rdi
callq 0x4662
movl $0x4, %edi
movq %rbx, %rsi
callq 0x42d0
jmp 0x6d0a
movq %r14, %rdi
callq 0x4662
movl $0x4, %edi
movq %rbx, %rsi
addq $0x1f50, %rsp           # imm = 0x1F50
popq %rbx
popq %r14
popq %r15
jmp 0x42d0
movq (%rcx), %rax
leaq 0x5551(%rip), %rsi      # 0xc488
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1f4c(%rsp), %rsi
movq %rax, %rdi
callq 0x46d5
testb %al, %al
je 0x7054
cmpl $0x14, 0x1f4c(%rsp)
jne 0x7045
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
cmpl $0x5, 0x8(%rax)
je 0x6f8f
movq %r14, %rdi
callq 0x4662
movl $0x4, %edi
movq %rbx, %rsi
callq 0x42d0
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
leal -0x10(%rcx), %edx
cmpl $0x2, %edx
jb 0x6fb8
cmpl $0x13, %ecx
je 0x6d2f
cmpl $0x18, %ecx
jne 0x7045
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
cmpl $0x5, 0x8(%rax)
je 0x6fdf
movq %r14, %rdi
callq 0x4662
movl $0x4, %edi
movq %rbx, %rsi
callq 0x42d0
movq %rbx, %rdi
callq 0x1691
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
leal -0x10(%rcx), %edx
cmpl $0x2, %edx
jb 0x6d89
cmpl $0x18, %ecx
je 0x6d89
cmpl $0x13, %ecx
je 0x6d2f
jmp 0x7045
movq (%rcx), %rax
leaq 0x5470(%rip), %rsi      # 0xc488
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x1f4c(%rsp), %rsi
movq %rax, %rdi
callq 0x46d5
testb %al, %al
je 0x7054
cmpl $0x14, 0x1f4c(%rsp)
je 0x6d89
movq %r14, %rdi
callq 0x4662
movl $0x4, %edi
jmp 0x7061
movq %r14, %rdi
callq 0x4662
movl $0x3, %edi
movq %rbx, %rsi
callq 0x42d0
jmp 0x6d89