#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, unsigned int);
int /*<<< orphan*/ puts(char *);
void nodelist_cb(int type, void *addr_bin, const char *addr_str,
                 unsigned int port) {
  switch (type) {
  case 0xA0:
    printf("node (IP %s port %u)\n", addr_str, port);
    break;
  case 0xA1:
    printf("node (IPv6 %s port %u)", addr_str, port);
    break;
  case 0xA2:
    printf("node (hostname %s port %u)\n", addr_str, port);
    break;
  default:
    puts("unknown node address type");
    return;
  }
}


x86 assembly (clang, -O0):
<nodelist_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0xa0,%eax
je     1172 <nodelist_cb+0x52>
jmp    114c <nodelist_cb+0x2c>
mov    -0x20(%rbp),%eax
sub    $0xa1,%eax
je     118a <nodelist_cb+0x6a>
jmp    115f <nodelist_cb+0x3f>
mov    -0x20(%rbp),%eax
sub    $0xa2,%eax
je     11a2 <nodelist_cb+0x82>
jmp    11ba <nodelist_cb+0x9a>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
jmp    11c6 <nodelist_cb+0xa6>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
jmp    11c6 <nodelist_cb+0xa6>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
jmp    11c6 <nodelist_cb+0xa6>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nodelist_cb>:
cmp    $0xa2,%edi
je     1141 <nodelist_cb+0x21>
cmp    $0xa1,%edi
je     114a <nodelist_cb+0x2a>
cmp    $0xa0,%edi
jne    115b <nodelist_cb+0x3b>
lea    0xec1(%rip),%rdi
jmp    1151 <nodelist_cb+0x31>
lea    0xee5(%rip),%rdi
jmp    1151 <nodelist_cb+0x31>
lea    0xec5(%rip),%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
jmp    1040 <printf@plt>
lea    0xee7(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"node (IP %s port %u)\0A\00"
@.str.1 = [23 x i8] c"node (IPv6 %s port %u)\00"
@.str.2 = [28 x i8] c"node (hostname %s port %u)\0A\00"
@.str.3 = [26 x i8] c"unknown node address type\00"
define void @nodelist_cb(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
switch i32 %9, label %22 [
i32 160, label %10
i32 161, label %14
i32 162, label %18
]
10: ; preds = %4
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %12)
br label %24
14: ; preds = %4
%15 = load i8*, i8** %7
%16 = load i32, i32* %8
%17 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %15, i32 %16)
br label %24
18: ; preds = %4
%19 = load i8*, i8** %7
%20 = load i32, i32* %8
%21 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %19, i32 %20)
br label %24
22: ; preds = %4
%23 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %18, %14, %10
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"node (IP %s port %u)\0A\00"
@.str.1 = [23 x i8] c"node (IPv6 %s port %u)\00"
@.str.2 = [28 x i8] c"node (hostname %s port %u)\0A\00"
@.str.3 = [26 x i8] c"unknown node address type\00"
define void @nodelist_cb(i32 %0, i8* nocapture readnone %1, i8* %2, i32 %3) {
switch i32 %0, label %11 [
i32 160, label %5
i32 161, label %7
i32 162, label %9
]
5: ; preds = %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3)
br label %13
7: ; preds = %4
%8 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %3)
br label %13
9: ; preds = %4
%10 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 %3)
br label %13
11: ; preds = %4
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %11, %9, %7, %5
ret void
}