#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 strlen(char *);
char *hydrology_extract_hour(char *measurement_time_string) {
  static char hour[3];
  *hour = '\0';
  if (strlen(measurement_time_string) != 4)
    return hour;
  *hour = *measurement_time_string;
  *(hour + 1) = *(measurement_time_string + 1);
  *(hour + 2) = '\0';
  return hour;
}


x86 assembly (clang, -O0):
<hydrology_extract_hour>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
movb   $0x0,0x2f06(%rip)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
je     1145 <hydrology_extract_hour+0x35>
lea    0x2eed(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1170 <hydrology_extract_hour+0x60>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,0x2ed8(%rip)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,0x2ecc(%rip)
movb   $0x0,0x2ec6(%rip)
lea    0x2ebd(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hydrology_extract_hour>:
push   %rbx
mov    %rdi,%rbx
movb   $0x0,0x2f0e(%rip)
call   1030 <strlen@plt>
cmp    $0x4,%eax
jne    113d <hydrology_extract_hour+0x2d>
mov    (%rbx),%al
mov    %al,0x2efc(%rip)
mov    0x1(%rbx),%al
mov    %al,0x2ef4(%rip)
movb   $0x0,0x2eee(%rip)
lea    0x2ee5(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@hydrology_extract_hour.hour = internal global [3 x i8] zeroinitializer
define i8* @hydrology_extract_hour(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
store i8 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 0)
%4 = load i8*, i8** %3
%5 = call i32 @strlen(i8* %4)
%6 = icmp ne i32 %5, 4
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 0), i8** %2
br label %14
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
store i8 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 0)
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
store i8 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 1)
store i8 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 2)
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 0), i8** %2
br label %14
14: ; preds = %8, %7
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
@hydrology_extract_hour.hour = internal global [3 x i8] zeroinitializer
define i8* @hydrology_extract_hour(i8* %0) {
store i8 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 0)
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 4
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i8, i8* %0
store i8 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 0)
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
store i8 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 1)
store i8 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 2)
br label %8
8: ; preds = %1, %4
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @hydrology_extract_hour.hour, i64 0, i64 0)
}