#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);
char *buildtime(long long int elap) {
  int num = elap / 1000;
  int hor = 0;
  int min = 0;
  int sec = 0;
  static char buf[12];
  buf[0] = '\0';
  hor = num / 3600;
  min = (num % 3600) / 60;
  sec = num % 60;
  sprintf(buf, "%02d:%02d:%02d", hor, min, sec);
  return (buf);
}


x86 assembly (clang, -O0):
<buildtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3e8,%ecx
cqto
idiv   %rcx
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movb   $0x0,0x2ee0(%rip)
mov    -0xc(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0x2e9b(%rip),%rdi
lea    0xe6b(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2e88(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildtime>:
push   %rbx
mov    %rdi,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x7,%rdx
add    %rax,%rdx
movb   $0x0,0x2ef3(%rip)
lea    0x2eec(%rip),%rbx
movslq %edx,%r8
imul   $0xffffffff91a2b3c5,%r8,%rdx
shr    $0x20,%rdx
add    %r8d,%edx
mov    %edx,%eax
shr    $0x1f,%eax
sar    $0xb,%edx
add    %eax,%edx
imul   $0xe10,%edx,%eax
mov    %r8d,%ecx
sub    %eax,%ecx
movswl %cx,%eax
imul   $0xffff8889,%eax,%eax
shr    $0x10,%eax
add    %ecx,%eax
movzwl %ax,%eax
movswl %ax,%ecx
shr    $0xf,%eax
sar    $0x5,%ecx
add    %eax,%ecx
movswl %cx,%ecx
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
sub    %eax,%r8d
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@buildtime.buf = internal global [12 x i8] zeroinitializer
@.str = [15 x i8] c"%02d:%02d:%02d\00"
define i8* @buildtime(i64 %0) {
%2 = sdiv i64 %0, 1000
%3 = trunc i64 %2 to i32
store i8 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @buildtime.buf, i64 0, i64 0)
%4 = sdiv i32 %3, 3600
%5 = srem i32 %3, 3600
%6 = trunc i32 %5 to i16
%7 = sdiv i16 %6, 60
%8 = sext i16 %7 to i32
%9 = srem i32 %3, 60
%10 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @buildtime.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %8, i32 %9)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @buildtime.buf, i64 0, i64 0)
}