#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*/ half_from_float(float);
int /*<<< orphan*/ half_from_float_slow(float);
double half_to_float(int /*<<< orphan*/);
double half_to_float_slow(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, float, double);
void identity(float f) {
  printf("slow expected = %f, actual = %f\n", f,
         half_to_float_slow(half_from_float_slow(f)));
  printf("fast expected = %f, actual = %f\n", f,
         half_to_float(half_from_float(f)));
}


x86 assembly (clang, -O0):
<identity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <half_from_float_slow@plt>
mov    %eax,%edi
call   1070 <half_to_float_slow@plt>
movaps %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <half_from_float@plt>
mov    %eax,%edi
call   1060 <half_to_float@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<identity>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1050 <half_from_float_slow@plt>
mov    %eax,%edi
call   1070 <half_to_float_slow@plt>
movaps %xmm0,%xmm1
lea    0xe93(%rip),%rdi
movss  0x4(%rsp),%xmm0
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
call   1030 <half_from_float@plt>
mov    %eax,%edi
call   1060 <half_to_float@plt>
movaps %xmm0,%xmm1
lea    0xe8d(%rip),%rdi
movss  0x4(%rsp),%xmm0
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"slow expected = %f, actual = %f\0A\00"
@.str.1 = [33 x i8] c"fast expected = %f, actual = %f\0A\00"
define void @identity(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = call i32 @half_from_float_slow(float %4)
%6 = call double @half_to_float_slow(i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), float %3, double %6)
%8 = load float, float* %2
%9 = load float, float* %2
%10 = call i32 @half_from_float(float %9)
%11 = call double @half_to_float(i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), float %8, double %11)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"slow expected = %f, actual = %f\0A\00"
@.str.1 = [33 x i8] c"fast expected = %f, actual = %f\0A\00"
define void @identity(float %0) {
%2 = tail call i32 @half_from_float_slow(float %0)
%3 = tail call double @half_to_float_slow(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), float %0, double %3)
%5 = tail call i32 @half_from_float(float %0)
%6 = tail call double @half_to_float(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), float %0, double %6)
ret void
}