#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 scalar_t__ ssize_t;
typedef int pid_t;
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
scalar_t__ EINTR;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ close(int);
int dup2(int, int /*<<< orphan*/);
scalar_t__ errno;
int /*<<< orphan*/ execl(char *, char *, char *, char *, char *, char *, char *,
                         char *, char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ gpu_cardlist_fill(char *, int **, int **);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ pipe(int *);
scalar_t__ read(int, char *, int);
int *realloc(int *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int *lsgpu(int *size) {
  pid_t pid;
  int *list = NULL, *end = NULL;
  int pipefd[2];
  char buffer[4096];
  ssize_t nb;
  *size = 0;
  pipe(pipefd);
  if ((pid = fork()) == -1) {
    fprintf(stderr, "lsgpu: fork() failed\n");
    return NULL;
  } else if (pid == 0) {
    while (dup2(pipefd[1], STDOUT_FILENO) == -1 && errno == EINTR)
      ;
    close(pipefd[1]);
    close(pipefd[0]);
    execl("/usr/bin/find", "/usr/bin/find", "/sys/class/drm/", "-regextype",
          "posix-extended", "-regex", ".+card[0-9]+$", "-exec", "basename",
          "{}", ";", NULL);
    perror("execl(): ");
    exit(EXIT_FAILURE);
  } else {
    close(pipefd[1]);
    do {
      nb = read(pipefd[0], buffer, sizeof(buffer));
      if (nb > 0)
        gpu_cardlist_fill(buffer, &list, &end);
    } while (errno == EINTR || nb > 0);
    *size = end - list;
    close(pipefd[0]);
    waitpid(pid, NULL, 0);
  }
  if (*size == 0) {
    free(list);
    list = NULL;
  } else
    list = realloc(list, *size * sizeof(int));
  return list;
}


x86 assembly (clang, -O0):
<lsgpu>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x1070,%rsp
mov    %rdi,-0x20(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
lea    -0x40(%rbp),%rdi
call   1060 <pipe@plt>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    123a <lsgpu+0x6a>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
lea    0xdd8(%rip),%rsi
call   1080 <fprintf@plt>
movq   $0x0,-0x18(%rbp)
jmp    143f <lsgpu+0x26f>
cmpl   $0x0,-0x24(%rbp)
jne    133d <lsgpu+0x16d>
jmp    1249 <lsgpu+0x79>
mov    -0x3c(%rbp),%edi
mov    0x2d9d(%rip),%rax
mov    (%rax),%esi
call   1040 <dup2@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x1049(%rbp)
jne    128a <lsgpu+0xba>
mov    0x2d5c(%rip),%rax
mov    (%rax),%rax
mov    0x2d42(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x1049(%rbp)
mov    -0x1049(%rbp),%al
test   $0x1,%al
jne    129d <lsgpu+0xcd>
jmp    12a2 <lsgpu+0xd2>
jmp    1249 <lsgpu+0x79>
mov    -0x3c(%rbp),%edi
call   1050 <close@plt>
mov    -0x40(%rbp),%edi
call   1050 <close@plt>
lea    0xd5d(%rip),%rsi
lea    0xd64(%rip),%rdx
lea    0xd6d(%rip),%rcx
lea    0xd71(%rip),%r8
lea    0xd79(%rip),%r9
lea    0xd79(%rip),%r14
lea    0xd80(%rip),%rbx
lea    0xd7f(%rip),%r11
lea    0xd81(%rip),%r10
lea    0xd7d(%rip),%rax
xor    %edi,%edi
mov    %rsi,%rdi
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
movq   $0x0,0x28(%rsp)
call   10e0 <execl@plt>
lea    0xd4d(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2c92(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x3c(%rbp),%edi
call   1050 <close@plt>
mov    -0x40(%rbp),%edi
lea    -0x1040(%rbp),%rsi
mov    $0x1000,%edx
call   1070 <read@plt>
mov    %rax,-0x1048(%rbp)
cmpq   $0x0,-0x1048(%rbp)
jle    1382 <lsgpu+0x1b2>
lea    -0x1040(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   10c0 <gpu_cardlist_fill@plt>
jmp    1387 <lsgpu+0x1b7>
mov    0x2c42(%rip),%rax
mov    (%rax),%rcx
mov    $0x1,%al
mov    0x2c26(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x104a(%rbp)
je     13ba <lsgpu+0x1ea>
cmpq   $0x0,-0x1048(%rbp)
setg   %al
mov    %al,-0x104a(%rbp)
mov    -0x104a(%rbp),%al
test   $0x1,%al
jne    1345 <lsgpu+0x175>
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%edi
call   1050 <close@plt>
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10a0 <waitpid@plt>
jmp    13fa <lsgpu+0x22a>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    141d <lsgpu+0x24d>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x30(%rbp)
jmp    1437 <lsgpu+0x267>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%esi
call   1090 <realloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1070,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsgpu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1038,%rsp
mov    %rdi,%rbx
movq   $0x0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
movl   $0x0,(%rdi)
lea    0x8(%rsp),%rdi
call   1060 <pipe@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
cmp    $0xffffffff,%eax
je     12c4 <lsgpu+0xf4>
mov    %rbx,0x28(%rsp)
mov    %eax,0x1c(%rsp)
test   %eax,%eax
je     12f4 <lsgpu+0x124>
mov    0xc(%rsp),%edi
call   1050 <close@plt>
lea    0x30(%rsp),%rbx
lea    0x10(%rsp),%r12
lea    0x20(%rsp),%r13
mov    0x2d8a(%rip),%r14
mov    0x2d73(%rip),%r15
nopl   (%rax)
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
mov    $0x1000,%edx
call   1070 <read@plt>
mov    %rax,%rbp
test   %rax,%rax
jle    1277 <lsgpu+0xa7>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   10c0 <gpu_cardlist_fill@plt>
test   %rbp,%rbp
jg     1250 <lsgpu+0x80>
mov    (%r15),%rax
cmp    %rax,(%r14)
je     1250 <lsgpu+0x80>
mov    0x20(%rsp),%rax
sub    0x10(%rsp),%rax
shr    $0x2,%rax
mov    0x28(%rsp),%rbx
mov    %eax,(%rbx)
mov    0x8(%rsp),%edi
call   1050 <close@plt>
mov    0x1c(%rsp),%edi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <waitpid@plt>
mov    (%rbx),%esi
mov    0x10(%rsp),%rdi
test   %esi,%esi
je     12db <lsgpu+0x10b>
shl    $0x2,%esi
call   1090 <realloc@plt>
jmp    12e2 <lsgpu+0x112>
mov    0x2d0d(%rip),%rax
mov    (%rax),%edi
lea    0xd2c(%rip),%rsi
call   1080 <fprintf@plt>
jmp    12e0 <lsgpu+0x110>
call   1030 <free@plt>
xor    %eax,%eax
add    $0x1038,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cf5(%rip),%r14
mov    0x2cce(%rip),%rbp
mov    0x2cb7(%rip),%rbx
nopl   0x0(%rax)
mov    0xc(%rsp),%edi
mov    (%r14),%esi
call   1040 <dup2@plt>
cmp    $0xffffffff,%eax
jne    132a <lsgpu+0x15a>
mov    (%rbx),%rax
cmp    %rax,0x0(%rbp)
je     1310 <lsgpu+0x140>
mov    0xc(%rsp),%edi
call   1050 <close@plt>
mov    0x8(%rsp),%edi
call   1050 <close@plt>
lea    0xd32(%rip),%rax
lea    0xd28(%rip),%rbp
lea    0xd18(%rip),%rbx
lea    0xd0b(%rip),%r10
lea    0xcf6(%rip),%r11
lea    0xcb0(%rip),%rdi
lea    0xcb7(%rip),%rdx
lea    0xcc0(%rip),%rcx
lea    0xcc4(%rip),%r8
lea    0xccc(%rip),%r9
mov    %rdi,%rsi
push   $0x0
push   %rax
push   %rbp
push   %rbx
push   %r10
push   %r11
call   10e0 <execl@plt>
add    $0x30,%rsp
lea    0xcd9(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2c1e(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"lsgpu: fork() failed\0A\00"
@STDOUT_FILENO = global i32 0
@errno = global i64 0
@EINTR = global i64 0
@.str.1 = [14 x i8] c"/usr/bin/find\00"
@.str.2 = [16 x i8] c"/sys/class/drm/\00"
@.str.3 = [11 x i8] c"-regextype\00"
@.str.4 = [15 x i8] c"posix-extended\00"
@.str.5 = [7 x i8] c"-regex\00"
@.str.6 = [14 x i8] c".+card[0-9]+$\00"
@.str.7 = [6 x i8] c"-exec\00"
@.str.8 = [9 x i8] c"basename\00"
@.str.9 = [3 x i8] c"{}\00"
@.str.10 = [2 x i8] c";\00"
@.str.11 = [10 x i8] c"execl(): \00"
@EXIT_FAILURE = global i32 0
define i32* @lsgpu(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca [2 x i32]
%8 = alloca [4096 x i8]
%9 = alloca i64
store i32* %0, i32** %3
store i32* null, i32** %5
store i32* null, i32** %6
%10 = load i32*, i32** %3
store i32 0, i32* %10
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%12 = call i32 @pipe(i32* %11)
%13 = call i32 (...) @fork()
store i32 %13, i32* %4
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %1
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32* null, i32** %2
br label %102
18: ; preds = %1
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %46
21: ; preds = %18
br label %22
22: ; preds = %34, %21
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%24 = load i32, i32* %23
%25 = load i32, i32* @STDOUT_FILENO
%26 = call i32 @dup2(i32 %24, i32 %25)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %32
28: ; preds = %22
%29 = load i64, i64* @errno
%30 = load i64, i64* @EINTR
%31 = icmp eq i64 %29, %30
br label %32
32: ; preds = %28, %22
%33 = phi i1 [ false, %22 ], [ %31, %28 ]
br i1 %33, label %34, label %35
34: ; preds = %32
br label %22
35: ; preds = %32
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%37 = load i32, i32* %36
%38 = call i32 @close(i32 %37)
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%40 = load i32, i32* %39
%41 = call i32 @close(i32 %40)
%42 = call i32 @execl(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32* null)
%43 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%44 = load i32, i32* @EXIT_FAILURE
%45 = call i32 @exit(i32 %44)
unreachable
46: ; preds = %18
%47 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%48 = load i32, i32* %47
%49 = call i32 @close(i32 %48)
br label %50
50: ; preds = %68, %46
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%52 = load i32, i32* %51
%53 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%54 = call i64 @read(i32 %52, i8* %53, i32 4096)
store i64 %54, i64* %9
%55 = load i64, i64* %9
%56 = icmp sgt i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %50
%58 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%59 = call i32 @gpu_cardlist_fill(i8* %58, i32** %5, i32** %6)
br label %60
60: ; preds = %57, %50
br label %61
61: ; preds = %60
%62 = load i64, i64* @errno
%63 = load i64, i64* @EINTR
%64 = icmp eq i64 %62, %63
br i1 %64, label %68, label %65
65: ; preds = %61
%66 = load i64, i64* %9
%67 = icmp sgt i64 %66, 0
br label %68
68: ; preds = %65, %61
%69 = phi i1 [ true, %61 ], [ %67, %65 ]
br i1 %69, label %50, label %70
70: ; preds = %68
%71 = load i32*, i32** %6
%72 = load i32*, i32** %5
%73 = ptrtoint i32* %71 to i64
%74 = ptrtoint i32* %72 to i64
%75 = sub i64 %73, %74
%76 = sdiv exact i64 %75, 4
%77 = trunc i64 %76 to i32
%78 = load i32*, i32** %3
store i32 %77, i32* %78
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%80 = load i32, i32* %79
%81 = call i32 @close(i32 %80)
%82 = load i32, i32* %4
%83 = call i32 @waitpid(i32 %82, i32* null, i32 0)
br label %84
84: ; preds = %70
br label %85
85: ; preds = %84
%86 = load i32*, i32** %3
%87 = load i32, i32* %86
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %92
89: ; preds = %85
%90 = load i32*, i32** %5
%91 = call i32 @free(i32* %90)
store i32* null, i32** %5
br label %100
92: ; preds = %85
%93 = load i32*, i32** %5
%94 = load i32*, i32** %3
%95 = load i32, i32* %94
%96 = sext i32 %95 to i64
%97 = mul i64 %96, 4
%98 = trunc i64 %97 to i32
%99 = call i32* @realloc(i32* %93, i32 %98)
store i32* %99, i32** %5
br label %100
100: ; preds = %92, %89
%101 = load i32*, i32** %5
store i32* %101, i32** %2
br label %102
102: ; preds = %100, %15
%103 = load i32*, i32** %2
ret i32* %103
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"lsgpu: fork() failed\0A\00"
@STDOUT_FILENO = global i32 0
@errno = global i64 0
@EINTR = global i64 0
@.str.1 = [14 x i8] c"/usr/bin/find\00"
@.str.2 = [16 x i8] c"/sys/class/drm/\00"
@.str.3 = [11 x i8] c"-regextype\00"
@.str.4 = [15 x i8] c"posix-extended\00"
@.str.5 = [7 x i8] c"-regex\00"
@.str.6 = [14 x i8] c".+card[0-9]+$\00"
@.str.7 = [6 x i8] c"-exec\00"
@.str.8 = [9 x i8] c"basename\00"
@.str.9 = [3 x i8] c"{}\00"
@.str.10 = [2 x i8] c";\00"
@.str.11 = [10 x i8] c"execl(): \00"
@EXIT_FAILURE = global i32 0
define i32* @lsgpu(i32* nocapture %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca [2 x i32]
%5 = alloca [4096 x i8]
%6 = bitcast i32** %2 to i8*
store i32* null, i32** %2
%7 = bitcast i32** %3 to i8*
store i32* null, i32** %3
%8 = bitcast [2 x i32]* %4 to i8*
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
store i32 0, i32* %0
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%11 = call i32 @pipe(i32* %10)
%12 = call i32 (...) @fork()
switch i32 %12, label %36 [
i32 -1, label %15
i32 0, label %13
]
13: ; preds = %1
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
br label %18
15: ; preds = %1
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %70
18: ; preds = %13, %18
%19 = load i32, i32* %14
%20 = load i32, i32* @STDOUT_FILENO
%21 = call i32 @dup2(i32 %19, i32 %20)
%22 = icmp eq i32 %21, -1
%23 = load i64, i64* @errno
%24 = load i64, i64* @EINTR
%25 = icmp eq i64 %23, %24
%26 = select i1 %22, i1 %25, i1 false
br i1 %26, label %18, label %27
27: ; preds = %18
%28 = load i32, i32* %14
%29 = call i32 @close(i32 %28)
%30 = load i32, i32* %10
%31 = call i32 @close(i32 %30)
%32 = call i32 @execl(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32* null)
%33 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%34 = load i32, i32* @EXIT_FAILURE
%35 = call i32 @exit(i32 %34)
unreachable
36: ; preds = %1
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%38 = load i32, i32* %37
%39 = call i32 @close(i32 %38)
br label %40
40: ; preds = %46, %36
%41 = load i32, i32* %10
%42 = call i64 @read(i32 %41, i8* %9, i32 4096)
%43 = icmp sgt i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = call i32 @gpu_cardlist_fill(i8* %9, i32** %2, i32** %3)
br label %46
46: ; preds = %40, %44
%47 = load i64, i64* @errno
%48 = load i64, i64* @EINTR
%49 = icmp eq i64 %47, %48
%50 = or i1 %43, %49
br i1 %50, label %40, label %51
51: ; preds = %46
%52 = load i32*, i32** %3
%53 = load i32*, i32** %2
%54 = ptrtoint i32* %52 to i64
%55 = ptrtoint i32* %53 to i64
%56 = sub i64 %54, %55
%57 = lshr exact i64 %56, 2
%58 = trunc i64 %57 to i32
store i32 %58, i32* %0
%59 = load i32, i32* %10
%60 = call i32 @close(i32 %59)
%61 = call i32 @waitpid(i32 %12, i32* null, i32 0)
%62 = load i32, i32* %0
%63 = icmp eq i32 %62, 0
%64 = load i32*, i32** %2
br i1 %63, label %65, label %67
65: ; preds = %51
%66 = call i32 @free(i32* %64)
br label %70
67: ; preds = %51
%68 = shl i32 %62, 2
%69 = call i32* @realloc(i32* %64, i32 %68)
br label %70
70: ; preds = %65, %67, %15
%71 = phi i32* [ null, %15 ], [ %69, %67 ], [ null, %65 ]
ret i32* %71
}