#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*/ remove_leading_whitespace(char *);
char *strpbrk(char *, char *);
scalar_t__ strstr(char *, char *);
unsigned long long strtoll(char *, int /*<<< orphan*/ *, int);
void find_match_ll(char *buffer, char *match, unsigned long long *result) {
  char *position;
  remove_leading_whitespace(buffer);
  if (strstr(buffer, match) == strstr(buffer, buffer)) {
    position = strpbrk(buffer, ":=");
    if (position != NULL) {
      position += 1;
      *result = strtoll(position, NULL, 10);
    } else
      *result = 0;
  }
}


x86 assembly (clang, -O0):
<find_match_ll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <remove_leading_whitespace@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strstr@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jne    11e7 <find_match_ll+0xa7>
mov    -0x8(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1040 <strpbrk@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11d7 <find_match_ll+0x97>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    11e2 <find_match_ll+0xa2>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
jmp    11e7 <find_match_ll+0xa7>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_match_ll>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1060 <remove_leading_whitespace@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strstr@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1050 <strstr@plt>
cmp    %rax,%r15
jne    119f <find_match_ll+0x5f>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strpbrk@plt>
test   %rax,%rax
je     119a <find_match_ll+0x5a>
add    $0x1,%rax
mov    %rax,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtoll@plt>
jmp    119c <find_match_ll+0x5c>
xor    %eax,%eax
mov    %rax,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c":=\00"
define void @find_match_ll(i8* %0, i8* %1, i64* nocapture writeonly %2) {
%4 = tail call i32 @remove_leading_whitespace(i8* %0)
%5 = tail call i64 @strstr(i8* %0, i8* %1)
%6 = tail call i64 @strstr(i8* %0, i8* %0)
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %16
8: ; preds = %3
%9 = tail call i8* @strpbrk(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = tail call i64 @strtoll(i8* nocapture %12, i32* null, i32 10)
br label %14
14: ; preds = %8, %11
%15 = phi i64 [ %13, %11 ], [ 0, %8 ]
store i64 %15, i64* %2
br label %16
16: ; preds = %14, %3
ret void
}