#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 */
typedef scalar_t__ uint8_t;
struct in_addr {
  int dummy;
};
struct ether_addr {
  int dummy;
};
struct arphdr {
  scalar_t__ ar_hln;
  int ar_pln;
  int /*<<< orphan*/ ar_op;
  int /*<<< orphan*/ ar_pro;
};

/* Variables and functions */
scalar_t__ ETH_ALEN;
int /*<<< orphan*/ arp_print_command(int /*<<< orphan*/);
int /*<<< orphan*/ arp_print_protocol(int /*<<< orphan*/);
char *ether_ntoa(struct ether_addr const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *inet_ntoa(struct in_addr const);
int /*<<< orphan*/ stdout;
void arp_non_complete_analysis(const uint8_t *packet) {
  const struct arphdr *arp_header = (const struct arphdr *)(packet);
  const uint8_t *data = packet + sizeof(struct arphdr);
  uint8_t hln = 0, pln = 0;
  arp_print_protocol(arp_header->ar_pro);
  fprintf(stdout, " ");
  arp_print_command(arp_header->ar_op);
  fprintf(stdout, " ");
  if (arp_header->ar_hln == ETH_ALEN) {
    fprintf(stdout, " %s", ether_ntoa((const struct ether_addr *)(data)));
  }
  data += hln;
  if (arp_header->ar_pln == 4) {
    fprintf(stdout, "(");
    fprintf(stdout, "%s", inet_ntoa(*((const struct in_addr *)(data))));
    fprintf(stdout, ") -> ");
  }
  data += pln;
  if (arp_header->ar_hln == ETH_ALEN) {
    fprintf(stdout, "%s ", ether_ntoa((const struct ether_addr *)data));
  }
  data += hln;
  if (arp_header->ar_pln == 4) {
    fprintf(stdout, "(");
    fprintf(stdout, "%s", inet_ntoa(*((const struct in_addr *)(data))));
    fprintf(stdout, ")");
  }
}


x86 assembly (clang, -O0):
<arp_non_complete_analysis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0xc0,%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edi
call   1040 <arp_print_protocol@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%edi
call   1060 <arp_print_command@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2e12(%rip),%rcx
cmp    (%rcx),%rax
jne    1208 <arp_non_complete_analysis+0xb8>
mov    0x2df2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <ether_ntoa@plt>
mov    -0x2c(%rbp),%edi
mov    %rax,%rdx
lea    0xdff(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x4,0x8(%rax)
jne    127f <arp_non_complete_analysis+0x12f>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
lea    0xdce(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d94(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1030 <inet_ntoa@plt>
mov    -0x30(%rbp),%edi
mov    %rax,%rdx
lea    0xda0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
lea    0xd8e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x28(%rbp),%rax
shl    $0x3,%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2d4b(%rip),%rcx
cmp    (%rcx),%rax
jne    12cf <arp_non_complete_analysis+0x17f>
mov    0x2d2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <ether_ntoa@plt>
mov    -0x34(%rbp),%edi
mov    %rax,%rdx
lea    0xd44(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x4,0x8(%rax)
jne    1346 <arp_non_complete_analysis+0x1f6>
mov    0x2ce4(%rip),%rax
mov    (%rax),%edi
lea    0xd07(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2ccd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1030 <inet_ntoa@plt>
mov    -0x38(%rbp),%edi
mov    %rax,%rdx
lea    0xcd9(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
lea    0xcd1(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arp_non_complete_analysis>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
lea    0xc0(%rdi),%r14
mov    0x10(%rdi),%edi
call   1040 <arp_print_protocol@plt>
mov    0x2e67(%rip),%r12
mov    (%r12),%edi
lea    0xe8e(%rip),%r15
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0xc(%rbx),%edi
call   1060 <arp_print_command@plt>
mov    (%r12),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%rbx),%rax
mov    0x2e42(%rip),%r15
cmp    (%r15),%rax
jne    11ca <arp_non_complete_analysis+0x7a>
mov    (%r12),%ebp
mov    %r14,%rdi
call   1050 <ether_ntoa@plt>
lea    0xe42(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
cmpl   $0x4,0x8(%rbx)
jne    1213 <arp_non_complete_analysis+0xc3>
mov    (%r12),%edi
lea    0xe29(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%r12),%ebp
mov    (%r14),%edi
call   1030 <inet_ntoa@plt>
lea    0xe0c(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%r12),%edi
lea    0xdfa(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%rbx),%rax
cmp    (%r15),%rax
jne    123a <arp_non_complete_analysis+0xea>
mov    (%r12),%ebp
mov    %r14,%rdi
call   1050 <ether_ntoa@plt>
lea    0xdde(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
cmpl   $0x4,0x8(%rbx)
jne    128b <arp_non_complete_analysis+0x13b>
mov    (%r12),%edi
lea    0xdb9(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%r12),%ebx
mov    (%r14),%edi
call   1030 <inet_ntoa@plt>
lea    0xd9c(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%r12),%edi
lea    0xd94(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <fprintf@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.arphdr = type { i64, i32, i32, i32 }
%struct.ether_addr = type { i32 }
%struct.in_addr = type { i32 }
@stdout = global i32 0
@.str = [2 x i8] c" \00"
@ETH_ALEN = global i64 0
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [2 x i8] c"(\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [6 x i8] c") -> \00"
@.str.5 = [4 x i8] c"%s \00"
@.str.6 = [2 x i8] c")\00"
define void @arp_non_complete_analysis(i64* %0) {
%2 = alloca i64*
%3 = alloca %struct.arphdr*
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
store i64* %0, i64** %2
%7 = load i64*, i64** %2
%8 = bitcast i64* %7 to %struct.arphdr*
store %struct.arphdr* %8, %struct.arphdr** %3
%9 = load i64*, i64** %2
%10 = getelementptr inbounds i64, i64* %9, i64 24
store i64* %10, i64** %4
store i64 0, i64* %5
store i64 0, i64* %6
%11 = load %struct.arphdr*, %struct.arphdr** %3
%12 = getelementptr inbounds %struct.arphdr, %struct.arphdr* %11, i32 0, i32 3
%13 = load i32, i32* %12
%14 = call i32 @arp_print_protocol(i32 %13)
%15 = load i32, i32* @stdout
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = load %struct.arphdr*, %struct.arphdr** %3
%18 = getelementptr inbounds %struct.arphdr, %struct.arphdr* %17, i32 0, i32 2
%19 = load i32, i32* %18
%20 = call i32 @arp_print_command(i32 %19)
%21 = load i32, i32* @stdout
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%23 = load %struct.arphdr*, %struct.arphdr** %3
%24 = getelementptr inbounds %struct.arphdr, %struct.arphdr* %23, i32 0, i32 0
%25 = load i64, i64* %24
%26 = load i64, i64* @ETH_ALEN
%27 = icmp eq i64 %25, %26
br i1 %27, label %28, label %34
28: ; preds = %1
%29 = load i32, i32* @stdout
%30 = load i64*, i64** %4
%31 = bitcast i64* %30 to %struct.ether_addr*
%32 = call i8* @ether_ntoa(%struct.ether_addr* %31)
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %28, %1
%35 = load i64, i64* %5
%36 = load i64*, i64** %4
%37 = getelementptr inbounds i64, i64* %36, i64 %35
store i64* %37, i64** %4
%38 = load %struct.arphdr*, %struct.arphdr** %3
%39 = getelementptr inbounds %struct.arphdr, %struct.arphdr* %38, i32 0, i32 1
%40 = load i32, i32* %39
%41 = icmp eq i32 %40, 4
br i1 %41, label %42, label %54
42: ; preds = %34
%43 = load i32, i32* @stdout
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%45 = load i32, i32* @stdout
%46 = load i64*, i64** %4
%47 = bitcast i64* %46 to %struct.in_addr*
%48 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %47, i32 0, i32 0
%49 = load i32, i32* %48
%50 = call i8* @inet_ntoa(i32 %49)
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %50)
%52 = load i32, i32* @stdout
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %54
54: ; preds = %42, %34
%55 = load i64, i64* %6
%56 = load i64*, i64** %4
%57 = getelementptr inbounds i64, i64* %56, i64 %55
store i64* %57, i64** %4
%58 = load %struct.arphdr*, %struct.arphdr** %3
%59 = getelementptr inbounds %struct.arphdr, %struct.arphdr* %58, i32 0, i32 0
%60 = load i64, i64* %59
%61 = load i64, i64* @ETH_ALEN
%62 = icmp eq i64 %60, %61
br i1 %62, label %63, label %69
63: ; preds = %54
%64 = load i32, i32* @stdout
%65 = load i64*, i64** %4
%66 = bitcast i64* %65 to %struct.ether_addr*
%67 = call i8* @ether_ntoa(%struct.ether_addr* %66)
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %67)
br label %69
69: ; preds = %63, %54
%70 = load i64, i64* %5
%71 = load i64*, i64** %4
%72 = getelementptr inbounds i64, i64* %71, i64 %70
store i64* %72, i64** %4
%73 = load %struct.arphdr*, %struct.arphdr** %3
%74 = getelementptr inbounds %struct.arphdr, %struct.arphdr* %73, i32 0, i32 1
%75 = load i32, i32* %74
%76 = icmp eq i32 %75, 4
br i1 %76, label %77, label %89
77: ; preds = %69
%78 = load i32, i32* @stdout
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%80 = load i32, i32* @stdout
%81 = load i64*, i64** %4
%82 = bitcast i64* %81 to %struct.in_addr*
%83 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %82, i32 0, i32 0
%84 = load i32, i32* %83
%85 = call i8* @inet_ntoa(i32 %84)
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %85)
%87 = load i32, i32* @stdout
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %89
89: ; preds = %77, %69
ret void
}

LLVM IR (-O2):
%struct.arphdr = type { i64, i32, i32, i32 }
%struct.ether_addr = type { i32 }
@stdout = global i32 0
@.str = [2 x i8] c" \00"
@ETH_ALEN = global i64 0
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [2 x i8] c"(\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [6 x i8] c") -> \00"
@.str.5 = [4 x i8] c"%s \00"
@.str.6 = [2 x i8] c")\00"
define void @arp_non_complete_analysis(i64* %0) {
%2 = bitcast i64* %0 to %struct.arphdr*
%3 = getelementptr inbounds i64, i64* %0, i64 24
%4 = getelementptr inbounds i64, i64* %0, i64 2
%5 = bitcast i64* %4 to i32*
%6 = load i32, i32* %5
%7 = tail call i32 @arp_print_protocol(i32 %6)
%8 = load i32, i32* @stdout
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds %struct.arphdr, %struct.arphdr* %2, i64 0, i32 2
%11 = load i32, i32* %10
%12 = tail call i32 @arp_print_command(i32 %11)
%13 = load i32, i32* @stdout
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = load i64, i64* %0
%16 = load i64, i64* @ETH_ALEN
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %23
18: ; preds = %1
%19 = load i32, i32* @stdout
%20 = bitcast i64* %3 to %struct.ether_addr*
%21 = tail call i8* @ether_ntoa(%struct.ether_addr* %20)
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %18, %1
%24 = getelementptr inbounds i64, i64* %0, i64 1
%25 = bitcast i64* %24 to i32*
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 4
br i1 %27, label %28, label %38
28: ; preds = %23
%29 = load i32, i32* @stdout
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%31 = load i32, i32* @stdout
%32 = bitcast i64* %3 to i32*
%33 = load i32, i32* %32
%34 = tail call i8* @inet_ntoa(i32 %33)
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %34)
%36 = load i32, i32* @stdout
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %28, %23
%39 = load i64, i64* %0
%40 = load i64, i64* @ETH_ALEN
%41 = icmp eq i64 %39, %40
br i1 %41, label %42, label %47
42: ; preds = %38
%43 = load i32, i32* @stdout
%44 = bitcast i64* %3 to %struct.ether_addr*
%45 = tail call i8* @ether_ntoa(%struct.ether_addr* %44)
%46 = tail call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %42, %38
%48 = load i32, i32* %25
%49 = icmp eq i32 %48, 4
br i1 %49, label %50, label %60
50: ; preds = %47
%51 = load i32, i32* @stdout
%52 = tail call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%53 = load i32, i32* @stdout
%54 = bitcast i64* %3 to i32*
%55 = load i32, i32* %54
%56 = tail call i8* @inet_ntoa(i32 %55)
%57 = tail call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %56)
%58 = load i32, i32* @stdout
%59 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %60
60: ; preds = %50, %47
ret void
}