#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 */
struct dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ *opendir(char *);
scalar_t__ readdir_r(int /*<<< orphan*/ *, struct dirent *, struct dirent **);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
void test_readdir(void) {
  DIR *dir = opendir("tests/1");
  if (dir == NULL) {
    fprintf(stderr, "Directory tests/1 not found\n");
    abort();
  }
  struct dirent ent[10];
  struct dirent *entry;
  size_t i = 0;
  size_t n = 0;
  while (readdir_r(dir, &ent[n], &entry) == 0 && entry != 0) {
    n++;
    assert(n <= 4);
  }
  assert(n == 4);
  int found = 0;
  for (i = 0; i < 4; i++) {
    entry = &ent[i];
    if (strcmp(entry->d_name, ".") == 0) {
      found += 1;
    } else if (strcmp(entry->d_name, "..") == 0) {
      found += 2;
    } else if (strcmp(entry->d_name, "file") == 0) {
      found += 4;
    } else if (strcmp(entry->d_name, "dir") == 0) {
      found += 8;
    } else {
      fprintf(stderr, "Unexpected file %s\n", entry->d_name);
      abort();
    }
  }
  assert(found == 0xf);
  closedir(dir);
}


x86 assembly (clang, -O0):
<test_readdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    0xe7e(%rip),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11b4 <test_readdir+0x44>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x78(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x78(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    -0x68(%rbp),%rdx
call   1040 <readdir_r@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x7d(%rbp)
jne    11fd <test_readdir+0x8d>
cmpq   $0x0,-0x68(%rbp)
setne  %al
mov    %al,-0x7d(%rbp)
mov    -0x7d(%rbp),%al
test   $0x1,%al
jne    120d <test_readdir+0x9d>
jmp    1230 <test_readdir+0xc0>
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
cmpq   $0x4,-0x78(%rbp)
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
jmp    11c4 <test_readdir+0x54>
cmpq   $0x4,-0x78(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
movl   $0x0,-0x7c(%rbp)
movq   $0x0,-0x70(%rbp)
cmpq   $0x4,-0x70(%rbp)
jae    1365 <test_readdir+0x1f5>
mov    -0x70(%rbp),%rcx
lea    -0x60(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    (%rax),%rdi
lea    0xda9(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    129a <test_readdir+0x12a>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    134f <test_readdir+0x1df>
mov    -0x68(%rbp),%rax
mov    (%rax),%rdi
lea    0xd7d(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12c5 <test_readdir+0x155>
mov    -0x7c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x7c(%rbp)
jmp    134a <test_readdir+0x1da>
mov    -0x68(%rbp),%rax
mov    (%rax),%rdi
lea    0xd55(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12f0 <test_readdir+0x180>
mov    -0x7c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x7c(%rbp)
jmp    1345 <test_readdir+0x1d5>
mov    -0x68(%rbp),%rax
mov    (%rax),%rdi
lea    0xd2f(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    131b <test_readdir+0x1ab>
mov    -0x7c(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x7c(%rbp)
jmp    1340 <test_readdir+0x1d0>
mov    0x2cbe(%rip),%rax
mov    (%rax),%edi
mov    -0x68(%rbp),%rax
mov    (%rax),%rdx
lea    0xcff(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1345 <test_readdir+0x1d5>
jmp    134a <test_readdir+0x1da>
jmp    134f <test_readdir+0x1df>
jmp    1354 <test_readdir+0x1e4>
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    1251 <test_readdir+0xe1>
cmpl   $0xf,-0x7c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1060 <closedir@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_readdir>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
lea    0xe7d(%rip),%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     147c <test_readdir+0x30c>
mov    %rax,%r15
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <readdir_r@plt>
xor    %edi,%edi
test   %rax,%rax
jne    120c <test_readdir+0x9c>
cmpq   $0x0,0x8(%rsp)
je     120c <test_readdir+0x9c>
lea    0x18(%rsp),%rbx
mov    $0x1,%ebp
lea    0x8(%rsp),%r12
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
cmp    $0x5,%rbp
setb   %dil
call   1080 <assert@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1040 <readdir_r@plt>
add    $0x1,%rbp
test   %rax,%rax
jne    1202 <test_readdir+0x92>
add    $0x8,%rbx
cmpq   $0x0,0x8(%rsp)
jne    11d0 <test_readdir+0x60>
xor    %edi,%edi
cmp    $0x5,%rbp
sete   %dil
call   1080 <assert@plt>
mov    %r14,0x8(%rsp)
mov    0x10(%rsp),%rdi
lea    0xe04(%rip),%rsi
call   1070 <strcmp@plt>
mov    $0x1,%r14d
mov    $0x1,%ebx
test   %rax,%rax
je     1298 <test_readdir+0x128>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xddf(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     128c <test_readdir+0x11c>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xdc9(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1293 <test_readdir+0x123>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xdb5(%rip),%rsi
call   1070 <strcmp@plt>
mov    $0x8,%ebx
test   %rax,%rax
je     1298 <test_readdir+0x128>
jmp    141d <test_readdir+0x2ad>
mov    $0x2,%ebx
jmp    1298 <test_readdir+0x128>
mov    $0x4,%ebx
lea    0x18(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    0x18(%rsp),%rdi
lea    0xd78(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     131c <test_readdir+0x1ac>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xd5e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     130e <test_readdir+0x19e>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xd48(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1316 <test_readdir+0x1a6>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xd34(%rip),%rsi
call   1070 <strcmp@plt>
mov    $0x8,%r14d
test   %rax,%rax
je     131c <test_readdir+0x1ac>
jmp    141d <test_readdir+0x2ad>
mov    $0x2,%r14d
jmp    131c <test_readdir+0x1ac>
mov    $0x4,%r14d
lea    0x20(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    0x20(%rsp),%rdi
lea    0xcf4(%rip),%rsi
call   1070 <strcmp@plt>
mov    $0x1,%r12d
mov    $0x1,%ebp
test   %rax,%rax
je     13a8 <test_readdir+0x238>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xccf(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     139c <test_readdir+0x22c>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xcb9(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13a3 <test_readdir+0x233>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xca5(%rip),%rsi
call   1070 <strcmp@plt>
mov    $0x8,%ebp
test   %rax,%rax
je     13a8 <test_readdir+0x238>
jmp    141d <test_readdir+0x2ad>
mov    $0x2,%ebp
jmp    13a8 <test_readdir+0x238>
mov    $0x4,%ebp
lea    0x28(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    0x28(%rsp),%rdi
lea    0xc68(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1451 <test_readdir+0x2e1>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xc4a(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1443 <test_readdir+0x2d3>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xc34(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     144b <test_readdir+0x2db>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
lea    0xc20(%rip),%rsi
call   1070 <strcmp@plt>
mov    $0x8,%r12d
test   %rax,%rax
je     1451 <test_readdir+0x2e1>
mov    0x2bbc(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xbfc(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>
mov    $0x2,%r12d
jmp    1451 <test_readdir+0x2e1>
mov    $0x4,%r12d
add    %r14d,%ebx
add    %ebp,%ebx
add    %r12d,%ebx
xor    %edi,%edi
cmp    $0xf,%ebx
sete   %dil
call   1080 <assert@plt>
mov    %r15,%rdi
call   1060 <closedir@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b5d(%rip),%rax
mov    (%rax),%edi
lea    0xb7c(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [8 x i8] c"tests/1\00"
@stderr = global i32 0
@.str.1 = [29 x i8] c"Directory tests/1 not found\0A\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [3 x i8] c"..\00"
@.str.4 = [5 x i8] c"file\00"
@.str.5 = [4 x i8] c"dir\00"
@.str.6 = [20 x i8] c"Unexpected file %s\0A\00"
define void @test_readdir() {
%1 = alloca i32*
%2 = alloca [10 x %struct.dirent]
%3 = alloca %struct.dirent*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = call i32* @opendir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %1
%8 = load i32*, i32** %1
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %0
store i64 0, i64* %4
store i64 0, i64* %5
br label %15
15: ; preds = %26, %14
%16 = load i32*, i32** %1
%17 = load i64, i64* %5
%18 = getelementptr inbounds [10 x %struct.dirent], [10 x %struct.dirent]* %2, i64 0, i64 %17
%19 = call i64 @readdir_r(i32* %16, %struct.dirent* %18, %struct.dirent** %3)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load %struct.dirent*, %struct.dirent** %3
%23 = icmp ne %struct.dirent* %22, null
br label %24
24: ; preds = %21, %15
%25 = phi i1 [ false, %15 ], [ %23, %21 ]
br i1 %25, label %26, label %33
26: ; preds = %24
%27 = load i64, i64* %5
%28 = add i64 %27, 1
store i64 %28, i64* %5
%29 = load i64, i64* %5
%30 = icmp ule i64 %29, 4
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
br label %15
33: ; preds = %24
%34 = load i64, i64* %5
%35 = icmp eq i64 %34, 4
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
store i32 0, i32* %6
store i64 0, i64* %4
br label %38
38: ; preds = %90, %33
%39 = load i64, i64* %4
%40 = icmp ult i64 %39, 4
br i1 %40, label %41, label %93
41: ; preds = %38
%42 = load i64, i64* %4
%43 = getelementptr inbounds [10 x %struct.dirent], [10 x %struct.dirent]* %2, i64 0, i64 %42
store %struct.dirent* %43, %struct.dirent** %3
%44 = load %struct.dirent*, %struct.dirent** %3
%45 = getelementptr inbounds %struct.dirent, %struct.dirent* %44, i32 0, i32 0
%46 = load i8*, i8** %45
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %41
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %89
52: ; preds = %41
%53 = load %struct.dirent*, %struct.dirent** %3
%54 = getelementptr inbounds %struct.dirent, %struct.dirent* %53, i32 0, i32 0
%55 = load i8*, i8** %54
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %52
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 2
store i32 %60, i32* %6
br label %88
61: ; preds = %52
%62 = load %struct.dirent*, %struct.dirent** %3
%63 = getelementptr inbounds %struct.dirent, %struct.dirent* %62, i32 0, i32 0
%64 = load i8*, i8** %63
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %70
67: ; preds = %61
%68 = load i32, i32* %6
%69 = add nsw i32 %68, 4
store i32 %69, i32* %6
br label %87
70: ; preds = %61
%71 = load %struct.dirent*, %struct.dirent** %3
%72 = getelementptr inbounds %struct.dirent, %struct.dirent* %71, i32 0, i32 0
%73 = load i8*, i8** %72
%74 = call i64 @strcmp(i8* %73, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %70
%77 = load i32, i32* %6
%78 = add nsw i32 %77, 8
store i32 %78, i32* %6
br label %86
79: ; preds = %70
%80 = load i32, i32* @stderr
%81 = load %struct.dirent*, %struct.dirent** %3
%82 = getelementptr inbounds %struct.dirent, %struct.dirent* %81, i32 0, i32 0
%83 = load i8*, i8** %82
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %83)
%85 = call i32 (...) @abort()
unreachable
86: ; preds = %76
br label %87
87: ; preds = %86, %67
br label %88
88: ; preds = %87, %58
br label %89
89: ; preds = %88, %49
br label %90
90: ; preds = %89
%91 = load i64, i64* %4
%92 = add i64 %91, 1
store i64 %92, i64* %4
br label %38
93: ; preds = %38
%94 = load i32, i32* %6
%95 = icmp eq i32 %94, 15
%96 = zext i1 %95 to i32
%97 = call i32 @assert(i32 %96)
%98 = load i32*, i32** %1
%99 = call i32 @closedir(i32* %98)
ret void
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [8 x i8] c"tests/1\00"
@stderr = global i32 0
@.str.1 = [29 x i8] c"Directory tests/1 not found\0A\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [3 x i8] c"..\00"
@.str.4 = [5 x i8] c"file\00"
@.str.5 = [4 x i8] c"dir\00"
@.str.6 = [20 x i8] c"Unexpected file %s\0A\00"
define void @test_readdir() {
%1 = alloca [10 x %struct.dirent]
%2 = alloca %struct.dirent*
%3 = tail call i32* @opendir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %0
%10 = bitcast [10 x %struct.dirent]* %1 to i8*
%11 = bitcast %struct.dirent** %2 to i8*
%12 = getelementptr inbounds [10 x %struct.dirent], [10 x %struct.dirent]* %1, i64 0, i64 0
%13 = call i64 @readdir_r(i32* %3, %struct.dirent* %12, %struct.dirent** %2)
%14 = icmp eq i64 %13, 0
%15 = load %struct.dirent*, %struct.dirent** %2
%16 = icmp ne %struct.dirent* %15, null
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %18, label %33
18: ; preds = %9, %18
%19 = phi i64 [ %20, %18 ], [ 0, %9 ]
%20 = add i64 %19, 1
%21 = icmp ult i64 %20, 5
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = getelementptr inbounds [10 x %struct.dirent], [10 x %struct.dirent]* %1, i64 0, i64 %20
%25 = call i64 @readdir_r(i32* %3, %struct.dirent* %24, %struct.dirent** %2)
%26 = icmp eq i64 %25, 0
%27 = load %struct.dirent*, %struct.dirent** %2
%28 = icmp ne %struct.dirent* %27, null
%29 = select i1 %26, i1 %28, i1 false
br i1 %29, label %18, label %30
30: ; preds = %18
%31 = icmp eq i64 %20, 4
%32 = zext i1 %31 to i32
br label %33
33: ; preds = %30, %9
%34 = phi i32 [ 0, %9 ], [ %32, %30 ]
%35 = call i32 @assert(i32 %34)
%36 = getelementptr inbounds [10 x %struct.dirent], [10 x %struct.dirent]* %1, i64 0, i64 0
store %struct.dirent* %36, %struct.dirent** %2
%37 = getelementptr inbounds [10 x %struct.dirent], [10 x %struct.dirent]* %1, i64 0, i64 0, i32 0
%38 = load i8*, i8** %37
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %66, label %41
41: ; preds = %33
%42 = load %struct.dirent*, %struct.dirent** %2
%43 = getelementptr inbounds %struct.dirent, %struct.dirent* %42, i64 0, i32 0
%44 = load i8*, i8** %43
%45 = call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %66, label %47
47: ; preds = %41
%48 = load %struct.dirent*, %struct.dirent** %2
%49 = getelementptr inbounds %struct.dirent, %struct.dirent* %48, i64 0, i32 0
%50 = load i8*, i8** %49
%51 = call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %66, label %53
53: ; preds = %47
%54 = load %struct.dirent*, %struct.dirent** %2
%55 = getelementptr inbounds %struct.dirent, %struct.dirent* %54, i64 0, i32 0
%56 = load i8*, i8** %55
%57 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %66, label %59
59: ; preds = %135, %110, %85, %53
%60 = load i32, i32* @stderr
%61 = load %struct.dirent*, %struct.dirent** %2
%62 = getelementptr inbounds %struct.dirent, %struct.dirent* %61, i64 0, i32 0
%63 = load i8*, i8** %62
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %63)
%65 = call i32 (...) @abort()
unreachable
66: ; preds = %53, %47, %41, %33
%67 = phi i32 [ 1, %33 ], [ 2, %41 ], [ 4, %47 ], [ 8, %53 ]
%68 = getelementptr inbounds [10 x %struct.dirent], [10 x %struct.dirent]* %1, i64 0, i64 1
store %struct.dirent* %68, %struct.dirent** %2
%69 = getelementptr inbounds %struct.dirent, %struct.dirent* %68, i64 0, i32 0
%70 = load i8*, i8** %69
%71 = call i64 @strcmp(i8* %70, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %91, label %73
73: ; preds = %66
%74 = load %struct.dirent*, %struct.dirent** %2
%75 = getelementptr inbounds %struct.dirent, %struct.dirent* %74, i64 0, i32 0
%76 = load i8*, i8** %75
%77 = call i64 @strcmp(i8* %76, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
br i1 %78, label %91, label %79
79: ; preds = %73
%80 = load %struct.dirent*, %struct.dirent** %2
%81 = getelementptr inbounds %struct.dirent, %struct.dirent* %80, i64 0, i32 0
%82 = load i8*, i8** %81
%83 = call i64 @strcmp(i8* %82, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%84 = icmp eq i64 %83, 0
br i1 %84, label %91, label %85
85: ; preds = %79
%86 = load %struct.dirent*, %struct.dirent** %2
%87 = getelementptr inbounds %struct.dirent, %struct.dirent* %86, i64 0, i32 0
%88 = load i8*, i8** %87
%89 = call i64 @strcmp(i8* %88, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %59
91: ; preds = %85, %79, %73, %66
%92 = phi i32 [ 1, %66 ], [ 2, %73 ], [ 4, %79 ], [ 8, %85 ]
%93 = getelementptr inbounds [10 x %struct.dirent], [10 x %struct.dirent]* %1, i64 0, i64 2
store %struct.dirent* %93, %struct.dirent** %2
%94 = getelementptr inbounds %struct.dirent, %struct.dirent* %93, i64 0, i32 0
%95 = load i8*, i8** %94
%96 = call i64 @strcmp(i8* %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%97 = icmp eq i64 %96, 0
br i1 %97, label %116, label %98
98: ; preds = %91
%99 = load %struct.dirent*, %struct.dirent** %2
%100 = getelementptr inbounds %struct.dirent, %struct.dirent* %99, i64 0, i32 0
%101 = load i8*, i8** %100
%102 = call i64 @strcmp(i8* %101, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%103 = icmp eq i64 %102, 0
br i1 %103, label %116, label %104
104: ; preds = %98
%105 = load %struct.dirent*, %struct.dirent** %2
%106 = getelementptr inbounds %struct.dirent, %struct.dirent* %105, i64 0, i32 0
%107 = load i8*, i8** %106
%108 = call i64 @strcmp(i8* %107, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%109 = icmp eq i64 %108, 0
br i1 %109, label %116, label %110
110: ; preds = %104
%111 = load %struct.dirent*, %struct.dirent** %2
%112 = getelementptr inbounds %struct.dirent, %struct.dirent* %111, i64 0, i32 0
%113 = load i8*, i8** %112
%114 = call i64 @strcmp(i8* %113, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%115 = icmp eq i64 %114, 0
br i1 %115, label %116, label %59
116: ; preds = %110, %104, %98, %91
%117 = phi i32 [ 1, %91 ], [ 2, %98 ], [ 4, %104 ], [ 8, %110 ]
%118 = getelementptr inbounds [10 x %struct.dirent], [10 x %struct.dirent]* %1, i64 0, i64 3
store %struct.dirent* %118, %struct.dirent** %2
%119 = getelementptr inbounds %struct.dirent, %struct.dirent* %118, i64 0, i32 0
%120 = load i8*, i8** %119
%121 = call i64 @strcmp(i8* %120, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%122 = icmp eq i64 %121, 0
br i1 %122, label %141, label %123
123: ; preds = %116
%124 = load %struct.dirent*, %struct.dirent** %2
%125 = getelementptr inbounds %struct.dirent, %struct.dirent* %124, i64 0, i32 0
%126 = load i8*, i8** %125
%127 = call i64 @strcmp(i8* %126, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%128 = icmp eq i64 %127, 0
br i1 %128, label %141, label %129
129: ; preds = %123
%130 = load %struct.dirent*, %struct.dirent** %2
%131 = getelementptr inbounds %struct.dirent, %struct.dirent* %130, i64 0, i32 0
%132 = load i8*, i8** %131
%133 = call i64 @strcmp(i8* %132, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%134 = icmp eq i64 %133, 0
br i1 %134, label %141, label %135
135: ; preds = %129
%136 = load %struct.dirent*, %struct.dirent** %2
%137 = getelementptr inbounds %struct.dirent, %struct.dirent* %136, i64 0, i32 0
%138 = load i8*, i8** %137
%139 = call i64 @strcmp(i8* %138, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%140 = icmp eq i64 %139, 0
br i1 %140, label %141, label %59
141: ; preds = %135, %129, %123, %116
%142 = phi i32 [ 1, %116 ], [ 2, %123 ], [ 4, %129 ], [ 8, %135 ]
%143 = add nuw nsw i32 %67, %92
%144 = add nuw nsw i32 %143, %117
%145 = add nuw nsw i32 %144, %142
%146 = icmp eq i32 %145, 15
%147 = zext i1 %146 to i32
%148 = call i32 @assert(i32 %147)
%149 = call i32 @closedir(i32* %3)
ret void
}