#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 */
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWUSR;
int atoi(char *);
int /*<<< orphan*/ chmod(char *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ execlp(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fdopen(int, char *);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fscanf(int /*<<< orphan*/ *, char *, char *);
char getopt(int, char **, char *);
char *optarg;
scalar_t__ opterr;
int optind;
int /*<<< orphan*/ perror(char *);
int pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int read(int /*<<< orphan*/, void *, int);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int sscanf(char *, char *, char *, char *, char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
char *strdup(char *);
int /*<<< orphan*/ *strstr(char *, char *);
int main(int argc, char **argv) {
  char str[4096];
  int rc, j;
  char action[20];
  char xfr_id_s[20];
  int xfr_id;
  char cp_xfr_id_s[20];
  int cp_xfr_id;
  char src_url[1024];
  char dst_url[1024];
  char *dst_url_tmp;
  char modex;
  int end = 0;
  fd_set in_pipes;
  char c;
  char *url;
  char *stg_url;
  char buffer[512];
  int u, f, g;
  char opt;
  int server_pid = -1;
  int pipes[2];
  FILE *file;
  setbuf(stdout, NULL);
  opterr = 0;
  optind = 1;
  u = f = g = 0;
  url = NULL;
  while ((opt = getopt(argc, argv, "h:u:fg")) != -1)
    switch (opt) {
    case 'u':
      url = strdup(optarg);
      u = 1;
      break;
    case 'f':
      f = 1;
      break;
    case 'g':
      g = 1;
      break;
    }
  while (!end) {
    FD_ZERO(&in_pipes);
    FD_SET(0, &in_pipes);
    rc = select(1, &in_pipes, NULL, NULL, NULL);
    if (rc == -1) {
      exit(-1);
    } else if (rc == 1) {
      j = 0;
      do {
        rc = read(0, (void *)&c, sizeof(char));
        str[j++] = c;
      } while (rc > 0 && c != '\n');
      str[j] = '\0';
      if (rc <= 0) {
        exit(-1);
      }
      rc = sscanf(str, "%s %s %s %c %s %s", action, xfr_id_s, cp_xfr_id_s,
                  &modex, src_url, dst_url);
      if (rc != 6) {
        printf("%s %s %s FAILURE Not enough parameters.\n", action, xfr_id_s,
               cp_xfr_id_s);
        continue;
      }
      xfr_id = atoi(xfr_id_s);
      if (strcmp(action, "INIT") == 0) {
        if (u == 1) {
          stg_url = url;
          rc = 0;
        } else if (g == 1) {
          if (pipe(pipes) == -1) {
            fprintf(stderr, "couldn't create pipes\n");
            rc = 1;
          } else {
            int fscanf_result;
            server_pid = fork();
            switch (server_pid) {
            case 0:
              close(pipes[0]);
              dup2(pipes[1], 1);
              execlp("globus-gass-server", "globus-gass-server", NULL);
              rc = 1;
            case -1:
              fprintf(stderr, "couldn't fork\n");
              rc = 1;
            default:
              close(pipes[1]);
              file = fdopen(pipes[0], "r");
              if (file == NULL)
                perror("opening stdout");
              fscanf_result = fscanf(file, "%s", buffer);
              stg_url = strdup(buffer);
              rc = 0;
            }
          }
        } else if (f == 1) {
          if (pipe(pipes) == -1) {
            fprintf(stderr, "couldn't create pipes\n");
            rc = 1;
          } else {
            int fscanf_result;
            server_pid = fork();
            switch (server_pid) {
            case 0:
              close(pipes[0]);
              dup2(pipes[1], 1);
              execlp("globus-gridftp-server", "globus-gridftp-server", NULL);
              rc = 1;
            case -1:
              fprintf(stderr, "couldn't fork\n");
              rc = 1;
            default:
              close(pipes[1]);
              file = fdopen(pipes[0], "r");
              if (file == NULL)
                perror("opening stdout");
              fscanf_result = fscanf(file, "%s", buffer);
              fscanf_result = fscanf(file, "%s", buffer);
              fscanf_result = fscanf(file, "%s", buffer);
              fscanf_result = fscanf(file, "%s", buffer);
              sprintf(str, "gsiftp://%s", buffer);
              stg_url = strdup(str);
              rc = 0;
            }
          }
        } else {
          stg_url = strdup("-");
          rc = 0;
        }
        if (rc == 1)
          printf("INIT - - FAILURE Error Activating the staging module.\n");
        else
          printf("INIT - - SUCCESS %s\n", stg_url);
      } else if (strcmp(action, "START") == 0) {
        printf("START %i - SUCCESS -\n", xfr_id);
      } else if (strcmp(action, "END") == 0) {
        printf("END %i - SUCCESS -\n", xfr_id);
      } else if (strcmp(action, "RMDIR") == 0) {
        printf("RMDIR %i - SUCCESS -\n", xfr_id);
      } else if (strcmp(action, "EXISTS") == 0) {
        printf("EXISTS %d - SUCCESS -\n", xfr_id);
      } else if (strcmp(action, "MKDIR") == 0) {
        printf("MKDIR %d - SUCCESS %s\n", xfr_id, src_url);
      } else if (strcmp(action, "CP") == 0) {
        cp_xfr_id = atoi(cp_xfr_id_s);
        if (g == 1) {
          if ((strstr(src_url, "stdout.wrapper") != NULL) ||
              (strstr(src_url, "stderr.wrapper") != NULL)) {
            dst_url_tmp = dst_url + 7;
            chmod(dst_url_tmp, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
          }
        }
        printf("CP %d %d SUCCESS (%s->%s)\n", xfr_id, cp_xfr_id, src_url,
               dst_url);
      } else if (strcmp(action, "FINALIZE") == 0) {
        end = 1;
      } else {
        printf("%s %s - FAILURE not a valid action\n", action, xfr_id_s);
      }
    }
  }
  printf("FINALIZE - - SUCCESS -\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b00,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1890(%rbp)
movl   $0xffffffff,-0x1ac4(%rbp)
ff ff ff
mov    0x2cec(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
mov    0x2ce2(%rip),%rax
movq   $0x0,(%rax)
mov    0x2d04(%rip),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x1abc(%rbp)
movl   $0x0,-0x1ab8(%rbp)
movl   $0x0,-0x1ab4(%rbp)
movq   $0x0,-0x18a0(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xcef(%rip),%rdx
call   1120 <getopt@plt>
mov    %al,-0x1abd(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     13ae <main+0x12e>
movsbl -0x1abd(%rbp),%eax
mov    %eax,-0x1ae4(%rbp)
sub    $0x66,%eax
je     1390 <main+0x110>
jmp    1343 <main+0xc3>
mov    -0x1ae4(%rbp),%eax
sub    $0x67,%eax
je     139f <main+0x11f>
jmp    1357 <main+0xd7>
mov    -0x1ae4(%rbp),%eax
sub    $0x75,%eax
jne    13a9 <main+0x129>
jmp    136b <main+0xeb>
mov    0x2c86(%rip),%rax
mov    (%rax),%rdi
call   1160 <strdup@plt>
mov    %rax,-0x18a0(%rbp)
movl   $0x1,-0x1ab4(%rbp)
jmp    13a9 <main+0x129>
movl   $0x1,-0x1ab8(%rbp)
jmp    13a9 <main+0x129>
movl   $0x1,-0x1abc(%rbp)
jmp    1303 <main+0x83>
jmp    13b3 <main+0x133>
cmpl   $0x0,-0x1890(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13cc <main+0x14c>
jmp    1bb1 <main+0x931>
lea    -0x1894(%rbp),%rdi
call   10c0 <FD_ZERO@plt>
xor    %edi,%edi
lea    -0x1894(%rbp),%rsi
call   1180 <FD_SET@plt>
mov    $0x1,%edi
lea    -0x1894(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   10d0 <select@plt>
mov    %eax,-0x1014(%rbp)
cmpl   $0xffffffff,-0x1014(%rbp)
jne    141f <main+0x19f>
mov    $0xffffffff,%edi
call   1150 <exit@plt>
cmpl   $0x1,-0x1014(%rbp)
jne    1ba7 <main+0x927>
movl   $0x0,-0x1018(%rbp)
xor    %edi,%edi
lea    -0x1895(%rbp),%rsi
mov    $0x1,%edx
call   1090 <read@plt>
mov    %eax,-0x1014(%rbp)
mov    -0x1895(%rbp),%cl
mov    -0x1018(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x1018(%rbp)
cltq
mov    %cl,-0x1010(%rbp,%rax,1)
xor    %eax,%eax
cmpl   $0x0,-0x1014(%rbp)
mov    %al,-0x1ae5(%rbp)
jle    1497 <main+0x217>
movsbl -0x1895(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x1ae5(%rbp)
mov    -0x1ae5(%rbp),%al
test   $0x1,%al
jne    1436 <main+0x1b6>
movslq -0x1018(%rbp),%rax
movb   $0x0,-0x1010(%rbp,%rax,1)
cmpl   $0x0,-0x1014(%rbp)
jg     14cb <main+0x24b>
mov    $0xffffffff,%edi
call   1150 <exit@plt>
lea    -0x1010(%rbp),%rdi
lea    -0x1030(%rbp),%rdx
lea    -0x1050(%rbp),%rcx
lea    -0x1070(%rbp),%r8
lea    -0x1480(%rbp),%r10
lea    -0x1880(%rbp),%rax
lea    0xb0b(%rip),%rsi
lea    -0x1889(%rbp),%r9
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   10e0 <sscanf@plt>
mov    %eax,-0x1014(%rbp)
cmpl   $0x6,-0x1014(%rbp)
je     154c <main+0x2cc>
lea    -0x1030(%rbp),%rsi
lea    -0x1050(%rbp),%rdx
lea    -0x1070(%rbp),%rcx
lea    0xad9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13b3 <main+0x133>
lea    -0x1050(%rbp),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x1054(%rbp)
lea    -0x1030(%rbp),%rdi
lea    0xad6(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1938 <main+0x6b8>
cmpl   $0x1,-0x1ab4(%rbp)
jne    15a5 <main+0x325>
mov    -0x18a0(%rbp),%rax
mov    %rax,-0x18a8(%rbp)
movl   $0x0,-0x1014(%rbp)
jmp    18fe <main+0x67e>
cmpl   $0x1,-0x1abc(%rbp)
jne    1701 <main+0x481>
lea    -0x1acc(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
jne    15eb <main+0x36b>
mov    0x29fa(%rip),%rax
mov    (%rax),%edi
lea    0xa70(%rip),%rsi
call   10b0 <fprintf@plt>
movl   $0x1,-0x1014(%rbp)
jmp    16fc <main+0x47c>
xor    %eax,%eax
call   1190 <fork@plt>
mov    %eax,-0x1ac4(%rbp)
mov    -0x1ac4(%rbp),%eax
mov    %eax,-0x1aec(%rbp)
sub    $0xffffffff,%eax
je     165d <main+0x3dd>
jmp    1612 <main+0x392>
mov    -0x1aec(%rbp),%eax
test   %eax,%eax
jne    167c <main+0x3fc>
jmp    1625 <main+0x3a5>
mov    -0x1acc(%rbp),%edi
call   1070 <close@plt>
mov    -0x1ac8(%rbp),%edi
mov    $0x1,%esi
call   1040 <dup2@plt>
lea    0xa17(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1170 <execlp@plt>
movl   $0x1,-0x1014(%rbp)
mov    0x2964(%rip),%rax
mov    (%rax),%edi
lea    0xa04(%rip),%rsi
call   10b0 <fprintf@plt>
movl   $0x1,-0x1014(%rbp)
mov    -0x1ac8(%rbp),%edi
call   1070 <close@plt>
mov    -0x1acc(%rbp),%edi
lea    0xb15(%rip),%rsi
call   10f0 <fdopen@plt>
mov    %rax,-0x1ad8(%rbp)
cmpq   $0x0,-0x1ad8(%rbp)
jne    16ba <main+0x43a>
lea    0x9cb(%rip),%rdi
call   1110 <perror@plt>
mov    -0x1ad8(%rbp),%rdi
lea    -0x1ab0(%rbp),%rdx
lea    0x947(%rip),%rsi
call   1060 <fscanf@plt>
mov    %eax,-0x1adc(%rbp)
lea    -0x1ab0(%rbp),%rdi
call   1160 <strdup@plt>
mov    %rax,-0x18a8(%rbp)
movl   $0x0,-0x1014(%rbp)
jmp    16fc <main+0x47c>
jmp    18f9 <main+0x679>
cmpl   $0x1,-0x1ab8(%rbp)
jne    18d7 <main+0x657>
lea    -0x1acc(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1747 <main+0x4c7>
mov    0x289e(%rip),%rax
mov    (%rax),%edi
lea    0x914(%rip),%rsi
call   10b0 <fprintf@plt>
movl   $0x1,-0x1014(%rbp)
jmp    18d2 <main+0x652>
xor    %eax,%eax
call   1190 <fork@plt>
mov    %eax,-0x1ac4(%rbp)
mov    -0x1ac4(%rbp),%eax
mov    %eax,-0x1af0(%rbp)
sub    $0xffffffff,%eax
je     17b9 <main+0x539>
jmp    176e <main+0x4ee>
mov    -0x1af0(%rbp),%eax
test   %eax,%eax
jne    17d8 <main+0x558>
jmp    1781 <main+0x501>
mov    -0x1acc(%rbp),%edi
call   1070 <close@plt>
mov    -0x1ac8(%rbp),%edi
mov    $0x1,%esi
call   1040 <dup2@plt>
lea    0x8ec(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1170 <execlp@plt>
movl   $0x1,-0x1014(%rbp)
mov    0x2808(%rip),%rax
mov    (%rax),%edi
lea    0x8a8(%rip),%rsi
call   10b0 <fprintf@plt>
movl   $0x1,-0x1014(%rbp)
mov    -0x1ac8(%rbp),%edi
call   1070 <close@plt>
mov    -0x1acc(%rbp),%edi
lea    0x9b9(%rip),%rsi
call   10f0 <fdopen@plt>
mov    %rax,-0x1ad8(%rbp)
cmpq   $0x0,-0x1ad8(%rbp)
jne    1816 <main+0x596>
lea    0x86f(%rip),%rdi
call   1110 <perror@plt>
mov    -0x1ad8(%rbp),%rdi
lea    -0x1ab0(%rbp),%rdx
lea    0x7eb(%rip),%rsi
call   1060 <fscanf@plt>
mov    %eax,-0x1ae0(%rbp)
mov    -0x1ad8(%rbp),%rdi
lea    -0x1ab0(%rbp),%rdx
lea    0x7cb(%rip),%rsi
call   1060 <fscanf@plt>
mov    %eax,-0x1ae0(%rbp)
mov    -0x1ad8(%rbp),%rdi
lea    -0x1ab0(%rbp),%rdx
lea    0x7ab(%rip),%rsi
call   1060 <fscanf@plt>
mov    %eax,-0x1ae0(%rbp)
mov    -0x1ad8(%rbp),%rdi
lea    -0x1ab0(%rbp),%rdx
lea    0x78b(%rip),%rsi
call   1060 <fscanf@plt>
mov    %eax,-0x1ae0(%rbp)
lea    -0x1010(%rbp),%rdi
lea    -0x1ab0(%rbp),%rdx
lea    0x7fa(%rip),%rsi
call   1140 <sprintf@plt>
lea    -0x1010(%rbp),%rdi
call   1160 <strdup@plt>
mov    %rax,-0x18a8(%rbp)
movl   $0x0,-0x1014(%rbp)
jmp    18d2 <main+0x652>
jmp    18f4 <main+0x674>
lea    0x7d3(%rip),%rdi
call   1160 <strdup@plt>
mov    %rax,-0x18a8(%rbp)
movl   $0x0,-0x1014(%rbp)
jmp    18f9 <main+0x679>
jmp    18fe <main+0x67e>
cmpl   $0x1,-0x1014(%rbp)
jne    191e <main+0x69e>
lea    0x7a1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1933 <main+0x6b3>
mov    -0x18a8(%rbp),%rsi
lea    0x7be(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1ba2 <main+0x922>
lea    -0x1030(%rbp),%rdi
lea    0x7b9(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    196e <main+0x6ee>
mov    -0x1054(%rbp),%esi
lea    0x7a3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1b9d <main+0x91d>
lea    -0x1030(%rbp),%rdi
lea    0x79f(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    19a4 <main+0x724>
mov    -0x1054(%rbp),%esi
lea    0x787(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1b98 <main+0x918>
lea    -0x1030(%rbp),%rdi
lea    0x781(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    19da <main+0x75a>
mov    -0x1054(%rbp),%esi
lea    0x76b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1b93 <main+0x913>
lea    -0x1030(%rbp),%rdi
lea    0x767(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1a10 <main+0x790>
mov    -0x1054(%rbp),%esi
lea    0x752(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1b8e <main+0x90e>
lea    -0x1030(%rbp),%rdi
lea    0x74f(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1a4d <main+0x7cd>
mov    -0x1054(%rbp),%esi
lea    -0x1480(%rbp),%rdx
lea    0x732(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1b89 <main+0x909>
lea    -0x1030(%rbp),%rdi
lea    0x72f(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1b37 <main+0x8b7>
lea    -0x1070(%rbp),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x1074(%rbp)
cmpl   $0x1,-0x1abc(%rbp)
jne    1b0a <main+0x88a>
lea    -0x1480(%rbp),%rdi
lea    0x6f6(%rip),%rsi
call   11a0 <strstr@plt>
cmp    $0x0,%rax
jne    1ac3 <main+0x843>
lea    -0x1480(%rbp),%rdi
lea    0x6e8(%rip),%rsi
call   11a0 <strstr@plt>
cmp    $0x0,%rax
je     1b05 <main+0x885>
lea    -0x1880(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x1888(%rbp)
mov    -0x1888(%rbp),%rdi
mov    0x24cd(%rip),%rax
mov    (%rax),%esi
mov    0x24f4(%rip),%rax
or     (%rax),%esi
mov    0x24cb(%rip),%rax
or     (%rax),%esi
mov    0x24ba(%rip),%rax
or     (%rax),%esi
call   1100 <chmod@plt>
jmp    1b0a <main+0x88a>
mov    -0x1054(%rbp),%esi
mov    -0x1074(%rbp),%edx
lea    -0x1480(%rbp),%rcx
lea    -0x1880(%rbp),%r8
lea    0x680(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1b84 <main+0x904>
lea    -0x1030(%rbp),%rdi
lea    0x681(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1b63 <main+0x8e3>
movl   $0x1,-0x1890(%rbp)
jmp    1b7f <main+0x8ff>
lea    -0x1030(%rbp),%rsi
lea    -0x1050(%rbp),%rdx
lea    0x657(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1b84 <main+0x904>
jmp    1b89 <main+0x909>
jmp    1b8e <main+0x90e>
jmp    1b93 <main+0x913>
jmp    1b98 <main+0x918>
jmp    1b9d <main+0x91d>
jmp    1ba2 <main+0x922>
jmp    1ba7 <main+0x927>
jmp    1bac <main+0x92c>
jmp    13b3 <main+0x133>
lea    0x63b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x1b00,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a98,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %rax,0x20(%rsp)
xor    %esi,%esi
call   1040 <setbuf@plt>
mov    0x2ce4(%rip),%rax
movq   $0x0,(%rax)
mov    0x2d06(%rip),%rax
movl   $0x1,(%rax)
lea    0xd21(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1130 <getopt@plt>
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
mov    $0x0,%ecx
mov    %rcx,0x18(%rsp)
cmp    $0xff,%al
je     139a <main+0x10a>
xor    %ecx,%ecx
mov    %rcx,0x18(%rsp)
lea    0xce7(%rip),%r14
mov    0x2cd8(%rip),%r15
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x20(%rsp)
jmp    135b <main+0xcb>
nopl   0x0(%rax)
mov    $0x1,%eax
mov    %rax,0x18(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1130 <getopt@plt>
cmp    $0xff,%al
je     139a <main+0x10a>
movsbl %al,%eax
cmp    $0x66,%eax
je     1390 <main+0x100>
cmp    $0x67,%eax
je     1340 <main+0xb0>
cmp    $0x75,%eax
jne    134a <main+0xba>
mov    (%r15),%rdi
call   1170 <strdup@plt>
mov    %rax,0x20(%rsp)
movl   $0x1,0x10(%rsp)
jmp    134a <main+0xba>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movl   $0x1,0xc(%rsp)
jmp    134a <main+0xba>
lea    0x2c(%rsp),%r12
lea    0x3(%rsp),%rbx
lea    0x70(%rsp),%r14
lea    0x50(%rsp),%r13
lea    0x30(%rsp),%r15
jmp    13c9 <main+0x139>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0xffffffff,%eax
je     18c7 <main+0x637>
mov    %r12,%rdi
call   10d0 <FD_ZERO@plt>
xor    %edi,%edi
mov    %r12,%rsi
call   1190 <FD_SET@plt>
mov    $0x1,%edi
mov    %r12,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10e0 <select@plt>
cmp    $0x1,%eax
jne    13c0 <main+0x130>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   10a0 <read@plt>
movzbl 0x3(%rsp),%ecx
mov    %cl,0xa90(%rsp,%rbp,1)
add    $0x1,%rbp
test   %eax,%eax
jle    1428 <main+0x198>
cmp    $0xa,%cl
jne    1400 <main+0x170>
mov    %ebp,%ecx
movb   $0x0,0xa90(%rsp,%rcx,1)
test   %eax,%eax
jle    18c7 <main+0x637>
lea    0xa90(%rsp),%rdi
lea    0xbbe(%rip),%rsi
mov    %r14,%rdx
mov    %r13,%rcx
mov    %r15,%r8
lea    0x17(%rsp),%r9
lea    0x690(%rsp),%rax
push   %rax
lea    0x298(%rsp),%rax
push   %rax
call   10f0 <sscanf@plt>
add    $0x10,%rsp
cmp    $0x6,%eax
jne    1560 <main+0x2d0>
mov    %r13,%rdi
call   1140 <atoi@plt>
mov    %eax,%ebp
mov    %r14,%rdi
lea    0xbb3(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     157c <main+0x2ec>
mov    %r14,%rdi
lea    0xc1f(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     163b <main+0x3ab>
mov    %r14,%rdi
lea    0xc23(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1647 <main+0x3b7>
mov    %r14,%rdi
lea    0xc23(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1763 <main+0x4d3>
mov    %r14,%rdi
lea    0xc27(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     176c <main+0x4dc>
mov    %r14,%rdi
lea    0xc2d(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     17c9 <main+0x539>
mov    %r14,%rdi
lea    0xc32(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     17e6 <main+0x556>
mov    %r14,%rdi
lea    0xc56(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     18a7 <main+0x617>
lea    0xc4a(%rip),%rdi
mov    %r14,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13c9 <main+0x139>
xchg   %ax,%ax
lea    0xab2(%rip),%rdi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13c9 <main+0x139>
mov    0x20(%rsp),%rsi
cmpl   $0x1,0x10(%rsp)
je     17b6 <main+0x526>
cmpl   $0x1,0x18(%rsp)
jne    1653 <main+0x3c3>
lea    0x4(%rsp),%rdi
call   1090 <pipe@plt>
cmp    $0xffffffff,%eax
je     1781 <main+0x4f1>
xor    %eax,%eax
call   11a0 <fork@plt>
cmp    $0xffffffff,%eax
je     15e2 <main+0x352>
test   %eax,%eax
jne    15f7 <main+0x367>
mov    0x4(%rsp),%edi
call   1080 <close@plt>
mov    0x8(%rsp),%edi
mov    $0x1,%esi
call   1050 <dup2@plt>
lea    0xa86(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1180 <execlp@plt>
mov    0x29df(%rip),%rax
mov    (%rax),%edi
lea    0xa7f(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x8(%rsp),%edi
call   1080 <close@plt>
mov    0x4(%rsp),%edi
lea    0xb65(%rip),%rsi
call   1100 <fdopen@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1885 <main+0x5f5>
mov    %rbp,%rdi
lea    0x9f0(%rip),%rsi
lea    0x90(%rsp),%rbp
mov    %rbp,%rdx
call   1070 <fscanf@plt>
jmp    175e <main+0x4ce>
lea    0xa8a(%rip),%rdi
jmp    1773 <main+0x4e3>
lea    0xa98(%rip),%rdi
jmp    1773 <main+0x4e3>
cmpl   $0x1,0xc(%rsp)
jne    17a7 <main+0x517>
lea    0x4(%rsp),%rdi
call   1090 <pipe@plt>
cmp    $0xffffffff,%eax
je     1781 <main+0x4f1>
xor    %eax,%eax
call   11a0 <fork@plt>
cmp    $0xffffffff,%eax
je     16a9 <main+0x419>
test   %eax,%eax
jne    16be <main+0x42e>
mov    0x4(%rsp),%edi
call   1080 <close@plt>
mov    0x8(%rsp),%edi
mov    $0x1,%esi
call   1050 <dup2@plt>
lea    0x9f0(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1180 <execlp@plt>
mov    0x2918(%rip),%rax
mov    (%rax),%edi
lea    0x9b8(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x8(%rsp),%edi
call   1080 <close@plt>
mov    0x4(%rsp),%edi
lea    0xa9e(%rip),%rsi
call   1100 <fdopen@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1896 <main+0x606>
mov    %rbp,%rdi
lea    0x929(%rip),%rsi
lea    0x90(%rsp),%rdx
call   1070 <fscanf@plt>
mov    %rbp,%rdi
lea    0x912(%rip),%rsi
lea    0x90(%rsp),%rdx
call   1070 <fscanf@plt>
mov    %rbp,%rdi
lea    0x8fb(%rip),%rsi
lea    0x90(%rsp),%rdx
call   1070 <fscanf@plt>
mov    %rbp,%rdi
lea    0x8e4(%rip),%rsi
lea    0x90(%rsp),%rdx
call   1070 <fscanf@plt>
lea    0xa90(%rsp),%rbp
mov    %rbp,%rdi
lea    0x954(%rip),%rsi
lea    0x90(%rsp),%rdx
call   1150 <sprintf@plt>
mov    %rbp,%rdi
jmp    17ae <main+0x51e>
lea    0x996(%rip),%rdi
jmp    1773 <main+0x4e3>
lea    0x9aa(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13c9 <main+0x139>
mov    0x2840(%rip),%rax
mov    (%rax),%edi
lea    0x8b6(%rip),%rsi
call   10c0 <fprintf@plt>
lea    0xa34(%rip),%rdi
call   1030 <puts@plt>
jmp    13c9 <main+0x139>
lea    0xa21(%rip),%rdi
call   1170 <strdup@plt>
mov    %rax,%rsi
lea    0x8f4(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13c9 <main+0x139>
lea    0x96a(%rip),%rdi
mov    %ebp,%esi
lea    0x290(%rsp),%rdx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13c9 <main+0x139>
mov    %r15,%rdi
call   1140 <atoi@plt>
mov    %eax,0x28(%rsp)
cmpl   $0x1,0x18(%rsp)
jne    185c <main+0x5cc>
lea    0x290(%rsp),%rdi
lea    0x94c(%rip),%rsi
call   11b0 <strstr@plt>
test   %rax,%rax
jne    182b <main+0x59b>
lea    0x290(%rsp),%rdi
lea    0x942(%rip),%rsi
call   11b0 <strstr@plt>
test   %rax,%rax
je     185c <main+0x5cc>
mov    0x27ae(%rip),%rax
mov    (%rax),%esi
mov    0x2775(%rip),%rax
or     (%rax),%esi
mov    0x277c(%rip),%rax
or     (%rax),%esi
mov    0x276b(%rip),%rax
or     (%rax),%esi
lea    0x697(%rsp),%rdi
call   1110 <chmod@plt>
lea    0x90f(%rip),%rdi
mov    %ebp,%esi
mov    0x28(%rsp),%edx
lea    0x290(%rsp),%rcx
lea    0x690(%rsp),%r8
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13c9 <main+0x139>
lea    0x7f4(%rip),%rdi
call   1120 <perror@plt>
jmp    161c <main+0x38c>
lea    0x7e3(%rip),%rdi
call   1120 <perror@plt>
jmp    16e3 <main+0x453>
lea    0x90c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x1a98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%edi
call   1160 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@opterr = global i64 0
@optind = global i32 0
@.str = [7 x i8] c"h:u:fg\00"
@optarg = global i8* null
@.str.1 = [18 x i8] c"%s %s %s %c %s %s\00"
@.str.2 = [41 x i8] c"%s %s %s FAILURE Not enough parameters.\0A\00"
@.str.3 = [5 x i8] c"INIT\00"
@stderr = global i32 0
@.str.4 = [23 x i8] c"couldn't create pipes\0A\00"
@.str.5 = [19 x i8] c"globus-gass-server\00"
@.str.6 = [15 x i8] c"couldn't fork\0A\00"
@.str.7 = [2 x i8] c"r\00"
@.str.8 = [15 x i8] c"opening stdout\00"
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [22 x i8] c"globus-gridftp-server\00"
@.str.11 = [12 x i8] c"gsiftp://%s\00"
@.str.12 = [2 x i8] c"-\00"
@.str.13 = [55 x i8] c"INIT - - FAILURE Error Activating the staging module.\0A\00"
@.str.14 = [21 x i8] c"INIT - - SUCCESS %s\0A\00"
@.str.15 = [6 x i8] c"START\00"
@.str.16 = [22 x i8] c"START %i - SUCCESS -\0A\00"
@.str.17 = [4 x i8] c"END\00"
@.str.18 = [20 x i8] c"END %i - SUCCESS -\0A\00"
@.str.19 = [6 x i8] c"RMDIR\00"
@.str.20 = [22 x i8] c"RMDIR %i - SUCCESS -\0A\00"
@.str.21 = [7 x i8] c"EXISTS\00"
@.str.22 = [23 x i8] c"EXISTS %d - SUCCESS -\0A\00"
@.str.23 = [6 x i8] c"MKDIR\00"
@.str.24 = [23 x i8] c"MKDIR %d - SUCCESS %s\0A\00"
@.str.25 = [3 x i8] c"CP\00"
@.str.26 = [15 x i8] c"stdout.wrapper\00"
@.str.27 = [15 x i8] c"stderr.wrapper\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.28 = [27 x i8] c"CP %d %d SUCCESS (%s->%s)\0A\00"
@.str.29 = [9 x i8] c"FINALIZE\00"
@.str.30 = [36 x i8] c"%s %s - FAILURE not a valid action\0A\00"
@.str.31 = [24 x i8] c"FINALIZE - - SUCCESS -\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca [20 x i8]
%10 = alloca [20 x i8]
%11 = alloca i32
%12 = alloca [20 x i8]
%13 = alloca i32
%14 = alloca [1024 x i8]
%15 = alloca [1024 x i8]
%16 = alloca i8*
%17 = alloca i8
%18 = alloca i32
%19 = alloca i32
%20 = alloca i8
%21 = alloca i8*
%22 = alloca i8*
%23 = alloca [512 x i8]
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i8
%28 = alloca i32
%29 = alloca [2 x i32]
%30 = alloca i32*
%31 = alloca i32
%32 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %18
store i32 -1, i32* %28
%33 = load i32, i32* @stdout
%34 = call i32 @setbuf(i32 %33, i32* null)
store i64 0, i64* @opterr
store i32 1, i32* @optind
store i32 0, i32* %26
store i32 0, i32* %25
store i32 0, i32* %24
store i8* null, i8** %21
br label %35
35: ; preds = %49, %2
%36 = load i32, i32* %4
%37 = load i8**, i8*** %5
%38 = call signext i8 @getopt(i32 %36, i8** %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8 %38, i8* %27
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %39, -1
br i1 %40, label %41, label %50
41: ; preds = %35
%42 = load i8, i8* %27
%43 = sext i8 %42 to i32
switch i32 %43, label %49 [
i32 117, label %44
i32 102, label %47
i32 103, label %48
]
44: ; preds = %41
%45 = load i8*, i8** @optarg
%46 = call i8* @strdup(i8* %45)
store i8* %46, i8** %21
store i32 1, i32* %24
br label %49
47: ; preds = %41
store i32 1, i32* %25
br label %49
48: ; preds = %41
store i32 1, i32* %26
br label %49
49: ; preds = %41, %48, %47, %44
br label %35
50: ; preds = %35
br label %51
51: ; preds = %318, %101, %50
%52 = load i32, i32* %18
%53 = icmp ne i32 %52, 0
%54 = xor i1 %53, true
br i1 %54, label %55, label %319
55: ; preds = %51
%56 = call i32 @FD_ZERO(i32* %19)
%57 = call i32 @FD_SET(i32 0, i32* %19)
%58 = call i32 @select(i32 1, i32* %19, i32* null, i32* null, i32* null)
store i32 %58, i32* %7
%59 = load i32, i32* %7
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %63
61: ; preds = %55
%62 = call i32 @exit(i32 -1)
unreachable
63: ; preds = %55
%64 = load i32, i32* %7
%65 = icmp eq i32 %64, 1
br i1 %65, label %66, label %317
66: ; preds = %63
store i32 0, i32* %8
br label %67
67: ; preds = %81, %66
%68 = call i32 @read(i32 0, i8* %20, i32 1)
store i32 %68, i32* %7
%69 = load i8, i8* %20
%70 = load i32, i32* %8
%71 = add nsw i32 %70, 1
store i32 %71, i32* %8
%72 = sext i32 %70 to i64
%73 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %72
store i8 %69, i8* %73
br label %74
74: ; preds = %67
%75 = load i32, i32* %7
%76 = icmp sgt i32 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %74
%78 = load i8, i8* %20
%79 = sext i8 %78 to i32
%80 = icmp ne i32 %79, 10
br label %81
81: ; preds = %77, %74
%82 = phi i1 [ false, %74 ], [ %80, %77 ]
br i1 %82, label %67, label %83
83: ; preds = %81
%84 = load i32, i32* %8
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %85
store i8 0, i8* %86
%87 = load i32, i32* %7
%88 = icmp sle i32 %87, 0
br i1 %88, label %89, label %91
89: ; preds = %83
%90 = call i32 @exit(i32 -1)
unreachable
91: ; preds = %83
%92 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%93 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%94 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%95 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%97 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%98 = call i32 @sscanf(i8* %92, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %93, i8* %94, i8* %95, i8* %17, i8* %96, i8* %97)
store i32 %98, i32* %7
%99 = load i32, i32* %7
%100 = icmp ne i32 %99, 6
br i1 %100, label %101, label %106
101: ; preds = %91
%102 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%103 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%104 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %102, i8* %103, i8* %104)
br label %51
106: ; preds = %91
%107 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%108 = call i32 @atoi(i8* %107)
store i32 %108, i32* %11
%109 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%110 = call i64 @strcmp(i8* %109, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%111 = icmp eq i64 %110, 0
br i1 %111, label %112, label %228
112: ; preds = %106
%113 = load i32, i32* %24
%114 = icmp eq i32 %113, 1
br i1 %114, label %115, label %117
115: ; preds = %112
%116 = load i8*, i8** %21
store i8* %116, i8** %22
store i32 0, i32* %7
br label %219
117: ; preds = %112
%118 = load i32, i32* %26
%119 = icmp eq i32 %118, 1
br i1 %119, label %120, label %160
120: ; preds = %117
%121 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 0, i64 0
%122 = call i32 @pipe(i32* %121)
%123 = icmp eq i32 %122, -1
br i1 %123, label %124, label %127
124: ; preds = %120
%125 = load i32, i32* @stderr
%126 = call i32 @fprintf(i32 %125, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %7
br label %159
127: ; preds = %120
%128 = call i32 (...) @fork()
store i32 %128, i32* %28
%129 = load i32, i32* %28
switch i32 %129, label %141 [
i32 0, label %130
i32 -1, label %138
]
130: ; preds = %127
%131 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 0, i64 0
%132 = load i32, i32* %131
%133 = call i32 @close(i32 %132)
%134 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 0, i64 1
%135 = load i32, i32* %134
%136 = call i32 @dup2(i32 %135, i32 1)
%137 = call i32 @execlp(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32* null)
store i32 1, i32* %7
br label %138
138: ; preds = %127, %130
%139 = load i32, i32* @stderr
%140 = call i32 @fprintf(i32 %139, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %7
br label %141
141: ; preds = %127, %138
%142 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 0, i64 1
%143 = load i32, i32* %142
%144 = call i32 @close(i32 %143)
%145 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 0, i64 0
%146 = load i32, i32* %145
%147 = call i32* @fdopen(i32 %146, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %147, i32** %30
%148 = load i32*, i32** %30
%149 = icmp eq i32* %148, null
br i1 %149, label %150, label %152
150: ; preds = %141
%151 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
br label %152
152: ; preds = %150, %141
%153 = load i32*, i32** %30
%154 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%155 = call i32 @fscanf(i32* %153, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %154)
store i32 %155, i32* %31
%156 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%157 = call i8* @strdup(i8* %156)
store i8* %157, i8** %22
store i32 0, i32* %7
br label %158
158: ; preds = %152
br label %159
159: ; preds = %158, %124
br label %218
160: ; preds = %117
%161 = load i32, i32* %25
%162 = icmp eq i32 %161, 1
br i1 %162, label %163, label %215
163: ; preds = %160
%164 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 0, i64 0
%165 = call i32 @pipe(i32* %164)
%166 = icmp eq i32 %165, -1
br i1 %166, label %167, label %170
167: ; preds = %163
%168 = load i32, i32* @stderr
%169 = call i32 @fprintf(i32 %168, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %7
br label %214
170: ; preds = %163
%171 = call i32 (...) @fork()
store i32 %171, i32* %28
%172 = load i32, i32* %28
switch i32 %172, label %184 [
i32 0, label %173
i32 -1, label %181
]
173: ; preds = %170
%174 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 0, i64 0
%175 = load i32, i32* %174
%176 = call i32 @close(i32 %175)
%177 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 0, i64 1
%178 = load i32, i32* %177
%179 = call i32 @dup2(i32 %178, i32 1)
%180 = call i32 @execlp(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32* null)
store i32 1, i32* %7
br label %181
181: ; preds = %170, %173
%182 = load i32, i32* @stderr
%183 = call i32 @fprintf(i32 %182, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %7
br label %184
184: ; preds = %170, %181
%185 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 0, i64 1
%186 = load i32, i32* %185
%187 = call i32 @close(i32 %186)
%188 = getelementptr inbounds [2 x i32], [2 x i32]* %29, i64 0, i64 0
%189 = load i32, i32* %188
%190 = call i32* @fdopen(i32 %189, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %190, i32** %30
%191 = load i32*, i32** %30
%192 = icmp eq i32* %191, null
br i1 %192, label %193, label %195
193: ; preds = %184
%194 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
br label %195
195: ; preds = %193, %184
%196 = load i32*, i32** %30
%197 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%198 = call i32 @fscanf(i32* %196, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %197)
store i32 %198, i32* %32
%199 = load i32*, i32** %30
%200 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%201 = call i32 @fscanf(i32* %199, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %200)
store i32 %201, i32* %32
%202 = load i32*, i32** %30
%203 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%204 = call i32 @fscanf(i32* %202, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %203)
store i32 %204, i32* %32
%205 = load i32*, i32** %30
%206 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%207 = call i32 @fscanf(i32* %205, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %206)
store i32 %207, i32* %32
%208 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%209 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%210 = call i32 @sprintf(i8* %208, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* %209)
%211 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%212 = call i8* @strdup(i8* %211)
store i8* %212, i8** %22
store i32 0, i32* %7
br label %213
213: ; preds = %195
br label %214
214: ; preds = %213, %167
br label %217
215: ; preds = %160
%216 = call i8* @strdup(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i8* %216, i8** %22
store i32 0, i32* %7
br label %217
217: ; preds = %215, %214
br label %218
218: ; preds = %217, %159
br label %219
219: ; preds = %218, %115
%220 = load i32, i32* %7
%221 = icmp eq i32 %220, 1
br i1 %221, label %222, label %224
222: ; preds = %219
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.13, i64 0, i64 0))
br label %227
224: ; preds = %219
%225 = load i8*, i8** %22
%226 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* %225)
br label %227
227: ; preds = %224, %222
br label %316
228: ; preds = %106
%229 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%230 = call i64 @strcmp(i8* %229, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%231 = icmp eq i64 %230, 0
br i1 %231, label %232, label %235
232: ; preds = %228
%233 = load i32, i32* %11
%234 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0), i32 %233)
br label %315
235: ; preds = %228
%236 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%237 = call i64 @strcmp(i8* %236, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
%238 = icmp eq i64 %237, 0
br i1 %238, label %239, label %242
239: ; preds = %235
%240 = load i32, i32* %11
%241 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.18, i64 0, i64 0), i32 %240)
br label %314
242: ; preds = %235
%243 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%244 = call i64 @strcmp(i8* %243, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0))
%245 = icmp eq i64 %244, 0
br i1 %245, label %246, label %249
246: ; preds = %242
%247 = load i32, i32* %11
%248 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0), i32 %247)
br label %313
249: ; preds = %242
%250 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%251 = call i64 @strcmp(i8* %250, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0))
%252 = icmp eq i64 %251, 0
br i1 %252, label %253, label %256
253: ; preds = %249
%254 = load i32, i32* %11
%255 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.22, i64 0, i64 0), i32 %254)
br label %312
256: ; preds = %249
%257 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%258 = call i64 @strcmp(i8* %257, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0))
%259 = icmp eq i64 %258, 0
br i1 %259, label %260, label %264
260: ; preds = %256
%261 = load i32, i32* %11
%262 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%263 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.24, i64 0, i64 0), i32 %261, i8* %262)
br label %311
264: ; preds = %256
%265 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%266 = call i64 @strcmp(i8* %265, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0))
%267 = icmp eq i64 %266, 0
br i1 %267, label %268, label %300
268: ; preds = %264
%269 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%270 = call i32 @atoi(i8* %269)
store i32 %270, i32* %13
%271 = load i32, i32* %26
%272 = icmp eq i32 %271, 1
br i1 %272, label %273, label %294
273: ; preds = %268
%274 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%275 = call i32* @strstr(i8* %274, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.26, i64 0, i64 0))
%276 = icmp ne i32* %275, null
br i1 %276, label %281, label %277
277: ; preds = %273
%278 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%279 = call i32* @strstr(i8* %278, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i64 0, i64 0))
%280 = icmp ne i32* %279, null
br i1 %280, label %281, label %293
281: ; preds = %277, %273
%282 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%283 = getelementptr inbounds i8, i8* %282, i64 7
store i8* %283, i8** %16
%284 = load i8*, i8** %16
%285 = load i32, i32* @S_IRUSR
%286 = load i32, i32* @S_IWUSR
%287 = or i32 %285, %286
%288 = load i32, i32* @S_IRGRP
%289 = or i32 %287, %288
%290 = load i32, i32* @S_IROTH
%291 = or i32 %289, %290
%292 = call i32 @chmod(i8* %284, i32 %291)
br label %293
293: ; preds = %281, %277
br label %294
294: ; preds = %293, %268
%295 = load i32, i32* %11
%296 = load i32, i32* %13
%297 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%298 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%299 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.28, i64 0, i64 0), i32 %295, i32 %296, i8* %297, i8* %298)
br label %310
300: ; preds = %264
%301 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%302 = call i64 @strcmp(i8* %301, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.29, i64 0, i64 0))
%303 = icmp eq i64 %302, 0
br i1 %303, label %304, label %305
304: ; preds = %300
store i32 1, i32* %18
br label %309
305: ; preds = %300
%306 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%307 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%308 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.30, i64 0, i64 0), i8* %306, i8* %307)
br label %309
309: ; preds = %305, %304
br label %310
310: ; preds = %309, %294
br label %311
311: ; preds = %310, %260
br label %312
312: ; preds = %311, %253
br label %313
313: ; preds = %312, %246
br label %314
314: ; preds = %313, %239
br label %315
315: ; preds = %314, %232
br label %316
316: ; preds = %315, %227
br label %317
317: ; preds = %316, %63
br label %318
318: ; preds = %317
br label %51
319: ; preds = %51
%320 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.31, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@opterr = global i64 0
@optind = global i32 0
@.str = [7 x i8] c"h:u:fg\00"
@optarg = global i8* null
@.str.1 = [18 x i8] c"%s %s %s %c %s %s\00"
@.str.2 = [41 x i8] c"%s %s %s FAILURE Not enough parameters.\0A\00"
@.str.3 = [5 x i8] c"INIT\00"
@stderr = global i32 0
@.str.4 = [23 x i8] c"couldn't create pipes\0A\00"
@.str.5 = [19 x i8] c"globus-gass-server\00"
@.str.6 = [15 x i8] c"couldn't fork\0A\00"
@.str.7 = [2 x i8] c"r\00"
@.str.8 = [15 x i8] c"opening stdout\00"
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [22 x i8] c"globus-gridftp-server\00"
@.str.11 = [12 x i8] c"gsiftp://%s\00"
@.str.12 = [2 x i8] c"-\00"
@.str.14 = [21 x i8] c"INIT - - SUCCESS %s\0A\00"
@.str.15 = [6 x i8] c"START\00"
@.str.16 = [22 x i8] c"START %i - SUCCESS -\0A\00"
@.str.17 = [4 x i8] c"END\00"
@.str.18 = [20 x i8] c"END %i - SUCCESS -\0A\00"
@.str.19 = [6 x i8] c"RMDIR\00"
@.str.20 = [22 x i8] c"RMDIR %i - SUCCESS -\0A\00"
@.str.21 = [7 x i8] c"EXISTS\00"
@.str.22 = [23 x i8] c"EXISTS %d - SUCCESS -\0A\00"
@.str.23 = [6 x i8] c"MKDIR\00"
@.str.24 = [23 x i8] c"MKDIR %d - SUCCESS %s\0A\00"
@.str.25 = [3 x i8] c"CP\00"
@.str.26 = [15 x i8] c"stdout.wrapper\00"
@.str.27 = [15 x i8] c"stderr.wrapper\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.28 = [27 x i8] c"CP %d %d SUCCESS (%s->%s)\0A\00"
@.str.29 = [9 x i8] c"FINALIZE\00"
@.str.30 = [36 x i8] c"%s %s - FAILURE not a valid action\0A\00"
@str = [23 x i8] c"FINALIZE - - SUCCESS -\00"
@str.32 = [54 x i8] c"INIT - - FAILURE Error Activating the staging module.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [4096 x i8]
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = alloca [20 x i8]
%7 = alloca [1024 x i8]
%8 = alloca [1024 x i8]
%9 = alloca i8
%10 = alloca i32
%11 = alloca i8
%12 = alloca [512 x i8]
%13 = alloca [2 x i32]
%14 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%20 = bitcast i32* %10 to i8*
%21 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%22 = bitcast [2 x i32]* %13 to i8*
%23 = load i32, i32* @stdout
%24 = tail call i32 @setbuf(i32 %23, i32* null)
store i64 0, i64* @opterr
store i32 1, i32* @optind
%25 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i8 %25, -1
br i1 %26, label %27, label %38
27: ; preds = %50, %2
%28 = phi i8* [ null, %2 ], [ %51, %50 ]
%29 = phi i32 [ 0, %2 ], [ %52, %50 ]
%30 = phi i32 [ 0, %2 ], [ %53, %50 ]
%31 = phi i32 [ 0, %2 ], [ %54, %50 ]
%32 = icmp eq i32 %31, 1
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 7
%34 = icmp eq i32 %29, 1
%35 = icmp eq i32 %30, 1
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
br label %57
38: ; preds = %2, %50
%39 = phi i8 [ %55, %50 ], [ %25, %2 ]
%40 = phi i32 [ %54, %50 ], [ 0, %2 ]
%41 = phi i32 [ %53, %50 ], [ 0, %2 ]
%42 = phi i32 [ %52, %50 ], [ 0, %2 ]
%43 = phi i8* [ %51, %50 ], [ null, %2 ]
%44 = sext i8 %39 to i32
switch i32 %44, label %50 [
i32 117, label %45
i32 102, label %48
i32 103, label %49
]
45: ; preds = %38
%46 = load i8*, i8** @optarg
%47 = tail call i8* @strdup(i8* %46)
br label %50
48: ; preds = %38
br label %50
49: ; preds = %38
br label %50
50: ; preds = %38, %49, %48, %45
%51 = phi i8* [ %43, %38 ], [ %43, %49 ], [ %43, %48 ], [ %47, %45 ]
%52 = phi i32 [ %42, %38 ], [ %42, %49 ], [ %42, %48 ], [ 1, %45 ]
%53 = phi i32 [ %41, %38 ], [ %41, %49 ], [ 1, %48 ], [ %41, %45 ]
%54 = phi i32 [ %40, %38 ], [ 1, %49 ], [ %40, %48 ], [ %40, %45 ]
%55 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%56 = icmp eq i8 %55, -1
br i1 %56, label %27, label %38
57: ; preds = %83, %27
%58 = call i32 @FD_ZERO(i32* %10)
%59 = call i32 @FD_SET(i32 0, i32* %10)
%60 = call i32 @select(i32 1, i32* %10, i32* null, i32* null, i32* null)
switch i32 %60, label %83 [
i32 -1, label %61
i32 1, label %63
]
61: ; preds = %57
%62 = call i32 @exit(i32 -1)
unreachable
63: ; preds = %57, %63
%64 = phi i64 [ %67, %63 ], [ 0, %57 ]
%65 = call i32 @read(i32 0, i8* %11, i32 1)
%66 = load i8, i8* %11
%67 = add nuw i64 %64, 1
%68 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %64
store i8 %66, i8* %68
%69 = icmp sgt i32 %65, 0
%70 = icmp ne i8 %66, 10
%71 = select i1 %69, i1 %70, i1 false
br i1 %71, label %63, label %72
72: ; preds = %63
%73 = and i64 %67, 4294967295
%74 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %73
store i8 0, i8* %74
%75 = icmp slt i32 %65, 1
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = call i32 @exit(i32 -1)
unreachable
78: ; preds = %72
%79 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %16, i8* %17, i8* %9, i8* %18, i8* %19)
%80 = icmp eq i32 %79, 6
br i1 %80, label %84, label %81
81: ; preds = %78
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %15, i8* %16, i8* %17)
br label %83
83: ; preds = %81, %151, %147, %162, %172, %199, %204, %177, %167, %157, %57
br label %57
84: ; preds = %78
%85 = call i32 @atoi(i8* %16)
%86 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %154
88: ; preds = %84
br i1 %34, label %151, label %89
89: ; preds = %88
br i1 %32, label %90, label %115
90: ; preds = %89
%91 = call i32 @pipe(i32* %36)
%92 = icmp eq i32 %91, -1
br i1 %92, label %147, label %93
93: ; preds = %90
%94 = call i32 (...) @fork()
switch i32 %94, label %104 [
i32 0, label %95
i32 -1, label %101
]
95: ; preds = %93
%96 = load i32, i32* %36
%97 = call i32 @close(i32 %96)
%98 = load i32, i32* %37
%99 = call i32 @dup2(i32 %98, i32 1)
%100 = call i32 @execlp(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32* null)
br label %101
101: ; preds = %93, %95
%102 = load i32, i32* @stderr
%103 = call i32 @fprintf(i32 %102, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %104
104: ; preds = %93, %101
%105 = load i32, i32* %37
%106 = call i32 @close(i32 %105)
%107 = load i32, i32* %36
%108 = call i32* @fdopen(i32 %107, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%109 = icmp eq i32* %108, null
br i1 %109, label %110, label %112
110: ; preds = %104
%111 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
br label %112
112: ; preds = %110, %104
%113 = call i32 @fscanf(i32* %108, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %21)
%114 = call i8* @strdup(i8* %21)
br label %151
115: ; preds = %89
br i1 %35, label %116, label %145
116: ; preds = %115
%117 = call i32 @pipe(i32* %36)
%118 = icmp eq i32 %117, -1
br i1 %118, label %147, label %119
119: ; preds = %116
%120 = call i32 (...) @fork()
switch i32 %120, label %130 [
i32 0, label %121
i32 -1, label %127
]
121: ; preds = %119
%122 = load i32, i32* %36
%123 = call i32 @close(i32 %122)
%124 = load i32, i32* %37
%125 = call i32 @dup2(i32 %124, i32 1)
%126 = call i32 @execlp(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32* null)
br label %127
127: ; preds = %119, %121
%128 = load i32, i32* @stderr
%129 = call i32 @fprintf(i32 %128, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %130
130: ; preds = %119, %127
%131 = load i32, i32* %37
%132 = call i32 @close(i32 %131)
%133 = load i32, i32* %36
%134 = call i32* @fdopen(i32 %133, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%135 = icmp eq i32* %134, null
br i1 %135, label %136, label %138
136: ; preds = %130
%137 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
br label %138
138: ; preds = %136, %130
%139 = call i32 @fscanf(i32* %134, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %21)
%140 = call i32 @fscanf(i32* %134, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %21)
%141 = call i32 @fscanf(i32* %134, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %21)
%142 = call i32 @fscanf(i32* %134, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %21)
%143 = call i32 @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* %21)
%144 = call i8* @strdup(i8* %14)
br label %151
145: ; preds = %115
%146 = call dereferenceable_or_null(2) i8* @strdup(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
br label %151
147: ; preds = %116, %90
%148 = load i32, i32* @stderr
%149 = call i32 @fprintf(i32 %148, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%150 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.32, i64 0, i64 0))
br label %83
151: ; preds = %112, %138, %145, %88
%152 = phi i8* [ %28, %88 ], [ %146, %145 ], [ %144, %138 ], [ %114, %112 ]
%153 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* %152)
br label %83
154: ; preds = %84
%155 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%156 = icmp eq i64 %155, 0
br i1 %156, label %157, label %159
157: ; preds = %154
%158 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0), i32 %85)
br label %83
159: ; preds = %154
%160 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
%161 = icmp eq i64 %160, 0
br i1 %161, label %162, label %164
162: ; preds = %159
%163 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.18, i64 0, i64 0), i32 %85)
br label %83
164: ; preds = %159
%165 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0))
%166 = icmp eq i64 %165, 0
br i1 %166, label %167, label %169
167: ; preds = %164
%168 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0), i32 %85)
br label %83
169: ; preds = %164
%170 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0))
%171 = icmp eq i64 %170, 0
br i1 %171, label %172, label %174
172: ; preds = %169
%173 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.22, i64 0, i64 0), i32 %85)
br label %83
174: ; preds = %169
%175 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0))
%176 = icmp eq i64 %175, 0
br i1 %176, label %177, label %179
177: ; preds = %174
%178 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.24, i64 0, i64 0), i32 %85, i8* %18)
br label %83
179: ; preds = %174
%180 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0))
%181 = icmp eq i64 %180, 0
br i1 %181, label %182, label %201
182: ; preds = %179
%183 = call i32 @atoi(i8* %17)
br i1 %32, label %184, label %199
184: ; preds = %182
%185 = call i32* @strstr(i8* %18, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.26, i64 0, i64 0))
%186 = icmp eq i32* %185, null
br i1 %186, label %187, label %190
187: ; preds = %184
%188 = call i32* @strstr(i8* %18, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i64 0, i64 0))
%189 = icmp eq i32* %188, null
br i1 %189, label %199, label %190
190: ; preds = %187, %184
%191 = load i32, i32* @S_IRUSR
%192 = load i32, i32* @S_IWUSR
%193 = or i32 %192, %191
%194 = load i32, i32* @S_IRGRP
%195 = or i32 %193, %194
%196 = load i32, i32* @S_IROTH
%197 = or i32 %195, %196
%198 = call i32 @chmod(i8* %33, i32 %197)
br label %199
199: ; preds = %187, %190, %182
%200 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.28, i64 0, i64 0), i32 %85, i32 %183, i8* %18, i8* %19)
br label %83
201: ; preds = %179
%202 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.29, i64 0, i64 0))
%203 = icmp eq i64 %202, 0
br i1 %203, label %206, label %204
204: ; preds = %201
%205 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.30, i64 0, i64 0), i8* %15, i8* %16)
br label %83
206: ; preds = %201
%207 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret i32 0
}