#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 O_APPEND;
int O_CREAT;
int O_RDONLY;
int O_RDWR;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ fl_disp(char *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  fl_disp("O_RDONLY", O_RDONLY);
  fl_disp("O_WRONLY", O_WRONLY);
  fl_disp("O_RDWR", O_RDWR);
  printf("\n");
  fl_disp("O_APPEND", O_APPEND);
  fl_disp("O_TRUNC", O_TRUNC);
  fl_disp("O_CREAT", O_CREAT);
  printf("\n");
  fl_disp("O_WRONLY|O_APPEND|O_CREAT", O_WRONLY | O_APPEND | O_CREAT);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fl_disp@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%esi
lea    0xec0(%rip),%rdi
call   1030 <fl_disp@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
lea    0xeb4(%rip),%rdi
call   1030 <fl_disp@plt>
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
lea    0xe9c(%rip),%rdi
call   1030 <fl_disp@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
lea    0xe90(%rip),%rdi
call   1030 <fl_disp@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%esi
lea    0xe95(%rip),%rdi
call   1030 <fl_disp@plt>
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%esi
mov    0x2de6(%rip),%rax
or     (%rax),%esi
mov    0x2e25(%rip),%rax
or     (%rax),%esi
lea    0xe50(%rip),%rdi
call   1030 <fl_disp@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
lea    0xecb(%rip),%rdi
call   1040 <fl_disp@plt>
mov    0x2e77(%rip),%r14
mov    (%r14),%esi
lea    0xebe(%rip),%rdi
call   1040 <fl_disp@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
lea    0xeb2(%rip),%rdi
call   1040 <fl_disp@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2e3a(%rip),%r15
mov    (%r15),%esi
lea    0xe99(%rip),%rdi
call   1040 <fl_disp@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%esi
lea    0xe8d(%rip),%rdi
call   1040 <fl_disp@plt>
mov    0x2e57(%rip),%rbx
mov    (%rbx),%esi
lea    0xe92(%rip),%rdi
call   1040 <fl_disp@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r15),%esi
or     (%r14),%esi
or     (%rbx),%esi
lea    0xe62(%rip),%rdi
call   1040 <fl_disp@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"O_RDONLY\00"
@O_RDONLY = global i32 0
@.str.1 = [9 x i8] c"O_WRONLY\00"
@O_WRONLY = global i32 0
@.str.2 = [7 x i8] c"O_RDWR\00"
@O_RDWR = global i32 0
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [9 x i8] c"O_APPEND\00"
@O_APPEND = global i32 0
@.str.5 = [8 x i8] c"O_TRUNC\00"
@O_TRUNC = global i32 0
@.str.6 = [8 x i8] c"O_CREAT\00"
@O_CREAT = global i32 0
@.str.7 = [26 x i8] c"O_WRONLY|O_APPEND|O_CREAT\00"
define i32 @main() {
%1 = load i32, i32* @O_RDONLY
%2 = call i32 @fl_disp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @O_WRONLY
%4 = call i32 @fl_disp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @O_RDWR
%6 = call i32 @fl_disp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%8 = load i32, i32* @O_APPEND
%9 = call i32 @fl_disp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @O_TRUNC
%11 = call i32 @fl_disp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @O_CREAT
%13 = call i32 @fl_disp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32, i32* @O_WRONLY
%16 = load i32, i32* @O_APPEND
%17 = or i32 %15, %16
%18 = load i32, i32* @O_CREAT
%19 = or i32 %17, %18
%20 = call i32 @fl_disp(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"O_RDONLY\00"
@O_RDONLY = global i32 0
@.str.1 = [9 x i8] c"O_WRONLY\00"
@O_WRONLY = global i32 0
@.str.2 = [7 x i8] c"O_RDWR\00"
@O_RDWR = global i32 0
@.str.4 = [9 x i8] c"O_APPEND\00"
@O_APPEND = global i32 0
@.str.5 = [8 x i8] c"O_TRUNC\00"
@O_TRUNC = global i32 0
@.str.6 = [8 x i8] c"O_CREAT\00"
@O_CREAT = global i32 0
@.str.7 = [26 x i8] c"O_WRONLY|O_APPEND|O_CREAT\00"
define i32 @main() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 @fl_disp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @O_WRONLY
%4 = tail call i32 @fl_disp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @O_RDWR
%6 = tail call i32 @fl_disp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @putchar(i32 10)
%8 = load i32, i32* @O_APPEND
%9 = tail call i32 @fl_disp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @O_TRUNC
%11 = tail call i32 @fl_disp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @O_CREAT
%13 = tail call i32 @fl_disp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %12)
%14 = tail call i32 @putchar(i32 10)
%15 = load i32, i32* @O_WRONLY
%16 = load i32, i32* @O_APPEND
%17 = or i32 %16, %15
%18 = load i32, i32* @O_CREAT
%19 = or i32 %17, %18
%20 = tail call i32 @fl_disp(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %19)
ret i32 0
}