#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*/ Close(int);
int /*<<< orphan*/ Create(char *);
int /*<<< orphan*/ Exec(char *);
int /*<<< orphan*/ Exit(int /*<<< orphan*/);
int Open(char *);
int /*<<< orphan*/ Read(char *, int, int);
int /*<<< orphan*/ Write(char *, int, int);
int main() {
  int fd;
  char *buf;
  Create("archivo.nuevo");
  fd = Open("archivo.nuevo");
  Write("prueba", 6, fd);
  Close(fd);
  Exec("../test/brillo");
  Exec("brillo1");
  fd = Open("archivo.nuevo");
  Read(buf, 6, fd);
  Write(buf, 6, 1);
  Exit(0);
  fd = 1;
  fd++;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
call   1040 <Create@plt>
lea    0xe6e(%rip),%rdi
call   1030 <Open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    0xe6a(%rip),%rdi
mov    $0x6,%esi
call   1060 <Write@plt>
mov    -0x8(%rbp),%edi
call   1090 <Close@plt>
lea    0xe58(%rip),%rdi
call   1080 <Exec@plt>
lea    0xe5b(%rip),%rdi
call   1080 <Exec@plt>
lea    0xe2b(%rip),%rdi
call   1030 <Open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    $0x6,%esi
call   1050 <Read@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
call   1060 <Write@plt>
xor    %edi,%edi
call   1070 <Exit@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xe86(%rip),%rbx
mov    %rbx,%rdi
call   1040 <Create@plt>
mov    %rbx,%rdi
call   1030 <Open@plt>
mov    %eax,%ebp
lea    0xe7b(%rip),%rdi
mov    $0x6,%esi
mov    %eax,%edx
call   1060 <Write@plt>
mov    %ebp,%edi
call   1090 <Close@plt>
lea    0xe68(%rip),%rdi
call   1080 <Exec@plt>
lea    0xe6b(%rip),%rdi
call   1080 <Exec@plt>
mov    %rbx,%rdi
call   1030 <Open@plt>
mov    $0x6,%esi
mov    %eax,%edx
call   1050 <Read@plt>
mov    $0x6,%esi
mov    $0x1,%edx
call   1060 <Write@plt>
xor    %edi,%edi
call   1070 <Exit@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"archivo.nuevo\00"
@.str.1 = [7 x i8] c"prueba\00"
@.str.2 = [15 x i8] c"../test/brillo\00"
@.str.3 = [8 x i8] c"brillo1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 @Create(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @Open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @Write(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %6)
%8 = load i32, i32* %2
%9 = call i32 @Close(i32 %8)
%10 = call i32 @Exec(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @Exec(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @Open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %2
%13 = load i8*, i8** %3
%14 = load i32, i32* %2
%15 = call i32 @Read(i8* %13, i32 6, i32 %14)
%16 = load i8*, i8** %3
%17 = call i32 @Write(i8* %16, i32 6, i32 1)
%18 = call i32 @Exit(i32 0)
store i32 1, i32* %2
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"archivo.nuevo\00"
@.str.1 = [7 x i8] c"prueba\00"
@.str.2 = [15 x i8] c"../test/brillo\00"
@.str.3 = [8 x i8] c"brillo1\00"
define i32 @main() {
%1 = tail call i32 @Create(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @Open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @Write(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %2)
%4 = tail call i32 @Close(i32 %2)
%5 = tail call i32 @Exec(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @Exec(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @Open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @Read(i8* undef, i32 6, i32 %7)
%9 = tail call i32 @Write(i8* undef, i32 6, i32 1)
%10 = tail call i32 @Exit(i32 0)
ret i32 0
}