#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 parse_dec(char const *, int);
int strtoul(char const *, char **, int);
int parse_time(const char *s) {
  int seconds, frames = 0;
  seconds = strtoul(s, (char **)&s, 10);
  if (*s)
    if (*s != 'F' || (frames = parse_dec(s + 1, 2)) < 0)
      return -1;
  return seconds * 25 + frames;
}


x86 assembly (clang, -O0):
<parse_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1194 <parse_time+0x74>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x46,%eax
jne    1183 <parse_time+0x63>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    $0x2,%esi
call   1030 <parse_dec@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    118f <parse_time+0x6f>
movl   $0xffffffff,-0x4(%rbp)
jmp    119e <parse_time+0x7e>
jmp    1194 <parse_time+0x74>
imul   $0x19,-0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_time>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rsi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %eax,%ebx
mov    (%rsp),%rdi
mov    (%rdi),%al
test   %al,%al
je     115d <parse_time+0x3d>
mov    $0xffffffff,%ebp
cmp    $0x46,%al
jne    1167 <parse_time+0x47>
add    $0x1,%rdi
mov    $0x2,%esi
call   1030 <parse_dec@plt>
test   %eax,%eax
jns    115f <parse_time+0x3f>
jmp    1167 <parse_time+0x47>
xor    %eax,%eax
lea    (%rbx,%rbx,4),%ecx
lea    (%rcx,%rcx,4),%ebp
add    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @parse_time(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @strtoul(i8* %0, i8** %2, i32 10)
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
switch i8 %5, label %14 [
i8 0, label %10
i8 70, label %6
]
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %4, i64 1
%8 = tail call i32 @parse_dec(i8* %7, i32 2)
%9 = icmp slt i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %1, %6
%11 = phi i32 [ %8, %6 ], [ 0, %1 ]
%12 = mul nsw i32 %3, 25
%13 = add nsw i32 %11, %12
br label %14
14: ; preds = %6, %1, %10
%15 = phi i32 [ %13, %10 ], [ -1, %1 ], [ -1, %6 ]
ret i32 %15
}