#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 sockaddr_in {
  int dummy;
};

/* Variables and functions */
scalar_t__ SOCK_ADDR_IN_ADDR(struct sockaddr_in *);
scalar_t__ SOCK_ADDR_IN_PORT(struct sockaddr_in *);
int peer_are_addrs_equal(struct sockaddr_in *a, struct sockaddr_in *b) {
  if (SOCK_ADDR_IN_PORT(a) == SOCK_ADDR_IN_PORT(b) &&
      SOCK_ADDR_IN_ADDR(a) == SOCK_ADDR_IN_ADDR(b)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<peer_are_addrs_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <SOCK_ADDR_IN_PORT@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <SOCK_ADDR_IN_PORT@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    1188 <peer_are_addrs_equal+0x68>
mov    -0x10(%rbp),%rdi
call   1040 <SOCK_ADDR_IN_ADDR@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <SOCK_ADDR_IN_ADDR@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jne    1188 <peer_are_addrs_equal+0x68>
movl   $0x1,-0x4(%rbp)
jmp    118f <peer_are_addrs_equal+0x6f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<peer_are_addrs_equal>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <SOCK_ADDR_IN_PORT@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <SOCK_ADDR_IN_PORT@plt>
cmp    %rax,%rbx
jne    1160 <peer_are_addrs_equal+0x40>
mov    %r15,%rdi
call   1040 <SOCK_ADDR_IN_ADDR@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <SOCK_ADDR_IN_ADDR@plt>
mov    %rax,%rcx
mov    $0x1,%eax
cmp    %rcx,%rbx
je     1162 <peer_are_addrs_equal+0x42>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
define i32 @peer_are_addrs_equal(%struct.sockaddr_in* %0, %struct.sockaddr_in* %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in*
%5 = alloca %struct.sockaddr_in*
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %4
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %5
%6 = load %struct.sockaddr_in*, %struct.sockaddr_in** %4
%7 = call i64 @SOCK_ADDR_IN_PORT(%struct.sockaddr_in* %6)
%8 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%9 = call i64 @SOCK_ADDR_IN_PORT(%struct.sockaddr_in* %8)
%10 = icmp eq i64 %7, %9
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load %struct.sockaddr_in*, %struct.sockaddr_in** %4
%13 = call i64 @SOCK_ADDR_IN_ADDR(%struct.sockaddr_in* %12)
%14 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%15 = call i64 @SOCK_ADDR_IN_ADDR(%struct.sockaddr_in* %14)
%16 = icmp eq i64 %13, %15
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 1, i32* %3
br label %19
18: ; preds = %11, %2
store i32 0, i32* %3
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %3
ret i32 %20
}

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