#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 LLONG_MAX;
int O_CREAT;
int O_WRONLY;
int POSIX_FADV_DONTNEED;
int POSIX_FADV_NORMAL;
int POSIX_FADV_RANDOM;
int POSIX_FADV_SEQUENTIAL;
int POSIX_FADV_WILLNEED;
int /*<<< orphan*/ S_IRWXU;
int /*<<< orphan*/ close(int);
int open(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ posix_fadvise(int, int, int, int);
int main() {
  int fd;
  fd = open("foobar", O_WRONLY | O_CREAT, S_IRWXU);
  posix_fadvise(fd, 0, 1024, POSIX_FADV_NORMAL);
  posix_fadvise(-1, 0, 1024, POSIX_FADV_RANDOM);
  posix_fadvise(fd, -1, 1024, POSIX_FADV_SEQUENTIAL);
  posix_fadvise(fd, 0, -1, POSIX_FADV_WILLNEED);
  posix_fadvise(fd, LLONG_MAX, 0, POSIX_FADV_DONTNEED);
  posix_fadvise(fd, 0x72345678deadbeefLL, 0, POSIX_FADV_DONTNEED);
  posix_fadvise(fd, 0, LLONG_MAX, POSIX_FADV_DONTNEED);
  posix_fadvise(fd, 0, 0x72345678deadbeefLL, POSIX_FADV_DONTNEED);
  posix_fadvise(fd, 0, 1024, -1);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e52(%rip),%rax
mov    (%rax),%esi
mov    0x2ea9(%rip),%rax
or     (%rax),%esi
mov    0x2e80(%rip),%rax
mov    (%rax),%edx
lea    0xe9f(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e5d(%rip),%rax
mov    (%rax),%ecx
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <posix_fadvise@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%ecx
mov    $0xffffffff,%edi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <posix_fadvise@plt>
mov    -0x8(%rbp),%edi
mov    0x2e03(%rip),%rax
mov    (%rax),%ecx
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1040 <posix_fadvise@plt>
mov    -0x8(%rbp),%edi
mov    0x2e08(%rip),%rax
mov    (%rax),%ecx
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1040 <posix_fadvise@plt>
mov    -0x8(%rbp),%edi
mov    0x2de8(%rip),%rax
mov    (%rax),%esi
mov    0x2e07(%rip),%rax
mov    (%rax),%ecx
xor    %edx,%edx
call   1040 <posix_fadvise@plt>
mov    -0x8(%rbp),%edi
mov    0x2df4(%rip),%rax
mov    (%rax),%ecx
mov    $0xdeadbeef,%esi
xor    %edx,%edx
call   1040 <posix_fadvise@plt>
mov    -0x8(%rbp),%edi
mov    0x2db4(%rip),%rax
mov    (%rax),%edx
mov    0x2dd3(%rip),%rax
mov    (%rax),%ecx
xor    %esi,%esi
call   1040 <posix_fadvise@plt>
mov    -0x8(%rbp),%edi
mov    0x2dc0(%rip),%rax
mov    (%rax),%ecx
xor    %esi,%esi
mov    $0xdeadbeef,%edx
call   1040 <posix_fadvise@plt>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
mov    $0x400,%edx
mov    $0xffffffff,%ecx
call   1040 <posix_fadvise@plt>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x2e5c(%rip),%rax
mov    0x2eb5(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
lea    0xea9(%rip),%rdi
call   1050 <open@plt>
mov    %eax,%ebx
mov    0x2e6b(%rip),%rax
mov    (%rax),%ecx
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <posix_fadvise@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%ecx
mov    $0xffffffff,%edi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <posix_fadvise@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%ecx
mov    %ebx,%edi
mov    $0xffffffff,%esi
mov    $0x400,%edx
call   1040 <posix_fadvise@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%ecx
mov    %ebx,%edi
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1040 <posix_fadvise@plt>
mov    0x2df9(%rip),%r14
mov    (%r14),%esi
mov    0x2e17(%rip),%r15
mov    (%r15),%ecx
mov    %ebx,%edi
xor    %edx,%edx
call   1040 <posix_fadvise@plt>
mov    (%r15),%ecx
mov    %ebx,%edi
mov    $0xdeadbeef,%esi
xor    %edx,%edx
call   1040 <posix_fadvise@plt>
mov    (%r14),%edx
mov    (%r15),%ecx
mov    %ebx,%edi
xor    %esi,%esi
call   1040 <posix_fadvise@plt>
mov    (%r15),%ecx
mov    %ebx,%edi
xor    %esi,%esi
mov    $0xdeadbeef,%edx
call   1040 <posix_fadvise@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x400,%edx
mov    $0xffffffff,%ecx
call   1040 <posix_fadvise@plt>
mov    %ebx,%edi
call   1030 <close@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"foobar\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@S_IRWXU = global i32 0
@POSIX_FADV_NORMAL = global i32 0
@POSIX_FADV_RANDOM = global i32 0
@POSIX_FADV_SEQUENTIAL = global i32 0
@POSIX_FADV_WILLNEED = global i32 0
@LLONG_MAX = global i32 0
@POSIX_FADV_DONTNEED = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @O_WRONLY
%4 = load i32, i32* @O_CREAT
%5 = or i32 %3, %4
%6 = load i32, i32* @S_IRWXU
%7 = call i32 @open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = load i32, i32* @POSIX_FADV_NORMAL
%10 = call i32 @posix_fadvise(i32 %8, i32 0, i32 1024, i32 %9)
%11 = load i32, i32* @POSIX_FADV_RANDOM
%12 = call i32 @posix_fadvise(i32 -1, i32 0, i32 1024, i32 %11)
%13 = load i32, i32* %2
%14 = load i32, i32* @POSIX_FADV_SEQUENTIAL
%15 = call i32 @posix_fadvise(i32 %13, i32 -1, i32 1024, i32 %14)
%16 = load i32, i32* %2
%17 = load i32, i32* @POSIX_FADV_WILLNEED
%18 = call i32 @posix_fadvise(i32 %16, i32 0, i32 -1, i32 %17)
%19 = load i32, i32* %2
%20 = load i32, i32* @LLONG_MAX
%21 = load i32, i32* @POSIX_FADV_DONTNEED
%22 = call i32 @posix_fadvise(i32 %19, i32 %20, i32 0, i32 %21)
%23 = load i32, i32* %2
%24 = load i32, i32* @POSIX_FADV_DONTNEED
%25 = call i32 @posix_fadvise(i32 %23, i32 -559038737, i32 0, i32 %24)
%26 = load i32, i32* %2
%27 = load i32, i32* @LLONG_MAX
%28 = load i32, i32* @POSIX_FADV_DONTNEED
%29 = call i32 @posix_fadvise(i32 %26, i32 0, i32 %27, i32 %28)
%30 = load i32, i32* %2
%31 = load i32, i32* @POSIX_FADV_DONTNEED
%32 = call i32 @posix_fadvise(i32 %30, i32 0, i32 -559038737, i32 %31)
%33 = load i32, i32* %2
%34 = call i32 @posix_fadvise(i32 %33, i32 0, i32 1024, i32 -1)
%35 = load i32, i32* %2
%36 = call i32 @close(i32 %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"foobar\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@S_IRWXU = global i32 0
@POSIX_FADV_NORMAL = global i32 0
@POSIX_FADV_RANDOM = global i32 0
@POSIX_FADV_SEQUENTIAL = global i32 0
@POSIX_FADV_WILLNEED = global i32 0
@LLONG_MAX = global i32 0
@POSIX_FADV_DONTNEED = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_WRONLY
%2 = load i32, i32* @O_CREAT
%3 = or i32 %2, %1
%4 = load i32, i32* @S_IRWXU
%5 = tail call i32 @open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = load i32, i32* @POSIX_FADV_NORMAL
%7 = tail call i32 @posix_fadvise(i32 %5, i32 0, i32 1024, i32 %6)
%8 = load i32, i32* @POSIX_FADV_RANDOM
%9 = tail call i32 @posix_fadvise(i32 -1, i32 0, i32 1024, i32 %8)
%10 = load i32, i32* @POSIX_FADV_SEQUENTIAL
%11 = tail call i32 @posix_fadvise(i32 %5, i32 -1, i32 1024, i32 %10)
%12 = load i32, i32* @POSIX_FADV_WILLNEED
%13 = tail call i32 @posix_fadvise(i32 %5, i32 0, i32 -1, i32 %12)
%14 = load i32, i32* @LLONG_MAX
%15 = load i32, i32* @POSIX_FADV_DONTNEED
%16 = tail call i32 @posix_fadvise(i32 %5, i32 %14, i32 0, i32 %15)
%17 = load i32, i32* @POSIX_FADV_DONTNEED
%18 = tail call i32 @posix_fadvise(i32 %5, i32 -559038737, i32 0, i32 %17)
%19 = load i32, i32* @LLONG_MAX
%20 = load i32, i32* @POSIX_FADV_DONTNEED
%21 = tail call i32 @posix_fadvise(i32 %5, i32 0, i32 %19, i32 %20)
%22 = load i32, i32* @POSIX_FADV_DONTNEED
%23 = tail call i32 @posix_fadvise(i32 %5, i32 0, i32 -559038737, i32 %22)
%24 = tail call i32 @posix_fadvise(i32 %5, i32 0, i32 1024, i32 -1)
%25 = tail call i32 @close(i32 %5)
ret i32 0
}