#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 M_PI;
double atan2(double, double);
double arc_tang(double y, double x) {
  return (x != 0.0 ? atan2(y, x) : (y >= 0 ? M_PI / 2.0 : -M_PI / 2.0));
}


x86 assembly (clang, -O0):
<arc_tang>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    113f <arc_tang+0x2f>
jp     113f <arc_tang+0x2f>
jmp    1158 <arc_tang+0x48>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,-0x18(%rbp)
jmp    11c8 <arc_tang+0xb8>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     118b <arc_tang+0x7b>
mov    0x2e77(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe83(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11be <arc_tang+0xae>
mov    0x2e56(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arc_tang>:
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    111c <arc_tang+0xc>
jnp    1121 <arc_tang+0x11>
jmp    1030 <atan2@plt>
ucomisd %xmm2,%xmm0
mov    0x2ebc(%rip),%rax
movsd  (%rax),%xmm0
jae    113b <arc_tang+0x2b>
mulsd  0xece(%rip),%xmm0
ret
mulsd  0xebd(%rip),%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @arc_tang(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp une double %5, 0.000000e+00
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load double, double* %3
%9 = load double, double* %4
%10 = call double @atan2(double %8, double %9)
br label %23
11: ; preds = %2
%12 = load double, double* %3
%13 = fcmp oge double %12, 0.000000e+00
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load double, double* @M_PI
%16 = fdiv double %15, 2.000000e+00
br label %21
17: ; preds = %11
%18 = load double, double* @M_PI
%19 = fneg double %18
%20 = fdiv double %19, 2.000000e+00
br label %21
21: ; preds = %17, %14
%22 = phi double [ %16, %14 ], [ %20, %17 ]
br label %23
23: ; preds = %21, %7
%24 = phi double [ %10, %7 ], [ %22, %21 ]
ret double %24
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @arc_tang(double %0, double %1) {
%3 = fcmp une double %1, 0.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call double @atan2(double %0, double %1)
br label %13
6: ; preds = %2
%7 = fcmp ult double %0, 0.000000e+00
%8 = load double, double* @M_PI
br i1 %7, label %11, label %9
9: ; preds = %6
%10 = fmul double %8, 5.000000e-01
br label %13
11: ; preds = %6
%12 = fmul double %8, -5.000000e-01
br label %13
13: ; preds = %9, %11, %4
%14 = phi double [ %5, %4 ], [ %10, %9 ], [ %12, %11 ]
ret double %14
}