#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 *, unsigned char, unsigned char,
                           unsigned char);
int eb_tim_to_str(unsigned char hh, unsigned char mm, unsigned char ss,
                  char *tgt) {
  if (hh >= 0x00 && hh <= 0x17 && mm >= 0x00 && mm <= 0x3B && ss >= 0x00 &&
      ss <= 0x3B)
    sprintf(tgt, "%02d:%02d:%02d", hh, mm, ss);
  else
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<eb_tim_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %dl,-0x6(%rbp)
mov    %al,-0x7(%rbp)
mov    %rcx,-0x10(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x0,%eax
jl     11a2 <eb_tim_to_str+0x92>
movzbl -0x5(%rbp),%eax
cmp    $0x17,%eax
jg     11a2 <eb_tim_to_str+0x92>
movzbl -0x6(%rbp),%eax
cmp    $0x0,%eax
jl     11a2 <eb_tim_to_str+0x92>
movzbl -0x6(%rbp),%eax
cmp    $0x3b,%eax
jg     11a2 <eb_tim_to_str+0x92>
movzbl -0x7(%rbp),%eax
cmp    $0x0,%eax
jl     11a2 <eb_tim_to_str+0x92>
movzbl -0x7(%rbp),%eax
cmp    $0x3b,%eax
jg     11a2 <eb_tim_to_str+0x92>
mov    -0x10(%rbp),%rdi
mov    -0x5(%rbp),%cl
mov    -0x6(%rbp),%al
lea    0xe73(%rip),%rsi
movzbl %cl,%edx
movzbl %al,%ecx
movzbl -0x7(%rbp),%r8d
call   1030 <sprintf@plt>
jmp    11ae <eb_tim_to_str+0x9e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b5 <eb_tim_to_str+0xa5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eb_tim_to_str>:
mov    $0xffffffff,%eax
cmp    $0x17,%dil
ja     114d <eb_tim_to_str+0x3d>
cmp    $0x3b,%sil
ja     114d <eb_tim_to_str+0x3d>
cmp    $0x3b,%dl
ja     114d <eb_tim_to_str+0x3d>
push   %rax
movzbl %dil,%eax
movzbl %sil,%r9d
movzbl %dl,%r8d
lea    0xec6(%rip),%rsi
mov    %rcx,%rdi
mov    %eax,%edx
mov    %r9d,%ecx
call   1030 <sprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%02d:%02d:%02d\00"
define i32 @eb_tim_to_str(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8*
store i8 %0, i8* %6
store i8 %1, i8* %7
store i8 %2, i8* %8
store i8* %3, i8** %9
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %39
13: ; preds = %4
%14 = load i8, i8* %6
%15 = zext i8 %14 to i32
%16 = icmp sle i32 %15, 23
br i1 %16, label %17, label %39
17: ; preds = %13
%18 = load i8, i8* %7
%19 = zext i8 %18 to i32
%20 = icmp sge i32 %19, 0
br i1 %20, label %21, label %39
21: ; preds = %17
%22 = load i8, i8* %7
%23 = zext i8 %22 to i32
%24 = icmp sle i32 %23, 59
br i1 %24, label %25, label %39
25: ; preds = %21
%26 = load i8, i8* %8
%27 = zext i8 %26 to i32
%28 = icmp sge i32 %27, 0
br i1 %28, label %29, label %39
29: ; preds = %25
%30 = load i8, i8* %8
%31 = zext i8 %30 to i32
%32 = icmp sle i32 %31, 59
br i1 %32, label %33, label %39
33: ; preds = %29
%34 = load i8*, i8** %9
%35 = load i8, i8* %6
%36 = load i8, i8* %7
%37 = load i8, i8* %8
%38 = call i32 @sprintf(i8* %34, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8 zeroext %35, i8 zeroext %36, i8 zeroext %37)
br label %40
39: ; preds = %29, %25, %21, %17, %13, %4
store i32 -1, i32* %5
br label %41
40: ; preds = %33
store i32 0, i32* %5
br label %41
41: ; preds = %40, %39
%42 = load i32, i32* %5
ret i32 %42
}

LLVM IR (-O2):
@.str = [15 x i8] c"%02d:%02d:%02d\00"
define i32 @eb_tim_to_str(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8* nocapture writeonly %3) {
%5 = icmp ult i8 %0, 24
%6 = icmp ult i8 %1, 60
%7 = and i1 %5, %6
%8 = icmp ult i8 %2, 60
%9 = and i1 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8 zeroext %0, i8 zeroext %1, i8 zeroext %2)
br label %12
12: ; preds = %4, %10
%13 = phi i32 [ 0, %10 ], [ -1, %4 ]
ret i32 %13
}