fpu_main() {
  volatile double a, c, d;
  double e;
  extern volatile double a1, b1, c1;
  float b;
  int tmp;
  d = 3.0;
  e = d;
  a = *(double *)&a1 - *(double *)&b1;
  if (a != c1)
    fail(1);
  a = sqrt(e);
  if (fabs((a * a) - d) > 1E-15)
    fail(2);
  b = sqrt(e);
  if (fabs((b * b) - d) > 1E-7)
    fail(3);
  tmp = fpu_pipe();
  if (tmp)
    fail(tmp);
  tmp = fpu_chkft();
  if (tmp)
    fail(5);
}


x86 assembly (clang, -O0):
<fpu_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  0xeb0(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e6a(%rip),%rax
movsd  (%rax),%xmm0
mov    0x2e87(%rip),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    0x2e5a(%rip),%rax
movsd  (%rax),%xmm1
ucomisd %xmm1,%xmm0
jne    119f <fpu_main+0x5f>
jp     119f <fpu_main+0x5f>
jmp    11ab <fpu_main+0x6b>
mov    $0x1,%edi
mov    $0x0,%al
call   1040 <fail@plt>
movsd  -0x28(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movaps 0xe31(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe0d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1211 <fpu_main+0xd1>
mov    $0x2,%edi
mov    $0x0,%al
call   1040 <fail@plt>
movsd  -0x28(%rbp),%xmm0
call   1060 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
mulss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
movaps 0xdde(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xdc2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1264 <fpu_main+0x124>
mov    $0x3,%edi
mov    $0x0,%al
call   1040 <fail@plt>
mov    $0x0,%al
call   1030 <fpu_pipe@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     1282 <fpu_main+0x142>
mov    -0x30(%rbp),%edi
mov    $0x0,%al
call   1040 <fail@plt>
mov    $0x0,%al
call   1050 <fpu_chkft@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     12a2 <fpu_main+0x162>
mov    $0x5,%edi
mov    $0x0,%al
call   1040 <fail@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpu_main>:
sub    $0x18,%rsp
movabs $0x4008000000000000,%rax
mov    %rax,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
mov    0x2e70(%rip),%rax
movsd  (%rax),%xmm1
mov    0x2e8d(%rip),%rax
subsd  (%rax),%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm1
mov    0x2e60(%rip),%rax
ucomisd (%rax),%xmm1
movsd  %xmm0,0x10(%rsp)
jne    118e <fpu_main+0x4e>
jnp    11a0 <fpu_main+0x60>
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <fail@plt>
movsd  0x10(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11b0 <fpu_main+0x70>
sqrtsd %xmm0,%xmm0
jmp    11b5 <fpu_main+0x75>
call   1060 <sqrt@plt>
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
mulsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
andpd  0xe2e(%rip),%xmm0
ucomisd 0xe36(%rip),%xmm0
jbe    11e8 <fpu_main+0xa8>
mov    $0x2,%edi
xor    %eax,%eax
call   1040 <fail@plt>
xorpd  %xmm1,%xmm1
movsd  0x10(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jb     11fe <fpu_main+0xbe>
sqrtsd %xmm0,%xmm0
jmp    1203 <fpu_main+0xc3>
call   1060 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
subsd  0x8(%rsp),%xmm0
andpd  0xde3(%rip),%xmm0
ucomisd 0xdf3(%rip),%xmm0
jbe    1233 <fpu_main+0xf3>
mov    $0x3,%edi
xor    %eax,%eax
call   1040 <fail@plt>
xor    %eax,%eax
call   1030 <fpu_pipe@plt>
test   %eax,%eax
je     1247 <fpu_main+0x107>
mov    %eax,%edi
xor    %eax,%eax
call   1040 <fail@plt>
xor    %eax,%eax
call   1050 <fpu_chkft@plt>
test   %eax,%eax
je     125e <fpu_main+0x11e>
mov    $0x5,%edi
xor    %eax,%eax
call   1040 <fail@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@a1 = external global double
@b1 = external global double
@c1 = external global double
define i32 @fpu_main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca float
%7 = alloca i32
store volatile double 3.000000e+00, double* %4
%8 = load volatile double, double* %4
store double %8, double* %5
%9 = load double, double* @a1
%10 = load double, double* @b1
%11 = fsub double %9, %10
store volatile double %11, double* %2
%12 = load volatile double, double* %2
%13 = load volatile double, double* @c1
%14 = fcmp une double %12, %13
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 1)
br label %17
17: ; preds = %15, %0
%18 = load double, double* %5
%19 = call double @sqrt(double %18)
store volatile double %19, double* %2
%20 = load volatile double, double* %2
%21 = load volatile double, double* %2
%22 = load volatile double, double* %4
%23 = fneg double %22
%24 = call double @llvm.fmuladd.f64(double %20, double %21, double %23)
%25 = call double @llvm.fabs.f64(double %24)
%26 = fcmp ogt double %25, 1.000000e-15
br i1 %26, label %27, label %29
27: ; preds = %17
%28 = call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 2)
br label %29
29: ; preds = %27, %17
%30 = load double, double* %5
%31 = call double @sqrt(double %30)
%32 = fptrunc double %31 to float
store float %32, float* %6
%33 = load float, float* %6
%34 = load float, float* %6
%35 = fmul float %33, %34
%36 = fpext float %35 to double
%37 = load volatile double, double* %4
%38 = fsub double %36, %37
%39 = call double @llvm.fabs.f64(double %38)
%40 = fcmp ogt double %39, 0x3E7AD7F29ABCAF48
br i1 %40, label %41, label %43
41: ; preds = %29
%42 = call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 3)
br label %43
43: ; preds = %41, %29
%44 = call i32 (...) @fpu_pipe()
store i32 %44, i32* %7
%45 = load i32, i32* %7
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load i32, i32* %7
%49 = call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 %48)
br label %50
50: ; preds = %47, %43
%51 = call i32 (...) @fpu_chkft()
store i32 %51, i32* %7
%52 = load i32, i32* %7
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 5)
br label %56
56: ; preds = %54, %50
%57 = load i32, i32* %1
ret i32 %57
}

LLVM IR (-O2):
@a1 = external global double
@b1 = external global double
@c1 = external global double
define i32 @fpu_main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
store volatile double 3.000000e+00, double* %2
%5 = load volatile double, double* %2
%6 = load double, double* @a1
%7 = load double, double* @b1
%8 = fsub double %6, %7
store volatile double %8, double* %1
%9 = load volatile double, double* %1
%10 = load volatile double, double* @c1
%11 = fcmp une double %9, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 1)
br label %14
14: ; preds = %12, %0
%15 = tail call double @sqrt(double %5)
store volatile double %15, double* %1
%16 = load volatile double, double* %1
%17 = load volatile double, double* %1
%18 = load volatile double, double* %2
%19 = fneg double %18
%20 = tail call double @llvm.fmuladd.f64(double %16, double %17, double %19)
%21 = tail call double @llvm.fabs.f64(double %20)
%22 = fcmp ogt double %21, 1.000000e-15
br i1 %22, label %23, label %25
23: ; preds = %14
%24 = tail call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 2)
br label %25
25: ; preds = %23, %14
%26 = tail call double @sqrt(double %5)
%27 = fptrunc double %26 to float
%28 = fmul float %27, %27
%29 = fpext float %28 to double
%30 = load volatile double, double* %2
%31 = fsub double %29, %30
%32 = tail call double @llvm.fabs.f64(double %31)
%33 = fcmp ogt double %32, 0x3E7AD7F29ABCAF48
br i1 %33, label %34, label %36
34: ; preds = %25
%35 = tail call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 3)
br label %36
36: ; preds = %34, %25
%37 = tail call i32 (...) @fpu_pipe()
%38 = icmp eq i32 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %36
%40 = tail call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 %37)
br label %41
41: ; preds = %39, %36
%42 = tail call i32 (...) @fpu_chkft()
%43 = icmp eq i32 %42, 0
br i1 %43, label %46, label %44
44: ; preds = %41
%45 = tail call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 5)
br label %46
46: ; preds = %44, %41
ret i32 undef
}