#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;
struct iphdr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ attach_outter_encapsulation(int *, char *, char *, int, int);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(void *, void *, int);
int /*<<< orphan*/ printIPHeader(struct iphdr *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sendPacket(int *);
void processPacket(uint8_t *data, int dataLen, int protocol) {
  if (protocol != 145 && protocol != 146 && protocol != 17)
    return;
  int ipHeaderLen = sizeof(struct iphdr);
  if (protocol == 145 || protocol == 17) {
    printf("\nReceived From Sender\n");
    int packetLen = ipHeaderLen + dataLen;
    uint8_t *packet = (uint8_t *)malloc(packetLen);
    attach_outter_encapsulation(packet, "10.0.0.100", "10.0.0.200", 146,
                                packetLen);
    struct iphdr *iphdr = (struct iphdr *)data;
    printIPHeader(iphdr);
    memcpy((void *)(packet + ipHeaderLen), (void *)data, dataLen);
    sendPacket(packet);
    free(packet);
  } else if (protocol == 146) {
    printf("\nReceived From NSF\n");
    struct iphdr *outter_iphdr = (struct iphdr *)data;
    uint8_t actionCode = *(uint8_t *)(data + ipHeaderLen);
    uint8_t metadataNum = *(uint8_t *)(data + ipHeaderLen + 1);
    int resultHeaderLen = (2 + metadataNum) * sizeof(uint8_t);
    int i = 0;
    printf("\n\n/**********INSPECTION RESULT**********/\n");
    printf("actionCode: %02x, metadataNum: %02x\n", actionCode, metadataNum);
    for (i = 0; i < metadataNum; i++) {
      printf("metaData: %02x\n", *(uint8_t *)(data + ipHeaderLen + 2 + i));
    }
    printf("/*************************************/\n");
    struct iphdr *origin_iphdr =
        (struct iphdr *)(data + ipHeaderLen + resultHeaderLen);
    printIPHeader(origin_iphdr);
    if (actionCode == 0x00000000) {
      sendPacket(data + ipHeaderLen + resultHeaderLen);
    } else if (actionCode == 0x00000001) {
    } else if (actionCode == 0x00000002) {
      sendPacket(data + ipHeaderLen + resultHeaderLen);
    } else if (actionCode == 0x00000003) {
      int packetLen = dataLen - resultHeaderLen;
      uint8_t *packet = (uint8_t *)malloc(packetLen);
      attach_outter_encapsulation(packet, "10.0.0.100", "10.0.0.102", 146,
                                  packetLen);
      memcpy((void *)(packet + ipHeaderLen),
             (void *)(data + ipHeaderLen + resultHeaderLen),
             packetLen - ipHeaderLen);
      sendPacket(packet);
      free(packet);
    }
  }
}


x86 assembly (clang, -O0):
<processPacket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x91,-0x10(%rbp)
je     11ab <processPacket+0x3b>
cmpl   $0x92,-0x10(%rbp)
je     11ab <processPacket+0x3b>
cmpl   $0x11,-0x10(%rbp)
je     11ab <processPacket+0x3b>
jmp    144b <processPacket+0x2db>
movl   $0x4,-0x14(%rbp)
cmpl   $0x91,-0x10(%rbp)
je     11c9 <processPacket+0x59>
cmpl   $0x11,-0x10(%rbp)
jne    124f <processPacket+0xdf>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%r8d
lea    0xe1c(%rip),%rsi
lea    0xe20(%rip),%rdx
mov    $0x92,%ecx
call   1090 <attach_outter_encapsulation@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <printIPHeader@plt>
mov    -0x20(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1070 <memcpy@plt>
mov    -0x20(%rbp),%rdi
call   1060 <sendPacket@plt>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
jmp    144b <processPacket+0x2db>
cmpl   $0x92,-0x10(%rbp)
jne    1446 <processPacket+0x2d6>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    0x4(%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
add    $0x2,%eax
cltq
shl    $0x2,%rax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    130d <processPacket+0x19d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x40(%rbp),%rcx
mov    0x8(%rax,%rcx,4),%esi
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12ce <processPacket+0x15e>
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x3c(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <printIPHeader@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1370 <processPacket+0x200>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1060 <sendPacket@plt>
jmp    1441 <processPacket+0x2d1>
cmpl   $0x1,-0x34(%rbp)
jne    137f <processPacket+0x20f>
jmp    143c <processPacket+0x2cc>
cmpl   $0x2,-0x34(%rbp)
jne    13ad <processPacket+0x23d>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1060 <sendPacket@plt>
jmp    1437 <processPacket+0x2c7>
cmpl   $0x3,-0x34(%rbp)
jne    1432 <processPacket+0x2c2>
mov    -0xc(%rbp),%eax
sub    -0x3c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%edi
call   1080 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x4c(%rbp),%r8d
lea    0xc3c(%rip),%rsi
lea    0xce8(%rip),%rdx
mov    $0x92,%ecx
call   1090 <attach_outter_encapsulation@plt>
mov    -0x58(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x4c(%rbp),%edx
sub    -0x14(%rbp),%edx
call   1070 <memcpy@plt>
mov    -0x58(%rbp),%rdi
call   1060 <sendPacket@plt>
mov    -0x58(%rbp),%rdi
call   1040 <free@plt>
jmp    1437 <processPacket+0x2c7>
jmp    143c <processPacket+0x2cc>
jmp    1441 <processPacket+0x2d1>
jmp    1446 <processPacket+0x2d6>
jmp    144b <processPacket+0x2db>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processPacket>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    -0x91(%rdx),%eax
cmp    $0x2,%eax
jb     11a8 <processPacket+0x28>
cmp    $0x11,%edx
jne    12f3 <processPacket+0x173>
mov    %edx,%eax
and    $0xffffff7f,%eax
cmp    $0x11,%eax
jne    1222 <processPacket+0xa2>
lea    0xf00(%rip),%rdi
call   1050 <puts@plt>
lea    0x4(%r14),%r15d
mov    %r15d,%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
lea    0xe2a(%rip),%rsi
lea    0xe2e(%rip),%rdx
mov    %rax,%rdi
mov    $0x92,%ecx
mov    %r15d,%r8d
call   10a0 <attach_outter_encapsulation@plt>
mov    %rbx,%rdi
call   1030 <printIPHeader@plt>
lea    0x10(%rbp),%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1080 <memcpy@plt>
mov    %rbp,%rdi
call   1070 <sendPacket@plt>
mov    %rbp,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <free@plt>
cmp    $0x92,%edx
jne    12f3 <processPacket+0x173>
lea    0xe21(%rip),%rdi
call   1050 <puts@plt>
lea    0x10(%rbx),%rax
mov    %rax,0x10(%rsp)
mov    0x10(%rbx),%r15d
mov    0x14(%rbx),%ebp
lea    0x8(,%rbp,4),%eax
mov    %eax,0xc(%rsp)
lea    0xe0d(%rip),%rdi
call   1050 <puts@plt>
lea    0xdae(%rip),%rdi
mov    %r15d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <printf@plt>
test   %ebp,%ebp
jle    12a8 <processPacket+0x128>
lea    0xdbc(%rip),%r12
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x18(%rbx,%r13,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r13
cmp    %r13,%rbp
jne    1290 <processPacket+0x110>
lea    0xde4(%rip),%rdi
call   1050 <puts@plt>
mov    0xc(%rsp),%ebp
movslq %ebp,%rax
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,4),%rbx
mov    %rbx,%rdi
call   1030 <printIPHeader@plt>
cmp    $0x3,%r15d
je     1302 <processPacket+0x182>
cmp    $0x2,%r15d
je     12dd <processPacket+0x15d>
test   %r15d,%r15d
jne    12f3 <processPacket+0x173>
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <sendPacket@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
sub    %ebp,%r14d
mov    %r14d,%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
lea    0xce9(%rip),%rsi
lea    0xd2d(%rip),%rdx
mov    %rax,%rdi
mov    $0x92,%ecx
mov    %r14d,%r8d
call   10a0 <attach_outter_encapsulation@plt>
lea    0x10(%rbp),%rdi
add    $0xfffffffc,%r14d
jmp    11f9 <processPacket+0x79>

LLVM IR (-O0):
%struct.iphdr = type { i32 }
@.str = [23 x i8] c"\0AReceived From Sender\0A\00"
@.str.1 = [11 x i8] c"10.0.0.100\00"
@.str.2 = [11 x i8] c"10.0.0.200\00"
@.str.3 = [20 x i8] c"\0AReceived From NSF\0A\00"
@.str.4 = [43 x i8] c"\0A\0A/**********INSPECTION RESULT**********/\0A\00"
@.str.5 = [37 x i8] c"actionCode: %02x, metadataNum: %02x\0A\00"
@.str.6 = [16 x i8] c"metaData: %02x\0A\00"
@.str.7 = [41 x i8] c"/*************************************/\0A\00"
@.str.8 = [11 x i8] c"10.0.0.102\00"
define void @processPacket(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca %struct.iphdr*
%11 = alloca %struct.iphdr*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca %struct.iphdr*
%17 = alloca i32
%18 = alloca i32*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 145
br i1 %20, label %21, label %28
21: ; preds = %3
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, 146
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i32, i32* %6
%26 = icmp ne i32 %25, 17
br i1 %26, label %27, label %28
27: ; preds = %24
br label %185
28: ; preds = %24, %21, %3
store i32 4, i32* %7
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 145
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %6
%33 = icmp eq i32 %32, 17
br i1 %33, label %34, label %62
34: ; preds = %31, %28
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%36 = load i32, i32* %7
%37 = load i32, i32* %5
%38 = add nsw i32 %36, %37
store i32 %38, i32* %8
%39 = load i32, i32* %8
%40 = call i64 @malloc(i32 %39)
%41 = inttoptr i64 %40 to i32*
store i32* %41, i32** %9
%42 = load i32*, i32** %9
%43 = load i32, i32* %8
%44 = call i32 @attach_outter_encapsulation(i32* %42, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 146, i32 %43)
%45 = load i32*, i32** %4
%46 = bitcast i32* %45 to %struct.iphdr*
store %struct.iphdr* %46, %struct.iphdr** %10
%47 = load %struct.iphdr*, %struct.iphdr** %10
%48 = call i32 @printIPHeader(%struct.iphdr* %47)
%49 = load i32*, i32** %9
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
%53 = bitcast i32* %52 to i8*
%54 = load i32*, i32** %4
%55 = bitcast i32* %54 to i8*
%56 = load i32, i32* %5
%57 = call i32 @memcpy(i8* %53, i8* %55, i32 %56)
%58 = load i32*, i32** %9
%59 = call i32 @sendPacket(i32* %58)
%60 = load i32*, i32** %9
%61 = call i32 @free(i32* %60)
br label %185
62: ; preds = %31
%63 = load i32, i32* %6
%64 = icmp eq i32 %63, 146
br i1 %64, label %65, label %184
65: ; preds = %62
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%67 = load i32*, i32** %4
%68 = bitcast i32* %67 to %struct.iphdr*
store %struct.iphdr* %68, %struct.iphdr** %11
%69 = load i32*, i32** %4
%70 = load i32, i32* %7
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i32, i32* %69, i64 %71
%73 = load i32, i32* %72
store i32 %73, i32* %12
%74 = load i32*, i32** %4
%75 = load i32, i32* %7
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %74, i64 %76
%78 = getelementptr inbounds i32, i32* %77, i64 1
%79 = load i32, i32* %78
store i32 %79, i32* %13
%80 = load i32, i32* %13
%81 = add nsw i32 2, %80
%82 = sext i32 %81 to i64
%83 = mul i64 %82, 4
%84 = trunc i64 %83 to i32
store i32 %84, i32* %14
store i32 0, i32* %15
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%86 = load i32, i32* %12
%87 = load i32, i32* %13
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %86, i32 %87)
store i32 0, i32* %15
br label %89
89: ; preds = %104, %65
%90 = load i32, i32* %15
%91 = load i32, i32* %13
%92 = icmp slt i32 %90, %91
br i1 %92, label %93, label %107
93: ; preds = %89
%94 = load i32*, i32** %4
%95 = load i32, i32* %7
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i32, i32* %94, i64 %96
%98 = getelementptr inbounds i32, i32* %97, i64 2
%99 = load i32, i32* %15
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i32, i32* %98, i64 %100
%102 = load i32, i32* %101
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %102)
br label %104
104: ; preds = %93
%105 = load i32, i32* %15
%106 = add nsw i32 %105, 1
store i32 %106, i32* %15
br label %89
107: ; preds = %89
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%109 = load i32*, i32** %4
%110 = load i32, i32* %7
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i32, i32* %109, i64 %111
%113 = load i32, i32* %14
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i32, i32* %112, i64 %114
%116 = bitcast i32* %115 to %struct.iphdr*
store %struct.iphdr* %116, %struct.iphdr** %16
%117 = load %struct.iphdr*, %struct.iphdr** %16
%118 = call i32 @printIPHeader(%struct.iphdr* %117)
%119 = load i32, i32* %12
%120 = icmp eq i32 %119, 0
br i1 %120, label %121, label %130
121: ; preds = %107
%122 = load i32*, i32** %4
%123 = load i32, i32* %7
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i32, i32* %122, i64 %124
%126 = load i32, i32* %14
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i32, i32* %125, i64 %127
%129 = call i32 @sendPacket(i32* %128)
br label %183
130: ; preds = %107
%131 = load i32, i32* %12
%132 = icmp eq i32 %131, 1
br i1 %132, label %133, label %134
133: ; preds = %130
br label %182
134: ; preds = %130
%135 = load i32, i32* %12
%136 = icmp eq i32 %135, 2
br i1 %136, label %137, label %146
137: ; preds = %134
%138 = load i32*, i32** %4
%139 = load i32, i32* %7
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i32, i32* %138, i64 %140
%142 = load i32, i32* %14
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i32, i32* %141, i64 %143
%145 = call i32 @sendPacket(i32* %144)
br label %181
146: ; preds = %134
%147 = load i32, i32* %12
%148 = icmp eq i32 %147, 3
br i1 %148, label %149, label %180
149: ; preds = %146
%150 = load i32, i32* %5
%151 = load i32, i32* %14
%152 = sub nsw i32 %150, %151
store i32 %152, i32* %17
%153 = load i32, i32* %17
%154 = call i64 @malloc(i32 %153)
%155 = inttoptr i64 %154 to i32*
store i32* %155, i32** %18
%156 = load i32*, i32** %18
%157 = load i32, i32* %17
%158 = call i32 @attach_outter_encapsulation(i32* %156, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 146, i32 %157)
%159 = load i32*, i32** %18
%160 = load i32, i32* %7
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds i32, i32* %159, i64 %161
%163 = bitcast i32* %162 to i8*
%164 = load i32*, i32** %4
%165 = load i32, i32* %7
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds i32, i32* %164, i64 %166
%168 = load i32, i32* %14
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds i32, i32* %167, i64 %169
%171 = bitcast i32* %170 to i8*
%172 = load i32, i32* %17
%173 = load i32, i32* %7
%174 = sub nsw i32 %172, %173
%175 = call i32 @memcpy(i8* %163, i8* %171, i32 %174)
%176 = load i32*, i32** %18
%177 = call i32 @sendPacket(i32* %176)
%178 = load i32*, i32** %18
%179 = call i32 @free(i32* %178)
br label %180
180: ; preds = %149, %146
br label %181
181: ; preds = %180, %137
br label %182
182: ; preds = %181, %133
br label %183
183: ; preds = %182, %121
br label %184
184: ; preds = %183, %62
br label %185
185: ; preds = %27, %184, %34
ret void
}

LLVM IR (-O2):
%struct.iphdr = type { i32 }
@.str.1 = [11 x i8] c"10.0.0.100\00"
@.str.2 = [11 x i8] c"10.0.0.200\00"
@.str.5 = [37 x i8] c"actionCode: %02x, metadataNum: %02x\0A\00"
@.str.6 = [16 x i8] c"metaData: %02x\0A\00"
@.str.8 = [11 x i8] c"10.0.0.102\00"
@str = [19 x i8] c"\0AReceived From NSF\00"
@str.9 = [42 x i8] c"\0A\0A/**********INSPECTION RESULT**********/\00"
@str.10 = [40 x i8] c"/*************************************/\00"
@str.11 = [22 x i8] c"\0AReceived From Sender\00"
define void @processPacket(i32* %0, i32 %1, i32 %2) {
switch i32 %2, label %66 [
i32 146, label %4
i32 145, label %4
i32 17, label %4
]
4: ; preds = %3, %3, %3
%5 = and i32 %2, -129
%6 = icmp eq i32 %5, 17
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.11, i64 0, i64 0))
%9 = add nsw i32 %1, 4
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i32*
%12 = tail call i32 @attach_outter_encapsulation(i32* %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 146, i32 %9)
%13 = bitcast i32* %0 to %struct.iphdr*
%14 = tail call i32 @printIPHeader(%struct.iphdr* %13)
%15 = getelementptr inbounds i32, i32* %11, i64 4
%16 = bitcast i32* %15 to i8*
%17 = bitcast i32* %0 to i8*
%18 = tail call i32 @memcpy(i8* %16, i8* %17, i32 %1)
%19 = tail call i32 @sendPacket(i32* %11)
%20 = tail call i32 @free(i32* %11)
br label %66
21: ; preds = %4
%22 = icmp eq i32 %2, 146
br i1 %22, label %23, label %66
23: ; preds = %21
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%25 = getelementptr inbounds i32, i32* %0, i64 4
%26 = load i32, i32* %25
%27 = getelementptr inbounds i32, i32* %0, i64 5
%28 = load i32, i32* %27
%29 = shl i32 %28, 2
%30 = add i32 %29, 8
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.9, i64 0, i64 0))
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %26, i32 %28)
%33 = icmp sgt i32 %28, 0
br i1 %33, label %34, label %44
34: ; preds = %23
%35 = getelementptr inbounds i32, i32* %0, i64 6
%36 = zext i32 %28 to i64
br label %37
37: ; preds = %34, %37
%38 = phi i64 [ 0, %34 ], [ %42, %37 ]
%39 = getelementptr inbounds i32, i32* %35, i64 %38
%40 = load i32, i32* %39
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %40)
%42 = add nuw nsw i64 %38, 1
%43 = icmp eq i64 %42, %36
br i1 %43, label %44, label %37
44: ; preds = %37, %23
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.10, i64 0, i64 0))
%46 = sext i32 %30 to i64
%47 = getelementptr inbounds i32, i32* %25, i64 %46
%48 = bitcast i32* %47 to %struct.iphdr*
%49 = tail call i32 @printIPHeader(%struct.iphdr* %48)
switch i32 %26, label %66 [
i32 0, label %50
i32 3, label %54
i32 2, label %52
]
50: ; preds = %44
%51 = tail call i32 @sendPacket(i32* %47)
br label %66
52: ; preds = %44
%53 = tail call i32 @sendPacket(i32* %47)
br label %66
54: ; preds = %44
%55 = sub nsw i32 %1, %30
%56 = tail call i64 @malloc(i32 %55)
%57 = inttoptr i64 %56 to i32*
%58 = tail call i32 @attach_outter_encapsulation(i32* %57, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 146, i32 %55)
%59 = getelementptr inbounds i32, i32* %57, i64 4
%60 = bitcast i32* %59 to i8*
%61 = bitcast i32* %47 to i8*
%62 = add nsw i32 %55, -4
%63 = tail call i32 @memcpy(i8* %60, i8* %61, i32 %62)
%64 = tail call i32 @sendPacket(i32* %57)
%65 = tail call i32 @free(i32* %57)
br label %66
66: ; preds = %7, %21, %44, %54, %52, %50, %3
ret void
}