#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 atof(char *);
int character_count(char, char *);
int /*<<< orphan*/ column(char *, int, char *);
double google_map_convert_base_60(char *latitude_longitude) {
  char degrees[16];
  char minutes[16];
  char seconds[16];
  double results;
  if (!*latitude_longitude)
    return 0.0;
  if (character_count(' ', latitude_longitude) != 2)
    return 0.0;
  column(degrees, 0, latitude_longitude);
  column(minutes, 1, latitude_longitude);
  column(seconds, 2, latitude_longitude);
  if (!*degrees)
    return 0.0;
  if (*degrees == '-') {
    results =
        atof(degrees) - ((atof(minutes) / 60.0) + (atof(seconds) / 3600.0));
  } else {
    results =
        atof(degrees) + ((atof(minutes) / 60.0) + (atof(seconds) / 3600.0));
  }
  return results;
}


x86 assembly (clang, -O0):
<google_map_convert_base_60>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1156 <google_map_convert_base_60+0x26>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    128e <google_map_convert_base_60+0x15e>
mov    -0x10(%rbp),%rsi
mov    $0x20,%edi
call   1040 <character_count@plt>
cmp    $0x2,%eax
je     117a <google_map_convert_base_60+0x4a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    128e <google_map_convert_base_60+0x15e>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1050 <column@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x1,%esi
call   1050 <column@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2,%esi
call   1050 <column@plt>
cmpb   $0x0,-0x20(%rbp)
jne    11c4 <google_map_convert_base_60+0x94>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    128e <google_map_convert_base_60+0x15e>
movsbl -0x20(%rbp),%eax
cmp    $0x2d,%eax
jne    122d <google_map_convert_base_60+0xfd>
lea    -0x20(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x50(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <atof@plt>
movsd  0xe18(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    -0x40(%rbp),%rdi
call   1030 <atof@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movsd  0xde9(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1284 <google_map_convert_base_60+0x154>
lea    -0x20(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x60(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <atof@plt>
movsd  0xdbc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
lea    -0x40(%rbp),%rdi
call   1030 <atof@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
movsd  0xd8d(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<google_map_convert_base_60>:
push   %rbx
sub    $0x50,%rsp
xorpd  %xmm0,%xmm0
cmpb   $0x0,(%rdi)
je     1245 <google_map_convert_base_60+0x115>
mov    %rdi,%rbx
mov    $0x20,%edi
mov    %rbx,%rsi
call   1040 <character_count@plt>
cmp    $0x2,%eax
jne    11f8 <google_map_convert_base_60+0xc8>
lea    0x20(%rsp),%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1050 <column@plt>
lea    0x40(%rsp),%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
call   1050 <column@plt>
lea    0x30(%rsp),%rdi
mov    $0x2,%esi
mov    %rbx,%rdx
call   1050 <column@plt>
mov    0x20(%rsp),%al
test   %al,%al
xorpd  %xmm0,%xmm0
je     1245 <google_map_convert_base_60+0x115>
lea    0x20(%rsp),%rdi
cmp    $0x2d,%al
jne    11fe <google_map_convert_base_60+0xce>
call   1030 <atof@plt>
movapd %xmm0,0x10(%rsp)
lea    0x40(%rsp),%rdi
call   1030 <atof@plt>
movapd %xmm0,(%rsp)
lea    0x30(%rsp),%rdi
call   1030 <atof@plt>
movapd (%rsp),%xmm1
unpcklpd %xmm0,%xmm1
divpd  0xe24(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movapd 0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    1245 <google_map_convert_base_60+0x115>
xorpd  %xmm0,%xmm0
jmp    1245 <google_map_convert_base_60+0x115>
call   1030 <atof@plt>
movsd  %xmm0,0x10(%rsp)
lea    0x40(%rsp),%rdi
call   1030 <atof@plt>
movapd %xmm0,(%rsp)
lea    0x30(%rsp),%rdi
call   1030 <atof@plt>
movapd (%rsp),%xmm1
unpcklpd %xmm0,%xmm1
divpd  0xdcd(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @google_map_convert_base_60(i8* %0) {
%2 = alloca double
%3 = alloca i8*
%4 = alloca [16 x i8]
%5 = alloca [16 x i8]
%6 = alloca [16 x i8]
%7 = alloca double
store i8* %0, i8** %3
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %1
store double 0.000000e+00, double* %2
br label %60
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = call i32 @character_count(i8 signext 32, i8* %13)
%15 = icmp ne i32 %14, 2
br i1 %15, label %16, label %17
16: ; preds = %12
store double 0.000000e+00, double* %2
br label %60
17: ; preds = %12
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%19 = load i8*, i8** %3
%20 = call i32 @column(i8* %18, i32 0, i8* %19)
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%22 = load i8*, i8** %3
%23 = call i32 @column(i8* %21, i32 1, i8* %22)
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%25 = load i8*, i8** %3
%26 = call i32 @column(i8* %24, i32 2, i8* %25)
%27 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%28 = load i8, i8* %27
%29 = icmp ne i8 %28, 0
br i1 %29, label %31, label %30
30: ; preds = %17
store double 0.000000e+00, double* %2
br label %60
31: ; preds = %17
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 45
br i1 %35, label %36, label %47
36: ; preds = %31
%37 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%38 = call double @atof(i8* %37)
%39 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%40 = call double @atof(i8* %39)
%41 = fdiv double %40, 6.000000e+01
%42 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%43 = call double @atof(i8* %42)
%44 = fdiv double %43, 3.600000e+03
%45 = fadd double %41, %44
%46 = fsub double %38, %45
store double %46, double* %7
br label %58
47: ; preds = %31
%48 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%49 = call double @atof(i8* %48)
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%51 = call double @atof(i8* %50)
%52 = fdiv double %51, 6.000000e+01
%53 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%54 = call double @atof(i8* %53)
%55 = fdiv double %54, 3.600000e+03
%56 = fadd double %52, %55
%57 = fadd double %49, %56
store double %57, double* %7
br label %58
58: ; preds = %47, %36
%59 = load double, double* %7
store double %59, double* %2
br label %60
60: ; preds = %58, %30, %16, %11
%61 = load double, double* %2
ret double %61
}

LLVM IR (-O2):
define double @google_map_convert_base_60(i8* %0) {
%2 = alloca [16 x i8]
%3 = alloca [16 x i8]
%4 = alloca [16 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 0
br i1 %9, label %40, label %10
10: ; preds = %1
%11 = tail call i32 @character_count(i8 signext 32, i8* %0)
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %40
13: ; preds = %10
%14 = call i32 @column(i8* %5, i32 0, i8* %0)
%15 = call i32 @column(i8* %6, i32 1, i8* %0)
%16 = call i32 @column(i8* %7, i32 2, i8* %0)
%17 = load i8, i8* %5
switch i8 %17, label %29 [
i8 0, label %40
i8 45, label %18
]
18: ; preds = %13
%19 = call double @atof(i8* %5)
%20 = call double @atof(i8* %6)
%21 = call double @atof(i8* %7)
%22 = insertelement <2 x double> poison, double %20, i64 0
%23 = insertelement <2 x double> %22, double %21, i64 1
%24 = fdiv <2 x double> %23, <double 6.000000e+01, double 3.600000e+03>
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%26 = fadd <2 x double> %24, %25
%27 = extractelement <2 x double> %26, i64 0
%28 = fsub double %19, %27
br label %40
29: ; preds = %13
%30 = call double @atof(i8* %5)
%31 = call double @atof(i8* %6)
%32 = call double @atof(i8* %7)
%33 = insertelement <2 x double> poison, double %31, i64 0
%34 = insertelement <2 x double> %33, double %32, i64 1
%35 = fdiv <2 x double> %34, <double 6.000000e+01, double 3.600000e+03>
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%37 = fadd <2 x double> %35, %36
%38 = extractelement <2 x double> %37, i64 0
%39 = fadd double %30, %38
br label %40
40: ; preds = %18, %29, %13, %10, %1
%41 = phi double [ 0.000000e+00, %1 ], [ 0.000000e+00, %10 ], [ 0.000000e+00, %13 ], [ %28, %18 ], [ %39, %29 ]
ret double %41
}