#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 atoi(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
char *timeconv(char *input) {
  int count = atoi(input);
  static char ret[50];
  if (count < 0)
    snprintf(ret, 50, "?");
  else if (count < 60)
    snprintf(ret, 50, "%02i %s", count, "secs");
  else if (count < 3600)
    snprintf(ret, 50, "%i:%02i %s", count / 60, (count % 60), "mins");
  else if (count < 86400)
    snprintf(ret, 50, "%i:%02i %s", count / 3600, (count % 3600) / 60, "h");
  else
    snprintf(ret, 50, "%i %s %02i %s", count / 86400, "D",
             (count % 86400) / 3600, "h");
  return (ret);
}


x86 assembly (clang, -O0):
<timeconv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1161 <timeconv+0x41>
lea    0x2ef7(%rip),%rdi
mov    $0x32,%esi
lea    0xeab(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    129a <timeconv+0x17a>
cmpl   $0x3c,-0xc(%rbp)
jge    1194 <timeconv+0x74>
mov    -0xc(%rbp),%ecx
lea    0x2ecb(%rip),%rdi
mov    $0x32,%esi
lea    0xe9e(%rip),%rdx
lea    0xe7a(%rip),%r8
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    1295 <timeconv+0x175>
cmpl   $0xe10,-0xc(%rbp)
jge    11e2 <timeconv+0xc2>
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
mov    $0x3c,%esi
cltd
idiv   %esi
mov    %edx,%r8d
lea    0x2e7d(%rip),%rdi
mov    $0x32,%esi
lea    0xe38(%rip),%rdx
lea    0xe3c(%rip),%r9
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    1290 <timeconv+0x170>
cmpl   $0x15180,-0xc(%rbp)
jge    123a <timeconv+0x11a>
mov    -0xc(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
mov    $0xe10,%esi
cltd
idiv   %esi
mov    %edx,%eax
mov    $0x3c,%esi
cltd
idiv   %esi
mov    %eax,%r8d
lea    0x2e25(%rip),%rdi
mov    $0x32,%esi
lea    0xde0(%rip),%rdx
lea    0xde9(%rip),%r9
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    128b <timeconv+0x16b>
mov    -0xc(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
mov    $0x15180,%esi
cltd
idiv   %esi
mov    %edx,%eax
mov    $0xe10,%esi
cltd
idiv   %esi
mov    %eax,%r9d
lea    0x2dda(%rip),%rdi
mov    $0x32,%esi
lea    0xda7(%rip),%rdx
lea    0xdae(%rip),%r8
lea    0xd97(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    1290 <timeconv+0x170>
jmp    1295 <timeconv+0x175>
jmp    129a <timeconv+0x17a>
lea    0x2d9f(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeconv>:
push   %rax
call   1040 <atoi@plt>
test   %eax,%eax
js     1157 <timeconv+0x37>
cmp    $0x3b,%eax
ja     1176 <timeconv+0x56>
lea    0x2f0a(%rip),%rdi
lea    0xee2(%rip),%rdx
lea    0xebe(%rip),%r8
mov    $0x32,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <snprintf@plt>
jmp    1249 <timeconv+0x129>
lea    0x2ee2(%rip),%rdi
lea    0xe9b(%rip),%rdx
mov    $0x32,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
jmp    1249 <timeconv+0x129>
cmp    $0xe0f,%eax
ja     11ae <timeconv+0x8e>
movzwl %ax,%ecx
imul   $0x8889,%ecx,%ecx
shr    $0x15,%ecx
imul   $0x3c,%ecx,%edx
sub    %edx,%eax
movzwl %ax,%r8d
lea    0x2ea7(%rip),%rdi
lea    0xe67(%rip),%rdx
lea    0xe6b(%rip),%r9
mov    $0x32,%esi
jmp    11f1 <timeconv+0xd1>
mov    %eax,%edx
cmp    $0x1517f,%eax
ja     11fa <timeconv+0xda>
mov    $0x91a2b3c5,%ecx
imul   %rdx,%rcx
shr    $0x2b,%rcx
imul   $0xe10,%ecx,%edx
sub    %edx,%eax
imul   $0x8889,%eax,%r8d
shr    $0x15,%r8d
lea    0x2e62(%rip),%rdi
lea    0xe22(%rip),%rdx
lea    0xe2b(%rip),%r9
mov    $0x32,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
jmp    1249 <timeconv+0x129>
mov    $0xc22e4507,%ecx
imul   %rdx,%rcx
shr    $0x30,%rcx
imul   $0x15180,%ecx,%edx
sub    %edx,%eax
mov    $0x91a2b3c5,%r9d
imul   %rax,%r9
shr    $0x2b,%r9
lea    0xdf3(%rip),%rax
mov    %rax,(%rsp)
lea    0x2e11(%rip),%rdi
lea    0xde3(%rip),%rdx
lea    0xdea(%rip),%r8
mov    $0x32,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
lea    0x2df0(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@timeconv.ret = internal global [50 x i8] zeroinitializer
@.str = [2 x i8] c"?\00"
@.str.1 = [8 x i8] c"%02i %s\00"
@.str.2 = [5 x i8] c"secs\00"
@.str.3 = [11 x i8] c"%i:%02i %s\00"
@.str.4 = [5 x i8] c"mins\00"
@.str.5 = [2 x i8] c"h\00"
@.str.6 = [14 x i8] c"%i %s %02i %s\00"
@.str.7 = [2 x i8] c"D\00"
define i8* @timeconv(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @atoi(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %45
10: ; preds = %1
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 60
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %3
%15 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %44
16: ; preds = %10
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 3600
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* %3
%21 = sdiv i32 %20, 60
%22 = load i32, i32* %3
%23 = srem i32 %22, 60
%24 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %43
25: ; preds = %16
%26 = load i32, i32* %3
%27 = icmp slt i32 %26, 86400
br i1 %27, label %28, label %35
28: ; preds = %25
%29 = load i32, i32* %3
%30 = sdiv i32 %29, 3600
%31 = load i32, i32* %3
%32 = srem i32 %31, 3600
%33 = sdiv i32 %32, 60
%34 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %30, i32 %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %42
35: ; preds = %25
%36 = load i32, i32* %3
%37 = sdiv i32 %36, 86400
%38 = load i32, i32* %3
%39 = srem i32 %38, 86400
%40 = sdiv i32 %39, 3600
%41 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %42
42: ; preds = %35, %28
br label %43
43: ; preds = %42, %19
br label %44
44: ; preds = %43, %13
br label %45
45: ; preds = %44, %8
ret i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0)
}

LLVM IR (-O2):
@timeconv.ret = internal global [50 x i8] zeroinitializer
@.str = [2 x i8] c"?\00"
@.str.1 = [8 x i8] c"%02i %s\00"
@.str.2 = [5 x i8] c"secs\00"
@.str.3 = [11 x i8] c"%i:%02i %s\00"
@.str.4 = [5 x i8] c"mins\00"
@.str.5 = [2 x i8] c"h\00"
@.str.6 = [14 x i8] c"%i %s %02i %s\00"
@.str.7 = [2 x i8] c"D\00"
define i8* @timeconv(i8* nocapture %0) {
%2 = tail call i32 @atoi(i8* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %33
6: ; preds = %1
%7 = icmp ult i32 %2, 60
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %33
10: ; preds = %6
%11 = icmp ult i32 %2, 3600
br i1 %11, label %12, label %19
12: ; preds = %10
%13 = trunc i32 %2 to i16
%14 = udiv i16 %13, 60
%15 = zext i16 %14 to i32
%16 = urem i16 %13, 60
%17 = zext i16 %16 to i32
%18 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %15, i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %33
19: ; preds = %10
%20 = icmp ult i32 %2, 86400
br i1 %20, label %21, label %28
21: ; preds = %19
%22 = udiv i32 %2, 3600
%23 = urem i32 %2, 3600
%24 = trunc i32 %23 to i16
%25 = udiv i16 %24, 60
%26 = zext i16 %25 to i32
%27 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %22, i32 %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %33
28: ; preds = %19
%29 = udiv i32 %2, 86400
%30 = urem i32 %2, 86400
%31 = udiv i32 %30, 3600
%32 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %33
33: ; preds = %8, %21, %28, %12, %4
ret i8* getelementptr inbounds ([50 x i8], [50 x i8]* @timeconv.ret, i64 0, i64 0)
}