#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 */
float NAN;
float __domain_error();
float atanf(float);
scalar_t__ isnan(float);
float sqrtf(float);
float asinf(float x) {
  if ((x > 1.f) || (x < -1.f))
    return __domain_error();
  if (isnan(x))
    return NAN;
  return 2.f * atanf(x / (1.f + sqrtf(1.f - x * x)));
}


x86 assembly (clang, -O0):
<asinf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xea6(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     1175 <asinf+0x35>
movss  0xe99(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1186 <asinf+0x46>
mov    $0x0,%al
call   1040 <__domain_error@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1216 <asinf+0xd6>
movss  -0x8(%rbp),%xmm0
call   1060 <isnan@plt>
cmp    $0x0,%rax
je     11af <asinf+0x6f>
mov    0x2e57(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1216 <asinf+0xd6>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm1,%xmm0
movss  0xe24(%rip),%xmm1
addss  %xmm1,%xmm0
call   1050 <sqrtf@plt>
movaps %xmm0,%xmm2
movss  -0xc(%rbp),%xmm0
movss  0xe0b(%rip),%xmm1
addss  %xmm2,%xmm1
divss  %xmm1,%xmm0
call   1030 <atanf@plt>
movaps %xmm0,%xmm1
movss  0xdfb(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asinf>:
push   %rax
ucomiss 0xeb8(%rip),%xmm0
ja     1174 <asinf+0x34>
movss  0xeb2(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     1174 <asinf+0x34>
movss  %xmm0,0x4(%rsp)
call   1060 <isnan@plt>
test   %rax,%rax
je     117c <asinf+0x3c>
mov    0x2e8a(%rip),%rax
movss  (%rax),%xmm0
pop    %rax
ret
xor    %eax,%eax
pop    %rcx
jmp    1040 <__domain_error@plt>
movss  0x4(%rsp),%xmm2
movaps %xmm2,%xmm1
mulss  %xmm2,%xmm1
movss  0xe6f(%rip),%xmm0
subss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11a6 <asinf+0x66>
movaps %xmm2,%xmm1
sqrtss %xmm0,%xmm0
jmp    11b1 <asinf+0x71>
call   1050 <sqrtf@plt>
movss  0x4(%rsp),%xmm1
addss  0xe47(%rip),%xmm0
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
call   1030 <atanf@plt>
addss  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@NAN = global float 0.000000e+00
define float @asinf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp ogt float %4, 1.000000e+00
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load float, float* %3
%8 = fcmp olt float %7, -1.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %6, %1
%10 = call float (...) @__domain_error()
store float %10, float* %2
br label %28
11: ; preds = %6
%12 = load float, float* %3
%13 = call i64 @isnan(float %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load float, float* @NAN
store float %16, float* %2
br label %28
17: ; preds = %11
%18 = load float, float* %3
%19 = load float, float* %3
%20 = load float, float* %3
%21 = fneg float %19
%22 = call float @llvm.fmuladd.f32(float %21, float %20, float 1.000000e+00)
%23 = call float @sqrtf(float %22)
%24 = fadd float 1.000000e+00, %23
%25 = fdiv float %18, %24
%26 = call float @atanf(float %25)
%27 = fmul float 2.000000e+00, %26
store float %27, float* %2
br label %28
28: ; preds = %17, %15, %9
%29 = load float, float* %2
ret float %29
}

LLVM IR (-O2):
@NAN = global float 0.000000e+00
define float @asinf(float %0) {
%2 = fcmp ogt float %0, 1.000000e+00
%3 = fcmp olt float %0, -1.000000e+00
%4 = or i1 %2, %3
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call float (...) @__domain_error()
br label %20
7: ; preds = %1
%8 = tail call i64 @isnan(float %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = load float, float* @NAN
br label %20
12: ; preds = %7
%13 = fneg float %0
%14 = tail call float @llvm.fmuladd.f32(float %13, float %0, float 1.000000e+00)
%15 = tail call float @sqrtf(float %14)
%16 = fadd float %15, 1.000000e+00
%17 = fdiv float %0, %16
%18 = tail call float @atanf(float %17)
%19 = fmul float %18, 2.000000e+00
br label %20
20: ; preds = %12, %10, %5
%21 = phi float [ %6, %5 ], [ %11, %10 ], [ %19, %12 ]
ret float %21
}