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;
  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;
  isec = (int)(seconds + 0.5);
  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 if (ndec > -1) {
    if (isec > 59) {
      isec = 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);
  }
  if (strlen(tstring) < (unsigned int)(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  0xe14(%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  0xddf(%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  0xdb2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd99(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jle    1328 <ra2str+0x1d8>
movsd  -0x38(%rbp),%xmm0
movsd  0xdb3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12c6 <ra2str+0x176>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    12ec <ra2str+0x19c>
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    0xd44(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16d5 <ra2str+0x585>
cmpl   $0x4,-0x1c(%rbp)
jle    13c2 <ra2str+0x272>
movsd  -0x38(%rbp),%xmm0
movsd  0xd11(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1360 <ra2str+0x210>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    1386 <ra2str+0x236>
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    0xcbb(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16d0 <ra2str+0x580>
cmpl   $0x3,-0x1c(%rbp)
jle    145c <ra2str+0x30c>
movsd  -0x38(%rbp),%xmm0
movsd  0xc6f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13fa <ra2str+0x2aa>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    1420 <ra2str+0x2d0>
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    0xc32(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16cb <ra2str+0x57b>
cmpl   $0x2,-0x1c(%rbp)
jle    14f6 <ra2str+0x3a6>
movsd  -0x38(%rbp),%xmm0
movsd  0xbcd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1494 <ra2str+0x344>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    14ba <ra2str+0x36a>
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    0xba9(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16c6 <ra2str+0x576>
cmpl   $0x1,-0x1c(%rbp)
jle    1590 <ra2str+0x440>
movsd  -0x38(%rbp),%xmm0
movsd  0xb2b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    152e <ra2str+0x3de>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    1554 <ra2str+0x404>
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    0xb20(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16c1 <ra2str+0x571>
cmpl   $0x0,-0x1c(%rbp)
jle    162a <ra2str+0x4da>
movsd  -0x38(%rbp),%xmm0
movsd  0xa89(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15c8 <ra2str+0x478>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    15ee <ra2str+0x49e>
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    0xa97(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16bc <ra2str+0x56c>
cmpl   $0xffffffff,-0x1c(%rbp)
jle    16b7 <ra2str+0x567>
cmpl   $0x3b,-0x8c(%rbp)
jle    165a <ra2str+0x50a>
movl   $0x0,-0x8c(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    1680 <ra2str+0x530>
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    0xa05(%rip),%rsi
mov    $0x1,%al
call   1070 <sprintf@plt>
jmp    16bc <ra2str+0x56c>
jmp    16c1 <ra2str+0x571>
jmp    16c6 <ra2str+0x576>
jmp    16cb <ra2str+0x57b>
jmp    16d0 <ra2str+0x580>
jmp    16d5 <ra2str+0x585>
lea    -0x80(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
cmp    %rcx,%rax
jae    1701 <ra2str+0x5b1>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    1728 <ra2str+0x5d8>
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   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %edx,%ebp
movapd %xmm0,%xmm3
movapd %xmm0,0x40(%rsp)
mov    %esi,%r14d
mov    %rdi,%r15
movapd %xmm0,%xmm1
xorpd  0xe88(%rip),%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm2,%xmm0
andpd  %xmm0,%xmm1
andnpd %xmm3,%xmm0
orpd   %xmm1,%xmm0
movsd  0xe7b(%rip),%xmm1
call   1060 <fmod@plt>
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm1
ucomisd 0x40(%rsp),%xmm2
jbe    11b2 <ra2str+0x62>
xorpd  0xe4e(%rip),%xmm1
movsd  0xe56(%rip),%xmm3
addsd  %xmm1,%xmm3
movapd %xmm1,%xmm0
cmpltsd %xmm2,%xmm0
andpd  %xmm0,%xmm3
andnpd %xmm1,%xmm0
orpd   %xmm3,%xmm0
divsd  0xe3d(%rip),%xmm0
cvttsd2si %xmm0,%eax
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  0xe2d(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
cvttpd2dq %xmm0,%xmm2
cvtdq2pd %xmm2,%xmm2
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
cmp    $0x6,%ebp
jl     1266 <ra2str+0x116>
xor    %edx,%edx
ucomisd 0xe3e(%rip),%xmm0
seta   %bl
xorpd  %xmm1,%xmm1
ja     1227 <ra2str+0xd7>
movapd %xmm0,%xmm1
mov    %bl,%dl
add    %ecx,%edx
xor    %ecx,%ecx
xor    %esi,%esi
cmp    $0x3c,%edx
setge  %sil
cmovl  %edx,%ecx
add    %eax,%esi
movslq %esi,%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    0xdff(%rip),%rsi
jmp    142f <ra2str+0x2df>
cmp    $0x5,%ebp
jne    12c1 <ra2str+0x171>
xor    %edx,%edx
ucomisd 0xddb(%rip),%xmm0
seta   %bl
xorpd  %xmm1,%xmm1
ja     1282 <ra2str+0x132>
movapd %xmm0,%xmm1
mov    %bl,%dl
add    %ecx,%edx
xor    %ecx,%ecx
xor    %esi,%esi
cmp    $0x3c,%edx
setge  %sil
cmovl  %edx,%ecx
add    %eax,%esi
movslq %esi,%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    0xdb5(%rip),%rsi
jmp    142f <ra2str+0x2df>
cmp    $0x4,%ebp
jl     131c <ra2str+0x1cc>
xor    %edx,%edx
ucomisd 0xd78(%rip),%xmm0
seta   %bl
xorpd  %xmm1,%xmm1
ja     12dd <ra2str+0x18d>
movapd %xmm0,%xmm1
mov    %bl,%dl
add    %ecx,%edx
xor    %ecx,%ecx
xor    %esi,%esi
cmp    $0x3c,%edx
setge  %sil
cmovl  %edx,%ecx
add    %eax,%esi
movslq %esi,%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    0xd6b(%rip),%rsi
jmp    142f <ra2str+0x2df>
cmp    $0x3,%ebp
jne    1379 <ra2str+0x229>
xor    %edx,%edx
ucomisd 0xd15(%rip),%xmm0
seta   %sil
xorpd  %xmm1,%xmm1
ja     1339 <ra2str+0x1e9>
movapd %xmm0,%xmm1
mov    %sil,%dl
add    %ecx,%edx
xor    %ecx,%ecx
xor    %esi,%esi
cmp    $0x3c,%edx
setge  %sil
cmovl  %edx,%ecx
add    %eax,%esi
movslq %esi,%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    0xd1f(%rip),%rsi
jmp    142f <ra2str+0x2df>
cmp    $0x2,%ebp
jl     13d3 <ra2str+0x283>
xor    %edx,%edx
ucomisd 0xcb0(%rip),%xmm0
seta   %sil
xorpd  %xmm1,%xmm1
ja     1396 <ra2str+0x246>
movapd %xmm0,%xmm1
mov    %sil,%dl
add    %ecx,%edx
xor    %ecx,%ecx
xor    %esi,%esi
cmp    $0x3c,%edx
setge  %sil
cmovl  %edx,%ecx
add    %eax,%esi
movslq %esi,%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    0xcd3(%rip),%rsi
jmp    142f <ra2str+0x2df>
cmp    $0x1,%ebp
jne    147b <ra2str+0x32b>
xor    %edx,%edx
ucomisd 0xc4a(%rip),%xmm0
seta   %sil
xorpd  %xmm1,%xmm1
ja     13f4 <ra2str+0x2a4>
movapd %xmm0,%xmm1
mov    %sil,%dl
add    %ecx,%edx
xor    %ecx,%ecx
xor    %esi,%esi
cmp    $0x3c,%edx
setge  %sil
cmovl  %edx,%ecx
add    %eax,%esi
movslq %esi,%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    0xc86(%rip),%rsi
mov    %rsp,%rdi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1070 <sprintf@plt>
mov    %rsp,%rdi
call   1050 <strlen@plt>
movslq %r14d,%rbp
add    $0xffffffffffffffff,%rbp
mov    %ebp,%ecx
mov    %rsp,%rsi
cmp    %rcx,%rax
jae    1460 <ra2str+0x310>
mov    %r15,%rdi
call   1040 <strcpy@plt>
jmp    1470 <ra2str+0x320>
mov    %r15,%rdi
mov    %rbp,%rdx
call   1030 <strncpy@plt>
movb   $0x0,(%r15,%rbp,1)
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
test   %ebp,%ebp
js     143d <ra2str+0x2ed>
movsd  0xba1(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edx
xor    %esi,%esi
cmp    $0x3c,%edx
setge  %sil
add    %ecx,%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    0xbe6(%rip),%rsi
mov    %rsp,%rdi
jmp    1436 <ra2str+0x2e6>

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