#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 ndt_mod(double, int);
double ndt_position_angle_reverse(double obverse) {
  if (obverse > 0.) {
    double reverse = ndt_mod(obverse - 360., -360.);
    return reverse ? reverse : -360.;
  }
  if (obverse < 0.) {
    double reverse = ndt_mod(obverse + 360., +360.);
    return reverse ? reverse : +360.;
  }
  return 0.;
}


x86 assembly (clang, -O0):
<ndt_position_angle_reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    119c <ndt_position_angle_reverse+0x8c>
movsd  -0x10(%rbp),%xmm0
movsd  0xec4(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    $0xfffffe98,%edi
call   1030 <ndt_mod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    116c <ndt_position_angle_reverse+0x5c>
jp     116c <ndt_position_angle_reverse+0x5c>
jmp    117b <ndt_position_angle_reverse+0x6b>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    118d <ndt_position_angle_reverse+0x7d>
movsd  0xe85(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    118d <ndt_position_angle_reverse+0x7d>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121b <ndt_position_angle_reverse+0x10b>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1213 <ndt_position_angle_reverse+0x103>
movsd  0xe4e(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
mov    $0x168,%edi
call   1030 <ndt_mod@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11e3 <ndt_position_angle_reverse+0xd3>
jp     11e3 <ndt_position_angle_reverse+0xd3>
jmp    11f2 <ndt_position_angle_reverse+0xe2>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1204 <ndt_position_angle_reverse+0xf4>
movsd  0xe06(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1204 <ndt_position_angle_reverse+0xf4>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121b <ndt_position_angle_reverse+0x10b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndt_position_angle_reverse>:
push   %rax
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    1154 <ndt_position_angle_reverse+0x44>
movsd  0xee1(%rip),%xmm0
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
mov    $0xfffffe98,%edi
call   1030 <ndt_mod@plt>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
cmpneqsd %xmm1,%xmm0
andpd  %xmm0,%xmm1
movsd  0xeb6(%rip),%xmm2
jmp    118d <ndt_position_angle_reverse+0x7d>
ucomisd %xmm1,%xmm0
jbe    1195 <ndt_position_angle_reverse+0x85>
movsd  0xe9e(%rip),%xmm0
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
mov    $0x168,%edi
call   1030 <ndt_mod@plt>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
cmpneqsd %xmm1,%xmm0
andpd  %xmm0,%xmm1
movsd  0xe73(%rip),%xmm2
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ndt_position_angle_reverse(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = fcmp ogt double %6, 0.000000e+00
br i1 %7, label %8, label %19
8: ; preds = %1
%9 = load double, double* %3
%10 = fsub double %9, 3.600000e+02
%11 = call double @ndt_mod(double %10, i32 -360)
store double %11, double* %4
%12 = load double, double* %4
%13 = fcmp une double %12, 0.000000e+00
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = load double, double* %4
br label %17
16: ; preds = %8
br label %17
17: ; preds = %16, %14
%18 = phi double [ %15, %14 ], [ -3.600000e+02, %16 ]
store double %18, double* %2
br label %34
19: ; preds = %1
%20 = load double, double* %3
%21 = fcmp olt double %20, 0.000000e+00
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = load double, double* %3
%24 = fadd double %23, 3.600000e+02
%25 = call double @ndt_mod(double %24, i32 360)
store double %25, double* %5
%26 = load double, double* %5
%27 = fcmp une double %26, 0.000000e+00
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = load double, double* %5
br label %31
30: ; preds = %22
br label %31
31: ; preds = %30, %28
%32 = phi double [ %29, %28 ], [ 3.600000e+02, %30 ]
store double %32, double* %2
br label %34
33: ; preds = %19
store double 0.000000e+00, double* %2
br label %34
34: ; preds = %33, %31, %17
%35 = load double, double* %2
ret double %35
}

LLVM IR (-O2):
define double @ndt_position_angle_reverse(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = fadd double %0, -3.600000e+02
%5 = tail call double @ndt_mod(double %4, i32 -360)
%6 = fcmp une double %5, 0.000000e+00
%7 = select i1 %6, double %5, double -3.600000e+02
br label %15
8: ; preds = %1
%9 = fcmp olt double %0, 0.000000e+00
br i1 %9, label %10, label %15
10: ; preds = %8
%11 = fadd double %0, 3.600000e+02
%12 = tail call double @ndt_mod(double %11, i32 360)
%13 = fcmp une double %12, 0.000000e+00
%14 = select i1 %13, double %12, double 3.600000e+02
br label %15
15: ; preds = %8, %10, %3
%16 = phi double [ %7, %3 ], [ %14, %10 ], [ 0.000000e+00, %8 ]
ret double %16
}