#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 *, ...);
char *secs_to_tt(char *tt, int secs) {
  int i;
  if (secs < 0) {
    i = (-secs) / 360;
  } else {
    i = (secs) / 360;
  }
  if (i <= 60) {
    sprintf(tt, "%02d", i);
  } else if (i < 700) {
    sprintf(tt, "61");
  } else if (i < 800) {
    sprintf(tt, "62");
  } else if (i < 900) {
    sprintf(tt, "63");
  } else if (i < 1000) {
    sprintf(tt, "64");
  } else if (i < 1100) {
    sprintf(tt, "65");
  } else if (i < 1200) {
    sprintf(tt, "66");
  } else if (i < 1800) {
    sprintf(tt, "67");
  } else {
    sprintf(tt, "68");
  }
  return tt;
}


x86 assembly (clang, -O0):
<secs_to_tt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    113e <secs_to_tt+0x2e>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    $0x168,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    114c <secs_to_tt+0x3c>
mov    -0xc(%rbp),%eax
mov    $0x168,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x3c,-0x10(%rbp)
jg     1170 <secs_to_tt+0x60>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    12a1 <secs_to_tt+0x191>
cmpl   $0x2bc,-0x10(%rbp)
jge    1194 <secs_to_tt+0x84>
mov    -0x8(%rbp),%rdi
lea    0xe7d(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    129c <secs_to_tt+0x18c>
cmpl   $0x320,-0x10(%rbp)
jge    11b8 <secs_to_tt+0xa8>
mov    -0x8(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1297 <secs_to_tt+0x187>
cmpl   $0x384,-0x10(%rbp)
jge    11dc <secs_to_tt+0xcc>
mov    -0x8(%rbp),%rdi
lea    0xe3b(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1292 <secs_to_tt+0x182>
cmpl   $0x3e8,-0x10(%rbp)
jge    1200 <secs_to_tt+0xf0>
mov    -0x8(%rbp),%rdi
lea    0xe1a(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    128d <secs_to_tt+0x17d>
cmpl   $0x44c,-0x10(%rbp)
jge    1224 <secs_to_tt+0x114>
mov    -0x8(%rbp),%rdi
lea    0xdf9(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1288 <secs_to_tt+0x178>
cmpl   $0x4b0,-0x10(%rbp)
jge    1248 <secs_to_tt+0x138>
mov    -0x8(%rbp),%rdi
lea    0xdd8(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1283 <secs_to_tt+0x173>
cmpl   $0x708,-0x10(%rbp)
jge    126c <secs_to_tt+0x15c>
mov    -0x8(%rbp),%rdi
lea    0xdb7(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    127e <secs_to_tt+0x16e>
mov    -0x8(%rbp),%rdi
lea    0xda3(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1283 <secs_to_tt+0x173>
jmp    1288 <secs_to_tt+0x178>
jmp    128d <secs_to_tt+0x17d>
jmp    1292 <secs_to_tt+0x182>
jmp    1297 <secs_to_tt+0x187>
jmp    129c <secs_to_tt+0x18c>
jmp    12a1 <secs_to_tt+0x191>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<secs_to_tt>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%eax
neg    %eax
cmovs  %esi,%eax
cmp    $0x55c7,%eax
ja     1144 <secs_to_tt+0x34>
movzwl %ax,%eax
imul   $0x2d83,%eax,%edx
shr    $0x16,%edx
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
jmp    11cb <secs_to_tt+0xbb>
cmp    $0x3d85f,%eax
ja     1156 <secs_to_tt+0x46>
movb   $0x0,0x2(%rbx)
movw   $0x3136,(%rbx)
jmp    11cb <secs_to_tt+0xbb>
cmp    $0x464ff,%eax
ja     1168 <secs_to_tt+0x58>
movb   $0x0,0x2(%rbx)
movw   $0x3236,(%rbx)
jmp    11cb <secs_to_tt+0xbb>
cmp    $0x4f19f,%eax
ja     117a <secs_to_tt+0x6a>
movb   $0x0,0x2(%rbx)
movw   $0x3336,(%rbx)
jmp    11cb <secs_to_tt+0xbb>
cmp    $0x57e3f,%eax
ja     118c <secs_to_tt+0x7c>
movb   $0x0,0x2(%rbx)
movw   $0x3436,(%rbx)
jmp    11cb <secs_to_tt+0xbb>
cmp    $0x60adf,%eax
ja     119e <secs_to_tt+0x8e>
movb   $0x0,0x2(%rbx)
movw   $0x3536,(%rbx)
jmp    11cb <secs_to_tt+0xbb>
cmp    $0x6977f,%eax
ja     11b0 <secs_to_tt+0xa0>
movb   $0x0,0x2(%rbx)
movw   $0x3636,(%rbx)
jmp    11cb <secs_to_tt+0xbb>
cmp    $0x9e33f,%eax
ja     11c2 <secs_to_tt+0xb2>
movb   $0x0,0x2(%rbx)
movw   $0x3736,(%rbx)
jmp    11cb <secs_to_tt+0xbb>
movb   $0x0,0x2(%rbx)
movw   $0x3836,(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%02d\00"
@.str.1 = [3 x i8] c"61\00"
@.str.2 = [3 x i8] c"62\00"
@.str.3 = [3 x i8] c"63\00"
@.str.4 = [3 x i8] c"64\00"
@.str.5 = [3 x i8] c"65\00"
@.str.6 = [3 x i8] c"66\00"
@.str.7 = [3 x i8] c"67\00"
@.str.8 = [3 x i8] c"68\00"
define i8* @secs_to_tt(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %4
%10 = sub nsw i32 0, %9
%11 = sdiv i32 %10, 360
store i32 %11, i32* %5
br label %15
12: ; preds = %2
%13 = load i32, i32* %4
%14 = sdiv i32 %13, 360
store i32 %14, i32* %5
br label %15
15: ; preds = %12, %8
%16 = load i32, i32* %5
%17 = icmp sle i32 %16, 60
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %74
22: ; preds = %15
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 700
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i8*, i8** %3
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %73
28: ; preds = %22
%29 = load i32, i32* %5
%30 = icmp slt i32 %29, 800
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i8*, i8** %3
%33 = call i32 (i8*, i8*, ...) @sprintf(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %72
34: ; preds = %28
%35 = load i32, i32* %5
%36 = icmp slt i32 %35, 900
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i8*, i8** %3
%39 = call i32 (i8*, i8*, ...) @sprintf(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %71
40: ; preds = %34
%41 = load i32, i32* %5
%42 = icmp slt i32 %41, 1000
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i8*, i8** %3
%45 = call i32 (i8*, i8*, ...) @sprintf(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %70
46: ; preds = %40
%47 = load i32, i32* %5
%48 = icmp slt i32 %47, 1100
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load i8*, i8** %3
%51 = call i32 (i8*, i8*, ...) @sprintf(i8* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %69
52: ; preds = %46
%53 = load i32, i32* %5
%54 = icmp slt i32 %53, 1200
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load i8*, i8** %3
%57 = call i32 (i8*, i8*, ...) @sprintf(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %68
58: ; preds = %52
%59 = load i32, i32* %5
%60 = icmp slt i32 %59, 1800
br i1 %60, label %61, label %64
61: ; preds = %58
%62 = load i8*, i8** %3
%63 = call i32 (i8*, i8*, ...) @sprintf(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %67
64: ; preds = %58
%65 = load i8*, i8** %3
%66 = call i32 (i8*, i8*, ...) @sprintf(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %67
67: ; preds = %64, %61
br label %68
68: ; preds = %67, %55
br label %69
69: ; preds = %68, %49
br label %70
70: ; preds = %69, %43
br label %71
71: ; preds = %70, %37
br label %72
72: ; preds = %71, %31
br label %73
73: ; preds = %72, %25
br label %74
74: ; preds = %73, %18
%75 = load i8*, i8** %3
ret i8* %75
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02d\00"
@.str.1 = [3 x i8] c"61\00"
@.str.2 = [3 x i8] c"62\00"
@.str.3 = [3 x i8] c"63\00"
@.str.4 = [3 x i8] c"64\00"
@.str.5 = [3 x i8] c"65\00"
@.str.6 = [3 x i8] c"66\00"
@.str.7 = [3 x i8] c"67\00"
@.str.8 = [3 x i8] c"68\00"
define i8* @secs_to_tt(i8* returned writeonly %0, i32 %1) {
%3 = tail call i32 @llvm.abs.i32(i32 %1, i1 true)
%4 = icmp ult i32 %3, 21960
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = trunc i32 %3 to i16
%7 = udiv i16 %6, 360
%8 = zext i16 %7 to i32
%9 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %32
10: ; preds = %2
%11 = icmp ult i32 %3, 252000
br i1 %11, label %12, label %13
12: ; preds = %10
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %0, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 3, i1 false)
br label %32
13: ; preds = %10
%14 = icmp ult i32 %3, 288000
br i1 %14, label %15, label %16
15: ; preds = %13
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %0, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 3, i1 false)
br label %32
16: ; preds = %13
%17 = icmp ult i32 %3, 324000
br i1 %17, label %18, label %19
18: ; preds = %16
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %0, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 3, i1 false)
br label %32
19: ; preds = %16
%20 = icmp ult i32 %3, 360000
br i1 %20, label %21, label %22
21: ; preds = %19
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %0, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64 3, i1 false)
br label %32
22: ; preds = %19
%23 = icmp ult i32 %3, 396000
br i1 %23, label %24, label %25
24: ; preds = %22
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %0, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i64 3, i1 false)
br label %32
25: ; preds = %22
%26 = icmp ult i32 %3, 432000
br i1 %26, label %27, label %28
27: ; preds = %25
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %0, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 3, i1 false)
br label %32
28: ; preds = %25
%29 = icmp ult i32 %3, 648000
br i1 %29, label %30, label %31
30: ; preds = %28
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %0, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i64 3, i1 false)
br label %32
31: ; preds = %28
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %0, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i64 3, i1 false)
br label %32
32: ; preds = %12, %18, %24, %30, %31, %27, %21, %15, %5
ret i8* %0
}