#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 */
struct ebt_mac_wormhash {
  int dummy;
};

/* Variables and functions */
int ebt_mac_wormhash_size(struct ebt_mac_wormhash const *);
scalar_t__ memcmp(struct ebt_mac_wormhash const *,
                  struct ebt_mac_wormhash const *, int);
int compare_wh(const struct ebt_mac_wormhash *aw,
               const struct ebt_mac_wormhash *bw) {
  int as, bs;
  as = ebt_mac_wormhash_size(aw);
  bs = ebt_mac_wormhash_size(bw);
  if (as != bs)
    return 0;
  if (as && memcmp(aw, bw, as))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<compare_wh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ebt_mac_wormhash_size@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <ebt_mac_wormhash_size@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
je     1160 <compare_wh+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1197 <compare_wh+0x77>
cmpl   $0x0,-0x1c(%rbp)
je     1190 <compare_wh+0x70>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
je     1190 <compare_wh+0x70>
movl   $0x0,-0x4(%rbp)
jmp    1197 <compare_wh+0x77>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_wh>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%rbp
call   1030 <ebt_mac_wormhash_size@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1030 <ebt_mac_wormhash_size@plt>
xor    %r14d,%r14d
cmp    %eax,%ebx
jne    115f <compare_wh+0x3f>
test   %ebx,%ebx
je     1159 <compare_wh+0x39>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1040 <memcmp@plt>
test   %rax,%rax
jne    115f <compare_wh+0x3f>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ebt_mac_wormhash = type { i32 }
define i32 @compare_wh(%struct.ebt_mac_wormhash* %0, %struct.ebt_mac_wormhash* %1) {
%3 = alloca i32
%4 = alloca %struct.ebt_mac_wormhash*
%5 = alloca %struct.ebt_mac_wormhash*
%6 = alloca i32
%7 = alloca i32
store %struct.ebt_mac_wormhash* %0, %struct.ebt_mac_wormhash** %4
store %struct.ebt_mac_wormhash* %1, %struct.ebt_mac_wormhash** %5
%8 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %4
%9 = call i32 @ebt_mac_wormhash_size(%struct.ebt_mac_wormhash* %8)
store i32 %9, i32* %6
%10 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %5
%11 = call i32 @ebt_mac_wormhash_size(%struct.ebt_mac_wormhash* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 0, i32* %3
br label %27
16: ; preds = %2
%17 = load i32, i32* %6
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %4
%21 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %5
%22 = load i32, i32* %6
%23 = call i64 @memcmp(%struct.ebt_mac_wormhash* %20, %struct.ebt_mac_wormhash* %21, i32 %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %19
store i32 0, i32* %3
br label %27
26: ; preds = %19, %16
store i32 1, i32* %3
br label %27
27: ; preds = %26, %25, %15
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
%struct.ebt_mac_wormhash = type { i32 }
define i32 @compare_wh(%struct.ebt_mac_wormhash* %0, %struct.ebt_mac_wormhash* %1) {
%3 = tail call i32 @ebt_mac_wormhash_size(%struct.ebt_mac_wormhash* %0)
%4 = tail call i32 @ebt_mac_wormhash_size(%struct.ebt_mac_wormhash* %1)
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = icmp eq i32 %3, 0
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = tail call i64 @memcmp(%struct.ebt_mac_wormhash* %0, %struct.ebt_mac_wormhash* %1, i32 %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8, %6
br label %12
12: ; preds = %8, %2, %11
%13 = phi i32 [ 1, %11 ], [ 0, %2 ], [ 0, %8 ]
ret i32 %13
}