#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void write_file_content_list(FILE *out, int amount) {
  int i;
  fprintf(out, "const unsigned char *files[] = {\n");
  for (i = 1; i <= amount; i++) {
    fprintf(out, "    f%d", i);
    if (i != amount) {
      fprintf(out, ", ");
    }
  }
  fprintf(out, "\n};\n\n");
}


x86 assembly (clang, -O0):
<write_file_content_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     118a <write_file_content_list+0x7a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1177 <write_file_content_list+0x67>
mov    -0x8(%rbp),%rdi
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    117c <write_file_content_list+0x6c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1138 <write_file_content_list+0x28>
mov    -0x8(%rbp),%rdi
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_file_content_list>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %esi,%r12d
mov    %rdi,%r14
lea    0xeca(%rip),%rdi
mov    $0x21,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fwrite@plt>
test   %r12d,%r12d
jle    11b0 <write_file_content_list+0x90>
neg    %r12d
mov    $0x1,%ebx
lea    0xec6(%rip),%r15
lea    0xec7(%rip),%r13
jmp    1183 <write_file_content_list+0x63>
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%r12,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     11b0 <write_file_content_list+0x90>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r12d,%eax
add    %ebx,%eax
je     1170 <write_file_content_list+0x50>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %r14,%rcx
call   1040 <fwrite@plt>
jmp    1170 <write_file_content_list+0x50>
lea    0xe76(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r14,%rcx
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"const unsigned char *files[] = {\0A\00"
@.str.1 = [8 x i8] c" f%d\00"
@.str.2 = [3 x i8] c", \00"
@.str.3 = [6 x i8] c"\0A};\0A\0A\00"
define void @write_file_content_list(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32*, i32** %3
%7 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %5
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = load i32*, i32** %3
%14 = load i32, i32* %5
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = load i32*, i32** %3
%21 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %19, %12
br label %23
23: ; preds = %22
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %8
26: ; preds = %8
%27 = load i32*, i32** %3
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"const unsigned char *files[] = {\0A\00"
@.str.1 = [8 x i8] c" f%d\00"
@.str.2 = [3 x i8] c", \00"
@.str.3 = [6 x i8] c"\0A};\0A\0A\00"
define void @write_file_content_list(i32* nocapture %0, i32 %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i64 33, i64 1, i32* %0)
%4 = icmp slt i32 %1, 1
br i1 %4, label %14, label %5
5: ; preds = %2, %11
%6 = phi i32 [ %12, %11 ], [ 1, %2 ]
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = icmp eq i32 %6, %1
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %11
11: ; preds = %5, %9
%12 = add nuw i32 %6, 1
%13 = icmp eq i32 %6, %1
br i1 %13, label %14, label %5
14: ; preds = %11, %2
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 5, i64 1, i32* %0)
ret void
}