#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 *, int, int, int, int);
const char *ms2tcode(int ms) {
  static char buf[32];
  sprintf(buf, "%02d:%02d:%02d.%03d", ms / 1000 / 60 / 60,
          (ms / 1000 / 60) % 60, (ms / 1000) % 60, ms % 1000);
  return buf;
}


x86 assembly (clang, -O0):
<ms2tcode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x4(%rbp),%eax
mov    $0x3e8,%esi
cltd
idiv   %esi
mov    $0x3c,%esi
cltd
idiv   %esi
mov    %edx,%r8d
mov    -0x4(%rbp),%eax
mov    $0x3e8,%esi
cltd
idiv   %esi
mov    %edx,%r9d
mov    -0x8(%rbp),%edx
lea    0x2ebc(%rip),%rdi
lea    0xe75(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2ea9(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ms2tcode>:
push   %rbx
movslq %edi,%r9
imul   $0x45e7b273,%r9,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0xe,%eax
add    %ecx,%eax
imul   $0x4a90be59,%r9,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rdx
sar    $0x14,%edx
add    %ecx,%edx
movslq %eax,%rcx
imul   $0xffffffff88888889,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%esi
shr    $0x1f,%esi
sar    $0x5,%eax
add    %esi,%eax
imul   $0x3c,%eax,%eax
sub    %eax,%ecx
imul   $0x10624dd3,%r9,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x26,%rax
add    %esi,%eax
movslq %eax,%r8
imul   $0xffffffff88888889,%r8,%rax
shr    $0x20,%rax
add    %r8d,%eax
mov    %eax,%esi
shr    $0x1f,%esi
sar    $0x5,%eax
add    %esi,%eax
imul   $0x3c,%eax,%eax
imul   $0x3e8,%r8d,%esi
sub    %eax,%r8d
sub    %esi,%r9d
lea    0x2e99(%rip),%rbx
lea    0xe52(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@ms2tcode.buf = internal global [32 x i8] zeroinitializer
@.str = [20 x i8] c"%02d:%02d:%02d.%03d\00"
define i8* @ms2tcode(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 1000
%5 = sdiv i32 %4, 60
%6 = sdiv i32 %5, 60
%7 = load i32, i32* %2
%8 = sdiv i32 %7, 1000
%9 = sdiv i32 %8, 60
%10 = srem i32 %9, 60
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 1000
%13 = srem i32 %12, 60
%14 = load i32, i32* %2
%15 = srem i32 %14, 1000
%16 = call i32 @sprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @ms2tcode.buf, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %10, i32 %13, i32 %15)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @ms2tcode.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@ms2tcode.buf = internal global [32 x i8] zeroinitializer
@.str = [20 x i8] c"%02d:%02d:%02d.%03d\00"
define i8* @ms2tcode(i32 %0) {
%2 = sdiv i32 %0, 1000
%3 = sdiv i32 %0, 60000
%4 = sdiv i32 %0, 3600000
%5 = srem i32 %3, 60
%6 = srem i32 %2, 60
%7 = srem i32 %0, 1000
%8 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @ms2tcode.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5, i32 %6, i32 %7)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @ms2tcode.buf, i64 0, i64 0)
}