#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 */
scalar_t__ strcmp(char const *, char const *);
int strtol(char const *, int /*<<< orphan*/ *, int);
int code_match(const char *code0, const char *code1) {
  int c0, c1;
  if (code0 == NULL || code1 == NULL)
    return 0;
  c0 = strtol(code0, NULL, 16);
  c1 = strtol(code1, NULL, 16);
  if (c0 && c1)
    return (c0 == c1) ? 1 : 0;
  else
    return (strcmp(code0, code1) == 0) ? 1 : 0;
}


x86 assembly (clang, -O0):
<code_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1146 <code_match+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1152 <code_match+0x32>
movl   $0x0,-0x4(%rbp)
jmp    11cb <code_match+0xab>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11aa <code_match+0x8a>
cmpl   $0x0,-0x20(%rbp)
je     11aa <code_match+0x8a>
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    11cb <code_match+0xab>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<code_match>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
test   %rdi,%rdi
je     1170 <code_match+0x50>
mov    %rsi,%r14
test   %rsi,%rsi
je     1170 <code_match+0x50>
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %eax,%ebp
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
test   %ebp,%ebp
je     115f <code_match+0x3f>
test   %eax,%eax
je     115f <code_match+0x3f>
cmp    %eax,%ebp
jmp    116d <code_match+0x4d>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
sete   %al
movzbl %al,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @code_match(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %10, %2
store i32 0, i32* %3
br label %37
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = call i32 @strtol(i8* %15, i32* null, i32 16)
store i32 %16, i32* %6
%17 = load i8*, i8** %5
%18 = call i32 @strtol(i8* %17, i32* null, i32 16)
store i32 %18, i32* %7
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %14
%22 = load i32, i32* %7
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = icmp eq i32 %25, %26
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 1, i32 0
store i32 %29, i32* %3
br label %37
30: ; preds = %21, %14
%31 = load i8*, i8** %4
%32 = load i8*, i8** %5
%33 = call i64 @strcmp(i8* %31, i8* %32)
%34 = icmp eq i64 %33, 0
%35 = zext i1 %34 to i64
%36 = select i1 %34, i32 1, i32 0
store i32 %36, i32* %3
br label %37
37: ; preds = %30, %24, %13
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
define i32 @code_match(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %17, label %6
6: ; preds = %2
%7 = tail call i32 @strtol(i8* nocapture %0, i32* null, i32 16)
%8 = tail call i32 @strtol(i8* nocapture %1, i32* null, i32 16)
%9 = icmp ne i32 %7, 0
%10 = icmp ne i32 %8, 0
%11 = select i1 %9, i1 %10, i1 false
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = icmp eq i32 %7, %8
br label %17
14: ; preds = %6
%15 = tail call i64 @strcmp(i8* %0, i8* %1)
%16 = icmp eq i64 %15, 0
br label %17
17: ; preds = %2, %14, %12
%18 = phi i1 [ %13, %12 ], [ %16, %14 ], [ false, %2 ]
%19 = zext i1 %18 to i32
ret i32 %19
}