// File: /workspace/github_c_makefile_star2_O0/evanwire[P]GitClone/server.c
// Function: push
void push(char* command, int connfd){
  //lock the repository
  pthread_mutex_lock(&lock);

  //Parse message from client
  char message[strlen(command) - 1];
  memset(message, 0, sizeof(message));
  int i;
  for(i = 2; i < strlen(command); i++){
      if(command[i]){
        message[i - 2] = command[i];
      }
      
  }

  //Isolate project name
  char* saveptr = message;
  char* projectName = strtok_r(saveptr, " ", &saveptr);

  char numberStorage[10];
  memset(numberStorage, '\0', 10);
  char* token = strtok_r(saveptr, "$", &saveptr);
  sprintf(numberStorage, "%s", token);

  int numFiles = atoi(numberStorage);

  token = strtok_r(saveptr, "&", &saveptr);
  token = strtok_r(saveptr, "&", &saveptr);
  token = strtok_r(saveptr, "&", &saveptr);
  char* commitContents = strtok_r(saveptr, "$", &saveptr);
  
  char* sendbuff;

  //Search for a commit file that matches the one that the client sent
  char commits_path[strlen(projectName) + 10];
  memset(commits_path, 0, strlen(projectName) + 10);
  strcpy(commits_path, "./");
  strcat(commits_path, projectName);
  strcat(commits_path, "/Commits");
  DIR* dir = opendir(commits_path);

  int does_commit_exist = 0;
  char* activeCommit = malloc(256 * sizeof(char));
  memset(activeCommit, 0, 256);


  //If commits directory does not exist, alert client they must create one first
  if(dir == NULL){
    closedir(dir);
    sendbuff = "\nError: no commits exist on the server currently. Run the commit command before you push.";
    write(connfd, sendbuff, strlen(sendbuff));
    pthread_mutex_unlock(&lock);
    return;
  }else{
    struct dirent* ent;
    int newCommitName = 0;
    //for each dirent in the directory
    while((ent = readdir(dir)) != NULL){
      char* fname = ent->d_name;
      //if its a folder, skip over it
      if(strcmp(fname, ".") == 0 || strcmp(fname, "..") == 0 || ent->d_type  == DT_DIR){
        continue;

      //if it is not a folder, we can assume that the dirent is a file. Thus, we can open it and compare its contents to the message from the client
      }else{
        char pathOfCurrentCommit[strlen(projectName) + strlen(ent->d_name) + 9];
        strcpy(pathOfCurrentCommit, projectName);
        strcat(pathOfCurrentCommit, "/Commits/");
        strcat(pathOfCurrentCommit, ent->d_name);
        char* contents = readFile(pathOfCurrentCommit);
        if(strcmp(contents, commitContents) == 0){
          strcpy(activeCommit, "./");
          strcat(activeCommit, pathOfCurrentCommit);
          does_commit_exist = 1;
          break;
        }
      }
    }
  }
  closedir(dir);
  //If the commit exists on the server, delete all others
  if(does_commit_exist == 1){
    DIR* dir2 = opendir(commits_path);
    struct dirent* ent;
    char filepath[256];
    
    while((ent = readdir(dir2)) != NULL){
      if(ent->d_type == DT_DIR){
        continue;
      }
      sprintf(filepath, "%s/%s", commits_path, ent->d_name);
      if(strcmp(filepath, activeCommit) != 0){
        remove(filepath);
      }
      
    }
    closedir(dir2);

  //If the commit does not exist on the server, report that to the client
  }else{
    sendbuff = "\nError: no commit file exists on the server that matches the one you pushed. Please run the commit command before pushing.";
    write(connfd, sendbuff, strlen(sendbuff));
    pthread_mutex_unlock(&lock);
    return;
  }



  

  //Get the current project's version number to name the archive
  char manifestPath[strlen(projectName) + 10];
  strcpy(manifestPath, projectName);
  strcat(manifestPath, "/.Manifest");
  char* manifest_contents = readFile(manifestPath);
  char* aptr = manifest_contents;
  char* version_num = strtok_r(aptr, "\n", &aptr);
  char* aptr2 = version_num;
  version_num = strtok_r(aptr2, " ", &aptr2);
  version_num = strtok_r(aptr2, " ", &aptr2);
  //Store the current project in an archive
  char historyPath[strlen(projectName) + 100];
  strcpy(historyPath, projectName);
  strcat(historyPath, "/History");
  strcat(historyPath, "/");
  DIR* historydir = opendir(historyPath);
  if(historydir == NULL){
    int result = mkdir(historyPath, 0777);
  }
  char cmd[100];
  sprintf(cmd, "cp -avr %s %s", projectName, version_num);
  system(cmd);
  sprintf(cmd, "mv %s %s", version_num, historyPath);
  system(cmd);
  
  int vnum = atoi(version_num);
  vnum++;

  //prepare the write to the new manifest
  char manifestWrite[1000];
  memset(manifestWrite, '\0', 1000);
  sprintf(manifestWrite, "V %d\n", vnum);
  
  token = saveptr;
  int idx = 0;
  while(1){
    if(token[idx] == '\0' || idx > strlen(token)){
      break;
    }
    char file_name_sz[5];
    int subidx = 0;
    while(token[idx] != '&'){
      file_name_sz[subidx] = token[idx];
      idx++;
      subidx++;
    }
    idx++;
    int fn_size = atoi(file_name_sz);
    char file_name[fn_size + 1];
    memset(file_name, '\0', fn_size + 1);

    for(i = 0; i < fn_size; i++){
      file_name[i] = token[idx];
      idx++;
    }
    
    char file_sz[5];
    subidx = 0;
    idx++;
    while(token[idx] != '&'){
      file_sz[subidx] = token[idx];
      idx++;
      subidx++;
    }
    idx++;
    int file_size = atoi(file_sz);
    char file[file_size + 1];
    memset(file, '\0', file_size + 1);
    for(i = 0; i < file_size; i++){
      file[i] = token[idx];
      idx++;
    }
    idx++;


    if(file_name[0] == 'A'){
      char fn[strlen(file_name)+1];
      memset(fn, '\0', strlen(file_name) + 1);
      for(i = 1; i < strlen(file_name); i++){
        fn[i-1] = file_name[i];
      }
      fn[i] = '\0';

      int newFileFd = open(fn, O_WRONLY | O_CREAT, 0777);
      int b = write(newFileFd, file, strlen(file));
      close(newFileFd);

      strcat(manifestWrite, fn);
      strcat(manifestWrite, "~V:0~H:");
      strcat(manifestWrite, hashIt(file));
      strcat(manifestWrite, "\n");
    }else if(file_name[0] == 'D'){
      char fn[strlen(file_name)+1];
      memset(fn, '\0', strlen(file_name) + 1);
      for(i = 1; i < strlen(file_name); i++){
        fn[i-1] = file_name[i];
      }
      fn[i] = '\0';
      char cmdd[strlen(fn) + 8];
      strcpy(cmdd, "rm -rf ");
      strcat(cmdd, fn);
      system(cmdd);

    }else{
      char fn[strlen(file_name)+1];
      memset(fn, '\0', strlen(file_name) + 1);
      for(i = 1; i < strlen(file_name); i++){
        fn[i-1] = file_name[i];
      }
      fn[i] = '\0';

      int newFileFd = open(fn, O_WRONLY | O_CREAT, 0777);
      int b = write(newFileFd, file, strlen(file));
      close(newFileFd);

      char* idk = readFile(manifestPath);
      char* apointer = strstr(idk, fn);
      char* tokenizing = strtok_r(apointer, "~", &apointer);
      tokenizing = strtok_r(apointer, "~", &apointer);
      apointer = tokenizing;
      tokenizing = strtok_r(apointer, ":", &apointer);
      tokenizing = strtok_r(apointer, ":", &apointer);
      
      int newNum = atoi(tokenizing);
      newNum++;
      char buff[5];
      sprintf(buff, "%d", newNum);

      strcat(manifestWrite, fn);
      strcat(manifestWrite, "~V:");
      strcat(manifestWrite, buff);
      strcat(manifestWrite, "~H:");
      strcat(manifestWrite, hashIt(file));
      strcat(manifestWrite, "\n");

    }
    


  }
  

  int manfd = open(manifestPath, O_WRONLY | O_TRUNC);
  write(manfd, manifestWrite, strlen(manifestWrite));
  
  

  
  //Unlock the repository*/
  free(manifest_contents);
  closedir(historydir);
  sendbuff = "\nSuccessful push";
  write(connfd, sendbuff, strlen(sendbuff));
  pthread_mutex_unlock(&lock);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x830, %rsp            # imm = 0x830
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq 0x57f7(%rip), %rdi      # 0x7180
callq 0x1210
movq -0x8(%rbp), %rdi
callq 0x10c0
movq %rax, %rdx
decq %rdx
movq %rsp, %rcx
movq %rcx, -0x18(%rbp)
addq $0xe, %rax
andq $-0x10, %rax
movq %rsp, %rdi
subq %rax, %rdi
movq %rdi, -0x718(%rbp)
movq %rdi, %rsp
movq %rdx, -0x20(%rbp)
xorl %esi, %esi
callq 0x10e0
movl $0x2, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x720(%rbp)
movq -0x8(%rbp), %rdi
callq 0x10c0
movq %rax, %rcx
movq -0x720(%rbp), %rax
cmpq %rcx, %rax
jae 0x1a2a
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x1a1d
movq -0x718(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movb (%rcx,%rdx), %dl
movl -0x24(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x1a1f
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x19ce
movq -0x718(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x3a37(%rip), %rsi      # 0x5477
leaq -0x30(%rbp), %rdx
movq %rdx, -0x730(%rbp)
callq 0x1290
movq -0x730(%rbp), %rdx
movq %rax, -0x38(%rbp)
movw $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x3a2b(%rip), %rsi      # 0x549f
movq %rsi, -0x738(%rbp)
callq 0x1290
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdx
leaq 0x3c58(%rip), %rsi      # 0x56e7
xorl %eax, %eax
leaq -0x48(%rbp), %rdi
movq %rdi, -0x748(%rbp)
callq 0x1070
movq -0x748(%rbp), %rdi
callq 0x1250
movq -0x730(%rbp), %rdx
movl %eax, -0x54(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x39df(%rip), %rsi      # 0x54a1
movq %rsi, -0x740(%rbp)
callq 0x1290
movq -0x740(%rbp), %rsi
movq -0x730(%rbp), %rdx
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1290
movq -0x740(%rbp), %rsi
movq -0x730(%rbp), %rdx
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1290
movq -0x738(%rbp), %rsi
movq -0x730(%rbp), %rdx
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1290
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rdi
callq 0x10c0
movq %rax, %rdx
movq %rdx, %rax
addq $0xa, %rax
addq $0x19, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x728(%rbp)
movq %rcx, %rsp
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rdi
callq 0x10c0
movq -0x728(%rbp), %rdi
movq %rax, %rdx
addq $0xa, %rdx
xorl %esi, %esi
callq 0x10e0
movq -0x728(%rbp), %rdi
leaq 0x3994(%rip), %rsi      # 0x5512
callq 0x1160
movq -0x728(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x1270
movq -0x728(%rbp), %rdi
leaq 0x3974(%rip), %rsi      # 0x5515
callq 0x1270
movq -0x728(%rbp), %rdi
callq 0x1220
movq %rax, -0x78(%rbp)
movl $0x0, -0x7c(%rbp)
movl $0x100, %edi            # imm = 0x100
callq 0x11e0
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x10e0
cmpq $0x0, -0x78(%rbp)
jne 0x1c49
movq -0x78(%rbp), %rdi
callq 0x1260
leaq 0x3a00(%rip), %rax      # 0x55f8
movq %rax, -0x68(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x754(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x750(%rbp)
movq -0x68(%rbp), %rdi
callq 0x10c0
movl -0x754(%rbp), %edi
movq -0x750(%rbp), %rsi
movq %rax, %rdx
callq 0x10b0
leaq 0x554b(%rip), %rdi      # 0x7180
callq 0x1110
movl $0x1, -0x8c(%rbp)
jmp 0x29de
movl $0x0, -0x9c(%rbp)
movq -0x78(%rbp), %rdi
callq 0x1230
movq %rax, -0x98(%rbp)
cmpq $0x0, %rax
je 0x1dd7
movq -0x98(%rbp), %rax
addq $0x13, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
leaq 0x395f(%rip), %rsi      # 0x55ec
callq 0x11f0
cmpl $0x0, %eax
je 0x1cbf
movq -0xa8(%rbp), %rdi
leaq 0x3946(%rip), %rsi      # 0x55eb
callq 0x11f0
cmpl $0x0, %eax
je 0x1cbf
movq -0x98(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x4, %eax
jne 0x1cc1
jmp 0x1c53
movq -0x38(%rbp), %rdi
callq 0x10c0
movq %rax, -0x768(%rbp)
movq -0x98(%rbp), %rdi
addq $0x13, %rdi
callq 0x10c0
movq -0x768(%rbp), %rcx
movq %rax, %rdx
leaq 0x9(%rcx,%rdx), %rax
movq %rsp, %rsi
movq %rsi, -0xb0(%rbp)
leaq 0x18(%rcx,%rdx), %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0x760(%rbp)
movq %rdi, %rsp
movq %rax, -0xb8(%rbp)
movq -0x38(%rbp), %rsi
callq 0x1160
movq -0x760(%rbp), %rdi
leaq 0x38bd(%rip), %rsi      # 0x55ee
callq 0x1270
movq -0x760(%rbp), %rdi
movq -0x98(%rbp), %rsi
addq $0x13, %rsi
callq 0x1270
movq -0x760(%rbp), %rdi
callq 0x4cb0
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x11f0
cmpl $0x0, %eax
jne 0x1dae
movq -0x88(%rbp), %rdi
leaq 0x378f(%rip), %rsi      # 0x5512
callq 0x1160
movq -0x760(%rbp), %rsi
movq -0x88(%rbp), %rdi
callq 0x1270
movl $0x1, -0x7c(%rbp)
movl $0x6, -0x8c(%rbp)
jmp 0x1db8
movl $0x0, -0x8c(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, %rsp
movl -0x8c(%rbp), %eax
testl %eax, %eax
je 0x1dd0
jmp 0x1dce
jmp 0x1dd7
jmp 0x1dd2
jmp 0x1c53
jmp 0x1dd9
movq -0x78(%rbp), %rdi
callq 0x1260
cmpl $0x1, -0x7c(%rbp)
jne 0x1e85
movq -0x728(%rbp), %rdi
callq 0x1220
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x1230
movq %rax, -0xd0(%rbp)
cmpq $0x0, %rax
je 0x1e77
movq -0xd0(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x4, %eax
jne 0x1e2a
jmp 0x1dff
movq -0x728(%rbp), %rdx
leaq -0x1d0(%rbp), %rdi
movq -0xd0(%rbp), %rcx
addq $0x13, %rcx
leaq 0x3808(%rip), %rsi      # 0x5652
movb $0x0, %al
callq 0x1070
leaq -0x1d0(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x11f0
cmpl $0x0, %eax
je 0x1e75
leaq -0x1d0(%rbp), %rdi
callq 0x1280
jmp 0x1dff
movq -0xc8(%rbp), %rdi
callq 0x1260
jmp 0x1edd
leaq 0x37cc(%rip), %rax      # 0x5658
movq %rax, -0x68(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x774(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x770(%rbp)
movq -0x68(%rbp), %rdi
callq 0x10c0
movl -0x774(%rbp), %edi
movq -0x770(%rbp), %rsi
movq %rax, %rdx
callq 0x10b0
leaq 0x52b7(%rip), %rdi      # 0x7180
callq 0x1110
movl $0x1, -0x8c(%rbp)
jmp 0x29de
movq -0x38(%rbp), %rdi
callq 0x10c0
movq %rax, %rcx
movq %rcx, %rax
addq $0xa, %rax
addq $0x19, %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0x798(%rbp)
movq %rdi, %rsp
movq %rax, -0x1d8(%rbp)
movq -0x38(%rbp), %rsi
callq 0x1160
movq -0x798(%rbp), %rdi
leaq 0x353b(%rip), %rsi      # 0x5461
callq 0x1270
movq -0x798(%rbp), %rdi
callq 0x4cb0
movq %rax, -0x1e0(%rbp)
movq -0x1e0(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rdi
leaq 0x346f(%rip), %rsi      # 0x53c9
leaq -0x1e8(%rbp), %rdx
callq 0x1290
movq %rax, -0x1f0(%rbp)
movq -0x1f0(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq -0x1f8(%rbp), %rdi
leaq 0x34ee(%rip), %rsi      # 0x5477
movq %rsi, -0x790(%rbp)
leaq -0x1f8(%rbp), %rdx
movq %rdx, -0x788(%rbp)
callq 0x1290
movq -0x790(%rbp), %rsi
movq -0x788(%rbp), %rdx
movq %rax, -0x1f0(%rbp)
movq -0x1f8(%rbp), %rdi
callq 0x1290
movq %rax, -0x1f0(%rbp)
movq -0x38(%rbp), %rdi
callq 0x10c0
movq %rax, %rcx
movq %rcx, %rax
addq $0x64, %rax
addq $0x73, %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0x780(%rbp)
movq %rdi, %rsp
movq %rax, -0x200(%rbp)
movq -0x38(%rbp), %rsi
callq 0x1160
movq -0x780(%rbp), %rdi
leaq 0x36bf(%rip), %rsi      # 0x56d3
callq 0x1270
movq -0x780(%rbp), %rdi
leaq 0x34ec(%rip), %rsi      # 0x5513
callq 0x1270
movq -0x780(%rbp), %rdi
callq 0x1220
movq %rax, -0x208(%rbp)
cmpq $0x0, -0x208(%rbp)
jne 0x2060
movq -0x780(%rbp), %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x10d0
movl %eax, -0x20c(%rbp)
leaq -0x270(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x1f0(%rbp), %rcx
leaq 0x3663(%rip), %rsi      # 0x56dc
movb $0x0, %al
callq 0x1070
leaq -0x270(%rbp), %rdi
callq 0x1140
movq -0x780(%rbp), %rcx
leaq -0x270(%rbp), %rdi
movq -0x1f0(%rbp), %rdx
leaq 0x3642(%rip), %rsi      # 0x56ea
movb $0x0, %al
callq 0x1070
leaq -0x270(%rbp), %rdi
callq 0x1140
movq -0x1f0(%rbp), %rdi
callq 0x1250
movl %eax, -0x274(%rbp)
movl -0x274(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x274(%rbp)
leaq -0x660(%rbp), %rdi
xorl %esi, %esi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x10e0
leaq -0x660(%rbp), %rdi
movl -0x274(%rbp), %edx
leaq 0x35f0(%rip), %rsi      # 0x56f3
movb $0x0, %al
callq 0x1070
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x664(%rbp)
jmp 0x211e
movq -0x50(%rbp), %rax
movslq -0x664(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x2158
movslq -0x664(%rbp), %rax
movq %rax, -0x7a0(%rbp)
movq -0x50(%rbp), %rdi
callq 0x10c0
movq %rax, %rcx
movq -0x7a0(%rbp), %rax
cmpq %rcx, %rax
jbe 0x215d
jmp 0x291f
movl $0x0, -0x670(%rbp)
movq -0x50(%rbp), %rax
movslq -0x664(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x26, %eax
je 0x21b7
movq -0x50(%rbp), %rax
movslq -0x664(%rbp), %rcx
movb (%rax,%rcx), %cl
movslq -0x670(%rbp), %rax
movb %cl, -0x669(%rbp,%rax)
movl -0x664(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x664(%rbp)
movl -0x670(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x670(%rbp)
jmp 0x2167
movl -0x664(%rbp), %eax
incl %eax
movl %eax, -0x664(%rbp)
leaq -0x669(%rbp), %rdi
callq 0x1250
movl %eax, -0x674(%rbp)
movl -0x674(%rbp), %eax
incl %eax
movq %rsp, %rcx
movq %rcx, -0x680(%rbp)
movq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0x7a8(%rbp)
movq %rdi, %rsp
movq %rax, -0x688(%rbp)
movl -0x674(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x10e0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x674(%rbp), %eax
jge 0x2266
movq -0x7a8(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq -0x664(%rbp), %rdx
movb (%rcx,%rdx), %dl
movslq -0x24(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x664(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x664(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2225
movl $0x0, -0x670(%rbp)
movl -0x664(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x664(%rbp)
movq -0x50(%rbp), %rax
movslq -0x664(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x26, %eax
je 0x22cf
movq -0x50(%rbp), %rax
movslq -0x664(%rbp), %rcx
movb (%rax,%rcx), %cl
movslq -0x670(%rbp), %rax
movb %cl, -0x68d(%rbp,%rax)
movl -0x664(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x664(%rbp)
movl -0x670(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x670(%rbp)
jmp 0x227f
movl -0x664(%rbp), %eax
incl %eax
movl %eax, -0x664(%rbp)
leaq -0x68d(%rbp), %rdi
callq 0x1250
movl %eax, -0x694(%rbp)
movl -0x694(%rbp), %eax
incl %eax
movq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0x7b0(%rbp)
movq %rdi, %rsp
movq %rax, -0x6a0(%rbp)
movl -0x694(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x10e0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x694(%rbp), %eax
jge 0x2374
movq -0x7b0(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq -0x664(%rbp), %rdx
movb (%rcx,%rdx), %dl
movslq -0x24(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x664(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x664(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2333
movq -0x7a8(%rbp), %rax
movl -0x664(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x664(%rbp)
movsbl (%rax), %eax
cmpl $0x41, %eax
jne 0x2523
movq -0x7a8(%rbp), %rdi
callq 0x10c0
movq -0x7a8(%rbp), %rdi
movq %rax, %rdx
movq %rdx, %rax
incq %rax
movq %rsp, %rcx
movq %rcx, -0x6a8(%rbp)
addq $0x10, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x7b8(%rbp)
movq %rcx, %rsp
movq %rax, -0x6b0(%rbp)
callq 0x10c0
movq -0x7b8(%rbp), %rdi
movq %rax, %rdx
addq $0x1, %rdx
xorl %esi, %esi
callq 0x10e0
movl $0x1, -0x24(%rbp)
movq -0x7a8(%rbp), %rdi
movslq -0x24(%rbp), %rax
movq %rax, -0x7c0(%rbp)
callq 0x10c0
movq %rax, %rcx
movq -0x7c0(%rbp), %rax
cmpq %rcx, %rax
jae 0x244e
movq -0x7b8(%rbp), %rax
movq -0x7a8(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movb (%rcx,%rdx), %dl
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x23fc
movq -0x7b8(%rbp), %rdi
movslq -0x24(%rbp), %rax
movb $0x0, (%rdi,%rax)
movl $0x41, %esi
movl $0x1ff, %edx            # imm = 0x1FF
movb $0x0, %al
callq 0x1100
movq -0x7b0(%rbp), %rdi
movl %eax, -0x6b4(%rbp)
movl -0x6b4(%rbp), %eax
movl %eax, -0x7cc(%rbp)
callq 0x10c0
movl -0x7cc(%rbp), %edi
movq -0x7b0(%rbp), %rsi
movq %rax, %rdx
callq 0x10b0
movl %eax, -0x6b8(%rbp)
movl -0x6b4(%rbp), %edi
callq 0x12b0
movq -0x7b8(%rbp), %rsi
leaq -0x660(%rbp), %rdi
callq 0x1270
leaq -0x660(%rbp), %rdi
leaq 0x3226(%rip), %rsi      # 0x56f9
callq 0x1270
movq -0x7b0(%rbp), %rdi
leaq -0x660(%rbp), %rax
movq %rax, -0x7c8(%rbp)
callq 0x4d90
movq -0x7c8(%rbp), %rdi
movq %rax, %rsi
callq 0x1270
leaq -0x660(%rbp), %rdi
leaq 0x2eba(%rip), %rsi      # 0x53c9
callq 0x1270
movq -0x6a8(%rbp), %rax
movq %rax, %rsp
jmp 0x2910
movq -0x7a8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x44, %eax
jne 0x2665
movq -0x7a8(%rbp), %rdi
callq 0x10c0
movq -0x7a8(%rbp), %rdi
movq %rax, %rdx
movq %rdx, %rax
incq %rax
movq %rsp, %rcx
movq %rcx, -0x6c0(%rbp)
addq $0x10, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x7d8(%rbp)
movq %rcx, %rsp
movq %rax, -0x6c8(%rbp)
callq 0x10c0
movq -0x7d8(%rbp), %rdi
movq %rax, %rdx
addq $0x1, %rdx
xorl %esi, %esi
callq 0x10e0
movl $0x1, -0x24(%rbp)
movq -0x7a8(%rbp), %rdi
movslq -0x24(%rbp), %rax
movq %rax, -0x7e0(%rbp)
callq 0x10c0
movq %rax, %rcx
movq -0x7e0(%rbp), %rax
cmpq %rcx, %rax
jae 0x25ee
movq -0x7d8(%rbp), %rax
movq -0x7a8(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movb (%rcx,%rdx), %dl
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x259c
movq -0x7d8(%rbp), %rdi
movslq -0x24(%rbp), %rax
movb $0x0, (%rdi,%rax)
callq 0x10c0
movq %rax, %rcx
movq %rcx, %rax
addq $0x8, %rax
addq $0x17, %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0x7e8(%rbp)
movq %rdi, %rsp
movq %rax, -0x6d0(%rbp)
leaq 0x2e3f(%rip), %rsi      # 0x5471
callq 0x1160
movq -0x7d8(%rbp), %rsi
movq -0x7e8(%rbp), %rdi
callq 0x1270
movq -0x7e8(%rbp), %rdi
callq 0x1140
movq -0x6c0(%rbp), %rax
movq %rax, %rsp
jmp 0x290e
movq -0x7a8(%rbp), %rdi
callq 0x10c0
movq -0x7a8(%rbp), %rdi
movq %rax, %rdx
movq %rdx, %rax
incq %rax
movq %rsp, %rcx
movq %rcx, -0x6d8(%rbp)
addq $0x10, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x7f0(%rbp)
movq %rcx, %rsp
movq %rax, -0x6e0(%rbp)
callq 0x10c0
movq -0x7f0(%rbp), %rdi
movq %rax, %rdx
addq $0x1, %rdx
xorl %esi, %esi
callq 0x10e0
movl $0x1, -0x24(%rbp)
movq -0x7a8(%rbp), %rdi
movslq -0x24(%rbp), %rax
movq %rax, -0x7f8(%rbp)
callq 0x10c0
movq %rax, %rcx
movq -0x7f8(%rbp), %rax
cmpq %rcx, %rax
jae 0x271d
movq -0x7f0(%rbp), %rax
movq -0x7a8(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movb (%rcx,%rdx), %dl
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x26cb
movq -0x7f0(%rbp), %rdi
movslq -0x24(%rbp), %rax
movb $0x0, (%rdi,%rax)
movl $0x41, %esi
movl $0x1ff, %edx            # imm = 0x1FF
movb $0x0, %al
callq 0x1100
movq -0x7b0(%rbp), %rdi
movl %eax, -0x6e4(%rbp)
movl -0x6e4(%rbp), %eax
movl %eax, -0x804(%rbp)
callq 0x10c0
movl -0x804(%rbp), %edi
movq -0x7b0(%rbp), %rsi
movq %rax, %rdx
callq 0x10b0
movl %eax, -0x6e8(%rbp)
movl -0x6e4(%rbp), %edi
callq 0x12b0
movq -0x798(%rbp), %rdi
callq 0x4cb0
movq -0x7f0(%rbp), %rsi
movq %rax, -0x6f0(%rbp)
movq -0x6f0(%rbp), %rdi
callq 0x1080
movq %rax, -0x6f8(%rbp)
movq -0x6f8(%rbp), %rdi
leaq 0x2d18(%rip), %rsi      # 0x54d4
leaq -0x6f8(%rbp), %rdx
callq 0x1290
movq %rax, -0x700(%rbp)
movq -0x6f8(%rbp), %rdi
leaq 0x2cf7(%rip), %rsi      # 0x54d4
leaq -0x6f8(%rbp), %rdx
callq 0x1290
movq %rax, -0x700(%rbp)
movq -0x700(%rbp), %rax
movq %rax, -0x6f8(%rbp)
movq -0x6f8(%rbp), %rdi
leaq 0x2ef3(%rip), %rsi      # 0x56ff
leaq -0x6f8(%rbp), %rdx
callq 0x1290
movq %rax, -0x700(%rbp)
movq -0x6f8(%rbp), %rdi
leaq 0x2ed2(%rip), %rsi      # 0x56ff
leaq -0x6f8(%rbp), %rdx
callq 0x1290
movq %rax, -0x700(%rbp)
movq -0x700(%rbp), %rdi
callq 0x1250
movl %eax, -0x704(%rbp)
movl -0x704(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x704(%rbp)
leaq -0x709(%rbp), %rdi
movl -0x704(%rbp), %edx
leaq 0x2c5c(%rip), %rsi      # 0x54d1
movb $0x0, %al
callq 0x1070
movq -0x7f0(%rbp), %rsi
leaq -0x660(%rbp), %rdi
callq 0x1270
leaq -0x660(%rbp), %rdi
leaq 0x2e64(%rip), %rsi      # 0x5701
callq 0x1270
leaq -0x660(%rbp), %rdi
leaq -0x709(%rbp), %rsi
callq 0x1270
leaq -0x660(%rbp), %rdi
leaq 0x2e3a(%rip), %rsi      # 0x56fd
callq 0x1270
movq -0x7b0(%rbp), %rdi
leaq -0x660(%rbp), %rax
movq %rax, -0x800(%rbp)
callq 0x4d90
movq -0x800(%rbp), %rdi
movq %rax, %rsi
callq 0x1270
leaq -0x660(%rbp), %rdi
leaq 0x2aca(%rip), %rsi      # 0x53c9
callq 0x1270
movq -0x6d8(%rbp), %rax
movq %rax, %rsp
jmp 0x2910
movq -0x680(%rbp), %rax
movq %rax, %rsp
jmp 0x211c
movq -0x798(%rbp), %rdi
movl $0x201, %esi            # imm = 0x201
movb $0x0, %al
callq 0x1100
movl %eax, -0x710(%rbp)
movl -0x710(%rbp), %eax
movl %eax, -0x824(%rbp)
leaq -0x660(%rbp), %rax
movq %rax, -0x820(%rbp)
leaq -0x660(%rbp), %rdi
callq 0x10c0
movl -0x824(%rbp), %edi
movq -0x820(%rbp), %rsi
movq %rax, %rdx
callq 0x10b0
movq -0x1e0(%rbp), %rdi
callq 0x11a0
movq -0x208(%rbp), %rdi
callq 0x1260
leaq 0x2d73(%rip), %rax      # 0x5705
movq %rax, -0x68(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x814(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x810(%rbp)
movq -0x68(%rbp), %rdi
callq 0x10c0
movl -0x814(%rbp), %edi
movq -0x810(%rbp), %rsi
movq %rax, %rdx
callq 0x10b0
leaq 0x47b1(%rip), %rdi      # 0x7180
callq 0x1110
movl $0x0, -0x8c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)