#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ close(int);
char *dirname(char *);
int /*<<< orphan*/ dup2(int, int /*<<< orphan*/);
scalar_t__ errno;
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ memset(char **, int, int);
int /*<<< orphan*/ perror(char *);
int pipe(int *);
int read(int /*<<< orphan*/, char *, int);
int readlink(char *, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  int pipeA[2], pipeB[2];
  if (pipe(pipeA) == -1 || pipe(pipeB) == -1) {
    perror("Pipe failed");
    exit(1);
  }
  char *dname;
  char loc[1024];
  char pathJar[1024];
  char wrapCmd[1024];
  ssize_t lsize = readlink("/proc/self/exe", loc, 1024);
  if (lsize == -1) {
    perror("Cannot determine correct path");
    exit(2);
  }
  loc[lsize] = 0;
  fprintf(stderr, "Current executable: '%s'", loc);
  dname = dirname(loc);
  fprintf(stderr, " dir: '%s'\n", dname);
  strcpy(pathJar, dname);
  strcat(pathJar, "/ZIPStream-1.0-SNAPSHOT.jar");
  strcpy(wrapCmd, "/bin/bash ");
  strcat(wrapCmd, dname);
  strcat(wrapCmd, "/wrapper.sh <<INPUTAPK>>");
  fprintf(stderr, "Jar: '%s' cmd: '%s'\n\n", pathJar, wrapCmd);
  if (fork() == 0) {
    char *jargs[50];
    unsigned int carg = 0;
    unsigned int i;
    memset(jargs, 0x0, sizeof(char *) * 50);
    close(0);
    dup2(pipeA[0], 0);
    close(pipeA[0]);
    close(pipeA[1]);
    close(pipeB[0]);
    close(pipeB[1]);
    jargs[carg++] = "/bin/java";
    jargs[carg++] = "-cp";
    jargs[carg++] = pathJar;
    jargs[carg++] = "cz.muni.fi.xklinec.zipstream.Mallory";
    jargs[carg++] = "-f";
    jargs[carg++] = "1";
    jargs[carg++] = "-e";
    jargs[carg++] = ".*gif$";
    jargs[carg++] = "--padd-extra";
    jargs[carg++] = "512000";
    jargs[carg++] = "--recompute-crc32";
    jargs[carg++] = "--create-temp-dir";
    jargs[carg++] = "--omit-missing";
    if ((1) && argc > 1) {
      jargs[carg++] = "--slow-down-stream";
      jargs[carg++] = "--apk-size", jargs[carg++] = argv[1];
    }
    jargs[carg++] = "--cmd";
    jargs[carg++] = wrapCmd;
    jargs[carg++] = NULL;
    fprintf(stderr, "Arguments for java application: \n<ARGUMENTS>\n");
    for (i = 0; i < carg - 1; i++) {
      fprintf(stderr, " %s", jargs[i]);
    }
    fprintf(stderr, "\n</ARGUMENTS>\n\n");
    errno = 0;
    execvp("/bin/java", jargs);
    if (errno) {
      perror("execvp of ./p failed");
    }
    exit(1);
  } else {
    close(pipeA[0]);
    close(pipeB[0]);
    close(pipeB[1]);
    int readb = 0;
    char reading_buf[128];
    while ((readb = read(0, reading_buf, 128)) > 0) {
      write(pipeA[1], reading_buf, readb);
    }
    close(pipeA[0]);
    close(pipeA[1]);
    close(pipeB[0]);
    close(pipeB[1]);
    wait(NULL);
    exit(0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   10a0 <pipe@plt>
cmp    $0xffffffff,%eax
je     123d <main+0x3d>
lea    -0x20(%rbp),%rdi
call   10a0 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1253 <main+0x53>
lea    0xdbc(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    -0x430(%rbp),%rsi
lea    0xdab(%rip),%rdi
mov    $0x400,%edx
call   1040 <readlink@plt>
mov    %eax,-0xc34(%rbp)
cmpl   $0xffffffff,-0xc34(%rbp)
jne    1294 <main+0x94>
lea    0xd96(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
movslq -0xc34(%rbp),%rax
movb   $0x0,-0x430(%rbp,%rax,1)
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
lea    -0x430(%rbp),%rdx
lea    0xd7f(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    -0x430(%rbp),%rdi
call   1070 <dirname@plt>
mov    %rax,-0x28(%rbp)
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xd6d(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    -0x830(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x830(%rbp),%rdi
lea    0xd54(%rip),%rsi
call   10f0 <strcat@plt>
lea    -0xc30(%rbp),%rdi
lea    0xd5d(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xc30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10f0 <strcat@plt>
lea    -0xc30(%rbp),%rdi
lea    0xd45(%rip),%rsi
call   10f0 <strcat@plt>
mov    0x2c94(%rip),%rax
mov    (%rax),%edi
lea    -0x830(%rbp),%rdx
lea    -0xc30(%rbp),%rcx
lea    0xd3b(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x0,%al
call   1120 <fork@plt>
cmp    $0x0,%rax
jne    1727 <main+0x527>
movl   $0x0,-0xdd4(%rbp)
lea    -0xdd0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1080 <memset@plt>
xor    %edi,%edi
call   1090 <close@plt>
mov    -0x18(%rbp),%edi
xor    %esi,%esi
call   1060 <dup2@plt>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    -0x20(%rbp),%edi
call   1090 <close@plt>
mov    -0x1c(%rbp),%edi
call   1090 <close@plt>
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xcd1(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xcb9(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
lea    -0x830(%rbp),%rcx
mov    -0xdd4(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xdd4(%rbp)
mov    %eax,%eax
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xc79(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xc7c(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xc5d(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xc3d(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xc1e(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xc03(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xbee(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xbd3(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xbc3(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xbb3(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
cmpl   $0x1,-0x8(%rbp)
jle    15f4 <main+0x3f4>
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xb96(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xb87(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0xdd4(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xdd4(%rbp)
mov    %eax,%eax
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
lea    0xb4d(%rip),%rcx
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
lea    -0xc30(%rbp),%rcx
mov    -0xdd4(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xdd4(%rbp)
mov    %eax,%eax
mov    %rcx,-0xdd0(%rbp,%rax,8)
ff
mov    -0xdd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xdd4(%rbp)
mov    %eax,%eax
movq   $0x0,-0xdd0(%rbp,%rax,8)
mov    0x2982(%rip),%rax
mov    (%rax),%edi
lea    0xafa(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
movl   $0x0,-0xdd8(%rbp)
mov    -0xdd8(%rbp),%eax
mov    -0xdd4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jae    16c8 <main+0x4c8>
mov    0x294a(%rip),%rax
mov    (%rax),%edi
mov    -0xdd8(%rbp),%eax
mov    -0xdd0(%rbp,%rax,8),%rdx
ff
lea    0xae2(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    -0xdd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdd8(%rbp)
jmp    1678 <main+0x478>
mov    0x2911(%rip),%rax
mov    (%rax),%edi
lea    0xabb(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    0x28f2(%rip),%rax
movq   $0x0,(%rax)
lea    -0xdd0(%rbp),%rsi
lea    0x9b9(%rip),%rdi
call   10e0 <execvp@plt>
mov    0x28d1(%rip),%rax
cmpq   $0x0,(%rax)
je     171d <main+0x51d>
lea    0xa8b(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
mov    -0x20(%rbp),%edi
call   1090 <close@plt>
mov    -0x1c(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0xddc(%rbp)
lea    -0xe60(%rbp),%rsi
xor    %edi,%edi
mov    $0x80,%edx
call   10b0 <read@plt>
mov    %eax,-0xddc(%rbp)
cmp    $0x0,%eax
jle    1785 <main+0x585>
mov    -0x14(%rbp),%edi
lea    -0xe60(%rbp),%rsi
mov    -0xddc(%rbp),%edx
call   1050 <write@plt>
jmp    1749 <main+0x549>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    -0x20(%rbp),%edi
call   1090 <close@plt>
mov    -0x1c(%rbp),%edi
call   1090 <close@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1110 <wait@plt>
xor    %edi,%edi
call   1100 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xda8,%rsp
mov    %rsi,%r12
mov    %edi,%r13d
mov    %rsp,%rdi
call   10a0 <pipe@plt>
cmp    $0xffffffff,%eax
je     1233 <main+0x33>
lea    0x8(%rsp),%rdi
call   10a0 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1249 <main+0x49>
lea    0xdc6(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0xdbc(%rip),%rdi
lea    0x1a0(%rsp),%rsi
mov    $0x400,%edx
call   1040 <readlink@plt>
cmp    $0xffffffff,%eax
jne    127d <main+0x7d>
lea    0xdad(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
cltq
movb   $0x0,0x1a0(%rsp,%rax,1)
mov    0x2d52(%rip),%r14
mov    (%r14),%edi
lea    0xda1(%rip),%rsi
lea    0x1a0(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    %rbx,%rdi
call   1070 <dirname@plt>
mov    %rax,%rbx
mov    (%r14),%edi
lea    0xd93(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
lea    0x9a0(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xd7b(%rip),%rsi
mov    %r15,%rdi
call   10f0 <strcat@plt>
lea    0xd88(%rip),%rsi
lea    0x5a0(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %rbp,%rbx
call   10f0 <strcat@plt>
lea    0xd6e(%rip),%rsi
mov    %rbp,%rdi
call   10f0 <strcat@plt>
mov    (%r14),%edi
lea    0xd75(%rip),%rsi
mov    %r15,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   10c0 <fprintf@plt>
xor    %eax,%eax
call   1120 <fork@plt>
test   %rax,%rax
jne    1507 <main+0x307>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1080 <memset@plt>
xor    %edi,%edi
call   1090 <close@plt>
mov    (%rsp),%edi
xor    %esi,%esi
call   1060 <dup2@plt>
mov    (%rsp),%edi
call   1090 <close@plt>
mov    0x4(%rsp),%edi
call   1090 <close@plt>
mov    0x8(%rsp),%edi
call   1090 <close@plt>
mov    0xc(%rsp),%edi
call   1090 <close@plt>
lea    0xd22(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xd20(%rip),%rax
mov    %rax,0x18(%rsp)
mov    %r15,0x20(%rsp)
lea    0xd13(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xd2c(%rip),%rax
mov    %rax,0x30(%rsp)
lea    0xd23(%rip),%rax
mov    %rax,0x38(%rsp)
lea    0xd19(%rip),%rax
mov    %rax,0x40(%rsp)
lea    0xd10(%rip),%rax
mov    %rax,0x48(%rsp)
lea    0xd0b(%rip),%rax
mov    %rax,0x50(%rsp)
lea    0xd0c(%rip),%rax
mov    %rax,0x58(%rsp)
lea    0xd07(%rip),%rax
mov    %rax,0x60(%rsp)
lea    0xd0d(%rip),%rax
mov    %rax,0x68(%rsp)
lea    0xd13(%rip),%rax
mov    %rax,0x70(%rsp)
mov    $0xd,%ebp
cmp    $0x2,%r13d
jl     1458 <main+0x258>
lea    0xd0b(%rip),%rax
mov    %rax,0x78(%rsp)
lea    0xd12(%rip),%rax
mov    %rax,0x80(%rsp)
mov    0x8(%r12),%rax
mov    %rax,0x88(%rsp)
mov    $0x10,%ebp
mov    %ebp,%eax
lea    0xcfa(%rip),%rcx
mov    %rcx,0x10(%rsp,%rax,8)
or     $0x2,%ebp
mov    %rbx,0x18(%rsp,%rax,8)
movq   $0x0,0x10(%rsp,%rbp,8)
mov    (%r14),%edi
lea    0xce0(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
lea    0xd00(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edi
mov    0x10(%rsp,%rbx,8),%rdx
mov    %r15,%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    14a0 <main+0x2a0>
mov    (%r14),%edi
lea    0xcce(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    0x2b05(%rip),%rbx
movq   $0x0,(%rbx)
lea    0xbd3(%rip),%rdi
lea    0x10(%rsp),%rsi
call   10e0 <execvp@plt>
cmpq   $0x0,(%rbx)
je     14fd <main+0x2fd>
lea    0xcab(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    (%rsp),%edi
call   1090 <close@plt>
mov    0x8(%rsp),%edi
call   1090 <close@plt>
mov    0xc(%rsp),%edi
call   1090 <close@plt>
lea    0x10(%rsp),%rsi
xor    %edi,%edi
mov    $0x80,%edx
call   10b0 <read@plt>
test   %eax,%eax
jle    1561 <main+0x361>
lea    0x10(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <write@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x80,%edx
call   10b0 <read@plt>
test   %eax,%eax
jg     1540 <main+0x340>
mov    (%rsp),%edi
call   1090 <close@plt>
mov    0x4(%rsp),%edi
call   1090 <close@plt>
mov    0x8(%rsp),%edi
call   1090 <close@plt>
mov    0xc(%rsp),%edi
call   1090 <close@plt>
xor    %edi,%edi
call   1110 <wait@plt>
xor    %edi,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Pipe failed\00"
@.str.1 = [15 x i8] c"/proc/self/exe\00"
@.str.2 = [30 x i8] c"Cannot determine correct path\00"
@stderr = global i32 0
@.str.3 = [25 x i8] c"Current executable: '%s'\00"
@.str.4 = [12 x i8] c" dir: '%s'\0A\00"
@.str.5 = [28 x i8] c"/ZIPStream-1.0-SNAPSHOT.jar\00"
@.str.6 = [11 x i8] c"/bin/bash \00"
@.str.7 = [25 x i8] c"/wrapper.sh <<INPUTAPK>>\00"
@.str.8 = [22 x i8] c"Jar: '%s' cmd: '%s'\0A\0A\00"
@.str.9 = [10 x i8] c"/bin/java\00"
@.str.10 = [4 x i8] c"-cp\00"
@.str.11 = [37 x i8] c"cz.muni.fi.xklinec.zipstream.Mallory\00"
@.str.12 = [3 x i8] c"-f\00"
@.str.13 = [2 x i8] c"1\00"
@.str.14 = [3 x i8] c"-e\00"
@.str.15 = [7 x i8] c".*gif$\00"
@.str.16 = [13 x i8] c"--padd-extra\00"
@.str.17 = [7 x i8] c"512000\00"
@.str.18 = [18 x i8] c"--recompute-crc32\00"
@.str.19 = [18 x i8] c"--create-temp-dir\00"
@.str.20 = [15 x i8] c"--omit-missing\00"
@.str.21 = [19 x i8] c"--slow-down-stream\00"
@.str.22 = [11 x i8] c"--apk-size\00"
@.str.23 = [6 x i8] c"--cmd\00"
@.str.24 = [46 x i8] c"Arguments for java application: \0A<ARGUMENTS>\0A\00"
@.str.25 = [4 x i8] c" %s\00"
@.str.26 = [16 x i8] c"\0A</ARGUMENTS>\0A\0A\00"
@errno = global i64 0
@.str.27 = [21 x i8] c"execvp of ./p failed\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i32]
%7 = alloca [2 x i32]
%8 = alloca i8*
%9 = alloca [1024 x i8]
%10 = alloca [1024 x i8]
%11 = alloca [1024 x i8]
%12 = alloca i32
%13 = alloca [50 x i8*]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%19 = call i32 @pipe(i32* %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %25, label %21
21: ; preds = %2
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%23 = call i32 @pipe(i32* %22)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %28
25: ; preds = %21, %2
%26 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %21
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%30 = call i32 @readlink(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %29, i32 1024)
store i32 %30, i32* %12
%31 = load i32, i32* %12
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 @exit(i32 2)
unreachable
36: ; preds = %28
%37 = load i32, i32* %12
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %38
store i8 0, i8* %39
%40 = load i32, i32* @stderr
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %41)
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%44 = call i8* @dirname(i8* %43)
store i8* %44, i8** %8
%45 = load i32, i32* @stderr
%46 = load i8*, i8** %8
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %46)
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%49 = load i8*, i8** %8
%50 = call i32 @strcpy(i8* %48, i8* %49)
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%52 = call i32 @strcat(i8* %51, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%54 = call i32 @strcpy(i8* %53, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%56 = load i8*, i8** %8
%57 = call i32 @strcat(i8* %55, i8* %56)
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%59 = call i32 @strcat(i8* %58, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%60 = load i32, i32* @stderr
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i8* %61, i8* %62)
%64 = call i64 (...) @fork()
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %198
66: ; preds = %36
store i32 0, i32* %14
%67 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 0
%68 = call i32 @memset(i8** %67, i32 0, i32 400)
%69 = call i32 @close(i32 0)
%70 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%71 = load i32, i32* %70
%72 = call i32 @dup2(i32 %71, i32 0)
%73 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%74 = load i32, i32* %73
%75 = call i32 @close(i32 %74)
%76 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%77 = load i32, i32* %76
%78 = call i32 @close(i32 %77)
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%80 = load i32, i32* %79
%81 = call i32 @close(i32 %80)
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%83 = load i32, i32* %82
%84 = call i32 @close(i32 %83)
%85 = load i32, i32* %14
%86 = add i32 %85, 1
store i32 %86, i32* %14
%87 = zext i32 %85 to i64
%88 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %87
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %88
%89 = load i32, i32* %14
%90 = add i32 %89, 1
store i32 %90, i32* %14
%91 = zext i32 %89 to i64
%92 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %91
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8** %92
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%94 = load i32, i32* %14
%95 = add i32 %94, 1
store i32 %95, i32* %14
%96 = zext i32 %94 to i64
%97 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %96
store i8* %93, i8** %97
%98 = load i32, i32* %14
%99 = add i32 %98, 1
store i32 %99, i32* %14
%100 = zext i32 %98 to i64
%101 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %100
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i8** %101
%102 = load i32, i32* %14
%103 = add i32 %102, 1
store i32 %103, i32* %14
%104 = zext i32 %102 to i64
%105 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %104
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8** %105
%106 = load i32, i32* %14
%107 = add i32 %106, 1
store i32 %107, i32* %14
%108 = zext i32 %106 to i64
%109 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %108
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i8** %109
%110 = load i32, i32* %14
%111 = add i32 %110, 1
store i32 %111, i32* %14
%112 = zext i32 %110 to i64
%113 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %112
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i8** %113
%114 = load i32, i32* %14
%115 = add i32 %114, 1
store i32 %115, i32* %14
%116 = zext i32 %114 to i64
%117 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %116
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0), i8** %117
%118 = load i32, i32* %14
%119 = add i32 %118, 1
store i32 %119, i32* %14
%120 = zext i32 %118 to i64
%121 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %120
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), i8** %121
%122 = load i32, i32* %14
%123 = add i32 %122, 1
store i32 %123, i32* %14
%124 = zext i32 %122 to i64
%125 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %124
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8** %125
%126 = load i32, i32* %14
%127 = add i32 %126, 1
store i32 %127, i32* %14
%128 = zext i32 %126 to i64
%129 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %128
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i8** %129
%130 = load i32, i32* %14
%131 = add i32 %130, 1
store i32 %131, i32* %14
%132 = zext i32 %130 to i64
%133 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %132
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.19, i64 0, i64 0), i8** %133
%134 = load i32, i32* %14
%135 = add i32 %134, 1
store i32 %135, i32* %14
%136 = zext i32 %134 to i64
%137 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %136
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.20, i64 0, i64 0), i8** %137
%138 = load i32, i32* %4
%139 = icmp sgt i32 %138, 1
br i1 %139, label %140, label %156
140: ; preds = %66
%141 = load i32, i32* %14
%142 = add i32 %141, 1
store i32 %142, i32* %14
%143 = zext i32 %141 to i64
%144 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %143
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0), i8** %144
%145 = load i32, i32* %14
%146 = add i32 %145, 1
store i32 %146, i32* %14
%147 = zext i32 %145 to i64
%148 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %147
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.22, i64 0, i64 0), i8** %148
%149 = load i8**, i8*** %5
%150 = getelementptr inbounds i8*, i8** %149, i64 1
%151 = load i8*, i8** %150
%152 = load i32, i32* %14
%153 = add i32 %152, 1
store i32 %153, i32* %14
%154 = zext i32 %152 to i64
%155 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %154
store i8* %151, i8** %155
br label %156
156: ; preds = %140, %66
%157 = load i32, i32* %14
%158 = add i32 %157, 1
store i32 %158, i32* %14
%159 = zext i32 %157 to i64
%160 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %159
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0), i8** %160
%161 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%162 = load i32, i32* %14
%163 = add i32 %162, 1
store i32 %163, i32* %14
%164 = zext i32 %162 to i64
%165 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %164
store i8* %161, i8** %165
%166 = load i32, i32* %14
%167 = add i32 %166, 1
store i32 %167, i32* %14
%168 = zext i32 %166 to i64
%169 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %168
store i8* null, i8** %169
%170 = load i32, i32* @stderr
%171 = call i32 (i32, i8*, ...) @fprintf(i32 %170, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.24, i64 0, i64 0))
store i32 0, i32* %15
br label %172
172: ; preds = %184, %156
%173 = load i32, i32* %15
%174 = load i32, i32* %14
%175 = sub i32 %174, 1
%176 = icmp ult i32 %173, %175
br i1 %176, label %177, label %187
177: ; preds = %172
%178 = load i32, i32* @stderr
%179 = load i32, i32* %15
%180 = zext i32 %179 to i64
%181 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 %180
%182 = load i8*, i8** %181
%183 = call i32 (i32, i8*, ...) @fprintf(i32 %178, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i64 0, i64 0), i8* %182)
br label %184
184: ; preds = %177
%185 = load i32, i32* %15
%186 = add i32 %185, 1
store i32 %186, i32* %15
br label %172
187: ; preds = %172
%188 = load i32, i32* @stderr
%189 = call i32 (i32, i8*, ...) @fprintf(i32 %188, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0))
store i64 0, i64* @errno
%190 = getelementptr inbounds [50 x i8*], [50 x i8*]* %13, i64 0, i64 0
%191 = call i32 @execvp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %190)
%192 = load i64, i64* @errno
%193 = icmp ne i64 %192, 0
br i1 %193, label %194, label %196
194: ; preds = %187
%195 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.27, i64 0, i64 0))
br label %196
196: ; preds = %194, %187
%197 = call i32 @exit(i32 1)
unreachable
198: ; preds = %36
%199 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%200 = load i32, i32* %199
%201 = call i32 @close(i32 %200)
%202 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%203 = load i32, i32* %202
%204 = call i32 @close(i32 %203)
%205 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%206 = load i32, i32* %205
%207 = call i32 @close(i32 %206)
store i32 0, i32* %16
br label %208
208: ; preds = %212, %198
%209 = getelementptr inbounds [128 x i8], [128 x i8]* %17, i64 0, i64 0
%210 = call i32 @read(i32 0, i8* %209, i32 128)
store i32 %210, i32* %16
%211 = icmp sgt i32 %210, 0
br i1 %211, label %212, label %218
212: ; preds = %208
%213 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%214 = load i32, i32* %213
%215 = getelementptr inbounds [128 x i8], [128 x i8]* %17, i64 0, i64 0
%216 = load i32, i32* %16
%217 = call i32 @write(i32 %214, i8* %215, i32 %216)
br label %208
218: ; preds = %208
%219 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%220 = load i32, i32* %219
%221 = call i32 @close(i32 %220)
%222 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%223 = load i32, i32* %222
%224 = call i32 @close(i32 %223)
%225 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%226 = load i32, i32* %225
%227 = call i32 @close(i32 %226)
%228 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%229 = load i32, i32* %228
%230 = call i32 @close(i32 %229)
%231 = call i32 @wait(i32* null)
%232 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"Pipe failed\00"
@.str.1 = [15 x i8] c"/proc/self/exe\00"
@.str.2 = [30 x i8] c"Cannot determine correct path\00"
@stderr = global i32 0
@.str.3 = [25 x i8] c"Current executable: '%s'\00"
@.str.4 = [12 x i8] c" dir: '%s'\0A\00"
@.str.5 = [28 x i8] c"/ZIPStream-1.0-SNAPSHOT.jar\00"
@.str.6 = [11 x i8] c"/bin/bash \00"
@.str.7 = [25 x i8] c"/wrapper.sh <<INPUTAPK>>\00"
@.str.8 = [22 x i8] c"Jar: '%s' cmd: '%s'\0A\0A\00"
@.str.9 = [10 x i8] c"/bin/java\00"
@.str.10 = [4 x i8] c"-cp\00"
@.str.11 = [37 x i8] c"cz.muni.fi.xklinec.zipstream.Mallory\00"
@.str.12 = [3 x i8] c"-f\00"
@.str.13 = [2 x i8] c"1\00"
@.str.14 = [3 x i8] c"-e\00"
@.str.15 = [7 x i8] c".*gif$\00"
@.str.16 = [13 x i8] c"--padd-extra\00"
@.str.17 = [7 x i8] c"512000\00"
@.str.18 = [18 x i8] c"--recompute-crc32\00"
@.str.19 = [18 x i8] c"--create-temp-dir\00"
@.str.20 = [15 x i8] c"--omit-missing\00"
@.str.21 = [19 x i8] c"--slow-down-stream\00"
@.str.22 = [11 x i8] c"--apk-size\00"
@.str.23 = [6 x i8] c"--cmd\00"
@.str.24 = [46 x i8] c"Arguments for java application: \0A<ARGUMENTS>\0A\00"
@.str.25 = [4 x i8] c" %s\00"
@.str.26 = [16 x i8] c"\0A</ARGUMENTS>\0A\0A\00"
@errno = global i64 0
@.str.27 = [21 x i8] c"execvp of ./p failed\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i32]
%4 = alloca [2 x i32]
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca [50 x i8*]
%9 = alloca [128 x i8]
%10 = bitcast [2 x i32]* %3 to i8*
%11 = bitcast [2 x i32]* %4 to i8*
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%13 = call i32 @pipe(i32* %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %19, label %15
15: ; preds = %2
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%17 = call i32 @pipe(i32* %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %22
19: ; preds = %15, %2
%20 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %15
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%26 = call i32 @readlink(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %23, i32 1024)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @exit(i32 2)
unreachable
31: ; preds = %22
%32 = sext i32 %26 to i64
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %32
store i8 0, i8* %33
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%36 = call i8* @dirname(i8* %23)
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %36)
%39 = call i32 @strcpy(i8* %24, i8* %36)
%40 = call i32 @strcat(i8* %24, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%41 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%42 = call i32 @strcat(i8* %25, i8* %36)
%43 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i8* %24, i8* %25)
%46 = call i64 (...) @fork()
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %114
48: ; preds = %31
%49 = bitcast [50 x i8*]* %8 to i8*
%50 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 0
%51 = call i32 @memset(i8** %50, i32 0, i32 400)
%52 = call i32 @close(i32 0)
%53 = load i32, i32* %12
%54 = call i32 @dup2(i32 %53, i32 0)
%55 = load i32, i32* %12
%56 = call i32 @close(i32 %55)
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%58 = load i32, i32* %57
%59 = call i32 @close(i32 %58)
%60 = load i32, i32* %16
%61 = call i32 @close(i32 %60)
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%63 = load i32, i32* %62
%64 = call i32 @close(i32 %63)
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %50
%65 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8** %65
%66 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 2
store i8* %24, i8** %66
%67 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 3
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i8** %67
%68 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8** %68
%69 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i8** %69
%70 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 6
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i8** %70
%71 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 7
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0), i8** %71
%72 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 8
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), i8** %72
%73 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 9
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8** %73
%74 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 10
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i8** %74
%75 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 11
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.19, i64 0, i64 0), i8** %75
%76 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 12
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.20, i64 0, i64 0), i8** %76
%77 = icmp sgt i32 %0, 1
br i1 %77, label %78, label %84
78: ; preds = %48
%79 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 13
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0), i8** %79
%80 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 14
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.22, i64 0, i64 0), i8** %80
%81 = getelementptr inbounds i8*, i8** %1, i64 1
%82 = load i8*, i8** %81
%83 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 15
store i8* %82, i8** %83
br label %84
84: ; preds = %78, %48
%85 = phi i32 [ 16, %78 ], [ 13, %48 ]
%86 = add nuw nsw i32 %85, 1
%87 = zext i32 %85 to i64
%88 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 %87
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0), i8** %88
%89 = or i32 %85, 2
%90 = zext i32 %86 to i64
%91 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 %90
store i8* %25, i8** %91
%92 = zext i32 %89 to i64
%93 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 %92
store i8* null, i8** %93
%94 = load i32, i32* @stderr
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.24, i64 0, i64 0))
br label %96
96: ; preds = %84, %96
%97 = phi i64 [ 0, %84 ], [ %102, %96 ]
%98 = load i32, i32* @stderr
%99 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 %97
%100 = load i8*, i8** %99
%101 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i64 0, i64 0), i8* %100)
%102 = add nuw nsw i64 %97, 1
%103 = icmp eq i64 %102, %92
br i1 %103, label %104, label %96
104: ; preds = %96
%105 = load i32, i32* @stderr
%106 = call i32 (i32, i8*, ...) @fprintf(i32 %105, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0))
store i64 0, i64* @errno
%107 = call i32 @execvp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %50)
%108 = load i64, i64* @errno
%109 = icmp eq i64 %108, 0
br i1 %109, label %112, label %110
110: ; preds = %104
%111 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.27, i64 0, i64 0))
br label %112
112: ; preds = %110, %104
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %31
%115 = load i32, i32* %12
%116 = call i32 @close(i32 %115)
%117 = load i32, i32* %16
%118 = call i32 @close(i32 %117)
%119 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%120 = load i32, i32* %119
%121 = call i32 @close(i32 %120)
%122 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%123 = call i32 @read(i32 0, i8* %122, i32 128)
%124 = icmp sgt i32 %123, 0
br i1 %124, label %125, label %133
125: ; preds = %114
%126 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
br label %127
127: ; preds = %125, %127
%128 = phi i32 [ %123, %125 ], [ %131, %127 ]
%129 = load i32, i32* %126
%130 = call i32 @write(i32 %129, i8* %122, i32 %128)
%131 = call i32 @read(i32 0, i8* %122, i32 128)
%132 = icmp sgt i32 %131, 0
br i1 %132, label %127, label %133
133: ; preds = %127, %114
%134 = load i32, i32* %12
%135 = call i32 @close(i32 %134)
%136 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%137 = load i32, i32* %136
%138 = call i32 @close(i32 %137)
%139 = load i32, i32* %16
%140 = call i32 @close(i32 %139)
%141 = load i32, i32* %119
%142 = call i32 @close(i32 %141)
%143 = call i32 @wait(i32* null)
%144 = call i32 @exit(i32 0)
unreachable
}