#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*/ SEEK_END;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
int creat(char *, int);
int /*<<< orphan*/ lseek(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ umask(int);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  umask(S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
  int fd = creat("hole.txt",
                 (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH));
  write(fd, "hello", 5);
  lseek(fd, 80000, SEEK_END);
  write(fd, "world", 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
mov    0x2e81(%rip),%rax
or     (%rax),%edi
mov    0x2e58(%rip),%rax
or     (%rax),%edi
mov    0x2e37(%rip),%rax
or     (%rax),%edi
call   1050 <umask@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%esi
mov    0x2e50(%rip),%rax
or     (%rax),%esi
mov    0x2e37(%rip),%rax
or     (%rax),%esi
mov    0x2e46(%rip),%rax
or     (%rax),%esi
mov    0x2e1d(%rip),%rax
or     (%rax),%esi
mov    0x2dfc(%rip),%rax
or     (%rax),%esi
lea    0xe4b(%rip),%rdi
call   1060 <creat@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xe42(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%edi
mov    0x2e0d(%rip),%rax
mov    (%rax),%edx
mov    $0x13880,%esi
call   1040 <lseek@plt>
mov    -0x8(%rbp),%edi
lea    0xe1e(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x2e79(%rip),%r15
mov    0x2e8a(%rip),%r14
mov    (%r14),%edi
or     (%r15),%edi
mov    0x2e5d(%rip),%r12
or     (%r12),%edi
mov    0x2e3a(%rip),%rbx
or     (%rbx),%edi
call   1050 <umask@plt>
mov    0x2e3c(%rip),%rax
mov    0x2e55(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
or     (%r15),%esi
or     (%r14),%esi
or     (%r12),%esi
or     (%rbx),%esi
lea    0xe66(%rip),%rdi
call   1060 <creat@plt>
mov    %eax,%ebx
lea    0xe61(%rip),%rsi
mov    %eax,%edi
mov    $0x5,%edx
call   1030 <write@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    $0x13880,%esi
call   1040 <lseek@plt>
lea    0xe3f(%rip),%rsi
mov    %ebx,%edi
mov    $0x5,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@.str = [9 x i8] c"hole.txt\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [6 x i8] c"hello\00"
@SEEK_END = global i32 0
@.str.2 = [6 x i8] c"world\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @S_IRGRP
%4 = load i32, i32* @S_IWGRP
%5 = or i32 %3, %4
%6 = load i32, i32* @S_IROTH
%7 = or i32 %5, %6
%8 = load i32, i32* @S_IWOTH
%9 = or i32 %7, %8
%10 = call i32 @umask(i32 %9)
%11 = load i32, i32* @S_IRUSR
%12 = load i32, i32* @S_IWUSR
%13 = or i32 %11, %12
%14 = load i32, i32* @S_IRGRP
%15 = or i32 %13, %14
%16 = load i32, i32* @S_IWGRP
%17 = or i32 %15, %16
%18 = load i32, i32* @S_IROTH
%19 = or i32 %17, %18
%20 = load i32, i32* @S_IWOTH
%21 = or i32 %19, %20
%22 = call i32 @creat(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %21)
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = call i32 @write(i32 %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%25 = load i32, i32* %2
%26 = load i32, i32* @SEEK_END
%27 = call i32 @lseek(i32 %25, i32 80000, i32 %26)
%28 = load i32, i32* %2
%29 = call i32 @write(i32 %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
ret i32 0
}

LLVM IR (-O2):
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@.str = [9 x i8] c"hole.txt\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [6 x i8] c"hello\00"
@SEEK_END = global i32 0
@.str.2 = [6 x i8] c"world\00"
define i32 @main() {
%1 = load i32, i32* @S_IRGRP
%2 = load i32, i32* @S_IWGRP
%3 = or i32 %2, %1
%4 = load i32, i32* @S_IROTH
%5 = or i32 %3, %4
%6 = load i32, i32* @S_IWOTH
%7 = or i32 %5, %6
%8 = tail call i32 @umask(i32 %7)
%9 = load i32, i32* @S_IRUSR
%10 = load i32, i32* @S_IWUSR
%11 = or i32 %10, %9
%12 = load i32, i32* @S_IRGRP
%13 = or i32 %11, %12
%14 = load i32, i32* @S_IWGRP
%15 = or i32 %13, %14
%16 = load i32, i32* @S_IROTH
%17 = or i32 %15, %16
%18 = load i32, i32* @S_IWOTH
%19 = or i32 %17, %18
%20 = tail call i32 @creat(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = tail call i32 @write(i32 %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%22 = load i32, i32* @SEEK_END
%23 = tail call i32 @lseek(i32 %20, i32 80000, i32 %22)
%24 = tail call i32 @write(i32 %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
ret i32 0
}