#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 */
scalar_t__ compare_floats2(float, float);
int /*<<< orphan*/ printf(char *, float, float, char *);
int main(int argc, char **argv) {
  float x = 67329.234;
  float y = 67329.242;
  printf("(%g == %g) = %s\n", x, y, compare_floats2(x, y) ? "true" : "false");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xec6(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xeb5(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1040 <compare_floats2@plt>
movss  -0x20(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mov    %rax,%rcx
lea    0xe97(%rip),%rsi
lea    0xe8b(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movss  0xed7(%rip),%xmm0
movss  0xed3(%rip),%xmm1
call   1040 <compare_floats2@plt>
test   %rax,%rax
lea    0xede(%rip),%rax
lea    0xed2(%rip),%rsi
cmove  %rax,%rsi
lea    0xeb6(%rip),%rdi
movss  0xea6(%rip),%xmm0
movss  0xea2(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"(%g == %g) = %s\0A\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0x40F07013C0000000, float* %6
store float 0x40F07013E0000000, float* %7
%8 = load float, float* %6
%9 = load float, float* %7
%10 = load float, float* %6
%11 = load float, float* %7
%12 = call i64 @compare_floats2(float %10, float %11)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%16 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), float %8, float %9, i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"(%g == %g) = %s\0A\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @compare_floats2(float 0x40F07013C0000000, float 0x40F07013E0000000)
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), float 0x40F07013C0000000, float 0x40F07013E0000000, i8* %5)
ret i32 0
}