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

/* Variables and functions */
int /*<<< orphan*/ writeDisk(char *, char *, unsigned long, int);
int createDisk(char *path, unsigned long n) {
  writeDisk(path, "disk0.dat", n, 1);
  writeDisk(path, "disk1.dat", n, 1);
  writeDisk(path, "disk2.dat", n, 1);
  writeDisk(path, "disk3.dat", n, 1);
  writeDisk(path, "drive.dat", n, 0);
  return 1;
}


x86 assembly (clang, -O0):
<createDisk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
mov    $0x1,%ecx
call   1030 <writeDisk@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xec2(%rip),%rsi
mov    $0x1,%ecx
call   1030 <writeDisk@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeb3(%rip),%rsi
mov    $0x1,%ecx
call   1030 <writeDisk@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xea4(%rip),%rsi
mov    $0x1,%ecx
call   1030 <writeDisk@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe95(%rip),%rsi
xor    %ecx,%ecx
call   1030 <writeDisk@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createDisk>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rsi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1030 <writeDisk@plt>
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1030 <writeDisk@plt>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1030 <writeDisk@plt>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1030 <writeDisk@plt>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %ecx,%ecx
call   1030 <writeDisk@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"disk0.dat\00"
@.str.1 = [10 x i8] c"disk1.dat\00"
@.str.2 = [10 x i8] c"disk2.dat\00"
@.str.3 = [10 x i8] c"disk3.dat\00"
@.str.4 = [10 x i8] c"drive.dat\00"
define i32 @createDisk(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @writeDisk(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %6, i32 1)
%8 = load i8*, i8** %3
%9 = load i64, i64* %4
%10 = call i32 @writeDisk(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 %9, i32 1)
%11 = load i8*, i8** %3
%12 = load i64, i64* %4
%13 = call i32 @writeDisk(i8* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i64 %12, i32 1)
%14 = load i8*, i8** %3
%15 = load i64, i64* %4
%16 = call i32 @writeDisk(i8* %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i64 %15, i32 1)
%17 = load i8*, i8** %3
%18 = load i64, i64* %4
%19 = call i32 @writeDisk(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i64 %18, i32 0)
ret i32 1
}

LLVM IR (-O2):
@.str = [10 x i8] c"disk0.dat\00"
@.str.1 = [10 x i8] c"disk1.dat\00"
@.str.2 = [10 x i8] c"disk2.dat\00"
@.str.3 = [10 x i8] c"disk3.dat\00"
@.str.4 = [10 x i8] c"drive.dat\00"
define i32 @createDisk(i8* %0, i64 %1) {
%3 = tail call i32 @writeDisk(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %1, i32 1)
%4 = tail call i32 @writeDisk(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 %1, i32 1)
%5 = tail call i32 @writeDisk(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i64 %1, i32 1)
%6 = tail call i32 @writeDisk(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i64 %1, i32 1)
%7 = tail call i32 @writeDisk(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i64 %1, i32 0)
ret i32 1
}