#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*/ extractField(char *, int, char **, int *);
scalar_t__ memcmp(char *, char *, int);
int strlen(char *);
int bbWordMatchesName(char *line, int fieldIx, void *target) {
  char *name = target;
  int fieldSize;
  char *field;
  extractField(line, fieldIx, &field, &fieldSize);
  return strlen(name) == fieldSize && memcmp(name, field, fieldSize) == 0;
}


x86 assembly (clang, -O0):
<bbWordMatchesName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x30(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1040 <extractField@plt>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    -0x24(%rbp),%ecx
mov    %al,-0x31(%rbp)
jne    1192 <bbWordMatchesName+0x62>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbWordMatchesName>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1040 <extractField@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%edx
xor    %eax,%eax
cmp    0x4(%rsp),%edx
jne    1171 <bbWordMatchesName+0x41>
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @bbWordMatchesName(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%10 = load i8*, i8** %6
store i8* %10, i8** %7
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = call i32 @extractField(i8* %11, i32 %12, i8** %9, i32* %8)
%14 = load i8*, i8** %7
%15 = call i32 @strlen(i8* %14)
%16 = load i32, i32* %8
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %3
%19 = load i8*, i8** %7
%20 = load i8*, i8** %9
%21 = load i32, i32* %8
%22 = call i64 @memcmp(i8* %19, i8* %20, i32 %21)
%23 = icmp eq i64 %22, 0
br label %24
24: ; preds = %18, %3
%25 = phi i1 [ false, %3 ], [ %23, %18 ]
%26 = zext i1 %25 to i32
ret i32 %26
}

LLVM IR (-O2):
define i32 @bbWordMatchesName(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = bitcast i32* %4 to i8*
%7 = bitcast i8** %5 to i8*
%8 = call i32 @extractField(i8* %0, i32 %1, i8** %5, i32* %4)
%9 = call i32 @strlen(i8* %2)
%10 = load i32, i32* %4
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = call i64 @memcmp(i8* %2, i8* %13, i32 %9)
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %12, %3
%18 = phi i32 [ 0, %3 ], [ %16, %12 ]
ret i32 %18
}