#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
int getopt(int, char **, char *);
char *optarg;
scalar_t__ read_display_ref(char *, char **);
int /*<<< orphan*/ remove_display_ref(char *);
char *rindex(char *, char);
int /*<<< orphan*/ setenv(char *, char *, int);
int /*<<< orphan*/ snprintf(char *, size_t, char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strdup(char *);
int system(char *);
int /*<<< orphan*/ wait_display_ref(char *);
int /*<<< orphan*/ write_display_ref(char *);
int main(int argc, char **argv) {
  char *refid = NULL;
  char *display = NULL;
  int refid_flag = 0;
  int wait_flag = 0;
  int create_flag = 0;
  int get_flag = 0;
  int remove_flag = 0;
  int local_flag = 1;
  int proxy_flag = 0;
  char *src_host = NULL;
  char *dst_host = NULL;
  char *user = NULL;
  char *ssh_cmd = NULL;
  char *ssh_args = NULL;
  char ref_file[256];
  size_t subcmd_size = 1024;
  char subcmd[1024];
  char *p;
  char *progname;
  char *optstring = "hi:crgwf:t:pd:u:s:o:";
  char *short_options_desc =
      "Usage : %s [-h] -i refid [-g|c|r] [-w] \n\[-u user] [-t nodeB"
      " [-f nodeA [-d display]] [-s ssh_cmd] [-o ssh_args] ] \n";
  int option;
  char *addon_options_desc =
      "\n        -h\t\tshow this message\n        -i refid\tjob id to use as a "
      "reference\n        -u user\t\tuser name to use during ssh connections\n "
      "       -d display\tDISPLAY value to use instead of using refid\n        "
      "          \tto get the good one (proxy mode only)\n        -f "
      "nodeA\tnode to use to initiate the X11 tunneling\n        -t "
      "nodeB\tnode to connect to to create an X11 tunnel\n        -c\t\tcreate "
      "local DISPLAY reference\n        -r\t\tremove local DISPLAY reference\n "
      "       -g\t\tget local DISPLAY reference (default)\n        -w\t\twait "
      "until reference is removed or\n        \t\tprocess is reattached to "
      "init\n";
  snprintf(subcmd, subcmd_size, "%s", "/usr/libexec/slurm-spank-x11");
  progname = rindex(argv[0], '/');
  if (progname == NULL)
    progname = argv[0];
  else
    progname++;
  while ((option = getopt(argc, argv, optstring)) != -1) {
    switch (option) {
    case 'i':
      refid = strdup(optarg);
      refid_flag = 1;
      p = strdup(subcmd);
      snprintf(subcmd, subcmd_size, "%s -i %s", p, optarg);
      free(p);
      break;
    case 'd':
      display = strdup(optarg);
      p = strdup(subcmd);
      snprintf(subcmd, subcmd_size, "%s -d %s", p, optarg);
      free(p);
      break;
    case 'u':
      user = strdup(optarg);
      p = strdup(subcmd);
      snprintf(subcmd, subcmd_size, "%s -u %s", p, optarg);
      free(p);
      break;
    case 'c':
      create_flag = 1;
      p = strdup(subcmd);
      snprintf(subcmd, subcmd_size, "%s -c", p);
      free(p);
      break;
    case 'r':
      remove_flag = 1;
      p = strdup(subcmd);
      snprintf(subcmd, subcmd_size, "%s -r", p);
      free(p);
      break;
    case 'g':
      get_flag = 1;
      p = strdup(subcmd);
      snprintf(subcmd, subcmd_size, "%s -g", p);
      free(p);
      break;
    case 'w':
      wait_flag = 1;
      p = strdup(subcmd);
      snprintf(subcmd, subcmd_size, "%s -w", p);
      free(p);
      break;
    case 's':
      ssh_cmd = strdup(optarg);
      p = strdup(subcmd);
      snprintf(subcmd, subcmd_size, "%s -s \"%s\"", p, optarg);
      free(p);
      break;
    case 'o':
      ssh_args = strdup(optarg);
      p = strdup(subcmd);
      snprintf(subcmd, subcmd_size, "%s -o \"%s\"", p, optarg);
      free(p);
      break;
    case 'f':
      src_host = strdup(optarg);
      break;
    case 't':
      dst_host = strdup(optarg);
      local_flag = 0;
      break;
    case 'p':
      proxy_flag = 1;
      break;
    case 'h':
    default:
      fprintf(stdout, short_options_desc, progname);
      fprintf(stdout, "%s\n", addon_options_desc);
      exit(0);
      break;
    }
  }
  if (!refid_flag) {
    fprintf(stderr, short_options_desc, progname);
    exit(1);
  }
  if (proxy_flag) {
    if (display != NULL) {
      setenv("DISPLAY", display, 1);
      free(display);
    } else if (read_display_ref(refid, &display) == 0) {
      setenv("DISPLAY", display, 1);
      free(display);
    } else {
      fprintf(stderr,
              "error: proxy failed : unable to read "
              "DISPLAY value for ref=%s",
              refid);
      exit(60);
    }
  }
  if (!local_flag) {
    if (ssh_cmd == NULL)
      ssh_cmd = strdup("ssh");
    if (ssh_args == NULL)
      ssh_args = strdup("");
    if (src_host != NULL) {
      p = strdup(subcmd);
      if (user != NULL)
        snprintf(subcmd, subcmd_size,
                 "%s -x %s -l %s"
                 " %s '%s -p -t %s'",
                 ssh_cmd, ssh_args, user, src_host, p, dst_host);
      else
        snprintf(subcmd, subcmd_size,
                 "%s -x %s %s '%s"
                 " -p -t %s'",
                 ssh_cmd, ssh_args, src_host, p, dst_host);
      free(p);
    } else {
      p = strdup(subcmd);
      if (user != NULL)
        snprintf(subcmd, subcmd_size,
                 "%s -Y %s -l %s"
                 " %s '%s'",
                 ssh_cmd, ssh_args, user, dst_host, p);
      else
        snprintf(subcmd, subcmd_size, "%s -Y %s %s '%s'", ssh_cmd, ssh_args,
                 dst_host, p);
      free(p);
    }
    return system(subcmd);
  }
  if (create_flag) {
    write_display_ref(refid);
  }
  if (get_flag) {
    if (read_display_ref(refid, &display) == 0) {
      fprintf(stdout, "%s\n", display);
      fflush(stdout);
      free(display);
    }
  }
  if (remove_flag) {
    remove_display_ref(refid);
  }
  if (wait_flag) {
    wait_display_ref(refid);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x1,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
movq   $0x0,-0x68(%rbp)
movq   $0x400,-0x178(%rbp)
lea    0xde0(%rip),%rax
mov    %rax,-0x598(%rbp)
lea    0xde7(%rip),%rax
mov    %rax,-0x5a0(%rbp)
lea    0xe4c(%rip),%rax
mov    %rax,-0x5b0(%rbp)
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
lea    0x10b1(%rip),%rdx
lea    0x107e(%rip),%rcx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x2f,%esi
call   10c0 <rindex@plt>
mov    %rax,-0x590(%rbp)
cmpq   $0x0,-0x590(%rbp)
jne    12f3 <main+0x113>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x590(%rbp)
jmp    1305 <main+0x125>
mov    -0x590(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x590(%rbp)
jmp    130a <main+0x12a>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x598(%rbp),%rdx
call   10d0 <getopt@plt>
mov    %eax,-0x5a4(%rbp)
cmp    $0xffffffff,%eax
je     171d <main+0x53d>
mov    -0x5a4(%rbp),%eax
add    $0xffffff9d,%eax
mov    %eax,%ecx
mov    %rcx,-0x5b8(%rbp)
sub    $0x14,%eax
ja     16d9 <main+0x4f9>
mov    -0x5b8(%rbp),%rax
lea    0xcab(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2c93(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x24(%rbp)
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x588(%rbp),%rcx
mov    0x2c51(%rip),%rax
mov    (%rax),%r8
lea    0xf9d(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
jmp    1718 <main+0x538>
mov    0x2c28(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x20(%rbp)
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x588(%rbp),%rcx
mov    0x2bed(%rip),%rax
mov    (%rax),%r8
lea    0xf42(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
jmp    1718 <main+0x538>
mov    0x2bc4(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x58(%rbp)
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x588(%rbp),%rcx
mov    0x2b89(%rip),%rax
mov    (%rax),%r8
lea    0xee7(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
jmp    1718 <main+0x538>
movl   $0x1,-0x2c(%rbp)
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x588(%rbp),%rcx
lea    0xea2(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
jmp    1718 <main+0x538>
movl   $0x1,-0x34(%rbp)
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x588(%rbp),%rcx
lea    0xe5a(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
jmp    1718 <main+0x538>
movl   $0x1,-0x30(%rbp)
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x588(%rbp),%rcx
lea    0xe12(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
jmp    1718 <main+0x538>
movl   $0x1,-0x28(%rbp)
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x588(%rbp),%rcx
lea    0xdca(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
jmp    1718 <main+0x538>
mov    0x2a28(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x60(%rbp)
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x588(%rbp),%rcx
mov    0x29ed(%rip),%rax
mov    (%rax),%r8
lea    0xd6c(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
jmp    1718 <main+0x538>
mov    0x29c4(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x68(%rbp)
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x588(%rbp),%rcx
mov    0x2989(%rip),%rax
mov    (%rax),%r8
lea    0xd13(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
jmp    1718 <main+0x538>
mov    0x2960(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x48(%rbp)
jmp    1718 <main+0x538>
mov    0x2948(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x38(%rbp)
jmp    1718 <main+0x538>
movl   $0x1,-0x3c(%rbp)
jmp    1718 <main+0x538>
jmp    16d9 <main+0x4f9>
mov    0x28f0(%rip),%rax
mov    (%rax),%edi
mov    -0x5a0(%rbp),%rsi
mov    -0x590(%rbp),%rdx
call   10a0 <fprintf@plt>
mov    0x28d4(%rip),%rax
mov    (%rax),%edi
mov    -0x5b0(%rbp),%rdx
lea    0xc8b(%rip),%rsi
call   10a0 <fprintf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
jmp    130a <main+0x12a>
cmpl   $0x0,-0x24(%rbp)
jne    174d <main+0x56d>
mov    0x28aa(%rip),%rax
mov    (%rax),%edi
mov    -0x5a0(%rbp),%rsi
mov    -0x590(%rbp),%rdx
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
cmpl   $0x0,-0x3c(%rbp)
je     17ec <main+0x60c>
cmpq   $0x0,-0x20(%rbp)
je     1785 <main+0x5a5>
mov    -0x20(%rbp),%rsi
lea    0xc2e(%rip),%rdi
mov    $0x1,%edx
call   1050 <setenv@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
jmp    17e7 <main+0x607>
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <read_display_ref@plt>
cmp    $0x0,%rax
jne    17bf <main+0x5df>
mov    -0x20(%rbp),%rsi
lea    0xbf4(%rip),%rdi
mov    $0x1,%edx
call   1050 <setenv@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
jmp    17e2 <main+0x602>
mov    0x2812(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xbd0(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x3c,%edi
call   10e0 <exit@plt>
jmp    17e7 <main+0x607>
jmp    17ec <main+0x60c>
cmpl   $0x0,-0x38(%rbp)
jne    199e <main+0x7be>
cmpq   $0x0,-0x60(%rbp)
jne    1811 <main+0x631>
lea    0xbd9(%rip),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    182c <main+0x64c>
lea    0x8b8(%rip),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     18ec <main+0x70c>
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     189f <main+0x6bf>
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%r8
mov    -0x58(%rbp),%r9
mov    -0x48(%rbp),%r11
mov    -0x588(%rbp),%r10
mov    -0x50(%rbp),%rax
lea    0xb60(%rip),%rdx
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1070 <snprintf@plt>
jmp    18db <main+0x6fb>
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%r8
mov    -0x48(%rbp),%r9
mov    -0x588(%rbp),%r10
mov    -0x50(%rbp),%rax
lea    0xb3a(%rip),%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
jmp    198a <main+0x7aa>
lea    -0x580(%rbp),%rdi
call   1100 <strdup@plt>
mov    %rax,-0x588(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     194b <main+0x76b>
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%r8
mov    -0x58(%rbp),%r9
mov    -0x50(%rbp),%r10
mov    -0x588(%rbp),%rax
lea    0xae9(%rip),%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1070 <snprintf@plt>
jmp    197e <main+0x79e>
lea    -0x580(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%r8
mov    -0x50(%rbp),%r9
mov    -0x588(%rbp),%rax
lea    0xac3(%rip),%rdx
mov    %rax,(%rsp)
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x588(%rbp),%rdi
call   1030 <free@plt>
lea    -0x580(%rbp),%rdi
call   1060 <system@plt>
mov    %eax,-0x4(%rbp)
jmp    1a34 <main+0x854>
cmpl   $0x0,-0x2c(%rbp)
je     19b1 <main+0x7d1>
mov    -0x18(%rbp),%rdi
call   1090 <write_display_ref@plt>
cmpl   $0x0,-0x30(%rbp)
je     1a07 <main+0x827>
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <read_display_ref@plt>
cmp    $0x0,%rax
jne    1a02 <main+0x822>
mov    0x25f7(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0x9b1(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x25de(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
jmp    1a07 <main+0x827>
cmpl   $0x0,-0x34(%rbp)
je     1a1a <main+0x83a>
mov    -0x18(%rbp),%rdi
call   10f0 <remove_display_ref@plt>
cmpl   $0x0,-0x28(%rbp)
je     1a2d <main+0x84d>
mov    -0x18(%rbp),%rdi
call   1080 <wait_display_ref@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x478,%rsp
mov    %rsi,%r12
mov    %edi,%r14d
movq   $0x0,0x18(%rsp)
lea    0x12e6(%rip),%rdx
lea    0x12b3(%rip),%rcx
lea    0x70(%rsp),%rdi
mov    $0x400,%esi
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    (%r12),%rdi
mov    $0x2f,%esi
call   10c0 <rindex@plt>
test   %rax,%rax
je     1238 <main+0x58>
add    $0x1,%rax
jmp    123c <main+0x5c>
mov    (%r12),%rax
mov    %rax,0x40(%rsp)
movl   $0x1,0x38(%rsp)
lea    0xdb0(%rip),%r13
xor    %eax,%eax
mov    %rax,0x60(%rsp)
movl   $0x0,0x34(%rsp)
xor    %eax,%eax
xor    %ecx,%ecx
mov    %rcx,0x58(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x20(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x48(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x8(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x10(%rsp)
movl   $0x0,0x2c(%rsp)
movl   $0x0,0x28(%rsp)
movl   $0x0,0x30(%rsp)
movl   $0x0,0x3c(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x68(%rsp)
mov    %r14d,0x4(%rsp)
mov    %r12,0x50(%rsp)
jmp    12e0 <main+0x100>
mov    0x2d3a(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,0x20(%rsp)
movl   $0x0,0x38(%rsp)
mov    %r15d,%eax
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%r15d
mov    %r14d,%edi
mov    %r12,%rsi
lea    0xef4(%rip),%rdx
call   10d0 <getopt@plt>
add    $0x1,%eax
cmp    $0x78,%eax
ja     17f2 <main+0x612>
movslq 0x0(%r13,%rax,4),%rcx
add    %r13,%rcx
mov    $0x1,%eax
jmp    *%rcx
lea    0x70(%rsp),%rbp
mov    %rbp,%rdi
call   1100 <strdup@plt>
mov    %rax,%rbx
mov    $0x400,%esi
mov    %rbp,%rdi
lea    0x11ca(%rip),%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movl   $0x1,0x28(%rsp)
mov    %r15d,%eax
jmp    12e0 <main+0x100>
lea    0x70(%rsp),%rbp
mov    %rbp,%rdi
call   1100 <strdup@plt>
mov    %rax,%rbx
mov    $0x400,%esi
mov    %rbp,%rdi
lea    0x1192(%rip),%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movl   $0x1,0x34(%rsp)
mov    %r15d,%eax
jmp    12e0 <main+0x100>
mov    0x2c62(%rip),%rax
mov    (%rax),%rbp
mov    %rbp,%rdi
call   1100 <strdup@plt>
mov    %rax,0x60(%rsp)
mov    %rax,0x18(%rsp)
lea    0x70(%rsp),%r12
mov    %r12,%rdi
call   1100 <strdup@plt>
mov    %rax,%rbx
mov    $0x400,%esi
mov    %r12,%rdi
mov    0x50(%rsp),%r12
lea    0x1118(%rip),%rdx
mov    %rax,%rcx
mov    %rbp,%r8
mov    0x4(%rsp),%r14d
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    %rbx,%rdi
jmp    15af <main+0x3cf>
mov    0x2c08(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,0x58(%rsp)
mov    %r15d,%eax
jmp    12e0 <main+0x100>
lea    0x70(%rsp),%rbp
mov    %rbp,%rdi
call   1100 <strdup@plt>
mov    %rax,%rbx
mov    $0x400,%esi
mov    %rbp,%rdi
lea    0x10e1(%rip),%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movl   $0x1,0x2c(%rsp)
mov    %r15d,%eax
jmp    12e0 <main+0x100>
mov    0x2bab(%rip),%rax
mov    (%rax),%rbp
mov    %rbp,%rdi
call   1100 <strdup@plt>
mov    %rax,0x68(%rsp)
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1100 <strdup@plt>
mov    %rax,%r12
mov    $0x400,%esi
mov    %rbx,%rdi
lea    0x1062(%rip),%rdx
mov    %rax,%rcx
mov    %rbp,%r8
mov    0x4(%rsp),%r14d
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    %r12,%rdi
mov    0x50(%rsp),%r12
call   1030 <free@plt>
movl   $0x1,0x3c(%rsp)
mov    %r15d,%eax
jmp    12e0 <main+0x100>
mov    0x2b46(%rip),%rax
mov    (%rax),%rbx
mov    %rbx,%rdi
call   1100 <strdup@plt>
mov    %rax,0x10(%rsp)
lea    0x70(%rsp),%r14
mov    %r14,%rdi
call   1100 <strdup@plt>
mov    %rax,%rbp
mov    $0x400,%esi
mov    %r14,%rdi
lea    0x103b(%rip),%rdx
jmp    159a <main+0x3ba>
mov    0x2b0b(%rip),%rax
mov    (%rax),%rbx
mov    %rbx,%rdi
call   1100 <strdup@plt>
mov    %rax,0x8(%rsp)
lea    0x70(%rsp),%r14
mov    %r14,%rdi
call   1100 <strdup@plt>
mov    %rax,%rbp
mov    $0x400,%esi
mov    %r14,%rdi
lea    0xff5(%rip),%rdx
jmp    159a <main+0x3ba>
lea    0x70(%rsp),%rbp
mov    %rbp,%rdi
call   1100 <strdup@plt>
mov    %rax,%rbx
mov    $0x400,%esi
mov    %rbp,%rdi
lea    0xfce(%rip),%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movl   $0x1,0x30(%rsp)
mov    %r15d,%eax
jmp    12e0 <main+0x100>
mov    0x2a92(%rip),%rax
mov    (%rax),%rbx
mov    %rbx,%rdi
call   1100 <strdup@plt>
mov    %rax,0x48(%rsp)
lea    0x70(%rsp),%r12
mov    %r12,%rdi
call   1100 <strdup@plt>
mov    %rax,%rbp
mov    $0x400,%esi
mov    %r12,%rdi
mov    0x50(%rsp),%r12
lea    0xf56(%rip),%rdx
mov    %rax,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    %rbp,%rdi
mov    0x4(%rsp),%r14d
call   1030 <free@plt>
mov    %r15d,%eax
jmp    12e0 <main+0x100>
cmpl   $0x0,0x3c(%rsp)
je     1828 <main+0x648>
test   %r15d,%r15d
mov    0x68(%rsp),%rbp
je     162a <main+0x44a>
mov    0x60(%rsp),%rbx
test   %rbx,%rbx
je     15f4 <main+0x414>
lea    0xf49(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <setenv@plt>
mov    %rbx,%rdi
jmp    1625 <main+0x445>
lea    0x18(%rsp),%rsi
mov    %rbp,%rdi
call   1040 <read_display_ref@plt>
test   %rax,%rax
jne    184c <main+0x66c>
mov    0x18(%rsp),%rsi
lea    0xf15(%rip),%rdi
mov    $0x1,%edx
call   1050 <setenv@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
cmpl   $0x0,0x38(%rsp)
je     16ad <main+0x4cd>
cmpl   $0x0,0x28(%rsp)
je     1640 <main+0x460>
mov    %rbp,%rdi
call   1090 <write_display_ref@plt>
cmpl   $0x0,0x2c(%rsp)
je     1684 <main+0x4a4>
lea    0x18(%rsp),%rsi
mov    %rbp,%rdi
call   1040 <read_display_ref@plt>
test   %rax,%rax
jne    1684 <main+0x4a4>
mov    0x2970(%rip),%rbx
mov    (%rbx),%edi
mov    0x18(%rsp),%rdx
lea    0xeb9(%rip),%rsi
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
call   10b0 <fflush@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
cmpl   $0x0,0x34(%rsp)
je     1693 <main+0x4b3>
mov    %rbp,%rdi
call   10f0 <remove_display_ref@plt>
xor    %ebx,%ebx
cmpl   $0x0,0x30(%rsp)
je     17de <main+0x5fe>
mov    %rbp,%rdi
call   1080 <wait_display_ref@plt>
jmp    17de <main+0x5fe>
cmpq   $0x0,0x8(%rsp)
je     1717 <main+0x537>
cmpq   $0x0,0x10(%rsp)
je     1730 <main+0x550>
lea    0x70(%rsp),%rdi
call   1100 <strdup@plt>
mov    %rax,%rbx
mov    0x58(%rsp),%rbp
test   %rbp,%rbp
je     1746 <main+0x566>
mov    0x48(%rsp),%r9
test   %r9,%r9
je     1774 <main+0x594>
sub    $0x8,%rsp
lea    0xe88(%rip),%rdx
lea    0x78(%rsp),%rdi
mov    $0x400,%esi
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%r8
xor    %eax,%eax
push   0x28(%rsp)
push   %rbx
push   %rbp
call   1070 <snprintf@plt>
add    $0x20,%rsp
jmp    17ca <main+0x5ea>
lea    0xe53(%rip),%rdi
call   1100 <strdup@plt>
mov    %rax,0x8(%rsp)
cmpq   $0x0,0x10(%rsp)
jne    16bd <main+0x4dd>
lea    0xb34(%rip),%rdi
call   1100 <strdup@plt>
mov    %rax,0x10(%rsp)
jmp    16bd <main+0x4dd>
mov    0x48(%rsp),%r9
test   %r9,%r9
je     179a <main+0x5ba>
lea    0xe58(%rip),%rdx
lea    0x70(%rsp),%rdi
mov    $0x400,%esi
mov    0x8(%rsp),%rcx
mov    0x10(%rsp),%r8
xor    %eax,%eax
push   %rbx
push   0x28(%rsp)
jmp    17c1 <main+0x5e1>
lea    0xe1a(%rip),%rdx
lea    0x70(%rsp),%rdi
mov    $0x400,%esi
mov    0x8(%rsp),%rcx
mov    0x10(%rsp),%r8
mov    %rbp,%r9
xor    %eax,%eax
push   0x20(%rsp)
jmp    17c0 <main+0x5e0>
sub    $0x8,%rsp
lea    0xe21(%rip),%rdx
lea    0x78(%rsp),%rdi
mov    $0x400,%esi
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    0x28(%rsp),%r9
xor    %eax,%eax
push   %rbx
call   1070 <snprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0x70(%rsp),%rdi
call   1060 <system@plt>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x478,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x27d7(%rip),%rbx
mov    (%rbx),%edi
lea    0x9f7(%rip),%rsi
mov    0x40(%rsp),%rdx
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xd12(%rip),%rsi
lea    0xa50(%rip),%rdx
call   10a0 <fprintf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    0x27a9(%rip),%rax
mov    (%rax),%edi
lea    0x9c1(%rip),%rsi
mov    0x40(%rsp),%rdx
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2785(%rip),%rax
mov    (%rax),%edi
lea    0xcd7(%rip),%rsi
mov    %rbp,%rdx
call   10a0 <fprintf@plt>
mov    $0x3c,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"hi:crgwf:t:pd:u:s:o:\00"
@.str.1 = [115 x i8] c"Usage : %s [-h] -i refid [-g|c|r] [-w] \0A[-u user] [-t nodeB [-f nodeA [-d display]] [-s ssh_cmd] [-o ssh_args] ] \0A\00"
@.str.2 = [597 x i8] c"\0A -h\09\09show this message\0A -i refid\09job id to use as a reference\0A -u user\09\09user name to use during ssh connections\0A -d display\09DISPLAY value to use instead of using refid\0A \09to get the good one (proxy mode only)\0A -f nodeA\09node to use to initiate the X11 tunneling\0A -t nodeB\09node to connect to to create an X11 tunnel\0A -c\09\09create local DISPLAY reference\0A -r\09\09remove local DISPLAY reference\0A -g\09\09get local DISPLAY reference (default)\0A -w\09\09wait until reference is removed or\0A \09\09process is reattached to init\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [29 x i8] c"/usr/libexec/slurm-spank-x11\00"
@optarg = global i8* null
@.str.5 = [9 x i8] c"%s -i %s\00"
@.str.6 = [9 x i8] c"%s -d %s\00"
@.str.7 = [9 x i8] c"%s -u %s\00"
@.str.8 = [6 x i8] c"%s -c\00"
@.str.9 = [6 x i8] c"%s -r\00"
@.str.10 = [6 x i8] c"%s -g\00"
@.str.11 = [6 x i8] c"%s -w\00"
@.str.12 = [11 x i8] c"%s -s \22%s\22\00"
@.str.13 = [11 x i8] c"%s -o \22%s\22\00"
@stdout = global i32 0
@.str.14 = [4 x i8] c"%s\0A\00"
@stderr = global i32 0
@.str.15 = [8 x i8] c"DISPLAY\00"
@.str.16 = [62 x i8] c"error: proxy failed : unable to read DISPLAY value for ref=%s\00"
@.str.17 = [4 x i8] c"ssh\00"
@.str.18 = [1 x i8] zeroinitializer
@.str.19 = [32 x i8] c"%s -x %s -l %s %s '%s -p -t %s'\00"
@.str.20 = [26 x i8] c"%s -x %s %s '%s -p -t %s'\00"
@.str.21 = [23 x i8] c"%s -Y %s -l %s %s '%s'\00"
@.str.22 = [17 x i8] c"%s -Y %s %s '%s'\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca [256 x i8]
%21 = alloca i64
%22 = alloca [1024 x i8]
%23 = alloca i8*
%24 = alloca i8*
%25 = alloca i8*
%26 = alloca i8*
%27 = alloca i32
%28 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 1, i32* %13
store i32 0, i32* %14
store i8* null, i8** %15
store i8* null, i8** %16
store i8* null, i8** %17
store i8* null, i8** %18
store i8* null, i8** %19
store i64 1024, i64* %21
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %25
store i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.1, i64 0, i64 0), i8** %26
store i8* getelementptr inbounds ([597 x i8], [597 x i8]* @.str.2, i64 0, i64 0), i8** %28
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%30 = load i64, i64* %21
%31 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %29, i64 %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i8* @rindex(i8* %34, i8 signext 47)
store i8* %35, i8** %24
%36 = load i8*, i8** %24
%37 = icmp eq i8* %36, null
br i1 %37, label %38, label %42
38: ; preds = %2
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
store i8* %41, i8** %24
br label %45
42: ; preds = %2
%43 = load i8*, i8** %24
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %24
br label %45
45: ; preds = %42, %38
br label %46
46: ; preds = %167, %45
%47 = load i32, i32* %4
%48 = load i8**, i8*** %5
%49 = load i8*, i8** %25
%50 = call i32 @getopt(i32 %47, i8** %48, i8* %49)
store i32 %50, i32* %27
%51 = icmp ne i32 %50, -1
br i1 %51, label %52, label %168
52: ; preds = %46
%53 = load i32, i32* %27
switch i32 %53, label %158 [
i32 105, label %54
i32 100, label %66
i32 117, label %78
i32 99, label %90
i32 114, label %99
i32 103, label %108
i32 119, label %117
i32 115, label %126
i32 111, label %138
i32 102, label %150
i32 116, label %153
i32 112, label %156
i32 104, label %157
]
54: ; preds = %52
%55 = load i8*, i8** @optarg
%56 = call i8* @strdup(i8* %55)
store i8* %56, i8** %6
store i32 1, i32* %8
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%58 = call i8* @strdup(i8* %57)
store i8* %58, i8** %23
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%60 = load i64, i64* %21
%61 = load i8*, i8** %23
%62 = load i8*, i8** @optarg
%63 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %59, i64 %60, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %61, i8* %62)
%64 = load i8*, i8** %23
%65 = call i32 @free(i8* %64)
br label %167
66: ; preds = %52
%67 = load i8*, i8** @optarg
%68 = call i8* @strdup(i8* %67)
store i8* %68, i8** %7
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%70 = call i8* @strdup(i8* %69)
store i8* %70, i8** %23
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%72 = load i64, i64* %21
%73 = load i8*, i8** %23
%74 = load i8*, i8** @optarg
%75 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %71, i64 %72, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %73, i8* %74)
%76 = load i8*, i8** %23
%77 = call i32 @free(i8* %76)
br label %167
78: ; preds = %52
%79 = load i8*, i8** @optarg
%80 = call i8* @strdup(i8* %79)
store i8* %80, i8** %17
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%82 = call i8* @strdup(i8* %81)
store i8* %82, i8** %23
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%84 = load i64, i64* %21
%85 = load i8*, i8** %23
%86 = load i8*, i8** @optarg
%87 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %83, i64 %84, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* %85, i8* %86)
%88 = load i8*, i8** %23
%89 = call i32 @free(i8* %88)
br label %167
90: ; preds = %52
store i32 1, i32* %10
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%92 = call i8* @strdup(i8* %91)
store i8* %92, i8** %23
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%94 = load i64, i64* %21
%95 = load i8*, i8** %23
%96 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %93, i64 %94, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* %95)
%97 = load i8*, i8** %23
%98 = call i32 @free(i8* %97)
br label %167
99: ; preds = %52
store i32 1, i32* %12
%100 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%101 = call i8* @strdup(i8* %100)
store i8* %101, i8** %23
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%103 = load i64, i64* %21
%104 = load i8*, i8** %23
%105 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %102, i64 %103, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %104)
%106 = load i8*, i8** %23
%107 = call i32 @free(i8* %106)
br label %167
108: ; preds = %52
store i32 1, i32* %11
%109 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%110 = call i8* @strdup(i8* %109)
store i8* %110, i8** %23
%111 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%112 = load i64, i64* %21
%113 = load i8*, i8** %23
%114 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %111, i64 %112, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* %113)
%115 = load i8*, i8** %23
%116 = call i32 @free(i8* %115)
br label %167
117: ; preds = %52
store i32 1, i32* %9
%118 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%119 = call i8* @strdup(i8* %118)
store i8* %119, i8** %23
%120 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%121 = load i64, i64* %21
%122 = load i8*, i8** %23
%123 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %120, i64 %121, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %122)
%124 = load i8*, i8** %23
%125 = call i32 @free(i8* %124)
br label %167
126: ; preds = %52
%127 = load i8*, i8** @optarg
%128 = call i8* @strdup(i8* %127)
store i8* %128, i8** %18
%129 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%130 = call i8* @strdup(i8* %129)
store i8* %130, i8** %23
%131 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%132 = load i64, i64* %21
%133 = load i8*, i8** %23
%134 = load i8*, i8** @optarg
%135 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %131, i64 %132, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %133, i8* %134)
%136 = load i8*, i8** %23
%137 = call i32 @free(i8* %136)
br label %167
138: ; preds = %52
%139 = load i8*, i8** @optarg
%140 = call i8* @strdup(i8* %139)
store i8* %140, i8** %19
%141 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%142 = call i8* @strdup(i8* %141)
store i8* %142, i8** %23
%143 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%144 = load i64, i64* %21
%145 = load i8*, i8** %23
%146 = load i8*, i8** @optarg
%147 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %143, i64 %144, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* %145, i8* %146)
%148 = load i8*, i8** %23
%149 = call i32 @free(i8* %148)
br label %167
150: ; preds = %52
%151 = load i8*, i8** @optarg
%152 = call i8* @strdup(i8* %151)
store i8* %152, i8** %15
br label %167
153: ; preds = %52
%154 = load i8*, i8** @optarg
%155 = call i8* @strdup(i8* %154)
store i8* %155, i8** %16
store i32 0, i32* %13
br label %167
156: ; preds = %52
store i32 1, i32* %14
br label %167
157: ; preds = %52
br label %158
158: ; preds = %52, %157
%159 = load i32, i32* @stdout
%160 = load i8*, i8** %26
%161 = load i8*, i8** %24
%162 = call i32 @fprintf(i32 %159, i8* %160, i8* %161)
%163 = load i32, i32* @stdout
%164 = load i8*, i8** %28
%165 = call i32 @fprintf(i32 %163, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* %164)
%166 = call i32 @exit(i32 0)
unreachable
167: ; preds = %156, %153, %150, %138, %126, %117, %108, %99, %90, %78, %66, %54
br label %46
168: ; preds = %46
%169 = load i32, i32* %8
%170 = icmp ne i32 %169, 0
br i1 %170, label %177, label %171
171: ; preds = %168
%172 = load i32, i32* @stderr
%173 = load i8*, i8** %26
%174 = load i8*, i8** %24
%175 = call i32 @fprintf(i32 %172, i8* %173, i8* %174)
%176 = call i32 @exit(i32 1)
unreachable
177: ; preds = %168
%178 = load i32, i32* %14
%179 = icmp ne i32 %178, 0
br i1 %179, label %180, label %204
180: ; preds = %177
%181 = load i8*, i8** %7
%182 = icmp ne i8* %181, null
br i1 %182, label %183, label %188
183: ; preds = %180
%184 = load i8*, i8** %7
%185 = call i32 @setenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* %184, i32 1)
%186 = load i8*, i8** %7
%187 = call i32 @free(i8* %186)
br label %203
188: ; preds = %180
%189 = load i8*, i8** %6
%190 = call i64 @read_display_ref(i8* %189, i8** %7)
%191 = icmp eq i64 %190, 0
br i1 %191, label %192, label %197
192: ; preds = %188
%193 = load i8*, i8** %7
%194 = call i32 @setenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* %193, i32 1)
%195 = load i8*, i8** %7
%196 = call i32 @free(i8* %195)
br label %202
197: ; preds = %188
%198 = load i32, i32* @stderr
%199 = load i8*, i8** %6
%200 = call i32 @fprintf(i32 %198, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.16, i64 0, i64 0), i8* %199)
%201 = call i32 @exit(i32 60)
unreachable
202: ; preds = %192
br label %203
203: ; preds = %202, %183
br label %204
204: ; preds = %203, %177
%205 = load i32, i32* %13
%206 = icmp ne i32 %205, 0
br i1 %206, label %275, label %207
207: ; preds = %204
%208 = load i8*, i8** %18
%209 = icmp eq i8* %208, null
br i1 %209, label %210, label %212
210: ; preds = %207
%211 = call i8* @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
store i8* %211, i8** %18
br label %212
212: ; preds = %210, %207
%213 = load i8*, i8** %19
%214 = icmp eq i8* %213, null
br i1 %214, label %215, label %217
215: ; preds = %212
%216 = call i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.18, i64 0, i64 0))
store i8* %216, i8** %19
br label %217
217: ; preds = %215, %212
%218 = load i8*, i8** %15
%219 = icmp ne i8* %218, null
br i1 %219, label %220, label %247
220: ; preds = %217
%221 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%222 = call i8* @strdup(i8* %221)
store i8* %222, i8** %23
%223 = load i8*, i8** %17
%224 = icmp ne i8* %223, null
br i1 %224, label %225, label %235
225: ; preds = %220
%226 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%227 = load i64, i64* %21
%228 = load i8*, i8** %18
%229 = load i8*, i8** %19
%230 = load i8*, i8** %17
%231 = load i8*, i8** %15
%232 = load i8*, i8** %23
%233 = load i8*, i8** %16
%234 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %226, i64 %227, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.19, i64 0, i64 0), i8* %228, i8* %229, i8* %230, i8* %231, i8* %232, i8* %233)
br label %244
235: ; preds = %220
%236 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%237 = load i64, i64* %21
%238 = load i8*, i8** %18
%239 = load i8*, i8** %19
%240 = load i8*, i8** %15
%241 = load i8*, i8** %23
%242 = load i8*, i8** %16
%243 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %236, i64 %237, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0), i8* %238, i8* %239, i8* %240, i8* %241, i8* %242)
br label %244
244: ; preds = %235, %225
%245 = load i8*, i8** %23
%246 = call i32 @free(i8* %245)
br label %272
247: ; preds = %217
%248 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%249 = call i8* @strdup(i8* %248)
store i8* %249, i8** %23
%250 = load i8*, i8** %17
%251 = icmp ne i8* %250, null
br i1 %251, label %252, label %261
252: ; preds = %247
%253 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%254 = load i64, i64* %21
%255 = load i8*, i8** %18
%256 = load i8*, i8** %19
%257 = load i8*, i8** %17
%258 = load i8*, i8** %16
%259 = load i8*, i8** %23
%260 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %253, i64 %254, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0), i8* %255, i8* %256, i8* %257, i8* %258, i8* %259)
br label %269
261: ; preds = %247
%262 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%263 = load i64, i64* %21
%264 = load i8*, i8** %18
%265 = load i8*, i8** %19
%266 = load i8*, i8** %16
%267 = load i8*, i8** %23
%268 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %262, i64 %263, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i64 0, i64 0), i8* %264, i8* %265, i8* %266, i8* %267)
br label %269
269: ; preds = %261, %252
%270 = load i8*, i8** %23
%271 = call i32 @free(i8* %270)
br label %272
272: ; preds = %269, %244
%273 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%274 = call i32 @system(i8* %273)
store i32 %274, i32* %3
br label %310
275: ; preds = %204
%276 = load i32, i32* %10
%277 = icmp ne i32 %276, 0
br i1 %277, label %278, label %281
278: ; preds = %275
%279 = load i8*, i8** %6
%280 = call i32 @write_display_ref(i8* %279)
br label %281
281: ; preds = %278, %275
%282 = load i32, i32* %11
%283 = icmp ne i32 %282, 0
br i1 %283, label %284, label %297
284: ; preds = %281
%285 = load i8*, i8** %6
%286 = call i64 @read_display_ref(i8* %285, i8** %7)
%287 = icmp eq i64 %286, 0
br i1 %287, label %288, label %296
288: ; preds = %284
%289 = load i32, i32* @stdout
%290 = load i8*, i8** %7
%291 = call i32 @fprintf(i32 %289, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* %290)
%292 = load i32, i32* @stdout
%293 = call i32 @fflush(i32 %292)
%294 = load i8*, i8** %7
%295 = call i32 @free(i8* %294)
br label %296
296: ; preds = %288, %284
br label %297
297: ; preds = %296, %281
%298 = load i32, i32* %12
%299 = icmp ne i32 %298, 0
br i1 %299, label %300, label %303
300: ; preds = %297
%301 = load i8*, i8** %6
%302 = call i32 @remove_display_ref(i8* %301)
br label %303
303: ; preds = %300, %297
%304 = load i32, i32* %9
%305 = icmp ne i32 %304, 0
br i1 %305, label %306, label %309
306: ; preds = %303
%307 = load i8*, i8** %6
%308 = call i32 @wait_display_ref(i8* %307)
br label %309
309: ; preds = %306, %303
store i32 0, i32* %3
br label %310
310: ; preds = %309, %272
%311 = load i32, i32* %3
ret i32 %311
}

LLVM IR (-O2):
@.str = [21 x i8] c"hi:crgwf:t:pd:u:s:o:\00"
@.str.1 = [115 x i8] c"Usage : %s [-h] -i refid [-g|c|r] [-w] \0A[-u user] [-t nodeB [-f nodeA [-d display]] [-s ssh_cmd] [-o ssh_args] ] \0A\00"
@.str.2 = [597 x i8] c"\0A -h\09\09show this message\0A -i refid\09job id to use as a reference\0A -u user\09\09user name to use during ssh connections\0A -d display\09DISPLAY value to use instead of using refid\0A \09to get the good one (proxy mode only)\0A -f nodeA\09node to use to initiate the X11 tunneling\0A -t nodeB\09node to connect to to create an X11 tunnel\0A -c\09\09create local DISPLAY reference\0A -r\09\09remove local DISPLAY reference\0A -g\09\09get local DISPLAY reference (default)\0A -w\09\09wait until reference is removed or\0A \09\09process is reattached to init\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [29 x i8] c"/usr/libexec/slurm-spank-x11\00"
@optarg = global i8* null
@.str.5 = [9 x i8] c"%s -i %s\00"
@.str.6 = [9 x i8] c"%s -d %s\00"
@.str.7 = [9 x i8] c"%s -u %s\00"
@.str.8 = [6 x i8] c"%s -c\00"
@.str.9 = [6 x i8] c"%s -r\00"
@.str.10 = [6 x i8] c"%s -g\00"
@.str.11 = [6 x i8] c"%s -w\00"
@.str.12 = [11 x i8] c"%s -s \22%s\22\00"
@.str.13 = [11 x i8] c"%s -o \22%s\22\00"
@stdout = global i32 0
@.str.14 = [4 x i8] c"%s\0A\00"
@stderr = global i32 0
@.str.15 = [8 x i8] c"DISPLAY\00"
@.str.16 = [62 x i8] c"error: proxy failed : unable to read DISPLAY value for ref=%s\00"
@.str.17 = [4 x i8] c"ssh\00"
@.str.18 = [1 x i8] zeroinitializer
@.str.19 = [32 x i8] c"%s -x %s -l %s %s '%s -p -t %s'\00"
@.str.20 = [26 x i8] c"%s -x %s %s '%s -p -t %s'\00"
@.str.21 = [23 x i8] c"%s -Y %s -l %s %s '%s'\00"
@.str.22 = [17 x i8] c"%s -Y %s %s '%s'\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%8 = load i8*, i8** %1
%9 = call i8* @rindex(i8* %8, i8 signext 47)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i8*, i8** %1
br label %15
13: ; preds = %2
%14 = getelementptr inbounds i8, i8* %9, i64 1
br label %15
15: ; preds = %13, %11
%16 = phi i8* [ %12, %11 ], [ %14, %13 ]
br label %17
17: ; preds = %33, %15
%18 = phi i8* [ null, %15 ], [ %34, %33 ]
%19 = phi i32 [ 0, %15 ], [ %35, %33 ]
%20 = phi i32 [ 1, %15 ], [ %36, %33 ]
%21 = phi i32 [ 0, %15 ], [ %37, %33 ]
%22 = phi i8* [ null, %15 ], [ %38, %33 ]
%23 = phi i8* [ null, %15 ], [ %39, %33 ]
%24 = phi i8* [ null, %15 ], [ %40, %33 ]
%25 = phi i8* [ null, %15 ], [ %41, %33 ]
%26 = phi i8* [ null, %15 ], [ %42, %33 ]
%27 = phi i32 [ 0, %15 ], [ %43, %33 ]
%28 = phi i32 [ 0, %15 ], [ %44, %33 ]
%29 = phi i32 [ 0, %15 ], [ %45, %33 ]
%30 = phi i32 [ 0, %15 ], [ %46, %33 ]
%31 = phi i8* [ null, %15 ], [ %47, %33 ]
%32 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
switch i32 %32, label %100 [
i32 -1, label %106
i32 105, label %48
i32 100, label %54
i32 117, label %60
i32 99, label %66
i32 114, label %70
i32 103, label %74
i32 119, label %78
i32 115, label %82
i32 111, label %88
i32 102, label %94
i32 116, label %97
i32 112, label %33
]
33: ; preds = %17, %97, %94, %88, %82, %78, %74, %70, %66, %60, %54, %48
%34 = phi i8* [ %18, %97 ], [ %18, %94 ], [ %18, %88 ], [ %18, %82 ], [ %18, %78 ], [ %18, %74 ], [ %18, %70 ], [ %18, %66 ], [ %18, %60 ], [ %56, %54 ], [ %18, %48 ], [ %18, %17 ]
%35 = phi i32 [ %19, %97 ], [ %19, %94 ], [ %19, %88 ], [ %19, %82 ], [ %19, %78 ], [ %19, %74 ], [ 1, %70 ], [ %19, %66 ], [ %19, %60 ], [ %19, %54 ], [ %19, %48 ], [ %19, %17 ]
%36 = phi i32 [ 0, %97 ], [ %20, %94 ], [ %20, %88 ], [ %20, %82 ], [ %20, %78 ], [ %20, %74 ], [ %20, %70 ], [ %20, %66 ], [ %20, %60 ], [ %20, %54 ], [ %20, %48 ], [ %20, %17 ]
%37 = phi i32 [ %21, %97 ], [ %21, %94 ], [ %21, %88 ], [ %21, %82 ], [ %21, %78 ], [ %21, %74 ], [ %21, %70 ], [ %21, %66 ], [ %21, %60 ], [ %21, %54 ], [ %21, %48 ], [ 1, %17 ]
%38 = phi i8* [ %22, %97 ], [ %96, %94 ], [ %22, %88 ], [ %22, %82 ], [ %22, %78 ], [ %22, %74 ], [ %22, %70 ], [ %22, %66 ], [ %22, %60 ], [ %22, %54 ], [ %22, %48 ], [ %22, %17 ]
%39 = phi i8* [ %99, %97 ], [ %23, %94 ], [ %23, %88 ], [ %23, %82 ], [ %23, %78 ], [ %23, %74 ], [ %23, %70 ], [ %23, %66 ], [ %23, %60 ], [ %23, %54 ], [ %23, %48 ], [ %23, %17 ]
%40 = phi i8* [ %24, %97 ], [ %24, %94 ], [ %24, %88 ], [ %24, %82 ], [ %24, %78 ], [ %24, %74 ], [ %24, %70 ], [ %24, %66 ], [ %62, %60 ], [ %24, %54 ], [ %24, %48 ], [ %24, %17 ]
%41 = phi i8* [ %25, %97 ], [ %25, %94 ], [ %25, %88 ], [ %84, %82 ], [ %25, %78 ], [ %25, %74 ], [ %25, %70 ], [ %25, %66 ], [ %25, %60 ], [ %25, %54 ], [ %25, %48 ], [ %25, %17 ]
%42 = phi i8* [ %26, %97 ], [ %26, %94 ], [ %90, %88 ], [ %26, %82 ], [ %26, %78 ], [ %26, %74 ], [ %26, %70 ], [ %26, %66 ], [ %26, %60 ], [ %26, %54 ], [ %26, %48 ], [ %26, %17 ]
%43 = phi i32 [ %27, %97 ], [ %27, %94 ], [ %27, %88 ], [ %27, %82 ], [ %27, %78 ], [ 1, %74 ], [ %27, %70 ], [ %27, %66 ], [ %27, %60 ], [ %27, %54 ], [ %27, %48 ], [ %27, %17 ]
%44 = phi i32 [ %28, %97 ], [ %28, %94 ], [ %28, %88 ], [ %28, %82 ], [ %28, %78 ], [ %28, %74 ], [ %28, %70 ], [ 1, %66 ], [ %28, %60 ], [ %28, %54 ], [ %28, %48 ], [ %28, %17 ]
%45 = phi i32 [ %29, %97 ], [ %29, %94 ], [ %29, %88 ], [ %29, %82 ], [ 1, %78 ], [ %29, %74 ], [ %29, %70 ], [ %29, %66 ], [ %29, %60 ], [ %29, %54 ], [ %29, %48 ], [ %29, %17 ]
%46 = phi i32 [ %30, %97 ], [ %30, %94 ], [ %30, %88 ], [ %30, %82 ], [ %30, %78 ], [ %30, %74 ], [ %30, %70 ], [ %30, %66 ], [ %30, %60 ], [ %30, %54 ], [ 1, %48 ], [ %30, %17 ]
%47 = phi i8* [ %31, %97 ], [ %31, %94 ], [ %31, %88 ], [ %31, %82 ], [ %31, %78 ], [ %31, %74 ], [ %31, %70 ], [ %31, %66 ], [ %31, %60 ], [ %31, %54 ], [ %50, %48 ], [ %31, %17 ]
br label %17
48: ; preds = %17
%49 = load i8*, i8** @optarg
%50 = call i8* @strdup(i8* %49)
%51 = call i8* @strdup(i8* %6)
%52 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %51, i8* %49)
%53 = call i32 @free(i8* %51)
br label %33
54: ; preds = %17
%55 = load i8*, i8** @optarg
%56 = call i8* @strdup(i8* %55)
store i8* %56, i8** %3
%57 = call i8* @strdup(i8* %6)
%58 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %57, i8* %55)
%59 = call i32 @free(i8* %57)
br label %33
60: ; preds = %17
%61 = load i8*, i8** @optarg
%62 = call i8* @strdup(i8* %61)
%63 = call i8* @strdup(i8* %6)
%64 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* %63, i8* %61)
%65 = call i32 @free(i8* %63)
br label %33
66: ; preds = %17
%67 = call i8* @strdup(i8* %6)
%68 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* %67)
%69 = call i32 @free(i8* %67)
br label %33
70: ; preds = %17
%71 = call i8* @strdup(i8* %6)
%72 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %71)
%73 = call i32 @free(i8* %71)
br label %33
74: ; preds = %17
%75 = call i8* @strdup(i8* %6)
%76 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* %75)
%77 = call i32 @free(i8* %75)
br label %33
78: ; preds = %17
%79 = call i8* @strdup(i8* %6)
%80 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %79)
%81 = call i32 @free(i8* %79)
br label %33
82: ; preds = %17
%83 = load i8*, i8** @optarg
%84 = call i8* @strdup(i8* %83)
%85 = call i8* @strdup(i8* %6)
%86 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %85, i8* %83)
%87 = call i32 @free(i8* %85)
br label %33
88: ; preds = %17
%89 = load i8*, i8** @optarg
%90 = call i8* @strdup(i8* %89)
%91 = call i8* @strdup(i8* %6)
%92 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* %91, i8* %89)
%93 = call i32 @free(i8* %91)
br label %33
94: ; preds = %17
%95 = load i8*, i8** @optarg
%96 = call i8* @strdup(i8* %95)
br label %33
97: ; preds = %17
%98 = load i8*, i8** @optarg
%99 = call i8* @strdup(i8* %98)
br label %33
100: ; preds = %17
%101 = load i32, i32* @stdout
%102 = call i32 @fprintf(i32 %101, i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%103 = load i32, i32* @stdout
%104 = call i32 @fprintf(i32 %103, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([597 x i8], [597 x i8]* @.str.2, i64 0, i64 0))
%105 = call i32 @exit(i32 0)
unreachable
106: ; preds = %17
%107 = icmp eq i32 %30, 0
br i1 %107, label %108, label %112
108: ; preds = %106
%109 = load i32, i32* @stderr
%110 = call i32 @fprintf(i32 %109, i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%111 = call i32 @exit(i32 1)
unreachable
112: ; preds = %106
%113 = icmp eq i32 %21, 0
br i1 %113, label %131, label %114
114: ; preds = %112
%115 = icmp eq i8* %18, null
br i1 %115, label %119, label %116
116: ; preds = %114
%117 = call i32 @setenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* %18, i32 1)
%118 = call i32 @free(i8* %18)
br label %131
119: ; preds = %114
%120 = call i64 @read_display_ref(i8* %31, i8** %3)
%121 = icmp eq i64 %120, 0
br i1 %121, label %122, label %127
122: ; preds = %119
%123 = load i8*, i8** %3
%124 = call i32 @setenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* %123, i32 1)
%125 = load i8*, i8** %3
%126 = call i32 @free(i8* %125)
br label %131
127: ; preds = %119
%128 = load i32, i32* @stderr
%129 = call i32 @fprintf(i32 %128, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.16, i64 0, i64 0), i8* %31)
%130 = call i32 @exit(i32 60)
unreachable
131: ; preds = %116, %122, %112
%132 = icmp eq i32 %20, 0
br i1 %132, label %133, label %160
133: ; preds = %131
%134 = icmp eq i8* %25, null
br i1 %134, label %135, label %137
135: ; preds = %133
%136 = call dereferenceable_or_null(4) i8* @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
br label %137
137: ; preds = %135, %133
%138 = phi i8* [ %136, %135 ], [ %25, %133 ]
%139 = icmp eq i8* %26, null
br i1 %139, label %140, label %142
140: ; preds = %137
%141 = call dereferenceable_or_null(1) i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.18, i64 0, i64 0))
br label %142
142: ; preds = %140, %137
%143 = phi i8* [ %141, %140 ], [ %26, %137 ]
%144 = icmp eq i8* %22, null
%145 = call i8* @strdup(i8* %6)
%146 = icmp eq i8* %24, null
br i1 %144, label %152, label %147
147: ; preds = %142
br i1 %146, label %150, label %148
148: ; preds = %147
%149 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.19, i64 0, i64 0), i8* %138, i8* %143, i8* %24, i8* %22, i8* %145, i8* %23)
br label %157
150: ; preds = %147
%151 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0), i8* %138, i8* %143, i8* %22, i8* %145, i8* %23)
br label %157
152: ; preds = %142
br i1 %146, label %155, label %153
153: ; preds = %152
%154 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0), i8* %138, i8* %143, i8* %24, i8* %23, i8* %145)
br label %157
155: ; preds = %152
%156 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %6, i64 1024, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i64 0, i64 0), i8* %138, i8* %143, i8* %23, i8* %145)
br label %157
157: ; preds = %153, %155, %148, %150
%158 = call i32 @free(i8* %145)
%159 = call i32 @system(i8* %6)
br label %185
160: ; preds = %131
%161 = icmp eq i32 %28, 0
br i1 %161, label %164, label %162
162: ; preds = %160
%163 = call i32 @write_display_ref(i8* %31)
br label %164
164: ; preds = %162, %160
%165 = icmp eq i32 %27, 0
br i1 %165, label %177, label %166
166: ; preds = %164
%167 = call i64 @read_display_ref(i8* %31, i8** %3)
%168 = icmp eq i64 %167, 0
br i1 %168, label %169, label %177
169: ; preds = %166
%170 = load i32, i32* @stdout
%171 = load i8*, i8** %3
%172 = call i32 @fprintf(i32 %170, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* %171)
%173 = load i32, i32* @stdout
%174 = call i32 @fflush(i32 %173)
%175 = load i8*, i8** %3
%176 = call i32 @free(i8* %175)
br label %177
177: ; preds = %166, %169, %164
%178 = icmp eq i32 %19, 0
br i1 %178, label %181, label %179
179: ; preds = %177
%180 = call i32 @remove_display_ref(i8* %31)
br label %181
181: ; preds = %179, %177
%182 = icmp eq i32 %29, 0
br i1 %182, label %185, label %183
183: ; preds = %181
%184 = call i32 @wait_display_ref(i8* %31)
br label %185
185: ; preds = %181, %183, %157
%186 = phi i32 [ %159, %157 ], [ 0, %183 ], [ 0, %181 ]
ret i32 %186
}