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

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ *open_memstream(char **, size_t *);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ seekdir(int /*<<< orphan*/ *, long);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
scalar_t__ strcmp(char *, char *);
long telldir(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  DIR *dirp;
  long int save3 = 0;
  int i = 0;
  struct dirent *dp;
  FILE *buf1;
  FILE *buf2;
  char *bp1;
  char *bp2;
  size_t size1;
  size_t size2;
  dirp = opendir(".");
  if (dirp == NULL) {
    perror("opendir");
    exit(1);
  }
  buf1 = open_memstream(&bp1, &size1);
  buf2 = open_memstream(&bp2, &size2);
  if (buf1 == NULL || buf2 == NULL) {
    perror("open_memstream");
    exit(1);
  }
  for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
    if (i++ == 3)
      save3 = telldir(dirp);
    if (i >= 5)
      fprintf(buf1, "%s ", dp->d_name);
    printf("%s\n", dp->d_name);
    if (i == 400)
      break;
  }
  printf("going back past 4-th entry...\n");
  seekdir(dirp, save3);
  i = 0;
  for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
    printf("%s\n", dp->d_name);
    i++;
    fprintf(buf2, "%s ", dp->d_name);
    if (i == 400)
      break;
  }
  fflush(buf1);
  fflush(buf2);
  if (strcmp(bp1, bp2)) {
    fflush(stdout);
    fprintf(stderr, "*** buffers differ:\n");
    fprintf(stderr, "buffer 1: %s\n", bp1);
    fprintf(stderr, "buffer 2: %s\n", bp2);
    return 1;
  }
  closedir(dirp);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xe14(%rip),%rdi
call   1040 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1216 <main+0x56>
lea    0xdfb(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0x48(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1030 <open_memstream@plt>
mov    %rax,-0x38(%rbp)
lea    -0x50(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <open_memstream@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     124e <main+0x8e>
cmpq   $0x0,-0x40(%rbp)
jne    1264 <main+0xa4>
lea    0xdb5(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1090 <readdir@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     12fe <main+0x13e>
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
cmp    $0x3,%eax
jne    129d <main+0xdd>
mov    -0x18(%rbp),%rdi
call   10c0 <telldir@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x5,-0x24(%rbp)
jl     12c0 <main+0x100>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rdx
lea    0xd60(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x190,-0x24(%rbp)
jne    12e7 <main+0x127>
jmp    12fe <main+0x13e>
jmp    12ec <main+0x12c>
mov    -0x18(%rbp),%rdi
call   1090 <readdir@plt>
mov    %rax,-0x30(%rbp)
jmp    1271 <main+0xb1>
lea    0xd18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <seekdir@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <readdir@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1398 <main+0x1d8>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rdx
lea    0xcb1(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
cmpl   $0x190,-0x24(%rbp)
jne    1381 <main+0x1c1>
jmp    1398 <main+0x1d8>
jmp    1386 <main+0x1c6>
mov    -0x18(%rbp),%rdi
call   1090 <readdir@plt>
mov    %rax,-0x30(%rbp)
jmp    132d <main+0x16d>
mov    -0x38(%rbp),%rdi
call   10a0 <fflush@plt>
mov    -0x40(%rbp),%rdi
call   10a0 <fflush@plt>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     142b <main+0x26b>
mov    0x2c10(%rip),%rax
mov    (%rax),%rdi
call   10a0 <fflush@plt>
mov    0x2c09(%rip),%rax
mov    (%rax),%rdi
lea    0xc5b(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2bf1(%rip),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rdx
lea    0xc54(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2bd5(%rip),%rax
mov    (%rax),%rdi
mov    -0x50(%rbp),%rdx
lea    0xc46(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%eax
add    $0x60,%rsp
pop    %rbp
ret
mov    -0x18(%rbp),%rdi
call   1060 <closedir@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xe83(%rip),%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     13b6 <main+0x1e6>
mov    %rax,%r14
lea    0x10(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1030 <open_memstream@plt>
mov    %rax,%rbx
lea    0x8(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1030 <open_memstream@plt>
test   %rbx,%rbx
je     13bf <main+0x1ef>
mov    %rax,%r15
test   %rax,%rax
je     13bf <main+0x1ef>
mov    %r14,%rdi
call   1090 <readdir@plt>
test   %rax,%rax
je     12a9 <main+0xd9>
mov    %rax,%rbp
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    1278 <main+0xa8>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   10c0 <telldir@plt>
mov    %rax,%r12
mov    0x0(%rbp),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1090 <readdir@plt>
mov    %rax,%rbp
add    $0x1,%r13d
test   %rax,%rax
je     12ac <main+0xdc>
cmp    $0x3,%r13d
je     1250 <main+0x80>
jbe    125b <main+0x8b>
mov    0x0(%rbp),%rdx
mov    %rbx,%rdi
lea    0xd89(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x0(%rbp),%rdi
call   1040 <puts@plt>
cmp    $0x18f,%r13d
jne    1264 <main+0x94>
jmp    12ac <main+0xdc>
xor    %r12d,%r12d
mov    %rbx,%r13
lea    0xd96(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   10b0 <seekdir@plt>
mov    %r14,%rdi
call   1090 <readdir@plt>
test   %rax,%rax
je     131f <main+0x14f>
mov    %rax,%rbp
mov    $0x190,%ebx
lea    0xd35(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%rbp),%rdi
call   1040 <puts@plt>
mov    0x0(%rbp),%rdx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0xffffffff,%ebx
je     131f <main+0x14f>
mov    %r14,%rdi
call   1090 <readdir@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    12f0 <main+0x120>
mov    %r13,%rdi
call   10a0 <fflush@plt>
mov    %r15,%rdi
call   10a0 <fflush@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13d5 <main+0x205>
mov    0x2c8a(%rip),%rax
mov    (%rax),%rdi
call   10a0 <fflush@plt>
mov    0x2c83(%rip),%rbx
mov    (%rbx),%rcx
lea    0xcb4(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
call   10f0 <fwrite@plt>
mov    (%rbx),%rdi
mov    0x10(%rsp),%rdx
lea    0xcab(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rbx),%rdi
mov    0x8(%rsp),%rdx
lea    0xca3(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc43(%rip),%rdi
jmp    13c6 <main+0x1f6>
lea    0xc42(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    %r14,%rdi
call   1060 <closedir@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [2 x i8] c".\00"
@.str.1 = [8 x i8] c"opendir\00"
@.str.2 = [15 x i8] c"open_memstream\00"
@.str.3 = [4 x i8] c"%s \00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [31 x i8] c"going back past 4-th entry...\0A\00"
@stdout = global i32* null
@stderr = global i32* null
@.str.6 = [21 x i8] c"*** buffers differ:\0A\00"
@.str.7 = [14 x i8] c"buffer 1: %s\0A\00"
@.str.8 = [14 x i8] c"buffer 2: %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 i32
%9 = alloca %struct.dirent*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %7
store i32 0, i32* %8
%16 = call i32* @opendir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %6
%17 = load i32*, i32** %6
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = call i32* @open_memstream(i8** %12, i64* %14)
store i32* %23, i32** %10
%24 = call i32* @open_memstream(i8** %13, i64* %15)
store i32* %24, i32** %11
%25 = load i32*, i32** %10
%26 = icmp eq i32* %25, null
br i1 %26, label %30, label %27
27: ; preds = %22
%28 = load i32*, i32** %11
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %33
30: ; preds = %27, %22
%31 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %27
%34 = load i32*, i32** %6
%35 = call %struct.dirent* @readdir(i32* %34)
store %struct.dirent* %35, %struct.dirent** %9
br label %36
36: ; preds = %64, %33
%37 = load %struct.dirent*, %struct.dirent** %9
%38 = icmp ne %struct.dirent* %37, null
br i1 %38, label %39, label %67
39: ; preds = %36
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
%42 = icmp eq i32 %40, 3
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i32*, i32** %6
%45 = call i64 @telldir(i32* %44)
store i64 %45, i64* %7
br label %46
46: ; preds = %43, %39
%47 = load i32, i32* %8
%48 = icmp sge i32 %47, 5
br i1 %48, label %49, label %55
49: ; preds = %46
%50 = load i32*, i32** %10
%51 = load %struct.dirent*, %struct.dirent** %9
%52 = getelementptr inbounds %struct.dirent, %struct.dirent* %51, i32 0, i32 0
%53 = load i8*, i8** %52
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %53)
br label %55
55: ; preds = %49, %46
%56 = load %struct.dirent*, %struct.dirent** %9
%57 = getelementptr inbounds %struct.dirent, %struct.dirent* %56, i32 0, i32 0
%58 = load i8*, i8** %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %58)
%60 = load i32, i32* %8
%61 = icmp eq i32 %60, 400
br i1 %61, label %62, label %63
62: ; preds = %55
br label %67
63: ; preds = %55
br label %64
64: ; preds = %63
%65 = load i32*, i32** %6
%66 = call %struct.dirent* @readdir(i32* %65)
store %struct.dirent* %66, %struct.dirent** %9
br label %36
67: ; preds = %62, %36
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%69 = load i32*, i32** %6
%70 = load i64, i64* %7
%71 = call i32 @seekdir(i32* %69, i64 %70)
store i32 0, i32* %8
%72 = load i32*, i32** %6
%73 = call %struct.dirent* @readdir(i32* %72)
store %struct.dirent* %73, %struct.dirent** %9
br label %74
74: ; preds = %93, %67
%75 = load %struct.dirent*, %struct.dirent** %9
%76 = icmp ne %struct.dirent* %75, null
br i1 %76, label %77, label %96
77: ; preds = %74
%78 = load %struct.dirent*, %struct.dirent** %9
%79 = getelementptr inbounds %struct.dirent, %struct.dirent* %78, i32 0, i32 0
%80 = load i8*, i8** %79
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %80)
%82 = load i32, i32* %8
%83 = add nsw i32 %82, 1
store i32 %83, i32* %8
%84 = load i32*, i32** %11
%85 = load %struct.dirent*, %struct.dirent** %9
%86 = getelementptr inbounds %struct.dirent, %struct.dirent* %85, i32 0, i32 0
%87 = load i8*, i8** %86
%88 = call i32 (i32*, i8*, ...) @fprintf(i32* %84, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %87)
%89 = load i32, i32* %8
%90 = icmp eq i32 %89, 400
br i1 %90, label %91, label %92
91: ; preds = %77
br label %96
92: ; preds = %77
br label %93
93: ; preds = %92
%94 = load i32*, i32** %6
%95 = call %struct.dirent* @readdir(i32* %94)
store %struct.dirent* %95, %struct.dirent** %9
br label %74
96: ; preds = %91, %74
%97 = load i32*, i32** %10
%98 = call i32 @fflush(i32* %97)
%99 = load i32*, i32** %11
%100 = call i32 @fflush(i32* %99)
%101 = load i8*, i8** %12
%102 = load i8*, i8** %13
%103 = call i64 @strcmp(i8* %101, i8* %102)
%104 = icmp ne i64 %103, 0
br i1 %104, label %105, label %116
105: ; preds = %96
%106 = load i32*, i32** @stdout
%107 = call i32 @fflush(i32* %106)
%108 = load i32*, i32** @stderr
%109 = call i32 (i32*, i8*, ...) @fprintf(i32* %108, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%110 = load i32*, i32** @stderr
%111 = load i8*, i8** %12
%112 = call i32 (i32*, i8*, ...) @fprintf(i32* %110, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* %111)
%113 = load i32*, i32** @stderr
%114 = load i8*, i8** %13
%115 = call i32 (i32*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* %114)
ret i32 1
116: ; preds = %96
%117 = load i32*, i32** %6
%118 = call i32 @closedir(i32* %117)
%119 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [2 x i8] c".\00"
@.str.1 = [8 x i8] c"opendir\00"
@.str.2 = [15 x i8] c"open_memstream\00"
@.str.3 = [4 x i8] c"%s \00"
@stdout = global i32* null
@stderr = global i32* null
@.str.6 = [21 x i8] c"*** buffers differ:\0A\00"
@.str.7 = [14 x i8] c"buffer 1: %s\0A\00"
@.str.8 = [14 x i8] c"buffer 2: %s\0A\00"
@str = [30 x i8] c"going back past 4-th entry...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = bitcast i8** %3 to i8*
%8 = bitcast i8** %4 to i8*
%9 = bitcast i64* %5 to i8*
%10 = bitcast i64* %6 to i8*
%11 = tail call i32* @opendir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = call i32* @open_memstream(i8** %3, i64* %5)
%18 = call i32* @open_memstream(i8** %4, i64* %6)
%19 = icmp eq i32* %17, null
%20 = icmp eq i32* %18, null
%21 = select i1 %19, i1 true, i1 %20
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %16
%26 = call %struct.dirent* @readdir(i32* %11)
%27 = icmp eq %struct.dirent* %26, null
br i1 %27, label %54, label %28
28: ; preds = %25, %50
%29 = phi i64 [ %51, %50 ], [ 0, %25 ]
%30 = phi i32 [ %32, %50 ], [ 0, %25 ]
%31 = phi %struct.dirent* [ %52, %50 ], [ %26, %25 ]
%32 = add nuw nsw i32 %30, 1
%33 = icmp eq i32 %30, 3
br i1 %33, label %34, label %36
34: ; preds = %28
%35 = call i64 @telldir(i32* %11)
br label %38
36: ; preds = %28
%37 = icmp ugt i32 %30, 3
br i1 %37, label %43, label %38
38: ; preds = %34, %36
%39 = phi i64 [ %29, %36 ], [ %35, %34 ]
%40 = getelementptr inbounds %struct.dirent, %struct.dirent* %31, i64 0, i32 0
%41 = load i8*, i8** %40
%42 = call i32 @puts(i8* dereferenceable(1) %41)
br label %50
43: ; preds = %36
%44 = getelementptr inbounds %struct.dirent, %struct.dirent* %31, i64 0, i32 0
%45 = load i8*, i8** %44
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %45)
%47 = load i8*, i8** %44
%48 = call i32 @puts(i8* dereferenceable(1) %47)
%49 = icmp eq i32 %32, 400
br i1 %49, label %54, label %50
50: ; preds = %38, %43
%51 = phi i64 [ %39, %38 ], [ %29, %43 ]
%52 = call %struct.dirent* @readdir(i32* %11)
%53 = icmp eq %struct.dirent* %52, null
br i1 %53, label %54, label %28
54: ; preds = %50, %43, %25
%55 = phi i64 [ 0, %25 ], [ %29, %43 ], [ %51, %50 ]
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%57 = call i32 @seekdir(i32* %11, i64 %55)
%58 = call %struct.dirent* @readdir(i32* %11)
%59 = icmp eq %struct.dirent* %58, null
br i1 %59, label %73, label %60
60: ; preds = %54, %70
%61 = phi i32 [ %66, %70 ], [ 0, %54 ]
%62 = phi %struct.dirent* [ %71, %70 ], [ %58, %54 ]
%63 = getelementptr inbounds %struct.dirent, %struct.dirent* %62, i64 0, i32 0
%64 = load i8*, i8** %63
%65 = call i32 @puts(i8* dereferenceable(1) %64)
%66 = add nuw nsw i32 %61, 1
%67 = load i8*, i8** %63
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %67)
%69 = icmp eq i32 %66, 400
br i1 %69, label %73, label %70
70: ; preds = %60
%71 = call %struct.dirent* @readdir(i32* %11)
%72 = icmp eq %struct.dirent* %71, null
br i1 %72, label %73, label %60
73: ; preds = %70, %60, %54
%74 = call i32 @fflush(i32* %17)
%75 = call i32 @fflush(i32* %18)
%76 = load i8*, i8** %3
%77 = load i8*, i8** %4
%78 = call i64 @strcmp(i8* %76, i8* %77)
%79 = icmp eq i64 %78, 0
br i1 %79, label %91, label %80
80: ; preds = %73
%81 = load i32*, i32** @stdout
%82 = call i32 @fflush(i32* %81)
%83 = load i32*, i32** @stderr
%84 = call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i64 20, i64 1, i32* %83)
%85 = load i32*, i32** @stderr
%86 = load i8*, i8** %3
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %85, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* %86)
%88 = load i32*, i32** @stderr
%89 = load i8*, i8** %4
%90 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* %89)
ret i32 1
91: ; preds = %73
%92 = call i32 @closedir(i32* %11)
%93 = call i32 @exit(i32 0)
unreachable
}