#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct sockaddr {
  int dummy;
};
struct addrinfo {
  scalar_t__ ai_addr;
  int /*<<< orphan*/ ai_family;
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  struct addrinfo *ai_next;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
char *calloc(int, int);
int /*<<< orphan*/ close(int);
int connect(int, scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
char *gai_strerror(int);
int /*<<< orphan*/ get_in_addr(struct sockaddr *);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
char getchar();
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                             int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
scalar_t__ strtol(char *, char **, int);
char tolower(char);
int main(int argc, char *argv[]) {
  int sockfd, numbytes;
  char buf[100];
  struct addrinfo hints, *servinfo, *p;
  int rv;
  char s[INET6_ADDRSTRLEN];
  char cmd = 't';
  if (argc != 2) {
    fprintf(stderr, "usage: client hostname\n");
    exit(1);
  }
  memset(&hints, 0, sizeof hints);
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  while (cmd != 'q') {
    if ((rv = getaddrinfo(argv[1], "3527", &hints, &servinfo)) != 0) {
      fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
      return 1;
    }
    for (p = servinfo; p != NULL; p = p->ai_next) {
      if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) ==
          -1) {
        perror("client: socket");
        continue;
      }
      if (connect(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
        close(sockfd);
        perror("client: connect");
        continue;
      }
      break;
    }
    if (p == NULL) {
      fprintf(stderr, "client: failed to connect\n");
      return 2;
    }
    inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), s,
              sizeof s);
    printf("client: connecting to %s\n", s);
    char filename[100];
    freeaddrinfo(servinfo);
    printf("............Welcome to the MC Command Hub.............\n");
    printf("Please input your command........'input: h for help'..\n");
    scanf("%c", &cmd);
    while (getchar() != '\n')
      continue;
    if (cmd == 'h') {
      printf("Please make your selection from the following commands\n");
      printf("'l' = List contents of server.....ex(l)...............\n");
      printf("'c' = Check for a file name.......ex(c <filename>)....\n");
      printf("'d' = Download file name..........ex(d <filename>)....\n");
      printf("'p' = Display file name...........ex(p <filename>)....\n");
      printf("'q' = Quit............................................\n");
    }
    if (cmd == 'l') {
      send(sockfd, "list", 4, 0);
      numbytes = recv(sockfd, buf, 100 - 1, 0);
      buf[numbytes] = '\0';
      printf("%s\n", buf);
    }
    if (cmd == 'c') {
      char ans[3];
      int numb;
      send(sockfd, "chek", 4, 0);
      printf("Which file do you want to check for?:\n");
      scanf("%s", &filename);
      while (getchar() != '\n')
        continue;
      send(sockfd, filename, 100, 0);
      numb = recv(sockfd, buf, 100 - 1, 0);
      buf[numb] = '\0';
      if (!strcmp(buf, "yes"))
        printf("File was found\n");
      else
        printf("File was not found\n");
    }
    if (cmd == 'p') {
      send(sockfd, "disp", 50, 0);
      printf("enter file name: \n");
      scanf("%s", &filename);
      int filesize;
      char sizeofFile[20] = {0};
      send(sockfd, filename, 100, 0);
      numbytes = recv(sockfd, sizeofFile, 20, 0);
      filesize = (int)strtol(sizeofFile, (char **)NULL, 10);
      printf("Size file: %d \n", filesize);
      if (filesize == 0) {
        printf("File not found");
        continue;
      } else {
        char *filebuff = calloc(filesize + 1, sizeof(char));
        sleep(1);
        numbytes = recv(sockfd, filebuff, filesize, 0);
        printf("contents : \n%s", filebuff);
      }
    }
    if (cmd == 'd') {
      send(sockfd, "disp", 50, 0);
      printf("Enter File Name: \n");
      scanf("%s", &filename);
      int filesize;
      char sizeofFile[20] = {0};
      send(sockfd, filename, 100, 0);
      numbytes = recv(sockfd, sizeofFile, 20, 0);
      filesize = (int)strtol(sizeofFile, (char **)NULL, 10);
      printf("File Size: %d \n", filesize);
      if (filesize == 0) {
        printf("File Not Found");
        continue;
      } else {
        char *filebuff = calloc(filesize + 1, sizeof(char));
        sleep(1);
        numbytes = recv(sockfd, filebuff, filesize, 0);
        printf("File Downloaded from Server\n");
        printf("Save as: ");
        scanf("%s", &filename);
        FILE *fp;
        fp = fopen(filename, "r");
        if (fp != NULL) {
          char choice[5];
          printf("File %s exists. Do you want to override? (y/n): ", filename);
          scanf("%4s", &choice);
          if (tolower(choice[0]) == 'n') {
            fclose(fp);
            free(filebuff);
            continue;
          }
        }
        fp = fopen(filename, "w");
        if (NULL == fp) {
          printf("Error Opening File");
          return 1;
        }
        fwrite(filebuff, 1, filesize, fp);
        fclose(fp);
        free(filebuff);
      }
    }
    if (cmd == 'q') {
      break;
    }
  }
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2d28(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x1a8(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0xc0(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1a0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc8(%rbp)
movb   $0x74,-0xc9(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1327 <main+0x87>
mov    0x2cc3(%rip),%rax
mov    (%rax),%edi
lea    0xcea(%rip),%rsi
mov    $0x0,%al
call   1100 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10b0 <memset@plt>
mov    0x2c9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x98(%rbp)
mov    0x2c78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
movsbl -0xc9(%rbp),%eax
cmp    $0x71,%eax
je     1ab6 <main+0x816>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xca1(%rip),%rsi
lea    -0xa0(%rbp),%rdx
lea    -0xa8(%rbp),%rcx
call   1190 <getaddrinfo@plt>
mov    %eax,-0xb4(%rbp)
cmp    $0x0,%eax
je     13e0 <main+0x140>
mov    0x2c30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1ac(%rbp)
mov    -0xb4(%rbp),%edi
call   10a0 <gai_strerror@plt>
mov    -0x1ac(%rbp),%edi
mov    %rax,%rdx
lea    0xc5a(%rip),%rsi
mov    $0x0,%al
call   1100 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0xd0(%rbp)
jmp    1acf <main+0x82f>
mov    -0xa8(%rbp),%rax
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0xb0(%rbp)
je     1496 <main+0x1f6>
mov    -0xb0(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0xb0(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0xb0(%rbp),%rax
mov    0x10(%rax),%edx
call   11c0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    143c <main+0x19c>
lea    0xbfc(%rip),%rdi
call   1150 <perror@plt>
jmp    147f <main+0x1df>
mov    -0x14(%rbp),%edi
mov    -0xb0(%rbp),%rax
mov    (%rax),%rsi
mov    -0xb0(%rbp),%rax
mov    0xc(%rax),%edx
call   1170 <connect@plt>
cmp    $0xffffffff,%eax
jne    147a <main+0x1da>
mov    -0x14(%rbp),%edi
call   10c0 <close@plt>
lea    0xbcd(%rip),%rdi
call   1150 <perror@plt>
jmp    147f <main+0x1df>
jmp    1496 <main+0x1f6>
mov    -0xb0(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0xb0(%rbp)
jmp    13ee <main+0x14e>
cmpq   $0x0,-0xb0(%rbp)
jne    14d1 <main+0x231>
mov    0x2b25(%rip),%rax
mov    (%rax),%edi
lea    0xb99(%rip),%rsi
mov    $0x0,%al
call   1100 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0xd0(%rbp)
jmp    1acf <main+0x82f>
mov    -0xb0(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x1b0(%rbp)
mov    -0xb0(%rbp),%rax
mov    (%rax),%rdi
call   1060 <get_in_addr@plt>
mov    -0x1b0(%rbp),%edi
mov    -0x1a0(%rbp),%rdx
mov    %eax,%esi
mov    -0x1a8(%rbp),%rax
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0x1a0(%rbp),%rsi
lea    0xb4d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0xa8(%rbp),%rdi
call   11b0 <freeaddrinfo@plt>
lea    0xb4d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xb77(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xba1(%rip),%rdi
lea    -0xc9(%rbp),%rsi
mov    $0x0,%al
call   1130 <scanf@plt>
mov    $0x0,%al
call   10f0 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1577 <main+0x2d7>
jmp    155f <main+0x2bf>
movsbl -0xc9(%rbp),%eax
cmp    $0x68,%eax
jne    15db <main+0x33b>
lea    0xb67(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xb91(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xbbb(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xbe5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xc0f(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xc39(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movsbl -0xc9(%rbp),%eax
cmp    $0x6c,%eax
jne    1632 <main+0x392>
mov    -0x14(%rbp),%edi
lea    0xc50(%rip),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    -0x14(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x63,%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
lea    -0x80(%rbp),%rsi
lea    0x9ff(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movsbl -0xc9(%rbp),%eax
cmp    $0x63,%eax
jne    170d <main+0x46d>
mov    -0x14(%rbp),%edi
lea    0xbfe(%rip),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
lea    0xbf0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xc74(%rip),%rdi
lea    -0x140(%rbp),%rsi
mov    $0x0,%al
call   1130 <scanf@plt>
mov    $0x0,%al
call   10f0 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1693 <main+0x3f3>
jmp    167b <main+0x3db>
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    -0x14(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x63,%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
mov    %eax,-0x148(%rbp)
movslq -0x148(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
lea    -0x80(%rbp),%rdi
lea    0xb9d(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%eax
jne    16fa <main+0x45a>
lea    0xb8c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1708 <main+0x468>
lea    0xb89(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    170d <main+0x46d>
movsbl -0xc9(%rbp),%eax
cmp    $0x70,%eax
jne    183f <main+0x59f>
mov    -0x14(%rbp),%edi
lea    0xb77(%rip),%rsi
mov    $0x32,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
lea    0xb69(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xb99(%rip),%rdi
lea    -0x140(%rbp),%rsi
mov    $0x0,%al
call   1130 <scanf@plt>
lea    -0x160(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    -0x14(%rbp),%edi
lea    -0x160(%rbp),%rsi
mov    $0x14,%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
mov    %eax,-0x18(%rbp)
lea    -0x160(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1110 <strtol@plt>
mov    %eax,-0x14c(%rbp)
mov    -0x14c(%rbp),%esi
lea    0xaf6(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x14c(%rbp)
jne    17e7 <main+0x547>
lea    0xaeb(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1358 <main+0xb8>
mov    -0x14c(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x168(%rbp)
mov    $0x1,%edi
call   11a0 <sleep@plt>
mov    -0x14(%rbp),%edi
mov    -0x168(%rbp),%rsi
mov    -0x14c(%rbp),%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
mov    %eax,-0x18(%rbp)
mov    -0x168(%rbp),%rsi
lea    0xaa2(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    183f <main+0x59f>
movsbl -0xc9(%rbp),%eax
cmp    $0x64,%eax
jne    1a9c <main+0x7fc>
mov    -0x14(%rbp),%edi
lea    0xa45(%rip),%rsi
mov    $0x32,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
lea    0xa78(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xa67(%rip),%rdi
lea    -0x140(%rbp),%rsi
mov    $0x0,%al
call   1130 <scanf@plt>
lea    -0x180(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    -0x14(%rbp),%edi
lea    -0x180(%rbp),%rsi
mov    $0x14,%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
mov    %eax,-0x18(%rbp)
lea    -0x180(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1110 <strtol@plt>
mov    %eax,-0x16c(%rbp)
mov    -0x16c(%rbp),%esi
lea    0xa05(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x16c(%rbp)
jne    1919 <main+0x679>
lea    0x9fa(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1358 <main+0xb8>
mov    -0x16c(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x188(%rbp)
mov    $0x1,%edi
call   11a0 <sleep@plt>
mov    -0x14(%rbp),%edi
mov    -0x188(%rbp),%rsi
mov    -0x16c(%rbp),%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
mov    %eax,-0x18(%rbp)
lea    0x9b8(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0x9c7(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0x967(%rip),%rdi
lea    -0x140(%rbp),%rsi
mov    $0x0,%al
call   1130 <scanf@plt>
lea    -0x140(%rbp),%rdi
lea    0x9a7(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x190(%rbp)
cmpq   $0x0,-0x190(%rbp)
je     1a14 <main+0x774>
lea    -0x140(%rbp),%rsi
lea    0x981(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0x9a4(%rip),%rdi
lea    -0x195(%rbp),%rsi
mov    $0x0,%al
call   1130 <scanf@plt>
movsbl -0x195(%rbp),%edi
call   1120 <tolower@plt>
movsbl %al,%eax
cmp    $0x6e,%eax
jne    1a0f <main+0x76f>
mov    -0x190(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x188(%rbp),%rdi
call   1040 <free@plt>
jmp    1358 <main+0xb8>
jmp    1a14 <main+0x774>
lea    -0x140(%rbp),%rdi
lea    0x952(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x190(%rbp)
xor    %eax,%eax
cmp    -0x190(%rbp),%rax
jne    1a61 <main+0x7c1>
lea    0x932(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0xd0(%rbp)
jmp    1acf <main+0x82f>
mov    -0x188(%rbp),%rdi
mov    -0x16c(%rbp),%edx
mov    -0x190(%rbp),%rcx
mov    $0x1,%esi
call   1180 <fwrite@plt>
mov    -0x190(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x188(%rbp),%rdi
call   1040 <free@plt>
jmp    1a9c <main+0x7fc>
movsbl -0xc9(%rbp),%eax
cmp    $0x71,%eax
jne    1ab1 <main+0x811>
jmp    1ab6 <main+0x816>
jmp    1358 <main+0xb8>
mov    -0x14(%rbp),%edi
call   10c0 <close@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xd0(%rbp)
mov    -0xc0(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
mov    %rsi,-0x88(%rbp)
mov    %rsp,-0x78(%rbp)
mov    0x2d22(%rip),%rax
mov    (%rax),%r13d
mov    %rsp,%rcx
lea    0xf(%r13),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x80(%rbp)
mov    %rcx,%rsp
movb   $0x74,-0x29(%rbp)
cmp    $0x2,%edi
jne    18e4 <main+0x644>
lea    -0xa8(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10c0 <memset@plt>
mov    0x2cdb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa0(%rbp)
mov    0x2cb4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
lea    0xd7c(%rip),%r15
mov    %r13,-0x38(%rbp)
jmp    1342 <main+0xa2>
nopl   0x0(%rax)
cmp    $0x71,%al
je     188d <main+0x5ed>
cmpb   $0x71,-0x29(%rbp)
je     188d <main+0x5ed>
mov    -0x88(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcd4(%rip),%rsi
lea    -0xa8(%rbp),%rdx
lea    -0x50(%rbp),%rcx
call   1190 <getaddrinfo@plt>
test   %eax,%eax
jne    1899 <main+0x5f9>
mov    -0x50(%rbp),%rbx
test   %rbx,%rbx
je     186f <main+0x5cf>
mov    0x14(%rbx),%esi
mov    0x8(%rbx),%edi
mov    0x10(%rbx),%edx
call   11c0 <socket@plt>
lea    0xcb0(%rip),%rdi
cmp    $0xffffffff,%eax
je     13b7 <main+0x117>
mov    %eax,%r12d
mov    (%rbx),%rsi
mov    0xc(%rbx),%edx
mov    %eax,%edi
call   1170 <connect@plt>
cmp    $0xffffffff,%eax
jne    13d0 <main+0x130>
mov    %r12d,%edi
call   10d0 <close@plt>
lea    0xc96(%rip),%rdi
call   1150 <perror@plt>
mov    0x18(%rbx),%rbx
test   %rbx,%rbx
jne    1379 <main+0xd9>
jmp    186f <main+0x5cf>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rbx),%r14d
mov    (%rbx),%rdi
call   1060 <get_in_addr@plt>
mov    %r14d,%edi
mov    %eax,%esi
mov    -0x80(%rbp),%rbx
mov    %rbx,%rdx
mov    %r13d,%ecx
call   1030 <inet_ntop@plt>
lea    0xc81(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    -0x50(%rbp),%rdi
call   11b0 <freeaddrinfo@plt>
lea    0xd34(%rip),%rdi
call   1070 <puts@plt>
lea    0xd5f(%rip),%rdi
call   1070 <puts@plt>
lea    0xc69(%rip),%rdi
lea    -0x29(%rbp),%rsi
xor    %eax,%eax
call   1130 <scanf@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   10f0 <getchar@plt>
cmp    $0xa,%al
jne    1440 <main+0x1a0>
mov    -0x29(%rbp),%al
cmp    $0x68,%al
lea    0xc78(%rip),%r14
je     1480 <main+0x1e0>
cmp    $0x6c,%al
je     14cf <main+0x22f>
cmp    $0x63,%al
je     151b <main+0x27b>
cmp    $0x70,%al
je     15bd <main+0x31d>
cmp    $0x64,%al
jne    1330 <main+0x90>
jmp    169b <main+0x3fb>
nopw   0x0(%rax,%rax,1)
lea    0xdb4(%rip),%rdi
call   1070 <puts@plt>
lea    0xddf(%rip),%rdi
call   1070 <puts@plt>
lea    0xe0a(%rip),%rdi
call   1070 <puts@plt>
lea    0xe35(%rip),%rdi
call   1070 <puts@plt>
lea    0xe60(%rip),%rdi
call   1070 <puts@plt>
lea    0xe8b(%rip),%rdi
call   1070 <puts@plt>
mov    -0x29(%rbp),%al
cmp    $0x6c,%al
jne    145d <main+0x1bd>
mov    %r12d,%edi
lea    0xbbc(%rip),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
mov    %r12d,%edi
lea    -0x180(%rbp),%rbx
mov    %rbx,%rsi
mov    $0x63,%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
cltq
movb   $0x0,-0x180(%rbp,%rax,1)
mov    %rbx,%rdi
call   1070 <puts@plt>
mov    -0x29(%rbp),%al
cmp    $0x63,%al
jne    1465 <main+0x1c5>
mov    %r12d,%edi
lea    0xb75(%rip),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
lea    0xcbb(%rip),%rdi
call   1070 <puts@plt>
mov    %r14,%rdi
lea    -0x110(%rbp),%rsi
xor    %eax,%eax
call   1130 <scanf@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   10f0 <getchar@plt>
cmp    $0xa,%al
jne    1550 <main+0x2b0>
mov    %r12d,%edi
lea    -0x110(%rbp),%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
mov    %r12d,%edi
lea    -0x180(%rbp),%rsi
mov    $0x63,%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
cltq
movb   $0x0,-0x180(%rbp,%rax,1)
cmpl   $0x736579,-0x180(%rbp)
lea    0xc86(%rip),%rdi
lea    0xc70(%rip),%rax
cmove  %rax,%rdi
call   1070 <puts@plt>
mov    -0x29(%rbp),%al
cmp    $0x70,%al
jne    146d <main+0x1cd>
mov    %r12d,%edi
mov    %r15,%rsi
mov    $0x32,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
lea    0xc0b(%rip),%rdi
call   1070 <puts@plt>
mov    %r14,%rdi
lea    -0x110(%rbp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1130 <scanf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,-0x70(%rbp)
movl   $0x0,-0x60(%rbp)
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
mov    %r12d,%edi
lea    -0x70(%rbp),%rbx
mov    %rbx,%rsi
mov    $0x14,%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1110 <strtol@plt>
mov    %rax,%rbx
lea    0xa66(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
test   %ebx,%ebx
je     17e2 <main+0x542>
lea    0x1(%rbx),%edi
mov    $0x1,%esi
call   10e0 <calloc@plt>
mov    %rax,%r14
mov    $0x1,%edi
call   11a0 <sleep@plt>
mov    %r12d,%edi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
lea    0xa44(%rip),%rdi
mov    %r14,%rsi
lea    0xa46(%rip),%r14
xor    %eax,%eax
call   10a0 <printf@plt>
mov    -0x29(%rbp),%al
cmp    $0x64,%al
jne    1330 <main+0x90>
mov    %r12d,%edi
mov    %r15,%rsi
mov    $0x32,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
lea    0xaff(%rip),%rdi
call   1070 <puts@plt>
mov    %r14,%rdi
lea    -0x110(%rbp),%r15
mov    %r15,%rsi
xor    %eax,%eax
call   1130 <scanf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,-0x70(%rbp)
movl   $0x0,-0x60(%rbp)
mov    %r12d,%edi
mov    %r15,%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
mov    %r12d,%edi
lea    -0x70(%rbp),%rbx
mov    %rbx,%rsi
mov    $0x14,%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1110 <strtol@plt>
mov    %r14,%r13
mov    %rax,%r14
lea    0x9b3(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
test   %r14d,%r14d
je     17f5 <main+0x555>
lea    0x1(%r14),%edi
mov    $0x1,%esi
call   10e0 <calloc@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   11a0 <sleep@plt>
mov    %r12d,%edi
mov    %rbx,-0x48(%rbp)
mov    %rbx,%rsi
mov    %r14d,%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
lea    0xa5d(%rip),%rdi
call   1070 <puts@plt>
lea    0x97d(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1130 <scanf@plt>
mov    %r15,%rdi
lea    0xa4d(%rip),%rsi
call   1140 <fopen@plt>
test   %rax,%rax
je     181a <main+0x57a>
mov    %rax,%r13
lea    0x955(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
lea    0x975(%rip),%rdi
lea    -0x3d(%rbp),%rsi
xor    %eax,%eax
call   1130 <scanf@plt>
movsbl -0x3d(%rbp),%edi
call   1120 <tolower@plt>
cmp    $0x6e,%al
jne    1813 <main+0x573>
mov    %r13,%rdi
call   1080 <fclose@plt>
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
jmp    1803 <main+0x563>
lea    0x8cb(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
jmp    1338 <main+0x98>
lea    0x8e6(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    -0x38(%rbp),%r13
lea    0x891(%rip),%r15
jmp    1338 <main+0x98>
lea    -0x110(%rbp),%r15
mov    %r15,%rdi
lea    0x90c(%rip),%rsi
call   1140 <fopen@plt>
test   %rax,%rax
je     18d4 <main+0x634>
mov    %rax,%rbx
mov    -0x48(%rbp),%r15
mov    %r15,%rdi
mov    $0x1,%esi
mov    %r14d,%edx
mov    %rax,%rcx
call   1180 <fwrite@plt>
mov    %rbx,%rdi
call   1080 <fclose@plt>
mov    %r15,%rdi
call   1040 <free@plt>
mov    -0x29(%rbp),%al
mov    -0x38(%rbp),%r13
lea    0x835(%rip),%r15
jmp    1330 <main+0x90>
mov    0x275a(%rip),%rax
mov    (%rax),%edi
lea    0x7de(%rip),%rsi
xor    %eax,%eax
call   1100 <fprintf@plt>
mov    $0x2,%eax
jmp    18c1 <main+0x621>
mov    %r12d,%edi
call   10d0 <close@plt>
xor    %eax,%eax
jmp    18c1 <main+0x621>
mov    0x2730(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   10b0 <gai_strerror@plt>
lea    0x77d(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1100 <fprintf@plt>
mov    $0x1,%eax
mov    -0x78(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x857(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
jmp    18bc <main+0x61c>
mov    0x26e5(%rip),%rax
mov    (%rax),%edi
lea    0x71c(%rip),%rsi
xor    %eax,%eax
call   1100 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i64, i32, i32, i32, i32, %struct.addrinfo* }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"usage: client hostname\0A\00"
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [5 x i8] c"3527\00"
@.str.2 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.3 = [15 x i8] c"client: socket\00"
@.str.4 = [16 x i8] c"client: connect\00"
@.str.5 = [27 x i8] c"client: failed to connect\0A\00"
@.str.6 = [26 x i8] c"client: connecting to %s\0A\00"
@.str.7 = [56 x i8] c"............Welcome to the MC Command Hub.............\0A\00"
@.str.8 = [56 x i8] c"Please input your command........'input: h for help'..\0A\00"
@.str.9 = [3 x i8] c"%c\00"
@.str.10 = [56 x i8] c"Please make your selection from the following commands\0A\00"
@.str.11 = [56 x i8] c"'l' = List contents of server.....ex(l)...............\0A\00"
@.str.12 = [56 x i8] c"'c' = Check for a file name.......ex(c <filename>)....\0A\00"
@.str.13 = [56 x i8] c"'d' = Download file name..........ex(d <filename>)....\0A\00"
@.str.14 = [56 x i8] c"'p' = Display file name...........ex(p <filename>)....\0A\00"
@.str.15 = [56 x i8] c"'q' = Quit............................................\0A\00"
@.str.16 = [5 x i8] c"list\00"
@.str.17 = [4 x i8] c"%s\0A\00"
@.str.18 = [5 x i8] c"chek\00"
@.str.19 = [39 x i8] c"Which file do you want to check for?:\0A\00"
@.str.20 = [3 x i8] c"%s\00"
@.str.21 = [4 x i8] c"yes\00"
@.str.22 = [16 x i8] c"File was found\0A\00"
@.str.23 = [20 x i8] c"File was not found\0A\00"
@.str.24 = [5 x i8] c"disp\00"
@.str.25 = [19 x i8] c"enter file name: \0A\00"
@.str.26 = [16 x i8] c"Size file: %d \0A\00"
@.str.27 = [15 x i8] c"File not found\00"
@.str.28 = [15 x i8] c"contents : \0A%s\00"
@.str.29 = [19 x i8] c"Enter File Name: \0A\00"
@.str.30 = [16 x i8] c"File Size: %d \0A\00"
@.str.31 = [15 x i8] c"File Not Found\00"
@.str.32 = [29 x i8] c"File Downloaded from Server\0A\00"
@.str.33 = [10 x i8] c"Save as: \00"
@.str.34 = [2 x i8] c"r\00"
@.str.35 = [49 x i8] c"File %s exists. Do you want to override? (y/n): \00"
@.str.36 = [4 x i8] c"%4s\00"
@.str.37 = [2 x i8] c"w\00"
@.str.38 = [19 x i8] c"Error Opening File\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [100 x i8]
%9 = alloca %struct.addrinfo
%10 = alloca %struct.addrinfo*
%11 = alloca %struct.addrinfo*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i8
%16 = alloca i32
%17 = alloca [100 x i8]
%18 = alloca [3 x i8]
%19 = alloca i32
%20 = alloca i32
%21 = alloca [20 x i8]
%22 = alloca i8*
%23 = alloca i32
%24 = alloca [20 x i8]
%25 = alloca i8*
%26 = alloca i32*
%27 = alloca [5 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%28 = load i32, i32* @INET6_ADDRSTRLEN
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
store i8* %30, i8** %13
%31 = alloca i8, i64 %29
store i64 %29, i64* %14
store i8 116, i8* %15
%32 = load i32, i32* %4
%33 = icmp ne i32 %32, 2
br i1 %33, label %34, label %38
34: ; preds = %2
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %2
%39 = call i32 @memset(%struct.addrinfo* %9, i32 0, i32 32)
%40 = load i32, i32* @AF_UNSPEC
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 1
store i32 %40, i32* %41
%42 = load i32, i32* @SOCK_STREAM
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 4
store i32 %42, i32* %43
br label %44
44: ; preds = %298, %270, %243, %206, %38
%45 = load i8, i8* %15
%46 = sext i8 %45 to i32
%47 = icmp ne i32 %46, 113
br i1 %47, label %48, label %299
48: ; preds = %44
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = call i32 @getaddrinfo(i8* %51, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %9, %struct.addrinfo** %10)
store i32 %52, i32* %12
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %59
54: ; preds = %48
%55 = load i32, i32* @stderr
%56 = load i32, i32* %12
%57 = call i8* @gai_strerror(i32 %56)
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %57)
store i32 1, i32* %3
store i32 1, i32* %16
br label %302
59: ; preds = %48
%60 = load %struct.addrinfo*, %struct.addrinfo** %10
store %struct.addrinfo* %60, %struct.addrinfo** %11
br label %61
61: ; preds = %93, %59
%62 = load %struct.addrinfo*, %struct.addrinfo** %11
%63 = icmp ne %struct.addrinfo* %62, null
br i1 %63, label %64, label %97
64: ; preds = %61
%65 = load %struct.addrinfo*, %struct.addrinfo** %11
%66 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %65, i32 0, i32 1
%67 = load i32, i32* %66
%68 = load %struct.addrinfo*, %struct.addrinfo** %11
%69 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %68, i32 0, i32 4
%70 = load i32, i32* %69
%71 = load %struct.addrinfo*, %struct.addrinfo** %11
%72 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %71, i32 0, i32 3
%73 = load i32, i32* %72
%74 = call i32 @socket(i32 %67, i32 %70, i32 %73)
store i32 %74, i32* %6
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %78
76: ; preds = %64
%77 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %93
78: ; preds = %64
%79 = load i32, i32* %6
%80 = load %struct.addrinfo*, %struct.addrinfo** %11
%81 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %80, i32 0, i32 0
%82 = load i64, i64* %81
%83 = load %struct.addrinfo*, %struct.addrinfo** %11
%84 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %83, i32 0, i32 2
%85 = load i32, i32* %84
%86 = call i32 @connect(i32 %79, i64 %82, i32 %85)
%87 = icmp eq i32 %86, -1
br i1 %87, label %88, label %92
88: ; preds = %78
%89 = load i32, i32* %6
%90 = call i32 @close(i32 %89)
%91 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %93
92: ; preds = %78
br label %97
93: ; preds = %88, %76
%94 = load %struct.addrinfo*, %struct.addrinfo** %11
%95 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %94, i32 0, i32 5
%96 = load %struct.addrinfo*, %struct.addrinfo** %95
store %struct.addrinfo* %96, %struct.addrinfo** %11
br label %61
97: ; preds = %92, %61
%98 = load %struct.addrinfo*, %struct.addrinfo** %11
%99 = icmp eq %struct.addrinfo* %98, null
br i1 %99, label %100, label %103
100: ; preds = %97
%101 = load i32, i32* @stderr
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
store i32 2, i32* %3
store i32 1, i32* %16
br label %302
103: ; preds = %97
%104 = load %struct.addrinfo*, %struct.addrinfo** %11
%105 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %104, i32 0, i32 1
%106 = load i32, i32* %105
%107 = load %struct.addrinfo*, %struct.addrinfo** %11
%108 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %107, i32 0, i32 0
%109 = load i64, i64* %108
%110 = inttoptr i64 %109 to %struct.sockaddr*
%111 = call i32 @get_in_addr(%struct.sockaddr* %110)
%112 = trunc i64 %29 to i32
%113 = call i32 @inet_ntop(i32 %106, i32 %111, i8* %31, i32 %112)
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %31)
%115 = load %struct.addrinfo*, %struct.addrinfo** %10
%116 = call i32 @freeaddrinfo(%struct.addrinfo* %115)
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0))
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0))
%119 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %15)
br label %120
120: ; preds = %124, %103
%121 = call signext i8 (...) @getchar()
%122 = sext i8 %121 to i32
%123 = icmp ne i32 %122, 10
br i1 %123, label %124, label %125
124: ; preds = %120
br label %120
125: ; preds = %120
%126 = load i8, i8* %15
%127 = sext i8 %126 to i32
%128 = icmp eq i32 %127, 104
br i1 %128, label %129, label %136
129: ; preds = %125
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.10, i64 0, i64 0))
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0))
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.12, i64 0, i64 0))
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.13, i64 0, i64 0))
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0))
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.15, i64 0, i64 0))
br label %136
136: ; preds = %129, %125
%137 = load i8, i8* %15
%138 = sext i8 %137 to i32
%139 = icmp eq i32 %138, 108
br i1 %139, label %140, label %151
140: ; preds = %136
%141 = load i32, i32* %6
%142 = call i32 @send(i32 %141, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i32 4, i32 0)
%143 = load i32, i32* %6
%144 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%145 = call i32 @recv(i32 %143, i8* %144, i32 99, i32 0)
store i32 %145, i32* %7
%146 = load i32, i32* %7
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %147
store i8 0, i8* %148
%149 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %149)
br label %151
151: ; preds = %140, %136
%152 = load i8, i8* %15
%153 = sext i8 %152 to i32
%154 = icmp eq i32 %153, 99
br i1 %154, label %155, label %183
155: ; preds = %151
%156 = load i32, i32* %6
%157 = call i32 @send(i32 %156, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i32 4, i32 0)
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.19, i64 0, i64 0))
%159 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), [100 x i8]* %17)
br label %160
160: ; preds = %164, %155
%161 = call signext i8 (...) @getchar()
%162 = sext i8 %161 to i32
%163 = icmp ne i32 %162, 10
br i1 %163, label %164, label %165
164: ; preds = %160
br label %160
165: ; preds = %160
%166 = load i32, i32* %6
%167 = getelementptr inbounds [100 x i8], [100 x i8]* %17, i64 0, i64 0
%168 = call i32 @send(i32 %166, i8* %167, i32 100, i32 0)
%169 = load i32, i32* %6
%170 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%171 = call i32 @recv(i32 %169, i8* %170, i32 99, i32 0)
store i32 %171, i32* %19
%172 = load i32, i32* %19
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %173
store i8 0, i8* %174
%175 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%176 = call i32 @strcmp(i8* %175, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0))
%177 = icmp ne i32 %176, 0
br i1 %177, label %180, label %178
178: ; preds = %165
%179 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0))
br label %182
180: ; preds = %165
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.23, i64 0, i64 0))
br label %182
182: ; preds = %180, %178
br label %183
183: ; preds = %182, %151
%184 = load i8, i8* %15
%185 = sext i8 %184 to i32
%186 = icmp eq i32 %185, 112
br i1 %186, label %187, label %220
187: ; preds = %183
%188 = load i32, i32* %6
%189 = call i32 @send(i32 %188, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), i32 50, i32 0)
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.25, i64 0, i64 0))
%191 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), [100 x i8]* %17)
%192 = bitcast [20 x i8]* %21 to i8*
%193 = load i32, i32* %6
%194 = getelementptr inbounds [100 x i8], [100 x i8]* %17, i64 0, i64 0
%195 = call i32 @send(i32 %193, i8* %194, i32 100, i32 0)
%196 = load i32, i32* %6
%197 = getelementptr inbounds [20 x i8], [20 x i8]* %21, i64 0, i64 0
%198 = call i32 @recv(i32 %196, i8* %197, i32 20, i32 0)
store i32 %198, i32* %7
%199 = getelementptr inbounds [20 x i8], [20 x i8]* %21, i64 0, i64 0
%200 = call i64 @strtol(i8* %199, i8** null, i32 10)
%201 = trunc i64 %200 to i32
store i32 %201, i32* %20
%202 = load i32, i32* %20
%203 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0), i32 %202)
%204 = load i32, i32* %20
%205 = icmp eq i32 %204, 0
br i1 %205, label %206, label %208
206: ; preds = %187
%207 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i64 0, i64 0))
br label %44
208: ; preds = %187
%209 = load i32, i32* %20
%210 = add nsw i32 %209, 1
%211 = call i8* @calloc(i32 %210, i32 1)
store i8* %211, i8** %22
%212 = call i32 @sleep(i32 1)
%213 = load i32, i32* %6
%214 = load i8*, i8** %22
%215 = load i32, i32* %20
%216 = call i32 @recv(i32 %213, i8* %214, i32 %215, i32 0)
store i32 %216, i32* %7
%217 = load i8*, i8** %22
%218 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.28, i64 0, i64 0), i8* %217)
br label %219
219: ; preds = %208
br label %220
220: ; preds = %219, %183
%221 = load i8, i8* %15
%222 = sext i8 %221 to i32
%223 = icmp eq i32 %222, 100
br i1 %223, label %224, label %293
224: ; preds = %220
%225 = load i32, i32* %6
%226 = call i32 @send(i32 %225, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), i32 50, i32 0)
%227 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.29, i64 0, i64 0))
%228 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), [100 x i8]* %17)
%229 = bitcast [20 x i8]* %24 to i8*
%230 = load i32, i32* %6
%231 = getelementptr inbounds [100 x i8], [100 x i8]* %17, i64 0, i64 0
%232 = call i32 @send(i32 %230, i8* %231, i32 100, i32 0)
%233 = load i32, i32* %6
%234 = getelementptr inbounds [20 x i8], [20 x i8]* %24, i64 0, i64 0
%235 = call i32 @recv(i32 %233, i8* %234, i32 20, i32 0)
store i32 %235, i32* %7
%236 = getelementptr inbounds [20 x i8], [20 x i8]* %24, i64 0, i64 0
%237 = call i64 @strtol(i8* %236, i8** null, i32 10)
%238 = trunc i64 %237 to i32
store i32 %238, i32* %23
%239 = load i32, i32* %23
%240 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.30, i64 0, i64 0), i32 %239)
%241 = load i32, i32* %23
%242 = icmp eq i32 %241, 0
br i1 %242, label %243, label %245
243: ; preds = %224
%244 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.31, i64 0, i64 0))
br label %44
245: ; preds = %224
%246 = load i32, i32* %23
%247 = add nsw i32 %246, 1
%248 = call i8* @calloc(i32 %247, i32 1)
store i8* %248, i8** %25
%249 = call i32 @sleep(i32 1)
%250 = load i32, i32* %6
%251 = load i8*, i8** %25
%252 = load i32, i32* %23
%253 = call i32 @recv(i32 %250, i8* %251, i32 %252, i32 0)
store i32 %253, i32* %7
%254 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.32, i64 0, i64 0))
%255 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.33, i64 0, i64 0))
%256 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), [100 x i8]* %17)
%257 = getelementptr inbounds [100 x i8], [100 x i8]* %17, i64 0, i64 0
%258 = call i32* @fopen(i8* %257, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.34, i64 0, i64 0))
store i32* %258, i32** %26
%259 = load i32*, i32** %26
%260 = icmp ne i32* %259, null
br i1 %260, label %261, label %276
261: ; preds = %245
%262 = getelementptr inbounds [100 x i8], [100 x i8]* %17, i64 0, i64 0
%263 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.35, i64 0, i64 0), i8* %262)
%264 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.36, i64 0, i64 0), [5 x i8]* %27)
%265 = getelementptr inbounds [5 x i8], [5 x i8]* %27, i64 0, i64 0
%266 = load i8, i8* %265
%267 = call signext i8 @tolower(i8 signext %266)
%268 = sext i8 %267 to i32
%269 = icmp eq i32 %268, 110
br i1 %269, label %270, label %275
270: ; preds = %261
%271 = load i32*, i32** %26
%272 = call i32 @fclose(i32* %271)
%273 = load i8*, i8** %25
%274 = call i32 @free(i8* %273)
br label %44
275: ; preds = %261
br label %276
276: ; preds = %275, %245
%277 = getelementptr inbounds [100 x i8], [100 x i8]* %17, i64 0, i64 0
%278 = call i32* @fopen(i8* %277, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.37, i64 0, i64 0))
store i32* %278, i32** %26
%279 = load i32*, i32** %26
%280 = icmp eq i32* null, %279
br i1 %280, label %281, label %283
281: ; preds = %276
%282 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.38, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %16
br label %302
283: ; preds = %276
%284 = load i8*, i8** %25
%285 = load i32, i32* %23
%286 = load i32*, i32** %26
%287 = call i32 @fwrite(i8* %284, i32 1, i32 %285, i32* %286)
%288 = load i32*, i32** %26
%289 = call i32 @fclose(i32* %288)
%290 = load i8*, i8** %25
%291 = call i32 @free(i8* %290)
br label %292
292: ; preds = %283
br label %293
293: ; preds = %292, %220
%294 = load i8, i8* %15
%295 = sext i8 %294 to i32
%296 = icmp eq i32 %295, 113
br i1 %296, label %297, label %298
297: ; preds = %293
br label %299
298: ; preds = %293
br label %44
299: ; preds = %297, %44
%300 = load i32, i32* %6
%301 = call i32 @close(i32 %300)
store i32 0, i32* %3
store i32 1, i32* %16
br label %302
302: ; preds = %299, %281, %100, %54
%303 = load i8*, i8** %13
%304 = load i32, i32* %3
ret i32 %304
}

LLVM IR (-O2):
%struct.addrinfo = type { i64, i32, i32, i32, i32, %struct.addrinfo* }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"usage: client hostname\0A\00"
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [5 x i8] c"3527\00"
@.str.2 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.3 = [15 x i8] c"client: socket\00"
@.str.4 = [16 x i8] c"client: connect\00"
@.str.5 = [27 x i8] c"client: failed to connect\0A\00"
@.str.6 = [26 x i8] c"client: connecting to %s\0A\00"
@.str.9 = [3 x i8] c"%c\00"
@.str.16 = [5 x i8] c"list\00"
@.str.18 = [5 x i8] c"chek\00"
@.str.20 = [3 x i8] c"%s\00"
@.str.24 = [5 x i8] c"disp\00"
@.str.26 = [16 x i8] c"Size file: %d \0A\00"
@.str.27 = [15 x i8] c"File not found\00"
@.str.28 = [15 x i8] c"contents : \0A%s\00"
@.str.30 = [16 x i8] c"File Size: %d \0A\00"
@.str.31 = [15 x i8] c"File Not Found\00"
@.str.33 = [10 x i8] c"Save as: \00"
@.str.34 = [2 x i8] c"r\00"
@.str.35 = [49 x i8] c"File %s exists. Do you want to override? (y/n): \00"
@.str.36 = [4 x i8] c"%4s\00"
@.str.37 = [2 x i8] c"w\00"
@.str.38 = [19 x i8] c"Error Opening File\00"
@str = [55 x i8] c"............Welcome to the MC Command Hub.............\00"
@str.39 = [55 x i8] c"Please input your command........'input: h for help'..\00"
@str.40 = [18 x i8] c"Enter File Name: \00"
@str.41 = [28 x i8] c"File Downloaded from Server\00"
@str.42 = [18 x i8] c"enter file name: \00"
@str.43 = [38 x i8] c"Which file do you want to check for?:\00"
@str.44 = [15 x i8] c"File was found\00"
@str.45 = [19 x i8] c"File was not found\00"
@str.46 = [55 x i8] c"Please make your selection from the following commands\00"
@str.47 = [55 x i8] c"'l' = List contents of server.....ex(l)...............\00"
@str.48 = [55 x i8] c"'c' = Check for a file name.......ex(c <filename>)....\00"
@str.49 = [55 x i8] c"'d' = Download file name..........ex(d <filename>)....\00"
@str.50 = [55 x i8] c"'p' = Display file name...........ex(p <filename>)....\00"
@str.51 = [55 x i8] c"'q' = Quit............................................\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca %struct.addrinfo
%5 = alloca %struct.addrinfo*
%6 = alloca i8
%7 = alloca [100 x i8]
%8 = alloca [20 x i8]
%9 = alloca [20 x i8]
%10 = alloca [5 x i8]
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%12 = bitcast %struct.addrinfo* %4 to i8*
%13 = bitcast %struct.addrinfo** %5 to i8*
%14 = load i32, i32* @INET6_ADDRSTRLEN
%15 = zext i32 %14 to i64
%16 = tail call i8* @llvm.stacksave()
%17 = alloca i8, i64 %15
store i8 116, i8* %6
%18 = icmp eq i32 %0, 2
br i1 %18, label %23, label %19
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = call i32 @memset(%struct.addrinfo* %4, i32 0, i32 32)
%25 = load i32, i32* @AF_UNSPEC
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 1
store i32 %25, i32* %26
%27 = load i32, i32* @SOCK_STREAM
%28 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 4
store i32 %27, i32* %28
%29 = load i8, i8* %6
%30 = icmp ne i8 %29, 113
%31 = getelementptr inbounds i8*, i8** %1, i64 1
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%33 = bitcast [100 x i8]* %3 to i32*
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%35 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%36 = getelementptr inbounds [5 x i8], [5 x i8]* %10, i64 0, i64 0
br label %37
37: ; preds = %23, %205
%38 = load i8*, i8** %31
%39 = call i32 @getaddrinfo(i8* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %4, %struct.addrinfo** %5)
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = load %struct.addrinfo*, %struct.addrinfo** %5
%43 = icmp eq %struct.addrinfo* %42, null
br i1 %43, label %73, label %48
44: ; preds = %37
%45 = load i32, i32* @stderr
%46 = call i8* @gai_strerror(i32 %39)
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %46)
br label %212
48: ; preds = %41, %67
%49 = phi %struct.addrinfo* [ %71, %67 ], [ %42, %41 ]
%50 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 1
%51 = load i32, i32* %50
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 4
%53 = load i32, i32* %52
%54 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 3
%55 = load i32, i32* %54
%56 = call i32 @socket(i32 %51, i32 %53, i32 %55)
%57 = icmp eq i32 %56, -1
br i1 %57, label %67, label %58
58: ; preds = %48
%59 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 0
%60 = load i64, i64* %59
%61 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 2
%62 = load i32, i32* %61
%63 = call i32 @connect(i32 %56, i64 %60, i32 %62)
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %76
65: ; preds = %58
%66 = call i32 @close(i32 %56)
br label %67
67: ; preds = %48, %65
%68 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), %65 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %48 ]
%69 = call i32 @perror(i8* %68)
%70 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 5
%71 = load %struct.addrinfo*, %struct.addrinfo** %70
%72 = icmp eq %struct.addrinfo* %71, null
br i1 %72, label %73, label %48
73: ; preds = %41, %67
%74 = load i32, i32* @stderr
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %212
76: ; preds = %58
%77 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 1
%78 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i64 0, i32 0
%79 = load i32, i32* %77
%80 = load i64, i64* %78
%81 = inttoptr i64 %80 to %struct.sockaddr*
%82 = call i32 @get_in_addr(%struct.sockaddr* %81)
%83 = call i32 @inet_ntop(i32 %79, i32 %82, i8* %17, i32 %14)
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %17)
%85 = load %struct.addrinfo*, %struct.addrinfo** %5
%86 = call i32 @freeaddrinfo(%struct.addrinfo* %85)
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%88 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.39, i64 0, i64 0))
%89 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %6)
br label %90
90: ; preds = %90, %76
%91 = call signext i8 (...) @getchar()
%92 = icmp eq i8 %91, 10
br i1 %92, label %93, label %90
93: ; preds = %90
%94 = load i8, i8* %6
%95 = icmp eq i8 %94, 104
br i1 %95, label %96, label %104
96: ; preds = %93
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.46, i64 0, i64 0))
%98 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.47, i64 0, i64 0))
%99 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.48, i64 0, i64 0))
%100 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.49, i64 0, i64 0))
%101 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.50, i64 0, i64 0))
%102 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.51, i64 0, i64 0))
%103 = load i8, i8* %6
br label %104
104: ; preds = %96, %93
%105 = phi i8 [ %103, %96 ], [ %94, %93 ]
%106 = icmp eq i8 %105, 108
br i1 %106, label %107, label %114
107: ; preds = %104
%108 = call i32 @send(i32 %56, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i32 4, i32 0)
%109 = call i32 @recv(i32 %56, i8* %11, i32 99, i32 0)
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %110
store i8 0, i8* %111
%112 = call i32 @puts(i8* %11)
%113 = load i8, i8* %6
br label %114
114: ; preds = %107, %104
%115 = phi i8 [ %113, %107 ], [ %105, %104 ]
%116 = icmp eq i8 %115, 99
br i1 %116, label %117, label %134
117: ; preds = %114
%118 = call i32 @send(i32 %56, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i32 4, i32 0)
%119 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.43, i64 0, i64 0))
%120 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), [100 x i8]* %7)
br label %121
121: ; preds = %121, %117
%122 = call signext i8 (...) @getchar()
%123 = icmp eq i8 %122, 10
br i1 %123, label %124, label %121
124: ; preds = %121
%125 = call i32 @send(i32 %56, i8* %32, i32 100, i32 0)
%126 = call i32 @recv(i32 %56, i8* %11, i32 99, i32 0)
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %127
store i8 0, i8* %128
%129 = load i32, i32* %33
%130 = icmp eq i32 %129, 7562617
%131 = select i1 %130, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.44, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.45, i64 0, i64 0)
%132 = call i32 @puts(i8* dereferenceable(1) %131)
%133 = load i8, i8* %6
br label %134
134: ; preds = %124, %114
%135 = phi i8 [ %133, %124 ], [ %115, %114 ]
%136 = icmp eq i8 %135, 112
br i1 %136, label %137, label %156
137: ; preds = %134
%138 = call i32 @send(i32 %56, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), i32 50, i32 0)
%139 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.42, i64 0, i64 0))
%140 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), [100 x i8]* %7)
%141 = call i32 @send(i32 %56, i8* %32, i32 100, i32 0)
%142 = call i32 @recv(i32 %56, i8* %34, i32 20, i32 0)
%143 = call i64 @strtol(i8* nocapture %34, i8** null, i32 10)
%144 = trunc i64 %143 to i32
%145 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0), i32 %144)
%146 = icmp eq i32 %144, 0
br i1 %146, label %147, label %149
147: ; preds = %137
%148 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i64 0, i64 0))
br label %203
149: ; preds = %137
%150 = add nsw i32 %144, 1
%151 = call i8* @calloc(i32 %150, i32 1)
%152 = call i32 @sleep(i32 1)
%153 = call i32 @recv(i32 %56, i8* %151, i32 %144, i32 0)
%154 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.28, i64 0, i64 0), i8* %151)
%155 = load i8, i8* %6
br label %156
156: ; preds = %149, %134
%157 = phi i8 [ %155, %149 ], [ %135, %134 ]
%158 = icmp eq i8 %157, 100
br i1 %158, label %159, label %199
159: ; preds = %156
%160 = call i32 @send(i32 %56, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), i32 50, i32 0)
%161 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.40, i64 0, i64 0))
%162 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), [100 x i8]* %7)
%163 = call i32 @send(i32 %56, i8* %32, i32 100, i32 0)
%164 = call i32 @recv(i32 %56, i8* %35, i32 20, i32 0)
%165 = call i64 @strtol(i8* nocapture %35, i8** null, i32 10)
%166 = trunc i64 %165 to i32
%167 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.30, i64 0, i64 0), i32 %166)
%168 = icmp eq i32 %166, 0
br i1 %168, label %169, label %171
169: ; preds = %159
%170 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.31, i64 0, i64 0))
br label %204
171: ; preds = %159
%172 = add nsw i32 %166, 1
%173 = call i8* @calloc(i32 %172, i32 1)
%174 = call i32 @sleep(i32 1)
%175 = call i32 @recv(i32 %56, i8* %173, i32 %166, i32 0)
%176 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.41, i64 0, i64 0))
%177 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.33, i64 0, i64 0))
%178 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), [100 x i8]* %7)
%179 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.34, i64 0, i64 0))
%180 = icmp eq i32* %179, null
br i1 %180, label %191, label %181
181: ; preds = %171
%182 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.35, i64 0, i64 0), i8* %32)
%183 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.36, i64 0, i64 0), [5 x i8]* %10)
%184 = load i8, i8* %36
%185 = call signext i8 @tolower(i8 signext %184)
%186 = icmp eq i8 %185, 110
br i1 %186, label %187, label %190
187: ; preds = %181
%188 = call i32 @fclose(i32* %179)
%189 = call i32 @free(i8* %173)
br label %204
190: ; preds = %181
br label %191
191: ; preds = %190, %171
%192 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.37, i64 0, i64 0))
%193 = icmp eq i32* %192, null
br i1 %193, label %210, label %194
194: ; preds = %191
%195 = call i32 @fwrite(i8* %173, i32 1, i32 %166, i32* %192)
%196 = call i32 @fclose(i32* %192)
%197 = call i32 @free(i8* %173)
%198 = load i8, i8* %6
br label %199
199: ; preds = %194, %156
%200 = phi i8 [ %198, %194 ], [ %157, %156 ]
%201 = icmp eq i8 %200, 113
br i1 %201, label %202, label %203
202: ; preds = %199
br label %208
203: ; preds = %199, %147
br label %205
204: ; preds = %187, %169
br label %205
205: ; preds = %204, %203
%206 = load i8, i8* %6
%207 = icmp eq i8 %206, 113
br i1 %207, label %208, label %37
208: ; preds = %205, %202
%209 = call i32 @close(i32 %56)
br label %212
210: ; preds = %191
%211 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.38, i64 0, i64 0))
br label %212
212: ; preds = %210, %208, %73, %44
%213 = phi i32 [ 1, %44 ], [ 2, %73 ], [ 0, %208 ], [ 1, %210 ]
ret i32 %213
}