#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;
typedef int /*<<< orphan*/ parent;
typedef int /*<<< orphan*/ btline;

/* Variables and functions */
scalar_t__ EAGAIN;
scalar_t__ EINTR;
scalar_t__ EXIT_FAILURE;
int STDERR_FILENO;
int STDIN_FILENO;
int STDOUT_FILENO;
scalar_t__ WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
int /*<<< orphan*/ backtrace_symbols_fd(void **, int, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int);
scalar_t__ errno;
int /*<<< orphan*/ execle(char *, char *, char *, char *, int /*<<< orphan*/ *,
                          ...);
int /*<<< orphan*/ exit(scalar_t__);
int fork();
int getppid();
scalar_t__ pipe(int *);
int read(int, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
int show_backtrace(void) {
  pid_t kidpid;
  int pipefd[2];
  if (pipe(pipefd) != 0) {
    return -1;
  }
  kidpid = fork();
  if (kidpid == -1) {
    return -1;
  } else if (kidpid == 0) {
    char parent[16];
    char buf[512];
    close(STDIN_FILENO);
    close(STDOUT_FILENO);
    dup2(pipefd[1], STDOUT_FILENO);
    dup2(pipefd[1], STDERR_FILENO);
    snprintf(parent, sizeof(parent), "%d", getppid());
    execle("/usr/bin/pstack", "pstack", parent, NULL, NULL);
    execle("/usr/bin/eu-stack", "eu-stack", "-p", parent, NULL, NULL);
    sprintf(buf,
            "No tools to pretty print a stack trace for pid %d.\n"
            "Fallback to glibc backtrace which may not contain all symbols.\n "
            "run eu-addr2line to pretty print the output.\n",
            getppid());
    write(STDOUT_FILENO, buf, strlen(buf));
    exit(EXIT_FAILURE);
  } else {
    char btline[256];
    int kidstat = 0;
    int bytesread;
    int done = 0;
    close(pipefd[1]);
    while (!done) {
      bytesread = read(pipefd[0], btline, sizeof(btline) - 1);
      if (bytesread > 0) {
        btline[bytesread] = 0;
        write(STDOUT_FILENO, btline, strlen(btline));
      } else if ((bytesread < 0) || ((errno != EINTR) && (errno != EAGAIN)))
        done = 1;
    }
    close(pipefd[0]);
    waitpid(kidpid, &kidstat, 0);
    if (WIFEXITED(kidstat) && (WEXITSTATUS(kidstat) == EXIT_FAILURE)) {
      void *buf[100];
      backtrace_symbols_fd(buf, 100, STDOUT_FILENO);
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<show_backtrace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x680,%rsp
lea    -0x10(%rbp),%rdi
call   1090 <pipe@plt>
cmp    $0x0,%rax
je     122a <show_backtrace+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ff <show_backtrace+0x2ff>
mov    $0x0,%al
call   1120 <fork@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    124a <show_backtrace+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ff <show_backtrace+0x2ff>
cmpl   $0x0,-0x8(%rbp)
jne    137d <show_backtrace+0x17d>
mov    0x2d5d(%rip),%rax
mov    (%rax),%edi
call   1080 <close@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
call   1080 <close@plt>
mov    -0xc(%rbp),%edi
mov    0x2d76(%rip),%rax
mov    (%rax),%esi
call   1060 <dup2@plt>
mov    -0xc(%rbp),%edi
mov    0x2d45(%rip),%rax
mov    (%rax),%esi
call   1060 <dup2@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x670(%rbp)
mov    $0x0,%al
call   10f0 <getppid@plt>
mov    -0x670(%rbp),%rdi
mov    %eax,%ecx
mov    $0x10,%esi
lea    0xd47(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0x20(%rbp),%rdx
lea    0xd3a(%rip),%rdi
lea    0xd3c(%rip),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
mov    $0x0,%al
call   1110 <execle@plt>
lea    -0x20(%rbp),%rcx
lea    0xd29(%rip),%rdi
lea    0xd2b(%rip),%rsi
lea    0xd2d(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%r8
mov    $0x0,%al
call   1110 <execle@plt>
lea    -0x220(%rbp),%rax
mov    %rax,-0x668(%rbp)
mov    $0x0,%al
call   10f0 <getppid@plt>
mov    -0x668(%rbp),%rdi
mov    %eax,%edx
lea    0xcfc(%rip),%rsi
call   10e0 <sprintf@plt>
mov    0x2cb8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x65c(%rbp)
lea    -0x220(%rbp),%rax
mov    %rax,-0x658(%rbp)
lea    -0x220(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x65c(%rbp),%edi
mov    -0x658(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    0x2c53(%rip),%rax
mov    (%rax),%rdi
call   1100 <exit@plt>
movl   $0x0,-0x324(%rbp)
movl   $0x0,-0x32c(%rbp)
mov    -0xc(%rbp),%edi
call   1080 <close@plt>
cmpl   $0x0,-0x32c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13b2 <show_backtrace+0x1b2>
jmp    147f <show_backtrace+0x27f>
mov    -0x10(%rbp),%edi
lea    -0x320(%rbp),%rsi
mov    $0xff,%edx
call   10a0 <read@plt>
mov    %eax,-0x328(%rbp)
cmpl   $0x0,-0x328(%rbp)
jle    142a <show_backtrace+0x22a>
movslq -0x328(%rbp),%rax
movb   $0x0,-0x320(%rbp,%rax,1)
mov    0x2c01(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x67c(%rbp)
lea    -0x320(%rbp),%rax
mov    %rax,-0x678(%rbp)
lea    -0x320(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x67c(%rbp),%edi
mov    -0x678(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
jmp    147a <show_backtrace+0x27a>
cmpl   $0x0,-0x328(%rbp)
jl     146b <show_backtrace+0x26b>
mov    0x2b9a(%rip),%rax
mov    (%rax),%rax
mov    0x2b78(%rip),%rcx
cmp    (%rcx),%rax
je     1475 <show_backtrace+0x275>
mov    0x2b80(%rip),%rax
mov    (%rax),%rax
mov    0x2b46(%rip),%rcx
cmp    (%rcx),%rax
je     1475 <show_backtrace+0x275>
movl   $0x1,-0x32c(%rbp)
jmp    147a <show_backtrace+0x27a>
jmp    1399 <show_backtrace+0x199>
mov    -0x10(%rbp),%edi
call   1080 <close@plt>
mov    -0x8(%rbp),%edi
lea    -0x324(%rbp),%rsi
xor    %edx,%edx
call   10c0 <waitpid@plt>
mov    -0x324(%rbp),%edi
call   10d0 <WIFEXITED@plt>
cmp    $0x0,%rax
je     14ee <show_backtrace+0x2ee>
mov    -0x324(%rbp),%edi
call   10b0 <WEXITSTATUS@plt>
mov    0x2b09(%rip),%rcx
cmp    (%rcx),%rax
jne    14ee <show_backtrace+0x2ee>
lea    -0x650(%rbp),%rdi
mov    0x2b1a(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1030 <backtrace_symbols_fd@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ff <show_backtrace+0x2ff>
jmp    14f3 <show_backtrace+0x2f3>
jmp    14f8 <show_backtrace+0x2f8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x680,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_backtrace>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
lea    0x8(%rsp),%rdi
call   1090 <pipe@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
jne    1327 <show_backtrace+0x127>
xor    %eax,%eax
call   1120 <fork@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
je     1324 <show_backtrace+0x124>
test   %r14d,%r14d
je     133b <show_backtrace+0x13b>
movl   $0x0,0x4(%rsp)
mov    0xc(%rsp),%edi
call   1080 <close@plt>
lea    0x10(%rsp),%rbx
mov    0x2d8e(%rip),%r15
mov    0x2d6f(%rip),%r12
mov    0x2d50(%rip),%r13
jmp    129e <show_backtrace+0x9e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%eax
movb   $0x0,0x10(%rsp,%rax,1)
mov    (%r15),%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
mov    $0xff,%edx
call   10a0 <read@plt>
test   %eax,%eax
jg     1280 <show_backtrace+0x80>
js     12cb <show_backtrace+0xcb>
mov    (%r12),%rax
cmp    0x0(%r13),%rax
je     129e <show_backtrace+0x9e>
mov    0x2ce2(%rip),%rcx
cmp    (%rcx),%rax
je     129e <show_backtrace+0x9e>
mov    0x8(%rsp),%edi
call   1080 <close@plt>
lea    0x4(%rsp),%rsi
xor    %ebx,%ebx
mov    %r14d,%edi
xor    %edx,%edx
call   10c0 <waitpid@plt>
mov    0x4(%rsp),%edi
call   10d0 <WIFEXITED@plt>
test   %rax,%rax
je     1327 <show_backtrace+0x127>
mov    0x4(%rsp),%edi
call   10b0 <WEXITSTATUS@plt>
mov    0x2cc5(%rip),%rcx
cmp    (%rcx),%rax
jne    1327 <show_backtrace+0x127>
mov    (%r15),%edx
lea    0x110(%rsp),%rdi
mov    $0x64,%esi
call   1030 <backtrace_symbols_fd@plt>
mov    $0xffffffff,%ebx
jmp    1327 <show_backtrace+0x127>
mov    %r14d,%ebx
mov    %ebx,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c76(%rip),%rax
mov    (%rax),%edi
call   1080 <close@plt>
mov    0x2ca0(%rip),%rbp
mov    0x0(%rbp),%edi
call   1080 <close@plt>
mov    0xc(%rsp),%edi
mov    0x0(%rbp),%esi
call   1060 <dup2@plt>
mov    0xc(%rsp),%edi
mov    0x2c61(%rip),%rax
mov    (%rax),%esi
call   1060 <dup2@plt>
xor    %eax,%eax
call   10f0 <getppid@plt>
lea    0xc7c(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
mov    %eax,%ecx
call   1070 <snprintf@plt>
lea    0xc64(%rip),%rdi
lea    0xc66(%rip),%rsi
mov    %rbx,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1110 <execle@plt>
lea    0xc57(%rip),%rdi
lea    0xc59(%rip),%rsi
lea    0xc5b(%rip),%rdx
mov    %rbx,%rcx
xor    %r8d,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
call   1110 <execle@plt>
xor    %eax,%eax
call   10f0 <getppid@plt>
lea    0xc40(%rip),%rsi
lea    0x110(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%edx
call   10e0 <sprintf@plt>
mov    0x0(%rbp),%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    0x2bb0(%rip),%rax
mov    (%rax),%rdi
call   1100 <exit@plt>

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"/usr/bin/pstack\00"
@.str.2 = [7 x i8] c"pstack\00"
@.str.3 = [18 x i8] c"/usr/bin/eu-stack\00"
@.str.4 = [9 x i8] c"eu-stack\00"
@.str.5 = [3 x i8] c"-p\00"
@.str.6 = [161 x i8] c"No tools to pretty print a stack trace for pid %d.\0AFallback to glibc backtrace which may not contain all symbols.\0A run eu-addr2line to pretty print the output.\0A\00"
@EXIT_FAILURE = global i64 0
@errno = global i64 0
@EINTR = global i64 0
@EAGAIN = global i64 0
define i32 @show_backtrace() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i32]
%4 = alloca [16 x i8]
%5 = alloca [512 x i8]
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [100 x i8*]
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%12 = call i64 @pipe(i32* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %0
store i32 -1, i32* %1
br label %112
15: ; preds = %0
%16 = call i32 (...) @fork()
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 -1, i32* %1
br label %112
20: ; preds = %15
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %53
23: ; preds = %20
%24 = load i32, i32* @STDIN_FILENO
%25 = call i32 @close(i32 %24)
%26 = load i32, i32* @STDOUT_FILENO
%27 = call i32 @close(i32 %26)
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%29 = load i32, i32* %28
%30 = load i32, i32* @STDOUT_FILENO
%31 = call i32 @dup2(i32 %29, i32 %30)
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%33 = load i32, i32* %32
%34 = load i32, i32* @STDERR_FILENO
%35 = call i32 @dup2(i32 %33, i32 %34)
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%37 = call i32 (...) @getppid()
%38 = call i32 @snprintf(i8* %36, i32 16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%40 = call i32 (i8*, i8*, i8*, i8*, i32*, ...) @execle(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %39, i8* null, i32* null)
%41 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%42 = call i32 (i8*, i8*, i8*, i8*, i32*, ...) @execle(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %41, i32* null, i8* null)
%43 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%44 = call i32 (...) @getppid()
%45 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.6, i64 0, i64 0), i32 %44)
%46 = load i32, i32* @STDOUT_FILENO
%47 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%48 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%49 = call i32 @strlen(i8* %48)
%50 = call i32 @write(i32 %46, i8* %47, i32 %49)
%51 = load i64, i64* @EXIT_FAILURE
%52 = call i32 @exit(i64 %51)
unreachable
53: ; preds = %20
store i32 0, i32* %7
store i32 0, i32* %9
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%55 = load i32, i32* %54
%56 = call i32 @close(i32 %55)
br label %57
57: ; preds = %90, %53
%58 = load i32, i32* %9
%59 = icmp ne i32 %58, 0
%60 = xor i1 %59, true
br i1 %60, label %61, label %91
61: ; preds = %57
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%63 = load i32, i32* %62
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%65 = call i32 @read(i32 %63, i8* %64, i32 255)
store i32 %65, i32* %8
%66 = load i32, i32* %8
%67 = icmp sgt i32 %66, 0
br i1 %67, label %68, label %77
68: ; preds = %61
%69 = load i32, i32* %8
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %70
store i8 0, i8* %71
%72 = load i32, i32* @STDOUT_FILENO
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%74 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%75 = call i32 @strlen(i8* %74)
%76 = call i32 @write(i32 %72, i8* %73, i32 %75)
br label %90
77: ; preds = %61
%78 = load i32, i32* %8
%79 = icmp slt i32 %78, 0
br i1 %79, label %88, label %80
80: ; preds = %77
%81 = load i64, i64* @errno
%82 = load i64, i64* @EINTR
%83 = icmp ne i64 %81, %82
br i1 %83, label %84, label %89
84: ; preds = %80
%85 = load i64, i64* @errno
%86 = load i64, i64* @EAGAIN
%87 = icmp ne i64 %85, %86
br i1 %87, label %88, label %89
88: ; preds = %84, %77
store i32 1, i32* %9
br label %89
89: ; preds = %88, %84, %80
br label %90
90: ; preds = %89, %68
br label %57
91: ; preds = %57
%92 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%93 = load i32, i32* %92
%94 = call i32 @close(i32 %93)
%95 = load i32, i32* %2
%96 = call i32 @waitpid(i32 %95, i32* %7, i32 0)
%97 = load i32, i32* %7
%98 = call i64 @WIFEXITED(i32 %97)
%99 = icmp ne i64 %98, 0
br i1 %99, label %100, label %109
100: ; preds = %91
%101 = load i32, i32* %7
%102 = call i64 @WEXITSTATUS(i32 %101)
%103 = load i64, i64* @EXIT_FAILURE
%104 = icmp eq i64 %102, %103
br i1 %104, label %105, label %109
105: ; preds = %100
%106 = getelementptr inbounds [100 x i8*], [100 x i8*]* %10, i64 0, i64 0
%107 = load i32, i32* @STDOUT_FILENO
%108 = call i32 @backtrace_symbols_fd(i8** %106, i32 100, i32 %107)
store i32 -1, i32* %1
br label %112
109: ; preds = %100, %91
br label %110
110: ; preds = %109
br label %111
111: ; preds = %110
store i32 0, i32* %1
br label %112
112: ; preds = %111, %105, %19, %14
%113 = load i32, i32* %1
ret i32 %113
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"/usr/bin/pstack\00"
@.str.2 = [7 x i8] c"pstack\00"
@.str.3 = [18 x i8] c"/usr/bin/eu-stack\00"
@.str.4 = [9 x i8] c"eu-stack\00"
@.str.5 = [3 x i8] c"-p\00"
@.str.6 = [161 x i8] c"No tools to pretty print a stack trace for pid %d.\0AFallback to glibc backtrace which may not contain all symbols.\0A run eu-addr2line to pretty print the output.\0A\00"
@EXIT_FAILURE = global i64 0
@errno = global i64 0
@EINTR = global i64 0
@EAGAIN = global i64 0
define i32 @show_backtrace() {
%1 = alloca [2 x i32]
%2 = alloca [16 x i8]
%3 = alloca [512 x i8]
%4 = alloca [256 x i8]
%5 = alloca i32
%6 = alloca [100 x i8*]
%7 = bitcast [2 x i32]* %1 to i8*
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%9 = call i64 @pipe(i32* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %82
11: ; preds = %0
%12 = call i32 (...) @fork()
switch i32 %12, label %38 [
i32 -1, label %82
i32 0, label %13
]
13: ; preds = %11
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%16 = load i32, i32* @STDIN_FILENO
%17 = call i32 @close(i32 %16)
%18 = load i32, i32* @STDOUT_FILENO
%19 = call i32 @close(i32 %18)
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%21 = load i32, i32* %20
%22 = load i32, i32* @STDOUT_FILENO
%23 = call i32 @dup2(i32 %21, i32 %22)
%24 = load i32, i32* %20
%25 = load i32, i32* @STDERR_FILENO
%26 = call i32 @dup2(i32 %24, i32 %25)
%27 = call i32 (...) @getppid()
%28 = call i32 @snprintf(i8* %14, i32 16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = call i32 (i8*, i8*, i8*, i8*, i32*, ...) @execle(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* null, i32* null)
%30 = call i32 (i8*, i8*, i8*, i8*, i32*, ...) @execle(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %14, i32* null, i8* null)
%31 = call i32 (...) @getppid()
%32 = call i32 @sprintf(i8* %15, i8* dereferenceable(1) getelementptr inbounds ([161 x i8], [161 x i8]* @.str.6, i64 0, i64 0), i32 %31)
%33 = load i32, i32* @STDOUT_FILENO
%34 = call i32 @strlen(i8* %15)
%35 = call i32 @write(i32 %33, i8* %15, i32 %34)
%36 = load i64, i64* @EXIT_FAILURE
%37 = call i32 @exit(i64 %36)
unreachable
38: ; preds = %11
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%40 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%41 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%42 = load i32, i32* %41
%43 = call i32 @close(i32 %42)
br label %44
44: ; preds = %63, %38
%45 = load i32, i32* %8
%46 = call i32 @read(i32 %45, i8* %39, i32 255)
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %54
48: ; preds = %44
%49 = zext i32 %46 to i64
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %49
store i8 0, i8* %50
%51 = load i32, i32* @STDOUT_FILENO
%52 = call i32 @strlen(i8* %39)
%53 = call i32 @write(i32 %51, i8* %39, i32 %52)
br label %63
54: ; preds = %44
%55 = icmp slt i32 %46, 0
br i1 %55, label %64, label %56
56: ; preds = %54
%57 = load i64, i64* @errno
%58 = load i64, i64* @EINTR
%59 = icmp eq i64 %57, %58
%60 = load i64, i64* @EAGAIN
%61 = icmp eq i64 %57, %60
%62 = select i1 %59, i1 true, i1 %61
br i1 %62, label %63, label %64
63: ; preds = %56, %48
br label %44
64: ; preds = %54, %56
%65 = load i32, i32* %8
%66 = call i32 @close(i32 %65)
%67 = call i32 @waitpid(i32 %12, i32* %5, i32 0)
%68 = load i32, i32* %5
%69 = call i64 @WIFEXITED(i32 %68)
%70 = icmp eq i64 %69, 0
br i1 %70, label %81, label %71
71: ; preds = %64
%72 = load i32, i32* %5
%73 = call i64 @WEXITSTATUS(i32 %72)
%74 = load i64, i64* @EXIT_FAILURE
%75 = icmp eq i64 %73, %74
br i1 %75, label %76, label %81
76: ; preds = %71
%77 = bitcast [100 x i8*]* %6 to i8*
%78 = getelementptr inbounds [100 x i8*], [100 x i8*]* %6, i64 0, i64 0
%79 = load i32, i32* @STDOUT_FILENO
%80 = call i32 @backtrace_symbols_fd(i8** %78, i32 100, i32 %79)
br label %82
81: ; preds = %71, %64
br label %82
82: ; preds = %81, %76, %11, %0
%83 = phi i32 [ -1, %0 ], [ %12, %11 ], [ 0, %81 ], [ -1, %76 ]
ret i32 %83
}