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


x86 assembly (clang, -O0):
<find_match_double>:
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    11e0 <find_match_double+0xa0>
mov    -0x8(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1040 <strpbrk@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11d0 <find_match_double+0x90>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11db <find_match_double+0x9b>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    11e0 <find_match_double+0xa0>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_match_double>:
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    119d <find_match_double+0x5d>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strpbrk@plt>
test   %rax,%rax
je     1195 <find_match_double+0x55>
add    $0x1,%rax
mov    %rax,%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
jmp    1198 <find_match_double+0x58>
xorps  %xmm0,%xmm0
movsd  %xmm0,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

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