#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 */
int modf(double, double *);
int round(double);
double gps_deg_dec(double deg_point) {
  double ddeg;
  double sec = modf(deg_point, &ddeg) * 60;
  int deg = (int)(ddeg / 100);
  int min = (int)(deg_point - (deg * 100));
  double absdlat = round(deg * 1000000.);
  double absmlat = round(min * 1000000.);
  double absslat = round(sec * 1000000.);
  return round(absdlat + (absmlat / 60) + (absslat / 3600)) / 1000000;
}


x86 assembly (clang, -O0):
<gps_deg_dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x10(%rbp),%rdi
call   1030 <modf@plt>
imul   $0x3c,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm0
imul   $0x64,-0x1c(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x20(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xe8c(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <round@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x20(%rbp),%xmm0
movsd  0xe6d(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <round@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe53(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <round@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  0xe26(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  0xe09(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
call   1040 <round@plt>
mov    $0xf4240,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gps_deg_dec>:
push   %rbx
sub    $0x30,%rsp
movaps %xmm0,(%rsp)
lea    0x28(%rsp),%rdi
call   1030 <modf@plt>
imul   $0x3c,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x28(%rsp),%xmm0
divsd  0xeaf(%rip),%xmm0
cvttsd2si %xmm0,%eax
imul   $0x64,%eax,%eax
cvtsi2sd %eax,%xmm1
movapd (%rsp),%xmm2
subsd  %xmm1,%xmm2
movapd %xmm2,(%rsp)
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
mulsd  0xe8e(%rip),%xmm0
call   1040 <round@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x18(%rsp)
cvttpd2dq (%rsp),%xmm0
cvtdq2pd %xmm0,%xmm0
mulsd  0xe6b(%rip),%xmm0
call   1040 <round@plt>
mov    %eax,%ebx
movsd  0x20(%rsp),%xmm0
mulsd  0xe56(%rip),%xmm0
call   1040 <round@plt>
movd   %ebx,%xmm0
movd   %eax,%xmm1
punpckldq %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm0
divpd  0xe41(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
addsd  %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1040 <round@plt>
cltq
imul   $0x431bde83,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @gps_deg_dec(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %2
%10 = load double, double* %2
%11 = call i32 @modf(double %10, double* %3)
%12 = mul nsw i32 %11, 60
%13 = sitofp i32 %12 to double
store double %13, double* %4
%14 = load double, double* %3
%15 = fdiv double %14, 1.000000e+02
%16 = fptosi double %15 to i32
store i32 %16, i32* %5
%17 = load double, double* %2
%18 = load i32, i32* %5
%19 = mul nsw i32 %18, 100
%20 = sitofp i32 %19 to double
%21 = fsub double %17, %20
%22 = fptosi double %21 to i32
store i32 %22, i32* %6
%23 = load i32, i32* %5
%24 = sitofp i32 %23 to double
%25 = fmul double %24, 1.000000e+06
%26 = call i32 @round(double %25)
%27 = sitofp i32 %26 to double
store double %27, double* %7
%28 = load i32, i32* %6
%29 = sitofp i32 %28 to double
%30 = fmul double %29, 1.000000e+06
%31 = call i32 @round(double %30)
%32 = sitofp i32 %31 to double
store double %32, double* %8
%33 = load double, double* %4
%34 = fmul double %33, 1.000000e+06
%35 = call i32 @round(double %34)
%36 = sitofp i32 %35 to double
store double %36, double* %9
%37 = load double, double* %7
%38 = load double, double* %8
%39 = fdiv double %38, 6.000000e+01
%40 = fadd double %37, %39
%41 = load double, double* %9
%42 = fdiv double %41, 3.600000e+03
%43 = fadd double %40, %42
%44 = call i32 @round(double %43)
%45 = sdiv i32 %44, 1000000
%46 = sitofp i32 %45 to double
ret double %46
}

LLVM IR (-O2):
define double @gps_deg_dec(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = call i32 @modf(double %0, double* %2)
%5 = mul nsw i32 %4, 60
%6 = sitofp i32 %5 to double
%7 = load double, double* %2
%8 = fdiv double %7, 1.000000e+02
%9 = fptosi double %8 to i32
%10 = mul nsw i32 %9, 100
%11 = sitofp i32 %10 to double
%12 = fsub double %0, %11
%13 = fptosi double %12 to i32
%14 = sitofp i32 %9 to double
%15 = fmul double %14, 1.000000e+06
%16 = tail call i32 @round(double %15)
%17 = sitofp i32 %16 to double
%18 = sitofp i32 %13 to double
%19 = fmul double %18, 1.000000e+06
%20 = tail call i32 @round(double %19)
%21 = fmul double %6, 1.000000e+06
%22 = tail call i32 @round(double %21)
%23 = insertelement <2 x i32> poison, i32 %20, i64 0
%24 = insertelement <2 x i32> %23, i32 %22, i64 1
%25 = sitofp <2 x i32> %24 to <2 x double>
%26 = fdiv <2 x double> %25, <double 6.000000e+01, double 3.600000e+03>
%27 = extractelement <2 x double> %26, i64 0
%28 = fadd double %27, %17
%29 = extractelement <2 x double> %26, i64 1
%30 = fadd double %28, %29
%31 = tail call i32 @round(double %30)
%32 = sdiv i32 %31, 1000000
%33 = sitofp i32 %32 to double
ret double %33
}