#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ conf_fakeenv(char *);
int execvp(char *, char **);
char *find_mypath();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
char *getenv(char *);
void *malloc(int);
int /*<<< orphan*/ memmove(char **, char **, int);
int /*<<< orphan*/ printf(char *, int, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char const *);
int strlen(char const *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  char *exebuf = find_mypath();
  char *fcr_base, *wrapbin;
  fcr_base = getenv("FAKECHROOT_BASE");
  if (fcr_base == NULL) {
    conf_fakeenv(exebuf);
    fcr_base = getenv("FAKECHROOT_BASE");
    assert(fcr_base != NULL);
  }
  if (strncmp(exebuf, fcr_base, strlen(fcr_base)) != 0) {
    fprintf(stderr, "wrap: Not within FAKECHROOT_BASE -- aborting.\n");
    return 1;
  }
  const char *my_abs = exebuf + strlen(fcr_base);
  wrapbin = malloc(strlen(fcr_base) + strlen("/wrap") + strlen(my_abs) + 1);
  assert(wrapbin != NULL);
  wrapbin[0] = '\0';
  strcat(wrapbin, fcr_base);
  strcat(wrapbin, "/wrap");
  strcat(wrapbin, my_abs);
  free(exebuf);
  exebuf = NULL;
  char *fakeld = malloc(strlen(fcr_base) + strlen("/lib/ld-linux.so.2") + 1);
  assert(fakeld != NULL);
  fakeld[0] = '\0';
  strcat(fakeld, fcr_base);
  strcat(fakeld, "/lib/ld-linux.so.2");
  char **new_args = malloc((argc + 2) * sizeof(char *));
  new_args[0] = "ld-linux.so.2";
  new_args[1] = wrapbin;
  memmove(new_args + 2, argv + 1, (argc - 1) * sizeof(char *));
  new_args[argc + 1] = NULL;
  if (getenv("WRAP_DEBUG") != NULL) {
    fprintf(stderr, "wrap executing \"%s\" with args:\n", fakeld);
    int i;
    for (i = 0; new_args[i] != NULL; i++)
      printf("\t%i: \"%s\"\n", i, new_args[i]);
  }
  if (execvp(fakeld, new_args) == -1) {
    fprintf(stderr, "wrap failed to execute program :/\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10b0 <find_mypath@plt>
mov    %rax,-0x18(%rbp)
lea    0xe08(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1237 <main+0x67>
mov    -0x18(%rbp),%rdi
call   10f0 <conf_fakeenv@plt>
lea    0xde4(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
je     128c <main+0xbc>
mov    0x2d70(%rip),%rax
mov    (%rax),%edi
lea    0xd97(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14be <main+0x2ee>
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x70(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x64(%rbp)
lea    0xd7f(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x64(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x60(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x60(%rbp),%edi
add    %eax,%edi
add    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10e0 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0xd25(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   10e0 <strcat@plt>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x5c(%rbp)
lea    0xcf5(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x5c(%rbp),%edi
add    %eax,%edi
add    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10e0 <strcat@plt>
mov    -0x38(%rbp),%rdi
lea    0xcae(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
lea    0xc8c(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rcx
mov    -0x40(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x40(%rbp),%rdi
add    $0x10,%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
call   10c0 <memmove@plt>
mov    -0x40(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
lea    0xc4c(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     147e <main+0x2ae>
mov    0x2bbe(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
lea    0xc34(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1479 <main+0x2a9>
mov    -0x44(%rbp),%esi
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc1d(%rip),%rdi
call   1070 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    143d <main+0x26d>
jmp    147e <main+0x2ae>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10d0 <execvp@plt>
cmp    $0xffffffff,%eax
jne    14b7 <main+0x2e7>
mov    0x2b45(%rip),%rax
mov    (%rax),%edi
lea    0xbea(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14be <main+0x2ee>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%r14d
xor    %eax,%eax
call   10b0 <find_mypath@plt>
mov    %rax,%r12
lea    0xe0e(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1224 <main+0x54>
mov    %r12,%rdi
call   10f0 <conf_fakeenv@plt>
lea    0xdf2(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1080 <assert@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     125f <main+0x8f>
lea    0xdcb(%rip),%rsi
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%eax
jmp    13ec <main+0x21c>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cltq
mov    %r12,%rbp
add    %rax,%rbp
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %eax,%r13d
lea    0xdbe(%rip),%rdi
call   1060 <strlen@plt>
mov    %r14,(%rsp)
mov    %eax,%r14d
mov    %rbp,%rdi
call   1060 <strlen@plt>
add    %r13d,%r14d
lea    (%rax,%r14,1),%edi
add    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,%r13
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1080 <assert@plt>
movb   $0x0,0x0(%r13)
mov    %r13,%rdi
mov    %rbx,%rsi
call   10e0 <strcat@plt>
mov    %r13,%rdi
lea    0xd70(%rip),%rsi
call   10e0 <strcat@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
call   10e0 <strcat@plt>
mov    %r12,%rdi
call   1040 <free@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebp
lea    0xd4d(%rip),%r14
mov    %r14,%rdi
call   1060 <strlen@plt>
lea    (%rax,%rbp,1),%edi
add    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,%r12
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1080 <assert@plt>
movb   $0x0,(%r12)
mov    %r12,%rdi
mov    %rbx,%rsi
call   10e0 <strcat@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   10e0 <strcat@plt>
mov    (%rsp),%rbp
lea    0x10(,%rbp,8),%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
lea    0xcf9(%rip),%rax
mov    %rax,(%rbx)
mov    %r13,0x8(%rbx)
lea    0x10(%rbx),%rdi
add    $0x8,%r15
lea    -0x8(,%rbp,8),%edx
mov    %r15,%rsi
call   10c0 <memmove@plt>
movslq %ebp,%rax
movq   $0x0,0x8(%rbx,%rax,8)
lea    0xcd6(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     13d8 <main+0x208>
mov    0x2c4d(%rip),%rax
mov    (%rax),%edi
lea    0xcc7(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%rdx
test   %rdx,%rdx
je     13d8 <main+0x208>
xor    %ebp,%ebp
lea    0xccc(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
call   1070 <printf@plt>
mov    0x8(%rbx,%rbp,8),%rdx
add    $0x1,%rbp
test   %rdx,%rdx
jne    13c0 <main+0x1f0>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10d0 <execvp@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     13fb <main+0x22b>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc8c(%rip),%rsi
jmp    1245 <main+0x75>

LLVM IR (-O0):
@.str = [16 x i8] c"FAKECHROOT_BASE\00"
@stderr = global i32 0
@.str.1 = [47 x i8] c"wrap: Not within FAKECHROOT_BASE -- aborting.\0A\00"
@.str.2 = [6 x i8] c"/wrap\00"
@.str.3 = [19 x i8] c"/lib/ld-linux.so.2\00"
@.str.4 = [14 x i8] c"ld-linux.so.2\00"
@.str.5 = [11 x i8] c"WRAP_DEBUG\00"
@.str.6 = [32 x i8] c"wrap executing \22%s\22 with args:\0A\00"
@.str.7 = [11 x i8] c"\09%i: \22%s\22\0A\00"
@.str.8 = [35 x i8] c"wrap failed to execute program :/\0A\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 i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8**
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i8* (...) @find_mypath()
store i8* %13, i8** %6
%14 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i8* %14, i8** %7
%15 = load i8*, i8** %7
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %25
17: ; preds = %2
%18 = load i8*, i8** %6
%19 = call i32 @conf_fakeenv(i8* %18)
%20 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i8* %20, i8** %7
%21 = load i8*, i8** %7
%22 = icmp ne i8* %21, null
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
br label %25
25: ; preds = %17, %2
%26 = load i8*, i8** %6
%27 = load i8*, i8** %7
%28 = load i8*, i8** %7
%29 = call i32 @strlen(i8* %28)
%30 = call i64 @strncmp(i8* %26, i8* %27, i32 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %25
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %144
35: ; preds = %25
%36 = load i8*, i8** %6
%37 = load i8*, i8** %7
%38 = call i32 @strlen(i8* %37)
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %36, i64 %39
store i8* %40, i8** %9
%41 = load i8*, i8** %7
%42 = call i32 @strlen(i8* %41)
%43 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%44 = add nsw i32 %42, %43
%45 = load i8*, i8** %9
%46 = call i32 @strlen(i8* %45)
%47 = add nsw i32 %44, %46
%48 = add nsw i32 %47, 1
%49 = call i8* @malloc(i32 %48)
store i8* %49, i8** %8
%50 = load i8*, i8** %8
%51 = icmp ne i8* %50, null
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = load i8*, i8** %8
%55 = getelementptr inbounds i8, i8* %54, i64 0
store i8 0, i8* %55
%56 = load i8*, i8** %8
%57 = load i8*, i8** %7
%58 = call i32 @strcat(i8* %56, i8* %57)
%59 = load i8*, i8** %8
%60 = call i32 @strcat(i8* %59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%61 = load i8*, i8** %8
%62 = load i8*, i8** %9
%63 = call i32 @strcat(i8* %61, i8* %62)
%64 = load i8*, i8** %6
%65 = call i32 @free(i8* %64)
store i8* null, i8** %6
%66 = load i8*, i8** %7
%67 = call i32 @strlen(i8* %66)
%68 = call i32 @strlen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%69 = add nsw i32 %67, %68
%70 = add nsw i32 %69, 1
%71 = call i8* @malloc(i32 %70)
store i8* %71, i8** %10
%72 = load i8*, i8** %10
%73 = icmp ne i8* %72, null
%74 = zext i1 %73 to i32
%75 = call i32 @assert(i32 %74)
%76 = load i8*, i8** %10
%77 = getelementptr inbounds i8, i8* %76, i64 0
store i8 0, i8* %77
%78 = load i8*, i8** %10
%79 = load i8*, i8** %7
%80 = call i32 @strcat(i8* %78, i8* %79)
%81 = load i8*, i8** %10
%82 = call i32 @strcat(i8* %81, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%83 = load i32, i32* %4
%84 = add nsw i32 %83, 2
%85 = sext i32 %84 to i64
%86 = mul i64 %85, 8
%87 = trunc i64 %86 to i32
%88 = call i8* @malloc(i32 %87)
%89 = bitcast i8* %88 to i8**
store i8** %89, i8*** %11
%90 = load i8**, i8*** %11
%91 = getelementptr inbounds i8*, i8** %90, i64 0
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %91
%92 = load i8*, i8** %8
%93 = load i8**, i8*** %11
%94 = getelementptr inbounds i8*, i8** %93, i64 1
store i8* %92, i8** %94
%95 = load i8**, i8*** %11
%96 = getelementptr inbounds i8*, i8** %95, i64 2
%97 = load i8**, i8*** %5
%98 = getelementptr inbounds i8*, i8** %97, i64 1
%99 = load i32, i32* %4
%100 = sub nsw i32 %99, 1
%101 = sext i32 %100 to i64
%102 = mul i64 %101, 8
%103 = trunc i64 %102 to i32
%104 = call i32 @memmove(i8** %96, i8** %98, i32 %103)
%105 = load i8**, i8*** %11
%106 = load i32, i32* %4
%107 = add nsw i32 %106, 1
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8*, i8** %105, i64 %108
store i8* null, i8** %109
%110 = call i8* @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%111 = icmp ne i8* %110, null
br i1 %111, label %112, label %135
112: ; preds = %35
%113 = load i32, i32* @stderr
%114 = load i8*, i8** %10
%115 = call i32 (i32, i8*, ...) @fprintf(i32 %113, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %114)
store i32 0, i32* %12
br label %116
116: ; preds = %131, %112
%117 = load i8**, i8*** %11
%118 = load i32, i32* %12
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i8*, i8** %117, i64 %119
%121 = load i8*, i8** %120
%122 = icmp ne i8* %121, null
br i1 %122, label %123, label %134
123: ; preds = %116
%124 = load i32, i32* %12
%125 = load i8**, i8*** %11
%126 = load i32, i32* %12
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i8*, i8** %125, i64 %127
%129 = load i8*, i8** %128
%130 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %124, i8* %129)
br label %131
131: ; preds = %123
%132 = load i32, i32* %12
%133 = add nsw i32 %132, 1
store i32 %133, i32* %12
br label %116
134: ; preds = %116
br label %135
135: ; preds = %134, %35
%136 = load i8*, i8** %10
%137 = load i8**, i8*** %11
%138 = call i32 @execvp(i8* %136, i8** %137)
%139 = icmp eq i32 %138, -1
br i1 %139, label %140, label %143
140: ; preds = %135
%141 = load i32, i32* @stderr
%142 = call i32 (i32, i8*, ...) @fprintf(i32 %141, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %144
143: ; preds = %135
store i32 0, i32* %3
br label %144
144: ; preds = %143, %140, %32
%145 = load i32, i32* %3
ret i32 %145
}

LLVM IR (-O2):
@.str = [16 x i8] c"FAKECHROOT_BASE\00"
@stderr = global i32 0
@.str.1 = [47 x i8] c"wrap: Not within FAKECHROOT_BASE -- aborting.\0A\00"
@.str.2 = [6 x i8] c"/wrap\00"
@.str.3 = [19 x i8] c"/lib/ld-linux.so.2\00"
@.str.4 = [14 x i8] c"ld-linux.so.2\00"
@.str.5 = [11 x i8] c"WRAP_DEBUG\00"
@.str.6 = [32 x i8] c"wrap executing \22%s\22 with args:\0A\00"
@.str.7 = [11 x i8] c"\09%i: \22%s\22\0A\00"
@.str.8 = [35 x i8] c"wrap failed to execute program :/\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i8* (...) @find_mypath()
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = tail call i32 @conf_fakeenv(i8* %3)
%8 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i8* %8, null
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
br label %12
12: ; preds = %6, %2
%13 = phi i8* [ %8, %6 ], [ %4, %2 ]
%14 = tail call i32 @strlen(i8* %13)
%15 = tail call i64 @strncmp(i8* %3, i8* %13, i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %76
17: ; preds = %12
%18 = tail call i32 @strlen(i8* %13)
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %3, i64 %19
%21 = tail call i32 @strlen(i8* %13)
%22 = tail call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%23 = tail call i32 @strlen(i8* %20)
%24 = add i32 %21, 1
%25 = add i32 %24, %22
%26 = add i32 %25, %23
%27 = tail call i8* @malloc(i32 %26)
%28 = icmp ne i8* %27, null
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
store i8 0, i8* %27
%31 = tail call i32 @strcat(i8* %27, i8* %13)
%32 = tail call i32 @strcat(i8* %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%33 = tail call i32 @strcat(i8* %27, i8* %20)
%34 = tail call i32 @free(i8* %3)
%35 = tail call i32 @strlen(i8* %13)
%36 = tail call i32 @strlen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%37 = add i32 %35, 1
%38 = add i32 %37, %36
%39 = tail call i8* @malloc(i32 %38)
%40 = icmp ne i8* %39, null
%41 = zext i1 %40 to i32
%42 = tail call i32 @assert(i32 %41)
store i8 0, i8* %39
%43 = tail call i32 @strcat(i8* %39, i8* %13)
%44 = tail call i32 @strcat(i8* %39, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%45 = shl i32 %0, 3
%46 = add i32 %45, 16
%47 = tail call i8* @malloc(i32 %46)
%48 = bitcast i8* %47 to i8**
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %48
%49 = getelementptr inbounds i8*, i8** %48, i64 1
store i8* %27, i8** %49
%50 = getelementptr inbounds i8*, i8** %48, i64 2
%51 = getelementptr inbounds i8*, i8** %1, i64 1
%52 = add i32 %45, -8
%53 = tail call i32 @memmove(i8** %50, i8** %51, i32 %52)
%54 = add nsw i32 %0, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %48, i64 %55
store i8* null, i8** %56
%57 = tail call i8* @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%58 = icmp eq i8* %57, null
br i1 %58, label %73, label %59
59: ; preds = %17
%60 = load i32, i32* @stderr
%61 = tail call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %39)
%62 = load i8*, i8** %48
%63 = icmp eq i8* %62, null
br i1 %63, label %73, label %64
64: ; preds = %59, %64
%65 = phi i64 [ %69, %64 ], [ 0, %59 ]
%66 = phi i8* [ %71, %64 ], [ %62, %59 ]
%67 = trunc i64 %65 to i32
%68 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %67, i8* %66)
%69 = add nuw i64 %65, 1
%70 = getelementptr inbounds i8*, i8** %48, i64 %69
%71 = load i8*, i8** %70
%72 = icmp eq i8* %71, null
br i1 %72, label %73, label %64
73: ; preds = %64, %59, %17
%74 = tail call i32 @execvp(i8* %39, i8** %48)
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %80
76: ; preds = %73, %12
%77 = phi i8* [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), %12 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), %73 ]
%78 = load i32, i32* @stderr
%79 = tail call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* %77)
br label %80
80: ; preds = %76, %73
%81 = phi i32 [ 0, %73 ], [ 1, %76 ]
ret i32 %81
}