#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 atand(double v) {
  if (v == -1.0) {
    return -45.0;
  } else if (v == 0.0) {
    return 0.0;
  } else if (v == 1.0) {
    return 45.0;
  }
  return atan(v) * 180.0 / 3.141592653589793238462643;
}


x86 assembly (clang, -O0):
<atand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    114c <atand+0x3c>
jp     114c <atand+0x3c>
movsd  0xee6(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <atand+0xc1>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1171 <atand+0x61>
jp     1171 <atand+0x61>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <atand+0xc1>
movsd  -0x10(%rbp),%xmm0
movsd  0xe8a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11a0 <atand+0x90>
jp     11a0 <atand+0x90>
movsd  0xe8a(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <atand+0xc1>
jmp    11a5 <atand+0x95>
jmp    11aa <atand+0x9a>
movsd  -0x10(%rbp),%xmm0
call   1030 <atan@plt>
movsd  0xe5c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe48(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atand>:
push   %rax
ucomisd 0xeef(%rip),%xmm0
jne    1127 <atand+0x17>
jp     1127 <atand+0x17>
movsd  0xedb(%rip),%xmm0
pop    %rax
ret
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1139 <atand+0x29>
jp     1139 <atand+0x29>
pop    %rax
ret
ucomisd 0xed7(%rip),%xmm1
jne    114f <atand+0x3f>
jp     114f <atand+0x3f>
movsd  0xec3(%rip),%xmm0
pop    %rax
ret
movapd %xmm1,%xmm0
call   1030 <atan@plt>
mulsd  0xec0(%rip),%xmm0
divsd  0xec0(%rip),%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define double @atand(double %0) {
%2 = fcmp oeq double %0, -1.000000e+00
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = fcmp oeq double %0, 0.000000e+00
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = fcmp oeq double %0, 1.000000e+00
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = tail call double @atan(double %0)
%9 = fmul double %8, 1.800000e+02
%10 = fdiv double %9, 0x400921FB54442D18
br label %11
11: ; preds = %5, %3, %1, %7
%12 = phi double [ %10, %7 ], [ -4.500000e+01, %1 ], [ 0.000000e+00, %3 ], [ 4.500000e+01, %5 ]
ret double %12
}