#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 {
  float *d_name;
};
typedef int /*<<< orphan*/ exist;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
scalar_t__ strcmp(float *, char *);
char *strerror(int /*<<< orphan*/);
int read_directory(char *d, int nbFiles, int count) {
  DIR *dir;
  int ret;
  struct dirent *file;
  unsigned char exist[256];
  unsigned char subdir;
  int number;
  int i;
  memset(exist, 0, sizeof(exist));
  subdir = 0;
  dir = opendir(".");
  if (dir == NULL) {
    printf("Can not open directory at level %d %s\n", count, strerror(errno));
    return -1;
  }
  ret = 0;
  while (1) {
    file = readdir(dir);
    if (file == NULL)
      break;
    if (strcmp(file->d_name, "..") == 0)
      continue;
    if (strcmp(file->d_name, ".") == 0)
      continue;
    if (strcmp(file->d_name, d) == 0) {
      subdir = 1;
      continue;
    }
    if (file->d_name[0] != 'f') {
      printf("%s found in directory level %d\n", file->d_name, count);
      ret = -1;
      break;
    }
    number = 0;
    i = 1;
    while (file->d_name[i] != 0) {
      number *= 10;
      number += file->d_name[i] - '0';
      i++;
    }
    if (number >= nbFiles) {
      printf("%s found in directory level %d\n", file->d_name, count);
      ret = -1;
      break;
    }
    if (exist[number] != 0) {
      printf("%s already found in directory level %d\n", file->d_name, count);
      ret = -1;
      break;
    }
    exist[number] = 1;
  }
  for (i = 0; i < nbFiles; i++) {
    if (exist[i] != 1) {
      printf("f%d is missing in directory level %d\n", i, count);
      ret = -1;
    }
  }
  if (subdir == 0) {
    printf("subdir %s is missing in directory level %d\n", d, count);
    ret = -1;
  }
  closedir(dir);
  return ret;
}


x86 assembly (clang, -O0):
<read_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
movb   $0x0,-0x131(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f4 <read_directory+0x84>
mov    -0x18(%rbp),%eax
mov    %eax,-0x140(%rbp)
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x140(%rbp),%esi
mov    %rax,%rdx
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1487 <read_directory+0x317>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1080 <readdir@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1218 <read_directory+0xa8>
jmp    13e4 <read_directory+0x274>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xe09(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    123a <read_directory+0xca>
jmp    11fb <read_directory+0x8b>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xde8(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    125c <read_directory+0xec>
jmp    11fb <read_directory+0x8b>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1282 <read_directory+0x112>
movb   $0x1,-0x131(%rbp)
jmp    11fb <read_directory+0x8b>
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movss  (%rax),%xmm0
movss  0xd6b(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    12a9 <read_directory+0x139>
jp     12a9 <read_directory+0x139>
jmp    12cd <read_directory+0x15d>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%edx
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    13e4 <read_directory+0x274>
movl   $0x0,-0x138(%rbp)
movl   $0x1,-0x13c(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movslq -0x13c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    130b <read_directory+0x19b>
jp     130b <read_directory+0x19b>
jmp    1361 <read_directory+0x1f1>
imul   $0xa,-0x138(%rbp),%eax
mov    %eax,-0x138(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movslq -0x13c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
movss  0xcd1(%rip),%xmm0
subss  %xmm0,%xmm1
cvtsi2ssl -0x138(%rbp),%xmm0
ff
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x138(%rbp)
mov    -0x13c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13c(%rbp)
jmp    12e1 <read_directory+0x171>
mov    -0x138(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1394 <read_directory+0x224>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%edx
lea    0xcb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    13e4 <read_directory+0x274>
movslq -0x138(%rbp),%rax
movzbl -0x130(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     13d0 <read_directory+0x260>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%edx
lea    0xc95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    13e4 <read_directory+0x274>
movslq -0x138(%rbp),%rax
movb   $0x1,-0x130(%rbp,%rax,1)
01
jmp    11fb <read_directory+0x8b>
movl   $0x0,-0x13c(%rbp)
mov    -0x13c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    144c <read_directory+0x2dc>
movslq -0x13c(%rbp),%rax
movzbl -0x130(%rbp,%rax,1),%eax
ff
cmp    $0x1,%eax
je     1433 <read_directory+0x2c3>
mov    -0x13c(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xc55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    1438 <read_directory+0x2c8>
mov    -0x13c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13c(%rbp)
jmp    13ee <read_directory+0x27e>
movzbl -0x131(%rbp),%eax
cmp    $0x0,%eax
jne    1478 <read_directory+0x308>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
lea    0xc36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <closedir@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_directory>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %edx,%r15d
mov    %esi,0x4(%rsp)
mov    %rdi,0x8(%rsp)
lea    0x10(%rsp),%rdi
xor    %r14d,%r14d
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
lea    0xe88(%rip),%rdi
call   1030 <opendir@plt>
test   %rax,%rax
je     12e6 <read_directory+0x176>
mov    %rax,%r13
mov    %rax,%rdi
call   1080 <readdir@plt>
test   %rax,%rax
je     1313 <read_directory+0x1a3>
mov    %rax,%r12
movl   $0x0,(%rsp)
mov    0x8(%rsp),%rbp
mov    0x4(%rsp),%r14d
lea    0xe4a(%rip),%rbx
jmp    1204 <read_directory+0x94>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1080 <readdir@plt>
mov    %rax,%r12
test   %rax,%rax
je     131c <read_directory+0x1ac>
mov    (%r12),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11f0 <read_directory+0x80>
mov    (%r12),%rdi
lea    0xe10(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11f0 <read_directory+0x80>
mov    (%r12),%rdi
mov    %rbp,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12c8 <read_directory+0x158>
mov    (%r12),%rsi
movss  (%rsi),%xmm0
ucomiss 0xdb2(%rip),%xmm0
jne    1321 <read_directory+0x1b1>
jp     1321 <read_directory+0x1b1>
movss  0x4(%rsi),%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jne    1269 <read_directory+0xf9>
jnp    12ae <read_directory+0x13e>
lea    0x8(%rsi),%rcx
xor    %eax,%eax
movss  0xd8d(%rip),%xmm3
nopw   0x0(%rax,%rax,1)
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
addss  %xmm3,%xmm0
addss  %xmm0,%xmm1
cvttss2si %xmm1,%eax
movss  (%rcx),%xmm0
add    $0x4,%rcx
ucomiss %xmm2,%xmm0
jne    1280 <read_directory+0x110>
jp     1280 <read_directory+0x110>
cmp    %r14d,%eax
jl     12b5 <read_directory+0x145>
jmp    1321 <read_directory+0x1b1>
xor    %eax,%eax
cmp    %r14d,%eax
jge    1321 <read_directory+0x1b1>
cltq
cmpb   $0x0,0x10(%rsp,%rax,1)
jne    132a <read_directory+0x1ba>
movb   $0x1,0x10(%rsp,%rax,1)
jmp    11f0 <read_directory+0x80>
mov    %r13,%rdi
call   1080 <readdir@plt>
mov    %rax,%r12
xor    %r14d,%r14d
mov    $0x1,%al
mov    %eax,(%rsp)
test   %r12,%r12
jne    11d9 <read_directory+0x69>
jmp    1341 <read_directory+0x1d1>
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xd0d(%rip),%rdi
mov    %r15d,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%r14d
jmp    13b1 <read_directory+0x241>
movl   $0x0,(%rsp)
jmp    1341 <read_directory+0x1d1>
xor    %r14d,%r14d
jmp    1341 <read_directory+0x1d1>
lea    0xd0a(%rip),%rdi
jmp    1331 <read_directory+0x1c1>
lea    0xd21(%rip),%rdi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%r14d
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1387 <read_directory+0x217>
mov    %eax,%ebp
lea    0xd28(%rip),%r12
xor    %ebx,%ebx
jmp    1369 <read_directory+0x1f9>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1387 <read_directory+0x217>
cmpb   $0x1,0x10(%rsp,%rbx,1)
je     1360 <read_directory+0x1f0>
mov    %r12,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%r14d
jmp    1360 <read_directory+0x1f0>
cmpb   $0x0,(%rsp)
jne    13a9 <read_directory+0x239>
lea    0xd0c(%rip),%rdi
mov    0x8(%rsp),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%r14d
mov    %r13,%rdi
call   1060 <closedir@plt>
mov    %r14d,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { float* }
@.str = [2 x i8] c".\00"
@.str.1 = [39 x i8] c"Can not open directory at level %d %s\0A\00"
@errno = global i32 0
@.str.2 = [3 x i8] c"..\00"
@.str.3 = [32 x i8] c"%s found in directory level %d\0A\00"
@.str.4 = [40 x i8] c"%s already found in directory level %d\0A\00"
@.str.5 = [38 x i8] c"f%d is missing in directory level %d\0A\00"
@.str.6 = [44 x i8] c"subdir %s is missing in directory level %d\0A\00"
define i32 @read_directory(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca %struct.dirent*
%11 = alloca [256 x i8]
%12 = alloca i8
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%16 = call i32 @memset(i8* %15, i32 0, i32 256)
store i8 0, i8* %12
%17 = call i32* @opendir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %17, i32** %8
%18 = load i32*, i32** %8
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %25
20: ; preds = %3
%21 = load i32, i32* %7
%22 = load i32, i32* @errno
%23 = call i8* @strerror(i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %21, i8* %23)
store i32 -1, i32* %4
br label %153
25: ; preds = %3
store i32 0, i32* %9
br label %26
26: ; preds = %25, %38, %45, %53, %117
%27 = load i32*, i32** %8
%28 = call %struct.dirent* @readdir(i32* %27)
store %struct.dirent* %28, %struct.dirent** %10
%29 = load %struct.dirent*, %struct.dirent** %10
%30 = icmp eq %struct.dirent* %29, null
br i1 %30, label %31, label %32
31: ; preds = %26
br label %121
32: ; preds = %26
%33 = load %struct.dirent*, %struct.dirent** %10
%34 = getelementptr inbounds %struct.dirent, %struct.dirent* %33, i32 0, i32 0
%35 = load float*, float** %34
%36 = call i64 @strcmp(float* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %32
br label %26
39: ; preds = %32
%40 = load %struct.dirent*, %struct.dirent** %10
%41 = getelementptr inbounds %struct.dirent, %struct.dirent* %40, i32 0, i32 0
%42 = load float*, float** %41
%43 = call i64 @strcmp(float* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %39
br label %26
46: ; preds = %39
%47 = load %struct.dirent*, %struct.dirent** %10
%48 = getelementptr inbounds %struct.dirent, %struct.dirent* %47, i32 0, i32 0
%49 = load float*, float** %48
%50 = load i8*, i8** %5
%51 = call i64 @strcmp(float* %49, i8* %50)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %46
store i8 1, i8* %12
br label %26
54: ; preds = %46
%55 = load %struct.dirent*, %struct.dirent** %10
%56 = getelementptr inbounds %struct.dirent, %struct.dirent* %55, i32 0, i32 0
%57 = load float*, float** %56
%58 = getelementptr inbounds float, float* %57, i64 0
%59 = load float, float* %58
%60 = fcmp une float %59, 1.020000e+02
br i1 %60, label %61, label %67
61: ; preds = %54
%62 = load %struct.dirent*, %struct.dirent** %10
%63 = getelementptr inbounds %struct.dirent, %struct.dirent* %62, i32 0, i32 0
%64 = load float*, float** %63
%65 = load i32, i32* %7
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), float* %64, i32 %65)
store i32 -1, i32* %9
br label %121
67: ; preds = %54
store i32 0, i32* %13
store i32 1, i32* %14
br label %68
68: ; preds = %77, %67
%69 = load %struct.dirent*, %struct.dirent** %10
%70 = getelementptr inbounds %struct.dirent, %struct.dirent* %69, i32 0, i32 0
%71 = load float*, float** %70
%72 = load i32, i32* %14
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds float, float* %71, i64 %73
%75 = load float, float* %74
%76 = fcmp une float %75, 0.000000e+00
br i1 %76, label %77, label %94
77: ; preds = %68
%78 = load i32, i32* %13
%79 = mul nsw i32 %78, 10
store i32 %79, i32* %13
%80 = load %struct.dirent*, %struct.dirent** %10
%81 = getelementptr inbounds %struct.dirent, %struct.dirent* %80, i32 0, i32 0
%82 = load float*, float** %81
%83 = load i32, i32* %14
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds float, float* %82, i64 %84
%86 = load float, float* %85
%87 = fsub float %86, 4.800000e+01
%88 = load i32, i32* %13
%89 = sitofp i32 %88 to float
%90 = fadd float %89, %87
%91 = fptosi float %90 to i32
store i32 %91, i32* %13
%92 = load i32, i32* %14
%93 = add nsw i32 %92, 1
store i32 %93, i32* %14
br label %68
94: ; preds = %68
%95 = load i32, i32* %13
%96 = load i32, i32* %6
%97 = icmp sge i32 %95, %96
br i1 %97, label %98, label %104
98: ; preds = %94
%99 = load %struct.dirent*, %struct.dirent** %10
%100 = getelementptr inbounds %struct.dirent, %struct.dirent* %99, i32 0, i32 0
%101 = load float*, float** %100
%102 = load i32, i32* %7
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), float* %101, i32 %102)
store i32 -1, i32* %9
br label %121
104: ; preds = %94
%105 = load i32, i32* %13
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 %106
%108 = load i8, i8* %107
%109 = zext i8 %108 to i32
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %117
111: ; preds = %104
%112 = load %struct.dirent*, %struct.dirent** %10
%113 = getelementptr inbounds %struct.dirent, %struct.dirent* %112, i32 0, i32 0
%114 = load float*, float** %113
%115 = load i32, i32* %7
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), float* %114, i32 %115)
store i32 -1, i32* %9
br label %121
117: ; preds = %104
%118 = load i32, i32* %13
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 %119
store i8 1, i8* %120
br label %26
121: ; preds = %111, %98, %61, %31
store i32 0, i32* %14
br label %122
122: ; preds = %138, %121
%123 = load i32, i32* %14
%124 = load i32, i32* %6
%125 = icmp slt i32 %123, %124
br i1 %125, label %126, label %141
126: ; preds = %122
%127 = load i32, i32* %14
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 %128
%130 = load i8, i8* %129
%131 = zext i8 %130 to i32
%132 = icmp ne i32 %131, 1
br i1 %132, label %133, label %137
133: ; preds = %126
%134 = load i32, i32* %14
%135 = load i32, i32* %7
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 %134, i32 %135)
store i32 -1, i32* %9
br label %137
137: ; preds = %133, %126
br label %138
138: ; preds = %137
%139 = load i32, i32* %14
%140 = add nsw i32 %139, 1
store i32 %140, i32* %14
br label %122
141: ; preds = %122
%142 = load i8, i8* %12
%143 = zext i8 %142 to i32
%144 = icmp eq i32 %143, 0
br i1 %144, label %145, label %149
145: ; preds = %141
%146 = load i8*, i8** %5
%147 = load i32, i32* %7
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i8* %146, i32 %147)
store i32 -1, i32* %9
br label %149
149: ; preds = %145, %141
%150 = load i32*, i32** %8
%151 = call i32 @closedir(i32* %150)
%152 = load i32, i32* %9
store i32 %152, i32* %4
br label %153
153: ; preds = %149, %20
%154 = load i32, i32* %4
ret i32 %154
}

LLVM IR (-O2):
%struct.dirent = type { float* }
@.str = [2 x i8] c".\00"
@.str.1 = [39 x i8] c"Can not open directory at level %d %s\0A\00"
@errno = global i32 0
@.str.2 = [3 x i8] c"..\00"
@.str.3 = [32 x i8] c"%s found in directory level %d\0A\00"
@.str.4 = [40 x i8] c"%s already found in directory level %d\0A\00"
@.str.5 = [38 x i8] c"f%d is missing in directory level %d\0A\00"
@.str.6 = [44 x i8] c"subdir %s is missing in directory level %d\0A\00"
define i32 @read_directory(i8* %0, i32 %1, i32 %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 256)
%7 = call i32* @opendir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = call %struct.dirent* @readdir(i32* %7)
%11 = icmp eq %struct.dirent* %10, null
br i1 %11, label %72, label %33
12: ; preds = %3
%13 = load i32, i32* @errno
%14 = call i8* @strerror(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %2, i8* %14)
br label %99
16: ; preds = %33, %66
%17 = phi %struct.dirent* [ %34, %33 ], [ %67, %66 ]
%18 = getelementptr inbounds %struct.dirent, %struct.dirent* %17, i64 0, i32 0
%19 = load float*, float** %18
%20 = call i64 @strcmp(float* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %66, label %22
22: ; preds = %16
%23 = load float*, float** %18
%24 = call i64 @strcmp(float* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %66, label %26
26: ; preds = %22
%27 = load float*, float** %18
%28 = call i64 @strcmp(float* %27, i8* %0)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = call %struct.dirent* @readdir(i32* %7)
%32 = icmp eq %struct.dirent* %31, null
br i1 %32, label %72, label %33
33: ; preds = %9, %30
%34 = phi %struct.dirent* [ %31, %30 ], [ %10, %9 ]
%35 = phi i8 [ 1, %30 ], [ 0, %9 ]
br label %16
36: ; preds = %26
%37 = load float*, float** %18
%38 = load float, float* %37
%39 = fcmp une float %38, 1.020000e+02
br i1 %39, label %69, label %40
40: ; preds = %36
%41 = getelementptr inbounds float, float* %37, i64 1
%42 = load float, float* %41
%43 = fcmp une float %42, 0.000000e+00
br i1 %43, label %44, label %57
44: ; preds = %40, %44
%45 = phi i64 [ %53, %44 ], [ 1, %40 ]
%46 = phi float [ %55, %44 ], [ %42, %40 ]
%47 = phi i32 [ %52, %44 ], [ 0, %40 ]
%48 = mul nsw i32 %47, 10
%49 = fadd float %46, -4.800000e+01
%50 = sitofp i32 %48 to float
%51 = fadd float %49, %50
%52 = fptosi float %51 to i32
%53 = add nuw nsw i64 %45, 1
%54 = getelementptr inbounds float, float* %37, i64 %53
%55 = load float, float* %54
%56 = fcmp une float %55, 0.000000e+00
br i1 %56, label %44, label %57
57: ; preds = %44, %40
%58 = phi i32 [ 0, %40 ], [ %52, %44 ]
%59 = icmp slt i32 %58, %1
br i1 %59, label %60, label %69
60: ; preds = %57
%61 = sext i32 %58 to i64
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = icmp eq i8 %63, 0
br i1 %64, label %65, label %69
65: ; preds = %60
store i8 1, i8* %62
br label %66
66: ; preds = %65, %16, %22
%67 = call %struct.dirent* @readdir(i32* %7)
%68 = icmp eq %struct.dirent* %67, null
br i1 %68, label %72, label %16
69: ; preds = %60, %57, %36
%70 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), %36 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), %57 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), %60 ]
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %70, float* %37, i32 %2)
br label %72
72: ; preds = %30, %66, %69, %9
%73 = phi i8 [ 0, %9 ], [ %35, %69 ], [ %35, %66 ], [ 1, %30 ]
%74 = phi i32 [ 0, %9 ], [ -1, %69 ], [ 0, %66 ], [ 0, %30 ]
%75 = icmp sgt i32 %1, 0
br i1 %75, label %76, label %91
76: ; preds = %72
%77 = zext i32 %1 to i64
br label %78
78: ; preds = %76, %87
%79 = phi i64 [ 0, %76 ], [ %89, %87 ]
%80 = phi i32 [ %74, %76 ], [ %88, %87 ]
%81 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %79
%82 = load i8, i8* %81
%83 = icmp eq i8 %82, 1
br i1 %83, label %87, label %84
84: ; preds = %78
%85 = trunc i64 %79 to i32
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 %85, i32 %2)
br label %87
87: ; preds = %78, %84
%88 = phi i32 [ -1, %84 ], [ %80, %78 ]
%89 = add nuw nsw i64 %79, 1
%90 = icmp eq i64 %89, %77
br i1 %90, label %91, label %78
91: ; preds = %87, %72
%92 = phi i32 [ %74, %72 ], [ %88, %87 ]
%93 = icmp eq i8 %73, 0
br i1 %93, label %94, label %96
94: ; preds = %91
%95 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i8* %0, i32 %2)
br label %96
96: ; preds = %94, %91
%97 = phi i32 [ -1, %94 ], [ %92, %91 ]
%98 = call i32 @closedir(i32* %7)
br label %99
99: ; preds = %96, %12
%100 = phi i32 [ -1, %12 ], [ %97, %96 ]
ret i32 %100
}