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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ stderr;
int createFiles(int count) {
  FILE *fp;
  int i;
  for (i = 0; i < count; i++) {
    char nameBuf[32];
    snprintf(nameBuf, sizeof(nameBuf), "src/Interface%03d.java", i);
    fp = fopen(nameBuf, "w");
    if (fp == NULL) {
      fprintf(stderr, "ERROR: unable to open %s\n", nameBuf);
      return -1;
    }
    fprintf(fp, "interface Interface%03d {\n", i);
    if ((i & 0x01) != 0)
      fprintf(fp, "    int func%03d();\n", i);
    fprintf(fp, "}\n");
    fclose(fp);
  }
  fp = fopen("func-decl", "w");
  fprintf(fp, "    implements\n");
  for (i = 0; i < count; i++) {
    fprintf(fp, "        Interface%03d%s\n", i, (i == count - 1) ? "" : ",");
  }
  fprintf(fp, "\n");
  for (i = 1; i < count; i += 2) {
    fprintf(fp, "    public int func%03d() { return %d; }\n", i, i);
  }
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<createFiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    121f <createFiles+0xdf>
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0x20,%esi
lea    0xe8f(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x40(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11bd <createFiles+0x7d>
mov    0x2e44(%rip),%rax
movslq (%rax),%rdi
lea    -0x40(%rbp),%rdx
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12f9 <createFiles+0x1b9>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11f6 <createFiles+0xb6>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe5f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xebe(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <createFiles+0x12>
lea    0xe3d(%rip),%rdi
lea    0xdea(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe2c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    129e <createFiles+0x15e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%r8d
sub    $0x1,%r8d
lea    0xe22(%rip),%rcx
lea    0xde7(%rip),%rax
cmp    %r8d,%esi
cmove  %rax,%rcx
lea    0xdf4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    124f <createFiles+0x10f>
mov    -0x10(%rbp),%rdi
lea    0xdb8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12e9 <createFiles+0x1a9>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xdc4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    12b7 <createFiles+0x177>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createFiles>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edi,%r14d
test   %edi,%edi
jle    1217 <createFiles+0xb7>
mov    %rsp,%rbx
lea    0xe94(%rip),%r12
lea    0xf35(%rip),%rbp
xor    %r15d,%r15d
jmp    11b6 <createFiles+0x56>
nop
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbp,%rdi
mov    %r13,%rcx
call   1080 <fwrite@plt>
mov    %r13,%rdi
call   1030 <fclose@plt>
add    $0x1,%r15d
cmp    %r15d,%r14d
je     1217 <createFiles+0xb7>
mov    %rbx,%rdi
mov    $0x20,%esi
lea    0xe3b(%rip),%rdx
mov    %r15d,%ecx
call   1040 <snprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     12db <createFiles+0x17b>
mov    %rax,%r13
mov    %rax,%rdi
lea    0xe45(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
test   $0x1,%r15b
je     1190 <createFiles+0x30>
mov    %r13,%rdi
lea    0xe46(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1190 <createFiles+0x30>
lea    0xe45(%rip),%rdi
lea    0xdf2(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r12
lea    0xe39(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
test   %r14d,%r14d
jle    12fd <createFiles+0x19d>
lea    -0x1(%r14),%ebx
lea    0xe3c(%rip),%r13
lea    0xe1c(%rip),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %ebp,%ebx
mov    %r13,%rcx
lea    0xde6(%rip),%rax
cmove  %rax,%rcx
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1270 <createFiles+0x110>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
cmp    $0x2,%r14d
jl     130a <createFiles+0x1aa>
mov    $0x1,%ebp
lea    0xde2(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x2,%ebp
cmp    %r14d,%ebp
jl     12c0 <createFiles+0x160>
jmp    130a <createFiles+0x1aa>
mov    0x2cfe(%rip),%rax
movslq (%rax),%rdi
lea    0xd2d(%rip),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    1314 <createFiles+0x1b4>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"src/Interface%03d.java\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.2 = [26 x i8] c"ERROR: unable to open %s\0A\00"
@.str.3 = [27 x i8] c"interface Interface%03d {\0A\00"
@.str.4 = [21 x i8] c" int func%03d();\0A\00"
@.str.5 = [3 x i8] c"}\0A\00"
@.str.6 = [10 x i8] c"func-decl\00"
@.str.7 = [16 x i8] c" implements\0A\00"
@.str.8 = [25 x i8] c" Interface%03d%s\0A\00"
@.str.9 = [1 x i8] zeroinitializer
@.str.10 = [2 x i8] c",\00"
@.str.11 = [2 x i8] c"\0A\00"
@.str.12 = [42 x i8] c" public int func%03d() { return %d; }\0A\00"
define i32 @createFiles(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [32 x i8]
store i32 %0, i32* %3
store i32 0, i32* %5
br label %7
7: ; preds = %41, %1
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %44
11: ; preds = %7
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%13 = load i32, i32* %5
%14 = call i32 @snprintf(i8* %12, i32 32, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %4
%17 = load i32*, i32** %4
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %25
19: ; preds = %11
%20 = load i32, i32* @stderr
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %23)
store i32 -1, i32* %2
br label %83
25: ; preds = %11
%26 = load i32*, i32** %4
%27 = load i32, i32* %5
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %5
%30 = and i32 %29, 1
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %25
%33 = load i32*, i32** %4
%34 = load i32, i32* %5
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %32, %25
%37 = load i32*, i32** %4
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%39 = load i32*, i32** %4
%40 = call i32 @fclose(i32* %39)
br label %41
41: ; preds = %36
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
br label %7
44: ; preds = %7
%45 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %45, i32** %4
%46 = load i32*, i32** %4
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %5
br label %48
48: ; preds = %62, %44
%49 = load i32, i32* %5
%50 = load i32, i32* %3
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %65
52: ; preds = %48
%53 = load i32*, i32** %4
%54 = load i32, i32* %5
%55 = load i32, i32* %5
%56 = load i32, i32* %3
%57 = sub nsw i32 %56, 1
%58 = icmp eq i32 %55, %57
%59 = zext i1 %58 to i64
%60 = select i1 %58, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0)
%61 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %54, i8* %60)
br label %62
62: ; preds = %52
%63 = load i32, i32* %5
%64 = add nsw i32 %63, 1
store i32 %64, i32* %5
br label %48
65: ; preds = %48
%66 = load i32*, i32** %4
%67 = call i32 (i32*, i8*, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %5
br label %68
68: ; preds = %77, %65
%69 = load i32, i32* %5
%70 = load i32, i32* %3
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %80
72: ; preds = %68
%73 = load i32*, i32** %4
%74 = load i32, i32* %5
%75 = load i32, i32* %5
%76 = call i32 (i32*, i8*, ...) @fprintf(i32* %73, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0), i32 %74, i32 %75)
br label %77
77: ; preds = %72
%78 = load i32, i32* %5
%79 = add nsw i32 %78, 2
store i32 %79, i32* %5
br label %68
80: ; preds = %68
%81 = load i32*, i32** %4
%82 = call i32 @fclose(i32* %81)
store i32 0, i32* %2
br label %83
83: ; preds = %80, %19
%84 = load i32, i32* %2
ret i32 %84
}

LLVM IR (-O2):
@.str = [23 x i8] c"src/Interface%03d.java\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.2 = [26 x i8] c"ERROR: unable to open %s\0A\00"
@.str.3 = [27 x i8] c"interface Interface%03d {\0A\00"
@.str.4 = [21 x i8] c" int func%03d();\0A\00"
@.str.5 = [3 x i8] c"}\0A\00"
@.str.6 = [10 x i8] c"func-decl\00"
@.str.7 = [16 x i8] c" implements\0A\00"
@.str.8 = [25 x i8] c" Interface%03d%s\0A\00"
@.str.9 = [1 x i8] zeroinitializer
@.str.10 = [2 x i8] c",\00"
@.str.12 = [42 x i8] c" public int func%03d() { return %d; }\0A\00"
define i32 @createFiles(i32 %0) {
%2 = alloca [32 x i8]
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %27
4: ; preds = %1
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
br label %6
6: ; preds = %4, %22
%7 = phi i32 [ 0, %4 ], [ %25, %22 ]
%8 = call i32 @snprintf(i8* %5, i32 32, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = load i32, i32* @stderr
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %5)
br label %51
16: ; preds = %6
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%18 = and i32 %7, 1
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %7)
br label %22
22: ; preds = %20, %16
%23 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i64 2, i64 1, i32* %9)
%24 = call i32 @fclose(i32* %9)
%25 = add nuw nsw i32 %7, 1
%26 = icmp eq i32 %25, %0
br i1 %26, label %27, label %6
27: ; preds = %22, %1
%28 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i64 15, i64 1, i32* %28)
br i1 %3, label %32, label %30
30: ; preds = %27
%31 = call i32 @fputc(i32 10, i32* %28)
br label %49
32: ; preds = %27
%33 = add nsw i32 %0, -1
br label %34
34: ; preds = %32, %34
%35 = phi i32 [ 0, %32 ], [ %39, %34 ]
%36 = icmp eq i32 %35, %33
%37 = select i1 %36, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0)
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %35, i8* %37)
%39 = add nuw nsw i32 %35, 1
%40 = icmp eq i32 %39, %0
br i1 %40, label %41, label %34
41: ; preds = %34
%42 = call i32 @fputc(i32 10, i32* %28)
%43 = icmp sgt i32 %0, 1
br i1 %43, label %44, label %49
44: ; preds = %41, %44
%45 = phi i32 [ %47, %44 ], [ 1, %41 ]
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0), i32 %45, i32 %45)
%47 = add nuw nsw i32 %45, 2
%48 = icmp slt i32 %47, %0
br i1 %48, label %44, label %49
49: ; preds = %44, %30, %41
%50 = call i32 @fclose(i32* %28)
br label %51
51: ; preds = %11, %49
%52 = phi i32 [ 0, %49 ], [ -1, %11 ]
ret i32 %52
}