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


x86 assembly (clang, -O0):
<testfp3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm3
movsd  -0x10(%rbp),%xmm4
movsd  -0x18(%rbp),%xmm5
lea    0xeb4(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xeb7(%rip),%rsi
lea    0xeac(%rip),%rax
ucomisd %xmm1,%xmm0
setnp  %dl
sete   %cl
test   %dl,%cl
cmovne %rax,%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testfp3>:
sub    $0x18,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
lea    0xed4(%rip),%rdi
movaps %xmm0,%xmm3
movaps %xmm1,%xmm4
movaps %xmm2,%xmm5
mov    $0x6,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm3
movapd %xmm3,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
ucomisd %xmm1,%xmm0
lea    0xedb(%rip),%rax
lea    0xed0(%rip),%rsi
cmovne %rax,%rsi
cmovp  %rax,%rsi
lea    0xebb(%rip),%rdi
xor    %eax,%eax
add    $0x18,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"x = (%.2f * %.2f) * %.2f; y = %.2f * (%.2f * %.2f); x == y? \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 @testfp3(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%9 = load double, double* %4
%10 = load double, double* %5
%11 = load double, double* %6
%12 = load double, double* %4
%13 = load double, double* %5
%14 = load double, double* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), double %9, double %10, double %11, double %12, double %13, double %14)
%16 = load double, double* %4
%17 = load double, double* %5
%18 = fmul double %16, %17
%19 = load double, double* %6
%20 = fmul double %18, %19
store double %20, double* %7
%21 = load double, double* %4
%22 = load double, double* %5
%23 = load double, double* %6
%24 = fmul double %22, %23
%25 = fmul double %21, %24
store double %25, double* %8
%26 = load double, double* %7
%27 = load double, double* %8
%28 = fcmp oeq double %26, %27
%29 = zext i1 %28 to i64
%30 = select i1 %28, 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)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %30)
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c"x = (%.2f * %.2f) * %.2f; y = %.2f * (%.2f * %.2f); x == y? \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 @testfp3(double %0, double %1, double %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), double %0, double %1, double %2, double %0, double %1, double %2)
%5 = fmul double %0, %1
%6 = fmul double %5, %2
%7 = fmul double %1, %2
%8 = fmul double %7, %0
%9 = fcmp oeq double %6, %8
%10 = select i1 %9, 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)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %10)
ret void
}