#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 int uint8_t;
typedef int uint16_t;
typedef int /*<<< orphan*/ address;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AF_INET6;
char *inet_ntop(int /*<<< orphan*/, int const *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
void parse_address(const uint8_t *data_item, uint16_t item_len,
                   int changeable) {
  char address[46] = {0};
  if (changeable) {
    if (data_item[0] == 1)
      printf("Add ");
    else
      printf("Drop ");
  }
  if (item_len == 5)
    printf("IPv4 address: %s\n",
           inet_ntop(AF_INET, data_item + 1, address, sizeof(address)));
  else
    printf("IPv6 address: %s\n",
           inet_ntop(AF_INET6, data_item + 1, address, sizeof(address)));
}


x86 assembly (clang, -O0):
<parse_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x2e,%edx
call   1050 <memset@plt>
cmpl   $0x0,-0x10(%rbp)
je     118f <parse_address+0x5f>
mov    -0x8(%rbp),%rax
cmpl   $0x1,(%rax)
jne    117c <parse_address+0x4c>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    118a <parse_address+0x5a>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    118f <parse_address+0x5f>
cmpl   $0x5,-0xc(%rbp)
jne    11ce <parse_address+0x9e>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    -0x40(%rbp),%rdx
mov    $0x2e,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fe <parse_address+0xce>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    -0x40(%rbp),%rdx
mov    $0x2e,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,%rsi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_address>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movups %xmm0,0x1e(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
test   %edx,%edx
je     115c <parse_address+0x3c>
cmpl   $0x1,(%rbx)
lea    0xeb6(%rip),%rax
lea    0xeb4(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x5,%ebp
lea    0xea5(%rip),%rax
lea    0xeb0(%rip),%rbp
mov    0x2e6c(%rip),%rcx
cmove  0x2e6c(%rip),%rcx
cmove  %rax,%rbp
mov    (%rcx),%edi
add    $0x4,%rbx
mov    %rsp,%rdx
mov    %rbx,%rsi
mov    $0x2e,%ecx
call   1030 <inet_ntop@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Add \00"
@.str.1 = [6 x i8] c"Drop \00"
@.str.2 = [18 x i8] c"IPv4 address: %s\0A\00"
@AF_INET = global i32 0
@.str.3 = [18 x i8] c"IPv6 address: %s\0A\00"
@AF_INET6 = global i32 0
define void @parse_address(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [46 x i8]
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = bitcast [46 x i8]* %7 to i8*
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %20
18: ; preds = %11
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
br label %21
21: ; preds = %20, %3
%22 = load i32, i32* %5
%23 = icmp eq i32 %22, 5
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = load i32, i32* @AF_INET
%26 = load i32*, i32** %4
%27 = getelementptr inbounds i32, i32* %26, i64 1
%28 = getelementptr inbounds [46 x i8], [46 x i8]* %7, i64 0, i64 0
%29 = call i8* @inet_ntop(i32 %25, i32* %27, i8* %28, i32 46)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %29)
br label %38
31: ; preds = %21
%32 = load i32, i32* @AF_INET6
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 1
%35 = getelementptr inbounds [46 x i8], [46 x i8]* %7, i64 0, i64 0
%36 = call i8* @inet_ntop(i32 %32, i32* %34, i8* %35, i32 46)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %36)
br label %38
38: ; preds = %31, %24
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"Add \00"
@.str.1 = [6 x i8] c"Drop \00"
@.str.2 = [18 x i8] c"IPv4 address: %s\0A\00"
@AF_INET = global i32 0
@.str.3 = [18 x i8] c"IPv6 address: %s\0A\00"
@AF_INET6 = global i32 0
define void @parse_address(i32* %0, i32 %1, i32 %2) {
%4 = alloca [46 x i8]
%5 = getelementptr inbounds [46 x i8], [46 x i8]* %4, i64 0, i64 0
%6 = icmp eq i32 %2, 0
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = load i32, i32* %0
%9 = icmp eq i32 %8, 1
%10 = select i1 %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %7, %3
%13 = icmp eq i32 %1, 5
%14 = select i1 %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0)
%15 = load i32, i32* @AF_INET
%16 = load i32, i32* @AF_INET6
%17 = select i1 %13, i32 %15, i32 %16
%18 = getelementptr inbounds i32, i32* %0, i64 1
%19 = call i8* @inet_ntop(i32 %17, i32* %18, i8* %5, i32 46)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %14, i8* %19)
ret void
}