#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, ...);
long double recip_l(int);
void test3(int denom) {
  long double r1, r2;
  int t1, t2, t3;
  r1 = recip_l(denom);
  r2 = recip_l(denom);
  t1 = r1 == r2;
  do_nothing();
  t2 = r1 == r2;
  t3 = r1 == 1.0 / (long double)denom;
  printf("test3 t1: r1 %f %c= r2 %f\n", (double)r1, t1 ? '=' : '!', (double)r2);
  printf("test3 t2: r1 %f %c= r2 %f\n", (double)r1, t2 ? '=' : '!', (double)r2);
  printf("test3 t3: r1 %f %c= 1.0/10.0\n", (double)r1, t2 ? '=' : '!');
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <recip_l@plt>
fstpt  -0x20(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <recip_l@plt>
fstpt  -0x30(%rbp)
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setnp  %cl
sete   %al
and    %cl,%al
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
xor    %eax,%eax
call   1040 <do_nothing@plt>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setnp  %cl
sete   %al
and    %cl,%al
movzbl %al,%eax
mov    %eax,-0x38(%rbp)
fldt   -0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x40(%rbp)
fildl  -0x40(%rbp)
fld1
fdivp  %st,%st(1)
fucomip %st(1),%st
fstp   %st(0)
setnp  %cl
sete   %al
and    %cl,%al
movzbl %al,%eax
mov    %eax,-0x3c(%rbp)
fldt   -0x20(%rbp)
fstpl  -0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x34(%rbp),%eax
test   %eax,%eax
mov    $0x3d,%eax
mov    %eax,-0x70(%rbp)
mov    $0x21,%esi
mov    %esi,-0x74(%rbp)
cmovne %eax,%esi
fldt   -0x30(%rbp)
fstpl  -0x48(%rbp)
movsd  -0x48(%rbp),%xmm1
lea    0xe1a(%rip),%rdi
mov    $0x2,%al
mov    %al,-0x69(%rbp)
call   1030 <printf@plt>
mov    -0x74(%rbp),%esi
mov    -0x70(%rbp),%ecx
mov    -0x69(%rbp),%al
fldt   -0x20(%rbp)
fstpl  -0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    -0x38(%rbp),%edx
test   %edx,%edx
cmovne %ecx,%esi
fldt   -0x30(%rbp)
fstpl  -0x58(%rbp)
movsd  -0x58(%rbp),%xmm1
lea    0xdfd(%rip),%rdi
call   1030 <printf@plt>
fldt   -0x20(%rbp)
fstpl  -0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
mov    -0x38(%rbp),%edx
mov    $0x21,%eax
mov    $0x3d,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
lea    0xdee(%rip),%rdi
movsbl %al,%esi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
push   %rbx
sub    $0x30,%rsp
mov    %edi,%ebx
call   1050 <recip_l@plt>
fstpt  (%rsp)
mov    %ebx,%edi
call   1050 <recip_l@plt>
fstpt  0x10(%rsp)
xor    %eax,%eax
call   1040 <do_nothing@plt>
fldt   (%rsp)
fldt   0x10(%rsp)
fxch   %st(1)
fucomi %st(1),%st
fstpl  0x28(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,(%rsp)
fstpl  0x20(%rsp)
movsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
mov    $0x21,%eax
mov    $0x3d,%ebx
cmovne %eax,%ebx
cmovp  %eax,%ebx
lea    0xe6e(%rip),%rdi
mov    %ebx,%esi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe79(%rip),%rdi
movsd  (%rsp),%xmm0
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe79(%rip),%rdi
movsd  (%rsp),%xmm0
mov    %ebx,%esi
mov    $0x1,%al
add    $0x30,%rsp
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"test3 t1: r1 %f %c= r2 %f\0A\00"
@.str.1 = [27 x i8] c"test3 t2: r1 %f %c= r2 %f\0A\00"
@.str.2 = [30 x i8] c"test3 t3: r1 %f %c= 1.0/10.0\0A\00"
define void @test3(i32 %0) {
%2 = alloca i32
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
%8 = load i32, i32* %2
%9 = call x86_fp80 @recip_l(i32 %8)
store x86_fp80 %9, x86_fp80* %3
%10 = load i32, i32* %2
%11 = call x86_fp80 @recip_l(i32 %10)
store x86_fp80 %11, x86_fp80* %4
%12 = load x86_fp80, x86_fp80* %3
%13 = load x86_fp80, x86_fp80* %4
%14 = fcmp oeq x86_fp80 %12, %13
%15 = zext i1 %14 to i32
store i32 %15, i32* %5
%16 = call i32 (...) @do_nothing()
%17 = load x86_fp80, x86_fp80* %3
%18 = load x86_fp80, x86_fp80* %4
%19 = fcmp oeq x86_fp80 %17, %18
%20 = zext i1 %19 to i32
store i32 %20, i32* %6
%21 = load x86_fp80, x86_fp80* %3
%22 = load i32, i32* %2
%23 = sitofp i32 %22 to x86_fp80
%24 = fdiv x86_fp80 0xK3FFF8000000000000000, %23
%25 = fcmp oeq x86_fp80 %21, %24
%26 = zext i1 %25 to i32
store i32 %26, i32* %7
%27 = load x86_fp80, x86_fp80* %3
%28 = fptrunc x86_fp80 %27 to double
%29 = load i32, i32* %5
%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 x86_fp80, x86_fp80* %4
%35 = fptrunc x86_fp80 %34 to double
%36 = call i32 (i8*, double, i8, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %28, i8 signext %33, double %35)
%37 = load x86_fp80, x86_fp80* %3
%38 = fptrunc x86_fp80 %37 to double
%39 = load i32, i32* %6
%40 = icmp ne i32 %39, 0
%41 = zext i1 %40 to i64
%42 = select i1 %40, i32 61, i32 33
%43 = trunc i32 %42 to i8
%44 = load x86_fp80, x86_fp80* %4
%45 = fptrunc x86_fp80 %44 to double
%46 = call i32 (i8*, double, i8, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), double %38, i8 signext %43, double %45)
%47 = load x86_fp80, x86_fp80* %3
%48 = fptrunc x86_fp80 %47 to double
%49 = load i32, i32* %6
%50 = icmp ne i32 %49, 0
%51 = zext i1 %50 to i64
%52 = select i1 %50, i32 61, i32 33
%53 = trunc i32 %52 to i8
%54 = call i32 (i8*, double, i8, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %48, i8 signext %53)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"test3 t1: r1 %f %c= r2 %f\0A\00"
@.str.1 = [27 x i8] c"test3 t2: r1 %f %c= r2 %f\0A\00"
@.str.2 = [30 x i8] c"test3 t3: r1 %f %c= 1.0/10.0\0A\00"
define void @test3(i32 %0) {
%2 = tail call x86_fp80 @recip_l(i32 %0)
%3 = tail call x86_fp80 @recip_l(i32 %0)
%4 = fcmp oeq x86_fp80 %2, %3
%5 = tail call i32 (...) @do_nothing()
%6 = fptrunc x86_fp80 %2 to double
%7 = select i1 %4, i8 61, i8 33
%8 = fptrunc x86_fp80 %3 to double
%9 = tail call i32 (i8*, double, i8, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %6, i8 signext %7, double %8)
%10 = tail call i32 (i8*, double, i8, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), double %6, i8 signext %7, double %8)
%11 = tail call i32 (i8*, double, i8, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %6, i8 signext %7)
ret void
}