#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 */
scalar_t__ ETXTBSY;
int /*<<< orphan*/ _SC_OPEN_MAX;
int atoi(char *);
char *calloc(int, int);
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int /*<<< orphan*/ execv(char *, char **);
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
scalar_t__ strcmp(char *, char *);
int sysconf(int /*<<< orphan*/);
int main(int argc, char **argv) {
  int i, split_index, maxfd, n;
  char *to_leave_open;
  int with_path = 0;
  maxfd = sysconf(_SC_OPEN_MAX);
  to_leave_open = calloc(maxfd, sizeof(char));
  if (!to_leave_open)
    return 99;
  split_index = -1;
  for (i = 0; argv[i]; i++)
    if (strcmp(argv[i], "--") == 0) {
      split_index = i;
      break;
    }
  if (split_index == -1 || (split_index + 1) >= argc) {
    printf("Usage:\n");
    printf("  %s fd0 .. fdN -- argv0 .. argvN\n", argv[0]);
    exit(1);
  }
  for (i = 0; i < split_index; i++) {
    if (strcmp(argv[1 + i], "--exec-with-path") == 0) {
      with_path = 1;
    } else {
      int fd = atoi(argv[1 + i]);
      to_leave_open[fd] = 1;
    }
  }
  for (i = 0; i < maxfd; i++)
    if (!to_leave_open[i])
      close(i);
  argv += split_index + 1;
  for (n = 5; n > 0; n--) {
    if (with_path)
      execvp(argv[0], argv);
    else
      execv(argv[0], argv);
    perror("Unix error: ");
    if (errno == ETXTBSY)
      sleep(1);
    else
      exit(127);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
call   1080 <sysconf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1206 <main+0x56>
movl   $0x63,-0x4(%rbp)
jmp    141c <main+0x26c>
movl   $0xffffffff,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1267 <main+0xb7>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdc6(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1254 <main+0xa4>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1267 <main+0xb7>
jmp    1259 <main+0xa9>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1214 <main+0x64>
cmpl   $0xffffffff,-0x18(%rbp)
je     1280 <main+0xd0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     12ad <main+0xfd>
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    132b <main+0x17b>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd56(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12f3 <main+0x143>
movl   $0x1,-0x2c(%rbp)
jmp    1318 <main+0x168>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
jmp    131d <main+0x16d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12b4 <main+0x104>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    136b <main+0x1bb>
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
jne    1358 <main+0x1a8>
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
jmp    135d <main+0x1ad>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1332 <main+0x182>
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
movl   $0x5,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    1415 <main+0x265>
cmpl   $0x0,-0x2c(%rbp)
je     13b3 <main+0x203>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1090 <execvp@plt>
jmp    13c3 <main+0x213>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   10d0 <execv@plt>
lea    0xc75(%rip),%rdi
call   1070 <perror@plt>
mov    0x2bfa(%rip),%rax
mov    (%rax),%rax
mov    0x2bf8(%rip),%rcx
cmp    (%rcx),%rax
jne    13f8 <main+0x248>
mov    $0x1,%edi
call   10c0 <sleep@plt>
jmp    1402 <main+0x252>
mov    $0x7f,%edi
call   10b0 <exit@plt>
jmp    1407 <main+0x257>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    138a <main+0x1da>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%r15d
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
call   1090 <sysconf@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,%r14
mov    $0x63,%eax
test   %r14,%r14
jne    120c <main+0x4c>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,0xc(%rsp)
mov    (%rbx),%rdi
test   %rdi,%rdi
je     124b <main+0x8b>
xor    %ebp,%ebp
lea    0xddf(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1272 <main+0xb2>
mov    0x8(%rbx,%rbp,8),%rdi
add    $0x1,%rbp
test   %rdi,%rdi
jne    1230 <main+0x70>
lea    0xdf2(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%rsi
lea    0xda2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0x1(%rbp),%rax
cmp    %r15d,%eax
jge    124b <main+0x8b>
mov    %rax,0x10(%rsp)
movl   $0x0,0x8(%rsp)
test   %ebp,%ebp
jne    12d4 <main+0x114>
mov    0xc(%rsp),%eax
test   %eax,%eax
mov    0x8(%rsp),%r15d
jle    12b9 <main+0xf9>
mov    %eax,%r12d
xor    %ebp,%ebp
jmp    12a9 <main+0xe9>
add    $0x1,%rbp
cmp    %rbp,%r12
je     12b9 <main+0xf9>
cmpb   $0x0,(%r14,%rbp,1)
jne    12a0 <main+0xe0>
mov    %ebp,%edi
call   1050 <close@plt>
jmp    12a0 <main+0xe0>
mov    0x10(%rsp),%eax
lea    (%rbx,%rax,8),%r14
mov    (%rbx,%rax,8),%rdi
mov    %r14,%rsi
test   %r15d,%r15d
jne    132a <main+0x16a>
call   10e0 <execv@plt>
jmp    132f <main+0x16f>
mov    %ebp,%r13d
xor    %r12d,%r12d
lea    0xd45(%rip),%rbp
movl   $0x0,0x8(%rsp)
jmp    1309 <main+0x149>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rbx,%r12,8),%rdi
call   10b0 <atoi@plt>
cltq
movb   $0x1,(%r14,%rax,1)
mov    %r15,%r12
cmp    %r15,%r13
je     128c <main+0xcc>
lea    0x1(%r12),%r15
mov    0x8(%rbx,%r12,8),%rdi
mov    %rbp,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    12f0 <main+0x130>
movl   $0x1,0x8(%rsp)
jmp    1301 <main+0x141>
call   10a0 <execvp@plt>
lea    0xd01(%rip),%rdi
call   1080 <perror@plt>
mov    0x2c8e(%rip),%rbx
mov    (%rbx),%rax
mov    0x2c8c(%rip),%rbp
cmp    0x0(%rbp),%rax
jne    1443 <main+0x283>
mov    $0x1,%edi
call   10d0 <sleep@plt>
mov    (%r14),%rdi
mov    %r14,%rsi
test   %r15d,%r15d
jne    1372 <main+0x1b2>
call   10e0 <execv@plt>
jmp    1377 <main+0x1b7>
call   10a0 <execvp@plt>
lea    0xcb9(%rip),%rdi
call   1080 <perror@plt>
mov    (%rbx),%rax
cmp    0x0(%rbp),%rax
jne    1443 <main+0x283>
mov    $0x1,%edi
call   10d0 <sleep@plt>
mov    (%r14),%rdi
mov    %r14,%rsi
test   %r15d,%r15d
jne    13ac <main+0x1ec>
call   10e0 <execv@plt>
jmp    13b1 <main+0x1f1>
call   10a0 <execvp@plt>
lea    0xc7f(%rip),%rdi
call   1080 <perror@plt>
mov    (%rbx),%rax
cmp    0x0(%rbp),%rax
jne    1443 <main+0x283>
mov    $0x1,%edi
call   10d0 <sleep@plt>
mov    (%r14),%rdi
mov    %r14,%rsi
test   %r15d,%r15d
jne    13e2 <main+0x222>
call   10e0 <execv@plt>
jmp    13e7 <main+0x227>
call   10a0 <execvp@plt>
lea    0xc49(%rip),%rdi
call   1080 <perror@plt>
mov    (%rbx),%rax
cmp    0x0(%rbp),%rax
jne    1443 <main+0x283>
mov    $0x1,%edi
call   10d0 <sleep@plt>
mov    (%r14),%rdi
mov    %r14,%rsi
test   %r15d,%r15d
jne    1418 <main+0x258>
call   10e0 <execv@plt>
jmp    141d <main+0x25d>
call   10a0 <execvp@plt>
lea    0xc13(%rip),%rdi
call   1080 <perror@plt>
mov    (%rbx),%rax
cmp    0x0(%rbp),%rax
jne    1443 <main+0x283>
mov    $0x1,%edi
call   10d0 <sleep@plt>
xor    %eax,%eax
jmp    11fd <main+0x3d>
mov    $0x7f,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@_SC_OPEN_MAX = global i32 0
@.str = [3 x i8] c"--\00"
@.str.1 = [8 x i8] c"Usage:\0A\00"
@.str.2 = [35 x i8] c" %s fd0 .. fdN -- argv0 .. argvN\0A\00"
@.str.3 = [17 x i8] c"--exec-with-path\00"
@.str.4 = [13 x i8] c"Unix error: \00"
@errno = global i64 0
@ETXTBSY = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
%13 = load i32, i32* @_SC_OPEN_MAX
%14 = call i32 @sysconf(i32 %13)
store i32 %14, i32* %8
%15 = load i32, i32* %8
%16 = call i8* @calloc(i32 %15, i32 1)
store i8* %16, i8** %10
%17 = load i8*, i8** %10
%18 = icmp ne i8* %17, null
br i1 %18, label %20, label %19
19: ; preds = %2
store i32 99, i32* %3
br label %145
20: ; preds = %2
store i32 -1, i32* %7
store i32 0, i32* %6
br label %21
21: ; preds = %39, %20
%22 = load i8**, i8*** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %42
28: ; preds = %21
%29 = load i8**, i8*** %5
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %28
%37 = load i32, i32* %6
store i32 %37, i32* %7
br label %42
38: ; preds = %28
br label %39
39: ; preds = %38
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %21
42: ; preds = %36, %21
%43 = load i32, i32* %7
%44 = icmp eq i32 %43, -1
br i1 %44, label %50, label %45
45: ; preds = %42
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
%48 = load i32, i32* %4
%49 = icmp sge i32 %47, %48
br i1 %49, label %50, label %57
50: ; preds = %45, %42
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 0
%54 = load i8*, i8** %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %54)
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %45
store i32 0, i32* %6
br label %58
58: ; preds = %85, %57
%59 = load i32, i32* %6
%60 = load i32, i32* %7
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %88
62: ; preds = %58
%63 = load i8**, i8*** %5
%64 = load i32, i32* %6
%65 = add nsw i32 1, %64
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %63, i64 %66
%68 = load i8*, i8** %67
%69 = call i64 @strcmp(i8* %68, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %62
store i32 1, i32* %11
br label %84
72: ; preds = %62
%73 = load i8**, i8*** %5
%74 = load i32, i32* %6
%75 = add nsw i32 1, %74
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8*, i8** %73, i64 %76
%78 = load i8*, i8** %77
%79 = call i32 @atoi(i8* %78)
store i32 %79, i32* %12
%80 = load i8*, i8** %10
%81 = load i32, i32* %12
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %80, i64 %82
store i8 1, i8* %83
br label %84
84: ; preds = %72, %71
br label %85
85: ; preds = %84
%86 = load i32, i32* %6
%87 = add nsw i32 %86, 1
store i32 %87, i32* %6
br label %58
88: ; preds = %58
store i32 0, i32* %6
br label %89
89: ; preds = %104, %88
%90 = load i32, i32* %6
%91 = load i32, i32* %8
%92 = icmp slt i32 %90, %91
br i1 %92, label %93, label %107
93: ; preds = %89
%94 = load i8*, i8** %10
%95 = load i32, i32* %6
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %94, i64 %96
%98 = load i8, i8* %97
%99 = icmp ne i8 %98, 0
br i1 %99, label %103, label %100
100: ; preds = %93
%101 = load i32, i32* %6
%102 = call i32 @close(i32 %101)
br label %103
103: ; preds = %100, %93
br label %104
104: ; preds = %103
%105 = load i32, i32* %6
%106 = add nsw i32 %105, 1
store i32 %106, i32* %6
br label %89
107: ; preds = %89
%108 = load i32, i32* %7
%109 = add nsw i32 %108, 1
%110 = load i8**, i8*** %5
%111 = sext i32 %109 to i64
%112 = getelementptr inbounds i8*, i8** %110, i64 %111
store i8** %112, i8*** %5
store i32 5, i32* %9
br label %113
113: ; preds = %141, %107
%114 = load i32, i32* %9
%115 = icmp sgt i32 %114, 0
br i1 %115, label %116, label %144
116: ; preds = %113
%117 = load i32, i32* %11
%118 = icmp ne i32 %117, 0
br i1 %118, label %119, label %125
119: ; preds = %116
%120 = load i8**, i8*** %5
%121 = getelementptr inbounds i8*, i8** %120, i64 0
%122 = load i8*, i8** %121
%123 = load i8**, i8*** %5
%124 = call i32 @execvp(i8* %122, i8** %123)
br label %131
125: ; preds = %116
%126 = load i8**, i8*** %5
%127 = getelementptr inbounds i8*, i8** %126, i64 0
%128 = load i8*, i8** %127
%129 = load i8**, i8*** %5
%130 = call i32 @execv(i8* %128, i8** %129)
br label %131
131: ; preds = %125, %119
%132 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%133 = load i64, i64* @errno
%134 = load i64, i64* @ETXTBSY
%135 = icmp eq i64 %133, %134
br i1 %135, label %136, label %138
136: ; preds = %131
%137 = call i32 @sleep(i32 1)
br label %140
138: ; preds = %131
%139 = call i32 @exit(i32 127)
unreachable
140: ; preds = %136
br label %141
141: ; preds = %140
%142 = load i32, i32* %9
%143 = add nsw i32 %142, -1
store i32 %143, i32* %9
br label %113
144: ; preds = %113
store i32 0, i32* %3
br label %145
145: ; preds = %144, %19
%146 = load i32, i32* %3
ret i32 %146
}

LLVM IR (-O2):
@_SC_OPEN_MAX = global i32 0
@.str = [3 x i8] c"--\00"
@.str.2 = [35 x i8] c" %s fd0 .. fdN -- argv0 .. argvN\0A\00"
@.str.3 = [17 x i8] c"--exec-with-path\00"
@.str.4 = [13 x i8] c"Unix error: \00"
@errno = global i64 0
@ETXTBSY = global i64 0
@str = [7 x i8] c"Usage:\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i32, i32* @_SC_OPEN_MAX
%4 = tail call i32 @sysconf(i32 %3)
%5 = tail call i8* @calloc(i32 %4, i32 1)
%6 = icmp eq i8* %5, null
br i1 %6, label %131, label %7
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = icmp eq i8* %8, null
br i1 %9, label %28, label %10
10: ; preds = %7, %15
%11 = phi i64 [ %16, %15 ], [ 0, %7 ]
%12 = phi i8* [ %18, %15 ], [ %8, %7 ]
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = add nuw i64 %11, 1
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = icmp eq i8* %18, null
br i1 %19, label %28, label %10
20: ; preds = %10
%21 = trunc i64 %11 to i32
%22 = add nuw nsw i32 %21, 1
%23 = icmp slt i32 %22, %0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = icmp eq i32 %21, 0
br i1 %25, label %33, label %26
26: ; preds = %24
%27 = and i64 %11, 4294967295
br label %38
28: ; preds = %15, %7, %20
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%30 = load i8*, i8** %1
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = tail call i32 @exit(i32 1)
unreachable
33: ; preds = %51, %24
%34 = phi i32 [ 0, %24 ], [ %52, %51 ]
%35 = icmp sgt i32 %4, 0
br i1 %35, label %36, label %65
36: ; preds = %33
%37 = zext i32 %4 to i64
br label %54
38: ; preds = %26, %51
%39 = phi i64 [ 0, %26 ], [ %41, %51 ]
%40 = phi i32 [ 0, %26 ], [ %52, %51 ]
%41 = add nuw nsw i64 %39, 1
%42 = getelementptr inbounds i8*, i8** %1, i64 %41
%43 = load i8*, i8** %42
%44 = tail call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %51, label %46
46: ; preds = %38
%47 = load i8*, i8** %42
%48 = tail call i32 @atoi(i8* %47)
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %5, i64 %49
store i8 1, i8* %50
br label %51
51: ; preds = %38, %46
%52 = phi i32 [ %40, %46 ], [ 1, %38 ]
%53 = icmp eq i64 %41, %27
br i1 %53, label %33, label %38
54: ; preds = %36, %62
%55 = phi i64 [ 0, %36 ], [ %63, %62 ]
%56 = getelementptr inbounds i8, i8* %5, i64 %55
%57 = load i8, i8* %56
%58 = icmp eq i8 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %54
%60 = trunc i64 %55 to i32
%61 = tail call i32 @close(i32 %60)
br label %62
62: ; preds = %54, %59
%63 = add nuw nsw i64 %55, 1
%64 = icmp eq i64 %63, %37
br i1 %64, label %65, label %54
65: ; preds = %62, %33
%66 = zext i32 %22 to i64
%67 = getelementptr inbounds i8*, i8** %1, i64 %66
%68 = icmp eq i32 %34, 0
%69 = load i8*, i8** %67
br i1 %68, label %72, label %70
70: ; preds = %65
%71 = tail call i32 @execvp(i8* %69, i8** %67)
br label %74
72: ; preds = %65
%73 = tail call i32 @execv(i8* %69, i8** %67)
br label %74
74: ; preds = %72, %70
%75 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%76 = load i64, i64* @errno
%77 = load i64, i64* @ETXTBSY
%78 = icmp eq i64 %76, %77
br i1 %78, label %79, label %129
79: ; preds = %74
%80 = tail call i32 @sleep(i32 1)
%81 = load i8*, i8** %67
br i1 %68, label %84, label %82
82: ; preds = %79
%83 = tail call i32 @execvp(i8* %81, i8** %67)
br label %86
84: ; preds = %79
%85 = tail call i32 @execv(i8* %81, i8** %67)
br label %86
86: ; preds = %84, %82
%87 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%88 = load i64, i64* @errno
%89 = load i64, i64* @ETXTBSY
%90 = icmp eq i64 %88, %89
br i1 %90, label %91, label %129
91: ; preds = %86
%92 = tail call i32 @sleep(i32 1)
%93 = load i8*, i8** %67
br i1 %68, label %96, label %94
94: ; preds = %91
%95 = tail call i32 @execvp(i8* %93, i8** %67)
br label %98
96: ; preds = %91
%97 = tail call i32 @execv(i8* %93, i8** %67)
br label %98
98: ; preds = %96, %94
%99 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%100 = load i64, i64* @errno
%101 = load i64, i64* @ETXTBSY
%102 = icmp eq i64 %100, %101
br i1 %102, label %103, label %129
103: ; preds = %98
%104 = tail call i32 @sleep(i32 1)
%105 = load i8*, i8** %67
br i1 %68, label %108, label %106
106: ; preds = %103
%107 = tail call i32 @execvp(i8* %105, i8** %67)
br label %110
108: ; preds = %103
%109 = tail call i32 @execv(i8* %105, i8** %67)
br label %110
110: ; preds = %108, %106
%111 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%112 = load i64, i64* @errno
%113 = load i64, i64* @ETXTBSY
%114 = icmp eq i64 %112, %113
br i1 %114, label %115, label %129
115: ; preds = %110
%116 = tail call i32 @sleep(i32 1)
%117 = load i8*, i8** %67
br i1 %68, label %120, label %118
118: ; preds = %115
%119 = tail call i32 @execvp(i8* %117, i8** %67)
br label %122
120: ; preds = %115
%121 = tail call i32 @execv(i8* %117, i8** %67)
br label %122
122: ; preds = %120, %118
%123 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%124 = load i64, i64* @errno
%125 = load i64, i64* @ETXTBSY
%126 = icmp eq i64 %124, %125
br i1 %126, label %127, label %129
127: ; preds = %122
%128 = tail call i32 @sleep(i32 1)
br label %131
129: ; preds = %122, %110, %98, %86, %74
%130 = tail call i32 @exit(i32 127)
unreachable
131: ; preds = %127, %2
%132 = phi i32 [ 99, %2 ], [ 0, %127 ]
ret i32 %132
}