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

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
scalar_t__ EINTR;
int /*<<< orphan*/ LOG_WARNING;
int O_APPEND;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_WRONLY;
int PATH_MAX;
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int execv(char *, char **);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ memset(char **, int /*<<< orphan*/, int);
int /*<<< orphan*/ msleep(int);
int open(char *, int, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int strlen(char *);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *, ...);
int wait(int *);
int execute(char **args, char *in, char *out, char *err) {
  char buf[PATH_MAX];
  int i, pid, status = 0, rc = 0;
  memset(&buf, 0, sizeof(buf));
  for (i = 0; i < 16; i++) {
    if (args[i])
      snprintf(buf + strlen(buf), PATH_MAX - strlen(buf), " %s", args[i]);
    else
      break;
  }
  syslog(LOG_WARNING, "Execute:%s", buf);
  fflush(stdout);
  fflush(stderr);
  if ((pid = fork()) == 0) {
    msleep(150);
    if (in) {
      close(0);
      if (open(in, O_RDONLY) != 0) {
        syslog(LOG_WARNING, "Reopen of stdin to %s failed", in);
        _exit(-1);
      }
    }
    if (out) {
      close(1);
      if (open(out, O_WRONLY | O_APPEND | O_CREAT, 0600) != 1) {
        syslog(LOG_WARNING, "Reopen of stdout to %s failed", out);
        _exit(-1);
      }
    }
    if (err) {
      close(2);
      if (open(err, O_WRONLY | O_APPEND | O_CREAT, 0600) != 2) {
        syslog(LOG_WARNING, "Reopen of stderr to %s failed", err);
        _exit(-1);
      }
    }
    rc = execv(args[0], args);
    syslog(LOG_WARNING, "Exec \"%s\" returned %d", args[0], rc);
    _exit(-1);
  }
  do {
    rc = wait(&status);
  } while (((rc > 0) && (rc != pid)) || ((rc == -1) && (errno == EINTR)));
  return 0;
}


x86 assembly (clang, -O0):
<execute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2e09(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x48(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x10,-0x34(%rbp)
jge    12a8 <execute+0xe8>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1290 <execute+0xd0>
mov    -0x48(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x48(%rbp),%rdi
movslq %eax,%rcx
mov    %rdi,%rax
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    0x2d88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
call   1040 <strlen@plt>
mov    -0x54(%rbp),%esi
mov    -0x50(%rbp),%rdi
sub    %eax,%esi
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xd7a(%rip),%rdx
call   1060 <snprintf@plt>
jmp    1295 <execute+0xd5>
jmp    12a8 <execute+0xe8>
jmp    129a <execute+0xda>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1222 <execute+0x62>
mov    -0x48(%rbp),%rdx
mov    0x2d1d(%rip),%rax
mov    (%rax),%edi
lea    0xd48(%rip),%rsi
mov    $0x0,%al
call   10a0 <syslog@plt>
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    0x2ce8(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    $0x0,%al
call   10e0 <fork@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x0,%eax
jne    1479 <execute+0x2b9>
mov    $0x96,%edi
call   1050 <msleep@plt>
cmpq   $0x0,-0x10(%rbp)
je     1355 <execute+0x195>
xor    %edi,%edi
call   1080 <close@plt>
mov    -0x10(%rbp),%rdi
mov    0x2cbf(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   10b0 <open@plt>
cmp    $0x0,%eax
je     1350 <execute+0x190>
mov    0x2c9e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xcd0(%rip),%rsi
mov    $0x0,%al
call   10a0 <syslog@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>
jmp    1355 <execute+0x195>
cmpq   $0x0,-0x18(%rbp)
je     13c8 <execute+0x208>
mov    $0x1,%edi
call   1080 <close@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c23(%rip),%rax
mov    (%rax),%esi
mov    0x2c12(%rip),%rax
or     (%rax),%esi
mov    0x2c71(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
mov    $0x0,%al
call   10b0 <open@plt>
cmp    $0x1,%eax
je     13c3 <execute+0x203>
mov    0x2c2b(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xc7a(%rip),%rsi
mov    $0x0,%al
call   10a0 <syslog@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>
jmp    13c8 <execute+0x208>
cmpq   $0x0,-0x20(%rbp)
je     143b <execute+0x27b>
mov    $0x2,%edi
call   1080 <close@plt>
mov    -0x20(%rbp),%rdi
mov    0x2bb0(%rip),%rax
mov    (%rax),%esi
mov    0x2b9f(%rip),%rax
or     (%rax),%esi
mov    0x2bfe(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
mov    $0x0,%al
call   10b0 <open@plt>
cmp    $0x2,%eax
je     1436 <execute+0x276>
mov    0x2bb8(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xc25(%rip),%rsi
mov    $0x0,%al
call   10a0 <syslog@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>
jmp    143b <execute+0x27b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rsi
call   10d0 <execv@plt>
mov    %eax,-0x40(%rbp)
mov    0x2b7b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x40(%rbp),%ecx
lea    0xc00(%rip),%rsi
mov    $0x0,%al
call   10a0 <syslog@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>
jmp    147e <execute+0x2be>
lea    -0x3c(%rbp),%rdi
call   10c0 <wait@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jle    14a5 <execute+0x2e5>
mov    -0x40(%rbp),%ecx
mov    $0x1,%al
cmp    -0x38(%rbp),%ecx
mov    %al,-0x55(%rbp)
jne    14d4 <execute+0x314>
xor    %eax,%eax
cmpl   $0xffffffff,-0x40(%rbp)
mov    %al,-0x56(%rbp)
jne    14ce <execute+0x30e>
mov    0x2afd(%rip),%rax
mov    (%rax),%rax
mov    0x2aeb(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x56(%rbp)
mov    -0x56(%rbp),%al
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%al
test   $0x1,%al
jne    147e <execute+0x2be>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %rdi,%r13
mov    0x2e01(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rdx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
movl   $0x0,-0x44(%rbp)
xor    %r14d,%r14d
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpq   $0x0,0x0(%r13,%r14,8)
je     126c <execute+0xac>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movslq %eax,%r15
add    %rbx,%r15
mov    0x2dab(%rip),%rax
mov    (%rax),%r12d
mov    %rbx,%rdi
call   1040 <strlen@plt>
sub    %eax,%r12d
mov    0x0(%r13,%r14,8),%rcx
mov    %r15,%rdi
mov    %r12d,%esi
lea    0xda3(%rip),%rdx
call   1060 <snprintf@plt>
add    $0x1,%r14
cmp    $0x10,%r14
jne    1220 <execute+0x60>
mov    0x2d5d(%rip),%r14
mov    (%r14),%edi
lea    0xd87(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <syslog@plt>
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    0x2d24(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
xor    %eax,%eax
call   10e0 <fork@plt>
test   %eax,%eax
je     12ff <execute+0x13f>
mov    %eax,%ebx
lea    -0x44(%rbp),%r14
mov    0x2cfd(%rip),%r15
mov    0x2cee(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   10c0 <wait@plt>
test   %eax,%eax
jle    12e0 <execute+0x120>
cmp    %ebx,%eax
jne    12d0 <execute+0x110>
cmp    $0xffffffff,%eax
jne    12ee <execute+0x12e>
mov    (%r12),%rax
cmp    %rax,(%r15)
je     12d0 <execute+0x110>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x96,%edi
call   1050 <msleep@plt>
cmpq   $0x0,-0x40(%rbp)
je     1333 <execute+0x173>
xor    %edi,%edi
call   1080 <close@plt>
mov    0x2cba(%rip),%rax
mov    (%rax),%esi
mov    -0x40(%rbp),%rdi
xor    %eax,%eax
call   10b0 <open@plt>
test   %eax,%eax
jne    13e2 <execute+0x222>
cmpq   $0x0,-0x38(%rbp)
je     1374 <execute+0x1b4>
mov    $0x1,%edi
call   1080 <close@plt>
mov    0x2c4d(%rip),%rax
mov    0x2c3e(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2c9b(%rip),%rax
or     (%rax),%esi
mov    -0x38(%rbp),%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   10b0 <open@plt>
cmp    $0x1,%eax
jne    13f2 <execute+0x232>
cmpq   $0x0,-0x30(%rbp)
je     13b5 <execute+0x1f5>
mov    $0x2,%edi
call   1080 <close@plt>
mov    0x2c0c(%rip),%rax
mov    0x2bfd(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2c5a(%rip),%rax
or     (%rax),%esi
mov    -0x30(%rbp),%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   10b0 <open@plt>
cmp    $0x2,%eax
jne    1402 <execute+0x242>
mov    0x0(%r13),%rdi
mov    %r13,%rsi
call   10d0 <execv@plt>
mov    (%r14),%edi
mov    0x0(%r13),%rdx
lea    0xc99(%rip),%rsi
mov    %eax,%ecx
xor    %eax,%eax
call   10a0 <syslog@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>
mov    (%r14),%edi
lea    0xc23(%rip),%rsi
mov    -0x40(%rbp),%rdx
jmp    1410 <execute+0x250>
mov    (%r14),%edi
lea    0xc30(%rip),%rsi
mov    -0x38(%rbp),%rdx
jmp    1410 <execute+0x250>
mov    (%r14),%edi
lea    0xc3e(%rip),%rsi
mov    -0x30(%rbp),%rdx
xor    %eax,%eax
call   10a0 <syslog@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [4 x i8] c" %s\00"
@LOG_WARNING = global i32 0
@.str.1 = [11 x i8] c"Execute:%s\00"
@stdout = global i32 0
@stderr = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [29 x i8] c"Reopen of stdin to %s failed\00"
@O_WRONLY = global i32 0
@O_APPEND = global i32 0
@O_CREAT = global i32 0
@.str.3 = [30 x i8] c"Reopen of stdout to %s failed\00"
@.str.4 = [30 x i8] c"Reopen of stderr to %s failed\00"
@.str.5 = [22 x i8] c"Exec \22%s\22 returned %d\00"
@errno = global i64 0
@EINTR = global i64 0
define i32 @execute(i8** %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8** %0, i8*** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%15 = load i32, i32* @PATH_MAX
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %9
%18 = alloca i8, i64 %16
store i64 %16, i64* %10
store i32 0, i32* %13
store i32 0, i32* %14
%19 = bitcast i8* %18 to i8**
%20 = trunc i64 %16 to i32
%21 = call i32 @memset(i8** %19, i32 0, i32 %20)
store i32 0, i32* %11
br label %22
22: ; preds = %47, %4
%23 = load i32, i32* %11
%24 = icmp slt i32 %23, 16
br i1 %24, label %25, label %50
25: ; preds = %22
%26 = load i8**, i8*** %5
%27 = load i32, i32* %11
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %45
32: ; preds = %25
%33 = call i32 @strlen(i8* %18)
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %18, i64 %34
%36 = load i32, i32* @PATH_MAX
%37 = call i32 @strlen(i8* %18)
%38 = sub nsw i32 %36, %37
%39 = load i8**, i8*** %5
%40 = load i32, i32* %11
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = call i32 @snprintf(i8* %35, i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %43)
br label %46
45: ; preds = %25
br label %50
46: ; preds = %32
br label %47
47: ; preds = %46
%48 = load i32, i32* %11
%49 = add nsw i32 %48, 1
store i32 %49, i32* %11
br label %22
50: ; preds = %45, %22
%51 = load i32, i32* @LOG_WARNING
%52 = call i32 (i32, i8*, i8*, ...) @syslog(i32 %51, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%53 = load i32, i32* @stdout
%54 = call i32 @fflush(i32 %53)
%55 = load i32, i32* @stderr
%56 = call i32 @fflush(i32 %55)
%57 = call i32 (...) @fork()
store i32 %57, i32* %12
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %126
59: ; preds = %50
%60 = call i32 @msleep(i32 150)
%61 = load i8*, i8** %6
%62 = icmp ne i8* %61, null
br i1 %62, label %63, label %75
63: ; preds = %59
%64 = call i32 @close(i32 0)
%65 = load i8*, i8** %6
%66 = load i32, i32* @O_RDONLY
%67 = call i32 (i8*, i32, ...) @open(i8* %65, i32 %66)
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %74
69: ; preds = %63
%70 = load i32, i32* @LOG_WARNING
%71 = load i8*, i8** %6
%72 = call i32 (i32, i8*, i8*, ...) @syslog(i32 %70, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %71)
%73 = call i32 @_exit(i32 -1)
unreachable
74: ; preds = %63
br label %75
75: ; preds = %74, %59
%76 = load i8*, i8** %7
%77 = icmp ne i8* %76, null
br i1 %77, label %78, label %94
78: ; preds = %75
%79 = call i32 @close(i32 1)
%80 = load i8*, i8** %7
%81 = load i32, i32* @O_WRONLY
%82 = load i32, i32* @O_APPEND
%83 = or i32 %81, %82
%84 = load i32, i32* @O_CREAT
%85 = or i32 %83, %84
%86 = call i32 (i8*, i32, ...) @open(i8* %80, i32 %85, i32 384)
%87 = icmp ne i32 %86, 1
br i1 %87, label %88, label %93
88: ; preds = %78
%89 = load i32, i32* @LOG_WARNING
%90 = load i8*, i8** %7
%91 = call i32 (i32, i8*, i8*, ...) @syslog(i32 %89, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %90)
%92 = call i32 @_exit(i32 -1)
unreachable
93: ; preds = %78
br label %94
94: ; preds = %93, %75
%95 = load i8*, i8** %8
%96 = icmp ne i8* %95, null
br i1 %96, label %97, label %113
97: ; preds = %94
%98 = call i32 @close(i32 2)
%99 = load i8*, i8** %8
%100 = load i32, i32* @O_WRONLY
%101 = load i32, i32* @O_APPEND
%102 = or i32 %100, %101
%103 = load i32, i32* @O_CREAT
%104 = or i32 %102, %103
%105 = call i32 (i8*, i32, ...) @open(i8* %99, i32 %104, i32 384)
%106 = icmp ne i32 %105, 2
br i1 %106, label %107, label %112
107: ; preds = %97
%108 = load i32, i32* @LOG_WARNING
%109 = load i8*, i8** %8
%110 = call i32 (i32, i8*, i8*, ...) @syslog(i32 %108, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %109)
%111 = call i32 @_exit(i32 -1)
unreachable
112: ; preds = %97
br label %113
113: ; preds = %112, %94
%114 = load i8**, i8*** %5
%115 = getelementptr inbounds i8*, i8** %114, i64 0
%116 = load i8*, i8** %115
%117 = load i8**, i8*** %5
%118 = call i32 @execv(i8* %116, i8** %117)
store i32 %118, i32* %14
%119 = load i32, i32* @LOG_WARNING
%120 = load i8**, i8*** %5
%121 = getelementptr inbounds i8*, i8** %120, i64 0
%122 = load i8*, i8** %121
%123 = load i32, i32* %14
%124 = call i32 (i32, i8*, i8*, ...) @syslog(i32 %119, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %122, i32 %123)
%125 = call i32 @_exit(i32 -1)
unreachable
126: ; preds = %50
br label %127
127: ; preds = %145, %126
%128 = call i32 @wait(i32* %13)
store i32 %128, i32* %14
br label %129
129: ; preds = %127
%130 = load i32, i32* %14
%131 = icmp sgt i32 %130, 0
br i1 %131, label %132, label %136
132: ; preds = %129
%133 = load i32, i32* %14
%134 = load i32, i32* %12
%135 = icmp ne i32 %133, %134
br i1 %135, label %145, label %136
136: ; preds = %132, %129
%137 = load i32, i32* %14
%138 = icmp eq i32 %137, -1
br i1 %138, label %139, label %143
139: ; preds = %136
%140 = load i64, i64* @errno
%141 = load i64, i64* @EINTR
%142 = icmp eq i64 %140, %141
br label %143
143: ; preds = %139, %136
%144 = phi i1 [ false, %136 ], [ %142, %139 ]
br label %145
145: ; preds = %143, %132
%146 = phi i1 [ true, %132 ], [ %144, %143 ]
br i1 %146, label %127, label %147
147: ; preds = %145
%148 = load i8*, i8** %9
ret i32 0
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [4 x i8] c" %s\00"
@LOG_WARNING = global i32 0
@.str.1 = [11 x i8] c"Execute:%s\00"
@stdout = global i32 0
@stderr = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [29 x i8] c"Reopen of stdin to %s failed\00"
@O_WRONLY = global i32 0
@O_APPEND = global i32 0
@O_CREAT = global i32 0
@.str.3 = [30 x i8] c"Reopen of stdout to %s failed\00"
@.str.4 = [30 x i8] c"Reopen of stderr to %s failed\00"
@.str.5 = [22 x i8] c"Exec \22%s\22 returned %d\00"
@errno = global i64 0
@EINTR = global i64 0
define i32 @execute(i8** %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = load i32, i32* @PATH_MAX
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = bitcast i8* %8 to i8**
%11 = call i32 @memset(i8** %10, i32 0, i32 %6)
br label %12
12: ; preds = %4, %17
%13 = phi i64 [ 0, %4 ], [ %26, %17 ]
%14 = getelementptr inbounds i8*, i8** %0, i64 %13
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, null
br i1 %16, label %28, label %17
17: ; preds = %12
%18 = call i32 @strlen(i8* %8)
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %8, i64 %19
%21 = load i32, i32* @PATH_MAX
%22 = call i32 @strlen(i8* %8)
%23 = sub nsw i32 %21, %22
%24 = load i8*, i8** %14
%25 = call i32 @snprintf(i8* %20, i32 %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = add nuw nsw i64 %13, 1
%27 = icmp eq i64 %26, 16
br i1 %27, label %28, label %12
28: ; preds = %12, %17
%29 = load i32, i32* @LOG_WARNING
%30 = call i32 (i32, i8*, i8*, ...) @syslog(i32 %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%31 = load i32, i32* @stdout
%32 = call i32 @fflush(i32 %31)
%33 = load i32, i32* @stderr
%34 = call i32 @fflush(i32 %33)
%35 = call i32 (...) @fork()
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %86
37: ; preds = %28
%38 = call i32 @msleep(i32 150)
%39 = icmp eq i8* %1, null
br i1 %39, label %49, label %40
40: ; preds = %37
%41 = call i32 @close(i32 0)
%42 = load i32, i32* @O_RDONLY
%43 = call i32 (i8*, i32, ...) @open(i8* %1, i32 %42)
%44 = icmp eq i32 %43, 0
br i1 %44, label %49, label %45
45: ; preds = %40
%46 = load i32, i32* @LOG_WARNING
%47 = call i32 (i32, i8*, i8*, ...) @syslog(i32 %46, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%48 = call i32 @_exit(i32 -1)
unreachable
49: ; preds = %40, %37
%50 = icmp eq i8* %2, null
br i1 %50, label %64, label %51
51: ; preds = %49
%52 = call i32 @close(i32 1)
%53 = load i32, i32* @O_WRONLY
%54 = load i32, i32* @O_APPEND
%55 = or i32 %54, %53
%56 = load i32, i32* @O_CREAT
%57 = or i32 %55, %56
%58 = call i32 (i8*, i32, ...) @open(i8* %2, i32 %57, i32 384)
%59 = icmp eq i32 %58, 1
br i1 %59, label %64, label %60
60: ; preds = %51
%61 = load i32, i32* @LOG_WARNING
%62 = call i32 (i32, i8*, i8*, ...) @syslog(i32 %61, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%63 = call i32 @_exit(i32 -1)
unreachable
64: ; preds = %51, %49
%65 = icmp eq i8* %3, null
br i1 %65, label %79, label %66
66: ; preds = %64
%67 = call i32 @close(i32 2)
%68 = load i32, i32* @O_WRONLY
%69 = load i32, i32* @O_APPEND
%70 = or i32 %69, %68
%71 = load i32, i32* @O_CREAT
%72 = or i32 %70, %71
%73 = call i32 (i8*, i32, ...) @open(i8* %3, i32 %72, i32 384)
%74 = icmp eq i32 %73, 2
br i1 %74, label %79, label %75
75: ; preds = %66
%76 = load i32, i32* @LOG_WARNING
%77 = call i32 (i32, i8*, i8*, ...) @syslog(i32 %76, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%78 = call i32 @_exit(i32 -1)
unreachable
79: ; preds = %66, %64
%80 = load i8*, i8** %0
%81 = call i32 @execv(i8* %80, i8** %0)
%82 = load i32, i32* @LOG_WARNING
%83 = load i8*, i8** %0
%84 = call i32 (i32, i8*, i8*, ...) @syslog(i32 %82, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %83, i32 %81)
%85 = call i32 @_exit(i32 -1)
unreachable
86: ; preds = %28, %97
%87 = call i32 @wait(i32* %5)
%88 = icmp slt i32 %87, 1
%89 = icmp eq i32 %87, %35
%90 = select i1 %88, i1 true, i1 %89
br i1 %90, label %91, label %97
91: ; preds = %86
%92 = icmp eq i32 %87, -1
%93 = load i64, i64* @errno
%94 = load i64, i64* @EINTR
%95 = icmp eq i64 %93, %94
%96 = select i1 %92, i1 %95, i1 false
br i1 %96, label %97, label %98
97: ; preds = %91, %86
br label %86
98: ; preds = %91
ret i32 0
}