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


x86 assembly (clang, -O0):
<find_match_int>:
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    11db <find_match_int+0x9b>
mov    -0x8(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1030 <strpbrk@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11cc <find_match_int+0x8c>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11d6 <find_match_int+0x96>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    11db <find_match_int+0x9b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_match_int>:
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    1198 <find_match_int+0x58>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strpbrk@plt>
test   %rax,%rax
je     1193 <find_match_int+0x53>
add    $0x1,%rax
mov    %rax,%rdi
call   1040 <atoi@plt>
jmp    1195 <find_match_int+0x55>
xor    %eax,%eax
mov    %eax,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c":=\00"
define void @find_match_int(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %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 i32 @atoi(i8* %25)
%27 = load i32*, i32** %6
store i32 %26, i32* %27
br label %30
28: ; preds = %17
%29 = load i32*, i32** %6
store i32 0, i32* %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_int(i8* %0, i8* %1, i32* 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 i32 @atoi(i8* %12)
br label %14
14: ; preds = %8, %11
%15 = phi i32 [ %13, %11 ], [ 0, %8 ]
store i32 %15, i32* %2
br label %16
16: ; preds = %14, %3
ret void
}