#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*/ createFile(char *);
int /*<<< orphan*/ fileSeek(char *);
int /*<<< orphan*/ fileSync(char *);
int /*<<< orphan*/ openFile(char *);
int /*<<< orphan*/ readFile(char *);
int /*<<< orphan*/ truncateFile(char *, int);
int /*<<< orphan*/ writeFile(char *);
int main(void) {
  openFile("../../LICENSE");
  createFile("salo.txt");
  readFile("../../LICENSE");
  writeFile("salo.txt");
  fileSync("salo.txt");
  fileSeek("../../LICENSE");
  truncateFile("salo.txt", 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
call   1050 <openFile@plt>
lea    0xe7c(%rip),%rdi
call   1060 <createFile@plt>
lea    0xe62(%rip),%rdi
call   1090 <readFile@plt>
lea    0xe64(%rip),%rdi
call   1070 <writeFile@plt>
lea    0xe58(%rip),%rdi
call   1040 <fileSync@plt>
lea    0xe3e(%rip),%rdi
call   1030 <fileSeek@plt>
lea    0xe40(%rip),%rdi
mov    $0x3,%esi
call   1080 <truncateFile@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe85(%rip),%r14
mov    %r14,%rdi
call   1050 <openFile@plt>
lea    0xe84(%rip),%rbx
mov    %rbx,%rdi
call   1060 <createFile@plt>
mov    %r14,%rdi
call   1090 <readFile@plt>
mov    %rbx,%rdi
call   1070 <writeFile@plt>
mov    %rbx,%rdi
call   1040 <fileSync@plt>
mov    %r14,%rdi
call   1030 <fileSeek@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1080 <truncateFile@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"../../LICENSE\00"
@.str.1 = [9 x i8] c"salo.txt\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @openFile(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @createFile(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @readFile(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @writeFile(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @fileSync(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @fileSeek(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @truncateFile(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 3)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"../../LICENSE\00"
@.str.1 = [9 x i8] c"salo.txt\00"
define i32 @main() {
%1 = tail call i32 @openFile(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @createFile(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @readFile(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @writeFile(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @fileSync(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @fileSeek(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @truncateFile(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 3)
ret i32 0
}