#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 NextIntegerFromString(char **, long *);
int NextTimeControlFromString(char **str, long *value) {
  long temp;
  int result = NextIntegerFromString(str, &temp);
  if (result == 0) {
    *value = temp * 60;
    if (**str == ':') {
      (*str)++;
      result = NextIntegerFromString(str, &temp);
      *value += temp;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<NextTimeControlFromString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <NextIntegerFromString@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    118a <NextTimeControlFromString+0x7a>
imul   $0x3c,-0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1185 <NextTimeControlFromString+0x75>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <NextIntegerFromString@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
jmp    118a <NextTimeControlFromString+0x7a>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NextTimeControlFromString>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rsi
call   1030 <NextIntegerFromString@plt>
test   %eax,%eax
jne    1151 <NextTimeControlFromString+0x41>
imul   $0x3c,(%rsp),%rax
mov    %rax,(%r14)
mov    (%rbx),%rcx
xor    %eax,%eax
cmpb   $0x3a,(%rcx)
jne    1151 <NextTimeControlFromString+0x41>
add    $0x1,%rcx
mov    %rcx,(%rbx)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <NextIntegerFromString@plt>
mov    (%rsp),%rcx
add    %rcx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @NextTimeControlFromString(i8** %0, i64* %1) {
%3 = alloca i8**
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i32
store i8** %0, i8*** %3
store i64* %1, i64** %4
%7 = load i8**, i8*** %3
%8 = call i32 @NextIntegerFromString(i8** %7, i64* %5)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %31
11: ; preds = %2
%12 = load i64, i64* %5
%13 = mul nsw i64 %12, 60
%14 = load i64*, i64** %4
store i64 %13, i64* %14
%15 = load i8**, i8*** %3
%16 = load i8*, i8** %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 58
br i1 %19, label %20, label %30
20: ; preds = %11
%21 = load i8**, i8*** %3
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %21
%24 = load i8**, i8*** %3
%25 = call i32 @NextIntegerFromString(i8** %24, i64* %5)
store i32 %25, i32* %6
%26 = load i64, i64* %5
%27 = load i64*, i64** %4
%28 = load i64, i64* %27
%29 = add nsw i64 %28, %26
store i64 %29, i64* %27
br label %30
30: ; preds = %20, %11
br label %31
31: ; preds = %30, %2
%32 = load i32, i32* %6
ret i32 %32
}

LLVM IR (-O2):
define i32 @NextTimeControlFromString(i8** %0, i64* nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = call i32 @NextIntegerFromString(i8** %0, i64* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %19
7: ; preds = %2
%8 = load i64, i64* %3
%9 = mul nsw i64 %8, 60
store i64 %9, i64* %1
%10 = load i8*, i8** %0
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 58
br i1 %12, label %13, label %19
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %14, i8** %0
%15 = call i32 @NextIntegerFromString(i8** %0, i64* %3)
%16 = load i64, i64* %3
%17 = load i64, i64* %1
%18 = add nsw i64 %17, %16
store i64 %18, i64* %1
br label %19
19: ; preds = %7, %13, %2
%20 = phi i32 [ %15, %13 ], [ 0, %7 ], [ %5, %2 ]
ret i32 %20
}