#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 atan(double);
double actan(double sinx, double cosx) {
  double ret;
  ret = 0.0;
  if (cosx < 0.0) {
    ret = 3.14159265358979323846;
  } else if (cosx == 0.0) {
    if (sinx < 0.0) {
      return 3.0 * 1.57079632679489661923;
    } else if (sinx == 0.0) {
      return ret;
    } else {
      return 1.57079632679489661923;
    }
  } else {
    if (sinx < 0.0) {
      ret = 2.0 * 3.14159265358979323846;
    } else if (sinx == 0.0) {
      return ret;
    }
  }
  return ret + atan(sinx / cosx);
}


x86 assembly (clang, -O0):
<actan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    114a <actan+0x3a>
movsd  0xed8(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1211 <actan+0x101>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11bb <actan+0xab>
jp     11bb <actan+0xab>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1182 <actan+0x72>
movsd  0xe98(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    123b <actan+0x12b>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a9 <actan+0x99>
jp     11a9 <actan+0x99>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    123b <actan+0x12b>
movsd  0xe57(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    123b <actan+0x12b>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11db <actan+0xcb>
movsd  0xe2f(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1207 <actan+0xf7>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1202 <actan+0xf2>
jp     1202 <actan+0xf2>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    123b <actan+0x12b>
jmp    1207 <actan+0xf7>
jmp    120c <actan+0xfc>
jmp    1211 <actan+0x101>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<actan>:
push   %rax
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jbe    113c <actan+0x2c>
movsd  0xedd(%rip),%xmm2
movsd  %xmm2,(%rsp)
divsd  %xmm1,%xmm0
call   1030 <atan@plt>
movsd  (%rsp),%xmm2
addsd  %xmm0,%xmm2
jmp    118b <actan+0x7b>
ucomisd %xmm2,%xmm1
jne    1158 <actan+0x48>
jp     1158 <actan+0x48>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    116c <actan+0x5c>
movsd  0xeba(%rip),%xmm2
jmp    118b <actan+0x7b>
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
jbe    1183 <actan+0x73>
movsd  0xe9e(%rip),%xmm2
jmp    1123 <actan+0x13>
cmpeqsd %xmm1,%xmm0
movsd  0xe9f(%rip),%xmm1
andnpd %xmm1,%xmm0
movapd %xmm0,%xmm2
jmp    118b <actan+0x7b>
ucomisd %xmm2,%xmm0
jne    1123 <actan+0x13>
jp     1123 <actan+0x13>
movapd %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @actan(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double 0.000000e+00, double* %6
%7 = load double, double* %5
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %2
store double 0x400921FB54442D18, double* %6
br label %35
10: ; preds = %2
%11 = load double, double* %5
%12 = fcmp oeq double %11, 0.000000e+00
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load double, double* %4
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %16, label %17
16: ; preds = %13
store double 0x4012D97C7F3321D2, double* %3
br label %42
17: ; preds = %13
%18 = load double, double* %4
%19 = fcmp oeq double %18, 0.000000e+00
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = load double, double* %6
store double %21, double* %3
br label %42
22: ; preds = %17
store double 0x3FF921FB54442D18, double* %3
br label %42
23: ; preds = %10
%24 = load double, double* %4
%25 = fcmp olt double %24, 0.000000e+00
br i1 %25, label %26, label %27
26: ; preds = %23
store double 0x401921FB54442D18, double* %6
br label %33
27: ; preds = %23
%28 = load double, double* %4
%29 = fcmp oeq double %28, 0.000000e+00
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = load double, double* %6
store double %31, double* %3
br label %42
32: ; preds = %27
br label %33
33: ; preds = %32, %26
br label %34
34: ; preds = %33
br label %35
35: ; preds = %34, %9
%36 = load double, double* %6
%37 = load double, double* %4
%38 = load double, double* %5
%39 = fdiv double %37, %38
%40 = call double @atan(double %39)
%41 = fadd double %36, %40
store double %41, double* %3
br label %42
42: ; preds = %35, %30, %22, %20, %16
%43 = load double, double* %3
ret double %43
}

LLVM IR (-O2):
define double @actan(double %0, double %1) {
%3 = fcmp olt double %1, 0.000000e+00
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = fcmp oeq double %1, 0.000000e+00
%6 = fcmp olt double %0, 0.000000e+00
br i1 %5, label %7, label %11
7: ; preds = %4
br i1 %6, label %19, label %8
8: ; preds = %7
%9 = fcmp oeq double %0, 0.000000e+00
%10 = select i1 %9, double 0.000000e+00, double 0x3FF921FB54442D18
br label %19
11: ; preds = %4
br i1 %6, label %14, label %12
12: ; preds = %11
%13 = fcmp oeq double %0, 0.000000e+00
br i1 %13, label %19, label %14
14: ; preds = %11, %2, %12
%15 = phi double [ 0.000000e+00, %12 ], [ 0x400921FB54442D18, %2 ], [ 0x401921FB54442D18, %11 ]
%16 = fdiv double %0, %1
%17 = tail call double @atan(double %16)
%18 = fadd double %15, %17
br label %19
19: ; preds = %12, %8, %7, %14
%20 = phi double [ %18, %14 ], [ 0x4012D97C7F3321D2, %7 ], [ %10, %8 ], [ 0.000000e+00, %12 ]
ret double %20
}