void decode_psp_coordinates(double *lat, double *lon, const char lonbyte) {
  if ((lonbyte == 0x02) || (lonbyte == 0x06)) {
    if (*lon > 0.0)
      *lon *= -1.0;
  } else if ((lonbyte == 0x03) || (lonbyte == 0x07)) {
    if (*lon > 0.0)
      *lon -= 180.0;
  } else if ((lonbyte == 0x00) || (lonbyte == 0x04)) {
    if (*lon < 0.0)
      *lon *= -1.0;
  } else if ((lonbyte == 0x01) || (lonbyte == 0x05)) {
    if (*lon < 0.0)
      *lon += 180.0;
  }
}


x86 assembly (clang, -O0):
<decode_psp_coordinates>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x2,%eax
je     112b <decode_psp_coordinates+0x2b>
movsbl -0x11(%rbp),%eax
cmp    $0x6,%eax
jne    1159 <decode_psp_coordinates+0x59>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1154 <decode_psp_coordinates+0x54>
mov    -0x10(%rbp),%rax
movsd  0xebc(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    123c <decode_psp_coordinates+0x13c>
movsbl -0x11(%rbp),%eax
cmp    $0x3,%eax
je     1173 <decode_psp_coordinates+0x73>
movsbl -0x11(%rbp),%eax
cmp    $0x7,%eax
jne    11a5 <decode_psp_coordinates+0xa5>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11a0 <decode_psp_coordinates+0xa0>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe68(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
jmp    1237 <decode_psp_coordinates+0x137>
movsbl -0x11(%rbp),%eax
cmp    $0x0,%eax
je     11bf <decode_psp_coordinates+0xbf>
movsbl -0x11(%rbp),%eax
cmp    $0x4,%eax
jne    11e9 <decode_psp_coordinates+0xe9>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jbe    11e4 <decode_psp_coordinates+0xe4>
mov    -0x10(%rbp),%rax
movsd  0xe2c(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    1232 <decode_psp_coordinates+0x132>
movsbl -0x11(%rbp),%eax
cmp    $0x1,%eax
je     1203 <decode_psp_coordinates+0x103>
movsbl -0x11(%rbp),%eax
cmp    $0x5,%eax
jne    122d <decode_psp_coordinates+0x12d>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jbe    1228 <decode_psp_coordinates+0x128>
mov    -0x10(%rbp),%rax
movsd  0xde0(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    122d <decode_psp_coordinates+0x12d>
jmp    1232 <decode_psp_coordinates+0x132>
jmp    1237 <decode_psp_coordinates+0x137>
jmp    123c <decode_psp_coordinates+0x13c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_psp_coordinates>:
mov    %edx,%eax
and    $0xfb,%al
cmp    $0x3,%al
ja     112c <decode_psp_coordinates+0x2c>
and    $0xfb,%edx
lea    0xf0b(%rip),%rax
movslq (%rax,%rdx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movsd  (%rsi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     113b <decode_psp_coordinates+0x3b>
ret
movsd  (%rsi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    112c <decode_psp_coordinates+0x2c>
xorpd  0xecd(%rip),%xmm0
movsd  %xmm0,(%rsi)
ret
movsd  (%rsi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    112c <decode_psp_coordinates+0x2c>
addsd  0xeaa(%rip),%xmm0
movsd  %xmm0,(%rsi)
ret
movsd  (%rsi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    112c <decode_psp_coordinates+0x2c>
addsd  0xe87(%rip),%xmm0
movsd  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define void @decode_psp_coordinates(double* %0, double* %1, i8 signext %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i8
store double* %0, double** %4
store double* %1, double** %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 2
br i1 %9, label %14, label %10
10: ; preds = %3
%11 = load i8, i8* %6
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 6
br i1 %13, label %14, label %23
14: ; preds = %10, %3
%15 = load double*, double** %5
%16 = load double, double* %15
%17 = fcmp ogt double %16, 0.000000e+00
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load double*, double** %5
%20 = load double, double* %19
%21 = fmul double %20, -1.000000e+00
store double %21, double* %19
br label %22
22: ; preds = %18, %14
br label %77
23: ; preds = %10
%24 = load i8, i8* %6
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 3
br i1 %26, label %31, label %27
27: ; preds = %23
%28 = load i8, i8* %6
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 7
br i1 %30, label %31, label %40
31: ; preds = %27, %23
%32 = load double*, double** %5
%33 = load double, double* %32
%34 = fcmp ogt double %33, 0.000000e+00
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load double*, double** %5
%37 = load double, double* %36
%38 = fsub double %37, 1.800000e+02
store double %38, double* %36
br label %39
39: ; preds = %35, %31
br label %76
40: ; preds = %27
%41 = load i8, i8* %6
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %40
%45 = load i8, i8* %6
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 4
br i1 %47, label %48, label %57
48: ; preds = %44, %40
%49 = load double*, double** %5
%50 = load double, double* %49
%51 = fcmp olt double %50, 0.000000e+00
br i1 %51, label %52, label %56
52: ; preds = %48
%53 = load double*, double** %5
%54 = load double, double* %53
%55 = fmul double %54, -1.000000e+00
store double %55, double* %53
br label %56
56: ; preds = %52, %48
br label %75
57: ; preds = %44
%58 = load i8, i8* %6
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 1
br i1 %60, label %65, label %61
61: ; preds = %57
%62 = load i8, i8* %6
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 5
br i1 %64, label %65, label %74
65: ; preds = %61, %57
%66 = load double*, double** %5
%67 = load double, double* %66
%68 = fcmp olt double %67, 0.000000e+00
br i1 %68, label %69, label %73
69: ; preds = %65
%70 = load double*, double** %5
%71 = load double, double* %70
%72 = fadd double %71, 1.800000e+02
store double %72, double* %70
br label %73
73: ; preds = %69, %65
br label %74
74: ; preds = %73, %61
br label %75
75: ; preds = %74, %56
br label %76
76: ; preds = %75, %39
br label %77
77: ; preds = %76, %22
ret void
}

LLVM IR (-O2):
define void @decode_psp_coordinates(double* nocapture readnone %0, double* nocapture %1, i8 signext %2) {
%4 = and i8 %2, -5
switch i8 %4, label %27 [
i8 2, label %5
i8 3, label %10
i8 0, label %15
i8 1, label %20
]
5: ; preds = %3
%6 = load double, double* %1
%7 = fcmp ogt double %6, 0.000000e+00
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = fneg double %6
br label %25
10: ; preds = %3
%11 = load double, double* %1
%12 = fcmp ogt double %11, 0.000000e+00
br i1 %12, label %13, label %27
13: ; preds = %10
%14 = fadd double %11, -1.800000e+02
br label %25
15: ; preds = %3
%16 = load double, double* %1
%17 = fcmp olt double %16, 0.000000e+00
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = fneg double %16
br label %25
20: ; preds = %3
%21 = load double, double* %1
%22 = fcmp olt double %21, 0.000000e+00
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = fadd double %21, 1.800000e+02
br label %25
25: ; preds = %8, %18, %23, %13
%26 = phi double [ %14, %13 ], [ %24, %23 ], [ %19, %18 ], [ %9, %8 ]
store double %26, double* %1
br label %27
27: ; preds = %25, %3, %10, %20, %15, %5
ret void
}