#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 */

/* Variables and functions */
int ENOENT;
char EOF;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_RDWR;
int S_IRUSR;
int S_IWUSR;
scalar_t__ calloc(int, int);
int chdir(char *);
int /*<<< orphan*/ close(int);
int createConnection(int);
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ execlp(char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ free(char *);
char *getFileName(char *);
scalar_t__ malloc(int);
int open(char *, int, ...);
int /*<<< orphan*/ perror(char *);
scalar_t__ pipe(int *);
int /*<<< orphan*/ printBuffer(int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
char *removeNL(char *);
char *strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ wait(int *);
int /*<<< orphan*/ write(int, char *, int);
void doCommand(int socket, char *command, char *arg) {
  int comLength = strlen(command);
  int argLength;
  if (arg != NULL)
    argLength = strlen(arg);
  char *newCommand = (char *)malloc(sizeof(char) * comLength);
  char *newArg = (char *)malloc(sizeof(char) * argLength);
  if (arg == NULL)
    newCommand = removeNL(command);
  else
    newArg = removeNL(arg);
  if (strcmp(newCommand, "exit") == 0) {
    printf("Good bye\n");
    write(socket, "Q\n", 2);
    char buffer1[10];
    read(socket, buffer1, 10);
    if (buffer1[0] == 'A')
      printf("Accepted\n");
    exit(0);
    if (buffer1[0] == 'E')
      printf("Error\n");
  } else if (strcmp(newCommand, "ls") == 0) {
    int pid, stat;
    int fd[2];
    int rdr, wtr;
    if (pipe(fd) < 0) {
      perror("The pipe for ls did not open correctly");
      exit(1);
    }
    rdr = fd[0];
    wtr = fd[1];
    pid = fork();
    if (pid == 0) {
      close(rdr);
      dup2(wtr, 1);
      execlp("ls", "ls", "-l", NULL);
      close(wtr);
      perror("the child did not execute properly.");
      exit(1);
    } else {
      close(wtr);
      wait(&stat);
      printBuffer(rdr);
    }
  } else if (strcmp(command, "cd") == 0) {
    int dir;
    if (arg == NULL)
      printf("A path must be given\n");
    else {
      printf("arg is %s\n", newArg);
      dir = chdir(newArg);
      if (dir < 0) {
        perror("error in changing directory or directory does not exist");
      }
    }
    printf("The Directory has been changed\n");
  } else if (strcmp(command, "rcd") == 0) {
    char *sendArg = (char *)calloc(strlen(arg) + 1, sizeof(char));
    sendArg = strcat(sendArg, "C");
    sendArg = strcat(sendArg, arg);
    write(socket, sendArg, strlen(sendArg));
    char acknowledge[2];
    read(socket, acknowledge, 2);
    printf("Directory has changed\n %s\n", acknowledge);
    free(sendArg);
  } else if (strcmp(command, "get") == 0) {
    char *data = "D\n";
    char *fileName;
    int file;
    int bytes = 1;
    char single;
    write(socket, data, 2);
    int connection = createConnection(socket);
    printf("The data connection has been established with the server %d\n",
           connection);
    int argLen = strlen(arg);
    char *command1 = (char *)calloc(argLen + 1, sizeof(char));
    command1 = strcat(command1, "G");
    command1 = strcat(command1, newArg);
    command1 = strcat(command1, "\n");
    write(socket, command1, strlen(command1));
    fileName = getFileName(newArg);
    char buffer[128];
    read(socket, buffer, 128);
    if (buffer[0] == 'A')
      printf("Accepted\n");
    if (buffer[0] == 'E') {
      printf("%s", &buffer[1]);
      close(connection);
      free(command1);
      return;
    }
    file = open(fileName, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
    if (file >= 0) {
      while (bytes > 0) {
        bytes = read(connection, &single, 1);
        if (bytes == 0)
          break;
        write(file, &single, 1);
      }
      close(file);
    }
    if (file == ENOENT) {
      printf("The file you entered does not exist\n");
      close(file);
    }
    close(connection);
    free(command1);
  } else if (strcmp(command, "show") == 0) {
    char *data = "D\n";
    char *fileName;
    int file;
    int bytes = 1;
    char single;
    int lineCount = 0;
    char user = ' ';
    write(socket, data, 2);
    int connection = createConnection(socket);
    int argLen = strlen(arg);
    char *command1 = (char *)calloc(argLen + 1, sizeof(char));
    command1 = strcat(command1, "G");
    command1 = strcat(command1, newArg);
    command1 = strcat(command1, "\n");
    write(socket, command1, strlen(command1));
    fileName = getFileName(newArg);
    char buffer[128];
    read(socket, buffer, 128);
    if (buffer[0] == 'A')
      printf("Accepted\n");
    if (buffer[0] == 'E') {
      printf("%s", &buffer[1]);
      close(connection);
      free(command1);
    }
    while (bytes > 0) {
      bytes = read(connection, &single, 1);
      if (single == EOF)
        break;
      if (single == '\n')
        lineCount++;
      printf("%c", single);
      if (lineCount == 19) {
        while (user != '\n') {
          read(0, &user, 1);
        }
        user = ' ';
        lineCount = 0;
      }
    }
    printf("********** End of file **********\n");
    if (file == ENOENT)
      printf("The file you entered does not exist\n");
  } else if (strcmp(command, "put") == 0) {
    char *data = "D\n";
    int file;
    int bytes = 1;
    char single;
    write(socket, data, 2);
    int argLen = strlen(arg);
    char *command1 = (char *)calloc(argLen + 1, sizeof(char));
    int connection = createConnection(socket);
    command1 = strcat(command1, "P");
    command1 = strcat(command1, newArg);
    command1 = strcat(command1, "\n");
    write(socket, command1, strlen(command1));
    file = open(newArg, O_RDONLY);
    char buffer[128];
    read(socket, buffer, 128);
    if (buffer[0] == 'A')
      printf("Accepted\n");
    if (buffer[0] == 'E') {
      printf("%s", &buffer[1]);
      close(connection);
      free(command1);
    }
    if (file >= 0) {
      while (bytes > 0) {
        bytes = read(file, &single, 1);
        if (bytes == 0)
          break;
        write(connection, &single, 1);
      }
      close(file);
      close(connection);
    }
    if (file == ENOENT)
      printf("The file you entered does not exist\n");
    if (file < 0) {
      printf("error in put");
      exit(1);
    }
    free(command1);
  } else if (strcmp(newCommand, "rls") == 0) {
    char *data = "D\n";
    write(socket, data, 2);
    int connection = createConnection(socket);
    char *commandCall = "L\n";
    write(socket, commandCall, strlen(commandCall));
    char buffer[100];
    read(socket, buffer, 10);
    if (buffer[0] == 'A')
      printf("Accepted\n");
    if (buffer[0] == 'E')
      printf("Error\n");
    printBuffer(connection);
    close(connection);
  } else
    printf("The command is not valid\n");
}


x86 assembly (clang, -O0):
<doCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x360,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     12a9 <doCommand+0x39>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x20(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12ec <doCommand+0x7c>
mov    -0x10(%rbp),%rdi
call   1090 <removeNL@plt>
mov    %rax,-0x28(%rbp)
jmp    12f9 <doCommand+0x89>
mov    -0x18(%rbp),%rdi
call   1090 <removeNL@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xcfc(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1368 <doCommand+0xf8>
lea    0xceb(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x4(%rbp),%edi
lea    0xce4(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x4(%rbp),%edi
lea    -0x3a(%rbp),%rsi
mov    $0xa,%edx
call   10c0 <read@plt>
movsbl -0x3a(%rbp),%eax
cmp    $0x41,%eax
jne    1361 <doCommand+0xf1>
lea    0xcb8(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
xor    %edi,%edi
call   1140 <exit@plt>
mov    -0x28(%rbp),%rdi
lea    0xe3a(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1436 <doCommand+0x1c6>
lea    -0x4c(%rbp),%rdi
call   10b0 <pipe@plt>
cmp    $0x0,%rax
jge    13ab <doCommand+0x13b>
lea    0xc80(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    $0x0,%al
call   1190 <fork@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jne    1418 <doCommand+0x1a8>
mov    -0x50(%rbp),%edi
call   10a0 <close@plt>
mov    -0x54(%rbp),%edi
mov    $0x1,%esi
call   1070 <dup2@plt>
lea    0xdc6(%rip),%rsi
lea    0xc55(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1150 <execlp@plt>
mov    -0x54(%rbp),%edi
call   10a0 <close@plt>
lea    0xc3d(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x54(%rbp),%edi
call   10a0 <close@plt>
lea    -0x44(%rbp),%rdi
call   1170 <wait@plt>
mov    -0x50(%rbp),%edi
call   1100 <printBuffer@plt>
jmp    1e01 <doCommand+0xb91>
mov    -0x10(%rbp),%rdi
lea    0xca3(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    14ba <doCommand+0x24a>
cmpq   $0x0,-0x18(%rbp)
jne    146e <doCommand+0x1fe>
lea    0xc08(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    14a7 <doCommand+0x237>
mov    -0x30(%rbp),%rsi
lea    0xc07(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1060 <chdir@plt>
mov    %eax,-0x58(%rbp)
cmpl   $0x0,-0x58(%rbp)
jge    14a2 <doCommand+0x232>
lea    0xbee(%rip),%rdi
call   1120 <perror@plt>
jmp    14a7 <doCommand+0x237>
lea    0xc15(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1dfc <doCommand+0xb8c>
mov    -0x10(%rbp),%rdi
lea    0xc1e(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1577 <doCommand+0x307>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
lea    0xbec(%rip),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x60(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x31c(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x318(%rbp)
mov    -0x60(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x31c(%rbp),%edi
mov    -0x318(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    -0x4(%rbp),%edi
lea    -0x62(%rbp),%rsi
mov    $0x2,%edx
call   10c0 <read@plt>
lea    -0x62(%rbp),%rsi
lea    0xb87(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
jmp    1df7 <doCommand+0xb87>
mov    -0x10(%rbp),%rdi
lea    0xb82(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    17de <doCommand+0x56e>
lea    0xb70(%rip),%rax
mov    %rax,-0x70(%rbp)
movl   $0x1,-0x80(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x70(%rbp),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x4(%rbp),%edi
call   1160 <createConnection@plt>
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%esi
lea    0xb3c(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
lea    0xb3b(%rip),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
lea    0xb5d(%rip),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x98(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x32c(%rbp)
mov    -0x98(%rbp),%rax
mov    %rax,-0x328(%rbp)
mov    -0x98(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x32c(%rbp),%edi
mov    -0x328(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    -0x30(%rbp),%rdi
call   1180 <getFileName@plt>
mov    %rax,-0x78(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x120(%rbp),%rsi
mov    $0x80,%edx
call   10c0 <read@plt>
movsbl -0x120(%rbp),%eax
cmp    $0x41,%eax
jne    16c0 <doCommand+0x450>
lea    0x959(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movsbl -0x120(%rbp),%eax
cmp    $0x45,%eax
jne    1705 <doCommand+0x495>
lea    -0x120(%rbp),%rsi
add    $0x1,%rsi
lea    0xa68(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x88(%rbp),%edi
call   10a0 <close@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
jmp    1e06 <doCommand+0xb96>
mov    -0x78(%rbp),%rdi
mov    0x28d0(%rip),%rax
mov    (%rax),%esi
mov    0x28df(%rip),%rax
or     (%rax),%esi
mov    0x2896(%rip),%rax
mov    (%rax),%edx
mov    0x289d(%rip),%rax
or     (%rax),%edx
mov    $0x0,%al
call   1110 <open@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
jl     179a <doCommand+0x52a>
jmp    1746 <doCommand+0x4d6>
cmpl   $0x0,-0x80(%rbp)
jle    1792 <doCommand+0x522>
mov    -0x88(%rbp),%edi
lea    -0x81(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <read@plt>
mov    %eax,-0x80(%rbp)
cmpl   $0x0,-0x80(%rbp)
jne    1779 <doCommand+0x509>
jmp    1792 <doCommand+0x522>
mov    -0x7c(%rbp),%edi
lea    -0x81(%rbp),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
jmp    1746 <doCommand+0x4d6>
mov    -0x7c(%rbp),%edi
call   10a0 <close@plt>
mov    -0x7c(%rbp),%eax
mov    0x2804(%rip),%rcx
cmp    (%rcx),%eax
jne    17c2 <doCommand+0x552>
lea    0x99a(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x7c(%rbp),%edi
call   10a0 <close@plt>
mov    -0x88(%rbp),%edi
call   10a0 <close@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
jmp    1df2 <doCommand+0xb82>
mov    -0x10(%rbp),%rdi
lea    0x989(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1a77 <doCommand+0x807>
lea    0x909(%rip),%rax
mov    %rax,-0x128(%rbp)
movl   $0x1,-0x138(%rbp)
movl   $0x0,-0x140(%rbp)
movb   $0x20,-0x141(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x128(%rbp),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x4(%rbp),%edi
call   1160 <createConnection@plt>
mov    %eax,-0x148(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x14c(%rbp)
mov    -0x14c(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x158(%rbp)
mov    -0x158(%rbp),%rdi
lea    0x8ce(%rip),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x158(%rbp)
mov    -0x158(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x158(%rbp)
mov    -0x158(%rbp),%rdi
lea    0x8f0(%rip),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x158(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x33c(%rbp)
mov    -0x158(%rbp),%rax
mov    %rax,-0x338(%rbp)
mov    -0x158(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x33c(%rbp),%edi
mov    -0x338(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    -0x30(%rbp),%rdi
call   1180 <getFileName@plt>
mov    %rax,-0x130(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x1e0(%rbp),%rsi
mov    $0x80,%edx
call   10c0 <read@plt>
movsbl -0x1e0(%rbp),%eax
cmp    $0x41,%eax
jne    1930 <doCommand+0x6c0>
lea    0x6e9(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movsbl -0x1e0(%rbp),%eax
cmp    $0x45,%eax
jne    1970 <doCommand+0x700>
lea    -0x1e0(%rbp),%rsi
add    $0x1,%rsi
lea    0x7f8(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x148(%rbp),%edi
call   10a0 <close@plt>
mov    -0x158(%rbp),%rdi
call   1030 <free@plt>
jmp    1975 <doCommand+0x705>
cmpl   $0x0,-0x138(%rbp)
jle    1a41 <doCommand+0x7d1>
mov    -0x148(%rbp),%edi
lea    -0x139(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <read@plt>
mov    %eax,-0x138(%rbp)
movsbl -0x139(%rbp),%eax
mov    0x2623(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    19bd <doCommand+0x74d>
jmp    1a41 <doCommand+0x7d1>
movsbl -0x139(%rbp),%eax
cmp    $0xa,%eax
jne    19dc <doCommand+0x76c>
mov    -0x140(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x140(%rbp)
movsbl -0x139(%rbp),%esi
lea    0x78d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
cmpl   $0x13,-0x140(%rbp)
jne    1a3c <doCommand+0x7cc>
jmp    1a03 <doCommand+0x793>
movsbl -0x141(%rbp),%eax
cmp    $0xa,%eax
je     1a2b <doCommand+0x7bb>
xor    %edi,%edi
lea    -0x141(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <read@plt>
jmp    1a03 <doCommand+0x793>
movb   $0x20,-0x141(%rbp)
movl   $0x0,-0x140(%rbp)
jmp    1975 <doCommand+0x705>
lea    0x732(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x134(%rbp),%eax
mov    0x254c(%rip),%rcx
cmp    (%rcx),%eax
jne    1a72 <doCommand+0x802>
lea    0x6e2(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1ded <doCommand+0xb7d>
mov    -0x10(%rbp),%rdi
lea    0x726(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1cdb <doCommand+0xa6b>
lea    0x670(%rip),%rax
mov    %rax,-0x1e8(%rbp)
movl   $0x1,-0x1f0(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x1e8(%rbp),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x1f8(%rbp)
mov    -0x1f8(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x200(%rbp)
mov    -0x4(%rbp),%edi
call   1160 <createConnection@plt>
mov    %eax,-0x204(%rbp)
mov    -0x200(%rbp),%rdi
lea    0x69b(%rip),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x200(%rbp)
mov    -0x200(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x200(%rbp)
mov    -0x200(%rbp),%rdi
lea    0x668(%rip),%rsi
call   1130 <strcat@plt>
mov    %rax,-0x200(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x34c(%rbp)
mov    -0x200(%rbp),%rax
mov    %rax,-0x348(%rbp)
mov    -0x200(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x34c(%rbp),%edi
mov    -0x348(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    -0x30(%rbp),%rdi
mov    0x2457(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1110 <open@plt>
mov    %eax,-0x1ec(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x290(%rbp),%rsi
mov    $0x80,%edx
call   10c0 <read@plt>
movsbl -0x290(%rbp),%eax
cmp    $0x41,%eax
jne    1bc2 <doCommand+0x952>
lea    0x457(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movsbl -0x290(%rbp),%eax
cmp    $0x45,%eax
jne    1c02 <doCommand+0x992>
lea    -0x290(%rbp),%rsi
add    $0x1,%rsi
lea    0x566(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x204(%rbp),%edi
call   10a0 <close@plt>
mov    -0x200(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x1ec(%rbp)
jl     1c82 <doCommand+0xa12>
jmp    1c14 <doCommand+0x9a4>
cmpl   $0x0,-0x1f0(%rbp)
jle    1c6c <doCommand+0x9fc>
mov    -0x1ec(%rbp),%edi
lea    -0x1f1(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <read@plt>
mov    %eax,-0x1f0(%rbp)
cmpl   $0x0,-0x1f0(%rbp)
jne    1c50 <doCommand+0x9e0>
jmp    1c6c <doCommand+0x9fc>
mov    -0x204(%rbp),%edi
lea    -0x1f1(%rbp),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
jmp    1c14 <doCommand+0x9a4>
mov    -0x1ec(%rbp),%edi
call   10a0 <close@plt>
mov    -0x204(%rbp),%edi
call   10a0 <close@plt>
mov    -0x1ec(%rbp),%eax
mov    0x2319(%rip),%rcx
cmp    (%rcx),%eax
jne    1ca5 <doCommand+0xa35>
lea    0x4af(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
cmpl   $0x0,-0x1ec(%rbp)
jge    1cca <doCommand+0xa5a>
lea    0x4e6(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x200(%rbp),%rdi
call   1030 <free@plt>
jmp    1de8 <doCommand+0xb78>
mov    -0x28(%rbp),%rdi
lea    0x4c6(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1dd5 <doCommand+0xb65>
lea    0x40c(%rip),%rax
mov    %rax,-0x298(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x298(%rbp),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x4(%rbp),%edi
call   1160 <createConnection@plt>
mov    %eax,-0x29c(%rbp)
lea    0x484(%rip),%rax
mov    %rax,-0x2a8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x35c(%rbp)
mov    -0x2a8(%rbp),%rax
mov    %rax,-0x358(%rbp)
mov    -0x2a8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x35c(%rbp),%edi
mov    -0x358(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    -0x4(%rbp),%edi
lea    -0x310(%rbp),%rsi
mov    $0xa,%edx
call   10c0 <read@plt>
movsbl -0x310(%rbp),%eax
cmp    $0x41,%eax
jne    1d9c <doCommand+0xb2c>
lea    0x27d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movsbl -0x310(%rbp),%eax
cmp    $0x45,%eax
jne    1dba <doCommand+0xb4a>
lea    0x400(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x29c(%rbp),%edi
call   1100 <printBuffer@plt>
mov    -0x29c(%rbp),%edi
call   10a0 <close@plt>
jmp    1de3 <doCommand+0xb73>
lea    0x3de(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1de8 <doCommand+0xb78>
jmp    1ded <doCommand+0xb7d>
jmp    1df2 <doCommand+0xb82>
jmp    1df7 <doCommand+0xb87>
jmp    1dfc <doCommand+0xb8c>
jmp    1e01 <doCommand+0xb91>
jmp    1e06 <doCommand+0xb96>
add    $0x360,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doCommand>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rdx,%r13
mov    %rsi,%r15
mov    %edi,%r14d
mov    %rsi,%rdi
call   1070 <strlen@plt>
mov    %eax,%ebp
test   %r13,%r13
je     12c5 <doCommand+0x35>
mov    %r13,%rdi
call   1070 <strlen@plt>
mov    %eax,%ebx
jmp    12c5 <doCommand+0x35>
mov    %ebp,%edi
call   1110 <malloc@plt>
mov    %rax,%rbp
mov    %ebx,%edi
call   1110 <malloc@plt>
test   %r13,%r13
je     12e8 <doCommand+0x58>
mov    %r13,%rdi
call   10b0 <removeNL@plt>
mov    %rax,%r12
jmp    12f6 <doCommand+0x66>
mov    %rax,%r12
mov    %r15,%rdi
call   10b0 <removeNL@plt>
mov    %rax,%rbp
lea    0xd03(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strcmp@plt>
test   %rax,%rax
je     19c1 <doCommand+0x731>
lea    0xdfd(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strcmp@plt>
test   %rax,%rax
je     13c2 <doCommand+0x132>
lea    0xd6d(%rip),%rsi
mov    %r15,%rdi
call   1100 <strcmp@plt>
test   %rax,%rax
je     1409 <doCommand+0x179>
lea    0xd54(%rip),%rsi
mov    %r15,%rdi
call   1100 <strcmp@plt>
test   %rax,%rax
je     1444 <doCommand+0x1b4>
lea    0xd5b(%rip),%rsi
mov    %r15,%rdi
call   1100 <strcmp@plt>
test   %rax,%rax
je     14bd <doCommand+0x22d>
lea    0xd8a(%rip),%rsi
mov    %r15,%rdi
call   1100 <strcmp@plt>
test   %rax,%rax
je     1644 <doCommand+0x3b4>
lea    0xd80(%rip),%rsi
mov    %r15,%rdi
call   1100 <strcmp@plt>
test   %rax,%rax
je     16fb <doCommand+0x46b>
lea    0xd6c(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strcmp@plt>
test   %rax,%rax
je     17e5 <doCommand+0x555>
lea    0xd5b(%rip),%rdi
jmp    162e <doCommand+0x39e>
lea    0x10(%rsp),%rdi
call   10d0 <pipe@plt>
test   %rax,%rax
js     1a0d <doCommand+0x77d>
mov    0x10(%rsp),%ebp
mov    0x14(%rsp),%ebx
xor    %eax,%eax
call   11b0 <fork@plt>
test   %eax,%eax
je     1a16 <doCommand+0x786>
mov    %ebx,%edi
call   10c0 <close@plt>
lea    0xc(%rsp),%rdi
call   1190 <wait@plt>
mov    %ebp,%edi
call   1120 <printBuffer@plt>
jmp    19af <doCommand+0x71f>
test   %r13,%r13
je     161b <doCommand+0x38b>
lea    0xc3d(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r12,%rdi
call   1080 <chdir@plt>
test   %eax,%eax
jns    1627 <doCommand+0x397>
lea    0xc27(%rip),%rdi
call   1140 <perror@plt>
jmp    1627 <doCommand+0x397>
mov    %r13,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%edi
mov    $0x1,%esi
call   10f0 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <strlen@plt>
movw   $0x43,(%rbx,%rax,1)
mov    %rbx,%rdi
mov    %r13,%rsi
call   1150 <strcat@plt>
mov    %rbx,%rdi
call   1070 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <write@plt>
lea    0x10(%rsp),%rbp
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0x2,%edx
call   10e0 <read@plt>
lea    0xbf7(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    19af <doCommand+0x71f>
lea    0xbf8(%rip),%rsi
mov    %r14d,%edi
mov    $0x2,%edx
call   1060 <write@plt>
mov    %r14d,%edi
call   1180 <createConnection@plt>
mov    %eax,%r15d
lea    0xbdc(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r13,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%edi
mov    $0x1,%esi
call   10f0 <calloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   1070 <strlen@plt>
movw   $0x47,0x0(%r13,%rax,1)
mov    %r13,%rdi
mov    %r12,%rsi
call   1150 <strcat@plt>
mov    %r13,%rdi
call   1070 <strlen@plt>
movw   $0xa,0x0(%r13,%rax,1)
mov    %r13,%rdi
call   1070 <strlen@plt>
mov    %r14d,%edi
mov    %r13,%rsi
mov    %eax,%edx
call   1060 <write@plt>
mov    %r12,%rdi
call   11a0 <getFileName@plt>
mov    %rax,%rbx
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0x80,%edx
call   10e0 <read@plt>
mov    0x10(%rsp),%al
cmp    $0x45,%al
je     17bd <doCommand+0x52d>
cmp    $0x41,%al
jne    157d <doCommand+0x2ed>
lea    0xc42(%rip),%rdi
call   1050 <puts@plt>
mov    0x2a5c(%rip),%rax
mov    0x2a6d(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2a22(%rip),%rax
mov    0x2a2b(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1130 <open@plt>
mov    %eax,%r14d
test   %eax,%eax
js     15f2 <doCommand+0x362>
lea    0xc(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
call   10e0 <read@plt>
test   %eax,%eax
je     15ea <doCommand+0x35a>
mov    %eax,%ebx
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
call   1060 <write@plt>
test   %ebx,%ebx
jg     15c0 <doCommand+0x330>
mov    %r14d,%edi
call   10c0 <close@plt>
mov    0x29af(%rip),%rax
cmp    (%rax),%r14d
jne    17d0 <doCommand+0x540>
lea    0xb50(%rip),%rdi
call   1050 <puts@plt>
mov    %r14d,%edi
call   10c0 <close@plt>
jmp    17d0 <doCommand+0x540>
lea    0xb7a(%rip),%rdi
call   1050 <puts@plt>
lea    0xb4f(%rip),%rdi
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <puts@plt>
movb   $0x20,0xb(%rsp)
lea    0xa6c(%rip),%rsi
mov    %r14d,%edi
mov    $0x2,%edx
call   1060 <write@plt>
mov    %r14d,%edi
call   1180 <createConnection@plt>
mov    %eax,%r15d
mov    %r13,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%edi
mov    $0x1,%esi
call   10f0 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <strlen@plt>
movw   $0x47,(%rbx,%rax,1)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1150 <strcat@plt>
mov    %rbx,%rdi
call   1070 <strlen@plt>
movw   $0xa,(%rbx,%rax,1)
mov    %rbx,%rdi
call   1070 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <write@plt>
mov    %r12,%rdi
call   11a0 <getFileName@plt>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0x80,%edx
call   10e0 <read@plt>
mov    0x10(%rsp),%al
cmp    $0x45,%al
je     1851 <doCommand+0x5c1>
cmp    $0x41,%al
jne    1874 <doCommand+0x5e4>
lea    0xac9(%rip),%rdi
call   1050 <puts@plt>
jmp    1874 <doCommand+0x5e4>
lea    0x9ba(%rip),%rsi
mov    %r14d,%edi
mov    $0x2,%edx
call   1060 <write@plt>
mov    %r13,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%edi
mov    $0x1,%esi
call   10f0 <calloc@plt>
mov    %rax,%r15
mov    %r14d,%edi
call   1180 <createConnection@plt>
mov    %eax,%r13d
mov    %r15,%rdi
call   1070 <strlen@plt>
movw   $0x50,(%r15,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
call   1150 <strcat@plt>
mov    %r15,%rdi
call   1070 <strlen@plt>
movw   $0xa,(%r15,%rax,1)
mov    %r15,%rdi
call   1070 <strlen@plt>
mov    %r14d,%edi
mov    %r15,%rsi
mov    %eax,%edx
call   1060 <write@plt>
mov    0x2861(%rip),%rax
mov    (%rax),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1130 <open@plt>
mov    %eax,%r12d
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0x80,%edx
call   10e0 <read@plt>
mov    0x10(%rsp),%al
cmp    $0x45,%al
je     1901 <doCommand+0x671>
cmp    $0x41,%al
jne    1924 <doCommand+0x694>
lea    0xa07(%rip),%rdi
call   1050 <puts@plt>
jmp    1924 <doCommand+0x694>
lea    0x11(%rsp),%rsi
lea    0x933(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r15d,%edi
call   10c0 <close@plt>
mov    %r13,%rdi
call   1030 <free@plt>
jmp    19af <doCommand+0x71f>
lea    0x8d0(%rip),%rsi
mov    %r14d,%edi
mov    $0x2,%edx
call   1060 <write@plt>
mov    %r14d,%edi
call   1180 <createConnection@plt>
mov    %eax,%ebx
lea    0x90b(%rip),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1060 <write@plt>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0xa,%edx
call   10e0 <read@plt>
mov    0x10(%rsp),%al
cmp    $0x41,%al
je     1995 <doCommand+0x705>
cmp    $0x45,%al
jne    19a1 <doCommand+0x711>
lea    0x8e5(%rip),%rdi
jmp    199c <doCommand+0x70c>
lea    0x11(%rsp),%rsi
lea    0x89f(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r15d,%edi
call   10c0 <close@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %r13d,%r13d
lea    0xc(%rsp),%r14
mov    0x274d(%rip),%r12
lea    0xb(%rsp),%rbp
jmp    1894 <doCommand+0x604>
nopw   0x0(%rax,%rax,1)
test   %ebx,%ebx
jle    18f0 <doCommand+0x660>
mov    %r15d,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   10e0 <read@plt>
movsbl 0xc(%rsp),%edi
cmp    (%r12),%dil
je     18f0 <doCommand+0x660>
mov    %eax,%ebx
xor    %eax,%eax
cmp    $0xa,%dil
sete   %al
add    %eax,%r13d
call   1040 <putchar@plt>
cmp    $0x13,%r13d
jne    1890 <doCommand+0x600>
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
call   10e0 <read@plt>
cmpb   $0xa,0xb(%rsp)
jne    18d0 <doCommand+0x640>
movb   $0x20,0xb(%rsp)
xor    %r13d,%r13d
jmp    1890 <doCommand+0x600>
lea    0x840(%rip),%rdi
call   1050 <puts@plt>
jmp    19af <doCommand+0x71f>
lea    0x11(%rsp),%rsi
lea    0x7ef(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r13d,%edi
call   10c0 <close@plt>
mov    %r15,%rdi
call   1030 <free@plt>
test   %r12d,%r12d
js     196a <doCommand+0x6da>
lea    0xc(%rsp),%rbx
xchg   %ax,%ax
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   10e0 <read@plt>
test   %eax,%eax
je     195a <doCommand+0x6ca>
mov    %eax,%ebp
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1060 <write@plt>
test   %ebp,%ebp
jg     1930 <doCommand+0x6a0>
mov    %r12d,%edi
call   10c0 <close@plt>
mov    %r13d,%edi
call   10c0 <close@plt>
mov    0x2637(%rip),%rax
cmp    (%rax),%r12d
jne    1982 <doCommand+0x6f2>
lea    0x7dc(%rip),%rdi
call   1050 <puts@plt>
test   %r12d,%r12d
js     1a5e <doCommand+0x7ce>
mov    %r15,%rdi
call   1030 <free@plt>
jmp    19af <doCommand+0x71f>
lea    0x81e(%rip),%rdi
call   1050 <puts@plt>
mov    %ebx,%edi
call   1120 <printBuffer@plt>
mov    %ebx,%edi
call   10c0 <close@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x7e9(%rip),%rdi
call   1050 <puts@plt>
lea    0x631(%rip),%rsi
mov    %r14d,%edi
mov    $0x2,%edx
call   1060 <write@plt>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0xa,%edx
call   10e0 <read@plt>
cmpb   $0x41,0x10(%rsp)
jne    1a06 <doCommand+0x776>
lea    0x7b9(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   1160 <exit@plt>
lea    0x5f4(%rip),%rdi
jmp    1a4f <doCommand+0x7bf>
mov    %ebp,%edi
call   10c0 <close@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1090 <dup2@plt>
lea    0x6e2(%rip),%rdi
lea    0x5f8(%rip),%rdx
mov    %rdi,%rsi
xor    %ecx,%ecx
call   1170 <execlp@plt>
mov    %ebx,%edi
call   10c0 <close@plt>
lea    0x5e3(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
lea    0x69f(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"exit\00"
@.str.1 = [10 x i8] c"Good bye\0A\00"
@.str.2 = [3 x i8] c"Q\0A\00"
@.str.3 = [10 x i8] c"Accepted\0A\00"
@.str.4 = [3 x i8] c"ls\00"
@.str.5 = [39 x i8] c"The pipe for ls did not open correctly\00"
@.str.6 = [3 x i8] c"-l\00"
@.str.7 = [36 x i8] c"the child did not execute properly.\00"
@.str.8 = [3 x i8] c"cd\00"
@.str.9 = [22 x i8] c"A path must be given\0A\00"
@.str.10 = [11 x i8] c"arg is %s\0A\00"
@.str.11 = [56 x i8] c"error in changing directory or directory does not exist\00"
@.str.12 = [32 x i8] c"The Directory has been changed\0A\00"
@.str.13 = [4 x i8] c"rcd\00"
@.str.14 = [2 x i8] c"C\00"
@.str.15 = [27 x i8] c"Directory has changed\0A %s\0A\00"
@.str.16 = [4 x i8] c"get\00"
@.str.17 = [3 x i8] c"D\0A\00"
@.str.18 = [61 x i8] c"The data connection has been established with the server %d\0A\00"
@.str.19 = [2 x i8] c"G\00"
@.str.20 = [2 x i8] c"\0A\00"
@.str.21 = [3 x i8] c"%s\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@ENOENT = global i32 0
@.str.22 = [37 x i8] c"The file you entered does not exist\0A\00"
@.str.23 = [5 x i8] c"show\00"
@EOF = global i8 0
@.str.24 = [3 x i8] c"%c\00"
@.str.25 = [35 x i8] c"********** End of file **********\0A\00"
@.str.26 = [4 x i8] c"put\00"
@.str.27 = [2 x i8] c"P\00"
@O_RDONLY = global i32 0
@.str.28 = [13 x i8] c"error in put\00"
@.str.29 = [4 x i8] c"rls\00"
@.str.30 = [3 x i8] c"L\0A\00"
@.str.31 = [7 x i8] c"Error\0A\00"
@.str.32 = [26 x i8] c"The command is not valid\0A\00"
define void @doCommand(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [10 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca [2 x i32]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca [2 x i8]
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca i32
%23 = alloca i32
%24 = alloca i8
%25 = alloca i32
%26 = alloca i32
%27 = alloca i8*
%28 = alloca [128 x i8]
%29 = alloca i8*
%30 = alloca i8*
%31 = alloca i32
%32 = alloca i32
%33 = alloca i8
%34 = alloca i32
%35 = alloca i8
%36 = alloca i32
%37 = alloca i32
%38 = alloca i8*
%39 = alloca [128 x i8]
%40 = alloca i8*
%41 = alloca i32
%42 = alloca i32
%43 = alloca i8
%44 = alloca i32
%45 = alloca i8*
%46 = alloca i32
%47 = alloca [128 x i8]
%48 = alloca i8*
%49 = alloca i32
%50 = alloca i8*
%51 = alloca [100 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%52 = load i8*, i8** %5
%53 = call i32 @strlen(i8* %52)
store i32 %53, i32* %7
%54 = load i8*, i8** %6
%55 = icmp ne i8* %54, null
br i1 %55, label %56, label %59
56: ; preds = %3
%57 = load i8*, i8** %6
%58 = call i32 @strlen(i8* %57)
store i32 %58, i32* %8
br label %59
59: ; preds = %56, %3
%60 = load i32, i32* %7
%61 = sext i32 %60 to i64
%62 = mul i64 1, %61
%63 = trunc i64 %62 to i32
%64 = call i64 @malloc(i32 %63)
%65 = inttoptr i64 %64 to i8*
store i8* %65, i8** %9
%66 = load i32, i32* %8
%67 = sext i32 %66 to i64
%68 = mul i64 1, %67
%69 = trunc i64 %68 to i32
%70 = call i64 @malloc(i32 %69)
%71 = inttoptr i64 %70 to i8*
store i8* %71, i8** %10
%72 = load i8*, i8** %6
%73 = icmp eq i8* %72, null
br i1 %73, label %74, label %77
74: ; preds = %59
%75 = load i8*, i8** %5
%76 = call i8* @removeNL(i8* %75)
store i8* %76, i8** %9
br label %80
77: ; preds = %59
%78 = load i8*, i8** %6
%79 = call i8* @removeNL(i8* %78)
store i8* %79, i8** %10
br label %80
80: ; preds = %77, %74
%81 = load i8*, i8** %9
%82 = call i64 @strcmp(i8* %81, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %99
84: ; preds = %80
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%86 = load i32, i32* %4
%87 = call i32 @write(i32 %86, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%88 = load i32, i32* %4
%89 = getelementptr inbounds [10 x i8], [10 x i8]* %11, i64 0, i64 0
%90 = call i32 @read(i32 %88, i8* %89, i32 10)
%91 = getelementptr inbounds [10 x i8], [10 x i8]* %11, i64 0, i64 0
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp eq i32 %93, 65
br i1 %94, label %95, label %97
95: ; preds = %84
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %97
97: ; preds = %95, %84
%98 = call i32 @exit(i32 0)
unreachable
99: ; preds = %80
%100 = load i8*, i8** %9
%101 = call i64 @strcmp(i8* %100, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %135
103: ; preds = %99
%104 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%105 = call i64 @pipe(i32* %104)
%106 = icmp slt i64 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %103
%108 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %103
%111 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%112 = load i32, i32* %111
store i32 %112, i32* %15
%113 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%114 = load i32, i32* %113
store i32 %114, i32* %16
%115 = call i32 (...) @fork()
store i32 %115, i32* %12
%116 = load i32, i32* %12
%117 = icmp eq i32 %116, 0
br i1 %117, label %118, label %128
118: ; preds = %110
%119 = load i32, i32* %15
%120 = call i32 @close(i32 %119)
%121 = load i32, i32* %16
%122 = call i32 @dup2(i32 %121, i32 1)
%123 = call i32 @execlp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* null)
%124 = load i32, i32* %16
%125 = call i32 @close(i32 %124)
%126 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
%127 = call i32 @exit(i32 1)
unreachable
128: ; preds = %110
%129 = load i32, i32* %16
%130 = call i32 @close(i32 %129)
%131 = call i32 @wait(i32* %13)
%132 = load i32, i32* %15
%133 = call i32 @printBuffer(i32 %132)
br label %134
134: ; preds = %128
br label %502
135: ; preds = %99
%136 = load i8*, i8** %5
%137 = call i64 @strcmp(i8* %136, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%138 = icmp eq i64 %137, 0
br i1 %138, label %139, label %156
139: ; preds = %135
%140 = load i8*, i8** %6
%141 = icmp eq i8* %140, null
br i1 %141, label %142, label %144
142: ; preds = %139
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
br label %154
144: ; preds = %139
%145 = load i8*, i8** %10
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %145)
%147 = load i8*, i8** %10
%148 = call i32 @chdir(i8* %147)
store i32 %148, i32* %17
%149 = load i32, i32* %17
%150 = icmp slt i32 %149, 0
br i1 %150, label %151, label %153
151: ; preds = %144
%152 = call i32 @perror(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0))
br label %153
153: ; preds = %151, %144
br label %154
154: ; preds = %153, %142
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0))
br label %501
156: ; preds = %135
%157 = load i8*, i8** %5
%158 = call i64 @strcmp(i8* %157, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
%159 = icmp eq i64 %158, 0
br i1 %159, label %160, label %183
160: ; preds = %156
%161 = load i8*, i8** %6
%162 = call i32 @strlen(i8* %161)
%163 = add nsw i32 %162, 1
%164 = call i64 @calloc(i32 %163, i32 1)
%165 = inttoptr i64 %164 to i8*
store i8* %165, i8** %18
%166 = load i8*, i8** %18
%167 = call i8* @strcat(i8* %166, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i8* %167, i8** %18
%168 = load i8*, i8** %18
%169 = load i8*, i8** %6
%170 = call i8* @strcat(i8* %168, i8* %169)
store i8* %170, i8** %18
%171 = load i32, i32* %4
%172 = load i8*, i8** %18
%173 = load i8*, i8** %18
%174 = call i32 @strlen(i8* %173)
%175 = call i32 @write(i32 %171, i8* %172, i32 %174)
%176 = load i32, i32* %4
%177 = getelementptr inbounds [2 x i8], [2 x i8]* %19, i64 0, i64 0
%178 = call i32 @read(i32 %176, i8* %177, i32 2)
%179 = getelementptr inbounds [2 x i8], [2 x i8]* %19, i64 0, i64 0
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i8* %179)
%181 = load i8*, i8** %18
%182 = call i32 @free(i8* %181)
br label %500
183: ; preds = %156
%184 = load i8*, i8** %5
%185 = call i64 @strcmp(i8* %184, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
%186 = icmp eq i64 %185, 0
br i1 %186, label %187, label %276
187: ; preds = %183
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i8** %20
store i32 1, i32* %23
%188 = load i32, i32* %4
%189 = load i8*, i8** %20
%190 = call i32 @write(i32 %188, i8* %189, i32 2)
%191 = load i32, i32* %4
%192 = call i32 @createConnection(i32 %191)
store i32 %192, i32* %25
%193 = load i32, i32* %25
%194 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.18, i64 0, i64 0), i32 %193)
%195 = load i8*, i8** %6
%196 = call i32 @strlen(i8* %195)
store i32 %196, i32* %26
%197 = load i32, i32* %26
%198 = add nsw i32 %197, 1
%199 = call i64 @calloc(i32 %198, i32 1)
%200 = inttoptr i64 %199 to i8*
store i8* %200, i8** %27
%201 = load i8*, i8** %27
%202 = call i8* @strcat(i8* %201, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
store i8* %202, i8** %27
%203 = load i8*, i8** %27
%204 = load i8*, i8** %10
%205 = call i8* @strcat(i8* %203, i8* %204)
store i8* %205, i8** %27
%206 = load i8*, i8** %27
%207 = call i8* @strcat(i8* %206, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
store i8* %207, i8** %27
%208 = load i32, i32* %4
%209 = load i8*, i8** %27
%210 = load i8*, i8** %27
%211 = call i32 @strlen(i8* %210)
%212 = call i32 @write(i32 %208, i8* %209, i32 %211)
%213 = load i8*, i8** %10
%214 = call i8* @getFileName(i8* %213)
store i8* %214, i8** %21
%215 = load i32, i32* %4
%216 = getelementptr inbounds [128 x i8], [128 x i8]* %28, i64 0, i64 0
%217 = call i32 @read(i32 %215, i8* %216, i32 128)
%218 = getelementptr inbounds [128 x i8], [128 x i8]* %28, i64 0, i64 0
%219 = load i8, i8* %218
%220 = sext i8 %219 to i32
%221 = icmp eq i32 %220, 65
br i1 %221, label %222, label %224
222: ; preds = %187
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %224
224: ; preds = %222, %187
%225 = getelementptr inbounds [128 x i8], [128 x i8]* %28, i64 0, i64 0
%226 = load i8, i8* %225
%227 = sext i8 %226 to i32
%228 = icmp eq i32 %227, 69
br i1 %228, label %229, label %236
229: ; preds = %224
%230 = getelementptr inbounds [128 x i8], [128 x i8]* %28, i64 0, i64 1
%231 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0), i8* %230)
%232 = load i32, i32* %25
%233 = call i32 @close(i32 %232)
%234 = load i8*, i8** %27
%235 = call i32 @free(i8* %234)
br label %503
236: ; preds = %224
%237 = load i8*, i8** %21
%238 = load i32, i32* @O_RDWR
%239 = load i32, i32* @O_CREAT
%240 = or i32 %238, %239
%241 = load i32, i32* @S_IRUSR
%242 = load i32, i32* @S_IWUSR
%243 = or i32 %241, %242
%244 = call i32 (i8*, i32, ...) @open(i8* %237, i32 %240, i32 %243)
store i32 %244, i32* %22
%245 = load i32, i32* %22
%246 = icmp sge i32 %245, 0
br i1 %246, label %247, label %263
247: ; preds = %236
br label %248
248: ; preds = %257, %247
%249 = load i32, i32* %23
%250 = icmp sgt i32 %249, 0
br i1 %250, label %251, label %260
251: ; preds = %248
%252 = load i32, i32* %25
%253 = call i32 @read(i32 %252, i8* %24, i32 1)
store i32 %253, i32* %23
%254 = load i32, i32* %23
%255 = icmp eq i32 %254, 0
br i1 %255, label %256, label %257
256: ; preds = %251
br label %260
257: ; preds = %251
%258 = load i32, i32* %22
%259 = call i32 @write(i32 %258, i8* %24, i32 1)
br label %248
260: ; preds = %256, %248
%261 = load i32, i32* %22
%262 = call i32 @close(i32 %261)
br label %263
263: ; preds = %260, %236
%264 = load i32, i32* %22
%265 = load i32, i32* @ENOENT
%266 = icmp eq i32 %264, %265
br i1 %266, label %267, label %271
267: ; preds = %263
%268 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.22, i64 0, i64 0))
%269 = load i32, i32* %22
%270 = call i32 @close(i32 %269)
br label %271
271: ; preds = %267, %263
%272 = load i32, i32* %25
%273 = call i32 @close(i32 %272)
%274 = load i8*, i8** %27
%275 = call i32 @free(i8* %274)
br label %499
276: ; preds = %183
%277 = load i8*, i8** %5
%278 = call i64 @strcmp(i8* %277, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.23, i64 0, i64 0))
%279 = icmp eq i64 %278, 0
br i1 %279, label %280, label %370
280: ; preds = %276
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i8** %29
store i32 1, i32* %32
store i32 0, i32* %34
store i8 32, i8* %35
%281 = load i32, i32* %4
%282 = load i8*, i8** %29
%283 = call i32 @write(i32 %281, i8* %282, i32 2)
%284 = load i32, i32* %4
%285 = call i32 @createConnection(i32 %284)
store i32 %285, i32* %36
%286 = load i8*, i8** %6
%287 = call i32 @strlen(i8* %286)
store i32 %287, i32* %37
%288 = load i32, i32* %37
%289 = add nsw i32 %288, 1
%290 = call i64 @calloc(i32 %289, i32 1)
%291 = inttoptr i64 %290 to i8*
store i8* %291, i8** %38
%292 = load i8*, i8** %38
%293 = call i8* @strcat(i8* %292, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
store i8* %293, i8** %38
%294 = load i8*, i8** %38
%295 = load i8*, i8** %10
%296 = call i8* @strcat(i8* %294, i8* %295)
store i8* %296, i8** %38
%297 = load i8*, i8** %38
%298 = call i8* @strcat(i8* %297, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
store i8* %298, i8** %38
%299 = load i32, i32* %4
%300 = load i8*, i8** %38
%301 = load i8*, i8** %38
%302 = call i32 @strlen(i8* %301)
%303 = call i32 @write(i32 %299, i8* %300, i32 %302)
%304 = load i8*, i8** %10
%305 = call i8* @getFileName(i8* %304)
store i8* %305, i8** %30
%306 = load i32, i32* %4
%307 = getelementptr inbounds [128 x i8], [128 x i8]* %39, i64 0, i64 0
%308 = call i32 @read(i32 %306, i8* %307, i32 128)
%309 = getelementptr inbounds [128 x i8], [128 x i8]* %39, i64 0, i64 0
%310 = load i8, i8* %309
%311 = sext i8 %310 to i32
%312 = icmp eq i32 %311, 65
br i1 %312, label %313, label %315
313: ; preds = %280
%314 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %315
315: ; preds = %313, %280
%316 = getelementptr inbounds [128 x i8], [128 x i8]* %39, i64 0, i64 0
%317 = load i8, i8* %316
%318 = sext i8 %317 to i32
%319 = icmp eq i32 %318, 69
br i1 %319, label %320, label %327
320: ; preds = %315
%321 = getelementptr inbounds [128 x i8], [128 x i8]* %39, i64 0, i64 1
%322 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0), i8* %321)
%323 = load i32, i32* %36
%324 = call i32 @close(i32 %323)
%325 = load i8*, i8** %38
%326 = call i32 @free(i8* %325)
br label %327
327: ; preds = %320, %315
br label %328
328: ; preds = %361, %327
%329 = load i32, i32* %32
%330 = icmp sgt i32 %329, 0
br i1 %330, label %331, label %362
331: ; preds = %328
%332 = load i32, i32* %36
%333 = call i32 @read(i32 %332, i8* %33, i32 1)
store i32 %333, i32* %32
%334 = load i8, i8* %33
%335 = sext i8 %334 to i32
%336 = load i8, i8* @EOF
%337 = sext i8 %336 to i32
%338 = icmp eq i32 %335, %337
br i1 %338, label %339, label %340
339: ; preds = %331
br label %362
340: ; preds = %331
%341 = load i8, i8* %33
%342 = sext i8 %341 to i32
%343 = icmp eq i32 %342, 10
br i1 %343, label %344, label %347
344: ; preds = %340
%345 = load i32, i32* %34
%346 = add nsw i32 %345, 1
store i32 %346, i32* %34
br label %347
347: ; preds = %344, %340
%348 = load i8, i8* %33
%349 = sext i8 %348 to i32
%350 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0), i32 %349)
%351 = load i32, i32* %34
%352 = icmp eq i32 %351, 19
br i1 %352, label %353, label %361
353: ; preds = %347
br label %354
354: ; preds = %358, %353
%355 = load i8, i8* %35
%356 = sext i8 %355 to i32
%357 = icmp ne i32 %356, 10
br i1 %357, label %358, label %360
358: ; preds = %354
%359 = call i32 @read(i32 0, i8* %35, i32 1)
br label %354
360: ; preds = %354
store i8 32, i8* %35
store i32 0, i32* %34
br label %361
361: ; preds = %360, %347
br label %328
362: ; preds = %339, %328
%363 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.25, i64 0, i64 0))
%364 = load i32, i32* %31
%365 = load i32, i32* @ENOENT
%366 = icmp eq i32 %364, %365
br i1 %366, label %367, label %369
367: ; preds = %362
%368 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.22, i64 0, i64 0))
br label %369
369: ; preds = %367, %362
br label %498
370: ; preds = %276
%371 = load i8*, i8** %5
%372 = call i64 @strcmp(i8* %371, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0))
%373 = icmp eq i64 %372, 0
br i1 %373, label %374, label %458
374: ; preds = %370
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i8** %40
store i32 1, i32* %42
%375 = load i32, i32* %4
%376 = load i8*, i8** %40
%377 = call i32 @write(i32 %375, i8* %376, i32 2)
%378 = load i8*, i8** %6
%379 = call i32 @strlen(i8* %378)
store i32 %379, i32* %44
%380 = load i32, i32* %44
%381 = add nsw i32 %380, 1
%382 = call i64 @calloc(i32 %381, i32 1)
%383 = inttoptr i64 %382 to i8*
store i8* %383, i8** %45
%384 = load i32, i32* %4
%385 = call i32 @createConnection(i32 %384)
store i32 %385, i32* %46
%386 = load i8*, i8** %45
%387 = call i8* @strcat(i8* %386, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.27, i64 0, i64 0))
store i8* %387, i8** %45
%388 = load i8*, i8** %45
%389 = load i8*, i8** %10
%390 = call i8* @strcat(i8* %388, i8* %389)
store i8* %390, i8** %45
%391 = load i8*, i8** %45
%392 = call i8* @strcat(i8* %391, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
store i8* %392, i8** %45
%393 = load i32, i32* %4
%394 = load i8*, i8** %45
%395 = load i8*, i8** %45
%396 = call i32 @strlen(i8* %395)
%397 = call i32 @write(i32 %393, i8* %394, i32 %396)
%398 = load i8*, i8** %10
%399 = load i32, i32* @O_RDONLY
%400 = call i32 (i8*, i32, ...) @open(i8* %398, i32 %399)
store i32 %400, i32* %41
%401 = load i32, i32* %4
%402 = getelementptr inbounds [128 x i8], [128 x i8]* %47, i64 0, i64 0
%403 = call i32 @read(i32 %401, i8* %402, i32 128)
%404 = getelementptr inbounds [128 x i8], [128 x i8]* %47, i64 0, i64 0
%405 = load i8, i8* %404
%406 = sext i8 %405 to i32
%407 = icmp eq i32 %406, 65
br i1 %407, label %408, label %410
408: ; preds = %374
%409 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %410
410: ; preds = %408, %374
%411 = getelementptr inbounds [128 x i8], [128 x i8]* %47, i64 0, i64 0
%412 = load i8, i8* %411
%413 = sext i8 %412 to i32
%414 = icmp eq i32 %413, 69
br i1 %414, label %415, label %422
415: ; preds = %410
%416 = getelementptr inbounds [128 x i8], [128 x i8]* %47, i64 0, i64 1
%417 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0), i8* %416)
%418 = load i32, i32* %46
%419 = call i32 @close(i32 %418)
%420 = load i8*, i8** %45
%421 = call i32 @free(i8* %420)
br label %422
422: ; preds = %415, %410
%423 = load i32, i32* %41
%424 = icmp sge i32 %423, 0
br i1 %424, label %425, label %443
425: ; preds = %422
br label %426
426: ; preds = %435, %425
%427 = load i32, i32* %42
%428 = icmp sgt i32 %427, 0
br i1 %428, label %429, label %438
429: ; preds = %426
%430 = load i32, i32* %41
%431 = call i32 @read(i32 %430, i8* %43, i32 1)
store i32 %431, i32* %42
%432 = load i32, i32* %42
%433 = icmp eq i32 %432, 0
br i1 %433, label %434, label %435
434: ; preds = %429
br label %438
435: ; preds = %429
%436 = load i32, i32* %46
%437 = call i32 @write(i32 %436, i8* %43, i32 1)
br label %426
438: ; preds = %434, %426
%439 = load i32, i32* %41
%440 = call i32 @close(i32 %439)
%441 = load i32, i32* %46
%442 = call i32 @close(i32 %441)
br label %443
443: ; preds = %438, %422
%444 = load i32, i32* %41
%445 = load i32, i32* @ENOENT
%446 = icmp eq i32 %444, %445
br i1 %446, label %447, label %449
447: ; preds = %443
%448 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.22, i64 0, i64 0))
br label %449
449: ; preds = %447, %443
%450 = load i32, i32* %41
%451 = icmp slt i32 %450, 0
br i1 %451, label %452, label %455
452: ; preds = %449
%453 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.28, i64 0, i64 0))
%454 = call i32 @exit(i32 1)
unreachable
455: ; preds = %449
%456 = load i8*, i8** %45
%457 = call i32 @free(i8* %456)
br label %497
458: ; preds = %370
%459 = load i8*, i8** %9
%460 = call i64 @strcmp(i8* %459, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i64 0, i64 0))
%461 = icmp eq i64 %460, 0
br i1 %461, label %462, label %494
462: ; preds = %458
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i8** %48
%463 = load i32, i32* %4
%464 = load i8*, i8** %48
%465 = call i32 @write(i32 %463, i8* %464, i32 2)
%466 = load i32, i32* %4
%467 = call i32 @createConnection(i32 %466)
store i32 %467, i32* %49
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.30, i64 0, i64 0), i8** %50
%468 = load i32, i32* %4
%469 = load i8*, i8** %50
%470 = load i8*, i8** %50
%471 = call i32 @strlen(i8* %470)
%472 = call i32 @write(i32 %468, i8* %469, i32 %471)
%473 = load i32, i32* %4
%474 = getelementptr inbounds [100 x i8], [100 x i8]* %51, i64 0, i64 0
%475 = call i32 @read(i32 %473, i8* %474, i32 10)
%476 = getelementptr inbounds [100 x i8], [100 x i8]* %51, i64 0, i64 0
%477 = load i8, i8* %476
%478 = sext i8 %477 to i32
%479 = icmp eq i32 %478, 65
br i1 %479, label %480, label %482
480: ; preds = %462
%481 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %482
482: ; preds = %480, %462
%483 = getelementptr inbounds [100 x i8], [100 x i8]* %51, i64 0, i64 0
%484 = load i8, i8* %483
%485 = sext i8 %484 to i32
%486 = icmp eq i32 %485, 69
br i1 %486, label %487, label %489
487: ; preds = %482
%488 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.31, i64 0, i64 0))
br label %489
489: ; preds = %487, %482
%490 = load i32, i32* %49
%491 = call i32 @printBuffer(i32 %490)
%492 = load i32, i32* %49
%493 = call i32 @close(i32 %492)
br label %496
494: ; preds = %458
%495 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.32, i64 0, i64 0))
br label %496
496: ; preds = %494, %489
br label %497
497: ; preds = %496, %455
br label %498
498: ; preds = %497, %369
br label %499
499: ; preds = %498, %271
br label %500
500: ; preds = %499, %160
br label %501
501: ; preds = %500, %154
br label %502
502: ; preds = %501, %134
br label %503
503: ; preds = %229, %502
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"exit\00"
@.str.2 = [3 x i8] c"Q\0A\00"
@.str.4 = [3 x i8] c"ls\00"
@.str.5 = [39 x i8] c"The pipe for ls did not open correctly\00"
@.str.6 = [3 x i8] c"-l\00"
@.str.7 = [36 x i8] c"the child did not execute properly.\00"
@.str.8 = [3 x i8] c"cd\00"
@.str.10 = [11 x i8] c"arg is %s\0A\00"
@.str.11 = [56 x i8] c"error in changing directory or directory does not exist\00"
@.str.13 = [4 x i8] c"rcd\00"
@.str.15 = [27 x i8] c"Directory has changed\0A %s\0A\00"
@.str.16 = [4 x i8] c"get\00"
@.str.17 = [3 x i8] c"D\0A\00"
@.str.18 = [61 x i8] c"The data connection has been established with the server %d\0A\00"
@.str.21 = [3 x i8] c"%s\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@ENOENT = global i32 0
@.str.23 = [5 x i8] c"show\00"
@EOF = global i8 0
@.str.26 = [4 x i8] c"put\00"
@O_RDONLY = global i32 0
@.str.28 = [13 x i8] c"error in put\00"
@.str.29 = [4 x i8] c"rls\00"
@.str.30 = [3 x i8] c"L\0A\00"
@str = [25 x i8] c"The command is not valid\00"
@str.33 = [6 x i8] c"Error\00"
@str.37 = [34 x i8] c"********** End of file **********\00"
@str.39 = [36 x i8] c"The file you entered does not exist\00"
@str.41 = [31 x i8] c"The Directory has been changed\00"
@str.42 = [21 x i8] c"A path must be given\00"
@str.43 = [9 x i8] c"Good bye\00"
@str.44 = [9 x i8] c"Accepted\00"
define void @doCommand(i32 %0, i8* %1, i8* %2) {
%4 = alloca [10 x i8]
%5 = alloca i32
%6 = alloca [2 x i32]
%7 = alloca [2 x i8]
%8 = alloca i8
%9 = alloca [128 x i8]
%10 = alloca i8
%11 = alloca i8
%12 = alloca [128 x i8]
%13 = alloca i8
%14 = alloca [128 x i8]
%15 = alloca [100 x i8]
%16 = tail call i32 @strlen(i8* %1)
%17 = icmp eq i8* %2, null
br i1 %17, label %20, label %18
18: ; preds = %3
%19 = tail call i32 @strlen(i8* %2)
br label %20
20: ; preds = %18, %3
%21 = phi i32 [ %19, %18 ], [ undef, %3 ]
%22 = tail call i64 @malloc(i32 %16)
%23 = tail call i64 @malloc(i32 %21)
br i1 %17, label %24, label %27
24: ; preds = %20
%25 = inttoptr i64 %23 to i8*
%26 = tail call i8* @removeNL(i8* %1)
br label %30
27: ; preds = %20
%28 = inttoptr i64 %22 to i8*
%29 = tail call i8* @removeNL(i8* %2)
br label %30
30: ; preds = %27, %24
%31 = phi i8* [ %25, %24 ], [ %29, %27 ]
%32 = phi i8* [ %26, %24 ], [ %28, %27 ]
%33 = tail call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %46
35: ; preds = %30
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0))
%37 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%38 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%39 = call i32 @read(i32 %0, i8* %38, i32 10)
%40 = load i8, i8* %38
%41 = icmp eq i8 %40, 65
br i1 %41, label %42, label %44
42: ; preds = %35
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.44, i64 0, i64 0))
br label %44
44: ; preds = %42, %35
%45 = tail call i32 @exit(i32 0)
unreachable
46: ; preds = %30
%47 = tail call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %75
49: ; preds = %46
%50 = bitcast i32* %5 to i8*
%51 = bitcast [2 x i32]* %6 to i8*
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%53 = call i64 @pipe(i32* %52)
%54 = icmp slt i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %49
%56 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %49
%59 = load i32, i32* %52
%60 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%61 = load i32, i32* %60
%62 = call i32 (...) @fork()
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %71
64: ; preds = %58
%65 = call i32 @close(i32 %59)
%66 = call i32 @dup2(i32 %61, i32 1)
%67 = call i32 @execlp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* null)
%68 = call i32 @close(i32 %61)
%69 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %58
%72 = call i32 @close(i32 %61)
%73 = call i32 @wait(i32* %5)
%74 = call i32 @printBuffer(i32 %59)
br label %293
75: ; preds = %46
%76 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %89
78: ; preds = %75
br i1 %17, label %79, label %81
79: ; preds = %78
%80 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.42, i64 0, i64 0))
br label %87
81: ; preds = %78
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %31)
%83 = tail call i32 @chdir(i8* %31)
%84 = icmp slt i32 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %81
%86 = tail call i32 @perror(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0))
br label %87
87: ; preds = %81, %85, %79
%88 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.41, i64 0, i64 0))
br label %293
89: ; preds = %75
%90 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %107
92: ; preds = %89
%93 = tail call i32 @strlen(i8* %2)
%94 = add nsw i32 %93, 1
%95 = tail call i64 @calloc(i32 %94, i32 1)
%96 = inttoptr i64 %95 to i8*
%97 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %96)
%98 = getelementptr i8, i8* %96, i64 %97
%99 = bitcast i8* %98 to i16*
store i16 67, i16* %99
%100 = tail call i8* @strcat(i8* dereferenceable(1) %96, i8* dereferenceable(1) %2)
%101 = tail call i32 @strlen(i8* %96)
%102 = tail call i32 @write(i32 %0, i8* %96, i32 %101)
%103 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%104 = call i32 @read(i32 %0, i8* %103, i32 2)
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i8* %103)
%106 = call i32 @free(i8* %96)
br label %293
107: ; preds = %89
%108 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
%109 = icmp eq i64 %108, 0
br i1 %109, label %110, label %165
110: ; preds = %107
%111 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32 2)
%112 = tail call i32 @createConnection(i32 %0)
%113 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.18, i64 0, i64 0), i32 %112)
%114 = tail call i32 @strlen(i8* %2)
%115 = add nsw i32 %114, 1
%116 = tail call i64 @calloc(i32 %115, i32 1)
%117 = inttoptr i64 %116 to i8*
%118 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %117)
%119 = getelementptr i8, i8* %117, i64 %118
%120 = bitcast i8* %119 to i16*
store i16 71, i16* %120
%121 = tail call i8* @strcat(i8* dereferenceable(1) %117, i8* dereferenceable(1) %31)
%122 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %117)
%123 = getelementptr i8, i8* %117, i64 %122
%124 = bitcast i8* %123 to i16*
store i16 10, i16* %124
%125 = tail call i32 @strlen(i8* %117)
%126 = tail call i32 @write(i32 %0, i8* %117, i32 %125)
%127 = tail call i8* @getFileName(i8* %31)
%128 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%129 = call i32 @read(i32 %0, i8* %128, i32 128)
%130 = load i8, i8* %128
switch i8 %130, label %138 [
i8 65, label %131
i8 69, label %133
]
131: ; preds = %110
%132 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.44, i64 0, i64 0))
br label %138
133: ; preds = %110
%134 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 1
%135 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0), i8* %134)
%136 = call i32 @close(i32 %112)
%137 = call i32 @free(i8* %117)
br label %164
138: ; preds = %110, %131
%139 = load i32, i32* @O_RDWR
%140 = load i32, i32* @O_CREAT
%141 = or i32 %140, %139
%142 = load i32, i32* @S_IRUSR
%143 = load i32, i32* @S_IWUSR
%144 = or i32 %143, %142
%145 = tail call i32 (i8*, i32, ...) @open(i8* %127, i32 %141, i32 %144)
%146 = icmp sgt i32 %145, -1
br i1 %146, label %147, label %155
147: ; preds = %138, %150
%148 = call i32 @read(i32 %112, i8* %8, i32 1)
%149 = icmp eq i32 %148, 0
br i1 %149, label %153, label %150
150: ; preds = %147
%151 = call i32 @write(i32 %145, i8* %8, i32 1)
%152 = icmp sgt i32 %148, 0
br i1 %152, label %147, label %153
153: ; preds = %147, %150
%154 = tail call i32 @close(i32 %145)
br label %155
155: ; preds = %153, %138
%156 = load i32, i32* @ENOENT
%157 = icmp eq i32 %145, %156
br i1 %157, label %158, label %161
158: ; preds = %155
%159 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.39, i64 0, i64 0))
%160 = tail call i32 @close(i32 %145)
br label %161
161: ; preds = %158, %155
%162 = tail call i32 @close(i32 %112)
%163 = tail call i32 @free(i8* %117)
br label %164
164: ; preds = %161, %133
br label %293
165: ; preds = %107
%166 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.23, i64 0, i64 0))
%167 = icmp eq i64 %166, 0
br i1 %167, label %168, label %219
168: ; preds = %165
store i8 32, i8* %11
%169 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32 2)
%170 = tail call i32 @createConnection(i32 %0)
%171 = tail call i32 @strlen(i8* %2)
%172 = add nsw i32 %171, 1
%173 = tail call i64 @calloc(i32 %172, i32 1)
%174 = inttoptr i64 %173 to i8*
%175 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %174)
%176 = getelementptr i8, i8* %174, i64 %175
%177 = bitcast i8* %176 to i16*
store i16 71, i16* %177
%178 = tail call i8* @strcat(i8* dereferenceable(1) %174, i8* dereferenceable(1) %31)
%179 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %174)
%180 = getelementptr i8, i8* %174, i64 %179
%181 = bitcast i8* %180 to i16*
store i16 10, i16* %181
%182 = tail call i32 @strlen(i8* %174)
%183 = tail call i32 @write(i32 %0, i8* %174, i32 %182)
%184 = tail call i8* @getFileName(i8* %31)
%185 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%186 = call i32 @read(i32 %0, i8* %185, i32 128)
%187 = load i8, i8* %185
switch i8 %187, label %195 [
i8 65, label %188
i8 69, label %190
]
188: ; preds = %168
%189 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.44, i64 0, i64 0))
br label %195
190: ; preds = %168
%191 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 1
%192 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0), i8* %191)
%193 = call i32 @close(i32 %170)
%194 = call i32 @free(i8* %174)
br label %195
195: ; preds = %168, %188, %190
br label %196
196: ; preds = %195, %214
%197 = phi i32 [ %215, %214 ], [ 0, %195 ]
%198 = call i32 @read(i32 %170, i8* %10, i32 1)
%199 = load i8, i8* %10
%200 = load i8, i8* @EOF
%201 = icmp eq i8 %199, %200
br i1 %201, label %217, label %202
202: ; preds = %196
%203 = icmp eq i8 %199, 10
%204 = zext i1 %203 to i32
%205 = add nsw i32 %197, %204
%206 = sext i8 %199 to i32
%207 = call i32 @putchar(i32 %206)
%208 = icmp eq i32 %205, 19
br i1 %208, label %209, label %214
209: ; preds = %202, %209
%210 = call i32 @read(i32 0, i8* %11, i32 1)
%211 = load i8, i8* %11
%212 = icmp eq i8 %211, 10
br i1 %212, label %213, label %209
213: ; preds = %209
store i8 32, i8* %11
br label %214
214: ; preds = %213, %202
%215 = phi i32 [ 0, %213 ], [ %205, %202 ]
%216 = icmp sgt i32 %198, 0
br i1 %216, label %196, label %217
217: ; preds = %196, %214
%218 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.37, i64 0, i64 0))
br label %293
219: ; preds = %165
%220 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0))
%221 = icmp eq i64 %220, 0
br i1 %221, label %222, label %273
222: ; preds = %219
%223 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32 2)
%224 = tail call i32 @strlen(i8* %2)
%225 = add nsw i32 %224, 1
%226 = tail call i64 @calloc(i32 %225, i32 1)
%227 = inttoptr i64 %226 to i8*
%228 = tail call i32 @createConnection(i32 %0)
%229 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %227)
%230 = getelementptr i8, i8* %227, i64 %229
%231 = bitcast i8* %230 to i16*
store i16 80, i16* %231
%232 = tail call i8* @strcat(i8* dereferenceable(1) %227, i8* dereferenceable(1) %31)
%233 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %227)
%234 = getelementptr i8, i8* %227, i64 %233
%235 = bitcast i8* %234 to i16*
store i16 10, i16* %235
%236 = tail call i32 @strlen(i8* %227)
%237 = tail call i32 @write(i32 %0, i8* %227, i32 %236)
%238 = load i32, i32* @O_RDONLY
%239 = tail call i32 (i8*, i32, ...) @open(i8* %31, i32 %238)
%240 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 0
%241 = call i32 @read(i32 %0, i8* %240, i32 128)
%242 = load i8, i8* %240
switch i8 %242, label %250 [
i8 65, label %243
i8 69, label %245
]
243: ; preds = %222
%244 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.44, i64 0, i64 0))
br label %250
245: ; preds = %222
%246 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 1
%247 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0), i8* %246)
%248 = call i32 @close(i32 %228)
%249 = call i32 @free(i8* %227)
br label %250
250: ; preds = %222, %243, %245
%251 = icmp sgt i32 %239, -1
br i1 %251, label %252, label %261
252: ; preds = %250, %255
%253 = call i32 @read(i32 %239, i8* %13, i32 1)
%254 = icmp eq i32 %253, 0
br i1 %254, label %258, label %255
255: ; preds = %252
%256 = call i32 @write(i32 %228, i8* %13, i32 1)
%257 = icmp sgt i32 %253, 0
br i1 %257, label %252, label %258
258: ; preds = %252, %255
%259 = call i32 @close(i32 %239)
%260 = call i32 @close(i32 %228)
br label %261
261: ; preds = %258, %250
%262 = load i32, i32* @ENOENT
%263 = icmp eq i32 %239, %262
br i1 %263, label %264, label %266
264: ; preds = %261
%265 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.39, i64 0, i64 0))
br label %266
266: ; preds = %264, %261
%267 = icmp slt i32 %239, 0
br i1 %267, label %268, label %271
268: ; preds = %266
%269 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.28, i64 0, i64 0))
%270 = call i32 @exit(i32 1)
unreachable
271: ; preds = %266
%272 = call i32 @free(i8* %227)
br label %293
273: ; preds = %219
%274 = tail call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i64 0, i64 0))
%275 = icmp eq i64 %274, 0
br i1 %275, label %276, label %291
276: ; preds = %273
%277 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32 2)
%278 = tail call i32 @createConnection(i32 %0)
%279 = tail call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.30, i64 0, i64 0))
%280 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.30, i64 0, i64 0), i32 %279)
%281 = getelementptr inbounds [100 x i8], [100 x i8]* %15, i64 0, i64 0
%282 = call i32 @read(i32 %0, i8* %281, i32 10)
%283 = load i8, i8* %281
switch i8 %283, label %288 [
i8 65, label %285
i8 69, label %284
]
284: ; preds = %276
br label %285
285: ; preds = %276, %284
%286 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.33, i64 0, i64 0), %284 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.44, i64 0, i64 0), %276 ]
%287 = tail call i32 @puts(i8* dereferenceable(1) %286)
br label %288
288: ; preds = %285, %276
%289 = tail call i32 @printBuffer(i32 %278)
%290 = tail call i32 @close(i32 %278)
br label %293
291: ; preds = %273
%292 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %293
293: ; preds = %164, %87, %271, %291, %288, %217, %92, %71
ret void
}