#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 *, char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
scalar_t__ timlib_strcmp(char *, char *);
int timlib_strlen(char *);
void date_place_colon_in_time(char *time_string) {
  char hour[3];
  char minute[3];
  if (timlib_strlen(time_string) != 4)
    return;
  if (timlib_strcmp(time_string, "null") == 0)
    return;
  strncpy(hour, time_string, 2);
  *(hour + 2) = '\0';
  strncpy(minute, time_string + 2, 2);
  *(minute + 2) = '\0';
  sprintf(time_string, "%s:%s", hour, minute);
}


x86 assembly (clang, -O0):
<date_place_colon_in_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <timlib_strlen@plt>
cmp    $0x4,%eax
je     1163 <date_place_colon_in_time+0x23>
jmp    11ca <date_place_colon_in_time+0x8a>
mov    -0x8(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1060 <timlib_strcmp@plt>
cmp    $0x0,%rax
jne    1182 <date_place_colon_in_time+0x42>
jmp    11ca <date_place_colon_in_time+0x8a>
lea    -0xb(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x9(%rbp)
lea    -0xe(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x2,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xb(%rbp),%rdx
lea    -0xe(%rbp),%rcx
lea    0xe40(%rip),%rsi
call   1050 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_place_colon_in_time>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1040 <timlib_strlen@plt>
cmp    $0x4,%eax
jne    11b4 <date_place_colon_in_time+0x74>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1060 <timlib_strcmp@plt>
test   %rax,%rax
je     11b4 <date_place_colon_in_time+0x74>
lea    0xd(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0xf(%rsp)
lea    0x2(%rbx),%rsi
lea    0xa(%rsp),%r15
mov    %r15,%rdi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0xc(%rsp)
lea    0xe5f(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
call   1050 <sprintf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"null\00"
@.str.1 = [6 x i8] c"%s:%s\00"
define void @date_place_colon_in_time(i8* %0) {
%2 = alloca i8*
%3 = alloca [3 x i8]
%4 = alloca [3 x i8]
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @timlib_strlen(i8* %5)
%7 = icmp ne i32 %6, 4
br i1 %7, label %8, label %9
8: ; preds = %1
br label %30
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i64 @timlib_strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
br label %30
14: ; preds = %9
%15 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%16 = load i8*, i8** %2
%17 = call i32 @strncpy(i8* %15, i8* %16, i32 2)
%18 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%19 = getelementptr inbounds i8, i8* %18, i64 2
store i8 0, i8* %19
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = call i32 @strncpy(i8* %20, i8* %22, i32 2)
%24 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%25 = getelementptr inbounds i8, i8* %24, i64 2
store i8 0, i8* %25
%26 = load i8*, i8** %2
%27 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%28 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%29 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %27, i8* %28)
br label %30
30: ; preds = %14, %13, %8
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"null\00"
@.str.1 = [6 x i8] c"%s:%s\00"
define void @date_place_colon_in_time(i8* %0) {
%2 = alloca [3 x i8]
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%6 = tail call i32 @timlib_strlen(i8* %0)
%7 = icmp eq i32 %6, 4
br i1 %7, label %8, label %18
8: ; preds = %1
%9 = tail call i64 @timlib_strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %8
%12 = call i32 @strncpy(i8* %4, i8* %0, i32 2)
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
store i8 0, i8* %13
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = call i32 @strncpy(i8* %5, i8* %14, i32 2)
%16 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
store i8 0, i8* %16
%17 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %5)
br label %18
18: ; preds = %8, %1, %11
ret void
}