#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stderr;
int createFiles(int count) {
  FILE *fp;
  int i;
  for (i = 0; i < count; i++) {
    char nameBuf[32];
    sprintf(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    121a <createFiles+0xda>
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe94(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x40(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b8 <createFiles+0x78>
mov    0x2e49(%rip),%rax
movslq (%rax),%rdi
lea    -0x40(%rbp),%rdx
lea    0xe74(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12f4 <createFiles+0x1b4>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe6d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11f1 <createFiles+0xb1>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe64(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xec3(%rip),%rsi
mov    $0x0,%al
call   1040 <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    0xe42(%rip),%rdi
lea    0xdef(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe31(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1299 <createFiles+0x159>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%r8d
sub    $0x1,%r8d
lea    0xe27(%rip),%rcx
lea    0xdec(%rip),%rax
cmp    %r8d,%esi
cmove  %rax,%rcx
lea    0xdf9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    124a <createFiles+0x10a>
mov    -0x10(%rbp),%rdi
lea    0xdbd(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12e4 <createFiles+0x1a4>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xdc9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    12b2 <createFiles+0x172>
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    120f <createFiles+0xaf>
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     120f <createFiles+0xaf>
mov    %rbx,%rdi
lea    0xe40(%rip),%rsi
mov    %r15d,%edx
call   1070 <sprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     12cb <createFiles+0x16b>
mov    %rax,%r13
mov    %rax,%rdi
lea    0xe4a(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
test   $0x1,%r15b
je     1190 <createFiles+0x30>
mov    %r13,%rdi
lea    0xe4b(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1190 <createFiles+0x30>
lea    0xe4d(%rip),%rdi
lea    0xdfa(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r12
lea    0xe41(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
test   %r14d,%r14d
jle    12ed <createFiles+0x18d>
lea    -0x1(%r14),%ebx
lea    0xe44(%rip),%r13
lea    0xe24(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
cmp    %ebp,%ebx
mov    %r13,%rcx
lea    0xdf6(%rip),%rax
cmove  %rax,%rcx
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1260 <createFiles+0x100>
mov    $0xa,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
cmp    $0x2,%r14d
jl     12fa <createFiles+0x19a>
mov    $0x1,%ebp
lea    0xdf2(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x2,%ebp
cmp    %r14d,%ebp
jl     12b0 <createFiles+0x150>
jmp    12fa <createFiles+0x19a>
mov    0x2d0e(%rip),%rax
movslq (%rax),%rdi
lea    0xd3d(%rip),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    1304 <createFiles+0x1a4>
mov    $0xa,%edi
mov    %r12,%rsi
call   1040 <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 @sprintf(i8* %12, 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 @sprintf(i8* %5, i8* dereferenceable(1) 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 = tail 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 = tail 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 = tail 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 = tail 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 = tail 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 = tail 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 = tail 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 = tail 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 = tail 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 = tail 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 = tail call i32 @fclose(i32* %28)
br label %51
51: ; preds = %11, %49
%52 = phi i32 [ 0, %49 ], [ -1, %11 ]
ret i32 %52
}