#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*/ printf(char *, ...);
void testfp1(double x, double a) {
  printf("x = %.2f - %.2f - %.2f - %.2f; x = 0.0? ", x, a, a, a);
  x -= a;
  x -= a;
  x -= a;
  printf("[%s]\n", ((x == 0.0)) ? "yes" : "NO!");
}


x86 assembly (clang, -O0):
<testfp1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
lea    0xec3(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
lea    0xea7(%rip),%rsi
lea    0xe9c(%rip),%rax
ucomisd %xmm1,%xmm0
setnp  %dl
sete   %cl
test   %dl,%cl
cmovne %rax,%rsi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testfp1>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
lea    0xed9(%rip),%rdi
movaps %xmm1,%xmm2
movaps %xmm1,%xmm3
mov    $0x4,%al
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm0
subsd  %xmm1,%xmm0
subsd  %xmm1,%xmm0
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
lea    0xed4(%rip),%rax
lea    0xec9(%rip),%rsi
cmovne %rax,%rsi
cmovp  %rax,%rsi
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
add    $0x18,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"x = %.2f - %.2f - %.2f - %.2f; x = 0.0? \00"
@.str.1 = [6 x i8] c"[%s]\0A\00"
@.str.2 = [4 x i8] c"yes\00"
@.str.3 = [4 x i8] c"NO!\00"
define void @testfp1(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = load double, double* %4
%8 = load double, double* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), double %5, double %6, double %7, double %8)
%10 = load double, double* %4
%11 = load double, double* %3
%12 = fsub double %11, %10
store double %12, double* %3
%13 = load double, double* %4
%14 = load double, double* %3
%15 = fsub double %14, %13
store double %15, double* %3
%16 = load double, double* %4
%17 = load double, double* %3
%18 = fsub double %17, %16
store double %18, double* %3
%19 = load double, double* %3
%20 = fcmp oeq double %19, 0.000000e+00
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %22)
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"x = %.2f - %.2f - %.2f - %.2f; x = 0.0? \00"
@.str.1 = [6 x i8] c"[%s]\0A\00"
@.str.2 = [4 x i8] c"yes\00"
@.str.3 = [4 x i8] c"NO!\00"
define void @testfp1(double %0, double %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), double %0, double %1, double %1, double %1)
%4 = fsub double %0, %1
%5 = fsub double %4, %1
%6 = fsub double %5, %1
%7 = fcmp oeq double %6, 0.000000e+00
%8 = select i1 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %8)
ret void
}