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

/* Variables and functions */
int /*<<< orphan*/ inet_ntoa(struct in_addr);
int /*<<< orphan*/ lprintf(int, char *, ...);
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
void rspf_dump(unsigned char *data, int length) {
  int bptr, nodes, links, adjs;
  lprintf(9, "RSPF: version %u ", data[0]);
  switch (data[1]) {
  case 3:
    lprintf(9, "type RRH seq %#04x flags %d\n", ntohs(*((u_short *)(&data[8]))),
            data[10]);
    bptr = 11;
    while (bptr < length)
      lprintf(9, "%c", data[bptr++]);
    lprintf(9, "\n");
    break;
  case 1:
    lprintf(9, "type ROUTING UPDATE ");
    lprintf(9, "fragment %u frag total %u sync %u #nodes %u env_id %u\n",
            data[2], data[3], data[6], data[7],
            ntohs(*((u_short *)(&data[8]))));
    bptr = data[6] + 6;
    nodes = data[7];
    while (nodes-- && (length - bptr) > 7) {
      lprintf(5, "     Reporting Router: %s Seq %u Subseq %u #links %u\n",
              inet_ntoa(*((struct in_addr *)(&data[bptr]))),
              ntohs(*((u_short *)(&data[bptr + 4]))), data[bptr + 6],
              data[bptr + 7]);
      links = data[bptr + 7];
      bptr += 8;
      while (links-- && (length - bptr) > 4) {
        lprintf(5,
                "          horizon %u ERP factor %u cost %u #adjacencies %u\n",
                data[bptr], data[bptr + 1], data[bptr + 2], data[bptr + 3]);
        adjs = data[bptr + 3];
        bptr += 4;
        while (adjs-- && (length - bptr) > 4) {
          lprintf(5, "               %s/%d \n",
                  inet_ntoa(*((struct in_addr *)(&data[bptr + 1]))),
                  data[bptr] & 0x3f);
          bptr += 5;
        }
      }
    }
    break;
  default:
    lprintf(1, "Unknown packet type %d\n", data[1]);
    break;
  }
}


x86 assembly (clang, -O0):
<rspf_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
lea    0xeb3(%rip),%rsi
xor    %eax,%eax
mov    $0x9,%edi
call   1050 <lprintf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
mov    %eax,-0x20(%rbp)
sub    $0x1,%eax
je     1205 <rspf_dump+0xd5>
jmp    1172 <rspf_dump+0x42>
mov    -0x20(%rbp),%eax
sub    $0x3,%eax
jne    147d <rspf_dump+0x34d>
jmp    1183 <rspf_dump+0x53>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
call   1040 <ntohs@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movzbl 0xa(%rax),%ecx
mov    $0x9,%edi
lea    0xe6d(%rip),%rsi
mov    $0x0,%al
call   1050 <lprintf@plt>
movl   $0xb,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ed <rspf_dump+0xbd>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
mov    $0x9,%edi
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1050 <lprintf@plt>
jmp    11b3 <rspf_dump+0x83>
mov    $0x9,%edi
lea    0xf0c(%rip),%rsi
mov    $0x0,%al
call   1050 <lprintf@plt>
jmp    1498 <rspf_dump+0x368>
mov    $0x9,%edi
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1050 <lprintf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x6(%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x7(%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
call   1040 <ntohs@plt>
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    $0x9,%edi
lea    0xddd(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1050 <lprintf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x6(%rax),%eax
add    $0x6,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x7(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x31(%rbp)
je     12b5 <rspf_dump+0x185>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
cmp    $0x7,%eax
setg   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    12c5 <rspf_dump+0x195>
jmp    1478 <rspf_dump+0x348>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%edi
call   1030 <inet_ntoa@plt>
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%edi
call   1040 <ntohs@plt>
mov    -0x38(%rbp),%edx
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%esi
add    $0x6,%esi
movslq %esi,%rsi
movzbl (%rax,%rsi,1),%r8d
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%esi
add    $0x7,%esi
movslq %esi,%rsi
movzbl (%rax,%rsi,1),%r9d
mov    $0x5,%edi
lea    0xd5c(%rip),%rsi
mov    $0x0,%al
call   1050 <lprintf@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x7,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x39(%rbp)
je     136e <rspf_dump+0x23e>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
cmp    $0x4,%eax
setg   %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    137e <rspf_dump+0x24e>
jmp    1473 <rspf_dump+0x343>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%ecx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%esi
add    $0x2,%esi
movslq %esi,%rsi
movzbl (%rax,%rsi,1),%r8d
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%esi
add    $0x3,%esi
movslq %esi,%rsi
movzbl (%rax,%rsi,1),%r9d
mov    $0x5,%edi
lea    0xce9(%rip),%rsi
mov    $0x0,%al
call   1050 <lprintf@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x10(%rbp)
mov    -0x1c(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x3a(%rbp)
je     1417 <rspf_dump+0x2e7>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
cmp    $0x4,%eax
setg   %al
mov    %al,-0x3a(%rbp)
mov    -0x3a(%rbp),%al
test   $0x1,%al
jne    1427 <rspf_dump+0x2f7>
jmp    146e <rspf_dump+0x33e>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%edi
call   1030 <inet_ntoa@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%ecx
and    $0x3f,%ecx
mov    $0x5,%edi
lea    0xc97(%rip),%rsi
mov    $0x0,%al
call   1050 <lprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x10(%rbp)
jmp    13ef <rspf_dump+0x2bf>
jmp    1346 <rspf_dump+0x216>
jmp    128d <rspf_dump+0x15d>
jmp    1498 <rspf_dump+0x368>
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%edx
mov    $0x1,%edi
lea    0xc76(%rip),%rsi
mov    $0x0,%al
call   1050 <lprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rspf_dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %esi,%r12d
mov    %rdi,%r13
movzbl (%rdi),%edx
lea    0xeb2(%rip),%rsi
mov    $0x9,%edi
xor    %eax,%eax
call   1050 <lprintf@plt>
movzbl 0x1(%r13),%edx
cmp    $0x1,%edx
je     11ef <rspf_dump+0xbf>
cmp    $0x3,%dl
jne    13ff <rspf_dump+0x2cf>
mov    0x8(%r13),%edi
call   1040 <ntohs@plt>
movzbl 0xa(%r13),%ecx
lea    0xe8c(%rip),%rsi
mov    $0x9,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <lprintf@plt>
cmp    $0xc,%r12d
jl     11ce <rspf_dump+0x9e>
mov    %r12d,%r15d
mov    $0xb,%ebx
lea    0xe86(%rip),%r14
nopl   0x0(%rax)
movzbl 0x0(%r13,%rbx,1),%edx
add    $0x1,%rbx
mov    $0x9,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <lprintf@plt>
cmp    %rbx,%r15
jne    11b0 <rspf_dump+0x80>
lea    0xf30(%rip),%rsi
mov    $0x9,%edi
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <lprintf@plt>
lea    0xe3c(%rip),%rsi
mov    $0x9,%edi
xor    %eax,%eax
call   1050 <lprintf@plt>
movzbl 0x2(%r13),%r15d
movzbl 0x3(%r13),%r14d
movzbl 0x6(%r13),%ebx
movzbl 0x7(%r13),%ebp
mov    0x8(%r13),%edi
call   1040 <ntohs@plt>
mov    %eax,(%rsp)
lea    0xe1e(%rip),%rsi
mov    $0x9,%edi
mov    %r15d,%edx
mov    %r14d,%ecx
mov    %ebx,%r8d
mov    %ebp,%r9d
xor    %eax,%eax
call   1050 <lprintf@plt>
movzbl 0x7(%r13),%eax
mov    %eax,0x14(%rsp)
test   %eax,%eax
je     13f0 <rspf_dump+0x2c0>
movzbl 0x6(%r13),%r14d
add    $0x6,%r14d
mov    %r12d,%eax
sub    %r14d,%eax
cmp    $0x8,%eax
jl     13f0 <rspf_dump+0x2c0>
movslq %r12d,%rax
lea    0x1(%r13),%rcx
mov    %rcx,0x20(%rsp)
add    $0xfffffffffffffffb,%rax
mov    %rax,0x28(%rsp)
lea    0xe2e(%rip),%r15
mov    %r13,0x30(%rsp)
mov    %r12d,0x18(%rsp)
addl   $0xffffffff,0x14(%rsp)
movslq %r14d,%r14
mov    0x0(%r13,%r14,1),%edi
call   1030 <inet_ntoa@plt>
mov    %eax,%ebx
mov    0x4(%r13,%r14,1),%edi
call   1040 <ntohs@plt>
movzbl 0x6(%r13,%r14,1),%r8d
movzbl 0x7(%r13,%r14,1),%r9d
mov    $0x5,%edi
lea    0xdb8(%rip),%rsi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <lprintf@plt>
movzbl 0x7(%r13,%r14,1),%ebp
add    $0x8,%r14d
mov    %r12d,%ebx
sub    %r14d,%ebx
jmp    130b <rspf_dump+0x1db>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    %r15d,%r14d
sub    %r15d,%ebx
mov    0x30(%rsp),%r13
mov    0x18(%rsp),%r12d
lea    0xdad(%rip),%r15
mov    0x1c(%rsp),%ebp
test   %ebp,%ebp
je     13e0 <rspf_dump+0x2b0>
cmp    $0x5,%ebx
jl     13e0 <rspf_dump+0x2b0>
add    $0xffffffff,%ebp
movslq %r14d,%r14
movzbl 0x0(%r13,%r14,1),%edx
movzbl 0x1(%r13,%r14,1),%ecx
movzbl 0x2(%r13,%r14,1),%r8d
movzbl 0x3(%r13,%r14,1),%r9d
mov    $0x5,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <lprintf@plt>
movzbl 0x3(%r13,%r14,1),%eax
add    $0x4,%r14d
mov    %r12d,%ebx
sub    %r14d,%ebx
test   %rax,%rax
je     130b <rspf_dump+0x1db>
cmp    $0x5,%ebx
jl     130b <rspf_dump+0x1db>
mov    %ebp,0x1c(%rsp)
movslq %r14d,%rcx
mov    0x20(%rsp),%rdx
lea    (%rdx,%rcx,1),%r12
mov    0x28(%rsp),%r13
sub    %rcx,%r13
lea    (%rax,%rax,4),%rbp
add    $0xfffffffffffffffb,%rbp
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    (%r12,%r15,1),%edi
call   1030 <inet_ntoa@plt>
movzbl -0x1(%r12,%r15,1),%ecx
and    $0x3f,%ecx
mov    $0x5,%edi
lea    0xd42(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <lprintf@plt>
mov    %r15d,%eax
add    $0x5,%r15
cmp    %eax,%ebp
je     12f0 <rspf_dump+0x1c0>
lea    -0x5(%r13),%rax
cmp    $0x4,%r13
mov    %rax,%r13
jg     1390 <rspf_dump+0x260>
jmp    12f0 <rspf_dump+0x1c0>
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,0x14(%rsp)
je     13f0 <rspf_dump+0x2c0>
cmp    $0x8,%ebx
jge    1290 <rspf_dump+0x160>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd01(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <lprintf@plt>

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [18 x i8] c"RSPF: version %u \00"
@.str.1 = [29 x i8] c"type RRH seq %x flags %d\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [21 x i8] c"type ROUTING UPDATE \00"
@.str.5 = [55 x i8] c"fragment %u frag total %u sync %u #nodes %u env_id %u\0A\00"
@.str.6 = [54 x i8] c" Reporting Router: %s Seq %u Subseq %u #links %u\0A\00"
@.str.7 = [60 x i8] c" horizon %u ERP factor %u cost %u #adjacencies %u\0A\00"
@.str.8 = [23 x i8] c" %s/%d \0A\00"
@.str.9 = [24 x i8] c"Unknown packet type %d\0A\00"
define void @rspf_dump(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
switch i32 %17, label %212 [
i32 3, label %18
i32 1, label %44
]
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 8
%21 = bitcast i8* %20 to i32*
%22 = load i32, i32* %21
%23 = call i32 @ntohs(i32 %22)
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i64 10
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %27)
store i32 11, i32* %5
br label %29
29: ; preds = %33, %18
%30 = load i32, i32* %5
%31 = load i32, i32* %4
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %42
33: ; preds = %29
%34 = load i8*, i8** %3
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds i8, i8* %34, i64 %37
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %29
42: ; preds = %29
%43 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %218
44: ; preds = %2
%45 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%46 = load i8*, i8** %3
%47 = getelementptr inbounds i8, i8* %46, i64 2
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = load i8*, i8** %3
%51 = getelementptr inbounds i8, i8* %50, i64 3
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = load i8*, i8** %3
%55 = getelementptr inbounds i8, i8* %54, i64 6
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = load i8*, i8** %3
%59 = getelementptr inbounds i8, i8* %58, i64 7
%60 = load i8, i8* %59
%61 = zext i8 %60 to i32
%62 = load i8*, i8** %3
%63 = getelementptr inbounds i8, i8* %62, i64 8
%64 = bitcast i8* %63 to i32*
%65 = load i32, i32* %64
%66 = call i32 @ntohs(i32 %65)
%67 = call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), i32 %49, i32 %53, i32 %57, i32 %61, i32 %66)
%68 = load i8*, i8** %3
%69 = getelementptr inbounds i8, i8* %68, i64 6
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = add nsw i32 %71, 6
store i32 %72, i32* %5
%73 = load i8*, i8** %3
%74 = getelementptr inbounds i8, i8* %73, i64 7
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
store i32 %76, i32* %6
br label %77
77: ; preds = %210, %44
%78 = load i32, i32* %6
%79 = add nsw i32 %78, -1
store i32 %79, i32* %6
%80 = icmp ne i32 %78, 0
br i1 %80, label %81, label %86
81: ; preds = %77
%82 = load i32, i32* %4
%83 = load i32, i32* %5
%84 = sub nsw i32 %82, %83
%85 = icmp sgt i32 %84, 7
br label %86
86: ; preds = %81, %77
%87 = phi i1 [ false, %77 ], [ %85, %81 ]
br i1 %87, label %88, label %211
88: ; preds = %86
%89 = load i8*, i8** %3
%90 = load i32, i32* %5
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8, i8* %89, i64 %91
%93 = bitcast i8* %92 to %struct.in_addr*
%94 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %93, i32 0, i32 0
%95 = load i32, i32* %94
%96 = call i32 @inet_ntoa(i32 %95)
%97 = load i8*, i8** %3
%98 = load i32, i32* %5
%99 = add nsw i32 %98, 4
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8, i8* %97, i64 %100
%102 = bitcast i8* %101 to i32*
%103 = load i32, i32* %102
%104 = call i32 @ntohs(i32 %103)
%105 = load i8*, i8** %3
%106 = load i32, i32* %5
%107 = add nsw i32 %106, 6
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8, i8* %105, i64 %108
%110 = load i8, i8* %109
%111 = zext i8 %110 to i32
%112 = load i8*, i8** %3
%113 = load i32, i32* %5
%114 = add nsw i32 %113, 7
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i8, i8* %112, i64 %115
%117 = load i8, i8* %116
%118 = zext i8 %117 to i32
%119 = call i32 (i32, i8*, ...) @lprintf(i32 5, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i32 %96, i32 %104, i32 %111, i32 %118)
%120 = load i8*, i8** %3
%121 = load i32, i32* %5
%122 = add nsw i32 %121, 7
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i8, i8* %120, i64 %123
%125 = load i8, i8* %124
%126 = zext i8 %125 to i32
store i32 %126, i32* %7
%127 = load i32, i32* %5
%128 = add nsw i32 %127, 8
store i32 %128, i32* %5
br label %129
129: ; preds = %209, %88
%130 = load i32, i32* %7
%131 = add nsw i32 %130, -1
store i32 %131, i32* %7
%132 = icmp ne i32 %130, 0
br i1 %132, label %133, label %138
133: ; preds = %129
%134 = load i32, i32* %4
%135 = load i32, i32* %5
%136 = sub nsw i32 %134, %135
%137 = icmp sgt i32 %136, 4
br label %138
138: ; preds = %133, %129
%139 = phi i1 [ false, %129 ], [ %137, %133 ]
br i1 %139, label %140, label %210
140: ; preds = %138
%141 = load i8*, i8** %3
%142 = load i32, i32* %5
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8, i8* %141, i64 %143
%145 = load i8, i8* %144
%146 = zext i8 %145 to i32
%147 = load i8*, i8** %3
%148 = load i32, i32* %5
%149 = add nsw i32 %148, 1
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i8, i8* %147, i64 %150
%152 = load i8, i8* %151
%153 = zext i8 %152 to i32
%154 = load i8*, i8** %3
%155 = load i32, i32* %5
%156 = add nsw i32 %155, 2
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8, i8* %154, i64 %157
%159 = load i8, i8* %158
%160 = zext i8 %159 to i32
%161 = load i8*, i8** %3
%162 = load i32, i32* %5
%163 = add nsw i32 %162, 3
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i8, i8* %161, i64 %164
%166 = load i8, i8* %165
%167 = zext i8 %166 to i32
%168 = call i32 (i32, i8*, ...) @lprintf(i32 5, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0), i32 %146, i32 %153, i32 %160, i32 %167)
%169 = load i8*, i8** %3
%170 = load i32, i32* %5
%171 = add nsw i32 %170, 3
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds i8, i8* %169, i64 %172
%174 = load i8, i8* %173
%175 = zext i8 %174 to i32
store i32 %175, i32* %8
%176 = load i32, i32* %5
%177 = add nsw i32 %176, 4
store i32 %177, i32* %5
br label %178
178: ; preds = %189, %140
%179 = load i32, i32* %8
%180 = add nsw i32 %179, -1
store i32 %180, i32* %8
%181 = icmp ne i32 %179, 0
br i1 %181, label %182, label %187
182: ; preds = %178
%183 = load i32, i32* %4
%184 = load i32, i32* %5
%185 = sub nsw i32 %183, %184
%186 = icmp sgt i32 %185, 4
br label %187
187: ; preds = %182, %178
%188 = phi i1 [ false, %178 ], [ %186, %182 ]
br i1 %188, label %189, label %209
189: ; preds = %187
%190 = load i8*, i8** %3
%191 = load i32, i32* %5
%192 = add nsw i32 %191, 1
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds i8, i8* %190, i64 %193
%195 = bitcast i8* %194 to %struct.in_addr*
%196 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %195, i32 0, i32 0
%197 = load i32, i32* %196
%198 = call i32 @inet_ntoa(i32 %197)
%199 = load i8*, i8** %3
%200 = load i32, i32* %5
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds i8, i8* %199, i64 %201
%203 = load i8, i8* %202
%204 = zext i8 %203 to i32
%205 = and i32 %204, 63
%206 = call i32 (i32, i8*, ...) @lprintf(i32 5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %198, i32 %205)
%207 = load i32, i32* %5
%208 = add nsw i32 %207, 5
store i32 %208, i32* %5
br label %178
209: ; preds = %187
br label %129
210: ; preds = %138
br label %77
211: ; preds = %86
br label %218
212: ; preds = %2
%213 = load i8*, i8** %3
%214 = getelementptr inbounds i8, i8* %213, i64 1
%215 = load i8, i8* %214
%216 = zext i8 %215 to i32
%217 = call i32 (i32, i8*, ...) @lprintf(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i32 %216)
br label %218
218: ; preds = %212, %211, %42
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"RSPF: version %u \00"
@.str.1 = [29 x i8] c"type RRH seq %x flags %d\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [21 x i8] c"type ROUTING UPDATE \00"
@.str.5 = [55 x i8] c"fragment %u frag total %u sync %u #nodes %u env_id %u\0A\00"
@.str.6 = [54 x i8] c" Reporting Router: %s Seq %u Subseq %u #links %u\0A\00"
@.str.7 = [60 x i8] c" horizon %u ERP factor %u cost %u #adjacencies %u\0A\00"
@.str.8 = [23 x i8] c" %s/%d \0A\00"
@.str.9 = [24 x i8] c"Unknown packet type %d\0A\00"
define void @rspf_dump(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = zext i8 %3 to i32
%5 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
switch i8 %7, label %161 [
i8 3, label %8
i8 1, label %30
]
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %0, i64 8
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = tail call i32 @ntohs(i32 %11)
%13 = getelementptr inbounds i8, i8* %0, i64 10
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %15)
%17 = icmp sgt i32 %1, 11
br i1 %17, label %18, label %28
18: ; preds = %8
%19 = zext i32 %1 to i64
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ 11, %18 ], [ %22, %20 ]
%22 = add nuw nsw i64 %21, 1
%23 = getelementptr inbounds i8, i8* %0, i64 %21
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = icmp eq i64 %22, %19
br i1 %27, label %28, label %20
28: ; preds = %20, %8
%29 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %164
30: ; preds = %2
%31 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%32 = getelementptr inbounds i8, i8* %0, i64 2
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = getelementptr inbounds i8, i8* %0, i64 3
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = getelementptr inbounds i8, i8* %0, i64 6
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = getelementptr inbounds i8, i8* %0, i64 7
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = getelementptr inbounds i8, i8* %0, i64 8
%45 = bitcast i8* %44 to i32*
%46 = load i32, i32* %45
%47 = tail call i32 @ntohs(i32 %46)
%48 = tail call i32 (i32, i8*, ...) @lprintf(i32 9, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), i32 %34, i32 %37, i32 %40, i32 %43, i32 %47)
%49 = load i8, i8* %38
%50 = zext i8 %49 to i32
%51 = add nuw nsw i32 %50, 6
%52 = load i8, i8* %41
%53 = icmp ne i8 %52, 0
%54 = sub nsw i32 %1, %51
%55 = icmp sgt i32 %54, 7
%56 = select i1 %53, i1 %55, i1 false
br i1 %56, label %57, label %164
57: ; preds = %30
%58 = zext i8 %52 to i32
%59 = sext i32 %1 to i64
br label %66
60: ; preds = %103, %66
%61 = phi i32 [ %95, %66 ], [ %104, %103 ]
%62 = phi i32 [ %93, %66 ], [ %105, %103 ]
%63 = icmp ne i32 %69, 0
%64 = icmp sgt i32 %61, 7
%65 = select i1 %63, i1 %64, i1 false
br i1 %65, label %66, label %164
66: ; preds = %57, %60
%67 = phi i32 [ %69, %60 ], [ %58, %57 ]
%68 = phi i32 [ %62, %60 ], [ %51, %57 ]
%69 = add nsw i32 %67, -1
%70 = sext i32 %68 to i64
%71 = getelementptr inbounds i8, i8* %0, i64 %70
%72 = bitcast i8* %71 to i32*
%73 = load i32, i32* %72
%74 = tail call i32 @inet_ntoa(i32 %73)
%75 = add nsw i32 %68, 4
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %0, i64 %76
%78 = bitcast i8* %77 to i32*
%79 = load i32, i32* %78
%80 = tail call i32 @ntohs(i32 %79)
%81 = add nsw i32 %68, 6
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %0, i64 %82
%84 = load i8, i8* %83
%85 = zext i8 %84 to i32
%86 = add nsw i32 %68, 7
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %0, i64 %87
%89 = load i8, i8* %88
%90 = zext i8 %89 to i32
%91 = tail call i32 (i32, i8*, ...) @lprintf(i32 5, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i32 %74, i32 %80, i32 %85, i32 %90)
%92 = load i8, i8* %88
%93 = add nsw i32 %68, 8
%94 = icmp ne i8 %92, 0
%95 = sub nsw i32 %1, %93
%96 = icmp sgt i32 %95, 4
%97 = select i1 %94, i1 %96, i1 false
br i1 %97, label %98, label %60
98: ; preds = %66
%99 = zext i8 %92 to i32
br label %109
100: ; preds = %142
%101 = trunc i64 %156 to i32
%102 = sub nsw i32 %1, %101
br label %103
103: ; preds = %100, %109
%104 = phi i32 [ %102, %100 ], [ %136, %109 ]
%105 = phi i32 [ %101, %100 ], [ %134, %109 ]
%106 = icmp ne i32 %112, 0
%107 = icmp sgt i32 %104, 4
%108 = select i1 %106, i1 %107, i1 false
br i1 %108, label %109, label %60
109: ; preds = %98, %103
%110 = phi i32 [ %112, %103 ], [ %99, %98 ]
%111 = phi i32 [ %105, %103 ], [ %93, %98 ]
%112 = add nsw i32 %110, -1
%113 = sext i32 %111 to i64
%114 = getelementptr inbounds i8, i8* %0, i64 %113
%115 = load i8, i8* %114
%116 = zext i8 %115 to i32
%117 = add nsw i32 %111, 1
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8, i8* %0, i64 %118
%120 = load i8, i8* %119
%121 = zext i8 %120 to i32
%122 = add nsw i32 %111, 2
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i8, i8* %0, i64 %123
%125 = load i8, i8* %124
%126 = zext i8 %125 to i32
%127 = add nsw i32 %111, 3
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i8, i8* %0, i64 %128
%130 = load i8, i8* %129
%131 = zext i8 %130 to i32
%132 = tail call i32 (i32, i8*, ...) @lprintf(i32 5, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0), i32 %116, i32 %121, i32 %126, i32 %131)
%133 = load i8, i8* %129
%134 = add i32 %111, 4
%135 = icmp ne i8 %133, 0
%136 = sub nsw i32 %1, %134
%137 = icmp sgt i32 %136, 4
%138 = select i1 %135, i1 %137, i1 false
br i1 %138, label %139, label %103
139: ; preds = %109
%140 = zext i8 %133 to i32
%141 = sext i32 %134 to i64
br label %142
142: ; preds = %139, %142
%143 = phi i64 [ %141, %139 ], [ %156, %142 ]
%144 = phi i32 [ %140, %139 ], [ %145, %142 ]
%145 = add nsw i32 %144, -1
%146 = add nsw i64 %143, 1
%147 = getelementptr inbounds i8, i8* %0, i64 %146
%148 = bitcast i8* %147 to i32*
%149 = load i32, i32* %148
%150 = tail call i32 @inet_ntoa(i32 %149)
%151 = getelementptr inbounds i8, i8* %0, i64 %143
%152 = load i8, i8* %151
%153 = and i8 %152, 63
%154 = zext i8 %153 to i32
%155 = tail call i32 (i32, i8*, ...) @lprintf(i32 5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %150, i32 %154)
%156 = add nsw i64 %143, 5
%157 = icmp ne i32 %145, 0
%158 = sub nsw i64 %59, %156
%159 = icmp sgt i64 %158, 4
%160 = select i1 %157, i1 %159, i1 false
br i1 %160, label %142, label %100
161: ; preds = %2
%162 = zext i8 %7 to i32
%163 = tail call i32 (i32, i8*, ...) @lprintf(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i32 %162)
br label %164
164: ; preds = %60, %30, %161, %28
ret void
}