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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ malloc(int);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int sscanf(int /*<<< orphan*/, char *, int *);
void writeMainPvd() {
  uint *tSteps;
  int status, aux;
  uint nt = 0;
  DIR *d;
  struct dirent *dir;
  d = opendir(".");
  if (d) {
    while ((dir = readdir(d)) != NULL) {
      status = sscanf(dir->d_name, "%d", &aux);
      if (status != 0) {
        nt++;
      }
    }
  }
  tSteps = (uint *)malloc(nt * sizeof(uint));
  nt = 0;
  d = opendir(".");
  if (d) {
    while ((dir = readdir(d)) != NULL) {
      status = sscanf(dir->d_name, "%d", &aux);
      if (status != 0) {
        tSteps[nt] = aux;
        nt++;
      }
    }
  }
  {
    int i, j, temp;
    for (i = 0; i < (nt - 1); ++i) {
      for (j = 0; j < (nt - 1) - i; ++j) {
        if (tSteps[j] > tSteps[j + 1]) {
          temp = tSteps[j + 1];
          tSteps[j + 1] = tSteps[j];
          tSteps[j] = temp;
        }
      }
    }
  }
  FILE *file = fopen("case.pvd", "w");
  fprintf(file, "<VTKFile type=\"Collection\" version=\"0.1\" "
                "byte_order=\"LittleEndian\">\n");
  fprintf(file, "  <Collection>\n");
  uint i;
  for (i = 0; i < nt; i++) {
    fprintf(
        file,
        "    <DataSet part=\"0\"  timestep=\"%d\" file=\"%d/fields.pvtu\" />\n",
        tSteps[i], tSteps[i]);
  }
  fprintf(file, "  </Collection>\n");
  fprintf(file, "</VTKFile>\n");
  fclose(file);
}


x86 assembly (clang, -O0):
<writeMainPvd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x14(%rbp)
lea    0xe7a(%rip),%rdi
call   1040 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11ec <writeMainPvd+0x7c>
jmp    119f <writeMainPvd+0x2f>
mov    -0x20(%rbp),%rdi
call   1060 <readdir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     11e7 <writeMainPvd+0x77>
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
lea    0xe3f(%rip),%rsi
lea    -0x10(%rbp),%rdx
call   1080 <sscanf@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11e2 <writeMainPvd+0x72>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119f <writeMainPvd+0x2f>
jmp    11ec <writeMainPvd+0x7c>
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xdf3(%rip),%rdi
call   1040 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1281 <writeMainPvd+0x111>
jmp    1226 <writeMainPvd+0xb6>
mov    -0x20(%rbp),%rdi
call   1060 <readdir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     127c <writeMainPvd+0x10c>
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
lea    0xdb8(%rip),%rsi
lea    -0x10(%rbp),%rdx
call   1080 <sscanf@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1277 <writeMainPvd+0x107>
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1226 <writeMainPvd+0xb6>
jmp    1281 <writeMainPvd+0x111>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1337 <writeMainPvd+0x1c7>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
sub    -0x2c(%rbp),%ecx
cmp    %ecx,%eax
jge    1324 <writeMainPvd+0x1b4>
mov    -0x8(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0x30(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1311 <writeMainPvd+0x1a1>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x34(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    1316 <writeMainPvd+0x1a6>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12a0 <writeMainPvd+0x130>
jmp    1329 <writeMainPvd+0x1b9>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1288 <writeMainPvd+0x118>
lea    0xcc7(%rip),%rdi
lea    0xcc9(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xcb7(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x40(%rbp),%rdi
lea    0xcea(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13bb <writeMainPvd+0x24b>
mov    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xcbf(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1379 <writeMainPvd+0x209>
mov    -0x40(%rbp),%rdi
lea    0xcde(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x40(%rbp),%rdi
lea    0xcdd(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeMainPvd>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe6d(%rip),%rdi
call   1040 <opendir@plt>
xor    %r12d,%r12d
mov    $0x0,%ebp
test   %rax,%rax
je     11f3 <writeMainPvd+0x73>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <readdir@plt>
mov    $0x0,%ebp
test   %rax,%rax
je     11f3 <writeMainPvd+0x73>
xor    %ebp,%ebp
lea    0xe3f(%rip),%r14
lea    0xc(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    (%rax),%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
sbb    $0xffffffff,%ebp
mov    %rbx,%rdi
call   1060 <readdir@plt>
test   %rax,%rax
jne    11d0 <writeMainPvd+0x50>
shl    $0x2,%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xdfc(%rip),%rdi
call   1040 <opendir@plt>
test   %rax,%rax
je     1322 <writeMainPvd+0x1a2>
mov    %rax,%r14
mov    %rax,%rdi
call   1060 <readdir@plt>
test   %rax,%rax
je     1322 <writeMainPvd+0x1a2>
xor    %r12d,%r12d
lea    0xdd2(%rip),%r15
lea    0xc(%rsp),%rbp
jmp    124d <writeMainPvd+0xcd>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <readdir@plt>
test   %rax,%rax
je     126f <writeMainPvd+0xef>
mov    (%rax),%edi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1080 <sscanf@plt>
test   %eax,%eax
je     1240 <writeMainPvd+0xc0>
mov    0xc(%rsp),%eax
movslq %r12d,%r12
mov    %eax,(%rbx,%r12,4)
add    $0x1,%r12d
jmp    1240 <writeMainPvd+0xc0>
cmp    $0x2,%r12d
jl     1322 <writeMainPvd+0x1a2>
lea    -0x1(%r12),%r8d
xor    %ecx,%ecx
mov    %r8d,%r10d
jmp    12a0 <writeMainPvd+0x120>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ecx
add    $0xffffffff,%r10d
cmp    %r8d,%ecx
je     1322 <writeMainPvd+0x1a2>
mov    %r8d,%r9d
sub    %ecx,%r9d
jle    1290 <writeMainPvd+0x110>
mov    (%rbx),%ebp
cmp    $0x1,%r9d
jne    12d0 <writeMainPvd+0x150>
xor    %esi,%esi
test   $0x1,%r9b
je     1290 <writeMainPvd+0x110>
mov    0x4(%rbx,%rsi,4),%eax
cmp    %eax,%ebp
jle    1290 <writeMainPvd+0x110>
mov    %ebp,0x4(%rbx,%rsi,4)
mov    %eax,(%rbx,%rsi,4)
jmp    1290 <writeMainPvd+0x110>
nopl   0x0(%rax)
mov    %r10d,%edx
and    $0xfffffffe,%edx
xor    %eax,%eax
jmp    12f0 <writeMainPvd+0x170>
nopw   0x0(%rax,%rax,1)
mov    %ebp,0x8(%rbx,%rax,4)
mov    %edi,0x4(%rbx,%rax,4)
mov    %rsi,%rax
cmp    %rsi,%rdx
je     12b2 <writeMainPvd+0x132>
mov    0x4(%rbx,%rax,4),%esi
cmp    %esi,%ebp
jle    1310 <writeMainPvd+0x190>
mov    %ebp,0x4(%rbx,%rax,4)
mov    %esi,(%rbx,%rax,4)
jmp    1312 <writeMainPvd+0x192>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %esi,%ebp
lea    0x2(%rax),%rsi
mov    0x8(%rbx,%rax,4),%edi
cmp    %edi,%ebp
jg     12e0 <writeMainPvd+0x160>
mov    %edi,%ebp
jmp    12e8 <writeMainPvd+0x168>
lea    0xcdc(%rip),%rdi
lea    0xcde(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r14
lea    0xcd1(%rip),%rdi
mov    $0x44,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10a0 <fwrite@plt>
lea    0xcfd(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10a0 <fwrite@plt>
test   %r12d,%r12d
jle    139b <writeMainPvd+0x21b>
mov    %r12d,%r12d
lea    0xcec(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,4),%ecx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ecx,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1380 <writeMainPvd+0x200>
lea    0xd02(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10a0 <fwrite@plt>
lea    0xcfa(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10a0 <fwrite@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"case.pvd\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [69 x i8] c"<VTKFile type=\22Collection\22 version=\220.1\22 byte_order=\22LittleEndian\22>\0A\00"
@.str.5 = [16 x i8] c" <Collection>\0A\00"
@.str.6 = [63 x i8] c" <DataSet part=\220\22 timestep=\22%d\22 file=\22%d/fields.pvtu\22 />\0A\00"
@.str.7 = [17 x i8] c" </Collection>\0A\00"
@.str.8 = [12 x i8] c"</VTKFile>\0A\00"
define void @writeMainPvd() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca %struct.dirent*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
store i32 0, i32* %4
%12 = call i32* @opendir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %5
%13 = load i32*, i32** %5
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %32
15: ; preds = %0
br label %16
16: ; preds = %30, %15
%17 = load i32*, i32** %5
%18 = call %struct.dirent* @readdir(i32* %17)
store %struct.dirent* %18, %struct.dirent** %6
%19 = icmp ne %struct.dirent* %18, null
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = load %struct.dirent*, %struct.dirent** %6
%22 = getelementptr inbounds %struct.dirent, %struct.dirent* %21, i32 0, i32 0
%23 = load i32, i32* %22
%24 = call i32 @sscanf(i32 %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %20
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %30
30: ; preds = %27, %20
br label %16
31: ; preds = %16
br label %32
32: ; preds = %31, %0
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = mul i64 %34, 4
%36 = trunc i64 %35 to i32
%37 = call i64 @malloc(i32 %36)
%38 = inttoptr i64 %37 to i32*
store i32* %38, i32** %1
store i32 0, i32* %4
%39 = call i32* @opendir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %39, i32** %5
%40 = load i32*, i32** %5
%41 = icmp ne i32* %40, null
br i1 %41, label %42, label %64
42: ; preds = %32
br label %43
43: ; preds = %62, %42
%44 = load i32*, i32** %5
%45 = call %struct.dirent* @readdir(i32* %44)
store %struct.dirent* %45, %struct.dirent** %6
%46 = icmp ne %struct.dirent* %45, null
br i1 %46, label %47, label %63
47: ; preds = %43
%48 = load %struct.dirent*, %struct.dirent** %6
%49 = getelementptr inbounds %struct.dirent, %struct.dirent* %48, i32 0, i32 0
%50 = load i32, i32* %49
%51 = call i32 @sscanf(i32 %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 %51, i32* %2
%52 = load i32, i32* %2
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %62
54: ; preds = %47
%55 = load i32, i32* %3
%56 = load i32*, i32** %1
%57 = load i32, i32* %4
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %56, i64 %58
store i32 %55, i32* %59
%60 = load i32, i32* %4
%61 = add nsw i32 %60, 1
store i32 %61, i32* %4
br label %62
62: ; preds = %54, %47
br label %43
63: ; preds = %43
br label %64
64: ; preds = %63, %32
store i32 0, i32* %7
br label %65
65: ; preds = %118, %64
%66 = load i32, i32* %7
%67 = load i32, i32* %4
%68 = sub nsw i32 %67, 1
%69 = icmp slt i32 %66, %68
br i1 %69, label %70, label %121
70: ; preds = %65
store i32 0, i32* %8
br label %71
71: ; preds = %114, %70
%72 = load i32, i32* %8
%73 = load i32, i32* %4
%74 = sub nsw i32 %73, 1
%75 = load i32, i32* %7
%76 = sub nsw i32 %74, %75
%77 = icmp slt i32 %72, %76
br i1 %77, label %78, label %117
78: ; preds = %71
%79 = load i32*, i32** %1
%80 = load i32, i32* %8
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %79, i64 %81
%83 = load i32, i32* %82
%84 = load i32*, i32** %1
%85 = load i32, i32* %8
%86 = add nsw i32 %85, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i32, i32* %84, i64 %87
%89 = load i32, i32* %88
%90 = icmp sgt i32 %83, %89
br i1 %90, label %91, label %113
91: ; preds = %78
%92 = load i32*, i32** %1
%93 = load i32, i32* %8
%94 = add nsw i32 %93, 1
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i32, i32* %92, i64 %95
%97 = load i32, i32* %96
store i32 %97, i32* %9
%98 = load i32*, i32** %1
%99 = load i32, i32* %8
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i32, i32* %98, i64 %100
%102 = load i32, i32* %101
%103 = load i32*, i32** %1
%104 = load i32, i32* %8
%105 = add nsw i32 %104, 1
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i32, i32* %103, i64 %106
store i32 %102, i32* %107
%108 = load i32, i32* %9
%109 = load i32*, i32** %1
%110 = load i32, i32* %8
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i32, i32* %109, i64 %111
store i32 %108, i32* %112
br label %113
113: ; preds = %91, %78
br label %114
114: ; preds = %113
%115 = load i32, i32* %8
%116 = add nsw i32 %115, 1
store i32 %116, i32* %8
br label %71
117: ; preds = %71
br label %118
118: ; preds = %117
%119 = load i32, i32* %7
%120 = add nsw i32 %119, 1
store i32 %120, i32* %7
br label %65
121: ; preds = %65
%122 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %122, i32** %10
%123 = load i32*, i32** %10
%124 = call i32 (i32*, i8*, ...) @fprintf(i32* %123, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.4, i64 0, i64 0))
%125 = load i32*, i32** %10
%126 = call i32 (i32*, i8*, ...) @fprintf(i32* %125, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %11
br label %127
127: ; preds = %144, %121
%128 = load i32, i32* %11
%129 = load i32, i32* %4
%130 = icmp slt i32 %128, %129
br i1 %130, label %131, label %147
131: ; preds = %127
%132 = load i32*, i32** %10
%133 = load i32*, i32** %1
%134 = load i32, i32* %11
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i32, i32* %133, i64 %135
%137 = load i32, i32* %136
%138 = load i32*, i32** %1
%139 = load i32, i32* %11
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i32, i32* %138, i64 %140
%142 = load i32, i32* %141
%143 = call i32 (i32*, i8*, ...) @fprintf(i32* %132, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i32 %137, i32 %142)
br label %144
144: ; preds = %131
%145 = load i32, i32* %11
%146 = add nsw i32 %145, 1
store i32 %146, i32* %11
br label %127
147: ; preds = %127
%148 = load i32*, i32** %10
%149 = call i32 (i32*, i8*, ...) @fprintf(i32* %148, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%150 = load i32*, i32** %10
%151 = call i32 (i32*, i8*, ...) @fprintf(i32* %150, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%152 = load i32*, i32** %10
%153 = call i32 @fclose(i32* %152)
ret void
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"case.pvd\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [69 x i8] c"<VTKFile type=\22Collection\22 version=\220.1\22 byte_order=\22LittleEndian\22>\0A\00"
@.str.5 = [16 x i8] c" <Collection>\0A\00"
@.str.6 = [63 x i8] c" <DataSet part=\220\22 timestep=\22%d\22 file=\22%d/fields.pvtu\22 />\0A\00"
@.str.7 = [17 x i8] c" </Collection>\0A\00"
@.str.8 = [12 x i8] c"</VTKFile>\0A\00"
define void @writeMainPvd() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32* @opendir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %21, label %5
5: ; preds = %0
%6 = call %struct.dirent* @readdir(i32* %3)
%7 = icmp eq %struct.dirent* %6, null
br i1 %7, label %21, label %8
8: ; preds = %5, %8
%9 = phi %struct.dirent* [ %17, %8 ], [ %6, %5 ]
%10 = phi i32 [ %16, %8 ], [ 0, %5 ]
%11 = getelementptr inbounds %struct.dirent, %struct.dirent* %9, i64 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @sscanf(i32 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i32
%16 = add nuw nsw i32 %10, %15
%17 = call %struct.dirent* @readdir(i32* %3)
%18 = icmp eq %struct.dirent* %17, null
br i1 %18, label %19, label %8
19: ; preds = %8
%20 = shl i32 %16, 2
br label %21
21: ; preds = %19, %5, %0
%22 = phi i32 [ 0, %0 ], [ 0, %5 ], [ %20, %19 ]
%23 = call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to i32*
%25 = call i32* @opendir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i32* %25, null
br i1 %26, label %96, label %27
27: ; preds = %21
%28 = call %struct.dirent* @readdir(i32* %25)
%29 = icmp eq %struct.dirent* %28, null
br i1 %29, label %96, label %30
30: ; preds = %27, %42
%31 = phi %struct.dirent* [ %44, %42 ], [ %28, %27 ]
%32 = phi i32 [ %43, %42 ], [ 0, %27 ]
%33 = getelementptr inbounds %struct.dirent, %struct.dirent* %31, i64 0, i32 0
%34 = load i32, i32* %33
%35 = call i32 @sscanf(i32 %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%36 = icmp eq i32 %35, 0
br i1 %36, label %42, label %37
37: ; preds = %30
%38 = load i32, i32* %1
%39 = sext i32 %32 to i64
%40 = getelementptr inbounds i32, i32* %24, i64 %39
store i32 %38, i32* %40
%41 = add nsw i32 %32, 1
br label %42
42: ; preds = %37, %30
%43 = phi i32 [ %41, %37 ], [ %32, %30 ]
%44 = call %struct.dirent* @readdir(i32* %25)
%45 = icmp eq %struct.dirent* %44, null
br i1 %45, label %46, label %30
46: ; preds = %42
%47 = add i32 %43, -1
%48 = icmp sgt i32 %43, 1
br i1 %48, label %49, label %96
49: ; preds = %46, %93
%50 = phi i32 [ %94, %93 ], [ 0, %46 ]
%51 = sub i32 %47, %50
%52 = zext i32 %51 to i64
%53 = icmp sgt i32 %47, %50
br i1 %53, label %54, label %93
54: ; preds = %49
%55 = load i32, i32* %24
%56 = and i64 %52, 1
%57 = icmp eq i32 %51, 1
br i1 %57, label %82, label %58
58: ; preds = %54
%59 = and i64 %52, 4294967294
br label %60
60: ; preds = %78, %58
%61 = phi i32 [ %55, %58 ], [ %79, %78 ]
%62 = phi i64 [ 0, %58 ], [ %72, %78 ]
%63 = phi i64 [ 0, %58 ], [ %80, %78 ]
%64 = or i64 %62, 1
%65 = getelementptr inbounds i32, i32* %24, i64 %64
%66 = load i32, i32* %65
%67 = icmp sgt i32 %61, %66
br i1 %67, label %68, label %70
68: ; preds = %60
%69 = getelementptr inbounds i32, i32* %24, i64 %62
store i32 %61, i32* %65
store i32 %66, i32* %69
br label %70
70: ; preds = %60, %68
%71 = phi i32 [ %66, %60 ], [ %61, %68 ]
%72 = add nuw nsw i64 %62, 2
%73 = getelementptr inbounds i32, i32* %24, i64 %72
%74 = load i32, i32* %73
%75 = icmp sgt i32 %71, %74
br i1 %75, label %76, label %78
76: ; preds = %70
%77 = getelementptr inbounds i32, i32* %24, i64 %64
store i32 %71, i32* %73
store i32 %74, i32* %77
br label %78
78: ; preds = %76, %70
%79 = phi i32 [ %74, %70 ], [ %71, %76 ]
%80 = add i64 %63, 2
%81 = icmp eq i64 %80, %59
br i1 %81, label %82, label %60
82: ; preds = %78, %54
%83 = phi i32 [ %55, %54 ], [ %79, %78 ]
%84 = phi i64 [ 0, %54 ], [ %72, %78 ]
%85 = icmp eq i64 %56, 0
br i1 %85, label %93, label %86
86: ; preds = %82
%87 = add nuw nsw i64 %84, 1
%88 = getelementptr inbounds i32, i32* %24, i64 %87
%89 = load i32, i32* %88
%90 = icmp sgt i32 %83, %89
br i1 %90, label %91, label %93
91: ; preds = %86
%92 = getelementptr inbounds i32, i32* %24, i64 %84
store i32 %83, i32* %88
store i32 %89, i32* %92
br label %93
93: ; preds = %82, %91, %86, %49
%94 = add nuw nsw i32 %50, 1
%95 = icmp eq i32 %94, %47
br i1 %95, label %96, label %49
96: ; preds = %93, %27, %21, %46
%97 = phi i32 [ %43, %46 ], [ 0, %21 ], [ 0, %27 ], [ %43, %93 ]
%98 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%99 = call i64 @fwrite(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.4, i64 0, i64 0), i64 68, i64 1, i32* %98)
%100 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i64 15, i64 1, i32* %98)
%101 = icmp sgt i32 %97, 0
br i1 %101, label %102, label %111
102: ; preds = %96
%103 = zext i32 %97 to i64
br label %104
104: ; preds = %102, %104
%105 = phi i64 [ 0, %102 ], [ %109, %104 ]
%106 = getelementptr inbounds i32, i32* %24, i64 %105
%107 = load i32, i32* %106
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %98, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i32 %107, i32 %107)
%109 = add nuw nsw i64 %105, 1
%110 = icmp eq i64 %109, %103
br i1 %110, label %111, label %104
111: ; preds = %104, %96
%112 = call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i64 16, i64 1, i32* %98)
%113 = call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i64 11, i64 1, i32* %98)
%114 = call i32 @fclose(i32* %98)
ret void
}