#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 get16(unsigned char *);
int /*<<< orphan*/ get32(unsigned char *);
int /*<<< orphan*/ lprintf(int, char *, ...);
int mask2width(int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, unsigned char, unsigned char,
                           unsigned char, unsigned char, ...);
void rip_dump(unsigned char *data, int length) {
  int i;
  int cmd;
  int version;
  int domain;
  char ipaddmask[25];
  lprintf(6, "RIP: ");
  cmd = data[0];
  version = data[1];
  domain = get16(data + 2);
  length -= 4;
  data += 4;
  switch (cmd) {
  case 1:
    lprintf(9, "REQUEST");
    break;
  case 2:
    lprintf(9, "RESPONSE");
    break;
  default:
    lprintf(9, " cmd %u", cmd);
    break;
  }
  switch (version) {
  case 98:
    lprintf(9, " vers %u entries %u\n", version, length / 6);
    i = 0;
    while (length >= 6) {
      sprintf(ipaddmask, "%u.%u.%u.%u/%-2u", data[0], data[1], data[2], data[3],
              data[4]);
      lprintf(8, "%-16s %-3u ", ipaddmask, data[5]);
      if ((++i % 3) == 0)
        lprintf(9, "\n");
      length -= 6;
      data += 6;
    }
    if ((i % 3) != 0)
      lprintf(9, "\n");
    break;
  default:
    lprintf(9, " vers %u entries %u domain %u:\n", version, length / 20,
            domain);
    i = 0;
    while (length >= 20) {
      if (get16(data + 0) != 2) {
        length -= 20;
        data += 20;
        continue;
      }
      if (version >= 2) {
        sprintf(ipaddmask, "%u.%u.%u.%u/%-4d", data[4], data[5], data[6],
                data[7], mask2width(get32(data + 8)));
      } else {
        sprintf(ipaddmask, "%u.%u.%u.%u/??", data[4], data[5], data[6],
                data[7]);
      }
      lprintf(8, "%-20s%-3u", ipaddmask, get32(data + 16));
      if ((++i % 3) == 0)
        lprintf(9, "\n");
      length -= 20;
      data += 20;
    }
    if ((i % 3) != 0)
      lprintf(9, "\n");
    break;
  }
}


x86 assembly (clang, -O0):
<rip_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xe9a(%rip),%rsi
xor    %eax,%eax
mov    $0x6,%edi
call   1070 <lprintf@plt>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
call   1050 <get16@plt>
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffffc,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
sub    $0x1,%eax
je     11d1 <rip_dump+0x81>
jmp    11c0 <rip_dump+0x70>
mov    -0x44(%rbp),%eax
sub    $0x2,%eax
je     11e9 <rip_dump+0x99>
jmp    1201 <rip_dump+0xb1>
mov    $0x9,%edi
lea    0xe29(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
jmp    1217 <rip_dump+0xc7>
mov    $0x9,%edi
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
jmp    1217 <rip_dump+0xc7>
mov    -0x14(%rbp),%edx
mov    $0x9,%edi
lea    0xe07(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
mov    -0x18(%rbp),%eax
sub    $0x62,%eax
jne    133c <rip_dump+0x1ec>
jmp    1228 <rip_dump+0xd8>
mov    -0x18(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    -0x48(%rbp),%edx
mov    %eax,%ecx
mov    $0x9,%edi
lea    0xdd5(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x6,-0xc(%rbp)
jl     1310 <rip_dump+0x1c0>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%dl
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%r8b
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%r9b
mov    -0x8(%rbp),%rax
movzbl 0x4(%rax),%eax
lea    0xda2(%rip),%rsi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
mov    %eax,(%rsp)
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x40(%rbp),%rdx
mov    -0x8(%rbp),%rax
movzbl 0x5(%rax),%ecx
mov    $0x8,%edi
lea    0xd83(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12f6 <rip_dump+0x1a6>
mov    $0x9,%edi
lea    0xd80(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
mov    -0xc(%rbp),%eax
sub    $0x6,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x8(%rbp)
jmp    1258 <rip_dump+0x108>
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1337 <rip_dump+0x1e7>
mov    $0x9,%edi
lea    0xd3f(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
jmp    1506 <rip_dump+0x3b6>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    -0x4c(%rbp),%edx
mov    %eax,%ecx
mov    -0x1c(%rbp),%r8d
mov    $0x9,%edi
lea    0xcef(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x14,-0xc(%rbp)
jl     14da <rip_dump+0x38a>
mov    -0x8(%rbp),%rdi
call   1050 <get16@plt>
cmp    $0x2,%eax
je     13a6 <rip_dump+0x256>
mov    -0xc(%rbp),%eax
sub    $0x14,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x8(%rbp)
jmp    1370 <rip_dump+0x220>
cmpl   $0x2,-0x18(%rbp)
jl     142a <rip_dump+0x2da>
lea    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%al
mov    %al,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    0x5(%rax),%al
mov    %al,-0x4f(%rbp)
mov    -0x8(%rbp),%rax
mov    0x6(%rax),%al
mov    %al,-0x4e(%rbp)
mov    -0x8(%rbp),%rax
mov    0x7(%rax),%al
mov    %al,-0x4d(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
call   1040 <get32@plt>
mov    %eax,%edi
call   1030 <mask2width@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%dl
mov    -0x4f(%rbp),%cl
mov    -0x4e(%rbp),%r8b
mov    -0x4d(%rbp),%r9b
lea    0xc64(%rip),%rsi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
mov    %eax,(%rsp)
mov    $0x0,%al
call   1060 <sprintf@plt>
jmp    1465 <rip_dump+0x315>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%dl
mov    -0x8(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x8(%rbp),%rax
mov    0x6(%rax),%r8b
mov    -0x8(%rbp),%rax
lea    0xc33(%rip),%rsi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl 0x7(%rax),%r9d
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
call   1040 <get32@plt>
mov    -0x60(%rbp),%rdx
mov    %eax,%ecx
mov    $0x8,%edi
lea    0xc05(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    14c0 <rip_dump+0x370>
mov    $0x9,%edi
lea    0xbb6(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
mov    -0xc(%rbp),%eax
sub    $0x14,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x8(%rbp)
jmp    1370 <rip_dump+0x220>
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1501 <rip_dump+0x3b1>
mov    $0x9,%edi
lea    0xb75(%rip),%rsi
mov    $0x0,%al
call   1070 <lprintf@plt>
jmp    1506 <rip_dump+0x3b6>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rip_dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xe96(%rip),%rsi
mov    $0x6,%edi
xor    %eax,%eax
call   1070 <lprintf@plt>
movzbl (%rbx),%r12d
movzbl 0x1(%rbx),%r14d
lea    0x2(%rbx),%rdi
call   1050 <get16@plt>
mov    %eax,%r15d
cmp    $0x2,%r12d
je     11a0 <rip_dump+0x50>
cmp    $0x1,%r12b
jne    11b5 <rip_dump+0x65>
lea    0xe68(%rip),%rsi
jmp    11a7 <rip_dump+0x57>
lea    0xe67(%rip),%rsi
mov    $0x9,%edi
xor    %eax,%eax
call   1070 <lprintf@plt>
jmp    11cb <rip_dump+0x7b>
lea    0xe5b(%rip),%rsi
mov    $0x9,%edi
mov    %r12d,%edx
xor    %eax,%eax
call   1070 <lprintf@plt>
lea    -0x4(%rbp),%r13d
add    $0x4,%rbx
cmp    $0x62,%r14b
jne    12e4 <rip_dump+0x194>
movslq %r13d,%rax
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
shr    $0x20,%rcx
add    %eax,%ecx
lea    0xe24(%rip),%rsi
mov    $0x9,%edi
mov    $0x62,%edx
xor    %eax,%eax
call   1070 <lprintf@plt>
cmp    $0xa,%ebp
jl     147c <rip_dump+0x32c>
add    $0x2,%ebp
mov    $0xffffffff,%r14d
mov    $0x1,%r12d
xor    %edx,%edx
xor    %r15d,%r15d
jmp    125b <rip_dump+0x10b>
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%rbp
add    $0xfffffffa,%ebp
mov    0x14(%rsp),%edx
add    $0xffffffff,%edx
add    $0xffffffff,%r14d
add    $0x1,%r12d
add    $0x1,%r15d
add    $0x6,%r13
cmp    $0xb,%ebp
mov    %r13,%rbx
jle    148b <rip_dump+0x33b>
mov    %edx,0x14(%rsp)
mov    %rbp,0x18(%rsp)
mov    %r12d,%eax
mov    $0xaaaaaaab,%ecx
imul   %rcx,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%ebp
movzbl (%rbx),%edx
movzbl 0x1(%rbx),%ecx
movzbl 0x2(%rbx),%r8d
movzbl 0x3(%rbx),%r9d
movzbl 0x4(%rbx),%eax
mov    %eax,(%rsp)
mov    %rbx,%r13
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
lea    0xd93(%rip),%rsi
xor    %eax,%eax
call   1060 <sprintf@plt>
movzbl 0x5(%r13),%ecx
mov    $0x8,%edi
lea    0xd8c(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <lprintf@plt>
add    %r14d,%ebp
jne    1230 <rip_dump+0xe0>
mov    $0x9,%edi
lea    0xd97(%rip),%rsi
xor    %eax,%eax
call   1070 <lprintf@plt>
jmp    1230 <rip_dump+0xe0>
movslq %r13d,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x23,%rcx
add    %eax,%ecx
lea    0xd4f(%rip),%rsi
mov    $0x9,%edi
mov    %r14d,%edx
mov    %r15d,%r8d
xor    %eax,%eax
call   1070 <lprintf@plt>
cmp    $0x18,%ebp
jl     147c <rip_dump+0x32c>
xor    %r15d,%r15d
mov    %r13d,%r13d
mov    $0x14,%ebp
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%r12,1),%rdi
call   1050 <get16@plt>
cmp    $0x2,%eax
je     1360 <rip_dump+0x210>
add    $0x14,%r12
add    $0xffffffffffffffec,%rbp
lea    0x0(%rbp,%r13,1),%eax
cmp    $0x27,%eax
jg     1330 <rip_dump+0x1e0>
jmp    1456 <rip_dump+0x306>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,0x18(%rsp)
mov    0x4(%rbx,%r12,1),%r15b
mov    0x5(%rbx,%r12,1),%bpl
mov    0x6(%rbx,%r12,1),%sil
mov    0x7(%rbx,%r12,1),%al
cmp    $0x2,%r14b
jb     13c4 <rip_dump+0x274>
lea    (%rbx,%r12,1),%rdi
add    $0x8,%rdi
mov    %al,0x14(%rsp)
mov    %sil,0x13(%rsp)
call   1040 <get32@plt>
mov    %eax,%edi
call   1030 <mask2width@plt>
mov    %eax,(%rsp)
movzbl %r15b,%edx
movzbl %bpl,%ecx
movzbl 0x13(%rsp),%r8d
movzbl 0x14(%rsp),%r9d
lea    0x20(%rsp),%r15
mov    %r15,%rdi
lea    0xcaf(%rip),%rsi
jmp    13e3 <rip_dump+0x293>
movzbl %r15b,%edx
movzbl %bpl,%ecx
movzbl %sil,%r8d
movzbl %al,%r9d
lea    0x20(%rsp),%r15
mov    %r15,%rdi
lea    0xc9f(%rip),%rsi
xor    %eax,%eax
call   1060 <sprintf@plt>
mov    %r13,%rbp
sub    %r12,%rbp
lea    (%rbx,%r12,1),%rdi
add    $0x10,%rdi
call   1040 <get32@plt>
mov    $0x8,%edi
lea    0xc88(%rip),%rsi
mov    %r15,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1070 <lprintf@plt>
mov    0x18(%rsp),%r15d
add    $0x1,%r15d
imul   $0xaaaaaaab,%r15d,%eax
cmp    $0x55555555,%eax
ja     143f <rip_dump+0x2ef>
mov    $0x9,%edi
lea    0xc37(%rip),%rsi
xor    %eax,%eax
call   1070 <lprintf@plt>
sub    %r12d,%r13d
add    $0xffffffec,%r13d
add    %r12,%rbx
add    $0x14,%rbx
cmp    $0x27,%ebp
jg     1320 <rip_dump+0x1d0>
imul   $0xaaaaaaab,%r15d,%eax
add    $0x2aaaaaaa,%eax
cmp    $0x55555555,%eax
jb     147c <rip_dump+0x32c>
lea    0xbff(%rip),%rsi
mov    $0x9,%edi
xor    %eax,%eax
call   1070 <lprintf@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15d,%eax
mov    $0xaaaaaaab,%ecx
imul   %rax,%rcx
shr    $0x21,%rcx
lea    (%rcx,%rcx,2),%eax
add    %eax,%edx
jne    1469 <rip_dump+0x319>
jmp    147c <rip_dump+0x32c>

LLVM IR (-O0):
@.str = [6 x i8] c"RIP: \00"
@.str.1 = [8 x i8] c"REQUEST\00"
@.str.2 = [9 x i8] c"RESPONSE\00"
@.str.3 = [8 x i8] c" cmd %u\00"
@.str.4 = [21 x i8] c" vers %u entries %u\0A\00"
@.str.5 = [17 x i8] c"%u.%u.%u.%u/%-2u\00"
@.str.6 = [12 x i8] c"%-16s %-3u \00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [32 x i8] c" vers %u entries %u domain %u:\0A\00"
@.str.9 = [17 x i8] c"%u.%u.%u.%u/%-4d\00"
@.str.10 = [15 x i8] c"%u.%u.%u.%u/??\00"
@.str.11 = [10 x i8] c"%-20s%-3u\00"
define void @rip_dump(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [25 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%10 = call i32 (i32, i8*, ...) @lprintf(i32 6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
store i32 %14, i32* %6
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
store i32 %18, i32* %7
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 2
%21 = call i32 @get16(i8* %20)
store i32 %21, i32* %8
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 4
store i32 %23, i32* %4
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i64 4
store i8* %25, i8** %3
%26 = load i32, i32* %6
switch i32 %26, label %31 [
i32 1, label %27
i32 2, label %29
]
27: ; preds = %2
%28 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %34
29: ; preds = %2
%30 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %34
31: ; preds = %2
%32 = load i32, i32* %6
%33 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %29, %27
%35 = load i32, i32* %7
switch i32 %35, label %87 [
i32 98, label %36
]
36: ; preds = %34
%37 = load i32, i32* %7
%38 = load i32, i32* %4
%39 = sdiv i32 %38, 6
%40 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %37, i32 %39)
store i32 0, i32* %5
br label %41
41: ; preds = %75, %36
%42 = load i32, i32* %4
%43 = icmp sge i32 %42, 6
br i1 %43, label %44, label %80
44: ; preds = %41
%45 = getelementptr inbounds [25 x i8], [25 x i8]* %9, i64 0, i64 0
%46 = load i8*, i8** %3
%47 = getelementptr inbounds i8, i8* %46, i64 0
%48 = load i8, i8* %47
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i64 1
%51 = load i8, i8* %50
%52 = load i8*, i8** %3
%53 = getelementptr inbounds i8, i8* %52, i64 2
%54 = load i8, i8* %53
%55 = load i8*, i8** %3
%56 = getelementptr inbounds i8, i8* %55, i64 3
%57 = load i8, i8* %56
%58 = load i8*, i8** %3
%59 = getelementptr inbounds i8, i8* %58, i64 4
%60 = load i8, i8* %59
%61 = zext i8 %60 to i32
%62 = call i32 (i8*, i8*, i8, i8, i8, i8, ...) @sprintf(i8* %45, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8 zeroext %48, i8 zeroext %51, i8 zeroext %54, i8 zeroext %57, i32 %61)
%63 = getelementptr inbounds [25 x i8], [25 x i8]* %9, i64 0, i64 0
%64 = load i8*, i8** %3
%65 = getelementptr inbounds i8, i8* %64, i64 5
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = call i32 (i32, i8*, ...) @lprintf(i32 8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %63, i32 %67)
%69 = load i32, i32* %5
%70 = add nsw i32 %69, 1
store i32 %70, i32* %5
%71 = srem i32 %70, 3
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %44
%74 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %75
75: ; preds = %73, %44
%76 = load i32, i32* %4
%77 = sub nsw i32 %76, 6
store i32 %77, i32* %4
%78 = load i8*, i8** %3
%79 = getelementptr inbounds i8, i8* %78, i64 6
store i8* %79, i8** %3
br label %41
80: ; preds = %41
%81 = load i32, i32* %5
%82 = srem i32 %81, 3
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %86
84: ; preds = %80
%85 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %86
86: ; preds = %84, %80
br label %167
87: ; preds = %34
%88 = load i32, i32* %7
%89 = load i32, i32* %4
%90 = sdiv i32 %89, 20
%91 = load i32, i32* %8
%92 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i32 %88, i32 %90, i32 %91)
store i32 0, i32* %5
br label %93
93: ; preds = %155, %101, %87
%94 = load i32, i32* %4
%95 = icmp sge i32 %94, 20
br i1 %95, label %96, label %160
96: ; preds = %93
%97 = load i8*, i8** %3
%98 = getelementptr inbounds i8, i8* %97, i64 0
%99 = call i32 @get16(i8* %98)
%100 = icmp ne i32 %99, 2
br i1 %100, label %101, label %106
101: ; preds = %96
%102 = load i32, i32* %4
%103 = sub nsw i32 %102, 20
store i32 %103, i32* %4
%104 = load i8*, i8** %3
%105 = getelementptr inbounds i8, i8* %104, i64 20
store i8* %105, i8** %3
br label %93
106: ; preds = %96
%107 = load i32, i32* %7
%108 = icmp sge i32 %107, 2
br i1 %108, label %109, label %128
109: ; preds = %106
%110 = getelementptr inbounds [25 x i8], [25 x i8]* %9, i64 0, i64 0
%111 = load i8*, i8** %3
%112 = getelementptr inbounds i8, i8* %111, i64 4
%113 = load i8, i8* %112
%114 = load i8*, i8** %3
%115 = getelementptr inbounds i8, i8* %114, i64 5
%116 = load i8, i8* %115
%117 = load i8*, i8** %3
%118 = getelementptr inbounds i8, i8* %117, i64 6
%119 = load i8, i8* %118
%120 = load i8*, i8** %3
%121 = getelementptr inbounds i8, i8* %120, i64 7
%122 = load i8, i8* %121
%123 = load i8*, i8** %3
%124 = getelementptr inbounds i8, i8* %123, i64 8
%125 = call i32 @get32(i8* %124)
%126 = call i32 @mask2width(i32 %125)
%127 = call i32 (i8*, i8*, i8, i8, i8, i8, ...) @sprintf(i8* %110, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8 zeroext %113, i8 zeroext %116, i8 zeroext %119, i8 zeroext %122, i32 %126)
br label %143
128: ; preds = %106
%129 = getelementptr inbounds [25 x i8], [25 x i8]* %9, i64 0, i64 0
%130 = load i8*, i8** %3
%131 = getelementptr inbounds i8, i8* %130, i64 4
%132 = load i8, i8* %131
%133 = load i8*, i8** %3
%134 = getelementptr inbounds i8, i8* %133, i64 5
%135 = load i8, i8* %134
%136 = load i8*, i8** %3
%137 = getelementptr inbounds i8, i8* %136, i64 6
%138 = load i8, i8* %137
%139 = load i8*, i8** %3
%140 = getelementptr inbounds i8, i8* %139, i64 7
%141 = load i8, i8* %140
%142 = call i32 (i8*, i8*, i8, i8, i8, i8, ...) @sprintf(i8* %129, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i8 zeroext %132, i8 zeroext %135, i8 zeroext %138, i8 zeroext %141)
br label %143
143: ; preds = %128, %109
%144 = getelementptr inbounds [25 x i8], [25 x i8]* %9, i64 0, i64 0
%145 = load i8*, i8** %3
%146 = getelementptr inbounds i8, i8* %145, i64 16
%147 = call i32 @get32(i8* %146)
%148 = call i32 (i32, i8*, ...) @lprintf(i32 8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* %144, i32 %147)
%149 = load i32, i32* %5
%150 = add nsw i32 %149, 1
store i32 %150, i32* %5
%151 = srem i32 %150, 3
%152 = icmp eq i32 %151, 0
br i1 %152, label %153, label %155
153: ; preds = %143
%154 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %155
155: ; preds = %153, %143
%156 = load i32, i32* %4
%157 = sub nsw i32 %156, 20
store i32 %157, i32* %4
%158 = load i8*, i8** %3
%159 = getelementptr inbounds i8, i8* %158, i64 20
store i8* %159, i8** %3
br label %93
160: ; preds = %93
%161 = load i32, i32* %5
%162 = srem i32 %161, 3
%163 = icmp ne i32 %162, 0
br i1 %163, label %164, label %166
164: ; preds = %160
%165 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %166
166: ; preds = %164, %160
br label %167
167: ; preds = %166, %86
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"RIP: \00"
@.str.1 = [8 x i8] c"REQUEST\00"
@.str.2 = [9 x i8] c"RESPONSE\00"
@.str.3 = [8 x i8] c" cmd %u\00"
@.str.4 = [21 x i8] c" vers %u entries %u\0A\00"
@.str.5 = [17 x i8] c"%u.%u.%u.%u/%-2u\00"
@.str.6 = [12 x i8] c"%-16s %-3u \00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [32 x i8] c" vers %u entries %u domain %u:\0A\00"
@.str.9 = [17 x i8] c"%u.%u.%u.%u/%-4d\00"
@.str.10 = [15 x i8] c"%u.%u.%u.%u/??\00"
@.str.11 = [10 x i8] c"%-20s%-3u\00"
define void @rip_dump(i8* %0, i32 %1) {
%3 = alloca [25 x i8]
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i32, i8*, ...) @lprintf(i32 6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = load i8, i8* %0
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = tail call i32 @get16(i8* %10)
%12 = add nsw i32 %1, -4
%13 = getelementptr inbounds i8, i8* %0, i64 4
switch i8 %6, label %18 [
i8 1, label %14
i8 2, label %16
]
14: ; preds = %2
%15 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %21
16: ; preds = %2
%17 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %21
18: ; preds = %2
%19 = zext i8 %6 to i32
%20 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %16, %14
%22 = icmp eq i8 %8, 98
br i1 %22, label %23, label %58
23: ; preds = %21
%24 = sdiv i32 %12, 6
%25 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 98, i32 %24)
%26 = icmp sgt i32 %1, 9
br i1 %26, label %27, label %112
27: ; preds = %23, %51
%28 = phi i8* [ %53, %51 ], [ %13, %23 ]
%29 = phi i32 [ %52, %51 ], [ %12, %23 ]
%30 = phi i32 [ %46, %51 ], [ 0, %23 ]
%31 = load i8, i8* %28
%32 = getelementptr inbounds i8, i8* %28, i64 1
%33 = load i8, i8* %32
%34 = getelementptr inbounds i8, i8* %28, i64 2
%35 = load i8, i8* %34
%36 = getelementptr inbounds i8, i8* %28, i64 3
%37 = load i8, i8* %36
%38 = getelementptr inbounds i8, i8* %28, i64 4
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = call i32 (i8*, i8*, i8, i8, i8, i8, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8 zeroext %31, i8 zeroext %33, i8 zeroext %35, i8 zeroext %37, i32 %40)
%42 = getelementptr inbounds i8, i8* %28, i64 5
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = call i32 (i32, i8*, ...) @lprintf(i32 8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %4, i32 %44)
%46 = add nuw nsw i32 %30, 1
%47 = urem i32 %46, 3
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %27
%50 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %51
51: ; preds = %49, %27
%52 = add nsw i32 %29, -6
%53 = getelementptr inbounds i8, i8* %28, i64 6
%54 = icmp sgt i32 %29, 11
br i1 %54, label %27, label %55
55: ; preds = %51
%56 = urem i32 %46, 3
%57 = icmp eq i32 %56, 0
br i1 %57, label %112, label %110
58: ; preds = %21
%59 = sdiv i32 %12, 20
%60 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i32 %9, i32 %59, i32 %11)
%61 = icmp sgt i32 %1, 23
br i1 %61, label %62, label %112
62: ; preds = %58
%63 = icmp ugt i8 %8, 1
br label %64
64: ; preds = %62, %102
%65 = phi i8* [ %13, %62 ], [ %104, %102 ]
%66 = phi i32 [ %12, %62 ], [ %103, %102 ]
%67 = phi i32 [ 0, %62 ], [ %97, %102 ]
br label %68
68: ; preds = %64, %73
%69 = phi i8* [ %65, %64 ], [ %75, %73 ]
%70 = phi i32 [ %66, %64 ], [ %74, %73 ]
%71 = call i32 @get16(i8* %69)
%72 = icmp eq i32 %71, 2
br i1 %72, label %77, label %73
73: ; preds = %68
%74 = add nsw i32 %70, -20
%75 = getelementptr inbounds i8, i8* %69, i64 20
%76 = icmp sgt i32 %70, 39
br i1 %76, label %68, label %106
77: ; preds = %68
%78 = getelementptr inbounds i8, i8* %69, i64 4
%79 = load i8, i8* %78
%80 = getelementptr inbounds i8, i8* %69, i64 5
%81 = load i8, i8* %80
%82 = getelementptr inbounds i8, i8* %69, i64 6
%83 = load i8, i8* %82
%84 = getelementptr inbounds i8, i8* %69, i64 7
%85 = load i8, i8* %84
br i1 %63, label %86, label %91
86: ; preds = %77
%87 = getelementptr inbounds i8, i8* %69, i64 8
%88 = call i32 @get32(i8* %87)
%89 = call i32 @mask2width(i32 %88)
%90 = call i32 (i8*, i8*, i8, i8, i8, i8, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8 zeroext %79, i8 zeroext %81, i8 zeroext %83, i8 zeroext %85, i32 %89)
br label %93
91: ; preds = %77
%92 = call i32 (i8*, i8*, i8, i8, i8, i8, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i8 zeroext %79, i8 zeroext %81, i8 zeroext %83, i8 zeroext %85)
br label %93
93: ; preds = %91, %86
%94 = getelementptr inbounds i8, i8* %69, i64 16
%95 = call i32 @get32(i8* %94)
%96 = call i32 (i32, i8*, ...) @lprintf(i32 8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* %4, i32 %95)
%97 = add nuw nsw i32 %67, 1
%98 = urem i32 %97, 3
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %102
100: ; preds = %93
%101 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %102
102: ; preds = %100, %93
%103 = add nsw i32 %70, -20
%104 = getelementptr inbounds i8, i8* %69, i64 20
%105 = icmp sgt i32 %70, 39
br i1 %105, label %64, label %106
106: ; preds = %102, %73
%107 = phi i32 [ %67, %73 ], [ %97, %102 ]
%108 = srem i32 %107, 3
%109 = icmp eq i32 %108, 0
br i1 %109, label %112, label %110
110: ; preds = %106, %55
%111 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %112
112: ; preds = %110, %58, %23, %106, %55
ret void
}