#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 */
int /*<<< orphan*/ sprintf(char *, char *, unsigned int, unsigned int,
                           unsigned int);
void TimeToString(char *string, unsigned long long millisecs) {
  unsigned int min = (unsigned int)(millisecs / (1000 * 60));
  millisecs -= (1000 * 60) * min;
  unsigned int sec = (unsigned int)(millisecs / 1000);
  millisecs -= 1000 * sec;
  unsigned int msec = (unsigned int)millisecs;
  sprintf(string, "%.2u:%.2u,%.3u", min, sec, msec);
}


x86 assembly (clang, -O0):
<TimeToString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xea60,%ecx
xor    %edx,%edx
div    %rcx
mov    %eax,-0x14(%rbp)
imul   $0xea60,-0x14(%rbp),%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %eax,-0x18(%rbp)
imul   $0x3e8,-0x18(%rbp),%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xe76(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimeToString>:
mov    %rsi,%rax
shr    $0x5,%rax
movabs $0x45e7b272f608771,%rcx
7b 5e 04
mul    %rcx
mov    %rdx,%r9
shr    $0x5,%r9
imul   $0xea60,%r9d,%eax
sub    %rax,%rsi
mov    %rsi,%rax
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
mov    %rdx,%rcx
shr    $0x4,%rcx
imul   $0xfffffc18,%ecx,%r8d
add    %esi,%r8d
lea    0xe9f(%rip),%rsi
mov    %r9d,%edx
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%.2u:%.2u,%.3u\00"
define void @TimeToString(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%8 = load i64, i64* %4
%9 = udiv i64 %8, 60000
%10 = trunc i64 %9 to i32
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = mul i32 60000, %11
%13 = zext i32 %12 to i64
%14 = load i64, i64* %4
%15 = sub i64 %14, %13
store i64 %15, i64* %4
%16 = load i64, i64* %4
%17 = udiv i64 %16, 1000
%18 = trunc i64 %17 to i32
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = mul i32 1000, %19
%21 = zext i32 %20 to i64
%22 = load i64, i64* %4
%23 = sub i64 %22, %21
store i64 %23, i64* %4
%24 = load i64, i64* %4
%25 = trunc i64 %24 to i32
store i32 %25, i32* %7
%26 = load i8*, i8** %3
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %27, i32 %28, i32 %29)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%.2u:%.2u,%.3u\00"
define void @TimeToString(i8* nocapture writeonly %0, i64 %1) {
%3 = udiv i64 %1, 60000
%4 = trunc i64 %3 to i32
%5 = mul nuw i64 %3, 60000
%6 = and i64 %5, 4294967264
%7 = sub i64 %1, %6
%8 = udiv i64 %7, 1000
%9 = trunc i64 %8 to i32
%10 = mul i64 %8, -1000
%11 = add i64 %10, %7
%12 = trunc i64 %11 to i32
%13 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %9, i32 %12)
ret void
}