#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_RDONLY;
int /*<<< orphan*/ S_IRWXU;
int /*<<< orphan*/ creat(char *, int /*<<< orphan*/);
int /*<<< orphan*/ creat64(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fopen(char *, char *);
int /*<<< orphan*/ fopen64(char *, char *);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ freopen64(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ open64(char *, int /*<<< orphan*/);
int /*<<< orphan*/ rename(char *, char *);
int /*<<< orphan*/ unlink(char *);
int main(void) {
  fopen("", "r");
  fopen64("", "r");
  freopen("", "r", NULL);
  freopen64("", "r", NULL);
  open("", O_RDONLY);
  open64("", O_RDONLY);
  creat("", S_IRWXU);
  creat64("", S_IRWXU);
  unlink("");
  rename("", "");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe4b(%rip),%rdi
lea    0xe43(%rip),%rsi
call   10a0 <fopen@plt>
lea    0xe38(%rip),%rdi
lea    0xe30(%rip),%rsi
call   1050 <fopen64@plt>
lea    0xe25(%rip),%rdi
lea    0xe1d(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <freopen@plt>
lea    0xe0e(%rip),%rdi
lea    0xe06(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <freopen64@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%esi
lea    0xdee(%rip),%rdi
call   1090 <open@plt>
mov    0x2dc1(%rip),%rax
mov    (%rax),%esi
lea    0xdd9(%rip),%rdi
call   1070 <open64@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%esi
lea    0xdc4(%rip),%rdi
call   10c0 <creat@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%esi
lea    0xdaf(%rip),%rdi
call   1080 <creat64@plt>
lea    0xda3(%rip),%rdi
call   1030 <unlink@plt>
lea    0xd97(%rip),%rsi
mov    %rsi,%rdi
call   10b0 <rename@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe56(%rip),%rbx
lea    0xe4e(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <fopen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fopen64@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <freopen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1060 <freopen64@plt>
mov    0x2df7(%rip),%r14
mov    (%r14),%esi
mov    %rbx,%rdi
call   1090 <open@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1070 <open64@plt>
mov    0x2de2(%rip),%r14
mov    (%r14),%esi
mov    %rbx,%rdi
call   10c0 <creat@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1080 <creat64@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
call   10b0 <rename@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"r\00"
@O_RDONLY = global i32 0
@S_IRWXU = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @fopen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @fopen64(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @freopen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* null)
%5 = call i32 @freopen64(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* null)
%6 = load i32, i32* @O_RDONLY
%7 = call i32 @open(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @O_RDONLY
%9 = call i32 @open64(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @S_IRWXU
%11 = call i32 @creat(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @S_IRWXU
%13 = call i32 @creat64(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 @unlink(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @rename(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"r\00"
@O_RDONLY = global i32 0
@S_IRWXU = global i32 0
define i32 @main() {
%1 = tail call i32 @fopen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @fopen64(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @freopen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* null)
%4 = tail call i32 @freopen64(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* null)
%5 = load i32, i32* @O_RDONLY
%6 = tail call i32 @open(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @O_RDONLY
%8 = tail call i32 @open64(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @S_IRWXU
%10 = tail call i32 @creat(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @S_IRWXU
%12 = tail call i32 @creat64(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = tail call i32 @unlink(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 @rename(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 0
}