#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 acos(double);
double arccos(double x, double y) {
  double result = 0.0;
  if (y > 0.0)
    result = acos(x / y);
  if (y < 0.0)
    result = 3.141592653589793 + acos(x / y);
  return result;
}


x86 assembly (clang, -O0):
<arccos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1150 <arccos+0x40>
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1181 <arccos+0x71>
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <acos@plt>
movaps %xmm0,%xmm1
movsd  0xe88(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arccos>:
sub    $0x18,%rsp
movapd %xmm0,%xmm2
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm1
xorpd  %xmm0,%xmm0
ja     1131 <arccos+0x21>
ucomisd %xmm1,%xmm3
ja     1160 <arccos+0x50>
add    $0x18,%rsp
ret
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
call   1030 <acos@plt>
xorpd  %xmm3,%xmm3
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
ucomisd %xmm1,%xmm3
jbe    112c <arccos+0x1c>
divsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
call   1030 <acos@plt>
addsd  0xe8b(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @arccos(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
store double 0.000000e+00, double* %5
%6 = load double, double* %4
%7 = fcmp ogt double %6, 0.000000e+00
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load double, double* %3
%10 = load double, double* %4
%11 = fdiv double %9, %10
%12 = call double @acos(double %11)
store double %12, double* %5
br label %13
13: ; preds = %8, %2
%14 = load double, double* %4
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load double, double* %3
%18 = load double, double* %4
%19 = fdiv double %17, %18
%20 = call double @acos(double %19)
%21 = fadd double 0x400921FB54442D18, %20
store double %21, double* %5
br label %22
22: ; preds = %16, %13
%23 = load double, double* %5
ret double %23
}

LLVM IR (-O2):
define double @arccos(double %0, double %1) {
%3 = fcmp ogt double %1, 0.000000e+00
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = fdiv double %0, %1
%6 = tail call double @acos(double %5)
br label %7
7: ; preds = %4, %2
%8 = phi double [ %6, %4 ], [ 0.000000e+00, %2 ]
%9 = fcmp olt double %1, 0.000000e+00
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = fdiv double %0, %1
%12 = tail call double @acos(double %11)
%13 = fadd double %12, 0x400921FB54442D18
br label %14
14: ; preds = %10, %7
%15 = phi double [ %13, %10 ], [ %8, %7 ]
ret double %15
}