#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 const fabs(double const);
extern double dms2deg(const double *dms) {
  double sign = dms[0] < 0.0 ? -1.0 : 1.0;
  return sign * (fabs(dms[0]) + dms[1] / 60.0 + dms[2] / 3600.0);
}


x86 assembly (clang, -O0):
<dms2deg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xee4(%rip),%xmm3
movsd  0xee4(%rip),%xmm2
xorps  %xmm1,%xmm1
cmpltsd %xmm1,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
movsd  0xe88(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
movsd  0xe67(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dms2deg>:
movsd  (%rdi),%xmm0
movapd 0xef4(%rip),%xmm1
andpd  %xmm0,%xmm1
movupd 0x8(%rdi),%xmm2
divpd  0xef3(%rip),%xmm2
addsd  %xmm2,%xmm1
unpckhpd %xmm2,%xmm2
addsd  %xmm1,%xmm2
movapd 0xeef(%rip),%xmm1
xorpd  %xmm2,%xmm1
xorpd  %xmm3,%xmm3
cmpltsd %xmm3,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm2,%xmm3
andpd  %xmm1,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @dms2deg(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 0
%6 = load double, double* %5
%7 = fcmp olt double %6, 0.000000e+00
%8 = zext i1 %7 to i64
%9 = select i1 %7, double -1.000000e+00, double 1.000000e+00
store double %9, double* %3
%10 = load double, double* %3
%11 = load double*, double** %2
%12 = getelementptr inbounds double, double* %11, i64 0
%13 = load double, double* %12
%14 = call double @fabs(double %13)
%15 = load double*, double** %2
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = fdiv double %17, 6.000000e+01
%19 = fadd double %14, %18
%20 = load double*, double** %2
%21 = getelementptr inbounds double, double* %20, i64 2
%22 = load double, double* %21
%23 = fdiv double %22, 3.600000e+03
%24 = fadd double %19, %23
%25 = fmul double %10, %24
ret double %25
}

LLVM IR (-O2):
define double @dms2deg(double* nocapture %0) {
%2 = load double, double* %0
%3 = fcmp olt double %2, 0.000000e+00
%4 = tail call double @llvm.fabs.f64(double %2)
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = bitcast double* %5 to <2 x double>*
%7 = load <2 x double>, <2 x double>* %6
%8 = fdiv <2 x double> %7, <double 6.000000e+01, double 3.600000e+03>
%9 = extractelement <2 x double> %8, i64 0
%10 = fadd double %4, %9
%11 = extractelement <2 x double> %8, i64 1
%12 = fadd double %10, %11
%13 = fneg double %12
%14 = select i1 %3, double %13, double %12
ret double %14
}