#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*/ assert(int);
int /*<<< orphan*/ snprintf(char *, int, char *, int const, ...);
int /*<<< orphan*/ strcpy(char *, char *);
void sec_to_min(char *buff, const int seconds) {
  assert(seconds >= 0);
  if (seconds < 6000) {
    int min, sec;
    min = seconds / 60;
    sec = seconds % 60;
    snprintf(buff, 6, "%02d:%02d", min, sec);
  } else if (seconds < 10000 * 60)
    snprintf(buff, 6, "%4dm", seconds / 60);
  else
    strcpy(buff, "!!!!!");
}


x86 assembly (clang, -O0):
<sec_to_min>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x1770,-0xc(%rbp)
jge    119c <sec_to_min+0x6c>
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    $0x6,%esi
lea    0xe70(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
jmp    11e7 <sec_to_min+0xb7>
cmpl   $0x927c0,-0xc(%rbp)
jge    11d2 <sec_to_min+0xa2>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x6,%esi
lea    0xe44(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
jmp    11e2 <sec_to_min+0xb2>
mov    -0x8(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11e7 <sec_to_min+0xb7>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sec_to_min>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %esi,%edi
not    %edi
shr    $0x1f,%edi
call   1050 <assert@plt>
cmp    $0x176f,%ebp
jg     118a <sec_to_min+0x5a>
movslq %ebp,%rax
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %ebp,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x5,%ecx
add    %eax,%ecx
imul   $0x3c,%ecx,%eax
sub    %eax,%ebp
lea    0xe8e(%rip),%rdx
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %ebp,%r8d
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <snprintf@plt>
cmp    $0x927bf,%ebp
ja     11bd <sec_to_min+0x8d>
mov    %ebp,%eax
mov    $0x88888889,%ecx
imul   %rax,%rcx
shr    $0x25,%rcx
lea    0xe62(%rip),%rdx
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <snprintf@plt>
lea    0xe4b(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%02d:%02d\00"
@.str.1 = [5 x i8] c"%4dm\00"
@.str.2 = [6 x i8] c"!!!!!\00"
define void @sec_to_min(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 6000
br i1 %12, label %13, label %22
13: ; preds = %2
%14 = load i32, i32* %4
%15 = sdiv i32 %14, 60
store i32 %15, i32* %5
%16 = load i32, i32* %4
%17 = srem i32 %16, 60
store i32 %17, i32* %6
%18 = load i8*, i8** %3
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %18, i32 6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20)
br label %34
22: ; preds = %2
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 600000
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i8*, i8** %3
%27 = load i32, i32* %4
%28 = sdiv i32 %27, 60
%29 = call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %26, i32 6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %33
30: ; preds = %22
%31 = load i8*, i8** %3
%32 = call i32 @strcpy(i8* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %30, %25
br label %34
34: ; preds = %33, %13
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%02d:%02d\00"
@.str.1 = [5 x i8] c"%4dm\00"
@.str.2 = [6 x i8] c"!!!!!\00"
define void @sec_to_min(i8* %0, i32 %1) {
%3 = xor i32 %1, -1
%4 = lshr i32 %3, 31
%5 = tail call i32 @assert(i32 %4)
%6 = icmp slt i32 %1, 6000
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = sdiv i32 %1, 60
%9 = srem i32 %1, 60
%10 = tail call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %0, i32 6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
br label %18
11: ; preds = %2
%12 = icmp ult i32 %1, 600000
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = udiv i32 %1, 60
%15 = tail call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %0, i32 6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %18
16: ; preds = %11
%17 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %13, %16, %7
ret void
}