#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*/ STDIN_FILENO;
char *amaca_eval_fd(int /*<<< orphan*/, int, char *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *title = "This is a title";
  char *body = "This is the body";
  char *str = amaca_eval_fd(STDIN_FILENO, 2, "title", title, "body", body);
  printf("%s", str);
  free(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xebf(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r9
mov    $0x2,%esi
lea    0xe98(%rip),%rdx
lea    0xea3(%rip),%r8
call   1050 <amaca_eval_fd@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rdx
lea    0xeb8(%rip),%rcx
lea    0xecd(%rip),%r8
lea    0xeba(%rip),%r9
mov    $0x2,%esi
call   1050 <amaca_eval_fd@plt>
mov    %rax,%rbx
lea    0xeb7(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"This is a title\00"
@.str.1 = [17 x i8] c"This is the body\00"
@STDIN_FILENO = global i32 0
@.str.2 = [6 x i8] c"title\00"
@.str.3 = [5 x i8] c"body\00"
@.str.4 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %3
%5 = load i32, i32* @STDIN_FILENO
%6 = load i8*, i8** %2
%7 = load i8*, i8** %3
%8 = call i8* @amaca_eval_fd(i32 %5, i32 2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %4
%12 = call i32 @free(i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"This is a title\00"
@.str.1 = [17 x i8] c"This is the body\00"
@STDIN_FILENO = global i32 0
@.str.2 = [6 x i8] c"title\00"
@.str.3 = [5 x i8] c"body\00"
@.str.4 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = load i32, i32* @STDIN_FILENO
%2 = tail call i8* @amaca_eval_fd(i32 %1, i32 2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%4 = tail call i32 @free(i8* %2)
ret i32 0
}