// File: /workspace/github_c_makefile_star2_O0/evanwire[P]GitClone/client.c
// Function: currentVersion
void currentVersion(char* projectName){
  //Prepare message to server
  int i;
  char to_be_written[strlen(projectName) + 3];
  memset(to_be_written, 0, sizeof(to_be_written));
  to_be_written[0] = 'v';
  to_be_written[1] = ' ';
  int message_idx = 2;
  for(i = 0; i < strlen(projectName); i++){
    if(projectName[i]){
      to_be_written[message_idx] = projectName[i];
      message_idx++;
    }
  }
  printf("\nWritten to server: -%s- Size: %d passed in: -%s-\n", to_be_written, sizeof(to_be_written), projectName);

  //Connect to server, store the response
  char* response = connect_to_WTFserver(to_be_written);

  //Report if server responded with an error
  /*
    TODO: Make a method for receiving and alerting user of errors
      -Basically, if the server response begins with a certain character or some indicator of an error, it will send the server response to that method which will print
        the error message out to the user, without including the indicator we decide to use.
  */
  if(strcmp(response, "x") == 0){
    printf("\nError: The specified project does not exist on the server. Please check the project name and try again.\n");
    exit(1);
  }else if(strcmp(response, "e") == 0){
    printf("\nError: The server ran into an error processing your request. Please try again.\n");
    exit(1);
  }

  printf("Here is the current version of the project and its contained files:\n");
  printf("%s\n",response);
  free(response);

  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x10b0
movq %rax, %rdx
addq $0x3, %rdx
movq %rdx, -0x40(%rbp)
movq %rsp, %rcx
movq %rcx, -0x18(%rbp)
addq $0x12, %rax
andq $-0x10, %rax
movq %rsp, %rdi
subq %rax, %rdi
movq %rdi, -0x38(%rbp)
movq %rdi, %rsp
movq %rdx, -0x20(%rbp)
xorl %esi, %esi
callq 0x10d0
movq -0x38(%rbp), %rax
movb $0x76, (%rax)
movb $0x20, 0x1(%rax)
movl $0x2, -0x24(%rbp)
movl $0x0, -0xc(%rbp)
movslq -0xc(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x10b0
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq %rcx, %rax
jae 0x5b27
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x5b1a
movq -0x38(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
movb (%rcx,%rdx), %dl
movslq -0x24(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5b1c
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x5ad0
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x8(%rbp), %rcx
leaq 0x19a8(%rip), %rdi      # 0x74e2
movb $0x0, %al
callq 0x1040
movq -0x38(%rbp), %rdi
callq 0x5be0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x2081(%rip), %rsi      # 0x7bda
callq 0x1190
cmpl $0x0, %eax
jne 0x5b7b
leaq 0x2154(%rip), %rdi      # 0x7cbe
movb $0x0, %al
callq 0x1040
movl $0x1, %edi
callq 0x1170
movq -0x30(%rbp), %rdi
leaq 0x14ef(%rip), %rsi      # 0x7075
callq 0x1190
cmpl $0x0, %eax
jne 0x5ba8
leaq 0x1a09(%rip), %rdi      # 0x75a0
movb $0x0, %al
callq 0x1040
movl $0x1, %edi
callq 0x1170
jmp 0x5baa
leaq 0x2177(%rip), %rdi      # 0x7d28
movb $0x0, %al
callq 0x1040
movq -0x30(%rbp), %rsi
leaq 0x1aea(%rip), %rdi      # 0x76ad
movb $0x0, %al
callq 0x1040
movq -0x30(%rbp), %rdi
callq 0x1160
movq -0x18(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nop