#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, ...);
void psecs(long l, register char *cp) {
  register int i;
  i = l / 3600;
  if (i) {
    sprintf(cp, "%d:", i);
    {
      while (*cp)
        cp++;
    };
    i = l % 3600;
    sprintf(cp, "%d%d", (i / 60) / 10, (i / 60) % 10);
    {
      while (*cp)
        cp++;
    };
  } else {
    i = l;
    sprintf(cp, "%d", i / 60);
    {
      while (*cp)
        cp++;
    };
  }
  i %= 60;
  *cp++ = ':';
  sprintf(cp, "%d%d", i / 10, i % 10);
}


x86 assembly (clang, -O0):
<psecs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11e4 <psecs+0xd4>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116e <psecs+0x5e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1150 <psecs+0x40>
mov    -0x8(%rbp),%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x18(%rbp),%edx
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11df <psecs+0xcf>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11c1 <psecs+0xb1>
jmp    122d <psecs+0x11d>
mov    -0x8(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1228 <psecs+0x118>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    120a <psecs+0xfa>
jmp    122d <psecs+0x11d>
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x3a,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x1c(%rbp),%edx
lea    0xd8e(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psecs>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movabs $0x48d159e26af37c05,%rcx
59 d1 48
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xa,%rdx
add    %rax,%rdx
test   %edx,%edx
je     11ec <psecs+0xdc>
imul   $0xe10,%rdx,%rax
sub    %rax,%r14
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
add    $0xffffffffffffffff,%rbx
nop
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1160 <psecs+0x50>
movswl %r14w,%ecx
imul   $0xffff8889,%ecx,%eax
shr    $0x10,%eax
add    %r14d,%eax
movzwl %ax,%edx
movswl %dx,%eax
shr    $0xf,%edx
sar    $0x5,%eax
add    %edx,%eax
imul   $0xffffda75,%ecx,%ecx
shr    $0x10,%ecx
add    %r14d,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
sar    $0x9,%edx
add    %ecx,%edx
movswl %dx,%edx
movsbl %al,%ecx
imul   $0x67,%ecx,%ecx
movzwl %cx,%ecx
movswl %cx,%esi
shr    $0xf,%ecx
shr    $0xa,%esi
add    %cl,%sil
movzbl %sil,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movsbl %al,%ecx
lea    0xe35(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
add    $0xffffffffffffffff,%rbx
nopl   (%rax)
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    11e0 <psecs+0xd0>
jmp    122a <psecs+0x11a>
movslq %r14d,%rdx
imul   $0xffffffff88888889,%rdx,%rax
shr    $0x20,%rax
add    %eax,%edx
mov    %edx,%eax
shr    $0x1f,%eax
sar    $0x5,%edx
add    %eax,%edx
lea    0xdf9(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1220 <psecs+0x110>
movslq %r14d,%rax
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x3c,%ecx,%ecx
sub    %ecx,%eax
movb   $0x3a,(%rbx)
add    $0x1,%rbx
movsbl %al,%ecx
imul   $0x67,%ecx,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
shr    $0xa,%edx
add    %cl,%dl
movsbl %dl,%edx
movzbl %dl,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movsbl %al,%ecx
lea    0xd89(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d:\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [3 x i8] c"%d\00"
define void @psecs(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i32
store i64 %0, i64* %3
store i8* %1, i8** %4
%6 = load i64, i64* %3
%7 = sdiv i64 %6, 3600
%8 = trunc i64 %7 to i32
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %42
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i32, i32* %5
%14 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %19, %11
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = icmp ne i8 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
br label %15
22: ; preds = %15
%23 = load i64, i64* %3
%24 = srem i64 %23, 3600
%25 = trunc i64 %24 to i32
store i32 %25, i32* %5
%26 = load i8*, i8** %4
%27 = load i32, i32* %5
%28 = sdiv i32 %27, 60
%29 = sdiv i32 %28, 10
%30 = load i32, i32* %5
%31 = sdiv i32 %30, 60
%32 = srem i32 %31, 10
%33 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %32)
br label %34
34: ; preds = %38, %22
%35 = load i8*, i8** %4
%36 = load i8, i8* %35
%37 = icmp ne i8 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %4
br label %34
41: ; preds = %34
br label %57
42: ; preds = %2
%43 = load i64, i64* %3
%44 = trunc i64 %43 to i32
store i32 %44, i32* %5
%45 = load i8*, i8** %4
%46 = load i32, i32* %5
%47 = sdiv i32 %46, 60
%48 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %53, %42
%50 = load i8*, i8** %4
%51 = load i8, i8* %50
%52 = icmp ne i8 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %49
%54 = load i8*, i8** %4
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %4
br label %49
56: ; preds = %49
br label %57
57: ; preds = %56, %41
%58 = load i32, i32* %5
%59 = srem i32 %58, 60
store i32 %59, i32* %5
%60 = load i8*, i8** %4
%61 = getelementptr inbounds i8, i8* %60, i32 1
store i8* %61, i8** %4
store i8 58, i8* %60
%62 = load i8*, i8** %4
%63 = load i32, i32* %5
%64 = sdiv i32 %63, 10
%65 = load i32, i32* %5
%66 = srem i32 %65, 10
%67 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %64, i32 %66)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d:\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [3 x i8] c"%d\00"
define void @psecs(i64 %0, i8* nocapture %1) {
%3 = sdiv i64 %0, 3600
%4 = srem i64 %0, 3600
%5 = trunc i64 %3 to i32
%6 = icmp eq i32 %5, 0
br i1 %6, label %28, label %7
7: ; preds = %2
%8 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %9
9: ; preds = %9, %7
%10 = phi i8* [ %1, %7 ], [ %13, %9 ]
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
%13 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %12, label %14, label %9
14: ; preds = %9
%15 = trunc i64 %4 to i16
%16 = sdiv i16 %15, 60
%17 = sdiv i16 %15, 600
%18 = sext i16 %17 to i32
%19 = trunc i16 %16 to i8
%20 = srem i8 %19, 10
%21 = sext i8 %20 to i32
%22 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %21)
br label %23
23: ; preds = %23, %14
%24 = phi i8* [ %10, %14 ], [ %27, %23 ]
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
%27 = getelementptr inbounds i8, i8* %24, i64 1
br i1 %26, label %37, label %23
28: ; preds = %2
%29 = trunc i64 %0 to i32
%30 = sdiv i32 %29, 60
%31 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %32, %28
%33 = phi i8* [ %1, %28 ], [ %36, %32 ]
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 0
%36 = getelementptr inbounds i8, i8* %33, i64 1
br i1 %35, label %39, label %32
37: ; preds = %23
%38 = trunc i64 %4 to i32
br label %39
39: ; preds = %32, %37
%40 = phi i8* [ %24, %37 ], [ %33, %32 ]
%41 = phi i32 [ %38, %37 ], [ %29, %32 ]
%42 = srem i32 %41, 60
%43 = getelementptr inbounds i8, i8* %40, i64 1
store i8 58, i8* %40
%44 = trunc i32 %42 to i8
%45 = sdiv i8 %44, 10
%46 = sext i8 %45 to i32
%47 = srem i8 %44, 10
%48 = sext i8 %47 to i32
%49 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* %43, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %46, i32 %48)
ret void
}