char *SFMLatitudeToString(double dms_y) {
  double m, s;
  static char str[256];
  if (dms_y < 0.0) {
    dms_y = fabs(dms_y);
    m = (dms_y - floor(dms_y)) * 60.0;
    s = floor((m - floor(m)) * 60.0);
    m = floor(m);
    sprintf(str, "%.0f'%s%.0f:%s%.0fS", floor(dms_y), (m < 10.0f) ? "0" : "", m,
            (s < 10.0f) ? "0" : "", s);
  } else {
    m = (dms_y - floor(dms_y)) * 60.0;
    s = floor((m - floor(m)) * 60.0);
    m = floor(m);
    sprintf(str, "%.0f'%s%.0f:%s%.0fN", floor(dms_y), (m < 10.0f) ? "0" : "", m,
            (s < 10.0f) ? "0" : "", s);
  }
  return (str);
}


x86 assembly (clang, -O0):
<SFMLatitudeToString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    123a <SFMLatitudeToString+0x11a>
movsd  -0x8(%rbp),%xmm0
movaps 0xec9(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xe90(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xe5f(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <floor@plt>
movsd  -0x10(%rbp),%xmm2
movsd  0xe23(%rip),%xmm1
lea    0xe51(%rip),%rdx
lea    0xe49(%rip),%rax
ucomisd %xmm2,%xmm1
cmova  %rax,%rdx
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm3
movsd  0xdfb(%rip),%xmm2
lea    0xe29(%rip),%rcx
lea    0xe21(%rip),%rax
ucomisd %xmm3,%xmm2
cmova  %rax,%rcx
movsd  -0x18(%rbp),%xmm2
lea    0x2e19(%rip),%rdi
lea    0xdf2(%rip),%rsi
mov    $0x3,%al
call   1030 <sprintf@plt>
jmp    131f <SFMLatitudeToString+0x1ff>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xda6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xd75(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <floor@plt>
movsd  -0x10(%rbp),%xmm2
movsd  0xd39(%rip),%xmm1
lea    0xd67(%rip),%rdx
lea    0xd5f(%rip),%rax
ucomisd %xmm2,%xmm1
cmova  %rax,%rdx
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm3
movsd  0xd11(%rip),%xmm2
lea    0xd3f(%rip),%rcx
lea    0xd37(%rip),%rax
ucomisd %xmm3,%xmm2
cmova  %rax,%rcx
movsd  -0x18(%rbp),%xmm2
lea    0x2d2f(%rip),%rdi
lea    0xd1e(%rip),%rsi
mov    $0x3,%al
call   1030 <sprintf@plt>
lea    0x2d1a(%rip),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SFMLatitudeToString>:
sub    $0x28,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    11cf <SFMLatitudeToString+0xaf>
andpd  0xed6(%rip),%xmm0
movapd %xmm0,(%rsp)
call   1040 <floor@plt>
movsd  %xmm0,0x20(%rsp)
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xea5(%rip),%xmm1
movapd %xmm1,(%rsp)
movapd %xmm1,%xmm0
call   1040 <floor@plt>
movsd  %xmm0,0x18(%rsp)
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe80(%rip),%xmm1
movapd %xmm1,%xmm0
call   1040 <floor@plt>
movsd  0xe77(%rip),%xmm3
movsd  0x18(%rsp),%xmm1
ucomisd %xmm1,%xmm3
lea    0xe92(%rip),%rax
lea    0xe8c(%rip),%rcx
mov    %rcx,%rdx
cmova  %rax,%rdx
movapd %xmm0,%xmm2
ucomisd %xmm0,%xmm3
cmova  %rax,%rcx
lea    0x2e7d(%rip),%rdi
lea    0xe56(%rip),%rsi
jmp    125f <SFMLatitudeToString+0x13f>
movapd %xmm0,(%rsp)
call   1040 <floor@plt>
movsd  %xmm0,0x20(%rsp)
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe10(%rip),%xmm1
movapd %xmm1,(%rsp)
movapd %xmm1,%xmm0
call   1040 <floor@plt>
movsd  %xmm0,0x18(%rsp)
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xdeb(%rip),%xmm1
movapd %xmm1,%xmm0
call   1040 <floor@plt>
movsd  0xde2(%rip),%xmm3
movsd  0x18(%rsp),%xmm1
ucomisd %xmm1,%xmm3
lea    0xdfd(%rip),%rax
lea    0xdf7(%rip),%rcx
mov    %rcx,%rdx
cmova  %rax,%rdx
movapd %xmm0,%xmm2
ucomisd %xmm0,%xmm3
cmova  %rax,%rcx
lea    0x2de8(%rip),%rdi
lea    0xdd7(%rip),%rsi
movsd  0x20(%rsp),%xmm0
mov    $0x3,%al
call   1030 <sprintf@plt>
lea    0x2dcd(%rip),%rax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@SFMLatitudeToString.str = internal global [256 x i8] zeroinitializer
@.str = [20 x i8] c"%.0f'%s%.0f:%s%.0fS\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [20 x i8] c"%.0f'%s%.0f:%s%.0fN\00"
define i8* @SFMLatitudeToString(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %36
7: ; preds = %1
%8 = load double, double* %2
%9 = call double @llvm.fabs.f64(double %8)
store double %9, double* %2
%10 = load double, double* %2
%11 = load double, double* %2
%12 = call double @llvm.floor.f64(double %11)
%13 = fsub double %10, %12
%14 = fmul double %13, 6.000000e+01
store double %14, double* %3
%15 = load double, double* %3
%16 = load double, double* %3
%17 = call double @llvm.floor.f64(double %16)
%18 = fsub double %15, %17
%19 = fmul double %18, 6.000000e+01
%20 = call double @llvm.floor.f64(double %19)
store double %20, double* %4
%21 = load double, double* %3
%22 = call double @llvm.floor.f64(double %21)
store double %22, double* %3
%23 = load double, double* %2
%24 = call double @llvm.floor.f64(double %23)
%25 = load double, double* %3
%26 = fcmp olt double %25, 1.000000e+01
%27 = zext i1 %26 to i64
%28 = select i1 %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%29 = load double, double* %3
%30 = load double, double* %4
%31 = fcmp olt double %30, 1.000000e+01
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%34 = load double, double* %4
%35 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @SFMLatitudeToString.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %24, i8* %28, double %29, i8* %33, double %34)
br label %63
36: ; preds = %1
%37 = load double, double* %2
%38 = load double, double* %2
%39 = call double @llvm.floor.f64(double %38)
%40 = fsub double %37, %39
%41 = fmul double %40, 6.000000e+01
store double %41, double* %3
%42 = load double, double* %3
%43 = load double, double* %3
%44 = call double @llvm.floor.f64(double %43)
%45 = fsub double %42, %44
%46 = fmul double %45, 6.000000e+01
%47 = call double @llvm.floor.f64(double %46)
store double %47, double* %4
%48 = load double, double* %3
%49 = call double @llvm.floor.f64(double %48)
store double %49, double* %3
%50 = load double, double* %2
%51 = call double @llvm.floor.f64(double %50)
%52 = load double, double* %3
%53 = fcmp olt double %52, 1.000000e+01
%54 = zext i1 %53 to i64
%55 = select i1 %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%56 = load double, double* %3
%57 = load double, double* %4
%58 = fcmp olt double %57, 1.000000e+01
%59 = zext i1 %58 to i64
%60 = select i1 %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%61 = load double, double* %4
%62 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @SFMLatitudeToString.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %51, i8* %55, double %56, i8* %60, double %61)
br label %63
63: ; preds = %36, %7
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @SFMLatitudeToString.str, i64 0, i64 0)
}

LLVM IR (-O2):
@SFMLatitudeToString.str = internal global [256 x i8] zeroinitializer
@.str = [20 x i8] c"%.0f'%s%.0f:%s%.0fS\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [20 x i8] c"%.0f'%s%.0f:%s%.0fN\00"
define i8* @SFMLatitudeToString(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
br i1 %2, label %3, label %17
3: ; preds = %1
%4 = tail call double @llvm.fabs.f64(double %0)
%5 = tail call double @llvm.floor.f64(double %4)
%6 = fsub double %4, %5
%7 = fmul double %6, 6.000000e+01
%8 = tail call double @llvm.floor.f64(double %7)
%9 = fsub double %7, %8
%10 = fmul double %9, 6.000000e+01
%11 = tail call double @llvm.floor.f64(double %10)
%12 = fcmp olt double %8, 1.000000e+01
%13 = select i1 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%14 = fcmp olt double %11, 1.000000e+01
%15 = select i1 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%16 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @SFMLatitudeToString.str, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %5, i8* %13, double %8, i8* %15, double %11)
br label %30
17: ; preds = %1
%18 = tail call double @llvm.floor.f64(double %0)
%19 = fsub double %0, %18
%20 = fmul double %19, 6.000000e+01
%21 = tail call double @llvm.floor.f64(double %20)
%22 = fsub double %20, %21
%23 = fmul double %22, 6.000000e+01
%24 = tail call double @llvm.floor.f64(double %23)
%25 = fcmp olt double %21, 1.000000e+01
%26 = select i1 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%27 = fcmp olt double %24, 1.000000e+01
%28 = select i1 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%29 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @SFMLatitudeToString.str, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %18, i8* %26, double %21, i8* %28, double %24)
br label %30
30: ; preds = %17, %3
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @SFMLatitudeToString.str, i64 0, i64 0)
}