#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 atan(double);
double fabs(double);
double arg(double x, double y) {
  double angle;
  if ((x > 0) && (y > 0)) {
    angle = atan(y / x);
  }
  if ((x < 0) && (y > 0)) {
    angle = M_PI - atan(fabs(y / x));
  }
  if ((x > 0) && (y < 0)) {
    angle = -1.0 * atan(fabs(y / x));
  }
  if ((x < 0) && (y < 0)) {
    angle = atan(fabs(y / x)) - M_PI;
  }
  if ((x == 0) && (y > 0)) {
    angle = M_PI / 2.0;
  }
  if ((x == 0) && (y < 0)) {
    angle = 3.0 * M_PI / 2.0;
  }
  if ((x > 0) && (y == 0)) {
    angle = 0.0;
  }
  if ((x < 0) && (y == 0)) {
    angle = M_PI;
  }
  if ((x == 0) && (y == 0)) {
    angle = 0;
  }
  return angle;
}


x86 assembly (clang, -O0):
<arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    115a <arg+0x4a>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    115a <arg+0x4a>
movsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1030 <atan@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11b5 <arg+0xa5>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11b5 <arg+0xa5>
mov    0x2e67(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movaps 0xe65(%rip),%xmm1
pand   %xmm1,%xmm0
call   1030 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1203 <arg+0xf3>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1203 <arg+0xf3>
movsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movaps 0xe1a(%rip),%xmm1
pand   %xmm1,%xmm0
call   1030 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xe16(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1249 <arg+0x139>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1249 <arg+0x139>
movsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movaps 0xdd0(%rip),%xmm1
pand   %xmm1,%xmm0
call   1030 <atan@plt>
mov    0x2da8(%rip),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    128f <arg+0x17f>
jp     128f <arg+0x17f>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    128f <arg+0x17f>
mov    0x2d6e(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xd92(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12d9 <arg+0x1c9>
jp     12d9 <arg+0x1c9>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12d9 <arg+0x1c9>
movsd  0xd63(%rip),%xmm0
mov    0x2d24(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xd48(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    130b <arg+0x1fb>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    130b <arg+0x1fb>
jp     130b <arg+0x1fb>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1341 <arg+0x231>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1341 <arg+0x231>
jp     1341 <arg+0x231>
mov    0x2cb0(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1379 <arg+0x269>
jp     1379 <arg+0x269>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1379 <arg+0x269>
jp     1379 <arg+0x269>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg>:
sub    $0x28,%rsp
movapd %xmm0,%xmm5
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm5
movsd  %xmm5,0x8(%rsp)
movsd  %xmm1,(%rsp)
jbe    1153 <arg+0x43>
ucomisd %xmm0,%xmm1
jbe    1153 <arg+0x43>
movapd %xmm1,%xmm0
divsd  %xmm5,%xmm0
call   1030 <atan@plt>
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm5
movapd %xmm0,%xmm7
xorpd  %xmm0,%xmm0
ucomisd %xmm5,%xmm0
jbe    119d <arg+0x8d>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    119d <arg+0x8d>
mov    0x2e7e(%rip),%rax
movsd  (%rax),%xmm0
movaps %xmm0,0x10(%rsp)
movapd %xmm1,%xmm0
divsd  %xmm5,%xmm0
andpd  0xe7d(%rip),%xmm0
call   1030 <atan@plt>
movapd 0x10(%rsp),%xmm7
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm5
subsd  %xmm0,%xmm7
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm5
jbe    11dd <arg+0xcd>
ucomisd %xmm1,%xmm0
jbe    11dd <arg+0xcd>
movapd %xmm1,%xmm0
divsd  %xmm5,%xmm0
andpd  0xe43(%rip),%xmm0
call   1030 <atan@plt>
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm5
movapd %xmm0,%xmm7
xorpd  %xmm0,%xmm0
xorpd  0xe33(%rip),%xmm7
ucomisd %xmm5,%xmm0
jbe    1222 <arg+0x112>
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1222 <arg+0x112>
movapd %xmm1,%xmm0
divsd  %xmm5,%xmm0
andpd  0xe03(%rip),%xmm0
call   1030 <atan@plt>
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm5
movapd %xmm0,%xmm7
mov    0x2dd0(%rip),%rax
movsd  (%rax),%xmm0
subsd  %xmm0,%xmm7
jmp    122d <arg+0x11d>
mov    0x2dbf(%rip),%rax
movsd  (%rax),%xmm0
xorpd  %xmm6,%xmm6
ucomisd %xmm6,%xmm5
movsd  0xde3(%rip),%xmm2
jne    1262 <arg+0x152>
jp     1262 <arg+0x152>
movapd %xmm0,%xmm3
mulsd  %xmm2,%xmm3
xorpd  %xmm4,%xmm4
cmpltsd %xmm1,%xmm4
andpd  %xmm4,%xmm3
andnpd %xmm7,%xmm4
orpd   %xmm3,%xmm4
movapd %xmm4,%xmm7
jne    128f <arg+0x17f>
jp     128f <arg+0x17f>
movsd  0xdba(%rip),%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm3
movapd %xmm1,%xmm2
cmpltsd %xmm6,%xmm2
andpd  %xmm2,%xmm3
andnpd %xmm7,%xmm2
orpd   %xmm3,%xmm2
movapd %xmm2,%xmm7
ucomisd %xmm6,%xmm1
movapd %xmm7,%xmm3
jne    12a3 <arg+0x193>
movapd %xmm7,%xmm3
jp     12a3 <arg+0x193>
xorpd  %xmm3,%xmm3
xorpd  %xmm2,%xmm2
cmpltsd %xmm5,%xmm2
andpd  %xmm2,%xmm3
andnpd %xmm7,%xmm2
orpd   %xmm3,%xmm2
movapd %xmm2,%xmm3
jne    12c8 <arg+0x1b8>
movapd %xmm2,%xmm3
jp     12c8 <arg+0x1b8>
movapd %xmm0,%xmm3
movapd %xmm5,%xmm0
cmpltsd %xmm6,%xmm0
andpd  %xmm0,%xmm3
andnpd %xmm2,%xmm0
orpd   %xmm3,%xmm0
movapd %xmm0,%xmm2
jne    12ed <arg+0x1dd>
movapd %xmm0,%xmm2
jp     12ed <arg+0x1dd>
xorpd  %xmm2,%xmm2
ucomisd %xmm6,%xmm5
jne    12f9 <arg+0x1e9>
jp     12f9 <arg+0x1e9>
movapd %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @arg(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = fcmp ogt double %6, 0.000000e+00
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load double, double* %4
%10 = fcmp ogt double %9, 0.000000e+00
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load double, double* %4
%13 = load double, double* %3
%14 = fdiv double %12, %13
%15 = call double @atan(double %14)
store double %15, double* %5
br label %16
16: ; preds = %11, %8, %2
%17 = load double, double* %3
%18 = fcmp olt double %17, 0.000000e+00
br i1 %18, label %19, label %30
19: ; preds = %16
%20 = load double, double* %4
%21 = fcmp ogt double %20, 0.000000e+00
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load double, double* @M_PI
%24 = load double, double* %4
%25 = load double, double* %3
%26 = fdiv double %24, %25
%27 = call double @llvm.fabs.f64(double %26)
%28 = call double @atan(double %27)
%29 = fsub double %23, %28
store double %29, double* %5
br label %30
30: ; preds = %22, %19, %16
%31 = load double, double* %3
%32 = fcmp ogt double %31, 0.000000e+00
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = load double, double* %4
%35 = fcmp olt double %34, 0.000000e+00
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load double, double* %4
%38 = load double, double* %3
%39 = fdiv double %37, %38
%40 = call double @llvm.fabs.f64(double %39)
%41 = call double @atan(double %40)
%42 = fmul double -1.000000e+00, %41
store double %42, double* %5
br label %43
43: ; preds = %36, %33, %30
%44 = load double, double* %3
%45 = fcmp olt double %44, 0.000000e+00
br i1 %45, label %46, label %57
46: ; preds = %43
%47 = load double, double* %4
%48 = fcmp olt double %47, 0.000000e+00
br i1 %48, label %49, label %57
49: ; preds = %46
%50 = load double, double* %4
%51 = load double, double* %3
%52 = fdiv double %50, %51
%53 = call double @llvm.fabs.f64(double %52)
%54 = call double @atan(double %53)
%55 = load double, double* @M_PI
%56 = fsub double %54, %55
store double %56, double* %5
br label %57
57: ; preds = %49, %46, %43
%58 = load double, double* %3
%59 = fcmp oeq double %58, 0.000000e+00
br i1 %59, label %60, label %66
60: ; preds = %57
%61 = load double, double* %4
%62 = fcmp ogt double %61, 0.000000e+00
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = load double, double* @M_PI
%65 = fdiv double %64, 2.000000e+00
store double %65, double* %5
br label %66
66: ; preds = %63, %60, %57
%67 = load double, double* %3
%68 = fcmp oeq double %67, 0.000000e+00
br i1 %68, label %69, label %76
69: ; preds = %66
%70 = load double, double* %4
%71 = fcmp olt double %70, 0.000000e+00
br i1 %71, label %72, label %76
72: ; preds = %69
%73 = load double, double* @M_PI
%74 = fmul double 3.000000e+00, %73
%75 = fdiv double %74, 2.000000e+00
store double %75, double* %5
br label %76
76: ; preds = %72, %69, %66
%77 = load double, double* %3
%78 = fcmp ogt double %77, 0.000000e+00
br i1 %78, label %79, label %83
79: ; preds = %76
%80 = load double, double* %4
%81 = fcmp oeq double %80, 0.000000e+00
br i1 %81, label %82, label %83
82: ; preds = %79
store double 0.000000e+00, double* %5
br label %83
83: ; preds = %82, %79, %76
%84 = load double, double* %3
%85 = fcmp olt double %84, 0.000000e+00
br i1 %85, label %86, label %91
86: ; preds = %83
%87 = load double, double* %4
%88 = fcmp oeq double %87, 0.000000e+00
br i1 %88, label %89, label %91
89: ; preds = %86
%90 = load double, double* @M_PI
store double %90, double* %5
br label %91
91: ; preds = %89, %86, %83
%92 = load double, double* %3
%93 = fcmp oeq double %92, 0.000000e+00
br i1 %93, label %94, label %98
94: ; preds = %91
%95 = load double, double* %4
%96 = fcmp oeq double %95, 0.000000e+00
br i1 %96, label %97, label %98
97: ; preds = %94
store double 0.000000e+00, double* %5
br label %98
98: ; preds = %97, %94, %91
%99 = load double, double* %5
ret double %99
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @arg(double %0, double %1) {
%3 = fcmp ogt double %0, 0.000000e+00
%4 = fcmp ogt double %1, 0.000000e+00
%5 = and i1 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = fdiv double %1, %0
%8 = tail call double @atan(double %7)
br label %9
9: ; preds = %6, %2
%10 = phi double [ %8, %6 ], [ undef, %2 ]
%11 = fcmp olt double %0, 0.000000e+00
%12 = and i1 %11, %4
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load double, double* @M_PI
%15 = fdiv double %1, %0
%16 = tail call double @llvm.fabs.f64(double %15)
%17 = tail call double @atan(double %16)
%18 = fsub double %14, %17
br label %19
19: ; preds = %13, %9
%20 = phi double [ %18, %13 ], [ %10, %9 ]
%21 = fcmp olt double %1, 0.000000e+00
%22 = and i1 %3, %21
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = fdiv double %1, %0
%25 = tail call double @llvm.fabs.f64(double %24)
%26 = tail call double @atan(double %25)
%27 = fneg double %26
br label %28
28: ; preds = %23, %19
%29 = phi double [ %27, %23 ], [ %20, %19 ]
%30 = and i1 %11, %21
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = load double, double* @M_PI
br label %39
33: ; preds = %28
%34 = fdiv double %1, %0
%35 = tail call double @llvm.fabs.f64(double %34)
%36 = tail call double @atan(double %35)
%37 = load double, double* @M_PI
%38 = fsub double %36, %37
br label %39
39: ; preds = %31, %33
%40 = phi double [ %37, %33 ], [ %32, %31 ]
%41 = phi double [ %38, %33 ], [ %29, %31 ]
%42 = fcmp oeq double %0, 0.000000e+00
%43 = and i1 %42, %4
%44 = fmul double %40, 5.000000e-01
%45 = select i1 %43, double %44, double %41
%46 = and i1 %42, %21
%47 = fmul double %40, 3.000000e+00
%48 = fmul double %47, 5.000000e-01
%49 = select i1 %46, double %48, double %45
%50 = fcmp oeq double %1, 0.000000e+00
%51 = and i1 %3, %50
%52 = select i1 %51, double 0.000000e+00, double %49
%53 = and i1 %11, %50
%54 = select i1 %53, double %40, double %52
%55 = and i1 %42, %50
%56 = select i1 %55, double 0.000000e+00, double %54
ret double %56
}