#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double fmod(double, double);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void ra2str(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    1310 <ra2str+0x1c0>
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
cvttsd2si -0x38(%rbp),%r8d
lea    0xd5a(%rip),%rsi
call   1070 <sprintf@plt>
jmp    16c0 <ra2str+0x570>
cmpl   $0x4,-0x1c(%rbp)
jle    13a9 <ra2str+0x259>
movsd  -0x38(%rbp),%xmm0
movsd  0xd29(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1348 <ra2str+0x1f8>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    136e <ra2str+0x21e>
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
cvttsd2si -0x38(%rbp),%r8d
lea    0xcd2(%rip),%rsi
call   1070 <sprintf@plt>
jmp    16bb <ra2str+0x56b>
cmpl   $0x3,-0x1c(%rbp)
jle    1442 <ra2str+0x2f2>
movsd  -0x38(%rbp),%xmm0
movsd  0xc88(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13e1 <ra2str+0x291>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    1407 <ra2str+0x2b7>
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
cvttsd2si -0x38(%rbp),%r8d
lea    0xc4a(%rip),%rsi
call   1070 <sprintf@plt>
jmp    16b6 <ra2str+0x566>
cmpl   $0x2,-0x1c(%rbp)
jle    14db <ra2str+0x38b>
movsd  -0x38(%rbp),%xmm0
movsd  0xbe7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    147a <ra2str+0x32a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    14a0 <ra2str+0x350>
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
cvttsd2si -0x38(%rbp),%r8d
lea    0xbc2(%rip),%rsi
call   1070 <sprintf@plt>
jmp    16b1 <ra2str+0x561>
cmpl   $0x1,-0x1c(%rbp)
jle    1574 <ra2str+0x424>
movsd  -0x38(%rbp),%xmm0
movsd  0xb46(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1513 <ra2str+0x3c3>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    1539 <ra2str+0x3e9>
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
cvttsd2si -0x38(%rbp),%r8d
lea    0xb3a(%rip),%rsi
call   1070 <sprintf@plt>
jmp    16ac <ra2str+0x55c>
cmpl   $0x0,-0x1c(%rbp)
jle    160d <ra2str+0x4bd>
movsd  -0x38(%rbp),%xmm0
movsd  0xaa5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15ac <ra2str+0x45c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    15d2 <ra2str+0x482>
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
cvttsd2si -0x38(%rbp),%r8d
lea    0xab2(%rip),%rsi
call   1070 <sprintf@plt>
jmp    16a7 <ra2str+0x557>
movsd  0xa13(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8c(%rbp)
cmpl   $0x3b,-0x8c(%rbp)
jle    164a <ra2str+0x4fa>
movl   $0x0,-0x8c(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x3b,-0x88(%rbp)
jle    1670 <ra2str+0x520>
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    0xa24(%rip),%rsi
call   1070 <sprintf@plt>
jmp    16ac <ra2str+0x55c>
jmp    16b1 <ra2str+0x561>
jmp    16b6 <ra2str+0x566>
jmp    16bb <ra2str+0x56b>
jmp    16c0 <ra2str+0x570>
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    16f5 <ra2str+0x5a5>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    1719 <ra2str+0x5c9>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
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     1265 <ra2str+0x115>
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
cmovl  %esi,%ecx
setge  %dl
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
cvttsd2si %xmm0,%r8d
lea    0xe00(%rip),%rsi
jmp    1493 <ra2str+0x343>
cmp    $0x5,%ebp
jne    12c5 <ra2str+0x175>
xor    %esi,%esi
ucomisd 0xddc(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     1281 <ra2str+0x131>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
cmovl  %esi,%ecx
setge  %dl
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
cvttsd2si %xmm0,%r8d
lea    0xdb1(%rip),%rsi
jmp    1493 <ra2str+0x343>
cmp    $0x4,%ebp
jl     1325 <ra2str+0x1d5>
xor    %esi,%esi
ucomisd 0xd74(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     12e1 <ra2str+0x191>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
cmovl  %esi,%ecx
setge  %dl
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
cvttsd2si %xmm0,%r8d
lea    0xd62(%rip),%rsi
jmp    1493 <ra2str+0x343>
cmp    $0x3,%ebp
jne    1385 <ra2str+0x235>
xor    %esi,%esi
ucomisd 0xd0c(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     1341 <ra2str+0x1f1>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
cmovl  %esi,%ecx
setge  %dl
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
cvttsd2si %xmm0,%r8d
lea    0xd13(%rip),%rsi
jmp    1493 <ra2str+0x343>
cmp    $0x2,%ebp
jl     13e5 <ra2str+0x295>
xor    %esi,%esi
ucomisd 0xca4(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     13a1 <ra2str+0x251>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
cmovl  %esi,%ecx
setge  %dl
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
cvttsd2si %xmm0,%r8d
lea    0xcc4(%rip),%rsi
jmp    1493 <ra2str+0x343>
cmp    $0x1,%ebp
jne    1442 <ra2str+0x2f2>
xor    %esi,%esi
ucomisd 0xc3c(%rip),%xmm1
seta   %cl
xorpd  %xmm0,%xmm0
ja     1401 <ra2str+0x2b1>
movapd %xmm1,%xmm0
mov    %cl,%sil
add    %edx,%esi
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x3c,%esi
cmovl  %esi,%ecx
setge  %dl
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
cvttsd2si %xmm0,%r8d
lea    0xc75(%rip),%rsi
jmp    1493 <ra2str+0x343>
addsd  0xbde(%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    0xc33(%rip),%rsi
mov    %rsp,%rdi
call   1070 <sprintf@plt>
mov    %rsp,%rdi
call   1050 <strlen@plt>
movslq %r14d,%rbp
add    $0xffffffffffffffff,%rbp
mov    %rsp,%rsi
cmp    %eax,%ebp
jle    14bb <ra2str+0x36b>
mov    %rbx,%rdi
call   1040 <strcpy@plt>
jmp    14c9 <ra2str+0x379>
mov    %rbx,%rdi
mov    %ebp,%edx
call   1030 <strncpy@plt>
movb   $0x0,(%rbx,%rbp,1)
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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