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);
  initfpreg();
  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  0xea0(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e5a(%rip),%rax
movsd  (%rax),%xmm0
mov    0x2e77(%rip),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    0x2e4a(%rip),%rax
movsd  (%rax),%xmm1
ucomisd %xmm1,%xmm0
jne    11af <fpu_main+0x5f>
jp     11af <fpu_main+0x5f>
jmp    11bb <fpu_main+0x6b>
mov    $0x1,%edi
mov    $0x0,%al
call   1040 <fail@plt>
movsd  -0x28(%rbp),%xmm0
call   1070 <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 0xe21(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xdfd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1221 <fpu_main+0xd1>
mov    $0x2,%edi
mov    $0x0,%al
call   1040 <fail@plt>
movsd  -0x28(%rbp),%xmm0
call   1070 <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 0xdce(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xdb2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1274 <fpu_main+0x124>
mov    $0x3,%edi
mov    $0x0,%al
call   1040 <fail@plt>
mov    $0x0,%al
call   1060 <initfpreg@plt>
mov    $0x0,%al
call   1030 <fpu_pipe@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     1299 <fpu_main+0x149>
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     12b9 <fpu_main+0x169>
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    0x2e60(%rip),%rax
movsd  (%rax),%xmm1
mov    0x2e7d(%rip),%rax
subsd  (%rax),%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm1
mov    0x2e50(%rip),%rax
ucomisd (%rax),%xmm1
movsd  %xmm0,0x10(%rsp)
jne    119e <fpu_main+0x4e>
jnp    11b0 <fpu_main+0x60>
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <fail@plt>
movsd  0x10(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11c0 <fpu_main+0x70>
sqrtsd %xmm0,%xmm0
jmp    11c5 <fpu_main+0x75>
call   1070 <sqrt@plt>
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
mulsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
andpd  0xe1e(%rip),%xmm0
ucomisd 0xe26(%rip),%xmm0
jbe    11f8 <fpu_main+0xa8>
mov    $0x2,%edi
xor    %eax,%eax
call   1040 <fail@plt>
xorpd  %xmm1,%xmm1
movsd  0x10(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jb     120e <fpu_main+0xbe>
sqrtsd %xmm0,%xmm0
jmp    1213 <fpu_main+0xc3>
call   1070 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
subsd  0x8(%rsp),%xmm0
andpd  0xdd3(%rip),%xmm0
ucomisd 0xde3(%rip),%xmm0
jbe    1243 <fpu_main+0xf3>
mov    $0x3,%edi
xor    %eax,%eax
call   1040 <fail@plt>
xor    %eax,%eax
call   1060 <initfpreg@plt>
xor    %eax,%eax
call   1030 <fpu_pipe@plt>
test   %eax,%eax
je     125e <fpu_main+0x10e>
mov    %eax,%edi
xor    %eax,%eax
call   1040 <fail@plt>
xor    %eax,%eax
call   1050 <fpu_chkft@plt>
test   %eax,%eax
je     1275 <fpu_main+0x125>
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 (...) @initfpreg()
%45 = call i32 (...) @fpu_pipe()
store i32 %45, i32* %7
%46 = load i32, i32* %7
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = load i32, i32* %7
%50 = call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 %49)
br label %51
51: ; preds = %48, %43
%52 = call i32 (...) @fpu_chkft()
store i32 %52, i32* %7
%53 = load i32, i32* %7
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 5)
br label %57
57: ; preds = %55, %51
%58 = load i32, i32* %1
ret i32 %58
}

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 (...) @initfpreg()
%38 = tail call i32 (...) @fpu_pipe()
%39 = icmp eq i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %36
%41 = tail call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 %38)
br label %42
42: ; preds = %40, %36
%43 = tail call i32 (...) @fpu_chkft()
%44 = icmp eq i32 %43, 0
br i1 %44, label %47, label %45
45: ; preds = %42
%46 = tail call i32 (i32, ...) bitcast (i32 (...)* @fail to i32 (i32, ...)*)(i32 5)
br label %47
47: ; preds = %45, %42
ret i32 undef
}