#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void layoutTemplate(FILE *assemblyfile, FILE *codefile, FILE *datafile) {
  fprintf(datafile, "extern printf\n\n");
  fprintf(datafile, "section .data\n");
  fprintf(datafile, "\t_int_format:\t\t\tdb\t\"%%d\",10,0\n");
  fprintf(datafile, "\t_float_format:\t\tdb\t\"%%f\",10,0\n");
  fprintf(datafile, "\t_float_temp:\t\t\tdq\t0\n");
  fprintf(datafile, "\t_string_format:\t\tdb\t\"%%s\",0\n");
  fprintf(datafile, "\t_int_to_float:\t\tdw\t0,0\n");
  fprintf(assemblyfile, "\nsection .bss\n");
  fprintf(codefile, "_start:\n\n");
  return;
}


x86 assembly (clang, -O0):
<layoutTemplate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xeef(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xef5(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xf03(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf0c(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xf0b(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<layoutTemplate>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xecb(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xec2(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <fprintf@plt>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <fprintf@plt>
lea    0xed9(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <fprintf@plt>
lea    0xee5(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xee5(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1040 <fwrite@plt>
lea    0xedb(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"extern printf\0A\0A\00"
@.str.1 = [15 x i8] c"section .data\0A\00"
@.str.2 = [31 x i8] c"\09_int_format:\09\09\09db\09\22%%d\22,10,0\0A\00"
@.str.3 = [32 x i8] c"\09_float_format:\09\09db\09\22%%f\22,10,0\0A\00"
@.str.4 = [22 x i8] c"\09_float_temp:\09\09\09dq\090\0A\00"
@.str.5 = [30 x i8] c"\09_string_format:\09\09db\09\22%%s\22,0\0A\00"
@.str.6 = [25 x i8] c"\09_int_to_float:\09\09dw\090,0\0A\00"
@.str.7 = [15 x i8] c"\0Asection .bss\0A\00"
@.str.8 = [10 x i8] c"_start:\0A\0A\00"
define void @layoutTemplate(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %6
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32*, i32** %6
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32*, i32** %6
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32*, i32** %6
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%17 = load i32*, i32** %6
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%19 = load i32*, i32** %6
%20 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%21 = load i32*, i32** %4
%22 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%23 = load i32*, i32** %5
%24 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"extern printf\0A\0A\00"
@.str.1 = [15 x i8] c"section .data\0A\00"
@.str.2 = [31 x i8] c"\09_int_format:\09\09\09db\09\22%%d\22,10,0\0A\00"
@.str.3 = [32 x i8] c"\09_float_format:\09\09db\09\22%%f\22,10,0\0A\00"
@.str.4 = [22 x i8] c"\09_float_temp:\09\09\09dq\090\0A\00"
@.str.5 = [30 x i8] c"\09_string_format:\09\09db\09\22%%s\22,0\0A\00"
@.str.6 = [25 x i8] c"\09_int_to_float:\09\09dw\090,0\0A\00"
@.str.7 = [15 x i8] c"\0Asection .bss\0A\00"
@.str.8 = [10 x i8] c"_start:\0A\0A\00"
define void @layoutTemplate(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 15, i64 1, i32* %2)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i64 14, i64 1, i32* %2)
%6 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i64 21, i64 1, i32* %2)
%9 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i64 24, i64 1, i32* %2)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i64 14, i64 1, i32* %0)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i64 9, i64 1, i32* %1)
ret void
}