#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 a2i(char const **);
int atoi(char const *);
char *strchr(char const *, char);
void parse_time(char const *str, int *hour, int *min, int *sec) {
  *hour = a2i(&str);
  if ((str = strchr(str, ':')) == NULL)
    *min = *sec = 0;
  else {
    ++str;
    *min = a2i(&str);
    *sec = ((str = strchr(str, ':')) == NULL) ? 0 : atoi(++str);
  }
}


x86 assembly (clang, -O0):
<parse_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <a2i@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    118e <parse_time+0x5e>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    11ee <parse_time+0xbe>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <a2i@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    11d1 <parse_time+0xa1>
xor    %eax,%eax
mov    %eax,-0x24(%rbp)
jmp    11e5 <parse_time+0xb5>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x8(%rbp)
call   1050 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_time>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <a2i@plt>
mov    %eax,(%rbx)
mov    0x8(%rsp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11a4 <parse_time+0x74>
add    $0x1,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <a2i@plt>
mov    %eax,(%r15)
mov    0x8(%rsp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11b4 <parse_time+0x84>
add    $0x1,%rax
mov    %rax,0x8(%rsp)
mov    %rax,%rdi
call   1050 <atoi@plt>
jmp    11b6 <parse_time+0x86>
movl   $0x0,(%r14)
movl   $0x0,(%r15)
jmp    11b9 <parse_time+0x89>
xor    %eax,%eax
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @parse_time(i8* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = call i32 @a2i(i8** %5)
%10 = load i32*, i32** %6
store i32 %9, i32* %10
%11 = load i8*, i8** %5
%12 = call i8* @strchr(i8* %11, i8 signext 58)
store i8* %12, i8** %5
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %17
14: ; preds = %4
%15 = load i32*, i32** %8
store i32 0, i32* %15
%16 = load i32*, i32** %7
store i32 0, i32* %16
br label %33
17: ; preds = %4
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %5
%20 = call i32 @a2i(i8** %5)
%21 = load i32*, i32** %7
store i32 %20, i32* %21
%22 = load i8*, i8** %5
%23 = call i8* @strchr(i8* %22, i8 signext 58)
store i8* %23, i8** %5
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %26
25: ; preds = %17
br label %30
26: ; preds = %17
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %5
%29 = call i32 @atoi(i8* %28)
br label %30
30: ; preds = %26, %25
%31 = phi i32 [ 0, %25 ], [ %29, %26 ]
%32 = load i32*, i32** %8
store i32 %31, i32* %32
br label %33
33: ; preds = %30, %14
ret void
}

LLVM IR (-O2):
define void @parse_time(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = alloca i8*
store i8* %0, i8** %5
%6 = call i32 @a2i(i8** %5)
store i32 %6, i32* %1
%7 = load i8*, i8** %5
%8 = call i8* @strchr(i8* dereferenceable(1) %7, i8 signext 58)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %4
store i32 0, i32* %3
store i32 0, i32* %2
br label %22
11: ; preds = %4
%12 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %12, i8** %5
%13 = call i32 @a2i(i8** %5)
store i32 %13, i32* %2
%14 = load i8*, i8** %5
%15 = call i8* @strchr(i8* dereferenceable(1) %14, i8 signext 58)
%16 = icmp eq i8* %15, null
br i1 %16, label %20, label %17
17: ; preds = %11
%18 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %18, i8** %5
%19 = call i32 @atoi(i8* %18)
br label %20
20: ; preds = %11, %17
%21 = phi i32 [ %19, %17 ], [ 0, %11 ]
store i32 %21, i32* %3
br label %22
22: ; preds = %20, %10
ret void
}