int main() {
  volatile float a = 0;
  if (__builtin_sqrtf(a) != 0) {
    return 1;
  }
  volatile float b = 4;
  if (__builtin_sqrtf(b) != 2) {
    return 1;
  }
  volatile float c = 9;
  if (__builtin_sqrtf(c) != 3) {
    return 1;
  }
  volatile float d = 100;
  if (__builtin_sqrtf(d) != 10) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <sqrtf@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1148 <main+0x38>
jp     1148 <main+0x38>
jmp    1154 <main+0x44>
movl   $0x1,-0x4(%rbp)
jmp    1218 <main+0x108>
movss  0xea8(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sqrtf@plt>
movss  0xe8d(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1187 <main+0x77>
jp     1187 <main+0x77>
jmp    1193 <main+0x83>
movl   $0x1,-0x4(%rbp)
jmp    1218 <main+0x108>
movss  0xe71(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <sqrtf@plt>
movss  0xe56(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11c6 <main+0xb6>
jp     11c6 <main+0xb6>
jmp    11d2 <main+0xc2>
movl   $0x1,-0x4(%rbp)
jmp    1218 <main+0x108>
movss  0xe3a(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sqrtf@plt>
movss  0xe1f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1205 <main+0xf5>
jp     1205 <main+0xf5>
jmp    1211 <main+0x101>
movl   $0x1,-0x4(%rbp)
jmp    1218 <main+0x108>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movss  0x14(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1130 <main+0x20>
sqrtss %xmm0,%xmm0
jmp    1138 <main+0x28>
call   1030 <sqrtf@plt>
xorps  %xmm1,%xmm1
mov    $0x1,%eax
ucomiss %xmm1,%xmm0
jne    1144 <main+0x34>
jnp    1149 <main+0x39>
add    $0x18,%rsp
ret
movl   $0x40800000,0x10(%rsp)
40
movss  0x10(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1165 <main+0x55>
sqrtss %xmm0,%xmm0
jmp    116a <main+0x5a>
call   1030 <sqrtf@plt>
mov    $0x1,%eax
ucomiss 0xe8a(%rip),%xmm0
jne    1144 <main+0x34>
jp     1144 <main+0x34>
movl   $0x41100000,0xc(%rsp)
41
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1196 <main+0x86>
sqrtss %xmm0,%xmm0
jmp    119b <main+0x8b>
call   1030 <sqrtf@plt>
mov    $0x1,%eax
ucomiss 0xe5d(%rip),%xmm0
jne    1144 <main+0x34>
jp     1144 <main+0x34>
movl   $0x42c80000,0x8(%rsp)
42
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11c7 <main+0xb7>
sqrtss %xmm0,%xmm0
jmp    11cc <main+0xbc>
call   1030 <sqrtf@plt>
cmpneqss 0xe33(%rip),%xmm0
movd   %xmm0,%eax
and    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store volatile float 0.000000e+00, float* %2
%6 = load volatile float, float* %2
%7 = call float @sqrtf(float %6)
%8 = fcmp une float %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 1, i32* %1
br label %26
10: ; preds = %0
store volatile float 4.000000e+00, float* %3
%11 = load volatile float, float* %3
%12 = call float @sqrtf(float %11)
%13 = fcmp une float %12, 2.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %1
br label %26
15: ; preds = %10
store volatile float 9.000000e+00, float* %4
%16 = load volatile float, float* %4
%17 = call float @sqrtf(float %16)
%18 = fcmp une float %17, 3.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 1, i32* %1
br label %26
20: ; preds = %15
store volatile float 1.000000e+02, float* %5
%21 = load volatile float, float* %5
%22 = call float @sqrtf(float %21)
%23 = fcmp une float %22, 1.000000e+01
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 1, i32* %1
br label %26
25: ; preds = %20
store i32 0, i32* %1
br label %26
26: ; preds = %25, %24, %19, %14, %9
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %1 to i8*
store volatile float 0.000000e+00, float* %1
%6 = load volatile float, float* %1
%7 = tail call float @sqrtf(float %6)
%8 = fcmp une float %7, 0.000000e+00
br i1 %8, label %29, label %9
9: ; preds = %0
%10 = bitcast float* %2 to i8*
store volatile float 4.000000e+00, float* %2
%11 = load volatile float, float* %2
%12 = tail call float @sqrtf(float %11)
%13 = fcmp une float %12, 2.000000e+00
br i1 %13, label %27, label %14
14: ; preds = %9
%15 = bitcast float* %3 to i8*
store volatile float 9.000000e+00, float* %3
%16 = load volatile float, float* %3
%17 = tail call float @sqrtf(float %16)
%18 = fcmp une float %17, 3.000000e+00
br i1 %18, label %25, label %19
19: ; preds = %14
%20 = bitcast float* %4 to i8*
store volatile float 1.000000e+02, float* %4
%21 = load volatile float, float* %4
%22 = tail call float @sqrtf(float %21)
%23 = fcmp une float %22, 1.000000e+01
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %14, %19
%26 = phi i32 [ %24, %19 ], [ 1, %14 ]
br label %27
27: ; preds = %9, %25
%28 = phi i32 [ %26, %25 ], [ 1, %9 ]
br label %29
29: ; preds = %0, %27
%30 = phi i32 [ %28, %27 ], [ 1, %0 ]
ret i32 %30
}