#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) {
  if (cosx == 0) {
    if (sinx > 0)
      return (1.5707963267949);
    else
      return (4.71238898);
  } else {
    if (cosx > 0) {
      if (sinx > 0)
        return (atan(sinx / cosx));
      else
        return (6.2831853071796 + atan(sinx / cosx));
    } else
      return (3.1415926535898 + atan(sinx / cosx));
  }
}


x86 assembly (clang, -O0):
<AcTan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1170 <AcTan+0x60>
jp     1170 <AcTan+0x60>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    115e <AcTan+0x4e>
movsd  0xec4(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f8 <AcTan+0xe8>
movsd  0xeaa(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f8 <AcTan+0xe8>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11d5 <AcTan+0xc5>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ad <AcTan+0x9d>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <atan@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11f8 <AcTan+0xe8>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xe41(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f8 <AcTan+0xe8>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xe11(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AcTan>:
push   %rax
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1138 <AcTan+0x28>
jp     1138 <AcTan+0x28>
xor    %eax,%eax
ucomisd %xmm0,%xmm2
seta   %al
lea    0xedf(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
pop    %rax
ret
jbe    1165 <AcTan+0x55>
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm2,(%rsp)
call   1030 <atan@plt>
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm2
ucomisd %xmm1,%xmm2
ja     117a <AcTan+0x6a>
addsd  0xea5(%rip),%xmm0
pop    %rax
ret
divsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
call   1030 <atan@plt>
addsd  0xe86(%rip),%xmm0
pop    %rax
ret

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

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