#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*/ O_CREAT;
int S_IRGRP;
int S_IRUSR;
int S_IWGRP;
int S_IWUSR;
int S_IXOTH;
int S_IXUSR;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ open(char *, int /*<<< orphan*/, int);
int main(void) {
  open("myfile_with_permissions1", O_CREAT, S_IRUSR | S_IXOTH);
  open("myfile_with_permissions2", O_CREAT,
       S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%esi
mov    0x2e71(%rip),%rax
mov    (%rax),%edx
mov    0x2e98(%rip),%rax
or     (%rax),%edx
lea    0xeaf(%rip),%rdi
call   1030 <open@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
mov    0x2e4a(%rip),%rax
mov    (%rax),%edx
mov    0x2e59(%rip),%rax
or     (%rax),%edx
mov    0x2e60(%rip),%rax
or     (%rax),%edx
mov    0x2e37(%rip),%rax
or     (%rax),%edx
mov    0x2e46(%rip),%rax
or     (%rax),%edx
lea    0xe86(%rip),%rdi
call   1030 <open@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
mov    (%r14),%esi
mov    0x2e7b(%rip),%rbx
mov    0x2ea4(%rip),%rax
mov    (%rax),%edx
or     (%rbx),%edx
lea    0xeb9(%rip),%rdi
call   1030 <open@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%edx
or     (%rbx),%edx
mov    0x2e7a(%rip),%rax
or     (%rax),%edx
mov    0x2e51(%rip),%rax
or     (%rax),%edx
mov    (%r14),%esi
mov    0x2e5d(%rip),%rax
or     (%rax),%edx
lea    0xe9d(%rip),%rdi
call   1030 <open@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"myfile_with_permissions1\00"
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IXOTH = global i32 0
@.str.1 = [25 x i8] c"myfile_with_permissions2\00"
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @O_CREAT
%3 = load i32, i32* @S_IRUSR
%4 = load i32, i32* @S_IXOTH
%5 = or i32 %3, %4
%6 = call i32 @open(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %5)
%7 = load i32, i32* @O_CREAT
%8 = load i32, i32* @S_IRUSR
%9 = load i32, i32* @S_IWUSR
%10 = or i32 %8, %9
%11 = load i32, i32* @S_IXUSR
%12 = or i32 %10, %11
%13 = load i32, i32* @S_IRGRP
%14 = or i32 %12, %13
%15 = load i32, i32* @S_IWGRP
%16 = or i32 %14, %15
%17 = call i32 @open(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %16)
%18 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [25 x i8] c"myfile_with_permissions1\00"
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IXOTH = global i32 0
@.str.1 = [25 x i8] c"myfile_with_permissions2\00"
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_CREAT
%2 = load i32, i32* @S_IRUSR
%3 = load i32, i32* @S_IXOTH
%4 = or i32 %3, %2
%5 = tail call i32 @open(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %4)
%6 = load i32, i32* @O_CREAT
%7 = load i32, i32* @S_IRUSR
%8 = load i32, i32* @S_IWUSR
%9 = or i32 %8, %7
%10 = load i32, i32* @S_IXUSR
%11 = or i32 %9, %10
%12 = load i32, i32* @S_IRGRP
%13 = or i32 %11, %12
%14 = load i32, i32* @S_IWGRP
%15 = or i32 %13, %14
%16 = tail call i32 @open(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %15)
%17 = tail call i32 @exit(i32 0)
unreachable
}