// File: /workspace/github_c_makefile_star2_O3/MartinNovotny25[P]VUT-FIT-IFJ2020/semantics.c
// Function: assign_vals_control
void assign_vals_control(TDLList *L, tBSTNodePtrLocal *node, functionData params){

    if(L->Act->rptr->tdata.type == t_EOL){
        error_call(ERR_SEM_OTHER, L);
    }
  
    char *id[MAXPARAMS];
    // na ukladanie typov
    int type[MAXPARAMS];
    int types_of_defined_vars[MAXPARAMS];
    // zbytocna premenna
    char *data = "null";
    // pocet stringov
    int string_count = 0;
    // pocet cisel
    int int_count = 0;
    // pocet floatov
    int float_count = 0;
    // pocet identifikatorov
    int identifier = 0;
    // id na ukladanie premennych v spravnom poradi
    int id_insert = 0;
    int is_function = 0;
    int underscore_found = 0;

    // Pocet premennych nalavo od =
    // po ukonceni cyklu bude L->act ukazovat na =
   
    while(L->Act->tdata.type != t_ASSIGN){
        if(L->Act->tdata.type == t_IDENTIFIER){

            id[identifier] = L->Act->tdata.lex;
            if(MainStackSearch(mainstack, id[identifier], &types_of_defined_vars[identifier])){
                    // premenna bola najdena v ramci a while bol hned zastaveny
                    // stack sa prehladava zhora dole
                if(!(strcmp(id[identifier], "_"))){
                    types_of_defined_vars[identifier] = 404;
                    underscore_found = 1;
                }
                //identifier++;
                //break;
            }else{
                BSTDisposeLocal(node);
                error_call(ERR_SEM_UNDEF, L);
            }
            identifier++;
        }
        TDLLSucc(L);
    }
    // pocet identifikatorov napravo od =
    //int identif_count = 0;
    // pocet ciarok napravo od =
    int comma_count = 0;
    // prechadzaj pokym neprejdeme na koniec riadku
    while(L->Act->tdata.type!= t_EOL){
            if(L->Act->tdata.type == t_GREATER){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_EXCOMPAT, L);
            }else if(L->Act->tdata.type == t_GREATEROREQUAL){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_EXCOMPAT, L);
            }else if(L->Act->tdata.type == t_LESS){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_EXCOMPAT, L);
            }else if(L->Act->tdata.type == t_LESSOREQUAL){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_EXCOMPAT, L);
            }else if(L->Act->tdata.type == t_EQUAL){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_EXCOMPAT, L);
            }else if(L->Act->tdata.type == t_NOT_EQUAL){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_EXCOMPAT, L);
            }

            if(!(strcmp(L->Act->tdata.lex, "/"))){
                if(L->Act->rptr->tdata.type == t_INT_ZERO){
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_ZERODIV, L);
                }
            }

            if(!(strcmp(L->Act->tdata.lex, "_"))){
                BSTDisposeLocal(node);
                error_call(ERR_SEM_UNDEF, L);
            }
           

            if(L->Act->tdata.type == t_INT_NON_ZERO || L->Act->tdata.type == t_INT_ZERO){
                type[id_insert] = t_INT_ID;
                int_count++;
                id_insert++;
            // ak ide o float
            }else if(L->Act->tdata.type == t_FLOAT64 || L->Act->tdata.type == t_FLOAT){
                if(!(strcmp(L->Act->tdata.lex, "0.0"))){
                    if(!(strcmp(L->Act->lptr->tdata.lex, "/"))){
                        BSTDisposeLocal(node);
                        error_call(ERR_SEM_ZERODIV, L);
                    }
                }
                type[id_insert] = t_FLOAT64;
                float_count++;
                id_insert++;
            // ak ide o string
            }else if(L->Act->tdata.type == t_STRING){
                if(L->Act->rptr->tdata.type == t_MINUS || L->Act->rptr->tdata.type == t_DIVIDE || L->Act->rptr->tdata.type == t_MULTIPLY){
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_EXCOMPAT, L);
                }
                
                type[id_insert] = t_STRING_ID;
                string_count++;
                id_insert++;
            // ak ide o premennu
            }else if(L->Act->tdata.type == t_IDENTIFIER){
                int datovytyp;
                char *name = L->Act->tdata.lex;
                functionData returned_data;
                if(!(strcmp(L->Act->tdata.lex, "_"))){
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_UNDEF, L);
                }
           
                if(!(strcmp(L->Act->tdata.lex, "inputs"))){
                    assign_func_params_control(L, node, "inputs");
                    if(identifier != 2) error_call(ERR_SEM_RETURN, L);
                   if(types_of_defined_vars[0] == t_STRING_ID && (types_of_defined_vars[1] == t_INT_ID || types_of_defined_vars[1] == 404)){
                       is_function++;
                   }else{
                       BSTDisposeLocal(node);
                       error_call(ERR_SEM_EXCOMPAT, L);
                   }
                }else if(!(strcmp(L->Act->tdata.lex, "inputi"))){
                    assign_func_params_control(L, node, "inputi");
                    if(identifier != 2) error_call(ERR_SEM_RETURN, L);
                    if(types_of_defined_vars[0] == t_INT_ID && (types_of_defined_vars[1] == t_INT_ID || types_of_defined_vars[1] == 404)){
                       is_function++;
                    }else{
                       BSTDisposeLocal(node);
                       error_call(ERR_SEM_EXCOMPAT, L);
                    }
                }else if(!(strcmp(L->Act->tdata.lex, "inputf"))){
                    assign_func_params_control(L, node, "inputf");
                    if(identifier != 2) error_call(ERR_SEM_RETURN, L);
                    if(types_of_defined_vars[0] == t_FLOAT64 && (types_of_defined_vars[1] == t_INT_ID || types_of_defined_vars[1] == 404)){
                        is_function++;
                    }else{
                       BSTDisposeLocal(node);
                       error_call(ERR_SEM_EXCOMPAT, L);
                    }
                }else if(!(strcmp(L->Act->tdata.lex, "int2float"))){
                    assign_func_params_control(L, node, "int2float");
                    if(identifier != 1) error_call(ERR_SEM_RETURN, L);
                    if(types_of_defined_vars[0] != t_FLOAT64){
                        if(types_of_defined_vars[1] != 404){
                            BSTDisposeLocal(node);
                            error_call(ERR_SEM_EXCOMPAT, L);
                        }
                    }
                    is_function++;
                }else if(!(strcmp(L->Act->tdata.lex, "float2int"))){
                    assign_func_params_control(L, node, "float2int");
                    if(identifier != 1) error_call(ERR_SEM_RETURN, L);
                    if(types_of_defined_vars[0] != t_INT_ID ){
                        if(types_of_defined_vars[1] != 404){
                            BSTDisposeLocal(node);
                            error_call(ERR_SEM_EXCOMPAT, L);
                        }
                    }
                    is_function++;
                }else if(!(strcmp(L->Act->tdata.lex, "len"))){
                    assign_func_params_control(L, node, "len");
                    if(identifier != 1) error_call(ERR_SEM_RETURN, L);
                    if(types_of_defined_vars[0] != t_INT_ID ){
                        if( types_of_defined_vars[1] != 404){
                            BSTDisposeLocal(node);
                            error_call(ERR_SEM_EXCOMPAT, L);
                        }
                    }
                    is_function++;
                }else if(!(strcmp(L->Act->tdata.lex, "substr"))){
                    assign_func_params_control(L, node, "substr");
                    if(identifier != 2) error_call(ERR_SEM_RETURN, L);
                    if(types_of_defined_vars[0] == t_STRING_ID && (types_of_defined_vars[1] == t_INT_ID || types_of_defined_vars[1] == 404)){
                         is_function++;
                    }else{
                       BSTDisposeLocal(node);
                       error_call(ERR_SEM_EXCOMPAT, L);
                    }
                }else if(!(strcmp(L->Act->tdata.lex, "ord"))){
                    assign_func_params_control(L, node, "ord");
                    if(identifier != 2) error_call(ERR_SEM_RETURN, L);
                    if(types_of_defined_vars[0] == t_INT_ID && (types_of_defined_vars[1] == t_INT_ID || types_of_defined_vars[1] == 404)){
                        is_function++;
                    }else{
                       BSTDisposeLocal(node);
                       error_call(ERR_SEM_EXCOMPAT, L);
                    }
                }else if(!(strcmp(L->Act->tdata.lex, "chr"))){
                    assign_func_params_control(L, node, "chr");
                    if(identifier != 2) error_call(ERR_SEM_RETURN, L);
                    if(types_of_defined_vars[0] == t_STRING_ID && (types_of_defined_vars[1] == t_INT_ID || types_of_defined_vars[1] == 404)){
                        is_function++;
                    }else{
                       BSTDisposeLocal(node);
                       error_call(ERR_SEM_EXCOMPAT, L);
                    }
                }else if(!(strcmp(L->Act->tdata.lex, "print"))){
                    BSTDisposeLocal(node);
                    error_call(ERR_SEM_EXCOMPAT, L);

                }else if(BSTSearchGlobal(functions, L->Act->tdata.lex, &returned_data)){
                    if(L->Act->rptr->tdata.type == t_LEFT_BRACKET){
                    checkCallFunction(L, L->Act->tdata.lex, node);
                    if(identifier != returned_data.numOfReturns) error_call(ERR_SEM_RETURN, L);
                    else{
                        int i = 0;
                        while(returned_data.numOfReturns != i){
                            type[i] = returned_data.returns[i];
                            i++;
                        }

                        for(int i = 0; i < identifier; i++){
                            if(types_of_defined_vars[i] != type[i]){
                                if(!(strcmp(id[i], "_"))){

                                }else{
                                    BSTDisposeLocal(node);
                                     error_call(ERR_SEM_EXCOMPAT, L);
                                }
                            }else{
                                is_function++;
                                break;
                            }
                        }
                    }
                    }
                }else if(MainStackSearch(mainstack, name, &datovytyp)) {
                     type[id_insert] = datovytyp;
                            if(datovytyp == t_INT_ID){
                                int_count++;
                                id_insert++;
                            }else if(datovytyp == t_FLOAT64){
                                float_count++;
                                id_insert++;
                            }else if(datovytyp == t_STRING_ID){
                                if(L->Act->rptr->tdata.type == t_MINUS || L->Act->rptr->tdata.type == t_DIVIDE || L->Act->rptr->tdata.type == t_MULTIPLY){
                                    BSTDisposeLocal(node);
                                    error_call(ERR_SEM_EXCOMPAT, L);
                                }
                                string_count++;
                                id_insert++;
                            }
                        }else{
                            error_call(ERR_SEM_UNDEF, L);
                            BSTDisposeLocal(node);
                        }
                // ak premenna napravo od =
                // nebola najdena v glob.strome ani v lok.ramci najnizsej urovni
                // potom musime prehladat vyssie ramce
                }else{
                      
                }
            // ak nejde o cislo, string, float alebo premennu
            
            

            if(L->Act->tdata.type == T_SEMICOLON) break;
            // Ak najdes ciarku tzv, chce sa deklarovat viac premennych naraz chyba
              
            // ak sme prisli na ciarku alebo koniec riadku
            if(L->Act->tdata.type == t_COMMA || L->Act->rptr->tdata.type == t_EOL || L->Act->tdata.type == t_BRACES_L){
                // ak vo vyraze boli len stringy
                if(string_count != 0 && int_count == 0 && float_count == 0){
                    
                    // je premenna do ktorej chceme ulozit hodnotu deklarovana?
                    if(types_of_defined_vars[comma_count] == t_STRING_ID || types_of_defined_vars[comma_count] == 404){
                        BSTInsertLocal(node, id[comma_count], type, data);
                        id_insert++;
                        string_count = 0;
                        int_count = 0;
                        float_count = 0;
                    }else{
                        if(types_of_defined_vars[comma_count] != t_INT_ID ){
                            if(types_of_defined_vars[comma_count] != t_STRING_ID){
                                if(types_of_defined_vars[comma_count] != t_FLOAT64){
                                    error_call(ERR_SEM_OTHER, L);
                                }else{
                                    error_call(ERR_SEM_EXCOMPAT, L);
                                }
                            }else{
                                error_call(ERR_SEM_EXCOMPAT, L);
                            }
                        }else{
                            error_call(ERR_SEM_EXCOMPAT, L);
                        }
                    }
                
                    // ak vo vyraze boli len cisla
                }else if(string_count == 0 && int_count != 0 && float_count == 0){
                    
                    // je premenna do ktorej chceme ulozit hodnotu deklarovana?
                    
                    if(types_of_defined_vars[comma_count] == t_INT_ID || types_of_defined_vars[comma_count] == 404){
                        //BSTInsertLocal(node, id[comma_count], types_of_defined_vars[comma_count], data);
                        id_insert++;
                        string_count = 0;
                        int_count = 0;
                        float_count = 0;
                    }else{
                        if(types_of_defined_vars[comma_count] != t_INT_ID ){
                            if(types_of_defined_vars[comma_count] != t_STRING_ID){
                                if(types_of_defined_vars[comma_count] != t_FLOAT64){
                                    error_call(ERR_SEM_OTHER, L);
                                }else{
                                    error_call(ERR_SEM_EXCOMPAT, L);
                                }
                            }else{
                                error_call(ERR_SEM_EXCOMPAT, L);
                            }
                        }else{
                            error_call(ERR_SEM_EXCOMPAT, L);
                        }
                        
                    }

                // ak vo vyraze boli len floaty
                }else if(string_count == 0 && int_count == 0 && float_count != 0){
                    
                    // je premenna do ktorej chceme ulozit hodnotu deklarovana?
                    
                    if(types_of_defined_vars[comma_count] == t_FLOAT64 || types_of_defined_vars[comma_count] == 404){
                        BSTInsertLocal(node, id[comma_count], type, data);
                        id_insert++;
                        string_count = 0;
                        int_count = 0;
                        float_count = 0;
                    }else{
                        if(types_of_defined_vars[comma_count] != t_INT_ID ){
                            if(types_of_defined_vars[comma_count] != t_STRING_ID){
                                if(types_of_defined_vars[comma_count] != t_FLOAT64){
                                    error_call(ERR_SEM_OTHER, L);
                                }else{
                                    error_call(ERR_SEM_EXCOMPAT, L);
                                }
                            }else{
                                error_call(ERR_SEM_EXCOMPAT, L);
                            }
                        }else{
                            error_call(ERR_SEM_EXCOMPAT, L);
                        }
                    }
                }else if(underscore_found == 1){
                    id_insert++;
                    string_count = 0;
                    int_count = 0;
                    float_count = 0;
                }else if(string_count == 0 && int_count == 0 && float_count == 0){
                    
                }else{
                    error_call(ERR_SEM_EXCOMPAT, L);
                }
                comma_count++;
            }
        TDLLSucc(L);
    }
    // Ak je pocet premennych do ktorych sa ma priradovat ako hodnot rozdielny
    if(is_function == 0){
        if(identifier != comma_count){
            error_call(ERR_SEM_OTHER, L);
            BSTDisposeLocal(node);
        }
    }
    //TDLLPred(L);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f98, %rsp           # imm = 0x3F98
movq %rsi, 0x1f58(%rsp)
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq 0x18(%rax), %rax
cmpl $0x2f, 0x8(%rax)
jne 0x55fd
movl $0x7, %edi
movq %r14, %rsi
callq 0x42d0
xorl %ebx, %ebx
leaq 0x6e82(%rip), %r15      # 0xc488
movl $0x0, 0x1f78(%rsp)
movq 0x8(%r14), %rax
movl 0x8(%rax), %ecx
cmpl $0x13, %ecx
je 0x5627
cmpl $0x3, %ecx
jne 0x569c
jmp 0x56a9
movq (%rax), %r13
movslq %ebx, %rax
movq %r13, 0x2790(%rsp,%rax,8)
leaq (%rsp,%rax,4), %r12
addq $0x1f90, %r12           # imm = 0x1F90
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r13, %rdi
movq %r12, %rsi
callq 0x46d5
testb %al, %al
je 0x5680
cmpb $0x5f, (%r13)
jne 0x569a
cmpb $0x0, 0x1(%r13)
jne 0x569a
movl $0x194, (%r12)          # imm = 0x194
movl $0x1, 0x1f78(%rsp)
jmp 0x569a
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x3, %edi
movq %r14, %rsi
callq 0x42d0
incl %ebx
movq %r14, %rdi
callq 0x1691
jmp 0x5611
movl %ebx, 0x1f70(%rsp)
movl %ebx, %eax
movq %rax, 0x1f88(%rsp)
leaq (,%rax,4), %rax
movq %rax, 0x1f80(%rsp)
xorl %ebx, %ebx
movl $0x3, %eax
xorl %edx, %edx
xorl %r15d, %r15d
movl $0x0, 0x1f6c(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
cmpl $0x2f, %eax
movl %edx, 0x1f54(%rsp)
ja 0x5729
movl %eax, %eax
movabsq $0x3c0000006, %rcx      # imm = 0x3C0000006
btq %rax, %rcx
jae 0x5af8
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x5, %edi
movq %r14, %rsi
callq 0x42d0
movl 0x1f54(%rsp), %edx
movq %rbx, 0x1f60(%rsp)
movl %r15d, %ebx
movq 0x8(%r14), %r15
movq (%r15), %rax
movb (%rax), %cl
cmpb $0x2f, %cl
jne 0x577c
cmpb $0x0, 0x1(%rax)
jne 0x57ac
movq 0x18(%r15), %rax
cmpl $0x10, 0x8(%rax)
jne 0x57ac
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x9, %edi
movq %r14, %rsi
callq 0x42d0
movl 0x1f54(%rsp), %edx
movq 0x8(%r14), %r15
movq (%r15), %rax
movb (%rax), %cl
cmpb $0x5f, %cl
jne 0x57ac
cmpb $0x0, 0x1(%rax)
jne 0x57ac
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x3, %edi
movq %r14, %rsi
callq 0x42d0
movl 0x1f54(%rsp), %edx
movq 0x8(%r14), %r15
movl 0x8(%r15), %eax
cmpl $0x16, %eax
jg 0x57e4
leal -0x10(%rax), %ecx
cmpl $0x2, %ecx
jae 0x58a3
movl %ebx, %r15d
movslq %ebx, %rax
movl $0x18, 0x2390(%rsp,%rax,4)
movq 0x1f60(%rsp), %rbx
incl %ebx
incl %r15d
jmp 0x5e67
cmpl $0x17, %eax
je 0x5842
cmpl $0x29, %eax
je 0x5842
cmpl $0x2b, %eax
jne 0x5df0
movq 0x18(%r15), %rax
movl 0x8(%rax), %eax
cmpl $0xb, %eax
ja 0x5827
movl $0xb00, %ecx            # imm = 0xB00
btl %eax, %ecx
jae 0x5827
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x5, %edi
movq %r14, %rsi
callq 0x42d0
movl %ebx, %r15d
movslq %ebx, %rax
movl $0x14, 0x2390(%rsp,%rax,4)
incl %ebp
incl %r15d
jmp 0x5df3
movq (%r15), %rdi
leaq 0x2ce3(%rip), %rsi      # 0x852f
callq 0x1080
testl %eax, %eax
jne 0x5881
movq 0x10(%r15), %rax
movq (%rax), %rax
cmpb $0x2f, (%rax)
jne 0x5881
cmpb $0x0, 0x1(%rax)
jne 0x5881
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x9, %edi
movq %r14, %rsi
callq 0x42d0
movl %ebx, %r15d
movslq %ebx, %rax
movl $0x17, 0x2390(%rsp,%rax,4)
movl 0x1f54(%rsp), %edx
incl %edx
incl %r15d
jmp 0x5e5f
cmpl $0x13, %eax
jne 0x5e5c
movl %ebp, 0x1f74(%rsp)
movl %r12d, 0x1f68(%rsp)
leaq 0x2c78(%rip), %r13      # 0x853a
movq (%r15), %r15
cmpb $0x5f, (%r15)
movq %r15, %r12
leaq 0x2c60(%rip), %rsi      # 0x8533
jne 0x5907
cmpb $0x0, 0x1(%r15)
movq %r15, %r12
jne 0x5907
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x3, %edi
movq %r14, %rsi
callq 0x42d0
movq 0x8(%r14), %rax
movq (%rax), %r12
leaq 0x2c2c(%rip), %rsi      # 0x8533
movq %r12, %rdi
movq %rsi, %rbp
callq 0x1080
testl %eax, %eax
je 0x5b07
movq %r12, %rdi
movq %r13, %rsi
callq 0x1080
testl %eax, %eax
je 0x5b88
movq %r12, %rdi
leaq 0x2c0a(%rip), %r13      # 0x8541
movq %r13, %rsi
callq 0x1080
testl %eax, %eax
movl 0x1f74(%rsp), %ebp
je 0x5bc3
movq %r12, %rdi
leaq 0x2bf0(%rip), %r13      # 0x8548
movq %r13, %rsi
callq 0x1080
testl %eax, %eax
je 0x5c70
movq %r12, %rdi
leaq 0x2be0(%rip), %r13      # 0x8552
movq %r13, %rsi
callq 0x1080
testl %eax, %eax
je 0x5c3c
movq %r12, %rdi
leaq 0x2bd0(%rip), %r13      # 0x855c
movq %r13, %rsi
callq 0x1080
testl %eax, %eax
je 0x5c3c
movq %r12, %rdi
leaq 0x2bba(%rip), %r13      # 0x8560
movq %r13, %rsi
callq 0x1080
testl %eax, %eax
je 0x5ce2
movq %r12, %rdi
leaq 0x2ba7(%rip), %r13      # 0x8567
movq %r13, %rsi
callq 0x1080
testl %eax, %eax
je 0x5d19
movq %r12, %rdi
leaq 0x2b91(%rip), %r13      # 0x856b
movq %r13, %rsi
callq 0x1080
testl %eax, %eax
je 0x5ce2
movq %r12, %rdi
leaq 0x2b2b(%rip), %rsi      # 0x851f
callq 0x1080
testl %eax, %eax
je 0x5d3f
movq 0x89c8(%rip), %rdi      # 0xe3d0
movq %r12, %rsi
leaq 0x2f90(%rsp), %rdx
callq 0x43b0
testb %al, %al
movl 0x1f68(%rsp), %r12d
je 0x5d66
movq 0x8(%r14), %rax
movq 0x18(%rax), %rcx
cmpl $0x6, 0x8(%rcx)
jne 0x5df0
movq (%rax), %rsi
movq %r14, %rdi
movq 0x1f58(%rsp), %rdx
callq 0x4e01
movl 0x1f70(%rsp), %r15d
cmpl 0x2f94(%rsp), %r15d
jne 0x5de3
testl %r15d, %r15d
je 0x5df0
leaq 0x2390(%rsp), %rdi
leaq 0x3b98(%rsp), %rsi
movq 0x1f80(%rsp), %rdx
callq 0x1090
testl %r15d, %r15d
jle 0x5df0
xorl %r15d, %r15d
movl 0x1f54(%rsp), %edx
movl 0x1f90(%rsp,%r15,4), %eax
cmpl 0x2390(%rsp,%r15,4), %eax
je 0x5e55
movq 0x2790(%rsp,%r15,8), %rax
cmpb $0x5f, (%rax)
jne 0x5ac5
cmpb $0x0, 0x1(%rax)
je 0x5ae6
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x5, %edi
movq %r14, %rsi
callq 0x42d0
movl 0x1f54(%rsp), %edx
incq %r15
cmpq %r15, 0x1f88(%rsp)
jne 0x5a9c
jmp 0x5e5c
cmpq $0x2f, %rax
jne 0x5729
jmp 0x602c
movq %r14, %rdi
movq 0x1f58(%rsp), %rsi
movq %rbp, %rdx
callq 0x6c22
cmpl $0x2, 0x1f70(%rsp)
je 0x5b31
movl $0x6, %edi
movq %r14, %rsi
callq 0x42d0
cmpl $0x14, 0x1f90(%rsp)
movl %ebx, %r15d
movl 0x1f74(%rsp), %ebp
jne 0x5b61
movl 0x1f94(%rsp), %eax
cmpl $0x194, %eax            # imm = 0x194
je 0x5b58
cmpl $0x18, %eax
jne 0x5b61
incl 0x1f6c(%rsp)
jmp 0x5b7b
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x5, %edi
movq %r14, %rsi
callq 0x42d0
movl 0x1f68(%rsp), %r12d
jmp 0x5df3
movq %r14, %rdi
movq 0x1f58(%rsp), %rsi
movq %r13, %rdx
callq 0x6c22
cmpl $0x2, 0x1f70(%rsp)
movl 0x1f74(%rsp), %ebp
je 0x5bb9
movl $0x6, %edi
movq %r14, %rsi
callq 0x42d0
cmpl $0x18, 0x1f90(%rsp)
jmp 0x5bf5
movq %r14, %rdi
movq 0x1f58(%rsp), %rsi
movq %r13, %rdx
callq 0x6c22
cmpl $0x2, 0x1f70(%rsp)
je 0x5bed
movl $0x6, %edi
movq %r14, %rsi
callq 0x42d0
cmpl $0x17, 0x1f90(%rsp)
movl 0x1f68(%rsp), %r12d
movl %ebx, %r15d
jne 0x5c1d
movl 0x1f94(%rsp), %eax
cmpl $0x194, %eax            # imm = 0x194
je 0x5cd6
cmpl $0x18, %eax
je 0x5cd6
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x5, %edi
movq %r14, %rsi
callq 0x42d0
jmp 0x5df3
movq %r14, %rdi
movq 0x1f58(%rsp), %rsi
movq %r13, %rdx
callq 0x6c22
cmpl $0x1, 0x1f70(%rsp)
je 0x5c66
movl $0x6, %edi
movq %r14, %rsi
callq 0x42d0
cmpl $0x18, 0x1f90(%rsp)
jmp 0x5ca2
movq %r14, %rdi
movq 0x1f58(%rsp), %rsi
movq %r13, %rdx
callq 0x6c22
cmpl $0x1, 0x1f70(%rsp)
je 0x5c9a
movl $0x6, %edi
movq %r14, %rsi
callq 0x42d0
cmpl $0x17, 0x1f90(%rsp)
movl 0x1f68(%rsp), %r12d
movl %ebx, %r15d
je 0x5cd6
cmpl $0x194, 0x1f94(%rsp) # imm = 0x194
je 0x5cd6
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x5, %edi
movq %r14, %rsi
callq 0x42d0
incl 0x1f6c(%rsp)
jmp 0x5df3
movq %r14, %rdi
movq 0x1f58(%rsp), %rsi
movq %r13, %rdx
callq 0x6c22
cmpl $0x2, 0x1f70(%rsp)
je 0x5d0c
movl $0x6, %edi
movq %r14, %rsi
callq 0x42d0
cmpl $0x14, 0x1f90(%rsp)
jmp 0x5bf5
movq %r14, %rdi
movq 0x1f58(%rsp), %rsi
movq %r13, %rdx
callq 0x6c22
cmpl $0x2, 0x1f70(%rsp)
jne 0x5bac
jmp 0x5bb9
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x5, %edi
movq %r14, %rsi
callq 0x42d0
movl 0x1f68(%rsp), %r12d
jmp 0x5df0
movl $0x3e9, %ecx            # imm = 0x3E9
movq %rsp, %rdi
leaq 0x6713(%rip), %rsi      # 0xc488
rep  movsq (%rsi), %es:(%rdi)
movq %r15, %rdi
leaq 0x1f7c(%rsp), %rsi
callq 0x46d5
testb %al, %al
je 0x5dc7
movl 0x1f7c(%rsp), %eax
movl %ebx, %r15d
movslq %ebx, %rcx
movl %eax, 0x2390(%rsp,%rcx,4)
cmpl $0x14, %eax
je 0x5e12
cmpl $0x17, %eax
movq 0x1f60(%rsp), %rbx
je 0x5e04
cmpl $0x18, %eax
movl 0x1f54(%rsp), %edx
je 0x57da
jmp 0x5e67
movl $0x3, %edi
movq %r14, %rsi
callq 0x42d0
movq 0x1f58(%rsp), %rdi
callq 0x4662
jmp 0x5df0
movl $0x6, %edi
movq %r14, %rsi
callq 0x42d0
movl %ebx, %r15d
movq 0x1f60(%rsp), %rbx
movl 0x1f54(%rsp), %edx
jmp 0x5e67
movl 0x1f54(%rsp), %edx
incl %edx
jmp 0x57dc
movq 0x8(%r14), %rax
movq 0x18(%rax), %rax
movl 0x8(%rax), %eax
cmpl $0xb, %eax
movq 0x1f60(%rsp), %rbx
ja 0x5e4e
movl $0xb00, %ecx            # imm = 0xB00
btl %eax, %ecx
jae 0x5e4e
movq 0x1f58(%rsp), %rdi
callq 0x4662
movl $0x5, %edi
movq %r14, %rsi
callq 0x42d0
incl %ebp
incl %r15d
jmp 0x5dfb
incl 0x1f6c(%rsp)
movl %ebx, %r15d
movq 0x1f60(%rsp), %rbx
movq 0x8(%r14), %rax
movl 0x8(%rax), %ecx
cmpl $0x5, %ecx
je 0x5e95
cmpl $0x38, %ecx
je 0x602c
cmpl $0x34, %ecx
je 0x5e95
movq 0x18(%rax), %rax
cmpl $0x2f, 0x8(%rax)
je 0x5e95
movl %ebp, %r13d
movl %edx, %ebp
jmp 0x5fe5
testl %ebp, %ebp
setne %al
movl %ebx, %ecx
orl %edx, %ecx
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x5ecd
movslq %r12d, %rax
movl 0x1f90(%rsp,%rax,4), %ecx
cmpl $0x17, %ecx
jg 0x5f0b
cmpl $0x14, %ecx
je 0x5f1f
movl %ebp, %r13d
cmpl $0x17, %ecx
je 0x5f83
jmp 0x5fd1
testl %ebx, %ebx
setne %al
movl %ebp, %ecx
orl %edx, %ecx
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x5f4a
movslq %r12d, %rax
movl 0x1f90(%rsp,%rax,4), %eax
cmpl $0x17, %eax
jg 0x5f8a
cmpl $0x14, %eax
je 0x5f01
cmpl $0x17, %eax
jne 0x5f96
movl $0x5, %edi
jmp 0x5f9b
movl %ebp, %r13d
cmpl $0x18, %ecx
je 0x5f83
cmpl $0x194, %ecx            # imm = 0x194
jne 0x5fd1
movq 0x2790(%rsp,%rax,8), %rsi
movq 0x1f58(%rsp), %rdi
leaq 0x2390(%rsp), %rdx
leaq 0x25ec(%rip), %rcx      # 0x852a
callq 0x4535
incl %r15d
xorl %ebx, %ebx
jmp 0x5fa3
movl %ebp, %eax
orl %ebx, %eax
sete %al
testl %edx, %edx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x5faa
movslq %r12d, %rax
movl 0x1f90(%rsp,%rax,4), %ecx
cmpl $0x17, %ecx
jg 0x5ffe
cmpl $0x14, %ecx
je 0x6016
cmpl $0x17, %ecx
je 0x5f1f
jmp 0x600f
movl $0x5, %edi
jmp 0x5fd6
cmpl $0x194, %eax            # imm = 0x194
je 0x5f43
cmpl $0x18, %eax
je 0x5f43
movl $0x7, %edi
movq %r14, %rsi
callq 0x42d0
xorl %ebp, %ebp
xorl %r13d, %r13d
jmp 0x5fe2
cmpl $0x1, 0x1f78(%rsp)
je 0x5f43
testl %edx, %edx
sete %cl
testb %cl, %al
jne 0x5f46
movl %ebp, %r13d
movl $0x5, %edi
movq %r14, %rsi
movl %edx, %ebp
callq 0x42d0
jmp 0x5fe2
movl $0x7, %edi
movq %r14, %rsi
callq 0x42d0
xorl %ebx, %ebx
xorl %ebp, %ebp
incl %r12d
movq %r14, %rdi
callq 0x1691
movq 0x8(%r14), %rax
movl 0x8(%rax), %eax
movl %ebp, %edx
movl %r13d, %ebp
jmp 0x56e6
cmpl $0x18, %ecx
je 0x6016
cmpl $0x194, %ecx            # imm = 0x194
je 0x5f1f
movl $0x7, %edi
jmp 0x601b
movl $0x5, %edi
movq %r14, %rsi
movl %edx, %ebp
callq 0x42d0
xorl %ebx, %ebx
jmp 0x5fa5
cmpl $0x0, 0x1f6c(%rsp)
setne %al
cmpl %r12d, 0x1f70(%rsp)
sete %cl
orb %al, %cl
jne 0x6060
movl $0x7, %edi
movq %r14, %rsi
callq 0x42d0
movq 0x1f58(%rsp), %rdi
callq 0x4662
addq $0x3f98, %rsp           # imm = 0x3F98
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq