#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 /*<<< orphan*/ assert(int);
int atoi(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char *);
scalar_t__ strspn(char *, char *);
char *strtok_r(char *, char *, char **);
int swh_geoc2d(const char *coord, double *ret) {
  int deg, dir, min, sec, degmax;
  char *ptr, buf[12];
  strcpy(buf, coord);
  char *saveptr;
  ptr = strtok_r(buf, ":", &saveptr);
  if (ptr == NULL || strspn(ptr, "0123456789") != strlen(ptr))
    return -1;
  else
    deg = atoi(ptr);
  assert(deg >= 0);
  ptr = strtok_r(NULL, ":", &saveptr);
  if (ptr == NULL)
    return -1;
  else {
    if (strcmp(ptr, "N") == 0 || strcmp(ptr, "E") == 0) {
      degmax = 90;
      dir = 1;
    } else if (strcmp(ptr, "S") == 0 || strcmp(ptr, "W") == 0) {
      degmax = 180;
      dir = 0;
    } else
      return -1;
  }
  assert(deg <= degmax);
  ptr = strtok_r(NULL, ":", &saveptr);
  if (ptr == NULL || strspn(ptr, "0123456789") != strlen(ptr))
    return -1;
  else
    min = atoi(ptr);
  assert(deg == degmax ? min == 0 : min >= 0 && min <= 59);
  ptr = strtok_r(NULL, ":", &saveptr);
  if (ptr == NULL || strspn(ptr, "0123456789") != strlen(ptr))
    return -1;
  else
    sec = atoi(ptr);
  assert(deg == degmax ? sec == 0 : sec >= 0 && sec <= 59);
  *ret = (double)(dir ? (deg + ((1.0 / 60) * min) + ((1.0 / 3600) * sec))
                      : -(deg + ((1.0 / 60) * min) + ((1.0 / 3600) * sec)));
  return 0;
}


x86 assembly (clang, -O0):
<swh_geoc2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x44(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x44(%rbp),%rdi
lea    0xe75(%rip),%rsi
lea    -0x50(%rbp),%rdx
call   1060 <strtok_r@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     11e0 <swh_geoc2d+0x70>
mov    -0x38(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1050 <strspn@plt>
mov    %rax,-0x58(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
cmp    %rcx,%rax
je     11ec <swh_geoc2d+0x7c>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f9 <swh_geoc2d+0x389>
mov    -0x38(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdfc(%rip),%rsi
lea    -0x50(%rbp),%rdx
call   1060 <strtok_r@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1238 <swh_geoc2d+0xc8>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f9 <swh_geoc2d+0x389>
mov    -0x38(%rbp),%rdi
lea    0xdda(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     126c <swh_geoc2d+0xfc>
mov    -0x38(%rbp),%rdi
lea    0xdc2(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    127f <swh_geoc2d+0x10f>
movl   $0x5a,-0x2c(%rbp)
movl   $0x1,-0x20(%rbp)
jmp    12d7 <swh_geoc2d+0x167>
mov    -0x38(%rbp),%rdi
lea    0xd97(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     12b3 <swh_geoc2d+0x143>
mov    -0x38(%rbp),%rdi
lea    0xd7f(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12c6 <swh_geoc2d+0x156>
movl   $0xb4,-0x2c(%rbp)
movl   $0x0,-0x20(%rbp)
jmp    12d2 <swh_geoc2d+0x162>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f9 <swh_geoc2d+0x389>
jmp    12d7 <swh_geoc2d+0x167>
jmp    12dc <swh_geoc2d+0x16c>
mov    -0x1c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd16(%rip),%rsi
lea    -0x50(%rbp),%rdx
call   1060 <strtok_r@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     133f <swh_geoc2d+0x1cf>
mov    -0x38(%rbp),%rdi
lea    0xcf5(%rip),%rsi
call   1050 <strspn@plt>
mov    %rax,-0x60(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
cmp    %rcx,%rax
je     134b <swh_geoc2d+0x1db>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f9 <swh_geoc2d+0x389>
mov    -0x38(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jne    1377 <swh_geoc2d+0x207>
cmpl   $0x0,-0x24(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x64(%rbp)
jmp    139b <swh_geoc2d+0x22b>
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x65(%rbp)
jl     1390 <swh_geoc2d+0x220>
cmpl   $0x3b,-0x24(%rbp)
setle  %al
mov    %al,-0x65(%rbp)
mov    -0x65(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
call   1080 <assert@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xc62(%rip),%rsi
lea    -0x50(%rbp),%rdx
call   1060 <strtok_r@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     13f3 <swh_geoc2d+0x283>
mov    -0x38(%rbp),%rdi
lea    0xc41(%rip),%rsi
call   1050 <strspn@plt>
mov    %rax,-0x70(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x70(%rbp),%rax
cmp    %rcx,%rax
je     13ff <swh_geoc2d+0x28f>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f9 <swh_geoc2d+0x389>
mov    -0x38(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jne    142b <swh_geoc2d+0x2bb>
cmpl   $0x0,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x74(%rbp)
jmp    144f <swh_geoc2d+0x2df>
xor    %eax,%eax
cmpl   $0x0,-0x28(%rbp)
mov    %al,-0x75(%rbp)
jl     1444 <swh_geoc2d+0x2d4>
cmpl   $0x3b,-0x28(%rbp)
setle  %al
mov    %al,-0x75(%rbp)
mov    -0x75(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%edi
call   1080 <assert@plt>
cmpl   $0x0,-0x20(%rbp)
je     149a <swh_geoc2d+0x32a>
cvtsi2sdl -0x1c(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  0xb95(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdl -0x28(%rbp),%xmm0
movsd  0xb78(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    14e5 <swh_geoc2d+0x375>
cvtsi2sdl -0x1c(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  0xb5c(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdl -0x28(%rbp),%xmm0
movsd  0xb3f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swh_geoc2d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rsi
lea    0x1c(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe88(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1060 <strtok_r@plt>
mov    $0xffffffff,%r13d
test   %rax,%rax
je     139c <swh_geoc2d+0x22c>
mov    %rax,%rbx
lea    0xe64(%rip),%rsi
mov    %rax,%rdi
call   1050 <strspn@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %rax,%rbp
jne    139c <swh_geoc2d+0x22c>
mov    %rbx,%rdi
call   1090 <atoi@plt>
mov    %eax,%r12d
mov    %eax,%edi
not    %edi
shr    $0x1f,%edi
call   1080 <assert@plt>
lea    0xe28(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %edi,%edi
call   1060 <strtok_r@plt>
test   %rax,%rax
je     139c <swh_geoc2d+0x22c>
mov    %rax,%rbx
lea    0xe16(%rip),%rsi
mov    %rax,%rdi
call   1070 <strcmp@plt>
mov    $0x5a,%r15d
test   %rax,%rax
je     1275 <swh_geoc2d+0x105>
lea    0xdfe(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1275 <swh_geoc2d+0x105>
lea    0xdec(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
mov    $0xb4,%r15d
mov    $0x1,%bpl
test   %rax,%rax
je     1277 <swh_geoc2d+0x107>
lea    0xdd1(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    139c <swh_geoc2d+0x22c>
jmp    1277 <swh_geoc2d+0x107>
xor    %ebp,%ebp
xor    %edi,%edi
cmp    %r15d,%r12d
setle  %dil
call   1080 <assert@plt>
lea    0xd94(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %edi,%edi
call   1060 <strtok_r@plt>
test   %rax,%rax
je     139c <swh_geoc2d+0x22c>
mov    %rax,%rbx
mov    %ebp,0x18(%rsp)
lea    0xd73(%rip),%rsi
mov    %rax,%rdi
call   1050 <strspn@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %rax,%rbp
jne    139c <swh_geoc2d+0x22c>
mov    %rbx,%rdi
call   1090 <atoi@plt>
mov    %eax,%ebp
xor    %eax,%eax
test   %ebp,%ebp
sete   %al
xor    %ecx,%ecx
cmp    $0x3c,%ebp
setb   %cl
cmp    %r15d,%r12d
cmove  %eax,%ecx
movzbl %cl,%edi
call   1080 <assert@plt>
lea    0xd27(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %edi,%edi
call   1060 <strtok_r@plt>
test   %rax,%rax
je     139c <swh_geoc2d+0x22c>
mov    %rax,%rbx
mov    %ebp,0x14(%rsp)
lea    0xd06(%rip),%rsi
mov    %rax,%rdi
call   1050 <strspn@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %rax,%rbp
jne    139c <swh_geoc2d+0x22c>
mov    %rbx,%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
xor    %eax,%eax
test   %ebx,%ebx
sete   %al
xor    %ecx,%ecx
cmp    $0x3c,%ebx
setb   %cl
cmp    %r15d,%r12d
cmove  %eax,%ecx
movzbl %cl,%edi
call   1080 <assert@plt>
cvtsi2sd %r12d,%xmm0
cvtsi2sdl 0x14(%rsp),%xmm1
mulsd  0xc92(%rip),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xc87(%rip),%xmm0
addsd  %xmm1,%xmm0
cmpb   $0x0,0x18(%rsp)
je     1394 <swh_geoc2d+0x224>
xorpd  0xc7c(%rip),%xmm0
movsd  %xmm0,(%r14)
xor    %r13d,%r13d
mov    %r13d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
@.str.1 = [11 x i8] c"0123456789\00"
@.str.2 = [2 x i8] c"N\00"
@.str.3 = [2 x i8] c"E\00"
@.str.4 = [2 x i8] c"S\00"
@.str.5 = [2 x i8] c"W\00"
define i32 @swh_geoc2d(i8* %0, double* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca [12 x i8]
%13 = alloca i8*
store i8* %0, i8** %4
store double* %1, double** %5
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %12, i64 0, i64 0
%15 = load i8*, i8** %4
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %12, i64 0, i64 0
%18 = call i8* @strtok_r(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %13)
store i8* %18, i8** %11
%19 = load i8*, i8** %11
%20 = icmp eq i8* %19, null
br i1 %20, label %27, label %21
21: ; preds = %2
%22 = load i8*, i8** %11
%23 = call i64 @strspn(i8* %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%24 = load i8*, i8** %11
%25 = call i64 @strlen(i8* %24)
%26 = icmp ne i64 %23, %25
br i1 %26, label %27, label %28
27: ; preds = %21, %2
store i32 -1, i32* %3
br label %157
28: ; preds = %21
%29 = load i8*, i8** %11
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %6
br label %31
31: ; preds = %28
%32 = load i32, i32* %6
%33 = icmp sge i32 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %13)
store i8* %36, i8** %11
%37 = load i8*, i8** %11
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %40
39: ; preds = %31
store i32 -1, i32* %3
br label %157
40: ; preds = %31
%41 = load i8*, i8** %11
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %40
%45 = load i8*, i8** %11
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %44, %40
store i32 90, i32* %10
store i32 1, i32* %7
br label %60
49: ; preds = %44
%50 = load i8*, i8** %11
%51 = call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %57, label %53
53: ; preds = %49
%54 = load i8*, i8** %11
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %53, %49
store i32 180, i32* %10
store i32 0, i32* %7
br label %59
58: ; preds = %53
store i32 -1, i32* %3
br label %157
59: ; preds = %57
br label %60
60: ; preds = %59, %48
br label %61
61: ; preds = %60
%62 = load i32, i32* %6
%63 = load i32, i32* %10
%64 = icmp sle i32 %62, %63
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %13)
store i8* %67, i8** %11
%68 = load i8*, i8** %11
%69 = icmp eq i8* %68, null
br i1 %69, label %76, label %70
70: ; preds = %61
%71 = load i8*, i8** %11
%72 = call i64 @strspn(i8* %71, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%73 = load i8*, i8** %11
%74 = call i64 @strlen(i8* %73)
%75 = icmp ne i64 %72, %74
br i1 %75, label %76, label %77
76: ; preds = %70, %61
store i32 -1, i32* %3
br label %157
77: ; preds = %70
%78 = load i8*, i8** %11
%79 = call i32 @atoi(i8* %78)
store i32 %79, i32* %8
br label %80
80: ; preds = %77
%81 = load i32, i32* %6
%82 = load i32, i32* %10
%83 = icmp eq i32 %81, %82
br i1 %83, label %84, label %88
84: ; preds = %80
%85 = load i32, i32* %8
%86 = icmp eq i32 %85, 0
%87 = zext i1 %86 to i32
br label %97
88: ; preds = %80
%89 = load i32, i32* %8
%90 = icmp sge i32 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %88
%92 = load i32, i32* %8
%93 = icmp sle i32 %92, 59
br label %94
94: ; preds = %91, %88
%95 = phi i1 [ false, %88 ], [ %93, %91 ]
%96 = zext i1 %95 to i32
br label %97
97: ; preds = %94, %84
%98 = phi i32 [ %87, %84 ], [ %96, %94 ]
%99 = call i32 @assert(i32 %98)
%100 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %13)
store i8* %100, i8** %11
%101 = load i8*, i8** %11
%102 = icmp eq i8* %101, null
br i1 %102, label %109, label %103
103: ; preds = %97
%104 = load i8*, i8** %11
%105 = call i64 @strspn(i8* %104, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%106 = load i8*, i8** %11
%107 = call i64 @strlen(i8* %106)
%108 = icmp ne i64 %105, %107
br i1 %108, label %109, label %110
109: ; preds = %103, %97
store i32 -1, i32* %3
br label %157
110: ; preds = %103
%111 = load i8*, i8** %11
%112 = call i32 @atoi(i8* %111)
store i32 %112, i32* %9
br label %113
113: ; preds = %110
%114 = load i32, i32* %6
%115 = load i32, i32* %10
%116 = icmp eq i32 %114, %115
br i1 %116, label %117, label %121
117: ; preds = %113
%118 = load i32, i32* %9
%119 = icmp eq i32 %118, 0
%120 = zext i1 %119 to i32
br label %130
121: ; preds = %113
%122 = load i32, i32* %9
%123 = icmp sge i32 %122, 0
br i1 %123, label %124, label %127
124: ; preds = %121
%125 = load i32, i32* %9
%126 = icmp sle i32 %125, 59
br label %127
127: ; preds = %124, %121
%128 = phi i1 [ false, %121 ], [ %126, %124 ]
%129 = zext i1 %128 to i32
br label %130
130: ; preds = %127, %117
%131 = phi i32 [ %120, %117 ], [ %129, %127 ]
%132 = call i32 @assert(i32 %131)
%133 = load i32, i32* %7
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %144
135: ; preds = %130
%136 = load i32, i32* %6
%137 = sitofp i32 %136 to double
%138 = load i32, i32* %8
%139 = sitofp i32 %138 to double
%140 = call double @llvm.fmuladd.f64(double 0x3F91111111111111, double %139, double %137)
%141 = load i32, i32* %9
%142 = sitofp i32 %141 to double
%143 = call double @llvm.fmuladd.f64(double 0x3F323456789ABCDF, double %142, double %140)
br label %154
144: ; preds = %130
%145 = load i32, i32* %6
%146 = sitofp i32 %145 to double
%147 = load i32, i32* %8
%148 = sitofp i32 %147 to double
%149 = call double @llvm.fmuladd.f64(double 0x3F91111111111111, double %148, double %146)
%150 = load i32, i32* %9
%151 = sitofp i32 %150 to double
%152 = call double @llvm.fmuladd.f64(double 0x3F323456789ABCDF, double %151, double %149)
%153 = fneg double %152
br label %154
154: ; preds = %144, %135
%155 = phi double [ %143, %135 ], [ %153, %144 ]
%156 = load double*, double** %5
store double %155, double* %156
store i32 0, i32* %3
br label %157
157: ; preds = %154, %109, %76, %58, %39, %27
%158 = load i32, i32* %3
ret i32 %158
}

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
@.str.1 = [11 x i8] c"0123456789\00"
@.str.2 = [2 x i8] c"N\00"
@.str.3 = [2 x i8] c"E\00"
@.str.4 = [2 x i8] c"S\00"
@.str.5 = [2 x i8] c"W\00"
define i32 @swh_geoc2d(i8* %0, double* nocapture writeonly %1) {
%3 = alloca [12 x i8]
%4 = alloca i8*
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* %0)
%7 = bitcast i8** %4 to i8*
%8 = call i8* @strtok_r(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%9 = icmp eq i8* %8, null
br i1 %9, label %73, label %10
10: ; preds = %2
%11 = call i64 @strspn(i8* %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%12 = call i64 @strlen(i8* %8)
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %73
14: ; preds = %10
%15 = call i32 @atoi(i8* %8)
%16 = xor i32 %15, -1
%17 = lshr i32 %16, 31
%18 = call i32 @assert(i32 %17)
%19 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%20 = icmp eq i8* %19, null
br i1 %20, label %73, label %21
21: ; preds = %14
%22 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %33, label %24
24: ; preds = %21
%25 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %33, label %27
27: ; preds = %24
%28 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %73
33: ; preds = %27, %30, %21, %24
%34 = phi i1 [ false, %24 ], [ false, %21 ], [ true, %30 ], [ true, %27 ]
%35 = phi i32 [ 90, %24 ], [ 90, %21 ], [ 180, %30 ], [ 180, %27 ]
%36 = icmp sle i32 %15, %35
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%40 = icmp eq i8* %39, null
br i1 %40, label %73, label %41
41: ; preds = %33
%42 = call i64 @strspn(i8* %39, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%43 = call i64 @strlen(i8* %39)
%44 = icmp eq i64 %42, %43
br i1 %44, label %45, label %73
45: ; preds = %41
%46 = call i32 @atoi(i8* %39)
%47 = icmp eq i32 %15, %35
%48 = icmp eq i32 %46, 0
%49 = icmp ult i32 %46, 60
%50 = select i1 %47, i1 %48, i1 %49
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%54 = icmp eq i8* %53, null
br i1 %54, label %73, label %55
55: ; preds = %45
%56 = call i64 @strspn(i8* %53, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%57 = call i64 @strlen(i8* %53)
%58 = icmp eq i64 %56, %57
br i1 %58, label %59, label %73
59: ; preds = %55
%60 = call i32 @atoi(i8* %53)
%61 = icmp eq i32 %60, 0
%62 = icmp ult i32 %60, 60
%63 = select i1 %47, i1 %61, i1 %62
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = sitofp i32 %15 to double
%67 = sitofp i32 %46 to double
%68 = call double @llvm.fmuladd.f64(double %67, double 0x3F91111111111111, double %66)
%69 = sitofp i32 %60 to double
%70 = call double @llvm.fmuladd.f64(double %69, double 0x3F323456789ABCDF, double %68)
%71 = fneg double %70
%72 = select i1 %34, double %71, double %70
store double %72, double* %1
br label %73
73: ; preds = %45, %55, %33, %41, %30, %14, %2, %10, %59
%74 = phi i32 [ 0, %59 ], [ -1, %10 ], [ -1, %2 ], [ -1, %14 ], [ -1, %30 ], [ -1, %41 ], [ -1, %33 ], [ -1, %55 ], [ -1, %45 ]
ret i32 %74
}