#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, int, int);
int /*<<< orphan*/ strcpy(char *, char *);
void SetTimeString(char *str, int intTime) {
  if (intTime >= 0) {
    sprintf(str, "%02d:%02d:%02d", ((intTime / 3600) % 60),
            ((intTime / 60) % 60), (intTime % 60));
  } else {
    strcpy(str, "NOT_IMPLEMENTED");
  }
}


x86 assembly (clang, -O0):
<SetTimeString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     118a <SetTimeString+0x6a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0xc(%rbp),%eax
mov    $0x3c,%esi
cltd
idiv   %esi
mov    %edx,%r8d
mov    -0x10(%rbp),%edx
lea    0xe80(%rip),%rsi
call   1040 <sprintf@plt>
jmp    119a <SetTimeString+0x7a>
mov    -0x8(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetTimeString>:
test   %esi,%esi
js     1172 <SetTimeString+0x52>
mov    %esi,%r8d
mov    %esi,%ecx
mov    $0x91a2b3c5,%edx
imul   %rcx,%rdx
shr    $0x2b,%rdx
mov    $0x88888889,%eax
mov    %rdx,%rsi
imul   %rax,%rsi
shr    $0x25,%rsi
imul   $0x3c,%esi,%esi
sub    %esi,%edx
imul   %rax,%rcx
shr    $0x25,%rcx
imul   %rcx,%rax
shr    $0x25,%rax
imul   $0x3c,%eax,%eax
imul   $0x3c,%ecx,%esi
sub    %eax,%ecx
sub    %esi,%r8d
lea    0xe93(%rip),%rsi
jmp    1040 <sprintf@plt>
lea    0xe96(%rip),%rsi
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%02d:%02d:%02d\00"
@.str.1 = [16 x i8] c"NOT_IMPLEMENTED\00"
define void @SetTimeString(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = sdiv i32 %9, 3600
%11 = srem i32 %10, 60
%12 = load i32, i32* %4
%13 = sdiv i32 %12, 60
%14 = srem i32 %13, 60
%15 = load i32, i32* %4
%16 = srem i32 %15, 60
%17 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14, i32 %16)
br label %21
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %18, %7
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%02d:%02d:%02d\00"
@.str.1 = [16 x i8] c"NOT_IMPLEMENTED\00"
define void @SetTimeString(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, -1
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = udiv i32 %1, 3600
%6 = urem i32 %5, 60
%7 = udiv i32 %1, 60
%8 = urem i32 %7, 60
%9 = urem i32 %1, 60
%10 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8, i32 %9)
br label %13
11: ; preds = %2
%12 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %4
ret void
}