#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*/ tmpfilename;
typedef int /*<<< orphan*/ count_str;
typedef int /*<<< orphan*/ cmd;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ close(int);
int errno;
scalar_t__ fchown(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ getuid();
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int mkstemp(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int system(char *);
int /*<<< orphan*/ unlink(char *);
int emc_check_fence(const char *sp_name, const char *sg_name,
                    const char *host) {
  char tmpfilename[80];
  char cmd[1000];
  char count_str[100];
  int count = 0;
  int fd;
  int status;
  FILE *tmpfile = NULL;
  snprintf(tmpfilename, sizeof(tmpfilename),
           "/tmp/gpdb_sg_lookup_results.XXXXXX");
  fd = mkstemp(tmpfilename);
  if (fd < 0) {
    fprintf(stderr, "failed to create sg_lookup-results file: %d\n", errno);
    return 0;
  }
  if (fchown(fd, getuid(), -1) < 0) {
    close(fd);
    unlink(tmpfilename);
    fprintf(stderr,
            "Storage-processor inquiry on sp %s storage-group %s host %s\n",
            sp_name, sg_name, host);
    return 0;
  }
  snprintf(cmd, sizeof(cmd),
           "/opt/Navisphere/bin/naviseccli -h %s storagegroup -list -gname %s "
           "-host | /usr/bin/grep %s | /usr/bin/wc -l >> %s",
           sp_name, sg_name, host, tmpfilename);
  fprintf(stdout, "cmd [%s]\n", cmd);
  status = system(cmd);
  if (status != 0) {
    close(fd);
    unlink(tmpfilename);
    fprintf(stderr,
            "Storage-processor inquiry on sp %s storage-group %s host %s\n",
            sp_name, sg_name, host);
    return 0;
  }
  tmpfile = fdopen(fd, "r");
  if (tmpfile == NULL) {
    close(fd);
    unlink(tmpfilename);
    fprintf(stderr, "Couldn't open %s for storage-group lookup results\n",
            tmpfilename);
    return 0;
  }
  memset(count_str, 0, sizeof(count_str));
  if (fgets(count_str, sizeof(count_str) - 1, tmpfile) == NULL) {
    int s_errno = errno;
    fclose(tmpfile);
    unlink(tmpfilename);
    fprintf(stderr, "Couldn't read results from storage-group lookup: %d\n",
            s_errno);
    return 0;
  }
  fclose(tmpfile);
  unlink(tmpfilename);
  count = atoi(count_str);
  return (count > 0) ? count : 0;
}


x86 assembly (clang, -O0):
<emc_check_fence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x500,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x4d4(%rbp)
movq   $0x0,-0x4e8(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x50,%esi
lea    0xdf4(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
lea    -0x70(%rbp),%rdi
call   10c0 <mkstemp@plt>
mov    %eax,-0x4d8(%rbp)
cmpl   $0x0,-0x4d8(%rbp)
jge    125b <emc_check_fence+0x8b>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
mov    0x2d99(%rip),%rax
mov    (%rax),%edx
lea    0xddb(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14ba <emc_check_fence+0x2ea>
mov    -0x4d8(%rbp),%eax
mov    %eax,-0x4f0(%rbp)
mov    $0x0,%al
call   1050 <getuid@plt>
mov    -0x4f0(%rbp),%edi
mov    %eax,%esi
mov    $0xffffffff,%edx
call   10e0 <fchown@plt>
cmp    $0x0,%rax
jge    12cd <emc_check_fence+0xfd>
mov    -0x4d8(%rbp),%edi
call   1090 <close@plt>
lea    -0x70(%rbp),%rdi
call   1030 <unlink@plt>
mov    0x2d3b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xd96(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14ba <emc_check_fence+0x2ea>
lea    -0x460(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    -0x70(%rbp),%rax
mov    $0x3e8,%esi
lea    0xd9d(%rip),%rdx
mov    %rax,(%rsp)
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    0x2cce(%rip),%rax
mov    (%rax),%edi
lea    -0x460(%rbp),%rdx
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
lea    -0x460(%rbp),%rdi
call   1060 <system@plt>
mov    %eax,-0x4dc(%rbp)
cmpl   $0x0,-0x4dc(%rbp)
je     137b <emc_check_fence+0x1ab>
mov    -0x4d8(%rbp),%edi
call   1090 <close@plt>
lea    -0x70(%rbp),%rdi
call   1030 <unlink@plt>
mov    0x2c8d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xce8(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14ba <emc_check_fence+0x2ea>
mov    -0x4d8(%rbp),%edi
lea    0xd81(%rip),%rsi
call   10d0 <fdopen@plt>
mov    %rax,-0x4e8(%rbp)
cmpq   $0x0,-0x4e8(%rbp)
jne    13dd <emc_check_fence+0x20d>
mov    -0x4d8(%rbp),%edi
call   1090 <close@plt>
lea    -0x70(%rbp),%rdi
call   1030 <unlink@plt>
mov    0x2c23(%rip),%rax
mov    (%rax),%edi
lea    -0x70(%rbp),%rdx
lea    0xd41(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14ba <emc_check_fence+0x2ea>
lea    -0x4d0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1080 <memset@plt>
lea    -0x4d0(%rbp),%rdi
mov    -0x4e8(%rbp),%rdx
mov    $0x63,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
jne    145f <emc_check_fence+0x28f>
mov    0x2bbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4ec(%rbp)
mov    -0x4e8(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x70(%rbp),%rdi
call   1030 <unlink@plt>
mov    0x2ba3(%rip),%rax
mov    (%rax),%edi
mov    -0x4ec(%rbp),%edx
lea    0xcf2(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14ba <emc_check_fence+0x2ea>
mov    -0x4e8(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x70(%rbp),%rdi
call   1030 <unlink@plt>
lea    -0x4d0(%rbp),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x4d4(%rbp)
cmpl   $0x0,-0x4d4(%rbp)
jle    14a4 <emc_check_fence+0x2d4>
mov    -0x4d4(%rbp),%eax
mov    %eax,-0x4f4(%rbp)
jmp    14b1 <emc_check_fence+0x2e1>
xor    %eax,%eax
mov    %eax,-0x4f4(%rbp)
jmp    14b1 <emc_check_fence+0x2e1>
mov    -0x4f4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x500,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emc_check_fence>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4b8,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xe0f(%rip),%rdx
xor    %r13d,%r13d
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    %rbx,%rdi
call   10c0 <mkstemp@plt>
test   %eax,%eax
js     12be <emc_check_fence+0xee>
mov    %eax,%ebp
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <getuid@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    $0xffffffff,%edx
call   10e0 <fchown@plt>
test   %rax,%rax
js     128b <emc_check_fence+0xbb>
mov    %rbx,(%rsp)
lea    0xe4b(%rip),%rdx
xor    %r13d,%r13d
lea    0xd0(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14,%r9
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
test   %eax,%eax
je     12f3 <emc_check_fence+0x123>
mov    %ebp,%edi
call   1090 <close@plt>
lea    0x10(%rsp),%rdi
call   1030 <unlink@plt>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
lea    0xda4(%rip),%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    12de <emc_check_fence+0x10e>
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
mov    0x2d0a(%rip),%rax
mov    (%rax),%edx
lea    0xd4c(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %r13d,%eax
add    $0x4b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe0f(%rip),%rsi
mov    %ebp,%edi
call   10d0 <fdopen@plt>
test   %rax,%rax
je     1359 <emc_check_fence+0x189>
mov    %rax,%rbx
lea    0x60(%rsp),%rbp
xor    %r13d,%r13d
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1080 <memset@plt>
mov    %rbp,%rdi
mov    $0x63,%esi
mov    %rbx,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     138f <emc_check_fence+0x1bf>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0x10(%rsp),%rdi
call   1030 <unlink@plt>
lea    0x60(%rsp),%rdi
call   10f0 <atoi@plt>
test   %eax,%eax
cmovns %eax,%r13d
jmp    12de <emc_check_fence+0x10e>
mov    %ebp,%edi
call   1090 <close@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    0x2c6c(%rip),%rax
mov    (%rax),%edi
lea    0xd8e(%rip),%rsi
xor    %r13d,%r13d
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    12de <emc_check_fence+0x10e>
mov    0x2c42(%rip),%rax
mov    (%rax),%ebp
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0x10(%rsp),%rdi
call   1030 <unlink@plt>
mov    0x2c2f(%rip),%rax
mov    (%rax),%edi
lea    0xd84(%rip),%rsi
mov    %ebp,%edx
jmp    12d7 <emc_check_fence+0x107>

LLVM IR (-O0):
@.str = [35 x i8] c"/tmp/gpdb_sg_lookup_results.XXXXXX\00"
@stderr = global i32 0
@.str.1 = [45 x i8] c"failed to create sg_lookup-results file: %d\0A\00"
@errno = global i32 0
@.str.2 = [61 x i8] c"Storage-processor inquiry on sp %s storage-group %s host %s\0A\00"
@.str.3 = [114 x i8] c"/opt/Navisphere/bin/naviseccli -h %s storagegroup -list -gname %s -host | /usr/bin/grep %s | /usr/bin/wc -l >> %s\00"
@stdout = global i32 0
@.str.4 = [10 x i8] c"cmd [%s]\0A\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [51 x i8] c"Couldn't open %s for storage-group lookup results\0A\00"
@.str.7 = [53 x i8] c"Couldn't read results from storage-group lookup: %d\0A\00"
define i32 @emc_check_fence(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [80 x i8]
%9 = alloca [1000 x i8]
%10 = alloca [100 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 0, i32* %11
store i32* null, i32** %14
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%17 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %16, i32 80, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%19 = call i32 @mkstemp(i8* %18)
store i32 %19, i32* %12
%20 = load i32, i32* %12
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %3
%23 = load i32, i32* @stderr
%24 = load i32, i32* @errno
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %24)
store i32 0, i32* %4
br label %108
26: ; preds = %3
%27 = load i32, i32* %12
%28 = call i32 (...) @getuid()
%29 = call i64 @fchown(i32 %27, i32 %28, i32 -1)
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %41
31: ; preds = %26
%32 = load i32, i32* %12
%33 = call i32 @close(i32 %32)
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%35 = call i32 @unlink(i8* %34)
%36 = load i32, i32* @stderr
%37 = load i8*, i8** %5
%38 = load i8*, i8** %6
%39 = load i8*, i8** %7
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i8* %37, i8* %38, i8* %39)
store i32 0, i32* %4
br label %108
41: ; preds = %26
%42 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%43 = load i8*, i8** %5
%44 = load i8*, i8** %6
%45 = load i8*, i8** %7
%46 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%47 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %42, i32 1000, i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.3, i64 0, i64 0), i8* %43, i8* %44, i8* %45, i8* %46)
%48 = load i32, i32* @stdout
%49 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %49)
%51 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%52 = call i32 @system(i8* %51)
store i32 %52, i32* %13
%53 = load i32, i32* %13
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %65
55: ; preds = %41
%56 = load i32, i32* %12
%57 = call i32 @close(i32 %56)
%58 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%59 = call i32 @unlink(i8* %58)
%60 = load i32, i32* @stderr
%61 = load i8*, i8** %5
%62 = load i8*, i8** %6
%63 = load i8*, i8** %7
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i8* %61, i8* %62, i8* %63)
store i32 0, i32* %4
br label %108
65: ; preds = %41
%66 = load i32, i32* %12
%67 = call i32* @fdopen(i32 %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %67, i32** %14
%68 = load i32*, i32** %14
%69 = icmp eq i32* %68, null
br i1 %69, label %70, label %78
70: ; preds = %65
%71 = load i32, i32* %12
%72 = call i32 @close(i32 %71)
%73 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%74 = call i32 @unlink(i8* %73)
%75 = load i32, i32* @stderr
%76 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i8* %76)
store i32 0, i32* %4
br label %108
78: ; preds = %65
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%80 = call i32 @memset(i8* %79, i32 0, i32 100)
%81 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%82 = load i32*, i32** %14
%83 = call i32* @fgets(i8* %81, i32 99, i32* %82)
%84 = icmp eq i32* %83, null
br i1 %84, label %85, label %94
85: ; preds = %78
%86 = load i32, i32* @errno
store i32 %86, i32* %15
%87 = load i32*, i32** %14
%88 = call i32 @fclose(i32* %87)
%89 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%90 = call i32 @unlink(i8* %89)
%91 = load i32, i32* @stderr
%92 = load i32, i32* %15
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0), i32 %92)
store i32 0, i32* %4
br label %108
94: ; preds = %78
%95 = load i32*, i32** %14
%96 = call i32 @fclose(i32* %95)
%97 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%98 = call i32 @unlink(i8* %97)
%99 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%100 = call i32 @atoi(i8* %99)
store i32 %100, i32* %11
%101 = load i32, i32* %11
%102 = icmp sgt i32 %101, 0
br i1 %102, label %103, label %105
103: ; preds = %94
%104 = load i32, i32* %11
br label %106
105: ; preds = %94
br label %106
106: ; preds = %105, %103
%107 = phi i32 [ %104, %103 ], [ 0, %105 ]
store i32 %107, i32* %4
br label %108
108: ; preds = %106, %85, %70, %55, %31, %22
%109 = load i32, i32* %4
ret i32 %109
}

LLVM IR (-O2):
@.str = [35 x i8] c"/tmp/gpdb_sg_lookup_results.XXXXXX\00"
@stderr = global i32 0
@.str.1 = [45 x i8] c"failed to create sg_lookup-results file: %d\0A\00"
@errno = global i32 0
@.str.2 = [61 x i8] c"Storage-processor inquiry on sp %s storage-group %s host %s\0A\00"
@.str.3 = [114 x i8] c"/opt/Navisphere/bin/naviseccli -h %s storagegroup -list -gname %s -host | /usr/bin/grep %s | /usr/bin/wc -l >> %s\00"
@stdout = global i32 0
@.str.4 = [10 x i8] c"cmd [%s]\0A\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [51 x i8] c"Couldn't open %s for storage-group lookup results\0A\00"
@.str.7 = [53 x i8] c"Couldn't read results from storage-group lookup: %d\0A\00"
define i32 @emc_check_fence(i8* %0, i8* %1, i8* %2) {
%4 = alloca [80 x i8]
%5 = alloca [1000 x i8]
%6 = alloca [100 x i8]
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%10 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %7, i32 80, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @mkstemp(i8* %7)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = load i32, i32* @errno
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %61
17: ; preds = %3
%18 = call i32 (...) @getuid()
%19 = call i64 @fchown(i32 %11, i32 %18, i32 -1)
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = call i32 @close(i32 %11)
%23 = call i32 @unlink(i8* %7)
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
br label %61
26: ; preds = %17
%27 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %8, i32 1000, i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* %1, i8* %2, i8* %7)
%28 = load i32, i32* @stdout
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%30 = call i32 @system(i8* %8)
%31 = icmp eq i32 %30, 0
br i1 %31, label %37, label %32
32: ; preds = %26
%33 = call i32 @close(i32 %11)
%34 = call i32 @unlink(i8* %7)
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
br label %61
37: ; preds = %26
%38 = call i32* @fdopen(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i32* %38, null
br i1 %39, label %40, label %45
40: ; preds = %37
%41 = call i32 @close(i32 %11)
%42 = call i32 @unlink(i8* %7)
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i8* %7)
br label %61
45: ; preds = %37
%46 = call i32 @memset(i8* %9, i32 0, i32 100)
%47 = call i32* @fgets(i8* %9, i32 99, i32* %38)
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %55
49: ; preds = %45
%50 = load i32, i32* @errno
%51 = call i32 @fclose(i32* %38)
%52 = call i32 @unlink(i8* %7)
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0), i32 %50)
br label %61
55: ; preds = %45
%56 = call i32 @fclose(i32* %38)
%57 = call i32 @unlink(i8* %7)
%58 = call i32 @atoi(i8* %9)
%59 = icmp sgt i32 %58, 0
%60 = select i1 %59, i32 %58, i32 0
br label %61
61: ; preds = %55, %49, %40, %32, %21, %13
%62 = phi i32 [ 0, %13 ], [ 0, %21 ], [ 0, %32 ], [ 0, %40 ], [ 0, %49 ], [ %60, %55 ]
ret i32 %62
}