#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 sscanf(char *, char *, float *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int processFloatVar(char *buf, char *matchStr, float *varp) {
  int retVal = 0;
  int len = strlen(matchStr);
  int varCount;
  float temp = 0;
  if (strncmp(buf, matchStr, len) == 0) {
    varCount = sscanf(&buf[len + 1], "%f", &temp);
    if (varCount == 1)
      *varp = temp;
    retVal = 1;
  }
  return (retVal);
}


x86 assembly (clang, -O0):
<processFloatVar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11b9 <processFloatVar+0x89>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%eax
add    $0x1,%eax
cltq
add    %rax,%rdi
lea    0xe71(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <sscanf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jne    11b2 <processFloatVar+0x82>
movss  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processFloatVar>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
movl   $0x0,0x4(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    119c <processFloatVar+0x6c>
movslq %ebp,%rax
lea    (%rax,%r15,1),%rdi
add    $0x1,%rdi
lea    0xe85(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1050 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
jne    119c <processFloatVar+0x6c>
movss  0x4(%rsp),%xmm0
movss  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define i32 @processFloatVar(i8* %0, i8* %1, float* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
store i8* %0, i8** %4
store i8* %1, i8** %5
store float* %2, float** %6
store i32 0, i32* %7
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %8
store float 0.000000e+00, float* %10
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = load i32, i32* %8
%16 = call i64 @strncmp(i8* %13, i8* %14, i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %31
18: ; preds = %3
%19 = load i8*, i8** %4
%20 = load i32, i32* %8
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %10)
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %18
%28 = load float, float* %10
%29 = load float*, float** %6
store float %28, float* %29
br label %30
30: ; preds = %27, %18
store i32 1, i32* %7
br label %31
31: ; preds = %30, %3
%32 = load i32, i32* %7
ret i32 %32
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i32 @processFloatVar(i8* %0, i8* %1, float* nocapture writeonly %2) {
%4 = alloca float
%5 = tail call i32 @strlen(i8* %1)
%6 = bitcast float* %4 to i8*
store float 0.000000e+00, float* %4
%7 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %3
%10 = add nsw i32 %5, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %4)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = load float, float* %4
store float %16, float* %2
br label %17
17: ; preds = %9, %15, %3
%18 = phi i32 [ 0, %3 ], [ 1, %15 ], [ 1, %9 ]
ret i32 %18
}