#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 ebt_mac_wormhash_tuple {
  scalar_t__ ip;
  int /*<<< orphan*/ *cmp;
};
struct ebt_mac_wormhash {
  int poolsize;
  int /*<<< orphan*/ *pool;
};

/* Variables and functions */
int /*<<< orphan*/ ebt_print_mac(unsigned char const *);
int /*<<< orphan*/ printf(char *, ...);
void wormhash_printout(const struct ebt_mac_wormhash *wh) {
  int i;
  unsigned char *ip;
  for (i = 0; i < wh->poolsize; i++) {
    const struct ebt_mac_wormhash_tuple *p;
    p = (const struct ebt_mac_wormhash_tuple *)(&wh->pool[i]);
    ebt_print_mac(((const unsigned char *)&p->cmp[0]) + 2);
    if (p->ip) {
      ip = (unsigned char *)&p->ip;
      printf("=%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]);
    }
    printf(",");
  }
  printf(" ");
}


x86 assembly (clang, -O0):
<wormhash_printout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    11ca <wormhash_printout+0xaa>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0xc(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
add    $0x2,%rdi
call   1040 <ebt_print_mac@plt>
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     11ae <wormhash_printout+0x8e>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%esi
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%edx
mov    -0x18(%rbp),%rax
movzbl 0x2(%rax),%ecx
mov    -0x18(%rbp),%rax
movzbl 0x3(%rax),%r8d
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <wormhash_printout+0x13>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wormhash_printout>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmpl   $0x0,(%rdi)
jle    11a4 <wormhash_printout+0x74>
mov    %rdi,%r15
lea    0xeb9(%rip),%r14
xor    %ebx,%ebx
jmp    1166 <wormhash_printout+0x36>
nopl   0x0(%rax,%rax,1)
mov    $0x2c,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
movslq (%r15),%rax
cmp    %rax,%rbx
jge    11a4 <wormhash_printout+0x74>
mov    0x8(%r15),%r12
mov    0x8(%r12,%rbx,4),%rdi
add    $0x2,%rdi
call   1050 <ebt_print_mac@plt>
mov    (%r12,%rbx,4),%rcx
test   %rcx,%rcx
je     1150 <wormhash_printout+0x20>
mov    %ecx,%eax
shr    $0x18,%eax
mov    %ecx,%edi
shr    $0x10,%edi
movzbl %cl,%esi
movzbl %ch,%edx
movzbl %dil,%ecx
mov    %r14,%rdi
mov    %eax,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <wormhash_printout+0x20>
mov    $0x20,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.ebt_mac_wormhash = type { i32, i32* }
%struct.ebt_mac_wormhash_tuple = type { i64, i32* }
@.str = [13 x i8] c"=%u.%u.%u.%u\00"
@.str.1 = [2 x i8] c",\00"
@.str.2 = [2 x i8] c" \00"
define void @wormhash_printout(%struct.ebt_mac_wormhash* %0) {
%2 = alloca %struct.ebt_mac_wormhash*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.ebt_mac_wormhash_tuple*
store %struct.ebt_mac_wormhash* %0, %struct.ebt_mac_wormhash** %2
store i32 0, i32* %3
br label %6
6: ; preds = %54, %1
%7 = load i32, i32* %3
%8 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %2
%9 = getelementptr inbounds %struct.ebt_mac_wormhash, %struct.ebt_mac_wormhash* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = icmp slt i32 %7, %10
br i1 %11, label %12, label %57
12: ; preds = %6
%13 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %2
%14 = getelementptr inbounds %struct.ebt_mac_wormhash, %struct.ebt_mac_wormhash* %13, i32 0, i32 1
%15 = load i32*, i32** %14
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = bitcast i32* %18 to %struct.ebt_mac_wormhash_tuple*
store %struct.ebt_mac_wormhash_tuple* %19, %struct.ebt_mac_wormhash_tuple** %5
%20 = load %struct.ebt_mac_wormhash_tuple*, %struct.ebt_mac_wormhash_tuple** %5
%21 = getelementptr inbounds %struct.ebt_mac_wormhash_tuple, %struct.ebt_mac_wormhash_tuple* %20, i32 0, i32 1
%22 = load i32*, i32** %21
%23 = getelementptr inbounds i32, i32* %22, i64 0
%24 = bitcast i32* %23 to i8*
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = call i32 @ebt_print_mac(i8* %25)
%27 = load %struct.ebt_mac_wormhash_tuple*, %struct.ebt_mac_wormhash_tuple** %5
%28 = getelementptr inbounds %struct.ebt_mac_wormhash_tuple, %struct.ebt_mac_wormhash_tuple* %27, i32 0, i32 0
%29 = load i64, i64* %28
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %52
31: ; preds = %12
%32 = load %struct.ebt_mac_wormhash_tuple*, %struct.ebt_mac_wormhash_tuple** %5
%33 = getelementptr inbounds %struct.ebt_mac_wormhash_tuple, %struct.ebt_mac_wormhash_tuple* %32, i32 0, i32 0
%34 = bitcast i64* %33 to i8*
store i8* %34, i8** %4
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i64 0
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i64 1
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = load i8*, i8** %4
%44 = getelementptr inbounds i8, i8* %43, i64 2
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = load i8*, i8** %4
%48 = getelementptr inbounds i8, i8* %47, i64 3
%49 = load i8, i8* %48
%50 = zext i8 %49 to i32
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %38, i32 %42, i32 %46, i32 %50)
br label %52
52: ; preds = %31, %12
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %54
54: ; preds = %52
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %6
57: ; preds = %6
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.ebt_mac_wormhash = type { i32, i32* }
@.str = [13 x i8] c"=%u.%u.%u.%u\00"
define void @wormhash_printout(%struct.ebt_mac_wormhash* nocapture %0) {
%2 = getelementptr inbounds %struct.ebt_mac_wormhash, %struct.ebt_mac_wormhash* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %37
5: ; preds = %1
%6 = getelementptr inbounds %struct.ebt_mac_wormhash, %struct.ebt_mac_wormhash* %0, i64 0, i32 1
br label %7
7: ; preds = %5, %31
%8 = phi i64 [ 0, %5 ], [ %33, %31 ]
%9 = load i32*, i32** %6
%10 = getelementptr inbounds i32, i32* %9, i64 %8
%11 = getelementptr inbounds i32, i32* %10, i64 2
%12 = bitcast i32* %11 to i8**
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 2
%15 = tail call i32 @ebt_print_mac(i8* %14)
%16 = bitcast i32* %10 to i64*
%17 = load i64, i64* %16
%18 = icmp eq i64 %17, 0
br i1 %18, label %31, label %19
19: ; preds = %7
%20 = trunc i64 %17 to i32
%21 = lshr i32 %20, 24
%22 = trunc i64 %17 to i32
%23 = lshr i32 %22, 16
%24 = trunc i64 %17 to i32
%25 = lshr i32 %24, 8
%26 = trunc i64 %17 to i32
%27 = and i32 %26, 255
%28 = and i32 %25, 255
%29 = and i32 %23, 255
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %27, i32 %28, i32 %29, i32 %21)
br label %31
31: ; preds = %19, %7
%32 = tail call i32 @putchar(i32 44)
%33 = add nuw nsw i64 %8, 1
%34 = load i32, i32* %2
%35 = sext i32 %34 to i64
%36 = icmp slt i64 %33, %35
br i1 %36, label %7, label %37
37: ; preds = %31, %1
%38 = tail call i32 @putchar(i32 32)
ret void
}