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


x86 assembly (clang, -O0):
<processNumericVar>:
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)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11b4 <processNumericVar+0x84>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%eax
add    $0x1,%eax
cltq
add    %rax,%rdi
lea    0xe72(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <sscanf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jne    11ad <processNumericVar+0x7d>
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processNumericVar>:
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    1198 <processNumericVar+0x68>
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    1198 <processNumericVar+0x68>
mov    0x4(%rsp),%ecx
mov    %ecx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @processNumericVar(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
store i32 0, i32* %7
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %8
store i32 0, i32* %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), i32* %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 i32, i32* %10
%29 = load i32*, i32** %6
store i32 %28, i32* %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"%d\00"
define i32 @processNumericVar(i8* %0, i8* %1, i32* nocapture writeonly %2) {
%4 = alloca i32
%5 = tail call i32 @strlen(i8* %1)
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %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), i32* %4)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = load i32, i32* %4
store i32 %16, i32* %2
br label %17
17: ; preds = %9, %15, %3
%18 = phi i32 [ 0, %3 ], [ 1, %15 ], [ 1, %9 ]
ret i32 %18
}