#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*/ path;
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ execlp(char *, char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, long);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
long strtol(char *, int /*<<< orphan*/ *, int);
int tcgetpgrp(int);
int main(int argc, char **argv) {
  if (argc != 3) {
    fprintf(stderr, "usage: tilix-flatpak-toolbox <command> <arg>\n");
    return 1;
  }
  if (strcmp(argv[1], "get-passwd") == 0) {
    execlp("getent", "getent", "passwd", argv[2], NULL);
    perror("error calling execlp");
    return 1;
  } else if (strcmp(argv[1], "get-child-pid") == 0) {
    pid_t pid = tcgetpgrp(3);
    if (pid == -1) {
      perror("error calling tcgetpgrp");
      return 1;
    }
    printf("%ld\n", (long)pid);
  } else if (strcmp(argv[1], "get-proc-stat") == 0) {
    long value = strtol(argv[2], NULL, 10);
    char path[32];
    snprintf(path, sizeof(path), "/proc/%lu/stat", value);
    FILE *fp = fopen(path, "r");
    if (fp == NULL) {
      perror("error opening /proc/<pid>/stat");
      return 1;
    }
    for (;;) {
      char buf[1024];
      int sz = fread(buf, 1, sizeof(buf) - 1, fp);
      buf[sz] = 0;
      printf("%s", buf);
      if (sz < sizeof(buf)) {
        if (feof(fp)) {
          break;
        } else if (ferror(fp)) {
          perror("error reading from /proc/<pid>/stat");
          fclose(fp);
          return 1;
        }
      }
    }
    fclose(fp);
    fflush(stdout);
  } else {
    fprintf(stderr, "Invalid command: %s\n", argv[1]);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1226 <main+0x46>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    147a <main+0x29a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf9(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    127f <main+0x9f>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xde6(%rip),%rsi
lea    0xdd8(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1100 <execlp@plt>
lea    0xdd2(%rip),%rdi
call   10f0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    147a <main+0x29a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc7(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12e3 <main+0x103>
mov    $0x3,%edi
call   10c0 <tcgetpgrp@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    12cc <main+0xec>
lea    0xda8(%rip),%rdi
call   10f0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    147a <main+0x29a>
movslq -0x14(%rbp),%rsi
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    146e <main+0x28e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd8e(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    143e <main+0x25e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10b0 <strtol@plt>
mov    %rax,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x20,%esi
lea    0xd5f(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0x40(%rbp),%rdi
lea    0xd5e(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    136b <main+0x18b>
lea    0xd45(%rip),%rdi
call   10f0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    147a <main+0x29a>
jmp    1370 <main+0x190>
lea    -0x450(%rbp),%rdi
mov    -0x48(%rbp),%rcx
mov    $0x1,%esi
mov    $0x3ff,%edx
call   1040 <fread@plt>
mov    %eax,-0x454(%rbp)
movslq -0x454(%rbp),%rax
movb   $0x0,-0x450(%rbp,%rax,1)
lea    -0x450(%rbp),%rsi
lea    0xd11(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movslq -0x454(%rbp),%rax
cmp    $0x400,%rax
jae    141d <main+0x23d>
mov    -0x48(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x0,%rax
je     13df <main+0x1ff>
jmp    1422 <main+0x242>
mov    -0x48(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     1413 <main+0x233>
lea    0xcc8(%rip),%rdi
call   10f0 <perror@plt>
mov    -0x48(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    147a <main+0x29a>
jmp    1418 <main+0x238>
jmp    141d <main+0x23d>
jmp    1370 <main+0x190>
mov    -0x48(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2ba6(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
jmp    1469 <main+0x289>
mov    0x2b9b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xc8f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    147a <main+0x29a>
jmp    146e <main+0x28e>
jmp    1473 <main+0x293>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x428,%rsp
cmp    $0x3,%edi
jne    1256 <main+0x76>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe2d(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1382 <main+0x1a2>
mov    0x8(%rbx),%rdi
lea    0xe3b(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1283 <main+0xa3>
mov    0x8(%rbx),%rdi
lea    0xe51(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12ab <main+0xcb>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe98(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    126d <main+0x8d>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
lea    0xd9a(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    $0x3,%edi
call   10c0 <tcgetpgrp@plt>
cmp    $0xffffffff,%eax
je     13b0 <main+0x1d0>
movslq %eax,%rsi
lea    0xddb(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1272 <main+0x92>
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10b0 <strtol@plt>
lea    0xdcc(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %rax,%rcx
call   1070 <snprintf@plt>
lea    0xdc1(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     13c1 <main+0x1e1>
mov    %rax,%r12
lea    0x20(%rsp),%r14
lea    0xdc2(%rip),%r15
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3ff,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
movslq %eax,%rbx
movb   $0x0,0x20(%rsp,%rbx,1)
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x3ff,%ebx
ja     1300 <main+0x120>
mov    %r12,%rdi
call   10a0 <feof@plt>
test   %rax,%rax
jne    1365 <main+0x185>
mov    %r12,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
je     1300 <main+0x120>
lea    0xd6e(%rip),%rdi
call   10f0 <perror@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
jmp    126d <main+0x8d>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    0x2c64(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
xor    %ebx,%ebx
jmp    1272 <main+0x92>
mov    0x10(%rbx),%rcx
lea    0xcac(%rip),%rdi
lea    0xc9e(%rip),%rdx
mov    %rdi,%rsi
xor    %r8d,%r8d
call   1100 <execlp@plt>
lea    0xc9a(%rip),%rdi
call   10f0 <perror@plt>
jmp    126d <main+0x8d>
lea    0xcac(%rip),%rdi
call   10f0 <perror@plt>
jmp    126d <main+0x8d>
lea    0xcd7(%rip),%rdi
call   10f0 <perror@plt>
jmp    126d <main+0x8d>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"usage: tilix-flatpak-toolbox <command> <arg>\0A\00"
@.str.1 = [11 x i8] c"get-passwd\00"
@.str.2 = [7 x i8] c"getent\00"
@.str.3 = [7 x i8] c"passwd\00"
@.str.4 = [21 x i8] c"error calling execlp\00"
@.str.5 = [14 x i8] c"get-child-pid\00"
@.str.6 = [24 x i8] c"error calling tcgetpgrp\00"
@.str.7 = [5 x i8] c"%ld\0A\00"
@.str.8 = [14 x i8] c"get-proc-stat\00"
@.str.9 = [15 x i8] c"/proc/%lu/stat\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [31 x i8] c"error opening /proc/<pid>/stat\00"
@.str.12 = [3 x i8] c"%s\00"
@.str.13 = [36 x i8] c"error reading from /proc/<pid>/stat\00"
@stdout = global i32 0
@.str.14 = [21 x i8] c"Invalid command: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca [32 x i8]
%9 = alloca i32*
%10 = alloca [1024 x i8]
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %108
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %17
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @execlp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %26, i32* null)
%28 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %108
29: ; preds = %17
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %45
35: ; preds = %29
%36 = call i32 @tcgetpgrp(i32 3)
store i32 %36, i32* %6
%37 = load i32, i32* %6
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %108
41: ; preds = %35
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i64 %43)
br label %106
45: ; preds = %29
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %99
51: ; preds = %45
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i64 @strtol(i8* %54, i32* null, i32 10)
store i64 %55, i64* %7
%56 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%57 = load i64, i64* %7
%58 = call i32 @snprintf(i8* %56, i32 32, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i64 %57)
%59 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%60 = call i32* @fopen(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %60, i32** %9
%61 = load i32*, i32** %9
%62 = icmp eq i32* %61, null
br i1 %62, label %63, label %65
63: ; preds = %51
%64 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %108
65: ; preds = %51
br label %66
66: ; preds = %93, %65
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%68 = load i32*, i32** %9
%69 = call i32 @fread(i8* %67, i32 1, i32 1023, i32* %68)
store i32 %69, i32* %11
%70 = load i32, i32* %11
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %71
store i8 0, i8* %72
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %73)
%75 = load i32, i32* %11
%76 = sext i32 %75 to i64
%77 = icmp ult i64 %76, 1024
br i1 %77, label %78, label %93
78: ; preds = %66
%79 = load i32*, i32** %9
%80 = call i64 @feof(i32* %79)
%81 = icmp ne i64 %80, 0
br i1 %81, label %82, label %83
82: ; preds = %78
br label %94
83: ; preds = %78
%84 = load i32*, i32** %9
%85 = call i64 @ferror(i32* %84)
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %91
87: ; preds = %83
%88 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.13, i64 0, i64 0))
%89 = load i32*, i32** %9
%90 = call i32 @fclose(i32* %89)
store i32 1, i32* %3
br label %108
91: ; preds = %83
br label %92
92: ; preds = %91
br label %93
93: ; preds = %92, %66
br label %66
94: ; preds = %82
%95 = load i32*, i32** %9
%96 = call i32 @fclose(i32* %95)
%97 = load i32, i32* @stdout
%98 = call i32 @fflush(i32 %97)
br label %105
99: ; preds = %45
%100 = load i32, i32* @stderr
%101 = load i8**, i8*** %5
%102 = getelementptr inbounds i8*, i8** %101, i64 1
%103 = load i8*, i8** %102
%104 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* %103)
store i32 1, i32* %3
br label %108
105: ; preds = %94
br label %106
106: ; preds = %105, %41
br label %107
107: ; preds = %106
store i32 0, i32* %3
br label %108
108: ; preds = %107, %99, %87, %63, %39, %23, %14
%109 = load i32, i32* %3
ret i32 %109
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"usage: tilix-flatpak-toolbox <command> <arg>\0A\00"
@.str.1 = [11 x i8] c"get-passwd\00"
@.str.2 = [7 x i8] c"getent\00"
@.str.3 = [7 x i8] c"passwd\00"
@.str.4 = [21 x i8] c"error calling execlp\00"
@.str.5 = [14 x i8] c"get-child-pid\00"
@.str.6 = [24 x i8] c"error calling tcgetpgrp\00"
@.str.7 = [5 x i8] c"%ld\0A\00"
@.str.8 = [14 x i8] c"get-proc-stat\00"
@.str.9 = [15 x i8] c"/proc/%lu/stat\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [31 x i8] c"error opening /proc/<pid>/stat\00"
@.str.12 = [3 x i8] c"%s\00"
@.str.13 = [36 x i8] c"error reading from /proc/<pid>/stat\00"
@stdout = global i32 0
@.str.14 = [21 x i8] c"Invalid command: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i8]
%4 = alloca [1024 x i8]
%5 = icmp eq i32 %0, 3
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %72
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @execlp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %16, i32* null)
%18 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %72
19: ; preds = %9
%20 = load i8*, i8** %10
%21 = tail call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %19
%24 = tail call i32 @tcgetpgrp(i32 3)
%25 = icmp eq i32 %24, -1
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = sext i32 %24 to i64
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i64 %27)
br label %72
29: ; preds = %23
%30 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %72
31: ; preds = %19
%32 = load i8*, i8** %10
%33 = tail call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %68
35: ; preds = %31
%36 = getelementptr inbounds i8*, i8** %1, i64 2
%37 = load i8*, i8** %36
%38 = tail call i64 @strtol(i8* nocapture %37, i32* null, i32 10)
%39 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%40 = call i32 @snprintf(i8* %39, i32 32, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i64 %38)
%41 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%42 = icmp eq i32* %41, null
br i1 %42, label %45, label %43
43: ; preds = %35
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
br label %47
45: ; preds = %35
%46 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
br label %63
47: ; preds = %43, %62
%48 = call i32 @fread(i8* %44, i32 1, i32 1023, i32* %41)
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %49
store i8 0, i8* %50
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %44)
%52 = icmp ult i32 %48, 1024
br i1 %52, label %53, label %62
53: ; preds = %47
%54 = call i64 @feof(i32* %41)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %64
56: ; preds = %53
%57 = call i64 @ferror(i32* %41)
%58 = icmp eq i64 %57, 0
br i1 %58, label %62, label %59
59: ; preds = %56
%60 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.13, i64 0, i64 0))
%61 = call i32 @fclose(i32* %41)
br label %63
62: ; preds = %47, %56
br label %47
63: ; preds = %45, %59
br label %72
64: ; preds = %53
%65 = call i32 @fclose(i32* %41)
%66 = load i32, i32* @stdout
%67 = call i32 @fflush(i32 %66)
br label %72
68: ; preds = %31
%69 = load i32, i32* @stderr
%70 = load i8*, i8** %10
%71 = tail call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* %70)
br label %72
72: ; preds = %26, %64, %63, %29, %68, %14, %6
%73 = phi i32 [ 1, %6 ], [ 1, %14 ], [ 1, %29 ], [ 1, %68 ], [ 1, %63 ], [ 0, %64 ], [ 0, %26 ]
ret i32 %73
}