// File: /workspace/github_cpp_makefile_star2_O3/Cristian-Castillo[P]Multithreaded-HTTP-Server/./httpserver_definitions.cpp
// Function: f_check_copy(char*, int)
void *f_check_copy(char *file_name, int clientSocket)
{
    /* 
       if a copy is not found in a directory then copyX_found = 0. 
       If file is found in the directory then copyX_found = 1  for X in (1,2,3)
    */
    int copy1_found, copy2_found, copy3_found;
    copy1_found = 0;
    copy2_found = 0;
    copy3_found = 0;

    /* Checking if the file requested by user exists in ./copy1 directory */
    DIR *dir;
    struct dirent *listD;
    dir = opendir("./copy1");
    
    if(dir == NULL){
        perror("Error: Unable to open current server directory copy1.\n)");
        copy1_found = 0;
    }
    else{
        while((listD = readdir(dir)) != NULL){
            if((strcmp(file_name, listD->d_name) == 0) && (listD->d_type == DT_REG)){
                copy1_found = 1;
            }
        }
    }
    dir = opendir("./copy2");
    
    if(dir == NULL){
        perror("Error: Unable to open current server directory copy2.\n)");
        copy2_found = 0;
    }
    else{
        while((listD = readdir(dir)) != NULL){

            if((strcmp(file_name, listD->d_name) == 0) && (listD->d_type == DT_REG)){
                copy2_found = 1;
            }
        }
    }
    dir = opendir("./copy3");
    
    if(dir == NULL){
        perror("Error: Unable to open current server directory copy3.\n)");
        copy3_found = 0;
    }
    else{
        while((listD = readdir(dir)) != NULL){
            if((strcmp(file_name, listD->d_name) == 0) && (listD->d_type == DT_REG)){
                copy3_found = 1;
            }
        }
    }
    closedir(dir);


    /* 
       If a file's permission is locking us out, then copyX_no_permission = 1. 
       But if we have the permission, copyX_no_permission = 0 
    */
    int copy1_no_permission, copy2_no_permission, copy3_no_permission;
    copy1_no_permission = 0;
    copy2_no_permission = 0;
    copy3_no_permission = 0;

    struct http_node *child;
    child = &spawnNode;

    /* Opening a file in directory ./copy1 */
    char path_with_name1[20]; 
    strcpy (path_with_name1,"copy1/");
    strcat (path_with_name1, file_name);

    int file_copy1 = open(path_with_name1, O_RDONLY,0664);
    if(copy1_found == 1){ /* Indicatese if file was found in directory */
    
    /* if this condition is met that means file in directory but no permission to open  //f_void_client_error_not_found(clientSocket);} */
        if(file_copy1 == -1) {copy1_no_permission = 1;}  
    }
    /* copy1_permission = f_int_permission_put(path_with_name1, clientSocket); */

    /* Opening a file in directory ./copy2 */
    char path_with_name2[20]; 

    strcpy (path_with_name2,"copy2/");

    strcat (path_with_name2, file_name);

    int file_copy2 = open(path_with_name2, O_RDONLY,0664);
    if(copy2_found == 1){
        if(file_copy2 == -1) {copy2_no_permission = 1;} /* {f_void_client_error_not_found(clientSocket);} */
    }
    /* copy2_permission = f_int_permission_put(path_with_name2, clientSocket); */

    /* Opening a file in directory ./copy3 */
    char path_with_name3[20]; 

    strcpy (path_with_name3,"copy3/");

    strcat (path_with_name3, file_name);

    int file_copy3 = open(path_with_name3, O_RDONLY,0664);
    if(copy3_found == 1){
        if(file_copy3 == -1){
            copy3_no_permission = 1; /* {f_void_client_error_not_found(clientSocket);} */
        } 
    }
    /* copy3_permission = f_int_permission_put(path_with_name3, clientSocket); */


    /* getting the content length of each file within each ./copyX directory for X in (1,2,3) */
    struct stat buf1;
    fstat(file_copy1,&buf1);
    int get_length1 = buf1.st_size;
    ////////////////////////////////////////////////////////////////////////////////////
    struct stat buf2;
    fstat(file_copy2,&buf2);
    int get_length2 = buf2.st_size;
    ////////////////////////////////////////////////////////////////////////////////////
    struct stat buf3;
    fstat(file_copy3,&buf3);
    int get_length3 = buf3.st_size;
    ////////////////////////////////////////////////////////////////////////////////////


    char *buff1 = (char*)malloc(get_length1*sizeof(char*));
    char *buff2 = (char*)malloc(get_length2*sizeof(char*));
    char *buff3 = (char*)malloc(get_length3*sizeof(char*));

    /* 
        If two files are found to be the same in regards to content length 
        and ascii character comparison, then copyXY = 1 
    */
    int copy12_same, copy13_same, copy23_same;
    copy12_same = copy13_same = copy23_same = 0;

    ssize_t check_bytes_recv1;
    ssize_t check_bytes_recv2;
    ssize_t check_bytes_recv3;

    /* Checking to see if the the file in ./copy1 is the same in ./copy2 in terms of ascii content and length */
    ssize_t write_bytes = 0;

    if((get_length1 == get_length2) && (file_copy1 != -1) && (file_copy2 !=-1)){
        lseek(file_copy1, 0*sizeof(char), SEEK_SET);
        lseek(file_copy2, 0*sizeof(char), SEEK_SET);
        while(((check_bytes_recv1 = read(file_copy1,buff1,get_length1)) >= 0) && ((check_bytes_recv2 = read(file_copy2,buff2,get_length2)) >= 0) ){
            write_bytes += check_bytes_recv1;
  
            sleep(2);
            /* comparing ascii values */
            if(strcmp(buff1,buff2) != 0){
                break;
            }
            if(write_bytes == get_length1){

                copy12_same = 1;
                break;
            }
        }
    }

     /* 
        Checking to see if the the file in ./copy1 is the same in
        ./copy3 in terms of ascii content and length 
    */
    memset(buff1, 0, get_length1);
    memset(buff2, 0, get_length2);
    
    if(copy12_same == 0 && (get_length1 == get_length3)  && (file_copy1 != -1) && (file_copy3 !=-1)){
        
            lseek(file_copy1, 0*sizeof(char), SEEK_SET);
            lseek(file_copy3, 0*sizeof(char), SEEK_SET);
            write_bytes = 0;
            
            while((check_bytes_recv1 = read(file_copy1,buff1,get_length1)) >= 0 && (check_bytes_recv3 = read(file_copy3,buff3,get_length3)) >= 0){
            write_bytes += check_bytes_recv1;
            
            if(strcmp(buff1,buff3) != 1){
                break;
            }
            if(write_bytes == get_length1){
    
                copy13_same = 1;
                break;
            }
        }
    }

    /* Checking to see if the the file in ./copy2 is the same in ./copy3 in terms of ascii content and length */
    memset(buff1, 0, get_length1);
    memset(buff3, 0, get_length3);
    
    if((copy12_same == 0) && (copy13_same == 0) && (get_length2 == get_length3)  && (file_copy2 != -1) && (file_copy3 !=-1)){
        
        lseek(file_copy2, 0*sizeof(char), SEEK_SET);
        lseek(file_copy3, 0*sizeof(char), SEEK_SET);
        write_bytes = 0;
        

        while((check_bytes_recv2 = read(file_copy2,buff2,get_length2)) >= 0 && (check_bytes_recv3 = read(file_copy3,buff3,get_length3)) >= 0){
            write_bytes += check_bytes_recv2;

            sleep(2);
            if(strcmp(buff2,buff3) != 0){
                break;
            }
            if(write_bytes == get_length2){
  
                copy23_same = 1;
                break;
            }
        }
    }
    memset(buff1, 0, get_length1);
    memset(buff3, 0, get_length3);

    lseek(file_copy1, 0*sizeof(char), SEEK_SET);
    lseek(file_copy2, 0*sizeof(char), SEEK_SET);
    
    free(buff1);
    free(buff2);
    free(buff3);

    close(file_copy3);

    /* 
       NOTE: the number of files that gives us no permission 
       to open is always less than or equal to the number of files that exist 
    */ 

    /* calculates the number of files that gives no permission for us to open in directorys ./copyX */
    int num_of_no_permission_files = copy1_no_permission + copy2_no_permission + copy3_no_permission;

    /* calculates the number of files that exists in the directory ./copyX */
    int num_of_files_that_exist = copy1_found + copy2_found + copy3_found;

    /* If all three files are not found or no permission, the status code should be 500 */
    if((num_of_files_that_exist == 0) || (num_of_no_permission_files == 3)){
       /* printf("500 internal error\n"); */
        close(file_copy1);
        close(file_copy2);
        f_void_intr_error(clientSocket);
    }

    /*  GET file with 2/3 or 3/3 files giving no permissions  */
    if(num_of_no_permission_files >=2 ){                
        /* printf("403 error per post @385 endosred by Daniel Alvs #2 & 3 ALSO @336 #1\n");*/
        close(file_copy1);
        close(file_copy2);
        f_void_client_error_forbid(clientSocket);
    }

    /*  GET file with 1/3 files giving no permissions, 1/3 files that don't exist, 1/3 files that do exist and we have permission */
    if((num_of_files_that_exist == 2) && (num_of_no_permission_files == 1)){                
        /* printf("500 error per post @385 endosred by Daniel Alvs #4 ALSO @336 #2\n"); */
        close(file_copy1);
        close(file_copy2);
        f_void_intr_error(clientSocket);
    }

    /*  GET with 2/3 files that don't exist, and file with 1/3 files giving no permissions   */
    if((num_of_files_that_exist == 1) && (num_of_no_permission_files == 1)){                
        /* printf("404 error per post @385 endosred by Daniel Alvs #5 ALSO @336 #3\n"); */
        close(file_copy1);
        close(file_copy2);
        f_void_client_error_not_found(clientSocket);
    }

    if(copy12_same == 1 || copy13_same == 1){

        /* sending HTTP 200 */
        f_client_req_found(file_copy1,clientSocket); 
        ssize_t send_bytes = 0;

        char *buffs = (char*)malloc(get_length1*sizeof(char*));

        /* Store file contents */
        while((child->content_length = read(file_copy1,buffs,sizeof(buffs))) != 0){

            /* printf("if you see then that means i am writing into the client socket\n"); */
            send_bytes +=  write(clientSocket,buffs,child->content_length);
            if(send_bytes == get_length1){break;}
        }
        close(file_copy1);
        close(file_copy2);
            
        if(child->content_length == 0){
            free(buffs);
            return NULL;
        }
        else{ 
            /* Internal error of 500 Content failuire*/
            f_void_intr_error(clientSocket);
            free(buffs);
            return NULL;   
        }

    }
    else if(copy23_same == 1){

        f_client_req_found(file_copy2,clientSocket);
        ssize_t send_bytes;

        char *buffs = (char*)malloc(get_length2*sizeof(char*));
        
        /* Store file contents */
        while((child->content_length = read(file_copy2,buffs,sizeof(buffs))) != 0){
            send_bytes =  write(clientSocket,buffs,child->content_length);
            if(send_bytes == get_length2){break;}
        }
        close(file_copy1);
        close(file_copy2);
            
        if(child->content_length == 0){
            free(buffs);
            return NULL;
        }
        else{ 
            /* Internal error of 500 Content failuire */
            f_void_intr_error(clientSocket);
            free(buffs);
            return NULL;
                
        }
    }
    else{
        close(file_copy1);
        close(file_copy2);
        f_void_intr_error(clientSocket);
        return NULL;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movl %esi, %r12d
movq %rdi, %rbx
leaq 0x101d2(%rip), %rdi     # 0x15724
callq 0x4550
testq %rax, %rax
je 0x55a2
movq %rax, %r14
movq %rax, %rdi
callq 0x4570
testq %rax, %rax
je 0x55ae
movq %rax, %r15
xorl %r13d, %r13d
movl $0x1, %ebp
leaq 0x13(%r15), %rsi
movq %rbx, %rdi
callq 0x44d0
testl %eax, %eax
jne 0x5590
cmpb $0x8, 0x12(%r15)
cmovel %ebp, %r13d
movq %r14, %rdi
callq 0x4570
movq %rax, %r15
testq %rax, %rax
jne 0x5577
jmp 0x55b1
leaq 0x10183(%rip), %rdi     # 0x1572c
callq 0x42e0
xorl %r13d, %r13d
leaq 0x101ac(%rip), %rdi     # 0x15764
callq 0x4550
testq %rax, %rax
je 0x5614
movq %rax, %r14
movq %rax, %rdi
callq 0x4570
testq %rax, %rax
je 0x5620
movq %rax, %r15
movl $0x0, 0x1c(%rsp)
movl $0x1, %ebp
leaq 0x13(%r15), %rsi
movq %rbx, %rdi
callq 0x44d0
testl %eax, %eax
jne 0x5602
cmpb $0x8, 0x12(%r15)
movl 0x1c(%rsp), %eax
cmovel %ebp, %eax
movl %eax, 0x1c(%rsp)
movq %r14, %rdi
callq 0x4570
movq %rax, %r15
testq %rax, %rax
jne 0x55e2
jmp 0x5628
leaq 0x10151(%rip), %rdi     # 0x1576c
callq 0x42e0
movl $0x0, 0x1c(%rsp)
leaq 0x10175(%rip), %rdi     # 0x157a4
callq 0x4550
movq %rax, %r14
testq %rax, %rax
je 0x568b
movq %r14, %rdi
callq 0x4570
testq %rax, %rax
je 0x5697
movq %rax, %r15
movl $0x0, 0x18(%rsp)
movl $0x1, %ebp
leaq 0x13(%r15), %rsi
movq %rbx, %rdi
callq 0x44d0
testl %eax, %eax
jne 0x5679
cmpb $0x8, 0x12(%r15)
movl 0x18(%rsp), %eax
cmovel %ebp, %eax
movl %eax, 0x18(%rsp)
movq %r14, %rdi
callq 0x4570
movq %rax, %r15
testq %rax, %rax
jne 0x5659
jmp 0x569f
leaq 0x1011a(%rip), %rdi     # 0x157ac
callq 0x42e0
movl $0x0, 0x18(%rsp)
movl %r12d, 0x4c(%rsp)
movq %r14, %rdi
callq 0x45a0
movl $0x79706f63, %eax       # imm = 0x79706F63
leaq 0xb0(%rsp), %r14
movl %eax, (%r14)
movl $0x2f3179, 0x3(%r14)    # imm = 0x2F3179
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4620
movq %r14, %rdi
xorl %esi, %esi
movl $0x1b4, %edx            # imm = 0x1B4
xorl %eax, %eax
callq 0x4280
movl %eax, %r15d
movl %r13d, 0x48(%rsp)
movl %r13d, %eax
xorl $0x1, %eax
movl %r15d, %ecx
notl %ecx
xorl %edx, %edx
orl %eax, %ecx
sete %dl
movl %edx, 0x44(%rsp)
leaq 0x90(%rsp), %r14
movl $0x79706f63, %r13d      # imm = 0x79706F63
movl %r13d, (%r14)
movl $0x2f3279, 0x3(%r14)    # imm = 0x2F3279
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4620
movq %r14, %rdi
xorl %esi, %esi
movl $0x1b4, %edx            # imm = 0x1B4
xorl %eax, %eax
callq 0x4280
movl %eax, %ebp
cmpl $0x1, 0x1c(%rsp)
sete %al
cmpl $-0x1, %ebp
sete %r12b
andb %al, %r12b
leaq 0x70(%rsp), %r14
movl %r13d, (%r14)
movl $0x2f3379, 0x3(%r14)    # imm = 0x2F3379
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4620
movq %r14, %rdi
xorl %esi, %esi
movl $0x1b4, %edx            # imm = 0x1B4
xorl %eax, %eax
callq 0x4280
movl %eax, %r14d
movl 0x18(%rsp), %eax
xorl $0x1, %eax
movl %r14d, %ecx
notl %ecx
xorl %edx, %edx
orl %eax, %ecx
sete %dl
movl %edx, 0x40(%rsp)
leaq 0x1e8(%rsp), %rbx
movl %r15d, 0xc(%rsp)
movl %r15d, %edi
movq %rbx, %rsi
callq 0x45d0
movq 0x30(%rbx), %r15
leaq 0x158(%rsp), %rbx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x45d0
movq 0x30(%rbx), %r13
leaq 0xc8(%rsp), %rbx
movl %r14d, 0x14(%rsp)
movl %r14d, %edi
movq %rbx, %rsi
callq 0x45d0
movq 0x30(%rbx), %r14
movq %r15, 0x30(%rsp)
movslq %r15d, %r15
leaq (,%r15,8), %rdi
movq %rdi, 0x68(%rsp)
callq 0x44b0
movq %rax, %rbx
movq %r13, 0x58(%rsp)
movslq %r13d, %rax
movq %rax, 0x28(%rsp)
leaq (,%rax,8), %rdi
movq %rdi, 0x60(%rsp)
callq 0x44b0
movq %rax, %r13
movq %r14, 0x50(%rsp)
movslq %r14d, %rax
movq %rax, 0x20(%rsp)
leaq (,%rax,8), %rdi
callq 0x44b0
movq %rax, %r14
movzbl %r12b, %eax
movl %eax, 0x3c(%rsp)
movl %ebp, 0x10(%rsp)
cmpl $-0x1, %ebp
je 0x58d2
cmpl $-0x1, 0xc(%rsp)
je 0x58d2
movq 0x30(%rsp), %rax
cmpl 0x58(%rsp), %eax
jne 0x58d2
xorl %ebp, %ebp
movl 0xc(%rsp), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4690
movl 0x10(%rsp), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4690
movl 0xc(%rsp), %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x4510
testq %rax, %rax
js 0x58d2
movq %rax, %r12
movl 0x10(%rsp), %edi
movq %r13, %rsi
movq 0x28(%rsp), %rdx
callq 0x4510
testq %rax, %rax
js 0x58d2
movl $0x2, %edi
callq 0x42a0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x44d0
testl %eax, %eax
jne 0x58d2
addq %r12, %rbp
cmpq %r15, %rbp
jne 0x587a
movb $0x1, %cl
xorl %r12d, %r12d
jmp 0x5a30
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x41f0
movq %r13, %rdi
xorl %esi, %esi
movq 0x28(%rsp), %rdx
callq 0x41f0
cmpl $-0x1, 0xc(%rsp)
je 0x5970
cmpl $-0x1, 0x14(%rsp)
je 0x5970
movq 0x30(%rsp), %rax
cmpl 0x50(%rsp), %eax
jne 0x5970
xorl %ebp, %ebp
movl 0xc(%rsp), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4690
movl 0x14(%rsp), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4690
movl 0xc(%rsp), %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x4510
testq %rax, %rax
js 0x5970
movq %rax, %r12
movl 0x14(%rsp), %edi
movq %r14, %rsi
movq 0x20(%rsp), %rdx
callq 0x4510
testq %rax, %rax
js 0x5970
movq %rbx, %rdi
movq %r14, %rsi
callq 0x44d0
cmpl $0x1, %eax
jne 0x5970
addq %r12, %rbp
cmpq %r15, %rbp
jne 0x5923
movb $0x1, %r12b
jmp 0x5a2e
xorl %r12d, %r12d
movq %r14, %rdi
xorl %esi, %esi
movq 0x20(%rsp), %rdx
callq 0x41f0
cmpl $-0x1, 0x10(%rsp)
je 0x5a2e
cmpl $-0x1, 0x14(%rsp)
je 0x5a2e
movl $0x0, %ecx
movl $0x0, %edx
movq 0x50(%rsp), %rax
cmpl %eax, 0x58(%rsp)
jne 0x5a32
xorl %ebp, %ebp
movl 0x10(%rsp), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4690
movl 0x14(%rsp), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4690
movq 0x28(%rsp), %rdx
movl 0x10(%rsp), %edi
movq %r13, %rsi
callq 0x4510
testq %rax, %rax
js 0x5a2b
movq %rax, %r12
movl 0x14(%rsp), %edi
movq %r14, %rsi
movq 0x20(%rsp), %rdx
callq 0x4510
testq %rax, %rax
js 0x5a2b
movl $0x2, %edi
callq 0x42a0
movq %r13, %rdi
movq %r14, %rsi
callq 0x44d0
testl %eax, %eax
jne 0x5a2b
addq %r12, %rbp
movq 0x28(%rsp), %rdx
cmpq %rdx, %rbp
jne 0x59d2
movb $0x1, %dl
xorl %r12d, %r12d
xorl %ecx, %ecx
jmp 0x5a32
xorl %r12d, %r12d
xorl %ecx, %ecx
xorl %edx, %edx
movl %edx, 0x30(%rsp)
movl %ecx, 0x20(%rsp)
movl 0xc(%rsp), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4690
movl 0x10(%rsp), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4690
movq %rbx, %rdi
callq 0x4400
movq %r13, %rdi
callq 0x4400
movq %r14, %rdi
callq 0x4400
movl 0x14(%rsp), %edi
callq 0x46d0
movl 0x3c(%rsp), %r14d
addl 0x44(%rsp), %r14d
addl 0x40(%rsp), %r14d
movl 0x1c(%rsp), %ebx
addl 0x48(%rsp), %ebx
addl 0x18(%rsp), %ebx
movl 0x4c(%rsp), %ebp
je 0x5a9c
cmpl $0x3, %r14d
jne 0x5abe
movl 0xc(%rsp), %edi
callq 0x46d0
movl 0x10(%rsp), %edi
callq 0x46d0
leaq 0xfac2(%rip), %rsi      # 0x15577
movl %ebp, %edi
xorl %eax, %eax
callq 0x4200
cmpl $0x1, %r14d
jbe 0x5acd
leaq 0xfa4b(%rip), %rbx      # 0x15516
jmp 0x5af3
cmpl $0x2, %ebx
jne 0x5ae1
cmpl $0x1, %r14d
jne 0x5ae1
leaq 0xfa98(%rip), %rbx      # 0x15577
jmp 0x5af3
cmpl $0x1, %ebx
jne 0x5b11
cmpl $0x1, %r14d
jne 0x5b11
leaq 0xfa51(%rip), %rbx      # 0x15544
movl 0xc(%rsp), %edi
callq 0x46d0
movl 0x10(%rsp), %edi
callq 0x46d0
movl %ebp, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4200
orb 0x20(%rsp), %r12b
cmpb $0x1, %r12b
jne 0x5b69
movl 0xc(%rsp), %edi
movl %ebp, %esi
callq 0x5101
movq 0x68(%rsp), %rdi
callq 0x44b0
movq %rax, %rbx
xorl %r14d, %r14d
movl $0x8, %edx
movl 0xc(%rsp), %edi
movq %rbx, %rsi
callq 0x4510
movl %eax, 0x18d6e(%rip)     # 0x1e8bc
testl %eax, %eax
je 0x5bba
movslq %eax, %rdx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x4130
addq %rax, %r14
cmpq %r15, %r14
jne 0x5b37
jmp 0x5bba
cmpb $0x0, 0x30(%rsp)
je 0x5bef
movl 0x10(%rsp), %edi
movl %ebp, %esi
callq 0x5101
movq 0x60(%rsp), %rdi
callq 0x44b0
movq %rax, %rbx
movq 0x28(%rsp), %r14
movl $0x8, %edx
movl 0x10(%rsp), %edi
movq %rbx, %rsi
callq 0x4510
movl %eax, 0x18d18(%rip)     # 0x1e8bc
testl %eax, %eax
je 0x5bba
movslq %eax, %rdx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x4130
cmpq %r14, %rax
jne 0x5b8d
movl 0xc(%rsp), %edi
callq 0x46d0
movl 0x10(%rsp), %edi
callq 0x46d0
cmpl $0x0, 0x18ce9(%rip)     # 0x1e8bc
je 0x5be5
leaq 0xf99b(%rip), %rsi      # 0x15577
movl %ebp, %edi
xorl %eax, %eax
callq 0x4200
movq %rbx, %rdi
callq 0x4400
jmp 0x5c11
movl 0xc(%rsp), %edi
callq 0x46d0
movl 0x10(%rsp), %edi
callq 0x46d0
leaq 0xf96f(%rip), %rsi      # 0x15577
movl %ebp, %edi
xorl %eax, %eax
callq 0x4200
xorl %eax, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq