#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*/ free(char *);
char *malloc(size_t);
int strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
unsigned long strtoul(char *, char **, int);
int get_match(const char *cell_ref, const char *cell_rel, size_t start,
              size_t len) {
  int ret = -1;
  size_t size_ref, size_rel;
  char *remaining_str;
  unsigned long val_integer;
  char *tmp_cell_rel;
  ;
  tmp_cell_rel = malloc(len + 1);
  strncpy(tmp_cell_rel, &cell_ref[start], len);
  tmp_cell_rel[2] = '\0';
  val_integer = strtoul(tmp_cell_rel, &remaining_str, 16);
  free(tmp_cell_rel);
  ;
  if (val_integer != 0 && val_integer == (strlen(cell_rel) / 2)) {
    ;
    ret = 0;
  } else
    ret = -1;
  return ret;
}


x86 assembly (clang, -O0):
<get_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0xffffffff,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <strncpy@plt>
mov    -0x50(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x50(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x10,%edx
call   1070 <strtoul@plt>
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x48(%rbp)
je     11fe <get_match+0xae>
mov    -0x48(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
jne    11fe <get_match+0xae>
movl   $0x0,-0x24(%rbp)
jmp    1205 <get_match+0xb5>
movl   $0xffffffff,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_match>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r12
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x1(%rcx),%rdi
call   1060 <malloc@plt>
mov    %rax,%r13
add    %r15,%rbx
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1040 <strncpy@plt>
movb   $0x0,0x2(%r13)
lea    0x8(%rsp),%rsi
mov    %r13,%rdi
mov    $0x10,%edx
call   1070 <strtoul@plt>
mov    %rax,%rbx
mov    %r13,%rdi
call   1030 <free@plt>
test   %rbx,%rbx
je     11c8 <get_match+0x78>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    %rcx,%rbx
je     11cd <get_match+0x7d>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @get_match(i8* %0, i8* %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
store i32 -1, i32* %9
%15 = load i64, i64* %8
%16 = add i64 %15, 1
%17 = call i8* @malloc(i64 %16)
store i8* %17, i8** %14
%18 = load i8*, i8** %14
%19 = load i8*, i8** %5
%20 = load i64, i64* %7
%21 = getelementptr inbounds i8, i8* %19, i64 %20
%22 = load i64, i64* %8
%23 = call i32 @strncpy(i8* %18, i8* %21, i64 %22)
%24 = load i8*, i8** %14
%25 = getelementptr inbounds i8, i8* %24, i64 2
store i8 0, i8* %25
%26 = load i8*, i8** %14
%27 = call i64 @strtoul(i8* %26, i8** %12, i32 16)
store i64 %27, i64* %13
%28 = load i8*, i8** %14
%29 = call i32 @free(i8* %28)
%30 = load i64, i64* %13
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %4
%33 = load i64, i64* %13
%34 = load i8*, i8** %6
%35 = call i32 @strlen(i8* %34)
%36 = sdiv i32 %35, 2
%37 = sext i32 %36 to i64
%38 = icmp eq i64 %33, %37
br i1 %38, label %39, label %40
39: ; preds = %32
store i32 0, i32* %9
br label %41
40: ; preds = %32, %4
store i32 -1, i32* %9
br label %41
41: ; preds = %40, %39
%42 = load i32, i32* %9
ret i32 %42
}

LLVM IR (-O2):
define i32 @get_match(i8* %0, i8* %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = bitcast i8** %5 to i8*
%7 = add i64 %3, 1
%8 = tail call i8* @malloc(i64 %7)
%9 = getelementptr inbounds i8, i8* %0, i64 %2
%10 = tail call i32 @strncpy(i8* %8, i8* %9, i64 %3)
%11 = getelementptr inbounds i8, i8* %8, i64 2
store i8 0, i8* %11
%12 = call i64 @strtoul(i8* %8, i8** %5, i32 16)
%13 = tail call i32 @free(i8* %8)
%14 = icmp eq i64 %12, 0
br i1 %14, label %20, label %15
15: ; preds = %4
%16 = tail call i32 @strlen(i8* %1)
%17 = sdiv i32 %16, 2
%18 = sext i32 %17 to i64
%19 = icmp eq i64 %12, %18
br i1 %19, label %21, label %20
20: ; preds = %15, %4
br label %21
21: ; preds = %15, %20
%22 = phi i32 [ -1, %20 ], [ 0, %15 ]
ret i32 %22
}