#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 sscanf(char *, char *, int *, double *, char *);
void cc_parse_pos(double *target, char *source) {
  int deg;
  double min;
  char dir;
  double r;
  if (sscanf(source, "%d°%lf'%c", &deg, &min, &dir) != 3) {
    *target = 0;
    return;
  }
  r = deg + min / 60.0;
  if (dir == 'S' || dir == 'W')
    r = -r;
  *target = r;
}


x86 assembly (clang, -O0):
<cc_parse_pos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xedd(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x21(%rbp),%r8
call   1030 <sscanf@plt>
cmp    $0x3,%eax
je     1155 <cc_parse_pos+0x45>
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    11bc <cc_parse_pos+0xac>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe99(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x53,%eax
je     118e <cc_parse_pos+0x7e>
movsbl -0x21(%rbp),%eax
cmp    $0x57,%eax
jne    11af <cc_parse_pos+0x9f>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cc_parse_pos>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
lea    0xefe(%rip),%rsi
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x3(%rsp),%r8
mov    %rax,%rdi
call   1030 <sscanf@plt>
xorpd  %xmm0,%xmm0
cmp    $0x3,%eax
jne    116c <cc_parse_pos+0x5c>
cvtsi2sdl 0x4(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
divsd  0xeaa(%rip),%xmm0
addsd  %xmm1,%xmm0
mov    0x3(%rsp),%al
and    $0xfb,%al
cmp    $0x53,%al
jne    116c <cc_parse_pos+0x5c>
xorpd  0xea4(%rip),%xmm0
movsd  %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%d\C2\B0%lf'%c\00"
define void @cc_parse_pos(double* %0, i8* %1) {
%3 = alloca double*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca double
%7 = alloca i8
%8 = alloca double
store double* %0, double** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %4
%10 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %5, double* %6, i8* %7)
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load double*, double** %3
store double 0.000000e+00, double* %13
br label %33
14: ; preds = %2
%15 = load i32, i32* %5
%16 = sitofp i32 %15 to double
%17 = load double, double* %6
%18 = fdiv double %17, 6.000000e+01
%19 = fadd double %16, %18
store double %19, double* %8
%20 = load i8, i8* %7
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 83
br i1 %22, label %27, label %23
23: ; preds = %14
%24 = load i8, i8* %7
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 87
br i1 %26, label %27, label %30
27: ; preds = %23, %14
%28 = load double, double* %8
%29 = fneg double %28
store double %29, double* %8
br label %30
30: ; preds = %27, %23
%31 = load double, double* %8
%32 = load double*, double** %3
store double %31, double* %32
br label %33
33: ; preds = %30, %12
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%d\C2\B0%lf'%c\00"
define void @cc_parse_pos(double* nocapture writeonly %0, i8* nocapture %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca i8
%6 = bitcast i32* %3 to i8*
%7 = bitcast double* %4 to i8*
%8 = call i32 @sscanf(i8* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %3, double* %4, i8* %5)
%9 = icmp eq i32 %8, 3
br i1 %9, label %10, label %21
10: ; preds = %2
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to double
%13 = load double, double* %4
%14 = fdiv double %13, 6.000000e+01
%15 = fadd double %14, %12
%16 = load i8, i8* %5
%17 = and i8 %16, -5
%18 = icmp eq i8 %17, 83
%19 = fneg double %15
%20 = select i1 %18, double %19, double %15
br label %21
21: ; preds = %2, %10
%22 = phi double [ %20, %10 ], [ 0.000000e+00, %2 ]
store double %22, double* %0
ret void
}