#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 *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ trim_character(char *, char, char *);
char *hydrology_trim_time(char *measurement_time_string) {
  char buffer[128];
  strcpy(buffer, measurement_time_string);
  trim_character(measurement_time_string, ':', buffer);
  if (strlen(measurement_time_string) == 3) {
    strcpy(buffer, measurement_time_string);
    sprintf(measurement_time_string, "0%s", measurement_time_string);
  }
  *(measurement_time_string + 4) = '\0';
  return measurement_time_string;
}


x86 assembly (clang, -O0):
<hydrology_trim_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rdx
mov    $0x3a,%esi
call   1050 <trim_character@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x3,%eax
jne    11aa <hydrology_trim_time+0x6a>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe5b(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%rax
movb   $0x0,0x4(%rax)
mov    -0x8(%rbp),%rax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hydrology_trim_time>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x3a,%esi
mov    %r14,%rdx
call   1050 <trim_character@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x3,%eax
jne    1195 <hydrology_trim_time+0x55>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
mov    %rbx,%rdx
call   1060 <sprintf@plt>
movb   $0x0,0x4(%rbx)
mov    %rbx,%rax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"0%s\00"
define i8* @hydrology_trim_time(i8* %0) {
%2 = alloca i8*
%3 = alloca [128 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @strcpy(i8* %4, i8* %5)
%7 = load i8*, i8** %2
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%9 = call i32 @trim_character(i8* %7, i8 signext 58, i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 @strlen(i8* %10)
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %20
13: ; preds = %1
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%15 = load i8*, i8** %2
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i8*, i8** %2
%18 = load i8*, i8** %2
%19 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %13, %1
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 4
store i8 0, i8* %22
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
@.str = [4 x i8] c"0%s\00"
define i8* @hydrology_trim_time(i8* returned %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = call i32 @trim_character(i8* %0, i8 signext 58, i8* %3)
%6 = call i32 @strlen(i8* %0)
%7 = icmp eq i32 %6, 3
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @strcpy(i8* %3, i8* %0)
%10 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %11
11: ; preds = %8, %1
%12 = getelementptr inbounds i8, i8* %0, i64 4
store i8 0, i8* %12
ret i8* %0
}