#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 iphdr {
  int /*<<< orphan*/ saddr;
};
struct ether_header {
  int /*<<< orphan*/ ether_shost;
};

/* Variables and functions */
scalar_t__ is_ignored_ip(int /*<<< orphan*/);
scalar_t__ is_ignored_mac(int /*<<< orphan*/);
int ignored_packet(void *packet) {
  const struct ether_header *eh = packet;
  struct iphdr *ip = (struct iphdr *)(packet + sizeof(struct ether_header));
  if (is_ignored_ip(ip->saddr) || is_ignored_mac(eh->ether_shost))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<ignored_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1040 <is_ignored_ip@plt>
cmp    $0x0,%rax
jne    116a <ignored_packet+0x4a>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1030 <is_ignored_mac@plt>
cmp    $0x0,%rax
je     1176 <ignored_packet+0x56>
movl   $0x1,-0x4(%rbp)
jmp    117d <ignored_packet+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ignored_packet>:
push   %rbx
mov    %rdi,%rbx
mov    0x4(%rdi),%edi
call   1040 <is_ignored_ip@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     113b <ignored_packet+0x1b>
pop    %rbx
ret
mov    (%rbx),%edi
call   1030 <is_ignored_mac@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
%struct.ether_header = type { i32 }
%struct.iphdr = type { i32 }
define i32 @ignored_packet(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.ether_header*
%5 = alloca %struct.iphdr*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.ether_header*
store %struct.ether_header* %7, %struct.ether_header** %4
%8 = load i8*, i8** %3
%9 = getelementptr i8, i8* %8, i64 4
%10 = bitcast i8* %9 to %struct.iphdr*
store %struct.iphdr* %10, %struct.iphdr** %5
%11 = load %struct.iphdr*, %struct.iphdr** %5
%12 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i64 @is_ignored_ip(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %1
%17 = load %struct.ether_header*, %struct.ether_header** %4
%18 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = call i64 @is_ignored_mac(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %16, %1
store i32 1, i32* %2
br label %24
23: ; preds = %16
store i32 0, i32* %2
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @ignored_packet(i8* nocapture %0) {
%2 = getelementptr i8, i8* %0, i64 4
%3 = bitcast i8* %2 to i32*
%4 = load i32, i32* %3
%5 = tail call i64 @is_ignored_ip(i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = bitcast i8* %0 to i32*
%9 = load i32, i32* %8
%10 = tail call i64 @is_ignored_mac(i32 %9)
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %7, %1
%14 = phi i32 [ 1, %1 ], [ %12, %7 ]
ret i32 %14
}