// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x3fc0, %rsp           # imm = 0x3FC0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpl $0x2f, 0x8(%rax)
jne 0x8843
movq -0x8(%rbp), %rsi
movl $0x7, %edi
callq 0x64e0
leaq 0x4d91(%rip), %rax      # 0xd5db
movq %rax, -0x1018(%rbp)
movl $0x0, -0x101c(%rbp)
movl $0x0, -0x1020(%rbp)
movl $0x0, -0x1024(%rbp)
movl $0x0, -0x1028(%rbp)
movl $0x0, -0x102c(%rbp)
movl $0x0, -0x1030(%rbp)
movl $0x0, -0x1034(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x3, 0x8(%rax)
je 0x89a4
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x13, 0x8(%rax)
jne 0x8996
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rcx
movslq -0x1028(%rbp), %rax
movq %rcx, -0x810(%rbp,%rax,8)
movslq -0x1028(%rbp), %rax
movq -0x810(%rbp,%rax,8), %rax
movq %rax, -0x2060(%rbp)
movslq -0x1028(%rbp), %rcx
leaq -0x1010(%rbp), %rax
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x2068(%rbp)
leaq 0x7b7a(%rip), %rsi      # 0x10488
movq %rsp, %rdi
movl $0x3e9, %ecx            # imm = 0x3E9
rep  movsq (%rsi), %es:(%rdi)
movq -0x2068(%rbp), %rsi
movq -0x2060(%rbp), %rdi
callq 0x6ec0
testb $0x1, %al
jne 0x8932
jmp 0x8970
movslq -0x1028(%rbp), %rax
movq -0x810(%rbp,%rax,8), %rdi
leaq 0x4c7b(%rip), %rsi      # 0xd5c3
callq 0x1070
cmpl $0x0, %eax
jne 0x896e
movslq -0x1028(%rbp), %rax
movl $0x194, -0x1010(%rbp,%rax,4) # imm = 0x194
movl $0x1, -0x1034(%rbp)
jmp 0x8987
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x3, %edi
callq 0x64e0
movl -0x1028(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1028(%rbp)
movq -0x8(%rbp), %rdi
callq 0x12e0
jmp 0x8897
movl $0x0, -0x1038(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x2f, 0x8(%rax)
je 0x98fc
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x2, 0x8(%rax)
jne 0x89ea
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x8ab8
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x1f, 0x8(%rax)
jne 0x8a14
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x8ab6
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x1, 0x8(%rax)
jne 0x8a3b
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x8ab4
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x1e, 0x8(%rax)
jne 0x8a62
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x8ab2
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x20, 0x8(%rax)
jne 0x8a89
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x8ab0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x21, 0x8(%rax)
jne 0x8aae
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x8ab0
jmp 0x8ab2
jmp 0x8ab4
jmp 0x8ab6
jmp 0x8ab8
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x4b16(%rip), %rsi      # 0xd5e0
callq 0x1070
cmpl $0x0, %eax
jne 0x8aff
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpl $0x10, 0x8(%rax)
jne 0x8afd
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x9, %edi
callq 0x64e0
jmp 0x8aff
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x4ab2(%rip), %rsi      # 0xd5c3
callq 0x1070
cmpl $0x0, %eax
jne 0x8b32
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x3, %edi
callq 0x64e0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x11, 0x8(%rax)
je 0x8b4e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x10, 0x8(%rax)
jne 0x8b83
movslq -0x102c(%rbp), %rax
movl $0x18, -0xc10(%rbp,%rax,4)
movl -0x1020(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1020(%rbp)
movl -0x102c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x102c(%rbp)
jmp 0x950d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x17, 0x8(%rax)
je 0x8ba3
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x29, 0x8(%rax)
jne 0x8c2d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x4a2d(%rip), %rsi      # 0xd5e2
callq 0x1070
cmpl $0x0, %eax
jne 0x8bf8
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
leaq 0x4a0b(%rip), %rsi      # 0xd5e0
callq 0x1070
cmpl $0x0, %eax
jne 0x8bf6
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x9, %edi
callq 0x64e0
jmp 0x8bf8
movslq -0x102c(%rbp), %rax
movl $0x17, -0xc10(%rbp,%rax,4)
movl -0x1024(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1024(%rbp)
movl -0x102c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x102c(%rbp)
jmp 0x950b
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x2b, 0x8(%rax)
jne 0x8cc1
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpl $0xb, 0x8(%rax)
je 0x8c75
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpl $0x8, 0x8(%rax)
je 0x8c75
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpl $0x9, 0x8(%rax)
jne 0x8c8c
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
movslq -0x102c(%rbp), %rax
movl $0x14, -0xc10(%rbp,%rax,4)
movl -0x101c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x101c(%rbp)
movl -0x102c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x102c(%rbp)
jmp 0x9509
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x13, 0x8(%rax)
jne 0x9505
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x1048(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x48cc(%rip), %rsi      # 0xd5c3
callq 0x1070
cmpl $0x0, %eax
jne 0x8d18
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x3, %edi
callq 0x64e0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x48bc(%rip), %rsi      # 0xd5e6
callq 0x1070
cmpl $0x0, %eax
jne 0x8daa
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x48a3(%rip), %rdx      # 0xd5e6
callq 0xa930
cmpl $0x2, -0x1028(%rbp)
je 0x8d5f
movq -0x8(%rbp), %rsi
movl $0x6, %edi
callq 0x64e0
cmpl $0x14, -0x1010(%rbp)
jne 0x8d8e
cmpl $0x18, -0x100c(%rbp)
je 0x8d7d
cmpl $0x194, -0x100c(%rbp)   # imm = 0x194
jne 0x8d8e
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0x8da5
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9503
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x4831(%rip), %rsi      # 0xd5ed
callq 0x1070
cmpl $0x0, %eax
jne 0x8e3c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x4818(%rip), %rdx      # 0xd5ed
callq 0xa930
cmpl $0x2, -0x1028(%rbp)
je 0x8df1
movq -0x8(%rbp), %rsi
movl $0x6, %edi
callq 0x64e0
cmpl $0x18, -0x1010(%rbp)
jne 0x8e20
cmpl $0x18, -0x100c(%rbp)
je 0x8e0f
cmpl $0x194, -0x100c(%rbp)   # imm = 0x194
jne 0x8e20
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0x8e37
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9501
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x47a6(%rip), %rsi      # 0xd5f4
callq 0x1070
cmpl $0x0, %eax
jne 0x8ece
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x478d(%rip), %rdx      # 0xd5f4
callq 0xa930
cmpl $0x2, -0x1028(%rbp)
je 0x8e83
movq -0x8(%rbp), %rsi
movl $0x6, %edi
callq 0x64e0
cmpl $0x17, -0x1010(%rbp)
jne 0x8eb2
cmpl $0x18, -0x100c(%rbp)
je 0x8ea1
cmpl $0x194, -0x100c(%rbp)   # imm = 0x194
jne 0x8eb2
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0x8ec9
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x94ff
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x471b(%rip), %rsi      # 0xd5fb
callq 0x1070
cmpl $0x0, %eax
jne 0x8f57
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x4702(%rip), %rdx      # 0xd5fb
callq 0xa930
cmpl $0x1, -0x1028(%rbp)
je 0x8f15
movq -0x8(%rbp), %rsi
movl $0x6, %edi
callq 0x64e0
cmpl $0x17, -0x1010(%rbp)
je 0x8f43
cmpl $0x194, -0x100c(%rbp)   # imm = 0x194
je 0x8f41
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x8f43
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0x94fd
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x469c(%rip), %rsi      # 0xd605
callq 0x1070
cmpl $0x0, %eax
jne 0x8fe0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x4683(%rip), %rdx      # 0xd605
callq 0xa930
cmpl $0x1, -0x1028(%rbp)
je 0x8f9e
movq -0x8(%rbp), %rsi
movl $0x6, %edi
callq 0x64e0
cmpl $0x18, -0x1010(%rbp)
je 0x8fcc
cmpl $0x194, -0x100c(%rbp)   # imm = 0x194
je 0x8fca
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x8fcc
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0x94fb
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x461d(%rip), %rsi      # 0xd60f
callq 0x1070
cmpl $0x0, %eax
jne 0x9069
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x4604(%rip), %rdx      # 0xd60f
callq 0xa930
cmpl $0x1, -0x1028(%rbp)
je 0x9027
movq -0x8(%rbp), %rsi
movl $0x6, %edi
callq 0x64e0
cmpl $0x18, -0x1010(%rbp)
je 0x9055
cmpl $0x194, -0x100c(%rbp)   # imm = 0x194
je 0x9053
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9055
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0x94f9
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x4598(%rip), %rsi      # 0xd613
callq 0x1070
cmpl $0x0, %eax
jne 0x90fb
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x457f(%rip), %rdx      # 0xd613
callq 0xa930
cmpl $0x2, -0x1028(%rbp)
je 0x90b0
movq -0x8(%rbp), %rsi
movl $0x6, %edi
callq 0x64e0
cmpl $0x14, -0x1010(%rbp)
jne 0x90df
cmpl $0x18, -0x100c(%rbp)
je 0x90ce
cmpl $0x194, -0x100c(%rbp)   # imm = 0x194
jne 0x90df
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0x90f6
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x94f7
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x450d(%rip), %rsi      # 0xd61a
callq 0x1070
cmpl $0x0, %eax
jne 0x918d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x44f4(%rip), %rdx      # 0xd61a
callq 0xa930
cmpl $0x2, -0x1028(%rbp)
je 0x9142
movq -0x8(%rbp), %rsi
movl $0x6, %edi
callq 0x64e0
cmpl $0x18, -0x1010(%rbp)
jne 0x9171
cmpl $0x18, -0x100c(%rbp)
je 0x9160
cmpl $0x194, -0x100c(%rbp)   # imm = 0x194
jne 0x9171
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0x9188
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x94f5
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x447f(%rip), %rsi      # 0xd61e
callq 0x1070
cmpl $0x0, %eax
jne 0x921f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x4466(%rip), %rdx      # 0xd61e
callq 0xa930
cmpl $0x2, -0x1028(%rbp)
je 0x91d4
movq -0x8(%rbp), %rsi
movl $0x6, %edi
callq 0x64e0
cmpl $0x14, -0x1010(%rbp)
jne 0x9203
cmpl $0x18, -0x100c(%rbp)
je 0x91f2
cmpl $0x194, -0x100c(%rbp)   # imm = 0x194
jne 0x9203
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0x921a
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x94f3
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x439b(%rip), %rsi      # 0xd5cc
callq 0x1070
cmpl $0x0, %eax
jne 0x9257
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x94f1
movq 0x9172(%rip), %rdi      # 0x123d0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rsi
leaq -0x2050(%rbp), %rdx
callq 0x66f0
testb $0x1, %al
jne 0x927e
jmp 0x93b7
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpl $0x6, 0x8(%rax)
jne 0x93b2
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
callq 0x79d0
movl -0x1028(%rbp), %eax
cmpl -0x204c(%rbp), %eax
je 0x92cd
movq -0x8(%rbp), %rsi
movl $0x6, %edi
callq 0x64e0
jmp 0x93b0
movl $0x0, -0x2054(%rbp)
movl -0x204c(%rbp), %eax
cmpl -0x2054(%rbp), %eax
je 0x9312
movslq -0x2054(%rbp), %rax
movl -0x1448(%rbp,%rax,4), %ecx
movslq -0x2054(%rbp), %rax
movl %ecx, -0xc10(%rbp,%rax,4)
movl -0x2054(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2054(%rbp)
jmp 0x92d7
movl $0x0, -0x2058(%rbp)
movl -0x2058(%rbp), %eax
cmpl -0x1028(%rbp), %eax
jge 0x93ae
movslq -0x2058(%rbp), %rax
movl -0x1010(%rbp,%rax,4), %eax
movslq -0x2058(%rbp), %rcx
cmpl -0xc10(%rbp,%rcx,4), %eax
je 0x9387
movslq -0x2058(%rbp), %rax
movq -0x810(%rbp,%rax,8), %rdi
leaq 0x4261(%rip), %rsi      # 0xd5c3
callq 0x1070
cmpl $0x0, %eax
jne 0x936e
jmp 0x9385
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9398
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0x93ae
jmp 0x939a
movl -0x2058(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2058(%rbp)
jmp 0x931c
jmp 0x93b0
jmp 0x93b2
jmp 0x94ef
movq -0x1048(%rbp), %rax
movq %rax, -0x2070(%rbp)
leaq 0x70bc(%rip), %rsi      # 0x10488
movq %rsp, %rdi
movl $0x3e9, %ecx            # imm = 0x3E9
rep  movsq (%rsi), %es:(%rdi)
movq -0x2070(%rbp), %rdi
leaq -0x103c(%rbp), %rsi
callq 0x6ec0
testb $0x1, %al
jne 0x93f3
jmp 0x94d6
movl -0x103c(%rbp), %ecx
movslq -0x102c(%rbp), %rax
movl %ecx, -0xc10(%rbp,%rax,4)
cmpl $0x18, -0x103c(%rbp)
jne 0x9433
movl -0x1020(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1020(%rbp)
movl -0x102c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x102c(%rbp)
jmp 0x94d4
cmpl $0x17, -0x103c(%rbp)
jne 0x945c
movl -0x1024(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1024(%rbp)
movl -0x102c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x102c(%rbp)
jmp 0x94d2
cmpl $0x14, -0x103c(%rbp)
jne 0x94d0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpl $0xb, 0x8(%rax)
je 0x949b
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpl $0x8, 0x8(%rax)
je 0x949b
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpl $0x9, 0x8(%rax)
jne 0x94b2
movq -0x10(%rbp), %rdi
callq 0x6d90
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
movl -0x101c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x101c(%rbp)
movl -0x102c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x102c(%rbp)
jmp 0x94d2
jmp 0x94d4
jmp 0x94ed
movq -0x8(%rbp), %rsi
movl $0x3, %edi
callq 0x64e0
movq -0x10(%rbp), %rdi
callq 0x6d90
jmp 0x94ef
jmp 0x94f1
jmp 0x94f3
jmp 0x94f5
jmp 0x94f7
jmp 0x94f9
jmp 0x94fb
jmp 0x94fd
jmp 0x94ff
jmp 0x9501
jmp 0x9503
jmp 0x9507
jmp 0x9507
jmp 0x9509
jmp 0x950b
jmp 0x950d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x38, 0x8(%rax)
jne 0x9520
jmp 0x98fc
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x5, 0x8(%rax)
je 0x9552
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpl $0x2f, 0x8(%rax)
je 0x9552
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x34, 0x8(%rax)
jne 0x98ee
cmpl $0x0, -0x101c(%rbp)
je 0x966b
cmpl $0x0, -0x1020(%rbp)
jne 0x966b
cmpl $0x0, -0x1024(%rbp)
jne 0x966b
movslq -0x1038(%rbp), %rax
cmpl $0x14, -0x1010(%rbp,%rax,4)
je 0x959e
movslq -0x1038(%rbp), %rax
cmpl $0x194, -0x1010(%rbp,%rax,4) # imm = 0x194
jne 0x95f3
movq -0x10(%rbp), %rdi
movslq -0x1038(%rbp), %rax
movq -0x810(%rbp,%rax,8), %rsi
leaq -0xc10(%rbp), %rdx
movq -0x1018(%rbp), %rcx
callq 0x6a60
movl -0x102c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x102c(%rbp)
movl $0x0, -0x101c(%rbp)
movl $0x0, -0x1020(%rbp)
movl $0x0, -0x1024(%rbp)
jmp 0x9666
movslq -0x1038(%rbp), %rax
cmpl $0x18, -0x1010(%rbp,%rax,4)
je 0x9656
movslq -0x1038(%rbp), %rax
cmpl $0x14, -0x1010(%rbp,%rax,4)
je 0x9646
movslq -0x1038(%rbp), %rax
cmpl $0x17, -0x1010(%rbp,%rax,4)
je 0x9636
movq -0x8(%rbp), %rsi
movl $0x7, %edi
callq 0x64e0
jmp 0x9644
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9654
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9664
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9666
jmp 0x98df
cmpl $0x0, -0x101c(%rbp)
jne 0x975e
cmpl $0x0, -0x1020(%rbp)
je 0x975e
cmpl $0x0, -0x1024(%rbp)
jne 0x975e
movslq -0x1038(%rbp), %rax
cmpl $0x18, -0x1010(%rbp,%rax,4)
je 0x96b7
movslq -0x1038(%rbp), %rax
cmpl $0x194, -0x1010(%rbp,%rax,4) # imm = 0x194
jne 0x96e6
movl -0x102c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x102c(%rbp)
movl $0x0, -0x101c(%rbp)
movl $0x0, -0x1020(%rbp)
movl $0x0, -0x1024(%rbp)
jmp 0x9759
movslq -0x1038(%rbp), %rax
cmpl $0x18, -0x1010(%rbp,%rax,4)
je 0x9749
movslq -0x1038(%rbp), %rax
cmpl $0x14, -0x1010(%rbp,%rax,4)
je 0x9739
movslq -0x1038(%rbp), %rax
cmpl $0x17, -0x1010(%rbp,%rax,4)
je 0x9729
movq -0x8(%rbp), %rsi
movl $0x7, %edi
callq 0x64e0
jmp 0x9737
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9747
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9757
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9759
jmp 0x98dd
cmpl $0x0, -0x101c(%rbp)
jne 0x9874
cmpl $0x0, -0x1020(%rbp)
jne 0x9874
cmpl $0x0, -0x1024(%rbp)
je 0x9874
movslq -0x1038(%rbp), %rax
cmpl $0x17, -0x1010(%rbp,%rax,4)
je 0x97aa
movslq -0x1038(%rbp), %rax
cmpl $0x194, -0x1010(%rbp,%rax,4) # imm = 0x194
jne 0x97ff
movq -0x10(%rbp), %rdi
movslq -0x1038(%rbp), %rax
movq -0x810(%rbp,%rax,8), %rsi
leaq -0xc10(%rbp), %rdx
movq -0x1018(%rbp), %rcx
callq 0x6a60
movl -0x102c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x102c(%rbp)
movl $0x0, -0x101c(%rbp)
movl $0x0, -0x1020(%rbp)
movl $0x0, -0x1024(%rbp)
jmp 0x9872
movslq -0x1038(%rbp), %rax
cmpl $0x18, -0x1010(%rbp,%rax,4)
je 0x9862
movslq -0x1038(%rbp), %rax
cmpl $0x14, -0x1010(%rbp,%rax,4)
je 0x9852
movslq -0x1038(%rbp), %rax
cmpl $0x17, -0x1010(%rbp,%rax,4)
je 0x9842
movq -0x8(%rbp), %rsi
movl $0x7, %edi
callq 0x64e0
jmp 0x9850
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9860
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9870
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x9872
jmp 0x98db
cmpl $0x1, -0x1034(%rbp)
jne 0x98ac
movl -0x102c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x102c(%rbp)
movl $0x0, -0x101c(%rbp)
movl $0x0, -0x1020(%rbp)
movl $0x0, -0x1024(%rbp)
jmp 0x98d9
cmpl $0x0, -0x101c(%rbp)
jne 0x98c9
cmpl $0x0, -0x1020(%rbp)
jne 0x98c9
cmpl $0x0, -0x1024(%rbp)
jne 0x98c9
jmp 0x98d7
movq -0x8(%rbp), %rsi
movl $0x5, %edi
callq 0x64e0
jmp 0x98d9
jmp 0x98db
jmp 0x98dd
jmp 0x98df
movl -0x1038(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1038(%rbp)
movq -0x8(%rbp), %rdi
callq 0x12e0
jmp 0x89ae
cmpl $0x0, -0x1030(%rbp)
jne 0x992c
movl -0x1028(%rbp), %eax
cmpl -0x1038(%rbp), %eax
je 0x992a
movq -0x8(%rbp), %rsi
movl $0x7, %edi
callq 0x64e0
movq -0x10(%rbp), %rdi
callq 0x6d90
jmp 0x992c
addq $0x3fc0, %rsp           # imm = 0x3FC0
popq %rbp
retq
nopw %cs:(%rax,%rax)