#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, ...);
char *showtime(unsigned long t) {
  static char buff[50];
  int m, s;
  if (t < 60 * 100) {
    sprintf(buff, "%.2f", ((double)t) * 0.01);
    return buff;
  }
  s = (int)((t + 50) / 100);
  m = s / 60;
  s = s % 60;
  if (m < 60) {
    sprintf(buff, "%d:%02d", m, s);
    return buff;
  }
  if (m < 60 * 24) {
    sprintf(buff, "%d:%02d:%02d", m / 60, m % 60, s);
    return buff;
  }
  sprintf(buff, "%dd%02d:%02d:%02d", m / 1440, (m / 60) % 24, m % 60, s);
  return buff;
}


x86 assembly (clang, -O0):
<showtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x1770,-0x10(%rbp)
jae    1186 <showtime+0x76>
movaps 0xedf(%rip),%xmm1
movq   -0x10(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xede(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xea7(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
lea    0x2ed8(%rip),%rdi
lea    0xec1(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    0x2ec3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1298 <showtime+0x188>
mov    -0x10(%rbp),%rax
add    $0x32,%rax
mov    $0x64,%ecx
xor    %edx,%edx
div    %rcx
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
cmpl   $0x3c,-0x14(%rbp)
jge    11ec <showtime+0xdc>
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0x2e72(%rip),%rdi
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    0x2e5d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1298 <showtime+0x188>
cmpl   $0x5a0,-0x14(%rbp)
jge    1240 <showtime+0x130>
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%r8d
lea    0x2e1e(%rip),%rdi
lea    0xe14(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    0x2e09(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1298 <showtime+0x188>
mov    -0x14(%rbp),%eax
mov    $0x5a0,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x14(%rbp),%eax
mov    $0x3c,%esi
cltd
idiv   %esi
mov    %edx,%r8d
mov    -0x20(%rbp),%edx
mov    -0x18(%rbp),%r9d
lea    0x2dc1(%rip),%rdi
lea    0xdc4(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    0x2dac(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showtime>:
push   %rax
cmp    $0x176f,%rdi
ja     1161 <showtime+0x51>
movq   %rdi,%xmm0
punpckldq 0xed9(%rip),%xmm0
subpd  0xee1(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0xedd(%rip),%xmm1
cvttsd2si %xmm1,%edx
lea    0x2ef2(%rip),%rdi
lea    0xed3(%rip),%rsi
xor    %eax,%eax
call   1030 <sprintf@plt>
jmp    1286 <showtime+0x176>
add    $0x32,%rdi
shr    $0x2,%rdi
movabs $0x28f5c28f5c28f5c3,%rcx
c2 f5 28
mov    %rdi,%rax
mul    %rcx
shr    $0x2,%rdx
movslq %edx,%rax
imul   $0xffffffff88888889,%rax,%r8
shr    $0x20,%r8
add    %edx,%r8d
mov    %r8d,%ecx
shr    $0x1f,%ecx
sar    $0x5,%r8d
add    %ecx,%r8d
imul   $0x3c,%r8d,%ecx
mov    %eax,%r9d
sub    %ecx,%r9d
cmp    $0xe0f,%eax
jg     11cc <showtime+0xbc>
lea    0x2e8d(%rip),%rdi
lea    0xe73(%rip),%rsi
mov    %r8d,%edx
mov    %r9d,%ecx
xor    %eax,%eax
call   1030 <sprintf@plt>
jmp    1286 <showtime+0x176>
mov    %edx,%eax
cmp    $0x1517f,%edx
ja     1221 <showtime+0x111>
mov    $0x91a2b3c5,%edx
imul   %rax,%rdx
shr    $0x2b,%rdx
movslq %r8d,%rax
imul   $0xffffffff88888889,%rax,%rax
shr    $0x20,%rax
add    %r8d,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x3c,%eax,%eax
sub    %eax,%r8d
lea    0x2e35(%rip),%rdi
lea    0xe23(%rip),%rsi
mov    %r8d,%ecx
mov    %r9d,%r8d
xor    %eax,%eax
call   1030 <sprintf@plt>
jmp    1286 <showtime+0x176>
mov    $0xc22e4507,%edx
imul   %rax,%rdx
shr    $0x30,%rdx
mov    $0x91a2b3c5,%ecx
imul   %rax,%rcx
shr    $0x2b,%rcx
mov    $0xaaaaaaab,%eax
imul   %rcx,%rax
shr    $0x24,%rax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ecx
movslq %r8d,%rax
imul   $0xffffffff88888889,%rax,%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    0x2dc8(%rip),%rdi
lea    0xdc3(%rip),%rsi
xor    %eax,%eax
call   1030 <sprintf@plt>
lea    0x2db3(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@showtime.buff = internal global [50 x i8] zeroinitializer
@.str = [5 x i8] c"%.2f\00"
@.str.1 = [8 x i8] c"%d:%02d\00"
@.str.2 = [13 x i8] c"%d:%02d:%02d\00"
@.str.3 = [18 x i8] c"%dd%02d:%02d:%02d\00"
define i8* @showtime(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i64 %0, i64* %3
%6 = load i64, i64* %3
%7 = icmp ult i64 %6, 6000
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i64, i64* %3
%10 = uitofp i64 %9 to double
%11 = fmul double %10, 1.000000e-02
%12 = fptosi double %11 to i32
%13 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %12)
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8** %2
br label %49
14: ; preds = %1
%15 = load i64, i64* %3
%16 = add i64 %15, 50
%17 = udiv i64 %16, 100
%18 = trunc i64 %17 to i32
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = sdiv i32 %19, 60
store i32 %20, i32* %4
%21 = load i32, i32* %5
%22 = srem i32 %21, 60
store i32 %22, i32* %5
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 60
br i1 %24, label %25, label %29
25: ; preds = %14
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 %27)
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8** %2
br label %49
29: ; preds = %14
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 1440
br i1 %31, label %32, label %39
32: ; preds = %29
%33 = load i32, i32* %4
%34 = sdiv i32 %33, 60
%35 = load i32, i32* %4
%36 = srem i32 %35, 60
%37 = load i32, i32* %5
%38 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %34, i32 %36, i32 %37)
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8** %2
br label %49
39: ; preds = %29
%40 = load i32, i32* %4
%41 = sdiv i32 %40, 1440
%42 = load i32, i32* %4
%43 = sdiv i32 %42, 60
%44 = srem i32 %43, 24
%45 = load i32, i32* %4
%46 = srem i32 %45, 60
%47 = load i32, i32* %5
%48 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 %44, i32 %46, i32 %47)
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8** %2
br label %49
49: ; preds = %39, %32, %25, %8
%50 = load i8*, i8** %2
ret i8* %50
}

LLVM IR (-O2):
@showtime.buff = internal global [50 x i8] zeroinitializer
@.str = [5 x i8] c"%.2f\00"
@.str.1 = [8 x i8] c"%d:%02d\00"
@.str.2 = [13 x i8] c"%d:%02d:%02d\00"
@.str.3 = [18 x i8] c"%dd%02d:%02d:%02d\00"
define i8* @showtime(i64 %0) {
%2 = icmp ult i64 %0, 6000
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = uitofp i64 %0 to double
%5 = fmul double %4, 1.000000e-02
%6 = fptosi double %5 to i32
%7 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %29
8: ; preds = %1
%9 = add i64 %0, 50
%10 = udiv i64 %9, 100
%11 = trunc i64 %10 to i32
%12 = sdiv i32 %11, 60
%13 = srem i32 %11, 60
%14 = icmp slt i32 %11, 3600
br i1 %14, label %15, label %17
15: ; preds = %8
%16 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13)
br label %29
17: ; preds = %8
%18 = icmp ult i32 %11, 86400
br i1 %18, label %19, label %23
19: ; preds = %17
%20 = udiv i32 %11, 3600
%21 = srem i32 %12, 60
%22 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %21, i32 %13)
br label %29
23: ; preds = %17
%24 = udiv i32 %11, 86400
%25 = udiv i32 %11, 3600
%26 = urem i32 %25, 24
%27 = srem i32 %12, 60
%28 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %24, i32 %26, i32 %27, i32 %13)
br label %29
29: ; preds = %23, %19, %15, %3
ret i8* getelementptr inbounds ([50 x i8], [50 x i8]* @showtime.buff, i64 0, i64 0)
}