#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 pid_t;

/* Variables and functions */
int O_APPEND;
int O_CREAT;
int O_RDWR;
int /*<<< orphan*/ SIGHUP;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int S_IRGRP;
int S_IRUSR;
int S_IWUSR;
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int chdir(char *);
int /*<<< orphan*/ close(int /*<<< orphan*/);
int /*<<< orphan*/ dirname(char *);
int /*<<< orphan*/ dup2(int, int /*<<< orphan*/);
int errno;
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
scalar_t__ getpid();
int open(char *, int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ realpath(int /*<<< orphan*/, char *);
int setsid();
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ umask(int /*<<< orphan*/);
void daemonize(char *exe, const char *log) {
  char realp[1024] = "";
  realpath(dirname(exe), realp);
  strcat(realp, "/");
  char logfile[1024] = "";
  strcpy(logfile, realp);
  strcat(logfile, log);
  pid_t pid = fork();
  if (pid == -1) {
    fprintf(stderr, "failed to fork while daemonising (errno=%d)\n", errno);
  } else if (pid != 0) {
    _exit(0);
  }
  if (setsid() == -1) {
    fprintf(stderr,
            "failed to become a session leader while daemonising(errno=%d)\n",
            errno);
  }
  signal(SIGHUP, SIG_IGN);
  pid = fork();
  if (pid == -1) {
    fprintf(stderr, "failed to fork while daemonising (errno=%d)\n", errno);
  } else if (pid != 0) {
    _exit(0);
  }
  if (chdir("/") == -1) {
    fprintf(stderr,
            "failed to change working directory while daemonising (errno=%d)\n",
            errno);
  }
  printf("pid: %d\n", (int)getpid());
  umask(0);
  int fout =
      open(logfile, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP);
  if (fout == -1) {
    fprintf(stderr, "failed to open logfile (errno=%d)\n", errno);
  }
  dup2(fout, STDOUT_FILENO);
  dup2(fout, STDERR_FILENO);
  close(STDIN_FILENO);
  freopen("/dev/null", "w+", stdin);
}


x86 assembly (clang, -O0):
<daemonize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    -0x8(%rbp),%rdi
call   1090 <dirname@plt>
mov    %eax,%edi
lea    -0x410(%rbp),%rsi
call   1110 <realpath@plt>
lea    -0x410(%rbp),%rdi
lea    0xd95(%rip),%rsi
call   1130 <strcat@plt>
lea    -0x810(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x810(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1130 <strcat@plt>
mov    $0x0,%al
call   1140 <fork@plt>
mov    %eax,-0x814(%rbp)
cmpl   $0xffffffff,-0x814(%rbp)
jne    12e3 <daemonize+0xc3>
mov    0x2ce1(%rip),%rax
mov    (%rax),%edi
mov    0x2cd0(%rip),%rax
mov    (%rax),%edx
lea    0xd29(%rip),%rsi
call   10f0 <fprintf@plt>
jmp    12fc <daemonize+0xdc>
cmpl   $0x0,-0x814(%rbp)
je     12f7 <daemonize+0xd7>
xor    %edi,%edi
call   1030 <_exit@plt>
jmp    12fc <daemonize+0xdc>
mov    $0x0,%al
call   10d0 <setsid@plt>
cmp    $0xffffffff,%eax
jne    132a <daemonize+0x10a>
mov    0x2c95(%rip),%rax
mov    (%rax),%edi
mov    0x2c84(%rip),%rax
mov    (%rax),%edx
lea    0xd0a(%rip),%rsi
call   10f0 <fprintf@plt>
mov    0x2cb7(%rip),%rax
mov    (%rax),%edi
mov    0x2c7e(%rip),%rax
mov    (%rax),%esi
call   10e0 <signal@plt>
mov    $0x0,%al
call   1140 <fork@plt>
mov    %eax,-0x814(%rbp)
cmpl   $0xffffffff,-0x814(%rbp)
jne    137e <daemonize+0x15e>
mov    0x2c46(%rip),%rax
mov    (%rax),%edi
mov    0x2c35(%rip),%rax
mov    (%rax),%edx
lea    0xc8e(%rip),%rsi
call   10f0 <fprintf@plt>
jmp    1397 <daemonize+0x177>
cmpl   $0x0,-0x814(%rbp)
je     1392 <daemonize+0x172>
xor    %edi,%edi
call   1030 <_exit@plt>
jmp    1397 <daemonize+0x177>
lea    0xc62(%rip),%rdi
call   1060 <chdir@plt>
cmp    $0xffffffff,%eax
jne    13ca <daemonize+0x1aa>
mov    0x2bf5(%rip),%rax
mov    (%rax),%edi
mov    0x2be4(%rip),%rax
mov    (%rax),%edx
lea    0xca9(%rip),%rsi
call   10f0 <fprintf@plt>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,%esi
lea    0xcd5(%rip),%rdi
call   1080 <printf@plt>
xor    %edi,%edi
call   1100 <umask@plt>
lea    -0x810(%rbp),%rdi
mov    0x2bdc(%rip),%rax
mov    (%rax),%esi
mov    0x2bfb(%rip),%rax
or     (%rax),%esi
mov    0x2b6a(%rip),%rax
or     (%rax),%esi
mov    0x2b79(%rip),%rax
mov    (%rax),%edx
mov    0x2ba8(%rip),%rax
or     (%rax),%edx
mov    0x2b6f(%rip),%rax
or     (%rax),%edx
call   1120 <open@plt>
mov    %eax,-0x818(%rbp)
cmpl   $0xffffffff,-0x818(%rbp)
jne    1459 <daemonize+0x239>
mov    0x2b66(%rip),%rax
mov    (%rax),%edi
mov    0x2b55(%rip),%rax
mov    (%rax),%edx
lea    0xc64(%rip),%rsi
call   10f0 <fprintf@plt>
mov    -0x818(%rbp),%edi
mov    0x2b7a(%rip),%rax
mov    (%rax),%esi
call   1070 <dup2@plt>
mov    -0x818(%rbp),%edi
mov    0x2b1e(%rip),%rax
mov    (%rax),%esi
call   1070 <dup2@plt>
mov    0x2af8(%rip),%rax
mov    (%rax),%edi
call   10c0 <close@plt>
mov    0x2b32(%rip),%rax
mov    (%rax),%edx
lea    0xc3c(%rip),%rdi
lea    0xc3f(%rip),%rsi
call   10b0 <freopen@plt>
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<daemonize>:
push   %r15
push   %r14
push   %rbx
sub    $0x800,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x400(%rsp),%r15
mov    $0x400,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10a0 <memset@plt>
mov    %rbx,%rdi
call   1090 <dirname@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1110 <realpath@plt>
lea    0xd9e(%rip),%rsi
mov    %r15,%rdi
call   1130 <strcat@plt>
mov    %rsp,%rbx
mov    $0x400,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10a0 <memset@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1130 <strcat@plt>
xor    %eax,%eax
call   1140 <fork@plt>
test   %eax,%eax
je     12c4 <daemonize+0xa4>
cmp    $0xffffffff,%eax
jne    143c <daemonize+0x21c>
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
mov    0x2cea(%rip),%rax
mov    (%rax),%edx
lea    0xd43(%rip),%rsi
call   10f0 <fprintf@plt>
xor    %eax,%eax
call   10d0 <setsid@plt>
cmp    $0xffffffff,%eax
jne    12ee <daemonize+0xce>
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
mov    0x2cc0(%rip),%rax
mov    (%rax),%edx
lea    0xd46(%rip),%rsi
call   10f0 <fprintf@plt>
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
mov    0x2cba(%rip),%rax
mov    (%rax),%esi
call   10e0 <signal@plt>
xor    %eax,%eax
call   1140 <fork@plt>
test   %eax,%eax
je     1337 <daemonize+0x117>
cmp    $0xffffffff,%eax
jne    143c <daemonize+0x21c>
mov    0x2c88(%rip),%rax
mov    (%rax),%edi
mov    0x2c77(%rip),%rax
mov    (%rax),%edx
lea    0xcd0(%rip),%rsi
call   10f0 <fprintf@plt>
lea    0xcc2(%rip),%rdi
call   1060 <chdir@plt>
cmp    $0xffffffff,%eax
jne    1366 <daemonize+0x146>
mov    0x2c59(%rip),%rax
mov    (%rax),%edi
mov    0x2c48(%rip),%rax
mov    (%rax),%edx
lea    0xd0d(%rip),%rsi
call   10f0 <fprintf@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xd3b(%rip),%rdi
mov    %eax,%esi
call   1080 <printf@plt>
xor    %edi,%edi
call   1100 <umask@plt>
mov    0x2c47(%rip),%rax
mov    0x2c68(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2bd5(%rip),%rax
or     (%rax),%esi
mov    0x2be4(%rip),%rax
mov    0x2c15(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2bda(%rip),%rax
or     (%rax),%edx
mov    %rsp,%rdi
call   1120 <open@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    13e5 <daemonize+0x1c5>
mov    0x2bda(%rip),%rax
mov    (%rax),%edi
mov    0x2bc9(%rip),%rax
mov    (%rax),%edx
lea    0xcd8(%rip),%rsi
call   10f0 <fprintf@plt>
mov    0x2bf4(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1070 <dup2@plt>
mov    0x2b9c(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1070 <dup2@plt>
mov    0x2b74(%rip),%rax
mov    (%rax),%edi
call   10c0 <close@plt>
mov    0x2bae(%rip),%rax
mov    (%rax),%edx
lea    0xcb8(%rip),%rdi
lea    0xcbb(%rip),%rsi
call   10b0 <freopen@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@stderr = global i32 0
@.str.1 = [45 x i8] c"failed to fork while daemonising (errno=%d)\0A\00"
@errno = global i32 0
@.str.2 = [63 x i8] c"failed to become a session leader while daemonising(errno=%d)\0A\00"
@SIGHUP = global i32 0
@SIG_IGN = global i32 0
@.str.3 = [65 x i8] c"failed to change working directory while daemonising (errno=%d)\0A\00"
@.str.4 = [9 x i8] c"pid: %d\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_APPEND = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@.str.5 = [35 x i8] c"failed to open logfile (errno=%d)\0A\00"
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@STDIN_FILENO = global i32 0
@.str.6 = [10 x i8] c"/dev/null\00"
@.str.7 = [3 x i8] c"w+\00"
@stdin = global i32 0
define void @daemonize(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = bitcast [1024 x i8]* %5 to i8*
%10 = load i8*, i8** %3
%11 = call i32 @dirname(i8* %10)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%13 = call i32 @realpath(i32 %11, i8* %12)
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = bitcast [1024 x i8]* %6 to i8*
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%21 = load i8*, i8** %4
%22 = call i32 @strcat(i8* %20, i8* %21)
%23 = call i32 (...) @fork()
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %30
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = load i32, i32* @errno
%29 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %36
30: ; preds = %2
%31 = load i32, i32* %7
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @_exit(i32 0)
unreachable
35: ; preds = %30
br label %36
36: ; preds = %35, %26
%37 = call i32 (...) @setsid()
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32, i32* @stderr
%41 = load i32, i32* @errno
%42 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %39, %36
%44 = load i32, i32* @SIGHUP
%45 = load i32, i32* @SIG_IGN
%46 = call i32 @signal(i32 %44, i32 %45)
%47 = call i32 (...) @fork()
store i32 %47, i32* %7
%48 = load i32, i32* %7
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %54
50: ; preds = %43
%51 = load i32, i32* @stderr
%52 = load i32, i32* @errno
%53 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %52)
br label %60
54: ; preds = %43
%55 = load i32, i32* %7
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 @_exit(i32 0)
unreachable
59: ; preds = %54
br label %60
60: ; preds = %59, %50
%61 = call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %67
63: ; preds = %60
%64 = load i32, i32* @stderr
%65 = load i32, i32* @errno
%66 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %63, %60
%68 = call i64 (...) @getpid()
%69 = trunc i64 %68 to i32
%70 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %69)
%71 = call i32 @umask(i32 0)
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%73 = load i32, i32* @O_RDWR
%74 = load i32, i32* @O_CREAT
%75 = or i32 %73, %74
%76 = load i32, i32* @O_APPEND
%77 = or i32 %75, %76
%78 = load i32, i32* @S_IRUSR
%79 = load i32, i32* @S_IWUSR
%80 = or i32 %78, %79
%81 = load i32, i32* @S_IRGRP
%82 = or i32 %80, %81
%83 = call i32 @open(i8* %72, i32 %77, i32 %82)
store i32 %83, i32* %8
%84 = load i32, i32* %8
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %90
86: ; preds = %67
%87 = load i32, i32* @stderr
%88 = load i32, i32* @errno
%89 = call i32 @fprintf(i32 %87, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %88)
br label %90
90: ; preds = %86, %67
%91 = load i32, i32* %8
%92 = load i32, i32* @STDOUT_FILENO
%93 = call i32 @dup2(i32 %91, i32 %92)
%94 = load i32, i32* %8
%95 = load i32, i32* @STDERR_FILENO
%96 = call i32 @dup2(i32 %94, i32 %95)
%97 = load i32, i32* @STDIN_FILENO
%98 = call i32 @close(i32 %97)
%99 = load i32, i32* @stdin
%100 = call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %99)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@stderr = global i32 0
@.str.1 = [45 x i8] c"failed to fork while daemonising (errno=%d)\0A\00"
@errno = global i32 0
@.str.2 = [63 x i8] c"failed to become a session leader while daemonising(errno=%d)\0A\00"
@SIGHUP = global i32 0
@SIG_IGN = global i32 0
@.str.3 = [65 x i8] c"failed to change working directory while daemonising (errno=%d)\0A\00"
@.str.4 = [9 x i8] c"pid: %d\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_APPEND = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@.str.5 = [35 x i8] c"failed to open logfile (errno=%d)\0A\00"
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@STDIN_FILENO = global i32 0
@.str.6 = [10 x i8] c"/dev/null\00"
@.str.7 = [3 x i8] c"w+\00"
@stdin = global i32 0
define void @daemonize(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = tail call i32 @dirname(i8* %0)
%7 = call i32 @realpath(i32 %6, i8* %5)
%8 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%10 = call i32 @strcpy(i8* %9, i8* %5)
%11 = call i32 @strcat(i8* %9, i8* %1)
%12 = call i32 (...) @fork()
switch i32 %12, label %17 [
i32 -1, label %13
i32 0, label %19
]
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i32, i32* @errno
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %19
17: ; preds = %2
%18 = call i32 @_exit(i32 0)
unreachable
19: ; preds = %2, %13
%20 = call i32 (...) @setsid()
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = load i32, i32* @errno
%25 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %22, %19
%27 = load i32, i32* @SIGHUP
%28 = load i32, i32* @SIG_IGN
%29 = call i32 @signal(i32 %27, i32 %28)
%30 = call i32 (...) @fork()
switch i32 %30, label %35 [
i32 -1, label %31
i32 0, label %37
]
31: ; preds = %26
%32 = load i32, i32* @stderr
%33 = load i32, i32* @errno
%34 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %37
35: ; preds = %26
%36 = call i32 @_exit(i32 0)
unreachable
37: ; preds = %26, %31
%38 = call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = load i32, i32* @stderr
%42 = load i32, i32* @errno
%43 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %40, %37
%45 = call i64 (...) @getpid()
%46 = trunc i64 %45 to i32
%47 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %46)
%48 = call i32 @umask(i32 0)
%49 = load i32, i32* @O_RDWR
%50 = load i32, i32* @O_CREAT
%51 = or i32 %50, %49
%52 = load i32, i32* @O_APPEND
%53 = or i32 %51, %52
%54 = load i32, i32* @S_IRUSR
%55 = load i32, i32* @S_IWUSR
%56 = or i32 %55, %54
%57 = load i32, i32* @S_IRGRP
%58 = or i32 %56, %57
%59 = call i32 @open(i8* %9, i32 %53, i32 %58)
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %65
61: ; preds = %44
%62 = load i32, i32* @stderr
%63 = load i32, i32* @errno
%64 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %63)
br label %65
65: ; preds = %61, %44
%66 = load i32, i32* @STDOUT_FILENO
%67 = call i32 @dup2(i32 %59, i32 %66)
%68 = load i32, i32* @STDERR_FILENO
%69 = call i32 @dup2(i32 %59, i32 %68)
%70 = load i32, i32* @STDIN_FILENO
%71 = call i32 @close(i32 %70)
%72 = load i32, i32* @stdin
%73 = call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %72)
ret void
}