#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 */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ n_len;
  int /*<<< orphan*/ n_bytes;
};
typedef TYPE_1__ netobj;

/* Variables and functions */
int /*<<< orphan*/ bcmp(int /*<<< orphan*/, int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ debuglog(char *, ...);
int same_netobj(const netobj *n0, const netobj *n1) {
  int retval;
  retval = 0;
  debuglog("Entering netobj identity check\n");
  if (n0->n_len == n1->n_len) {
    debuglog("Preliminary length check passed\n");
    retval = !bcmp(n0->n_bytes, n1->n_bytes, n0->n_len);
    debuglog("netobj %smatch\n", retval ? "" : "mis");
  }
  return (retval);
}


x86 assembly (clang, -O0):
<same_netobj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <debuglog@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
jne    11b7 <same_netobj+0x97>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1040 <debuglog@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%esi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
call   1030 <bcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
lea    0xeb6(%rip),%rsi
lea    0xe9e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <debuglog@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<same_netobj>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xece(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <debuglog@plt>
mov    (%r14),%rax
cmp    (%r15),%rax
jne    1188 <same_netobj+0x68>
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1040 <debuglog@plt>
mov    0x8(%r14),%edi
mov    0x8(%r15),%esi
mov    (%r14),%rdx
call   1030 <bcmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
lea    0xed1(%rip),%rax
lea    0xedb(%rip),%rsi
cmove  %rax,%rsi
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1040 <debuglog@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i64, i32 }
@.str = [32 x i8] c"Entering netobj identity check\0A\00"
@.str.1 = [33 x i8] c"Preliminary length check passed\0A\00"
@.str.2 = [16 x i8] c"netobj %smatch\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"mis\00"
define i32 @same_netobj(%struct.TYPE_4__* %0, %struct.TYPE_4__* %1) {
%3 = alloca %struct.TYPE_4__*
%4 = alloca %struct.TYPE_4__*
%5 = alloca i32
store %struct.TYPE_4__* %0, %struct.TYPE_4__** %3
store %struct.TYPE_4__* %1, %struct.TYPE_4__** %4
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @debuglog(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = load %struct.TYPE_4__*, %struct.TYPE_4__** %3
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = load i64, i64* %8
%10 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %10, i32 0, i32 0
%12 = load i64, i64* %11
%13 = icmp eq i64 %9, %12
br i1 %13, label %14, label %34
14: ; preds = %2
%15 = call i32 (i8*, ...) @debuglog(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%16 = load %struct.TYPE_4__*, %struct.TYPE_4__** %3
%17 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%20 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %19, i32 0, i32 1
%21 = load i32, i32* %20
%22 = load %struct.TYPE_4__*, %struct.TYPE_4__** %3
%23 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %22, i32 0, i32 0
%24 = load i64, i64* %23
%25 = call i32 @bcmp(i32 %18, i32 %21, i64 %24)
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
%28 = zext i1 %27 to i32
store i32 %28, i32* %5
%29 = load i32, i32* %5
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i64
%32 = select i1 %30, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%33 = call i32 (i8*, ...) @debuglog(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %14, %2
%35 = load i32, i32* %5
ret i32 %35
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i64, i32 }
@.str = [32 x i8] c"Entering netobj identity check\0A\00"
@.str.1 = [33 x i8] c"Preliminary length check passed\0A\00"
@.str.2 = [16 x i8] c"netobj %smatch\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"mis\00"
define i32 @same_netobj(%struct.TYPE_4__* nocapture %0, %struct.TYPE_4__* nocapture %1) {
%3 = tail call i32 (i8*, ...) @debuglog(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 0
%5 = load i64, i64* %4
%6 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 0
%7 = load i64, i64* %6
%8 = icmp eq i64 %5, %7
br i1 %8, label %9, label %21
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @debuglog(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 1
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 1
%14 = load i32, i32* %13
%15 = load i64, i64* %4
%16 = tail call i32 @bcmp(i32 %12, i32 %14, i64 %15)
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = select i1 %17, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%20 = tail call i32 (i8*, ...) @debuglog(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %9, %2
%22 = phi i32 [ %18, %9 ], [ 0, %2 ]
ret i32 %22
}