#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*/ do_nothing();
int /*<<< orphan*/ printf(char *, double, char, double);
double recip(int);
void test1(int denom) {
  double r1, r2;
  int t1, t2;
  r1 = recip(denom);
  r2 = recip(denom);
  t1 = r1 == r2;
  do_nothing();
  t2 = r1 == r2;
  printf("test1 t1: r1 %f %c= r2 %f\n", r1, t1 ? '=' : '!', r2);
  printf("test1 t2: r1 %f %c= r2 %f\n", r1, t2 ? '=' : '!', r2);
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <recip@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <recip@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <do_nothing@plt>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x1c(%rbp),%edx
mov    $0x21,%eax
mov    $0x3d,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movsd  -0x18(%rbp),%xmm1
lea    0xe4c(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
mov    -0x20(%rbp),%edx
mov    $0x21,%eax
mov    $0x3d,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movsd  -0x18(%rbp),%xmm1
lea    0xe3b(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
call   1050 <recip@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1050 <recip@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <do_nothing@plt>
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm1,%xmm0
mov    $0x21,%eax
mov    $0x3d,%ebx
cmovne %eax,%ebx
cmovp  %eax,%ebx
lea    0xe85(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    %ebx,%esi
movsd  (%rsp),%xmm1
add    $0x10,%rsp
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"test1 t1: r1 %f %c= r2 %f\0A\00"
@.str.1 = [27 x i8] c"test1 t2: r1 %f %c= r2 %f\0A\00"
define void @test1(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = call double @recip(i32 %7)
store double %8, double* %3
%9 = load i32, i32* %2
%10 = call double @recip(i32 %9)
store double %10, double* %4
%11 = load double, double* %3
%12 = load double, double* %4
%13 = fcmp oeq double %11, %12
%14 = zext i1 %13 to i32
store i32 %14, i32* %5
%15 = call i32 (...) @do_nothing()
%16 = load double, double* %3
%17 = load double, double* %4
%18 = fcmp oeq double %16, %17
%19 = zext i1 %18 to i32
store i32 %19, i32* %6
%20 = load double, double* %3
%21 = load i32, i32* %5
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 61, i32 33
%25 = trunc i32 %24 to i8
%26 = load double, double* %4
%27 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %20, i8 signext %25, double %26)
%28 = load double, double* %3
%29 = load i32, i32* %6
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 61, i32 33
%33 = trunc i32 %32 to i8
%34 = load double, double* %4
%35 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), double %28, i8 signext %33, double %34)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"test1 t1: r1 %f %c= r2 %f\0A\00"
@.str.1 = [27 x i8] c"test1 t2: r1 %f %c= r2 %f\0A\00"
define void @test1(i32 %0) {
%2 = tail call double @recip(i32 %0)
%3 = tail call double @recip(i32 %0)
%4 = fcmp oeq double %2, %3
%5 = tail call i32 (...) @do_nothing()
%6 = select i1 %4, i8 61, i8 33
%7 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %2, i8 signext %6, double %3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), double %2, i8 signext %6, double %3)
ret void
}