#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 in_addr {
  int /*<<< orphan*/ s_addr;
};

/* Variables and functions */
int ntohl(int /*<<< orphan*/);
const char *ipv4_net_to_type(struct in_addr net) {
  unsigned byte1 = (ntohl(net.s_addr) >> 24) & 0xff;
  unsigned byte2 = (ntohl(net.s_addr) >> 16) & 0xff;
  unsigned byte3 = (ntohl(net.s_addr) >> 8) & 0xff;
  unsigned byte4 = (ntohl(net.s_addr)) & 0xff;
  if (byte1 == 0) {
    return "This host on this network";
  }
  if (byte1 == 10) {
    return "Private Use";
  }
  if (byte1 == 100 && (byte2 & 0xc0) == 64) {
    return "Shared Address Space";
  }
  if (byte1 == 127) {
    return "Loopback";
  }
  if (byte1 == 169 && byte2 == 254) {
    return "Link Local";
  }
  if (byte1 == 172 && (byte2 & 0xf0) == 16) {
    return "Private Use";
  }
  if (byte1 == 192 && byte2 == 0 && byte3 == 0) {
    return "IETF Protocol Assignments";
  }
  if (byte1 == 192 && byte2 == 2 && byte3 == 0) {
    return "Documentation (TEST-NET-1)";
  }
  if (byte1 == 192 && byte2 == 51 && byte3 == 100) {
    return "Documentation (TEST-NET-2)";
  }
  if (byte1 == 203 && byte2 == 0 && byte3 == 113) {
    return "Documentation (TEST-NET-3)";
  }
  if (byte1 == 192 && byte2 == 88 && byte3 == 99) {
    return "6 to 4 Relay Anycast (Deprecated)";
  }
  if (byte1 == 192 && byte2 == 52 && byte3 == 193) {
    return "AMT";
  }
  if (byte1 == 192 && byte2 == 168) {
    return "Private Use";
  }
  if (byte1 == 255 && byte2 == 255 && byte3 == 255 && byte4 == 255) {
    return "Limited Broadcast";
  }
  if (byte1 == 198 && (byte2 & 0xfe) == 18) {
    return "Benchmarking";
  }
  if (byte1 >= 224 && byte1 <= 239) {
    return "Multicast";
  }
  if ((byte1 & 0xf0) == 240) {
    return "Reserved";
  }
  return "Internet";
}


x86 assembly (clang, -O0):
<ipv4_net_to_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <ntohl@plt>
sar    $0x18,%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <ntohl@plt>
sar    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <ntohl@plt>
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <ntohl@plt>
and    $0xff,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    117e <ipv4_net_to_type+0x6e>
lea    0xe8b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xa,-0x14(%rbp)
jne    1198 <ipv4_net_to_type+0x88>
lea    0xe8b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0x64,-0x14(%rbp)
jne    11c3 <ipv4_net_to_type+0xb3>
mov    -0x18(%rbp),%eax
and    $0xc0,%eax
cmp    $0x40,%eax
jne    11c3 <ipv4_net_to_type+0xb3>
lea    0xe6c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0x7f,-0x14(%rbp)
jne    11dd <ipv4_net_to_type+0xcd>
lea    0xe67(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xa9,-0x14(%rbp)
jne    1207 <ipv4_net_to_type+0xf7>
cmpl   $0xfe,-0x18(%rbp)
jne    1207 <ipv4_net_to_type+0xf7>
lea    0xe46(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xac,-0x14(%rbp)
jne    1235 <ipv4_net_to_type+0x125>
mov    -0x18(%rbp),%eax
and    $0xf0,%eax
cmp    $0x10,%eax
jne    1235 <ipv4_net_to_type+0x125>
lea    0xdee(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xc0,-0x14(%rbp)
jne    1266 <ipv4_net_to_type+0x156>
cmpl   $0x0,-0x18(%rbp)
jne    1266 <ipv4_net_to_type+0x156>
cmpl   $0x0,-0x1c(%rbp)
jne    1266 <ipv4_net_to_type+0x156>
lea    0xdf2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xc0,-0x14(%rbp)
jne    1297 <ipv4_net_to_type+0x187>
cmpl   $0x2,-0x18(%rbp)
jne    1297 <ipv4_net_to_type+0x187>
cmpl   $0x0,-0x1c(%rbp)
jne    1297 <ipv4_net_to_type+0x187>
lea    0xddb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xc0,-0x14(%rbp)
jne    12c8 <ipv4_net_to_type+0x1b8>
cmpl   $0x33,-0x18(%rbp)
jne    12c8 <ipv4_net_to_type+0x1b8>
cmpl   $0x64,-0x1c(%rbp)
jne    12c8 <ipv4_net_to_type+0x1b8>
lea    0xdc5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xcb,-0x14(%rbp)
jne    12f9 <ipv4_net_to_type+0x1e9>
cmpl   $0x0,-0x18(%rbp)
jne    12f9 <ipv4_net_to_type+0x1e9>
cmpl   $0x71,-0x1c(%rbp)
jne    12f9 <ipv4_net_to_type+0x1e9>
lea    0xdaf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xc0,-0x14(%rbp)
jne    132a <ipv4_net_to_type+0x21a>
cmpl   $0x58,-0x18(%rbp)
jne    132a <ipv4_net_to_type+0x21a>
cmpl   $0x63,-0x1c(%rbp)
jne    132a <ipv4_net_to_type+0x21a>
lea    0xd99(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xc0,-0x14(%rbp)
jne    135e <ipv4_net_to_type+0x24e>
cmpl   $0x34,-0x18(%rbp)
jne    135e <ipv4_net_to_type+0x24e>
cmpl   $0xc1,-0x1c(%rbp)
jne    135e <ipv4_net_to_type+0x24e>
lea    0xd87(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xc0,-0x14(%rbp)
jne    1388 <ipv4_net_to_type+0x278>
cmpl   $0xa8,-0x18(%rbp)
jne    1388 <ipv4_net_to_type+0x278>
lea    0xc9b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xff,-0x14(%rbp)
jne    13cc <ipv4_net_to_type+0x2bc>
cmpl   $0xff,-0x18(%rbp)
jne    13cc <ipv4_net_to_type+0x2bc>
cmpl   $0xff,-0x1c(%rbp)
jne    13cc <ipv4_net_to_type+0x2bc>
cmpl   $0xff,-0x20(%rbp)
jne    13cc <ipv4_net_to_type+0x2bc>
lea    0xd1d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xc6,-0x14(%rbp)
jne    13fa <ipv4_net_to_type+0x2ea>
mov    -0x18(%rbp),%eax
and    $0xfe,%eax
cmp    $0x12,%eax
jne    13fa <ipv4_net_to_type+0x2ea>
lea    0xd01(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
cmpl   $0xe0,-0x14(%rbp)
jb     1424 <ipv4_net_to_type+0x314>
cmpl   $0xef,-0x14(%rbp)
ja     1424 <ipv4_net_to_type+0x314>
lea    0xce4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
mov    -0x14(%rbp),%eax
and    $0xf0,%eax
cmp    $0xf0,%eax
jne    1447 <ipv4_net_to_type+0x337>
lea    0xccb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1452 <ipv4_net_to_type+0x342>
lea    0xcc4(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipv4_net_to_type>:
push   %rbx
call   1030 <ntohl@plt>
cmp    $0x1000000,%eax
jae    1126 <ipv4_net_to_type+0x16>
lea    0xedc(%rip),%rax
pop    %rbx
ret
mov    %eax,%ecx
mov    %eax,%edx
shr    $0x18,%edx
lea    0xee6(%rip),%rax
cmp    $0xa,%dl
je     11ca <ipv4_net_to_type+0xba>
cmp    $0x7f,%dl
je     116c <ipv4_net_to_type+0x5c>
mov    %ecx,%esi
shr    $0x10,%esi
movzbl %sil,%edi
movzbl %ch,%esi
cmp    $0x64,%dl
jne    1175 <ipv4_net_to_type+0x65>
mov    %ecx,%ebx
and    $0xc00000,%ebx
cmp    $0x400000,%ebx
jne    118e <ipv4_net_to_type+0x7e>
lea    0xebc(%rip),%rax
pop    %rbx
ret
lea    0xec8(%rip),%rax
pop    %rbx
ret
cmp    $0xa9,%edx
jne    11b2 <ipv4_net_to_type+0xa2>
cmp    $0xfe,%edi
jne    11b2 <ipv4_net_to_type+0xa2>
lea    0xeb8(%rip),%rax
pop    %rbx
ret
test   %edi,%edi
sete   %r9b
xor    %r8d,%r8d
cmp    $0xcb,%edx
jne    11cc <ipv4_net_to_type+0xbc>
test   %r9b,%r9b
je     11cc <ipv4_net_to_type+0xbc>
cmp    $0x71,%esi
jne    11cc <ipv4_net_to_type+0xbc>
lea    0xeef(%rip),%rax
pop    %rbx
ret
cmp    $0xac,%edx
jne    11e8 <ipv4_net_to_type+0xd8>
mov    %ecx,%ebx
and    $0xf00000,%ebx
cmp    $0x100000,%ebx
jne    11e8 <ipv4_net_to_type+0xd8>
pop    %rbx
ret
cmp    $0x58,%edi
sete   %bl
and    %r8b,%bl
cmp    $0x1,%bl
jne    120b <ipv4_net_to_type+0xfb>
cmp    $0x63,%esi
jne    120b <ipv4_net_to_type+0xfb>
lea    0xed4(%rip),%rax
pop    %rbx
ret
test   %edi,%edi
sete   %r9b
cmp    $0xc0,%edx
sete   %r8b
jne    122a <ipv4_net_to_type+0x11a>
test   %edi,%edi
jne    122a <ipv4_net_to_type+0x11a>
test   %esi,%esi
jne    122a <ipv4_net_to_type+0x11a>
lea    0xe46(%rip),%rax
pop    %rbx
ret
cmp    $0x34,%edi
sete   %bl
and    %r8b,%bl
cmp    $0x1,%bl
jne    1244 <ipv4_net_to_type+0x134>
cmp    $0xc1,%esi
jne    1244 <ipv4_net_to_type+0x134>
lea    0xeb4(%rip),%rax
pop    %rbx
ret
cmp    $0xc0,%edx
jne    1281 <ipv4_net_to_type+0x171>
cmp    $0x2,%edi
jne    1281 <ipv4_net_to_type+0x171>
test   %esi,%esi
jne    1281 <ipv4_net_to_type+0x171>
lea    0xe27(%rip),%rax
pop    %rbx
ret
cmp    $0xa8,%edi
sete   %bl
test   %bl,%r8b
jne    11ca <ipv4_net_to_type+0xba>
cmp    $0xff,%edx
jne    12a8 <ipv4_net_to_type+0x198>
cmp    $0xff,%edi
jne    12a8 <ipv4_net_to_type+0x198>
cmp    $0xff,%esi
jne    12a8 <ipv4_net_to_type+0x198>
movzbl %cl,%eax
cmp    $0xff,%eax
jne    12a8 <ipv4_net_to_type+0x198>
lea    0xe61(%rip),%rax
pop    %rbx
ret
cmp    $0xc0,%edx
jne    1197 <ipv4_net_to_type+0x87>
cmp    $0x33,%edi
jne    1197 <ipv4_net_to_type+0x87>
cmp    $0x64,%esi
jne    1197 <ipv4_net_to_type+0x87>
lea    0xdde(%rip),%rax
pop    %rbx
ret
cmp    $0xc6,%edx
jne    12c7 <ipv4_net_to_type+0x1b7>
mov    %ecx,%eax
and    $0xfe0000,%eax
cmp    $0x120000,%eax
jne    12c7 <ipv4_net_to_type+0x1b7>
lea    0xe2d(%rip),%rax
pop    %rbx
ret
mov    %ecx,%eax
and    $0xf0000000,%eax
cmp    $0xe0000000,%eax
jne    12de <ipv4_net_to_type+0x1ce>
lea    0xe23(%rip),%rax
pop    %rbx
ret
cmp    $0xf0000000,%ecx
lea    0xe1e(%rip),%rcx
lea    0xe20(%rip),%rax
cmovae %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [26 x i8] c"This host on this network\00"
@.str.1 = [12 x i8] c"Private Use\00"
@.str.2 = [21 x i8] c"Shared Address Space\00"
@.str.3 = [9 x i8] c"Loopback\00"
@.str.4 = [11 x i8] c"Link Local\00"
@.str.5 = [26 x i8] c"IETF Protocol Assignments\00"
@.str.6 = [27 x i8] c"Documentation (TEST-NET-1)\00"
@.str.7 = [27 x i8] c"Documentation (TEST-NET-2)\00"
@.str.8 = [27 x i8] c"Documentation (TEST-NET-3)\00"
@.str.9 = [34 x i8] c"6 to 4 Relay Anycast (Deprecated)\00"
@.str.10 = [4 x i8] c"AMT\00"
@.str.11 = [18 x i8] c"Limited Broadcast\00"
@.str.12 = [13 x i8] c"Benchmarking\00"
@.str.13 = [10 x i8] c"Multicast\00"
@.str.14 = [9 x i8] c"Reserved\00"
@.str.15 = [9 x i8] c"Internet\00"
define i8* @ipv4_net_to_type(i32 %0) {
%2 = alloca i8*
%3 = alloca %struct.in_addr
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
store i32 %0, i32* %8
%9 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 @ntohl(i32 %10)
%12 = ashr i32 %11, 24
%13 = and i32 %12, 255
store i32 %13, i32* %4
%14 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
%15 = load i32, i32* %14
%16 = call i32 @ntohl(i32 %15)
%17 = ashr i32 %16, 16
%18 = and i32 %17, 255
store i32 %18, i32* %5
%19 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
%20 = load i32, i32* %19
%21 = call i32 @ntohl(i32 %20)
%22 = ashr i32 %21, 8
%23 = and i32 %22, 255
store i32 %23, i32* %6
%24 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
%25 = load i32, i32* %24
%26 = call i32 @ntohl(i32 %25)
%27 = and i32 %26, 255
store i32 %27, i32* %7
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %1
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %2
br label %163
31: ; preds = %1
%32 = load i32, i32* %4
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %35
34: ; preds = %31
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %163
35: ; preds = %31
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 100
br i1 %37, label %38, label %43
38: ; preds = %35
%39 = load i32, i32* %5
%40 = and i32 %39, 192
%41 = icmp eq i32 %40, 64
br i1 %41, label %42, label %43
42: ; preds = %38
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %163
43: ; preds = %38, %35
%44 = load i32, i32* %4
%45 = icmp eq i32 %44, 127
br i1 %45, label %46, label %47
46: ; preds = %43
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %163
47: ; preds = %43
%48 = load i32, i32* %4
%49 = icmp eq i32 %48, 169
br i1 %49, label %50, label %54
50: ; preds = %47
%51 = load i32, i32* %5
%52 = icmp eq i32 %51, 254
br i1 %52, label %53, label %54
53: ; preds = %50
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %163
54: ; preds = %50, %47
%55 = load i32, i32* %4
%56 = icmp eq i32 %55, 172
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = load i32, i32* %5
%59 = and i32 %58, 240
%60 = icmp eq i32 %59, 16
br i1 %60, label %61, label %62
61: ; preds = %57
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %163
62: ; preds = %57, %54
%63 = load i32, i32* %4
%64 = icmp eq i32 %63, 192
br i1 %64, label %65, label %72
65: ; preds = %62
%66 = load i32, i32* %5
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %72
68: ; preds = %65
%69 = load i32, i32* %6
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %68
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %163
72: ; preds = %68, %65, %62
%73 = load i32, i32* %4
%74 = icmp eq i32 %73, 192
br i1 %74, label %75, label %82
75: ; preds = %72
%76 = load i32, i32* %5
%77 = icmp eq i32 %76, 2
br i1 %77, label %78, label %82
78: ; preds = %75
%79 = load i32, i32* %6
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %82
81: ; preds = %78
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %163
82: ; preds = %78, %75, %72
%83 = load i32, i32* %4
%84 = icmp eq i32 %83, 192
br i1 %84, label %85, label %92
85: ; preds = %82
%86 = load i32, i32* %5
%87 = icmp eq i32 %86, 51
br i1 %87, label %88, label %92
88: ; preds = %85
%89 = load i32, i32* %6
%90 = icmp eq i32 %89, 100
br i1 %90, label %91, label %92
91: ; preds = %88
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %163
92: ; preds = %88, %85, %82
%93 = load i32, i32* %4
%94 = icmp eq i32 %93, 203
br i1 %94, label %95, label %102
95: ; preds = %92
%96 = load i32, i32* %5
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %102
98: ; preds = %95
%99 = load i32, i32* %6
%100 = icmp eq i32 %99, 113
br i1 %100, label %101, label %102
101: ; preds = %98
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %163
102: ; preds = %98, %95, %92
%103 = load i32, i32* %4
%104 = icmp eq i32 %103, 192
br i1 %104, label %105, label %112
105: ; preds = %102
%106 = load i32, i32* %5
%107 = icmp eq i32 %106, 88
br i1 %107, label %108, label %112
108: ; preds = %105
%109 = load i32, i32* %6
%110 = icmp eq i32 %109, 99
br i1 %110, label %111, label %112
111: ; preds = %108
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %163
112: ; preds = %108, %105, %102
%113 = load i32, i32* %4
%114 = icmp eq i32 %113, 192
br i1 %114, label %115, label %122
115: ; preds = %112
%116 = load i32, i32* %5
%117 = icmp eq i32 %116, 52
br i1 %117, label %118, label %122
118: ; preds = %115
%119 = load i32, i32* %6
%120 = icmp eq i32 %119, 193
br i1 %120, label %121, label %122
121: ; preds = %118
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %163
122: ; preds = %118, %115, %112
%123 = load i32, i32* %4
%124 = icmp eq i32 %123, 192
br i1 %124, label %125, label %129
125: ; preds = %122
%126 = load i32, i32* %5
%127 = icmp eq i32 %126, 168
br i1 %127, label %128, label %129
128: ; preds = %125
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %163
129: ; preds = %125, %122
%130 = load i32, i32* %4
%131 = icmp eq i32 %130, 255
br i1 %131, label %132, label %142
132: ; preds = %129
%133 = load i32, i32* %5
%134 = icmp eq i32 %133, 255
br i1 %134, label %135, label %142
135: ; preds = %132
%136 = load i32, i32* %6
%137 = icmp eq i32 %136, 255
br i1 %137, label %138, label %142
138: ; preds = %135
%139 = load i32, i32* %7
%140 = icmp eq i32 %139, 255
br i1 %140, label %141, label %142
141: ; preds = %138
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %163
142: ; preds = %138, %135, %132, %129
%143 = load i32, i32* %4
%144 = icmp eq i32 %143, 198
br i1 %144, label %145, label %150
145: ; preds = %142
%146 = load i32, i32* %5
%147 = and i32 %146, 254
%148 = icmp eq i32 %147, 18
br i1 %148, label %149, label %150
149: ; preds = %145
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %163
150: ; preds = %145, %142
%151 = load i32, i32* %4
%152 = icmp uge i32 %151, 224
br i1 %152, label %153, label %157
153: ; preds = %150
%154 = load i32, i32* %4
%155 = icmp ule i32 %154, 239
br i1 %155, label %156, label %157
156: ; preds = %153
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %163
157: ; preds = %153, %150
%158 = load i32, i32* %4
%159 = and i32 %158, 240
%160 = icmp eq i32 %159, 240
br i1 %160, label %161, label %162
161: ; preds = %157
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %163
162: ; preds = %157
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %163
163: ; preds = %162, %161, %156, %149, %141, %128, %121, %111, %101, %91, %81, %71, %61, %53, %46, %42, %34, %30
%164 = load i8*, i8** %2
ret i8* %164
}

LLVM IR (-O2):
@.str = [26 x i8] c"This host on this network\00"
@.str.1 = [12 x i8] c"Private Use\00"
@.str.2 = [21 x i8] c"Shared Address Space\00"
@.str.3 = [9 x i8] c"Loopback\00"
@.str.4 = [11 x i8] c"Link Local\00"
@.str.5 = [26 x i8] c"IETF Protocol Assignments\00"
@.str.6 = [27 x i8] c"Documentation (TEST-NET-1)\00"
@.str.7 = [27 x i8] c"Documentation (TEST-NET-2)\00"
@.str.8 = [27 x i8] c"Documentation (TEST-NET-3)\00"
@.str.9 = [34 x i8] c"6 to 4 Relay Anycast (Deprecated)\00"
@.str.10 = [4 x i8] c"AMT\00"
@.str.11 = [18 x i8] c"Limited Broadcast\00"
@.str.12 = [13 x i8] c"Benchmarking\00"
@.str.13 = [10 x i8] c"Multicast\00"
@.str.14 = [9 x i8] c"Reserved\00"
@.str.15 = [9 x i8] c"Internet\00"
define i8* @ipv4_net_to_type(i32 %0) {
%2 = tail call i32 @ntohl(i32 %0)
%3 = lshr i32 %2, 24
%4 = lshr i32 %2, 16
%5 = and i32 %4, 255
%6 = lshr i32 %2, 8
%7 = and i32 %6, 255
%8 = and i32 %2, 255
%9 = icmp ult i32 %2, 16777216
br i1 %9, label %81, label %10
10: ; preds = %1
%11 = trunc i32 %3 to i8
switch i8 %11, label %18 [
i8 10, label %81
i8 100, label %12
i8 127, label %17
]
12: ; preds = %10
%13 = and i32 %2, 12582912
%14 = icmp eq i32 %13, 4194304
br i1 %14, label %81, label %15
15: ; preds = %12
%16 = icmp eq i32 %5, 0
br label %42
17: ; preds = %10
br label %81
18: ; preds = %10
%19 = icmp eq i32 %3, 169
%20 = icmp eq i32 %5, 254
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %81, label %22
22: ; preds = %18
%23 = icmp eq i32 %3, 172
%24 = and i32 %2, 15728640
%25 = icmp eq i32 %24, 1048576
%26 = and i1 %23, %25
br i1 %26, label %81, label %27
27: ; preds = %22
%28 = icmp eq i32 %3, 192
%29 = icmp eq i32 %5, 0
%30 = select i1 %28, i1 %29, i1 false
%31 = icmp eq i32 %7, 0
%32 = select i1 %30, i1 %31, i1 false
br i1 %32, label %81, label %33
33: ; preds = %27
%34 = icmp eq i32 %5, 2
%35 = select i1 %28, i1 %34, i1 false
%36 = select i1 %35, i1 %31, i1 false
br i1 %36, label %81, label %37
37: ; preds = %33
%38 = icmp eq i32 %5, 51
%39 = select i1 %28, i1 %38, i1 false
%40 = icmp eq i32 %7, 100
%41 = select i1 %39, i1 %40, i1 false
br i1 %41, label %81, label %42
42: ; preds = %15, %37
%43 = phi i1 [ %16, %15 ], [ %29, %37 ]
%44 = phi i1 [ false, %15 ], [ %28, %37 ]
%45 = icmp eq i32 %3, 203
%46 = select i1 %45, i1 %43, i1 false
%47 = icmp eq i32 %7, 113
%48 = select i1 %46, i1 %47, i1 false
br i1 %48, label %81, label %49
49: ; preds = %42
%50 = icmp eq i32 %5, 88
%51 = select i1 %44, i1 %50, i1 false
%52 = icmp eq i32 %7, 99
%53 = select i1 %51, i1 %52, i1 false
br i1 %53, label %81, label %54
54: ; preds = %49
%55 = icmp eq i32 %5, 52
%56 = select i1 %44, i1 %55, i1 false
%57 = icmp eq i32 %7, 193
%58 = select i1 %56, i1 %57, i1 false
br i1 %58, label %81, label %59
59: ; preds = %54
%60 = icmp eq i32 %5, 168
%61 = select i1 %44, i1 %60, i1 false
br i1 %61, label %81, label %62
62: ; preds = %59
%63 = icmp eq i32 %3, 255
%64 = icmp eq i32 %5, 255
%65 = select i1 %63, i1 %64, i1 false
%66 = icmp eq i32 %7, 255
%67 = select i1 %65, i1 %66, i1 false
%68 = icmp eq i32 %8, 255
%69 = select i1 %67, i1 %68, i1 false
br i1 %69, label %81, label %70
70: ; preds = %62
%71 = icmp eq i32 %3, 198
%72 = and i32 %2, 16646144
%73 = icmp eq i32 %72, 1179648
%74 = and i1 %71, %73
br i1 %74, label %81, label %75
75: ; preds = %70
%76 = and i32 %2, -268435456
%77 = icmp eq i32 %76, -536870912
br i1 %77, label %81, label %78
78: ; preds = %75
%79 = icmp ugt i32 %2, -268435457
%80 = select i1 %79, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0)
br label %81
81: ; preds = %78, %75, %70, %62, %59, %54, %49, %42, %37, %33, %27, %22, %18, %10, %12, %1, %17
%82 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), %17 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %10 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), %12 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %18 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %22 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), %27 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), %33 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), %37 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), %42 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), %49 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), %54 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %59 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), %62 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), %70 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), %75 ], [ %80, %78 ]
ret i8* %82
}