int fs_sexa(char *out, double a, int w, int fracbase) {
  char *out0 = out;
  unsigned long n;
  int d;
  int f;
  int m;
  int s;
  int isneg;
  isneg = (a < 0);
  if (isneg)
    a = -a;
  n = (unsigned long)(a * fracbase + 0.5);
  d = n / fracbase;
  f = n % fracbase;
  if (isneg && d == 0)
    out += sprintf(out, "%*s-0", w - 2, "");
  else
    out += sprintf(out, "%*d", w, isneg ? -d : d);
  switch (fracbase) {
  case 60:
    m = f / (fracbase / 60);
    out += sprintf(out, ":%02d", m);
    break;
  case 600:
    out += sprintf(out, ":%02d.%1d", f / 10, f % 10);
    break;
  case 3600:
    m = f / (fracbase / 60);
    s = f % (fracbase / 60);
    out += sprintf(out, ":%02d:%02d", m, s);
    break;
  case 36000:
    m = f / (fracbase / 60);
    s = f % (fracbase / 60);
    out += sprintf(out, ":%02d:%02d.%1d", m, s / 10, s % 10);
    break;
  case 360000:
    m = f / (fracbase / 60);
    s = f % (fracbase / 60);
    out += sprintf(out, ":%02d:%02d.%02d", m, s / 100, s % 100);
    break;
  default:
    printf("fs_sexa: unknown fracbase: %d\n", fracbase);
    exit(1);
  }
  return (out - out0);
}


x86 assembly (clang, -O0):
<fs_sexa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1190 <fs_sexa+0x60>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5a(%rip),%xmm1
addsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
movsd  0xe47(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %edx,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     123e <fs_sexa+0x10e>
cmpl   $0x0,-0x2c(%rbp)
jne    123e <fs_sexa+0x10e>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x2,%edx
lea    0xdf5(%rip),%rsi
lea    0xe40(%rip),%rcx
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1291 <fs_sexa+0x161>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1263 <fs_sexa+0x133>
xor    %eax,%eax
sub    -0x2c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
jmp    1269 <fs_sexa+0x139>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%edx
mov    -0x48(%rbp),%rdi
mov    -0x4c(%rbp),%ecx
lea    0xd9c(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x50(%rbp)
sub    $0x3c,%eax
je     12f1 <fs_sexa+0x1c1>
jmp    12a5 <fs_sexa+0x175>
mov    -0x50(%rbp),%eax
sub    $0x258,%eax
je     1337 <fs_sexa+0x207>
jmp    12b8 <fs_sexa+0x188>
mov    -0x50(%rbp),%eax
sub    $0xe10,%eax
je     137c <fs_sexa+0x24c>
jmp    12cb <fs_sexa+0x19b>
mov    -0x50(%rbp),%eax
sub    $0x8ca0,%eax
je     13e1 <fs_sexa+0x2b1>
jmp    12de <fs_sexa+0x1ae>
mov    -0x50(%rbp),%eax
sub    $0x57e40,%eax
je     1464 <fs_sexa+0x334>
jmp    14e7 <fs_sexa+0x3b7>
mov    -0x30(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x34(%rbp),%edx
lea    0xd04(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1502 <fs_sexa+0x3d2>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x58(%rbp)
mov    -0x30(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x58(%rbp),%edx
lea    0xcca(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1502 <fs_sexa+0x3d2>
mov    -0x30(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x60(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
lea    0xc55(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1502 <fs_sexa+0x3d2>
mov    -0x30(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x68(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x34(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
mov    $0xa,%esi
cltd
idiv   %esi
mov    %edx,%r8d
mov    -0x64(%rbp),%edx
lea    0xbdd(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1502 <fs_sexa+0x3d2>
mov    -0x30(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x78(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x34(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x38(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
mov    $0x64,%esi
cltd
idiv   %esi
mov    %edx,%r8d
mov    -0x70(%rbp),%edx
lea    0xb69(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1502 <fs_sexa+0x3d2>
mov    -0x18(%rbp),%esi
lea    0xb53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fs_sexa>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r14
movapd 0xeba(%rip),%xmm1
xorpd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm0,%xmm3
xorps  %xmm2,%xmm2
cvtsi2sd %edx,%xmm2
orpd   %xmm1,%xmm3
mulsd  %xmm3,%xmm2
addsd  0xe9a(%rip),%xmm2
cvttsd2si %xmm2,%rcx
mov    %rcx,%rdx
subsd  0xe92(%rip),%xmm2
sar    $0x3f,%rdx
cvttsd2si %xmm2,%rax
and    %rdx,%rax
or     %rcx,%rax
movslq %ebp,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     11ae <fs_sexa+0x7e>
xor    %edx,%edx
div    %rcx
mov    %rdx,%r15
jmp    11b5 <fs_sexa+0x85>
xor    %edx,%edx
div    %ebp
mov    %edx,%r15d
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    11e2 <fs_sexa+0xb2>
test   %eax,%eax
jne    11e2 <fs_sexa+0xb2>
add    $0xfffffffe,%ebx
lea    0xe53(%rip),%rsi
lea    0xe9e(%rip),%rcx
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1200 <fs_sexa+0xd0>
mov    %eax,%ecx
neg    %ecx
ucomisd %xmm0,%xmm1
cmovbe %eax,%ecx
lea    0xe32(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
movslq %eax,%rbx
add    %r14,%rbx
cmp    $0xe0f,%ebp
jle    127c <fs_sexa+0x14c>
cmp    $0xe10,%ebp
je     12ba <fs_sexa+0x18a>
cmp    $0x8ca0,%ebp
je     12f1 <fs_sexa+0x1c1>
cmp    $0x57e40,%ebp
jne    136b <fs_sexa+0x23b>
movslq %r15d,%rax
imul   $0x57619f1,%rax,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x27,%rdx
add    %ecx,%edx
imul   $0x1770,%edx,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0x147b,%ecx,%ecx
mov    %ecx,%esi
shr    $0x1f,%esi
sar    $0x13,%ecx
add    %esi,%ecx
imul   $0x64,%ecx,%esi
sub    %esi,%eax
movswl %ax,%r8d
lea    0xdd0(%rip),%rsi
mov    %rbx,%rdi
jmp    133c <fs_sexa+0x20c>
cmp    $0x3c,%ebp
je     1345 <fs_sexa+0x215>
cmp    $0x258,%ebp
jne    136b <fs_sexa+0x23b>
movslq %r15d,%rax
imul   $0x66666667,%rax,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x22,%rdx
add    %eax,%edx
lea    (%rdx,%rdx,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r15d
lea    0xd82(%rip),%rsi
jmp    12e2 <fs_sexa+0x1b2>
movslq %r15d,%rax
imul   $0xffffffff88888889,%rax,%rdx
shr    $0x20,%rdx
add    %r15d,%edx
mov    %edx,%eax
shr    $0x1f,%eax
sar    $0x5,%edx
add    %eax,%edx
imul   $0x3c,%edx,%eax
sub    %eax,%r15d
lea    0xd48(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1359 <fs_sexa+0x229>
movslq %r15d,%rax
imul   $0x1b4e81b5,%rax,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x26,%rdx
add    %eax,%edx
imul   $0x258,%edx,%eax
sub    %eax,%r15d
movswl %r15w,%eax
imul   $0x6667,%eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x12,%ecx
add    %eax,%ecx
lea    (%rcx,%rcx,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r15d
movswl %r15w,%r8d
lea    0xcfc(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1359 <fs_sexa+0x229>
lea    0xce3(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
add    %eax,%ebx
sub    %r14d,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xce2(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%*s-0\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [4 x i8] c"%*d\00"
@.str.3 = [6 x i8] c":%02d\00"
@.str.4 = [10 x i8] c":%02d.%1d\00"
@.str.5 = [11 x i8] c":%02d:%02d\00"
@.str.6 = [15 x i8] c":%02d:%02d.%1d\00"
@.str.7 = [16 x i8] c":%02d:%02d.%02d\00"
@.str.8 = [31 x i8] c"fs_sexa: unknown fracbase: %d\0A\00"
define i32 @fs_sexa(i8* %0, double %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i8* %0, i8** %5
store double %1, double* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%16 = load i8*, i8** %5
store i8* %16, i8** %9
%17 = load double, double* %6
%18 = fcmp olt double %17, 0.000000e+00
%19 = zext i1 %18 to i32
store i32 %19, i32* %15
%20 = load i32, i32* %15
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %4
%23 = load double, double* %6
%24 = fneg double %23
store double %24, double* %6
br label %25
25: ; preds = %22, %4
%26 = load double, double* %6
%27 = load i32, i32* %8
%28 = sitofp i32 %27 to double
%29 = call double @llvm.fmuladd.f64(double %26, double %28, double 5.000000e-01)
%30 = fptoui double %29 to i64
store i64 %30, i64* %10
%31 = load i64, i64* %10
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = udiv i64 %31, %33
%35 = trunc i64 %34 to i32
store i32 %35, i32* %11
%36 = load i64, i64* %10
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = urem i64 %36, %38
%40 = trunc i64 %39 to i32
store i32 %40, i32* %12
%41 = load i32, i32* %15
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %54
43: ; preds = %25
%44 = load i32, i32* %11
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %54
46: ; preds = %43
%47 = load i8*, i8** %5
%48 = load i32, i32* %7
%49 = sub nsw i32 %48, 2
%50 = call i32 (i8*, i8*, ...) @sprintf(i8* %47, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %49, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%51 = load i8*, i8** %5
%52 = sext i32 %50 to i64
%53 = getelementptr inbounds i8, i8* %51, i64 %52
store i8* %53, i8** %5
br label %70
54: ; preds = %43, %25
%55 = load i8*, i8** %5
%56 = load i32, i32* %7
%57 = load i32, i32* %15
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %54
%60 = load i32, i32* %11
%61 = sub nsw i32 0, %60
br label %64
62: ; preds = %54
%63 = load i32, i32* %11
br label %64
64: ; preds = %62, %59
%65 = phi i32 [ %61, %59 ], [ %63, %62 ]
%66 = call i32 (i8*, i8*, ...) @sprintf(i8* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %56, i32 %65)
%67 = load i8*, i8** %5
%68 = sext i32 %66 to i64
%69 = getelementptr inbounds i8, i8* %67, i64 %68
store i8* %69, i8** %5
br label %70
70: ; preds = %64, %46
%71 = load i32, i32* %8
switch i32 %71, label %147 [
i32 60, label %72
i32 600, label %83
i32 3600, label %93
i32 36000, label %109
i32 360000, label %128
]
72: ; preds = %70
%73 = load i32, i32* %12
%74 = load i32, i32* %8
%75 = sdiv i32 %74, 60
%76 = sdiv i32 %73, %75
store i32 %76, i32* %13
%77 = load i8*, i8** %5
%78 = load i32, i32* %13
%79 = call i32 (i8*, i8*, ...) @sprintf(i8* %77, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %78)
%80 = load i8*, i8** %5
%81 = sext i32 %79 to i64
%82 = getelementptr inbounds i8, i8* %80, i64 %81
store i8* %82, i8** %5
br label %150
83: ; preds = %70
%84 = load i8*, i8** %5
%85 = load i32, i32* %12
%86 = sdiv i32 %85, 10
%87 = load i32, i32* %12
%88 = srem i32 %87, 10
%89 = call i32 (i8*, i8*, ...) @sprintf(i8* %84, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %86, i32 %88)
%90 = load i8*, i8** %5
%91 = sext i32 %89 to i64
%92 = getelementptr inbounds i8, i8* %90, i64 %91
store i8* %92, i8** %5
br label %150
93: ; preds = %70
%94 = load i32, i32* %12
%95 = load i32, i32* %8
%96 = sdiv i32 %95, 60
%97 = sdiv i32 %94, %96
store i32 %97, i32* %13
%98 = load i32, i32* %12
%99 = load i32, i32* %8
%100 = sdiv i32 %99, 60
%101 = srem i32 %98, %100
store i32 %101, i32* %14
%102 = load i8*, i8** %5
%103 = load i32, i32* %13
%104 = load i32, i32* %14
%105 = call i32 (i8*, i8*, ...) @sprintf(i8* %102, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %103, i32 %104)
%106 = load i8*, i8** %5
%107 = sext i32 %105 to i64
%108 = getelementptr inbounds i8, i8* %106, i64 %107
store i8* %108, i8** %5
br label %150
109: ; preds = %70
%110 = load i32, i32* %12
%111 = load i32, i32* %8
%112 = sdiv i32 %111, 60
%113 = sdiv i32 %110, %112
store i32 %113, i32* %13
%114 = load i32, i32* %12
%115 = load i32, i32* %8
%116 = sdiv i32 %115, 60
%117 = srem i32 %114, %116
store i32 %117, i32* %14
%118 = load i8*, i8** %5
%119 = load i32, i32* %13
%120 = load i32, i32* %14
%121 = sdiv i32 %120, 10
%122 = load i32, i32* %14
%123 = srem i32 %122, 10
%124 = call i32 (i8*, i8*, ...) @sprintf(i8* %118, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %119, i32 %121, i32 %123)
%125 = load i8*, i8** %5
%126 = sext i32 %124 to i64
%127 = getelementptr inbounds i8, i8* %125, i64 %126
store i8* %127, i8** %5
br label %150
128: ; preds = %70
%129 = load i32, i32* %12
%130 = load i32, i32* %8
%131 = sdiv i32 %130, 60
%132 = sdiv i32 %129, %131
store i32 %132, i32* %13
%133 = load i32, i32* %12
%134 = load i32, i32* %8
%135 = sdiv i32 %134, 60
%136 = srem i32 %133, %135
store i32 %136, i32* %14
%137 = load i8*, i8** %5
%138 = load i32, i32* %13
%139 = load i32, i32* %14
%140 = sdiv i32 %139, 100
%141 = load i32, i32* %14
%142 = srem i32 %141, 100
%143 = call i32 (i8*, i8*, ...) @sprintf(i8* %137, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %138, i32 %140, i32 %142)
%144 = load i8*, i8** %5
%145 = sext i32 %143 to i64
%146 = getelementptr inbounds i8, i8* %144, i64 %145
store i8* %146, i8** %5
br label %150
147: ; preds = %70
%148 = load i32, i32* %8
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i32 %148)
unreachable
150: ; preds = %128, %109, %93, %83, %72
%151 = load i8*, i8** %5
%152 = load i8*, i8** %9
%153 = ptrtoint i8* %151 to i64
%154 = ptrtoint i8* %152 to i64
%155 = sub i64 %153, %154
%156 = trunc i64 %155 to i32
ret i32 %156
}

LLVM IR (-O2):
@.str = [6 x i8] c"%*s-0\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [4 x i8] c"%*d\00"
@.str.3 = [6 x i8] c":%02d\00"
@.str.4 = [10 x i8] c":%02d.%1d\00"
@.str.5 = [11 x i8] c":%02d:%02d\00"
@.str.6 = [15 x i8] c":%02d:%02d.%1d\00"
@.str.7 = [16 x i8] c":%02d:%02d.%02d\00"
@.str.8 = [31 x i8] c"fs_sexa: unknown fracbase: %d\0A\00"
define i32 @fs_sexa(i8* %0, double %1, i32 %2, i32 %3) {
%5 = fcmp olt double %1, 0.000000e+00
%6 = fneg double %1
%7 = select i1 %5, double %6, double %1
%8 = sitofp i32 %3 to double
%9 = tail call double @llvm.fmuladd.f64(double %7, double %8, double 5.000000e-01)
%10 = fptoui double %9 to i64
%11 = sext i32 %3 to i64
%12 = udiv i64 %10, %11
%13 = trunc i64 %12 to i32
%14 = urem i64 %10, %11
%15 = trunc i64 %14 to i32
%16 = icmp eq i32 %13, 0
%17 = select i1 %5, i1 %16, i1 false
br i1 %17, label %18, label %21
18: ; preds = %4
%19 = add nsw i32 %2, -2
%20 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %19, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %25
21: ; preds = %4
%22 = sub nsw i32 0, %13
%23 = select i1 %5, i32 %22, i32 %13
%24 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %2, i32 %23)
br label %25
25: ; preds = %21, %18
%26 = phi i32 [ %20, %18 ], [ %24, %21 ]
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %0, i64 %27
switch i32 %3, label %57 [
i32 60, label %29
i32 600, label %31
i32 3600, label %35
i32 36000, label %39
i32 360000, label %48
]
29: ; preds = %25
%30 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %28, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %59
31: ; preds = %25
%32 = sdiv i32 %15, 10
%33 = srem i32 %15, 10
%34 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %28, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %32, i32 %33)
br label %59
35: ; preds = %25
%36 = sdiv i32 %15, 60
%37 = srem i32 %15, 60
%38 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %28, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %36, i32 %37)
br label %59
39: ; preds = %25
%40 = sdiv i32 %15, 600
%41 = srem i32 %15, 600
%42 = trunc i32 %41 to i16
%43 = sdiv i16 %42, 10
%44 = sext i16 %43 to i32
%45 = srem i16 %42, 10
%46 = sext i16 %45 to i32
%47 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %28, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %40, i32 %44, i32 %46)
br label %59
48: ; preds = %25
%49 = sdiv i32 %15, 6000
%50 = srem i32 %15, 6000
%51 = trunc i32 %50 to i16
%52 = sdiv i16 %51, 100
%53 = sext i16 %52 to i32
%54 = srem i16 %51, 100
%55 = sext i16 %54 to i32
%56 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %28, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %49, i32 %53, i32 %55)
br label %59
57: ; preds = %25
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i32 %3)
tail call void @exit(i32 1)
unreachable
59: ; preds = %48, %39, %35, %31, %29
%60 = phi i32 [ %56, %48 ], [ %47, %39 ], [ %38, %35 ], [ %34, %31 ], [ %30, %29 ]
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %28, i64 %61
%63 = ptrtoint i8* %62 to i64
%64 = ptrtoint i8* %0 to i64
%65 = sub i64 %63, %64
%66 = trunc i64 %65 to i32
ret i32 %66
}