#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*/ printk(char *, ...);
void print_packet(unsigned char *data, int len) {
  int i, j;
  printk("packet length: %d%s:\n", len,
         len > 128 ? "(only show the first 128 bytes)" : "");
  for (i = 0; len;) {
    if (len >= 16) {
      for (j = 0; j < 16; j++) {
        printk("%02x ", data[i++]);
      }
      printk("| ");
      i -= 16;
      for (j = 0; j < 16; j++) {
        if (((data[i]) >= (0x21) && (data[i]) <= (0x7e))) {
          printk("%c", data[i++]);
        } else {
          printk(".");
          i++;
        }
      }
      printk("\n");
      len -= 16;
    } else {
      for (j = 0; j < len; j++) {
        printk("%02x ", data[i++]);
      }
      for (; j < 16; j++) {
        printk("   ");
      }
      printk("| ");
      i -= len;
      for (j = 0; j < len; j++) {
        if (((data[i]) >= (0x21) && (data[i]) <= (0x7e))) {
          printk("%c", data[i++]);
        } else {
          printk(".");
          i++;
        }
      }
      for (; j < 16; j++) {
        printk(" ");
      }
      printk("\n");
      len = 0;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<print_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%ecx
lea    0xee9(%rip),%rdx
lea    0xee3(%rip),%rax
cmp    $0x80,%ecx
cmovg  %rax,%rdx
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     13c8 <print_packet+0x2b8>
cmpl   $0x10,-0xc(%rbp)
jl     126a <print_packet+0x15a>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    11a9 <print_packet+0x99>
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),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116d <print_packet+0x5d>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    124e <print_packet+0x13e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x21,%eax
jl     1224 <print_packet+0x114>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jg     1224 <print_packet+0x114>
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),%esi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
jmp    123b <print_packet+0x12b>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1240 <print_packet+0x130>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c7 <print_packet+0xb7>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0xc(%rbp)
jmp    13c3 <print_packet+0x2b3>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12af <print_packet+0x19f>
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),%esi
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1271 <print_packet+0x161>
jmp    12b4 <print_packet+0x1a4>
cmpl   $0x10,-0x14(%rbp)
jge    12da <print_packet+0x1ca>
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12b4 <print_packet+0x1a4>
lea    0xd5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1383 <print_packet+0x273>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x21,%eax
jl     1359 <print_packet+0x249>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jg     1359 <print_packet+0x249>
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),%esi
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
jmp    1370 <print_packet+0x260>
lea    0xce2(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1375 <print_packet+0x265>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12fa <print_packet+0x1ea>
jmp    1388 <print_packet+0x278>
cmpl   $0x10,-0x14(%rbp)
jge    13ae <print_packet+0x29e>
lea    0xcad(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1388 <print_packet+0x278>
lea    0xc5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
movl   $0x0,-0xc(%rbp)
jmp    1152 <print_packet+0x42>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_packet>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r13d
mov    %rdi,%r12
cmp    $0x81,%esi
lea    0xee8(%rip),%rax
lea    0xee0(%rip),%rdx
cmovge %rax,%rdx
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printk@plt>
test   %r13d,%r13d
je     12ff <print_packet+0x1ef>
mov    %r13d,%eax
neg    %eax
mov    %eax,(%rsp)
lea    0xee3(%rip),%r15
xor    %ebx,%ebx
jmp    1192 <print_packet+0x82>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x4(%rsp),%ebx
add    %ebp,%ebx
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1030 <printk@plt>
addl   $0x10,(%rsp)
add    $0xfffffff0,%r13d
je     12ff <print_packet+0x1ef>
cmp    $0x10,%r13d
mov    %ebx,0x4(%rsp)
jl     130e <print_packet+0x1fe>
mov    %r13d,%ebp
movslq %ebx,%r13
lea    (%r12,%r13,1),%r14
movzbl (%r12,%r13,1),%esi
lea    0xe80(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0x1(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0x2(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0x3(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0x4(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0x5(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0x6(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0x7(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0x8(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0x9(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0xa(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0xb(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0xc(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0xd(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0xe(%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
movzbl 0xf(%r12,%r13,1),%esi
mov    %ebp,%r13d
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
lea    0xd82(%rip),%rdi
xor    %eax,%eax
call   1030 <printk@plt>
xor    %ebp,%ebp
lea    0xd75(%rip),%rbx
jmp    12e7 <print_packet+0x1d7>
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
add    $0x1,%rbp
cmp    $0x10,%ebp
je     1170 <print_packet+0x60>
movzbl (%r14,%rbp,1),%esi
lea    -0x21(%rsi),%eax
cmp    $0x5d,%al
ja     12d0 <print_packet+0x1c0>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
jmp    12da <print_packet+0x1ca>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %r13d,%r13d
jle    135d <print_packet+0x24d>
movslq %ebx,%rbp
add    %r12,%rbp
lea    0xd16(%rip),%rbx
xor    %r14d,%r14d
mov    (%rsp),%r15d
nopw   0x0(%rax,%rax,1)
movzbl 0x0(%rbp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
add    $0x1,%rbp
add    $0xffffffff,%r14d
cmp    %r14d,%r15d
jne    1330 <print_packet+0x220>
mov    0x4(%rsp),%ebx
sub    %r14d,%ebx
mov    %r13d,%ebp
cmp    $0xf,%r13d
jbe    1363 <print_packet+0x253>
jmp    137e <print_packet+0x26e>
xor    %ebp,%ebp
mov    (%rsp),%r15d
add    $0xfffffff0,%ebp
lea    0xcd7(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
inc    %ebp
jne    1370 <print_packet+0x260>
lea    0xcb7(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printk@plt>
test   %r13d,%r13d
jle    13e4 <print_packet+0x2d4>
add    %r15d,%ebx
movslq %ebx,%rax
add    %rax,%r12
lea    0xc9c(%rip),%r15
lea    0xc98(%rip),%r14
mov    %r13d,%ebp
jmp    13c3 <print_packet+0x2b3>
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
add    $0x1,%r12
add    $0xffffffff,%ebp
je     13db <print_packet+0x2cb>
movzbl (%r12),%esi
lea    -0x21(%rsi),%eax
cmp    $0x5d,%al
ja     13b0 <print_packet+0x2a0>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
jmp    13ba <print_packet+0x2aa>
mov    %r13d,%ebp
cmp    $0xf,%r13d
ja     13fe <print_packet+0x2ee>
add    $0xfffffff0,%ebp
lea    0xc58(%rip),%rbx
xchg   %ax,%ax
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printk@plt>
inc    %ebp
jne    13f0 <print_packet+0x2e0>
lea    0xc0f(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printk@plt>

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

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