void ra2str(string, lstr, ra, ndec) char *string;
int lstr;
double ra;
int ndec;
{
  double a, b;
  double seconds;
  char tstring[64];
  int hours;
  int minutes;
  int isec, ltstr;
  double dsgn;
  if (ra < 0.0) {
    ra = -ra;
    dsgn = -1.0;
  } else
    dsgn = 1.0;
  ra = fmod(ra, 360.0);
  ra *= dsgn;
  if (ra < 0.0)
    ra = ra + 360.0;
  a = ra / 15.0;
  hours = (int)a;
  b = (a - (double)hours) * 60.0;
  minutes = (int)b;
  seconds = (b - (double)minutes) * 60.0;
  if (ndec > 5) {
    if (seconds > 59.999999) {
      seconds = 0.0;
      minutes = minutes + 1;
    }
    if (minutes > 59) {
      minutes = 0;
      hours = hours + 1;
    }
    hours = hours % 24;
    (void)sprintf(tstring, "%02d:%02d:%09.6f", hours, minutes, seconds);
  } else if (ndec > 4) {
    if (seconds > 59.99999) {
      seconds = 0.0;
      minutes = minutes + 1;
    }
    if (minutes > 59) {
      minutes = 0;
      hours = hours + 1;
    }
    hours = hours % 24;
    (void)sprintf(tstring, "%02d:%02d:%08.5f", hours, minutes, seconds);
  } else if (ndec > 3) {
    if (seconds > 59.9999) {
      seconds = 0.0;
      minutes = minutes + 1;
    }
    if (minutes > 59) {
      minutes = 0;
      hours = hours + 1;
    }
    hours = hours % 24;
    (void)sprintf(tstring, "%02d:%02d:%07.4f", hours, minutes, seconds);
  } else if (ndec > 2) {
    if (seconds > 59.999) {
      seconds = 0.0;
      minutes = minutes + 1;
    }
    if (minutes > 59) {
      minutes = 0;
      hours = hours + 1;
    }
    hours = hours % 24;
    (void)sprintf(tstring, "%02d:%02d:%06.3f", hours, minutes, seconds);
  } else if (ndec > 1) {
    if (seconds > 59.99) {
      seconds = 0.0;
      minutes = minutes + 1;
    }
    if (minutes > 59) {
      minutes = 0;
      hours = hours + 1;
    }
    hours = hours % 24;
    (void)sprintf(tstring, "%02d:%02d:%05.2f", hours, minutes, seconds);
  } else if (ndec > 0) {
    if (seconds > 59.9) {
      seconds = 0.0;
      minutes = minutes + 1;
    }
    if (minutes > 59) {
      minutes = 0;
      hours = hours + 1;
    }
    hours = hours % 24;
    (void)sprintf(tstring, "%02d:%02d:%04.1f", hours, minutes, seconds);
  } else {
    isec = (int)(seconds + 0.5);
    if (isec > 59) {
      isec = 0;
      minutes = minutes + 1;
    }
    if (minutes > 59) {
      minutes = 0;
      hours = hours + 1;
    }
    hours = hours % 24;
    (void)sprintf(tstring, "%02d:%02d:%02d", hours, minutes, isec);
  }
  ltstr = (int)strlen(tstring);
  if (ltstr < lstr - 1)
    strcpy(string, tstring);
  else {
    strncpy(string, tstring, lstr - 1);
    string[lstr - 1] = 0;
  }
  return;
}


x86 assembly (clang, -O0):
<ra2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11ae <ra2str+0x5e>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe67(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    11be <ra2str+0x6e>
movsd  0xe4a(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  0xe45(%rip),%xmm1
call   1060 <fmod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1207 <ra2str+0xb7>
movsd  0xe13(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe0c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
cvttsd2si -0x28(%rbp),%eax
mov    %eax,-0x84(%rbp)
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x84(%rbp),%xmm1
ff
subsd  %xmm1,%xmm0
movsd  0xdd7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cvttsd2si -0x30(%rbp),%eax
mov    %eax,-0x88(%rbp)
movsd  -0x30(%rbp),%xmm0
cvtsi2sdl -0x88(%rbp),%xmm1
ff
subsd  %xmm1,%xmm0
movsd  0xdaa(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jle    1311 <ra2str+0x1c1>
movsd  -0x38(%rbp),%xmm0
movsd  0xdca(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12af <ra2str+0x15f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    12d5 <ra2str+0x185>
movl   $0x0,-0x88(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%edx
mov    -0x88(%rbp),%ecx
movsd  -0x38(%rbp),%xmm0
lea    0xd5b(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16c8 <ra2str+0x578>
cmpl   $0x4,-0x1c(%rbp)
jle    13ab <ra2str+0x25b>
movsd  -0x38(%rbp),%xmm0
movsd  0xd28(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1349 <ra2str+0x1f9>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    136f <ra2str+0x21f>
movl   $0x0,-0x88(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%edx
mov    -0x88(%rbp),%ecx
movsd  -0x38(%rbp),%xmm0
lea    0xcd2(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16c3 <ra2str+0x573>
cmpl   $0x3,-0x1c(%rbp)
jle    1445 <ra2str+0x2f5>
movsd  -0x38(%rbp),%xmm0
movsd  0xc86(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13e3 <ra2str+0x293>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    1409 <ra2str+0x2b9>
movl   $0x0,-0x88(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%edx
mov    -0x88(%rbp),%ecx
movsd  -0x38(%rbp),%xmm0
lea    0xc49(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16be <ra2str+0x56e>
cmpl   $0x2,-0x1c(%rbp)
jle    14df <ra2str+0x38f>
movsd  -0x38(%rbp),%xmm0
movsd  0xbe4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    147d <ra2str+0x32d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    14a3 <ra2str+0x353>
movl   $0x0,-0x88(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%edx
mov    -0x88(%rbp),%ecx
movsd  -0x38(%rbp),%xmm0
lea    0xbc0(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16b9 <ra2str+0x569>
cmpl   $0x1,-0x1c(%rbp)
jle    1579 <ra2str+0x429>
movsd  -0x38(%rbp),%xmm0
movsd  0xb42(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1517 <ra2str+0x3c7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    153d <ra2str+0x3ed>
movl   $0x0,-0x88(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%edx
mov    -0x88(%rbp),%ecx
movsd  -0x38(%rbp),%xmm0
lea    0xb37(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16b4 <ra2str+0x564>
cmpl   $0x0,-0x1c(%rbp)
jle    1613 <ra2str+0x4c3>
movsd  -0x38(%rbp),%xmm0
movsd  0xaa0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15b1 <ra2str+0x461>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    15d7 <ra2str+0x487>
movl   $0x0,-0x88(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%edx
mov    -0x88(%rbp),%ecx
movsd  -0x38(%rbp),%xmm0
lea    0xaae(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16af <ra2str+0x55f>
movsd  0xa0d(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8c(%rbp)
cmpl   $0x3b,-0x8c(%rbp)
jle    1650 <ra2str+0x500>
movl   $0x0,-0x8c(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    1676 <ra2str+0x526>
movl   $0x0,-0x88(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%edx
mov    -0x88(%rbp),%ecx
mov    -0x8c(%rbp),%r8d
lea    0xa1e(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
jmp    16b4 <ra2str+0x564>
jmp    16b9 <ra2str+0x569>
jmp    16be <ra2str+0x56e>
jmp    16c3 <ra2str+0x573>
jmp    16c8 <ra2str+0x578>
lea    -0x80(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x90(%rbp)
mov    -0x90(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    16fd <ra2str+0x5ad>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    1724 <ra2str+0x5d4>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rdx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ra2str>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %edx,%ebp
movapd %xmm0,%xmm3
movapd %xmm0,0x40(%rsp)
mov    %esi,%r14d
mov    %rdi,%rbx
movapd %xmm0,%xmm1
xorpd  0xe8a(%rip),%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm2,%xmm0
andpd  %xmm0,%xmm1
andnpd %xmm3,%xmm0
orpd   %xmm1,%xmm0
movsd  0xe7d(%rip),%xmm1
call   1060 <fmod@plt>
xorpd  %xmm2,%xmm2
ucomisd 0x40(%rsp),%xmm2
jbe    11ac <ra2str+0x5c>
xorpd  0xe54(%rip),%xmm0
movsd  0xe5c(%rip),%xmm3
addsd  %xmm0,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm2,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm0,%xmm1
orpd   %xmm3,%xmm1
divsd  0xe43(%rip),%xmm1
cvttsd2si %xmm1,%eax
cvttpd2dq %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm0
subsd  %xmm0,%xmm1
movsd  0xe33(%rip),%xmm0
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edx
cvttpd2dq %xmm1,%xmm2
cvtdq2pd %xmm2,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
cmp    $0x6,%ebp
jl     1260 <ra2str+0x110>
xor    %esi,%esi
ucomisd 0xe44(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     1221 <ra2str+0xd1>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
setge  %dl
cmovl  %esi,%ecx
add    %eax,%edx
movslq %edx,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rax
add    %esi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
lea    0xe05(%rip),%rsi
jmp    1423 <ra2str+0x2d3>
cmp    $0x5,%ebp
jne    12bb <ra2str+0x16b>
xor    %esi,%esi
ucomisd 0xde1(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     127c <ra2str+0x12c>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
setge  %dl
cmovl  %esi,%ecx
add    %eax,%edx
movslq %edx,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rax
add    %esi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
lea    0xdbb(%rip),%rsi
jmp    1423 <ra2str+0x2d3>
cmp    $0x4,%ebp
jl     1316 <ra2str+0x1c6>
xor    %esi,%esi
ucomisd 0xd7e(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     12d7 <ra2str+0x187>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
setge  %dl
cmovl  %esi,%ecx
add    %eax,%edx
movslq %edx,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rax
add    %esi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
lea    0xd71(%rip),%rsi
jmp    1423 <ra2str+0x2d3>
cmp    $0x3,%ebp
jne    1371 <ra2str+0x221>
xor    %esi,%esi
ucomisd 0xd1b(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     1332 <ra2str+0x1e2>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
setge  %dl
cmovl  %esi,%ecx
add    %eax,%edx
movslq %edx,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rax
add    %esi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
lea    0xd27(%rip),%rsi
jmp    1423 <ra2str+0x2d3>
cmp    $0x2,%ebp
jl     13c9 <ra2str+0x279>
xor    %esi,%esi
ucomisd 0xcb8(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     138d <ra2str+0x23d>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
setge  %dl
cmovl  %esi,%ecx
add    %eax,%edx
movslq %edx,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rax
add    %esi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
lea    0xcdd(%rip),%rsi
jmp    1423 <ra2str+0x2d3>
cmp    $0x1,%ebp
jne    1465 <ra2str+0x315>
xor    %esi,%esi
ucomisd 0xc54(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     13e9 <ra2str+0x299>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
setge  %dl
cmovl  %esi,%ecx
add    %eax,%edx
movslq %edx,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rax
add    %esi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
lea    0xc92(%rip),%rsi
mov    %rsp,%rdi
mov    $0x1,%al
call   1070 <sprintf@plt>
mov    %rsp,%rdi
call   1050 <strlen@plt>
movslq %r14d,%rbp
add    $0xffffffffffffffff,%rbp
mov    %rsp,%rsi
cmp    %eax,%ebp
jle    144d <ra2str+0x2fd>
mov    %rbx,%rdi
call   1040 <strcpy@plt>
jmp    145c <ra2str+0x30c>
mov    %rbx,%rdi
mov    %rbp,%rdx
call   1030 <strncpy@plt>
movb   $0x0,(%rbx,%rbp,1)
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
addsd  0xbbb(%rip),%xmm1
cvttsd2si %xmm1,%r8d
xor    %esi,%esi
xor    %ecx,%ecx
cmp    $0x3c,%r8d
cmovge %esi,%r8d
setge  %cl
add    %edx,%ecx
xor    %edx,%edx
cmp    $0x3c,%ecx
setge  %dl
cmovge %esi,%ecx
add    %eax,%edx
movslq %edx,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rax
add    %esi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
lea    0xc10(%rip),%rsi
mov    %rsp,%rdi
xor    %eax,%eax
call   1070 <sprintf@plt>
jmp    142d <ra2str+0x2dd>

LLVM IR (-O0):
@.str = [17 x i8] c"%02d:%02d:%09.6f\00"
@.str.1 = [17 x i8] c"%02d:%02d:%08.5f\00"
@.str.2 = [17 x i8] c"%02d:%02d:%07.4f\00"
@.str.3 = [17 x i8] c"%02d:%02d:%06.3f\00"
@.str.4 = [17 x i8] c"%02d:%02d:%05.2f\00"
@.str.5 = [17 x i8] c"%02d:%02d:%04.1f\00"
@.str.6 = [15 x i8] c"%02d:%02d:%02d\00"
define void @ra2str(i8* %0, i32 %1, double %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca [64 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
store i8* %0, i8** %5
store i32 %1, i32* %6
store double %2, double* %7
store i32 %3, i32* %8
%18 = load double, double* %7
%19 = fcmp olt double %18, 0.000000e+00
br i1 %19, label %20, label %23
20: ; preds = %4
%21 = load double, double* %7
%22 = fneg double %21
store double %22, double* %7
store double -1.000000e+00, double* %17
br label %24
23: ; preds = %4
store double 1.000000e+00, double* %17
br label %24
24: ; preds = %23, %20
%25 = load double, double* %7
%26 = call double @fmod(double %25, double 3.600000e+02)
store double %26, double* %7
%27 = load double, double* %17
%28 = load double, double* %7
%29 = fmul double %28, %27
store double %29, double* %7
%30 = load double, double* %7
%31 = fcmp olt double %30, 0.000000e+00
br i1 %31, label %32, label %35
32: ; preds = %24
%33 = load double, double* %7
%34 = fadd double %33, 3.600000e+02
store double %34, double* %7
br label %35
35: ; preds = %32, %24
%36 = load double, double* %7
%37 = fdiv double %36, 1.500000e+01
store double %37, double* %9
%38 = load double, double* %9
%39 = fptosi double %38 to i32
store i32 %39, i32* %13
%40 = load double, double* %9
%41 = load i32, i32* %13
%42 = sitofp i32 %41 to double
%43 = fsub double %40, %42
%44 = fmul double %43, 6.000000e+01
store double %44, double* %10
%45 = load double, double* %10
%46 = fptosi double %45 to i32
store i32 %46, i32* %14
%47 = load double, double* %10
%48 = load i32, i32* %14
%49 = sitofp i32 %48 to double
%50 = fsub double %47, %49
%51 = fmul double %50, 6.000000e+01
store double %51, double* %11
%52 = load i32, i32* %8
%53 = icmp sgt i32 %52, 5
br i1 %53, label %54, label %74
54: ; preds = %35
%55 = load double, double* %11
%56 = fcmp ogt double %55, 0x404DFFFFF79C8430
br i1 %56, label %57, label %60
57: ; preds = %54
store double 0.000000e+00, double* %11
%58 = load i32, i32* %14
%59 = add nsw i32 %58, 1
store i32 %59, i32* %14
br label %60
60: ; preds = %57, %54
%61 = load i32, i32* %14
%62 = icmp sgt i32 %61, 59
br i1 %62, label %63, label %66
63: ; preds = %60
store i32 0, i32* %14
%64 = load i32, i32* %13
%65 = add nsw i32 %64, 1
store i32 %65, i32* %13
br label %66
66: ; preds = %63, %60
%67 = load i32, i32* %13
%68 = srem i32 %67, 24
store i32 %68, i32* %13
%69 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%70 = load i32, i32* %13
%71 = load i32, i32* %14
%72 = load double, double* %11
%73 = call i32 (i8*, i8*, ...) @sprintf(i8* %69, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %70, i32 %71, double %72)
br label %217
74: ; preds = %35
%75 = load i32, i32* %8
%76 = icmp sgt i32 %75, 4
br i1 %76, label %77, label %97
77: ; preds = %74
%78 = load double, double* %11
%79 = fcmp ogt double %78, 0x404DFFFFAC1D29DC
br i1 %79, label %80, label %83
80: ; preds = %77
store double 0.000000e+00, double* %11
%81 = load i32, i32* %14
%82 = add nsw i32 %81, 1
store i32 %82, i32* %14
br label %83
83: ; preds = %80, %77
%84 = load i32, i32* %14
%85 = icmp sgt i32 %84, 59
br i1 %85, label %86, label %89
86: ; preds = %83
store i32 0, i32* %14
%87 = load i32, i32* %13
%88 = add nsw i32 %87, 1
store i32 %88, i32* %13
br label %89
89: ; preds = %86, %83
%90 = load i32, i32* %13
%91 = srem i32 %90, 24
store i32 %91, i32* %13
%92 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%93 = load i32, i32* %13
%94 = load i32, i32* %14
%95 = load double, double* %11
%96 = call i32 (i8*, i8*, ...) @sprintf(i8* %92, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %93, i32 %94, double %95)
br label %216
97: ; preds = %74
%98 = load i32, i32* %8
%99 = icmp sgt i32 %98, 3
br i1 %99, label %100, label %120
100: ; preds = %97
%101 = load double, double* %11
%102 = fcmp ogt double %101, 5.999990e+01
br i1 %102, label %103, label %106
103: ; preds = %100
store double 0.000000e+00, double* %11
%104 = load i32, i32* %14
%105 = add nsw i32 %104, 1
store i32 %105, i32* %14
br label %106
106: ; preds = %103, %100
%107 = load i32, i32* %14
%108 = icmp sgt i32 %107, 59
br i1 %108, label %109, label %112
109: ; preds = %106
store i32 0, i32* %14
%110 = load i32, i32* %13
%111 = add nsw i32 %110, 1
store i32 %111, i32* %13
br label %112
112: ; preds = %109, %106
%113 = load i32, i32* %13
%114 = srem i32 %113, 24
store i32 %114, i32* %13
%115 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%116 = load i32, i32* %13
%117 = load i32, i32* %14
%118 = load double, double* %11
%119 = call i32 (i8*, i8*, ...) @sprintf(i8* %115, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %116, i32 %117, double %118)
br label %215
120: ; preds = %97
%121 = load i32, i32* %8
%122 = icmp sgt i32 %121, 2
br i1 %122, label %123, label %143
123: ; preds = %120
%124 = load double, double* %11
%125 = fcmp ogt double %124, 5.999900e+01
br i1 %125, label %126, label %129
126: ; preds = %123
store double 0.000000e+00, double* %11
%127 = load i32, i32* %14
%128 = add nsw i32 %127, 1
store i32 %128, i32* %14
br label %129
129: ; preds = %126, %123
%130 = load i32, i32* %14
%131 = icmp sgt i32 %130, 59
br i1 %131, label %132, label %135
132: ; preds = %129
store i32 0, i32* %14
%133 = load i32, i32* %13
%134 = add nsw i32 %133, 1
store i32 %134, i32* %13
br label %135
135: ; preds = %132, %129
%136 = load i32, i32* %13
%137 = srem i32 %136, 24
store i32 %137, i32* %13
%138 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%139 = load i32, i32* %13
%140 = load i32, i32* %14
%141 = load double, double* %11
%142 = call i32 (i8*, i8*, ...) @sprintf(i8* %138, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %139, i32 %140, double %141)
br label %214
143: ; preds = %120
%144 = load i32, i32* %8
%145 = icmp sgt i32 %144, 1
br i1 %145, label %146, label %166
146: ; preds = %143
%147 = load double, double* %11
%148 = fcmp ogt double %147, 5.999000e+01
br i1 %148, label %149, label %152
149: ; preds = %146
store double 0.000000e+00, double* %11
%150 = load i32, i32* %14
%151 = add nsw i32 %150, 1
store i32 %151, i32* %14
br label %152
152: ; preds = %149, %146
%153 = load i32, i32* %14
%154 = icmp sgt i32 %153, 59
br i1 %154, label %155, label %158
155: ; preds = %152
store i32 0, i32* %14
%156 = load i32, i32* %13
%157 = add nsw i32 %156, 1
store i32 %157, i32* %13
br label %158
158: ; preds = %155, %152
%159 = load i32, i32* %13
%160 = srem i32 %159, 24
store i32 %160, i32* %13
%161 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%162 = load i32, i32* %13
%163 = load i32, i32* %14
%164 = load double, double* %11
%165 = call i32 (i8*, i8*, ...) @sprintf(i8* %161, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %162, i32 %163, double %164)
br label %213
166: ; preds = %143
%167 = load i32, i32* %8
%168 = icmp sgt i32 %167, 0
br i1 %168, label %169, label %189
169: ; preds = %166
%170 = load double, double* %11
%171 = fcmp ogt double %170, 0x404DF33333333333
br i1 %171, label %172, label %175
172: ; preds = %169
store double 0.000000e+00, double* %11
%173 = load i32, i32* %14
%174 = add nsw i32 %173, 1
store i32 %174, i32* %14
br label %175
175: ; preds = %172, %169
%176 = load i32, i32* %14
%177 = icmp sgt i32 %176, 59
br i1 %177, label %178, label %181
178: ; preds = %175
store i32 0, i32* %14
%179 = load i32, i32* %13
%180 = add nsw i32 %179, 1
store i32 %180, i32* %13
br label %181
181: ; preds = %178, %175
%182 = load i32, i32* %13
%183 = srem i32 %182, 24
store i32 %183, i32* %13
%184 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%185 = load i32, i32* %13
%186 = load i32, i32* %14
%187 = load double, double* %11
%188 = call i32 (i8*, i8*, ...) @sprintf(i8* %184, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %185, i32 %186, double %187)
br label %212
189: ; preds = %166
%190 = load double, double* %11
%191 = fadd double %190, 5.000000e-01
%192 = fptosi double %191 to i32
store i32 %192, i32* %15
%193 = load i32, i32* %15
%194 = icmp sgt i32 %193, 59
br i1 %194, label %195, label %198
195: ; preds = %189
store i32 0, i32* %15
%196 = load i32, i32* %14
%197 = add nsw i32 %196, 1
store i32 %197, i32* %14
br label %198
198: ; preds = %195, %189
%199 = load i32, i32* %14
%200 = icmp sgt i32 %199, 59
br i1 %200, label %201, label %204
201: ; preds = %198
store i32 0, i32* %14
%202 = load i32, i32* %13
%203 = add nsw i32 %202, 1
store i32 %203, i32* %13
br label %204
204: ; preds = %201, %198
%205 = load i32, i32* %13
%206 = srem i32 %205, 24
store i32 %206, i32* %13
%207 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%208 = load i32, i32* %13
%209 = load i32, i32* %14
%210 = load i32, i32* %15
%211 = call i32 (i8*, i8*, ...) @sprintf(i8* %207, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %208, i32 %209, i32 %210)
br label %212
212: ; preds = %204, %181
br label %213
213: ; preds = %212, %158
br label %214
214: ; preds = %213, %135
br label %215
215: ; preds = %214, %112
br label %216
216: ; preds = %215, %89
br label %217
217: ; preds = %216, %66
%218 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%219 = call i64 @strlen(i8* %218)
%220 = trunc i64 %219 to i32
store i32 %220, i32* %16
%221 = load i32, i32* %16
%222 = load i32, i32* %6
%223 = sub nsw i32 %222, 1
%224 = icmp slt i32 %221, %223
br i1 %224, label %225, label %229
225: ; preds = %217
%226 = load i8*, i8** %5
%227 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%228 = call i8* @strcpy(i8* %226, i8* %227)
br label %241
229: ; preds = %217
%230 = load i8*, i8** %5
%231 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%232 = load i32, i32* %6
%233 = sub nsw i32 %232, 1
%234 = sext i32 %233 to i64
%235 = call i8* @strncpy(i8* %230, i8* %231, i64 %234)
%236 = load i8*, i8** %5
%237 = load i32, i32* %6
%238 = sub nsw i32 %237, 1
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds i8, i8* %236, i64 %239
store i8 0, i8* %240
br label %241
241: ; preds = %229, %225
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"%02d:%02d:%09.6f\00"
@.str.1 = [17 x i8] c"%02d:%02d:%08.5f\00"
@.str.2 = [17 x i8] c"%02d:%02d:%07.4f\00"
@.str.3 = [17 x i8] c"%02d:%02d:%06.3f\00"
@.str.4 = [17 x i8] c"%02d:%02d:%05.2f\00"
@.str.5 = [17 x i8] c"%02d:%02d:%04.1f\00"
@.str.6 = [15 x i8] c"%02d:%02d:%02d\00"
define void @ra2str(i8* %0, i32 %1, double %2, i32 %3) {
%5 = alloca [64 x i8]
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%7 = fcmp olt double %2, 0.000000e+00
%8 = fneg double %2
%9 = select i1 %7, double %8, double %2
%10 = tail call double @fmod(double %9, double 3.600000e+02)
%11 = fneg double %10
%12 = select i1 %7, double %11, double %10
%13 = fcmp olt double %12, 0.000000e+00
%14 = fadd double %12, 3.600000e+02
%15 = select i1 %13, double %14, double %12
%16 = fdiv double %15, 1.500000e+01
%17 = fptosi double %16 to i32
%18 = sitofp i32 %17 to double
%19 = fsub double %16, %18
%20 = fmul double %19, 6.000000e+01
%21 = fptosi double %20 to i32
%22 = sitofp i32 %21 to double
%23 = fsub double %20, %22
%24 = fmul double %23, 6.000000e+01
%25 = icmp sgt i32 %3, 5
br i1 %25, label %26, label %37
26: ; preds = %4
%27 = fcmp ogt double %24, 0x404DFFFFF79C8430
%28 = select i1 %27, double 0.000000e+00, double %24
%29 = zext i1 %27 to i32
%30 = add nsw i32 %29, %21
%31 = icmp sgt i32 %30, 59
%32 = zext i1 %31 to i32
%33 = add nsw i32 %32, %17
%34 = select i1 %31, i32 0, i32 %30
%35 = srem i32 %33, 24
%36 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %34, double %28)
br label %115
37: ; preds = %4
%38 = icmp eq i32 %3, 5
br i1 %38, label %39, label %50
39: ; preds = %37
%40 = fcmp ogt double %24, 0x404DFFFFAC1D29DC
%41 = select i1 %40, double 0.000000e+00, double %24
%42 = zext i1 %40 to i32
%43 = add nsw i32 %42, %21
%44 = icmp sgt i32 %43, 59
%45 = zext i1 %44 to i32
%46 = add nsw i32 %45, %17
%47 = select i1 %44, i32 0, i32 %43
%48 = srem i32 %46, 24
%49 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %48, i32 %47, double %41)
br label %115
50: ; preds = %37
%51 = icmp sgt i32 %3, 3
br i1 %51, label %52, label %63
52: ; preds = %50
%53 = fcmp ogt double %24, 5.999990e+01
%54 = select i1 %53, double 0.000000e+00, double %24
%55 = zext i1 %53 to i32
%56 = add nsw i32 %55, %21
%57 = icmp sgt i32 %56, 59
%58 = zext i1 %57 to i32
%59 = add nsw i32 %58, %17
%60 = select i1 %57, i32 0, i32 %56
%61 = srem i32 %59, 24
%62 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %61, i32 %60, double %54)
br label %115
63: ; preds = %50
%64 = icmp eq i32 %3, 3
br i1 %64, label %65, label %76
65: ; preds = %63
%66 = fcmp ogt double %24, 5.999900e+01
%67 = select i1 %66, double 0.000000e+00, double %24
%68 = zext i1 %66 to i32
%69 = add nsw i32 %68, %21
%70 = icmp sgt i32 %69, 59
%71 = zext i1 %70 to i32
%72 = add nsw i32 %71, %17
%73 = select i1 %70, i32 0, i32 %69
%74 = srem i32 %72, 24
%75 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %74, i32 %73, double %67)
br label %115
76: ; preds = %63
%77 = icmp sgt i32 %3, 1
br i1 %77, label %78, label %89
78: ; preds = %76
%79 = fcmp ogt double %24, 5.999000e+01
%80 = select i1 %79, double 0.000000e+00, double %24
%81 = zext i1 %79 to i32
%82 = add nsw i32 %81, %21
%83 = icmp sgt i32 %82, 59
%84 = zext i1 %83 to i32
%85 = add nsw i32 %84, %17
%86 = select i1 %83, i32 0, i32 %82
%87 = srem i32 %85, 24
%88 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %87, i32 %86, double %80)
br label %115
89: ; preds = %76
%90 = icmp eq i32 %3, 1
br i1 %90, label %91, label %102
91: ; preds = %89
%92 = fcmp ogt double %24, 0x404DF33333333333
%93 = select i1 %92, double 0.000000e+00, double %24
%94 = zext i1 %92 to i32
%95 = add nsw i32 %94, %21
%96 = icmp sgt i32 %95, 59
%97 = zext i1 %96 to i32
%98 = add nsw i32 %97, %17
%99 = select i1 %96, i32 0, i32 %95
%100 = srem i32 %98, 24
%101 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %100, i32 %99, double %93)
br label %115
102: ; preds = %89
%103 = fadd double %24, 5.000000e-01
%104 = fptosi double %103 to i32
%105 = icmp sgt i32 %104, 59
%106 = zext i1 %105 to i32
%107 = add nsw i32 %106, %21
%108 = select i1 %105, i32 0, i32 %104
%109 = icmp sgt i32 %107, 59
%110 = zext i1 %109 to i32
%111 = add nsw i32 %110, %17
%112 = select i1 %109, i32 0, i32 %107
%113 = srem i32 %111, 24
%114 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %113, i32 %112, i32 %108)
br label %115
115: ; preds = %39, %65, %91, %102, %78, %52, %26
%116 = call i64 @strlen(i8* %6)
%117 = trunc i64 %116 to i32
%118 = add nsw i32 %1, -1
%119 = icmp sgt i32 %118, %117
br i1 %119, label %120, label %122
120: ; preds = %115
%121 = call i8* @strcpy(i8* dereferenceable(1) %0, i8* %6)
br label %126
122: ; preds = %115
%123 = sext i32 %118 to i64
%124 = call i8* @strncpy(i8* dereferenceable(1) %0, i8* %6, i64 %123)
%125 = getelementptr inbounds i8, i8* %0, i64 %123
store i8 0, i8* %125
br label %126
126: ; preds = %122, %120
ret void
}