#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 ASTIL_ParseInt(char const *, int *);
int ASTILCover_ParseTimestamp(const char *s, int *pos) {
  int minutes = ASTIL_ParseInt(s, pos);
  if (minutes >= 0 && s[(*pos)++] == ':') {
    int seconds = ASTIL_ParseInt(s, pos);
    if (seconds >= 0)
      return 60 * minutes + seconds;
  }
  return -1;
}


x86 assembly (clang, -O0):
<ASTILCover_ParseTimestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <ASTIL_ParseInt@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     1189 <ASTILCover_ParseTimestamp+0x79>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rdx
mov    (%rdx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,(%rdx)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
jne    1189 <ASTILCover_ParseTimestamp+0x79>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <ASTIL_ParseInt@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     1184 <ASTILCover_ParseTimestamp+0x74>
imul   $0x3c,-0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1190 <ASTILCover_ParseTimestamp+0x80>
jmp    1189 <ASTILCover_ParseTimestamp+0x79>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASTILCover_ParseTimestamp>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <ASTIL_ParseInt@plt>
test   %eax,%eax
js     114c <ASTILCover_ParseTimestamp+0x3c>
mov    %eax,%r14d
movslq (%rbx),%rax
lea    0x1(%rax),%ecx
mov    %ecx,(%rbx)
cmpb   $0x3a,0x0(%rbp,%rax,1)
jne    114c <ASTILCover_ParseTimestamp+0x3c>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <ASTIL_ParseInt@plt>
test   %eax,%eax
js     114c <ASTILCover_ParseTimestamp+0x3c>
imul   $0x3c,%r14d,%ecx
add    %ecx,%eax
jmp    1151 <ASTILCover_ParseTimestamp+0x41>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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