#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*/ as_write(char *, int);
int /*<<< orphan*/ as_write_f(char *, char *);
int /*<<< orphan*/ as_write_file(char *, int /*<<< orphan*/, int);
int exec_write(void *data) {
  char binary[] = {'W', 'o', 'r', 'l', 'd', '\n'};
  as_write("Hello ", -1);
  as_write(binary, 6);
  as_write_f("This is an example of sending %s output\n", "formatted");
  as_write_file("../example.txt", 0, -1);
  as_write("Files are not loaded into memory while sending!!!\n", -1);
  return 200;
}


x86 assembly (clang, -O0):
<exec_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0xe(%rbp)
mov    0xeb8(%rip),%ax
mov    %ax,-0xa(%rbp)
lea    0xeaf(%rip),%rdi
mov    $0xffffffff,%esi
call   1040 <as_write@plt>
lea    -0xe(%rbp),%rdi
mov    $0x6,%esi
call   1040 <as_write@plt>
lea    0xe97(%rip),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <as_write_f@plt>
lea    0xeb7(%rip),%rdi
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1030 <as_write_file@plt>
lea    0xeb3(%rip),%rdi
mov    $0xffffffff,%esi
call   1040 <as_write@plt>
mov    $0xc8,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exec_write>:
push   %rax
movw   $0xa64,0x4(%rsp)
movl   $0x6c726f57,(%rsp)
lea    0xec0(%rip),%rdi
mov    $0xffffffff,%esi
call   1040 <as_write@plt>
mov    %rsp,%rdi
mov    $0x6,%esi
call   1040 <as_write@plt>
lea    0xea9(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1050 <as_write_f@plt>
lea    0xec9(%rip),%rdi
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1030 <as_write_file@plt>
lea    0xec5(%rip),%rdi
mov    $0xffffffff,%esi
call   1040 <as_write@plt>
mov    $0xc8,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.exec_write.binary = [6 x i8] c"World\0A"
@.str = [7 x i8] c"Hello \00"
@.str.1 = [41 x i8] c"This is an example of sending %s output\0A\00"
@.str.2 = [10 x i8] c"formatted\00"
@.str.3 = [15 x i8] c"../example.txt\00"
@.str.4 = [51 x i8] c"Files are not loaded into memory while sending!!!\0A\00"
define i32 @exec_write(i8* %0) {
%2 = alloca i8*
%3 = alloca [6 x i8]
store i8* %0, i8** %2
%4 = bitcast [6 x i8]* %3 to i8*
%5 = call i32 @as_write(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 -1)
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%7 = call i32 @as_write(i8* %6, i32 6)
%8 = call i32 @as_write_f(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @as_write_file(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 -1)
%10 = call i32 @as_write(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i32 -1)
ret i32 200
}

LLVM IR (-O2):
@__const.exec_write.binary = [6 x i8] c"World\0A"
@.str = [7 x i8] c"Hello \00"
@.str.1 = [41 x i8] c"This is an example of sending %s output\0A\00"
@.str.2 = [10 x i8] c"formatted\00"
@.str.3 = [15 x i8] c"../example.txt\00"
@.str.4 = [51 x i8] c"Files are not loaded into memory while sending!!!\0A\00"
define i32 @exec_write(i8* nocapture readnone %0) {
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @as_write(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 -1)
%5 = call i32 @as_write(i8* %3, i32 6)
%6 = call i32 @as_write_f(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @as_write_file(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 -1)
%8 = call i32 @as_write(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i32 -1)
ret i32 200
}