#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*/ strcpy(char *, char const *const);
int strlen(char const *const);
char *show_time_text(const char *const input) {
  static char output[16];
  switch (strlen(input)) {
  case 4:
  case 5:
    output[0] = input[0];
    output[1] = input[1];
    output[2] = ':';
    output[3] = input[2];
    output[4] = input[3];
    output[5] = input[4];
    output[6] = '\0';
    break;
  default:
    strcpy(output, input);
    break;
  }
  return output;
}


x86 assembly (clang, -O0):
<show_time_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0xfffffffc,%eax
sub    $0x1,%eax
ja     1199 <show_time_text+0x79>
jmp    1146 <show_time_text+0x26>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,0x2eee(%rip)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,0x2ee2(%rip)
movb   $0x3a,0x2edc(%rip)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,0x2ed0(%rip)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%al
mov    %al,0x2ec4(%rip)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%al
mov    %al,0x2eb8(%rip)
movb   $0x0,0x2eb2(%rip)
jmp    11a9 <show_time_text+0x89>
mov    -0x8(%rbp),%rsi
lea    0x2e9c(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2e90(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_time_text>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
and    $0xfffffffe,%eax
cmp    $0x4,%eax
jne    116d <show_time_text+0x4d>
mov    (%rbx),%al
mov    %al,0x2f07(%rip)
mov    0x1(%rbx),%al
mov    %al,0x2eff(%rip)
movb   $0x3a,0x2ef9(%rip)
mov    0x2(%rbx),%al
mov    %al,0x2ef1(%rip)
mov    0x3(%rbx),%al
mov    %al,0x2ee9(%rip)
mov    0x4(%rbx),%al
mov    %al,0x2ee1(%rip)
movb   $0x0,0x2edb(%rip)
jmp    117c <show_time_text+0x5c>
lea    0x2ecc(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0x2ebd(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@show_time_text.output = internal global [16 x i8] zeroinitializer
define i8* @show_time_text(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strlen(i8* %3)
switch i32 %4, label %21 [
i32 4, label %5
i32 5, label %5
]
5: ; preds = %1, %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
store i8 %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 0)
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
store i8 %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 1)
store i8 58, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 2)
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 2
%14 = load i8, i8* %13
store i8 %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 3)
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 3
%17 = load i8, i8* %16
store i8 %17, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 4)
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 4
%20 = load i8, i8* %19
store i8 %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 5)
store i8 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 6)
br label %24
21: ; preds = %1
%22 = load i8*, i8** %2
%23 = call i32 @strcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %21, %5
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 0)
}

LLVM IR (-O2):
@show_time_text.output = internal global [16 x i8] zeroinitializer
define i8* @show_time_text(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = and i32 %2, -2
%4 = icmp eq i32 %3, 4
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = load i8, i8* %0
store i8 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 0)
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
store i8 %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 1)
store i8 58, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 2)
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
store i8 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 3)
%11 = getelementptr inbounds i8, i8* %0, i64 3
%12 = load i8, i8* %11
store i8 %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 4)
%13 = getelementptr inbounds i8, i8* %0, i64 4
%14 = load i8, i8* %13
store i8 %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 5)
store i8 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 6)
br label %17
15: ; preds = %1
%16 = tail call i32 @strcpy(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 0), i8* %0)
br label %17
17: ; preds = %15, %5
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @show_time_text.output, i64 0, i64 0)
}