#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 /*<<< orphan*/ sscanf(char *, char *, unsigned long long *);
char *strstr(char *, char *);
unsigned long long parse(char *s, char *match) {
  char *s1 = strstr(s, match);
  unsigned long long ret;
  if (s1 == NULL)
    return 0LL;
  s1 += 2;
  if (*s1++ != ':')
    return 0LL;
  sscanf(s1, "%llu", &ret);
  return ret;
}


x86 assembly (clang, -O0):
<parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1159 <parse+0x39>
movq   $0x0,-0x8(%rbp)
jmp    11a9 <parse+0x89>
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     118d <parse+0x6d>
movq   $0x0,-0x8(%rbp)
jmp    11a9 <parse+0x89>
mov    -0x20(%rbp),%rdi
lea    0xe68(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse>:
push   %rax
call   1040 <strstr@plt>
test   %rax,%rax
je     114d <parse+0x2d>
cmpb   $0x3a,0x2(%rax)
jne    114d <parse+0x2d>
add    $0x3,%rax
lea    0xec4(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1030 <sscanf@plt>
mov    (%rsp),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%llu\00"
define i64 @parse(i8* %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i8* @strstr(i8* %8, i8* %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %2
store i64 0, i64* %3
br label %27
14: ; preds = %2
%15 = load i8*, i8** %6
%16 = getelementptr inbounds i8, i8* %15, i64 2
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %6
%19 = load i8, i8* %17
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 58
br i1 %21, label %22, label %23
22: ; preds = %14
store i64 0, i64* %3
br label %27
23: ; preds = %14
%24 = load i8*, i8** %6
%25 = call i32 @sscanf(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %7)
%26 = load i64, i64* %7
store i64 %26, i64* %3
br label %27
27: ; preds = %23, %22, %13
%28 = load i64, i64* %3
ret i64 %28
}

LLVM IR (-O2):
@.str = [5 x i8] c"%llu\00"
define i64 @parse(i8* %0, i8* nocapture %1) {
%3 = alloca i64
%4 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%5 = bitcast i64* %3 to i8*
%6 = icmp eq i8* %4, null
br i1 %6, label %15, label %7
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %4, i64 2
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 58
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %4, i64 3
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %3)
%14 = load i64, i64* %3
br label %15
15: ; preds = %7, %2, %11
%16 = phi i64 [ %14, %11 ], [ 0, %2 ], [ 0, %7 ]
ret i64 %16
}