#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 fabs(double);
double modf(double, double *);
double geoRads2Decdms(double rads) {
  double d, m, s, sign;
  double frac;
  if (rads < 0.0)
    sign = -1.0;
  else
    sign = 1.0;
  frac = modf(fabs(rads * (180.0 / 3.14159265358979323846)), &d);
  frac = modf(frac * 60.0, &m);
  s = frac * 60.0;
  return (((d * 10000.0) + (m * 100) + s) * sign);
}


x86 assembly (clang, -O0):
<geoRads2Decdms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    113d <geoRads2Decdms+0x2d>
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    114a <geoRads2Decdms+0x3a>
movsd  0xebb(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xed6(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movaps 0xed2(%rip),%xmm1
pand   %xmm1,%xmm0
lea    -0x10(%rbp),%rdi
call   1030 <modf@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xea8(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
lea    -0x18(%rbp),%rdi
call   1030 <modf@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xe8d(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xe59(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geoRads2Decdms>:
sub    $0x28,%rsp
movapd %xmm0,%xmm1
movapd %xmm0,0x10(%rsp)
movsd  0xeda(%rip),%xmm0
mulsd  %xmm1,%xmm0
andpd  0xeee(%rip),%xmm0
lea    0x8(%rsp),%rdi
call   1030 <modf@plt>
mulsd  0xec4(%rip),%xmm0
mov    %rsp,%rdi
call   1030 <modf@plt>
mulsd  0xeb4(%rip),%xmm0
movsd  (%rsp),%xmm1
mulsd  0xeaf(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  0xea9(%rip),%xmm2
addsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movapd 0xeb1(%rip),%xmm0
xorpd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
movapd 0x10(%rsp),%xmm3
cmpltsd %xmm1,%xmm3
movapd %xmm3,%xmm1
andnpd %xmm2,%xmm1
andpd  %xmm0,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @geoRads2Decdms(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %2
%8 = load double, double* %2
%9 = fcmp olt double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %1
store double -1.000000e+00, double* %6
br label %12
11: ; preds = %1
store double 1.000000e+00, double* %6
br label %12
12: ; preds = %11, %10
%13 = load double, double* %2
%14 = fmul double %13, 0x404CA5DC1A63C1F8
%15 = call double @llvm.fabs.f64(double %14)
%16 = call double @modf(double %15, double* %3)
store double %16, double* %7
%17 = load double, double* %7
%18 = fmul double %17, 6.000000e+01
%19 = call double @modf(double %18, double* %4)
store double %19, double* %7
%20 = load double, double* %7
%21 = fmul double %20, 6.000000e+01
store double %21, double* %5
%22 = load double, double* %3
%23 = load double, double* %4
%24 = fmul double %23, 1.000000e+02
%25 = call double @llvm.fmuladd.f64(double %22, double 1.000000e+04, double %24)
%26 = load double, double* %5
%27 = fadd double %25, %26
%28 = load double, double* %6
%29 = fmul double %27, %28
ret double %29
}

LLVM IR (-O2):
define double @geoRads2Decdms(double %0) {
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %2 to i8*
%5 = bitcast double* %3 to i8*
%6 = fcmp olt double %0, 0.000000e+00
%7 = fmul double %0, 0x404CA5DC1A63C1F8
%8 = tail call double @llvm.fabs.f64(double %7)
%9 = call double @modf(double %8, double* %2)
%10 = fmul double %9, 6.000000e+01
%11 = call double @modf(double %10, double* %3)
%12 = fmul double %11, 6.000000e+01
%13 = load double, double* %2
%14 = load double, double* %3
%15 = fmul double %14, 1.000000e+02
%16 = tail call double @llvm.fmuladd.f64(double %13, double 1.000000e+04, double %15)
%17 = fadd double %12, %16
%18 = fneg double %17
%19 = select i1 %6, double %18, double %17
ret double %19
}