#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 uint8_t;
typedef int uint16_t;
struct udphdr {
  int /*<<< orphan*/ len;
  int /*<<< orphan*/ dest;
  int /*<<< orphan*/ source;
};
struct ip {
  int ip_hl;
  int ip_v;
  int ip_ttl;
  int ip_p;
  int /*<<< orphan*/ ip_dst;
  int /*<<< orphan*/ ip_src;
  int /*<<< orphan*/ ip_len;
};
typedef int /*<<< orphan*/ data;

/* Variables and functions */
char *comm_get_ip_str(int /*<<< orphan*/ *);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  uint8_t data[] = {0x45, 0x00, 0x00, 0x2e, 0x00, 0x0c, 0x00, 0x00, 0x40, 0x11,
                    0x58, 0x28, 0x0c, 0x21, 0x10, 0xdd, 0x0c, 0x20, 0xf9, 0x6d,
                    0x0f, 0xa7, 0x0f, 0xa7, 0x00, 0x1a, 0x0f, 0xca, 0x00, 0x10,
                    0xe0, 0x00, 0x99, 0x04, 0x0d, 0x00, 0x0a, 0x00, 0x42, 0x00,
                    0x45, 0x00, 0x45, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  struct ip *ip = (struct ip *)data;
  struct udphdr *udp;
  uint16_t i;
  printf("\n\n\n");
  printf("full packet: ");
  for (i = 0; i < sizeof(data); i++)
    printf("%.2x", data[i]);
  printf("\n");
  printf("len %u (%u)\n", ntohs(ip->ip_len), sizeof(data));
  printf("hlen %u\n", ip->ip_hl);
  printf("ver %u\n", ip->ip_v);
  printf("ttl %u\n", ip->ip_ttl);
  printf("proto %u\n", ip->ip_p);
  printf("src: %s\n", comm_get_ip_str(&ip->ip_src));
  printf("dst: %s\n", comm_get_ip_str(&ip->ip_dst));
  udp = (struct udphdr *)(data + ip->ip_hl * 4);
  printf("\n");
  printf("sport: %u\n", ntohs(udp->source));
  printf("dport: %u\n", ntohs(udp->dest));
  printf("ulen: %u\n", ntohs(udp->len));
  printf("payload: ");
  for (i = 0; i < ntohs(udp->len) - sizeof(struct udphdr); i++)
    printf("%.2x", data[ip->ip_hl * 4 + sizeof(struct udphdr) + i]);
  printf("\n");
  printf("msg: ");
  for (i = 0; i < ntohs(udp->len) - sizeof(struct udphdr); i++) {
    if (i % 2 == 0)
      printf("%c", data[ip->ip_hl * 4 + sizeof(struct udphdr) + 10 + i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x100(%rbp),%rdi
lea    0xea0(%rip),%rsi
mov    $0xf0,%edx
call   1040 <memcpy@plt>
lea    -0x100(%rbp),%rax
mov    %rax,-0x108(%rbp)
lea    0xf71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x114(%rbp)
movslq -0x114(%rbp),%rax
cmp    $0xf0,%rax
jae    11e1 <main+0xa1>
movslq -0x114(%rbp),%rax
mov    -0x100(%rbp,%rax,4),%esi
lea    0xf3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    119e <main+0x5e>
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x108(%rbp),%rax
mov    0x18(%rax),%edi
call   1060 <ntohs@plt>
mov    %eax,%esi
lea    0xf00(%rip),%rdi
mov    $0xf0,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x108(%rbp),%rax
mov    (%rax),%esi
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x108(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x108(%rbp),%rax
mov    0x8(%rax),%esi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x108(%rbp),%rax
mov    0xc(%rax),%esi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x108(%rbp),%rdi
add    $0x14,%rdi
call   1050 <comm_get_ip_str@plt>
mov    %rax,%rsi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x108(%rbp),%rdi
add    $0x10,%rdi
call   1050 <comm_get_ip_str@plt>
mov    %rax,%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x100(%rbp),%rax
mov    -0x108(%rbp),%rcx
mov    (%rcx),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x110(%rbp)
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x110(%rbp),%rax
mov    0x8(%rax),%edi
call   1060 <ntohs@plt>
mov    %eax,%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x110(%rbp),%rax
mov    0x4(%rax),%edi
call   1060 <ntohs@plt>
mov    %eax,%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x110(%rbp),%rax
mov    (%rax),%edi
call   1060 <ntohs@plt>
mov    %eax,%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x114(%rbp)
movslq -0x114(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x110(%rbp),%rax
mov    (%rax),%edi
call   1060 <ntohs@plt>
mov    %eax,%ecx
mov    -0x120(%rbp),%rax
movslq %ecx,%rcx
sub    $0xc,%rcx
cmp    %rcx,%rax
jae    13d4 <main+0x294>
mov    -0x108(%rbp),%rax
mov    (%rax),%eax
shl    $0x2,%eax
cltq
add    $0xc,%rax
movslq -0x114(%rbp),%rcx
add    %rcx,%rax
mov    -0x100(%rbp,%rax,4),%esi
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    135a <main+0x21a>
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x114(%rbp)
movslq -0x114(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x110(%rbp),%rax
mov    (%rax),%edi
call   1060 <ntohs@plt>
mov    %eax,%ecx
mov    -0x128(%rbp),%rax
movslq %ecx,%rcx
sub    $0xc,%rcx
cmp    %rcx,%rax
jae    1494 <main+0x354>
mov    -0x114(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    147b <main+0x33b>
mov    -0x108(%rbp),%rax
mov    (%rax),%eax
shl    $0x2,%eax
cltq
add    $0xc,%rax
add    $0xa,%rax
movslq -0x114(%rbp),%rcx
add    %rcx,%rax
mov    -0x100(%rbp,%rax,4),%esi
lea    0xd05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1480 <main+0x340>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    13fa <main+0x2ba>
lea    0xc57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xf0,%rsp
lea    0xe8d(%rip),%rsi
mov    %rsp,%rdi
mov    $0xf0,%edx
call   1060 <memcpy@plt>
lea    0xfee(%rip),%rdi
call   1040 <puts@plt>
lea    0xf5d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf5d(%rip),%r14
mov    %r14,%rdi
mov    $0x45,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0xf0,%rbx
jne    11c0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1080 <ntohs@plt>
lea    0xf11(%rip),%rdi
mov    $0xf0,%edx
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf09(%rip),%rdi
mov    $0x45,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeff(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xef7(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeef(%rip),%rdi
mov    $0x2e,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x14(%rsp),%rdi
call   1070 <comm_get_ip_str@plt>
lea    0xedc(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rdi
call   1070 <comm_get_ip_str@plt>
lea    0xeca(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movslq (%rsp),%r14
lea    0x0(,%r14,4),%r15
shl    $0x4,%r14
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp,%r14,1),%edi
call   1080 <ntohs@plt>
lea    0xe9e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp,%r14,1),%edi
call   1080 <ntohs@plt>
lea    0xe8f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp,%r14,1),%edi
call   1080 <ntohs@plt>
lea    0xe81(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp,%r14,1),%edi
call   1080 <ntohs@plt>
cmp    $0xc,%eax
je     1344 <main+0x1e4>
mov    $0xc,%ebx
lea    0xdf3(%rip),%r14
nopl   0x0(%rax,%rax,1)
movslq (%rsp),%rax
lea    (%rbx,%rax,4),%rax
mov    (%rsp,%rax,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp,%r15,4),%edi
call   1080 <ntohs@plt>
cltq
add    $0xfffffffffffffff4,%rax
lea    0x1(%rbx),%rcx
add    $0xfffffffffffffff5,%rbx
cmp    %rbx,%rax
mov    %rcx,%rbx
ja     1310 <main+0x1b0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe1a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp,%r15,4),%edi
call   1080 <ntohs@plt>
cmp    $0xc,%eax
jne    1383 <main+0x223>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %ebx,%ebx
jmp    13a8 <main+0x248>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    (%rsp,%r15,4),%edi
call   1080 <ntohs@plt>
cltq
add    $0xfffffffffffffff4,%rax
cmp    %rbx,%rax
jbe    136a <main+0x20a>
test   $0x1,%bl
jne    1390 <main+0x230>
movslq (%rsp),%rax
lea    (%rbx,%rax,4),%rax
mov    0x58(%rsp,%rax,4),%edi
call   1030 <putchar@plt>
jmp    1390 <main+0x230>

LLVM IR (-O0):
%struct.ip = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.udphdr = type { i32, i32, i32 }
@__const.main.data = <{ [45 x i32], [15 x i32] }> <{ [45 x i32] [i32 69, i32 0, i32 0, i32 46, i32 0, i32 12, i32 0, i32 0, i32 64, i32 17, i32 88, i32 40, i32 12, i32 33, i32 16, i32 221, i32 12, i32 32, i32 249, i32 109, i32 15, i32 167, i32 15, i32 167, i32 0, i32 26, i32 15, i32 202, i32 0, i32 16, i32 224, i32 0, i32 153, i32 4, i32 13, i32 0, i32 10, i32 0, i32 66, i32 0, i32 69, i32 0, i32 69, i32 0, i32 82], [15 x i32] zeroinitializer }>
@.str = [4 x i8] c"\0A\0A\0A\00"
@.str.1 = [14 x i8] c"full packet: \00"
@.str.2 = [5 x i8] c"%.2x\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [13 x i8] c"len %u (%u)\0A\00"
@.str.5 = [9 x i8] c"hlen %u\0A\00"
@.str.6 = [8 x i8] c"ver %u\0A\00"
@.str.7 = [8 x i8] c"ttl %u\0A\00"
@.str.8 = [10 x i8] c"proto %u\0A\00"
@.str.9 = [9 x i8] c"src: %s\0A\00"
@.str.10 = [9 x i8] c"dst: %s\0A\00"
@.str.11 = [11 x i8] c"sport: %u\0A\00"
@.str.12 = [11 x i8] c"dport: %u\0A\00"
@.str.13 = [10 x i8] c"ulen: %u\0A\00"
@.str.14 = [10 x i8] c"payload: \00"
@.str.15 = [6 x i8] c"msg: \00"
@.str.16 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [60 x i32]
%3 = alloca %struct.ip*
%4 = alloca %struct.udphdr*
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [60 x i32]* %2 to i8*
%7 = getelementptr inbounds [60 x i32], [60 x i32]* %2, i64 0, i64 0
%8 = bitcast i32* %7 to %struct.ip*
store %struct.ip* %8, %struct.ip** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %11
11: ; preds = %21, %0
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = icmp ult i64 %13, 240
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [60 x i32], [60 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %15
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %11
24: ; preds = %11
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = load %struct.ip*, %struct.ip** %3
%27 = getelementptr inbounds %struct.ip, %struct.ip* %26, i32 0, i32 6
%28 = load i32, i32* %27
%29 = call i32 @ntohs(i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %29, i64 240)
%31 = load %struct.ip*, %struct.ip** %3
%32 = getelementptr inbounds %struct.ip, %struct.ip* %31, i32 0, i32 0
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %33)
%35 = load %struct.ip*, %struct.ip** %3
%36 = getelementptr inbounds %struct.ip, %struct.ip* %35, i32 0, i32 1
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %37)
%39 = load %struct.ip*, %struct.ip** %3
%40 = getelementptr inbounds %struct.ip, %struct.ip* %39, i32 0, i32 2
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %41)
%43 = load %struct.ip*, %struct.ip** %3
%44 = getelementptr inbounds %struct.ip, %struct.ip* %43, i32 0, i32 3
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %45)
%47 = load %struct.ip*, %struct.ip** %3
%48 = getelementptr inbounds %struct.ip, %struct.ip* %47, i32 0, i32 5
%49 = call i8* @comm_get_ip_str(i32* %48)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %49)
%51 = load %struct.ip*, %struct.ip** %3
%52 = getelementptr inbounds %struct.ip, %struct.ip* %51, i32 0, i32 4
%53 = call i8* @comm_get_ip_str(i32* %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* %53)
%55 = getelementptr inbounds [60 x i32], [60 x i32]* %2, i64 0, i64 0
%56 = load %struct.ip*, %struct.ip** %3
%57 = getelementptr inbounds %struct.ip, %struct.ip* %56, i32 0, i32 0
%58 = load i32, i32* %57
%59 = mul nsw i32 %58, 4
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %55, i64 %60
%62 = bitcast i32* %61 to %struct.udphdr*
store %struct.udphdr* %62, %struct.udphdr** %4
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%64 = load %struct.udphdr*, %struct.udphdr** %4
%65 = getelementptr inbounds %struct.udphdr, %struct.udphdr* %64, i32 0, i32 2
%66 = load i32, i32* %65
%67 = call i32 @ntohs(i32 %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i32 %67)
%69 = load %struct.udphdr*, %struct.udphdr** %4
%70 = getelementptr inbounds %struct.udphdr, %struct.udphdr* %69, i32 0, i32 1
%71 = load i32, i32* %70
%72 = call i32 @ntohs(i32 %71)
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i32 %72)
%74 = load %struct.udphdr*, %struct.udphdr** %4
%75 = getelementptr inbounds %struct.udphdr, %struct.udphdr* %74, i32 0, i32 0
%76 = load i32, i32* %75
%77 = call i32 @ntohs(i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 %77)
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %5
br label %80
80: ; preds = %103, %24
%81 = load i32, i32* %5
%82 = sext i32 %81 to i64
%83 = load %struct.udphdr*, %struct.udphdr** %4
%84 = getelementptr inbounds %struct.udphdr, %struct.udphdr* %83, i32 0, i32 0
%85 = load i32, i32* %84
%86 = call i32 @ntohs(i32 %85)
%87 = sext i32 %86 to i64
%88 = sub i64 %87, 12
%89 = icmp ult i64 %82, %88
br i1 %89, label %90, label %106
90: ; preds = %80
%91 = load %struct.ip*, %struct.ip** %3
%92 = getelementptr inbounds %struct.ip, %struct.ip* %91, i32 0, i32 0
%93 = load i32, i32* %92
%94 = mul nsw i32 %93, 4
%95 = sext i32 %94 to i64
%96 = add i64 %95, 12
%97 = load i32, i32* %5
%98 = sext i32 %97 to i64
%99 = add i64 %96, %98
%100 = getelementptr inbounds [60 x i32], [60 x i32]* %2, i64 0, i64 %99
%101 = load i32, i32* %100
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %101)
br label %103
103: ; preds = %90
%104 = load i32, i32* %5
%105 = add nsw i32 %104, 1
store i32 %105, i32* %5
br label %80
106: ; preds = %80
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
store i32 0, i32* %5
br label %109
109: ; preds = %138, %106
%110 = load i32, i32* %5
%111 = sext i32 %110 to i64
%112 = load %struct.udphdr*, %struct.udphdr** %4
%113 = getelementptr inbounds %struct.udphdr, %struct.udphdr* %112, i32 0, i32 0
%114 = load i32, i32* %113
%115 = call i32 @ntohs(i32 %114)
%116 = sext i32 %115 to i64
%117 = sub i64 %116, 12
%118 = icmp ult i64 %111, %117
br i1 %118, label %119, label %141
119: ; preds = %109
%120 = load i32, i32* %5
%121 = srem i32 %120, 2
%122 = icmp eq i32 %121, 0
br i1 %122, label %123, label %137
123: ; preds = %119
%124 = load %struct.ip*, %struct.ip** %3
%125 = getelementptr inbounds %struct.ip, %struct.ip* %124, i32 0, i32 0
%126 = load i32, i32* %125
%127 = mul nsw i32 %126, 4
%128 = sext i32 %127 to i64
%129 = add i64 %128, 12
%130 = add i64 %129, 10
%131 = load i32, i32* %5
%132 = sext i32 %131 to i64
%133 = add i64 %130, %132
%134 = getelementptr inbounds [60 x i32], [60 x i32]* %2, i64 0, i64 %133
%135 = load i32, i32* %134
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32 %135)
br label %137
137: ; preds = %123, %119
br label %138
138: ; preds = %137
%139 = load i32, i32* %5
%140 = add nsw i32 %139, 1
store i32 %140, i32* %5
br label %109
141: ; preds = %109
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.data = <{ [45 x i32], [15 x i32] }> <{ [45 x i32] [i32 69, i32 0, i32 0, i32 46, i32 0, i32 12, i32 0, i32 0, i32 64, i32 17, i32 88, i32 40, i32 12, i32 33, i32 16, i32 221, i32 12, i32 32, i32 249, i32 109, i32 15, i32 167, i32 15, i32 167, i32 0, i32 26, i32 15, i32 202, i32 0, i32 16, i32 224, i32 0, i32 153, i32 4, i32 13, i32 0, i32 10, i32 0, i32 66, i32 0, i32 69, i32 0, i32 69, i32 0, i32 82], [15 x i32] zeroinitializer }>
@.str.1 = [14 x i8] c"full packet: \00"
@.str.2 = [5 x i8] c"%.2x\00"
@.str.4 = [13 x i8] c"len %u (%u)\0A\00"
@.str.5 = [9 x i8] c"hlen %u\0A\00"
@.str.6 = [8 x i8] c"ver %u\0A\00"
@.str.7 = [8 x i8] c"ttl %u\0A\00"
@.str.8 = [10 x i8] c"proto %u\0A\00"
@.str.9 = [9 x i8] c"src: %s\0A\00"
@.str.10 = [9 x i8] c"dst: %s\0A\00"
@.str.11 = [11 x i8] c"sport: %u\0A\00"
@.str.12 = [11 x i8] c"dport: %u\0A\00"
@.str.13 = [10 x i8] c"ulen: %u\0A\00"
@.str.14 = [10 x i8] c"payload: \00"
@.str.15 = [6 x i8] c"msg: \00"
@str = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca [60 x i32]
%2 = bitcast [60 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 69)
br label %6
6: ; preds = %0, %6
%7 = phi i64 [ 1, %0 ], [ %11, %6 ]
%8 = getelementptr inbounds [60 x i32], [60 x i32]* %1, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, 240
br i1 %12, label %13, label %6
13: ; preds = %6
%14 = tail call i32 @putchar(i32 10)
%15 = tail call i32 @ntohs(i32 0)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %15, i64 240)
%17 = getelementptr inbounds [60 x i32], [60 x i32]* %1, i64 0, i64 0
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 69)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 0)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 0)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 46)
%22 = getelementptr inbounds [60 x i32], [60 x i32]* %1, i64 0, i64 5
%23 = call i8* @comm_get_ip_str(i32* %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [60 x i32], [60 x i32]* %1, i64 0, i64 4
%26 = call i8* @comm_get_ip_str(i32* %25)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* %26)
%28 = load i32, i32* %17
%29 = shl nsw i32 %28, 2
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [60 x i32], [60 x i32]* %1, i64 0, i64 %30
%32 = call i32 @putchar(i32 10)
%33 = getelementptr inbounds i32, i32* %31, i64 2
%34 = load i32, i32* %33
%35 = call i32 @ntohs(i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds i32, i32* %31, i64 1
%38 = load i32, i32* %37
%39 = call i32 @ntohs(i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %31
%42 = call i32 @ntohs(i32 %41)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
%45 = load i32, i32* %31
%46 = call i32 @ntohs(i32 %45)
%47 = icmp eq i32 %46, 12
br i1 %47, label %64, label %48
48: ; preds = %13, %48
%49 = phi i64 [ %58, %48 ], [ 0, %13 ]
%50 = load i32, i32* %17
%51 = shl nsw i32 %50, 2
%52 = sext i32 %51 to i64
%53 = add nuw nsw i64 %49, 12
%54 = add nsw i64 %53, %52
%55 = getelementptr inbounds [60 x i32], [60 x i32]* %1, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %56)
%58 = add nuw i64 %49, 1
%59 = load i32, i32* %31
%60 = call i32 @ntohs(i32 %59)
%61 = sext i32 %60 to i64
%62 = add nsw i64 %61, -12
%63 = icmp ugt i64 %62, %58
br i1 %63, label %48, label %64
64: ; preds = %48, %13
%65 = call i32 @putchar(i32 10)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%67 = load i32, i32* %31
%68 = call i32 @ntohs(i32 %67)
%69 = icmp eq i32 %68, 12
br i1 %69, label %90, label %70
70: ; preds = %64, %83
%71 = phi i64 [ %84, %83 ], [ 0, %64 ]
%72 = and i64 %71, 1
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %83
74: ; preds = %70
%75 = load i32, i32* %17
%76 = shl nsw i32 %75, 2
%77 = sext i32 %76 to i64
%78 = add nuw nsw i64 %71, 22
%79 = add nsw i64 %78, %77
%80 = getelementptr inbounds [60 x i32], [60 x i32]* %1, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = call i32 @putchar(i32 %81)
br label %83
83: ; preds = %70, %74
%84 = add nuw i64 %71, 1
%85 = load i32, i32* %31
%86 = call i32 @ntohs(i32 %85)
%87 = sext i32 %86 to i64
%88 = add nsw i64 %87, -12
%89 = icmp ugt i64 %88, %84
br i1 %89, label %70, label %90
90: ; preds = %83, %64
%91 = call i32 @putchar(i32 10)
ret i32 0
}