#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 *, ...);
void printvmdkfile(char *src, char *output, long tsectors, int cyls, int heads,
                   int sectpertrack) {
  FILE *outputfile;
  outputfile = fopen(output, "w");
  fprintf(outputfile, "\nversion=1\n");
  fprintf(outputfile, "encoding=\"UTF-8\"\n");
  fprintf(outputfile, "CID=fffffffe\n");
  fprintf(outputfile, "parentCID=ffffffff\n");
  fprintf(outputfile, "isNativeSnapshot=\"no\"\n");
  fprintf(outputfile, "createType=\"monolithicFlat\"\n\n");
  fprintf(outputfile, "RW %ld FLAT \"%s\" 0\n\n", tsectors, src);
  fprintf(outputfile, "ddb.virtualHWVersion = \"7\"\n");
  fprintf(outputfile,
          "ddb.longContentID = \"29075898903f9855853610dffffffffe\"\n");
  fprintf(outputfile,
          "ddb.uuid = \"60 00 C2 91 8e 73 27 62-43 58 3b f8 05 ae 2e a0\"\n");
  fprintf(outputfile, "ddb.geometry.cylinders = \"%d\"\n", cyls);
  fprintf(outputfile, "ddb.geometry.heads = \"%d\"\n", heads);
  fprintf(outputfile, "ddb.geometry.sectors = \"%d\"\n", sectpertrack);
  fprintf(outputfile, "ddb.adapterType = \"ide\"\n");
  fclose(outputfile);
}


x86 assembly (clang, -O0):
<printvmdkfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xe94(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xe8e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xe8e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xe91(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe95(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xea2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xec8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xef1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xefb(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xf01(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xf0c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printvmdkfile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %rdx,%r13
mov    %rsi,%rax
mov    %rdi,%rbp
lea    0xe9c(%rip),%rsi
mov    %rax,%rdi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xe8c(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1060 <fwrite@plt>
lea    0xe7f(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe78(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe6d(%rip),%rdi
mov    $0x13,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe68(%rip),%rdi
mov    $0x16,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe66(%rip),%rdi
mov    $0x1d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
mov    %r13,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe69(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe6c(%rip),%rdi
mov    $0x37,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe8b(%rip),%rdi
mov    $0x3d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xec2(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xecb(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [12 x i8] c"\0Aversion=1\0A\00"
@.str.2 = [18 x i8] c"encoding=\22UTF-8\22\0A\00"
@.str.3 = [14 x i8] c"CID=fffffffe\0A\00"
@.str.4 = [20 x i8] c"parentCID=ffffffff\0A\00"
@.str.5 = [23 x i8] c"isNativeSnapshot=\22no\22\0A\00"
@.str.6 = [30 x i8] c"createType=\22monolithicFlat\22\0A\0A\00"
@.str.7 = [21 x i8] c"RW %ld FLAT \22%s\22 0\0A\0A\00"
@.str.8 = [28 x i8] c"ddb.virtualHWVersion = \227\22\0A\00"
@.str.9 = [56 x i8] c"ddb.longContentID = \2229075898903f9855853610dffffffffe\22\0A\00"
@.str.10 = [62 x i8] c"ddb.uuid = \2260 00 C2 91 8e 73 27 62-43 58 3b f8 05 ae 2e a0\22\0A\00"
@.str.11 = [31 x i8] c"ddb.geometry.cylinders = \22%d\22\0A\00"
@.str.12 = [27 x i8] c"ddb.geometry.heads = \22%d\22\0A\00"
@.str.13 = [29 x i8] c"ddb.geometry.sectors = \22%d\22\0A\00"
@.str.14 = [25 x i8] c"ddb.adapterType = \22ide\22\0A\00"
define void @printvmdkfile(i8* %0, i8* %1, i64 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i8*, i8** %8
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %13
%16 = load i32*, i32** %13
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32*, i32** %13
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32*, i32** %13
%21 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32*, i32** %13
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%24 = load i32*, i32** %13
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%26 = load i32*, i32** %13
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%28 = load i32*, i32** %13
%29 = load i64, i64* %9
%30 = load i8*, i8** %7
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i64 %29, i8* %30)
%32 = load i32*, i32** %13
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%34 = load i32*, i32** %13
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.9, i64 0, i64 0))
%36 = load i32*, i32** %13
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.10, i64 0, i64 0))
%38 = load i32*, i32** %13
%39 = load i32, i32* %10
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i32 %39)
%41 = load i32*, i32** %13
%42 = load i32, i32* %11
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), i32 %42)
%44 = load i32*, i32** %13
%45 = load i32, i32* %12
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i32 %45)
%47 = load i32*, i32** %13
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0))
%49 = load i32*, i32** %13
%50 = call i32 @fclose(i32* %49)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [12 x i8] c"\0Aversion=1\0A\00"
@.str.2 = [18 x i8] c"encoding=\22UTF-8\22\0A\00"
@.str.3 = [14 x i8] c"CID=fffffffe\0A\00"
@.str.4 = [20 x i8] c"parentCID=ffffffff\0A\00"
@.str.5 = [23 x i8] c"isNativeSnapshot=\22no\22\0A\00"
@.str.6 = [30 x i8] c"createType=\22monolithicFlat\22\0A\0A\00"
@.str.7 = [21 x i8] c"RW %ld FLAT \22%s\22 0\0A\0A\00"
@.str.8 = [28 x i8] c"ddb.virtualHWVersion = \227\22\0A\00"
@.str.9 = [56 x i8] c"ddb.longContentID = \2229075898903f9855853610dffffffffe\22\0A\00"
@.str.10 = [62 x i8] c"ddb.uuid = \2260 00 C2 91 8e 73 27 62-43 58 3b f8 05 ae 2e a0\22\0A\00"
@.str.11 = [31 x i8] c"ddb.geometry.cylinders = \22%d\22\0A\00"
@.str.12 = [27 x i8] c"ddb.geometry.heads = \22%d\22\0A\00"
@.str.13 = [29 x i8] c"ddb.geometry.sectors = \22%d\22\0A\00"
@.str.14 = [25 x i8] c"ddb.adapterType = \22ide\22\0A\00"
define void @printvmdkfile(i8* %0, i8* nocapture %1, i64 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i64 11, i64 1, i32* %7)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 17, i64 1, i32* %7)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 13, i64 1, i32* %7)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i64 19, i64 1, i32* %7)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i64 22, i64 1, i32* %7)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i64 29, i64 1, i32* %7)
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i64 %2, i8* %0)
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i64 27, i64 1, i32* %7)
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.9, i64 0, i64 0), i64 55, i64 1, i32* %7)
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.10, i64 0, i64 0), i64 61, i64 1, i32* %7)
%18 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i32 %3)
%19 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), i32 %4)
%20 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i32 %5)
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0), i64 24, i64 1, i32* %7)
%22 = tail call i32 @fclose(i32* %7)
ret void
}