#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_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ s_addr;
};
struct sockaddr_in {
  scalar_t__ sin_port;
  TYPE_1__ sin_addr;
};

/* Variables and functions */
int sockutil_a4_eq(struct sockaddr_in *a, struct sockaddr_in *b,
                   unsigned ignore) {
  if (!(ignore & 0x2) && (a->sin_port != b->sin_port)) {
    return 0;
  }
  if (!(ignore & 0x4) && (a->sin_addr.s_addr != b->sin_addr.s_addr)) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<sockutil_a4_eq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    113e <sockutil_a4_eq+0x3e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
je     113e <sockutil_a4_eq+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1176 <sockutil_a4_eq+0x76>
mov    -0x1c(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    116f <sockutil_a4_eq+0x6f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     116f <sockutil_a4_eq+0x6f>
movl   $0x0,-0x4(%rbp)
jmp    1176 <sockutil_a4_eq+0x76>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sockutil_a4_eq>:
test   $0x2,%dl
jne    110f <sockutil_a4_eq+0xf>
mov    (%rdi),%rcx
xor    %eax,%eax
cmp    (%rsi),%rcx
jne    1125 <sockutil_a4_eq+0x25>
test   $0x4,%dl
jne    1120 <sockutil_a4_eq+0x20>
mov    0x8(%rdi),%rcx
xor    %eax,%eax
cmp    0x8(%rsi),%rcx
jne    1125 <sockutil_a4_eq+0x25>
mov    $0x1,%eax
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i64, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64 }
define i32 @sockutil_a4_eq(%struct.sockaddr_in* %0, %struct.sockaddr_in* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr_in*
%6 = alloca %struct.sockaddr_in*
%7 = alloca i32
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %5
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = and i32 %8, 2
%10 = icmp ne i32 %9, 0
br i1 %10, label %20, label %11
11: ; preds = %3
%12 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 0
%14 = load i64, i64* %13
%15 = load %struct.sockaddr_in*, %struct.sockaddr_in** %6
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 0
%17 = load i64, i64* %16
%18 = icmp ne i64 %14, %17
br i1 %18, label %19, label %20
19: ; preds = %11
store i32 0, i32* %4
br label %36
20: ; preds = %11, %3
%21 = load i32, i32* %7
%22 = and i32 %21, 4
%23 = icmp ne i32 %22, 0
br i1 %23, label %35, label %24
24: ; preds = %20
%25 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %25, i32 0, i32 1
%27 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %26, i32 0, i32 0
%28 = load i64, i64* %27
%29 = load %struct.sockaddr_in*, %struct.sockaddr_in** %6
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %29, i32 0, i32 1
%31 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %30, i32 0, i32 0
%32 = load i64, i64* %31
%33 = icmp ne i64 %28, %32
br i1 %33, label %34, label %35
34: ; preds = %24
store i32 0, i32* %4
br label %36
35: ; preds = %24, %20
store i32 1, i32* %4
br label %36
36: ; preds = %35, %34, %19
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i64, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64 }
define i32 @sockutil_a4_eq(%struct.sockaddr_in* nocapture %0, %struct.sockaddr_in* nocapture %1, i32 %2) {
%4 = and i32 %2, 2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 0
%8 = load i64, i64* %7
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = icmp eq i64 %8, %10
br i1 %11, label %12, label %22
12: ; preds = %6, %3
%13 = and i32 %2, 4
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 1, i32 0
%17 = load i64, i64* %16
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
%19 = load i64, i64* %18
%20 = icmp eq i64 %17, %19
br i1 %20, label %21, label %22
21: ; preds = %15, %12
br label %22
22: ; preds = %15, %6, %21
%23 = phi i32 [ 1, %21 ], [ 0, %6 ], [ 0, %15 ]
ret i32 %23
}