#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 */
double asin(double);
int atan(int);
double invmodDymola(double, int);
double sin_inverse(double x, double y, const char *ys) {
  double pi;
  double n;
  ;
  pi = 4 * atan(1);
  n = invmodDymola((y + pi / 2), 2 * pi);
  return ((y - n * 2 * pi) > pi / 2 ? pi - asin(x) : asin(x)) + n * 2 * pi;
}


x86 assembly (clang, -O0):
<sin_inverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    $0x1,%edi
call   1030 <atan@plt>
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe92(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  0xe82(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
cvttsd2si %xmm1,%edi
call   1050 <invmodDymola@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xe62(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe2c(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    120c <sin_inverse+0xdc>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <asin@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    121b <sin_inverse+0xeb>
movsd  -0x8(%rbp),%xmm0
call   1040 <asin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  0xdd8(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sin_inverse>:
sub    $0x48,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%edi
call   1030 <atan@plt>
shl    $0x2,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movapd %xmm1,0x20(%rsp)
movsd  0xe9e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm0,0x30(%rsp)
addsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm1
cvttsd2si %xmm1,%edi
call   1050 <invmodDymola@plt>
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <asin@plt>
movapd 0x20(%rsp),%xmm2
subsd  %xmm0,%xmm2
movapd 0x30(%rsp),%xmm1
cmpltsd 0x8(%rsp),%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
addsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @sin_inverse(double %0, double %1, i8* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i8*
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store i8* %2, i8** %6
%9 = call i32 @atan(i32 1)
%10 = mul nsw i32 4, %9
%11 = sitofp i32 %10 to double
store double %11, double* %7
%12 = load double, double* %5
%13 = load double, double* %7
%14 = fdiv double %13, 2.000000e+00
%15 = fadd double %12, %14
%16 = load double, double* %7
%17 = fmul double 2.000000e+00, %16
%18 = fptosi double %17 to i32
%19 = call double @invmodDymola(double %15, i32 %18)
store double %19, double* %8
%20 = load double, double* %5
%21 = load double, double* %8
%22 = fmul double %21, 2.000000e+00
%23 = load double, double* %7
%24 = fneg double %22
%25 = call double @llvm.fmuladd.f64(double %24, double %23, double %20)
%26 = load double, double* %7
%27 = fdiv double %26, 2.000000e+00
%28 = fcmp ogt double %25, %27
br i1 %28, label %29, label %34
29: ; preds = %3
%30 = load double, double* %7
%31 = load double, double* %4
%32 = call double @asin(double %31)
%33 = fsub double %30, %32
br label %37
34: ; preds = %3
%35 = load double, double* %4
%36 = call double @asin(double %35)
br label %37
37: ; preds = %34, %29
%38 = phi double [ %33, %29 ], [ %36, %34 ]
%39 = load double, double* %8
%40 = fmul double %39, 2.000000e+00
%41 = load double, double* %7
%42 = call double @llvm.fmuladd.f64(double %40, double %41, double %38)
ret double %42
}

LLVM IR (-O2):
define double @sin_inverse(double %0, double %1, i8* nocapture readnone %2) {
%4 = tail call i32 @atan(i32 1)
%5 = shl nsw i32 %4, 2
%6 = sitofp i32 %5 to double
%7 = fmul double %6, 5.000000e-01
%8 = fadd double %7, %1
%9 = fmul double %6, 2.000000e+00
%10 = fptosi double %9 to i32
%11 = tail call double @invmodDymola(double %8, i32 %10)
%12 = fmul double %11, 2.000000e+00
%13 = fneg double %12
%14 = tail call double @llvm.fmuladd.f64(double %13, double %6, double %1)
%15 = fcmp ogt double %14, %7
%16 = tail call double @asin(double %0)
%17 = fsub double %6, %16
%18 = select i1 %15, double %17, double %16
%19 = tail call double @llvm.fmuladd.f64(double %12, double %6, double %18)
ret double %19
}