#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 */
struct udphdr {
  int dummy;
};
struct tcphdr {
  int doff;
  int /*<<< orphan*/ dest;
  int /*<<< orphan*/ source;
};
struct iphdr {
  int ihl;
  int protocol;
  int /*<<< orphan*/ daddr;
  int /*<<< orphan*/ saddr;
  int /*<<< orphan*/ tot_len;
};
struct in_addr {
  int /*<<< orphan*/ s_addr;
};
struct icmphdr {
  int dummy;
};
struct ethhdr {
  int /*<<< orphan*/ h_proto;
};
struct ARPhdr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ IsMatched(struct tcphdr *);
char *inet_ntoa(struct in_addr);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strncmp(unsigned char *, char *, int);
void display(unsigned char *buf) {
  struct ethhdr *eth = (struct ethhdr *)buf;
  struct ARPhdr *arp;
  struct iphdr *ip;
  struct icmphdr *icmp;
  struct udphdr *udp;
  struct tcphdr *tcp;
  unsigned char *data;
  int offset;
  int header_len;
  int data_len;
  struct in_addr tmp;
  if (ntohs(eth->h_proto) == 0x8864)
    offset = 8;
  else
    offset = 0;
  ip = (struct iphdr *)(buf + sizeof(struct ethhdr) + offset);
  arp = (struct ARPhdr *)((char *)buf + sizeof(struct ethhdr));
  tcp = (struct tcphdr *)((unsigned char *)buf + sizeof(struct ethhdr) +
                          (ip->ihl << 2) + offset);
  icmp = (struct icmphdr *)((unsigned char *)buf + sizeof(struct ethhdr) +
                            (ip->ihl << 2) + offset);
  udp =
      (struct udphdr *)(buf + sizeof(struct ethhdr) + (ip->ihl << 2) + offset);
  if (ip->protocol != 06)
    return;
  if (!IsMatched(tcp))
    return;
  header_len = (tcp->doff) * 4;
  data = (unsigned char *)tcp + header_len;
  data_len = ntohs(ip->tot_len) - header_len - ip->ihl * 4;
  data[data_len] = 0;
  if (data_len > 0) {
    if (ntohs(tcp->source) == 21 || ntohs(tcp->dest) == 21) {
      if (strncmp(data, "USER", 4) == 0) {
        printf("[FTP]");
        tmp.s_addr = ip->saddr;
        printf("[SADDR:%s] ", inet_ntoa(tmp));
        tmp.s_addr = ip->daddr;
        printf("[FTP Server:%s] ", inet_ntoa(tmp));
        printf("\n%s", data);
      }
      if (strncmp(data, "PASS", 4) == 0) {
        printf("PASSWORD :%s\n", data);
      }
    }
    if (ntohs(tcp->source) == 110 || ntohs(tcp->dest) == 110) {
      if (strncmp(data, "USER", 4) == 0) {
        printf("[POP3]");
        tmp.s_addr = ip->saddr;
        printf("[SADDR:%s] ", inet_ntoa(tmp));
        tmp.s_addr = ip->daddr;
        printf("[Email Server:%s] ", inet_ntoa(tmp));
        printf("\n%s\n", data);
      }
      if (strncmp(data, "PASS", 4) == 0) {
        printf("PASSWORD :%s\n", data);
      }
    }
  }
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1070 <ntohs@plt>
cmp    $0x8864,%eax
jne    1186 <display+0x36>
movl   $0x8,-0x44(%rbp)
jmp    118d <display+0x3d>
movl   $0x0,-0x44(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
movslq -0x44(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x6,0x4(%rax)
je     1225 <display+0xd5>
jmp    1459 <display+0x309>
mov    -0x38(%rbp),%rdi
call   1050 <IsMatched@plt>
cmp    $0x0,%eax
jne    123c <display+0xec>
jmp    1459 <display+0x309>
mov    -0x38(%rbp),%rax
mov    (%rax),%eax
shl    $0x2,%eax
mov    %eax,-0x48(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x48(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%edi
call   1070 <ntohs@plt>
sub    -0x48(%rbp),%eax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%ecx
shl    $0x2,%ecx
sub    %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpl   $0x0,-0x4c(%rbp)
jle    1459 <display+0x309>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%edi
call   1070 <ntohs@plt>
cmp    $0x15,%eax
je     12b4 <display+0x164>
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%edi
call   1070 <ntohs@plt>
cmp    $0x15,%eax
jne    136f <display+0x21f>
mov    -0x40(%rbp),%rdi
lea    0xd41(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1339 <display+0x1e9>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xcf7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xcf6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x40(%rbp),%rdi
lea    0xce8(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    136a <display+0x21a>
mov    -0x40(%rbp),%rsi
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    136f <display+0x21f>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%edi
call   1070 <ntohs@plt>
cmp    $0x6e,%eax
je     1399 <display+0x249>
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%edi
call   1070 <ntohs@plt>
cmp    $0x6e,%eax
jne    1454 <display+0x304>
mov    -0x40(%rbp),%rdi
lea    0xc5c(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    141e <display+0x2ce>
lea    0xc80(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xc29(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xc41(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xc42(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x40(%rbp),%rdi
lea    0xc03(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    144f <display+0x2ff>
mov    -0x40(%rbp),%rsi
lea    0xbe9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1454 <display+0x304>
jmp    1459 <display+0x309>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r12
mov    (%rdi),%edi
call   1070 <ntohs@plt>
xor    %r13d,%r13d
cmp    $0x8864,%eax
sete   %r13b
cmpl   $0x6,0x8(%r12,%r13,8)
jne    1336 <display+0x1e6>
mov    0x4(%r12,%r13,8),%eax
shl    $0x2,%eax
cltq
add    %r12,%rax
add    $0x4,%rax
lea    (%rax,%r13,8),%r15
mov    %r15,%rdi
call   1050 <IsMatched@plt>
test   %eax,%eax
je     1336 <display+0x1e6>
shl    $0x3,%r13
add    $0x4,%r12
movslq (%r15),%rbx
lea    (%r15,%rbx,4),%r14
shl    $0x2,%rbx
mov    0x10(%r12,%r13,1),%edi
call   1070 <ntohs@plt>
sub    %ebx,%eax
mov    (%r12,%r13,1),%ecx
shl    $0x2,%ecx
sub    %ecx,%eax
cltq
movb   $0x0,(%rax,%r14,1)
test   %eax,%eax
jle    1336 <display+0x1e6>
mov    0x8(%r15),%edi
call   1070 <ntohs@plt>
cmp    $0x15,%eax
je     11f7 <display+0xa7>
mov    0x4(%r15),%edi
call   1070 <ntohs@plt>
cmp    $0x15,%eax
jne    128f <display+0x13f>
lea    0xe02(%rip),%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1265 <display+0x115>
lea    0xdee(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%r12,%r13,1),%edi
call   1040 <inet_ntoa@plt>
lea    0xddc(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%r12,%r13,1),%edi
call   1040 <inet_ntoa@plt>
lea    0xdcd(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdcd(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdc0(%rip),%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    128f <display+0x13f>
lea    0xdac(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%r15),%edi
call   1070 <ntohs@plt>
cmp    $0x6e,%eax
je     12af <display+0x15f>
mov    0x4(%r15),%edi
call   1070 <ntohs@plt>
cmp    $0x6e,%eax
jne    1336 <display+0x1e6>
lea    0xd4a(%rip),%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    131d <display+0x1cd>
lea    0xd70(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%r12,%r13,1),%edi
call   1040 <inet_ntoa@plt>
lea    0xd24(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%r12,%r13,1),%edi
call   1040 <inet_ntoa@plt>
lea    0xd44(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd46(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd08(%rip),%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1340 <display+0x1f0>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xcea(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1060 <printf@plt>

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

LLVM IR (-O2):
%struct.tcphdr = type { i32, i32, i32 }
@.str = [5 x i8] c"USER\00"
@.str.1 = [6 x i8] c"[FTP]\00"
@.str.2 = [12 x i8] c"[SADDR:%s] \00"
@.str.3 = [17 x i8] c"[FTP Server:%s] \00"
@.str.4 = [4 x i8] c"\0A%s\00"
@.str.5 = [5 x i8] c"PASS\00"
@.str.6 = [14 x i8] c"PASSWORD :%s\0A\00"
@.str.7 = [7 x i8] c"[POP3]\00"
@.str.8 = [19 x i8] c"[Email Server:%s] \00"
@.str.9 = [5 x i8] c"\0A%s\0A\00"
define void @display(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @ntohs(i32 %3)
%5 = icmp eq i32 %4, 34916
%6 = select i1 %5, i64 8, i64 0
%7 = getelementptr inbounds i8, i8* %0, i64 4
%8 = getelementptr inbounds i8, i8* %7, i64 %6
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = shl i32 %10, 2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %7, i64 %12
%14 = getelementptr inbounds i8, i8* %13, i64 %6
%15 = getelementptr inbounds i8, i8* %8, i64 4
%16 = bitcast i8* %15 to i32*
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 6
br i1 %18, label %19, label %104
19: ; preds = %1
%20 = bitcast i8* %14 to %struct.tcphdr*
%21 = tail call i32 @IsMatched(%struct.tcphdr* %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %104, label %23
23: ; preds = %19
%24 = bitcast i8* %14 to i32*
%25 = load i32, i32* %24
%26 = shl nsw i32 %25, 2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %14, i64 %27
%29 = getelementptr inbounds i8, i8* %8, i64 16
%30 = bitcast i8* %29 to i32*
%31 = load i32, i32* %30
%32 = tail call i32 @ntohs(i32 %31)
%33 = sub nsw i32 %32, %26
%34 = load i32, i32* %9
%35 = mul i32 %34, -4
%36 = add i32 %35, %33
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %28, i64 %37
store i8 0, i8* %38
%39 = icmp sgt i32 %36, 0
br i1 %39, label %40, label %104
40: ; preds = %23
%41 = getelementptr inbounds i8, i8* %14, i64 8
%42 = bitcast i8* %41 to i32*
%43 = load i32, i32* %42
%44 = tail call i32 @ntohs(i32 %43)
%45 = icmp eq i32 %44, 21
br i1 %45, label %52, label %46
46: ; preds = %40
%47 = getelementptr inbounds i8, i8* %14, i64 4
%48 = bitcast i8* %47 to i32*
%49 = load i32, i32* %48
%50 = tail call i32 @ntohs(i32 %49)
%51 = icmp eq i32 %50, 21
br i1 %51, label %52, label %73
52: ; preds = %46, %40
%53 = tail call i64 @strncmp(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %68
55: ; preds = %52
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%57 = getelementptr inbounds i8, i8* %8, i64 12
%58 = bitcast i8* %57 to i32*
%59 = load i32, i32* %58
%60 = tail call i8* @inet_ntoa(i32 %59)
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %60)
%62 = getelementptr inbounds i8, i8* %8, i64 8
%63 = bitcast i8* %62 to i32*
%64 = load i32, i32* %63
%65 = tail call i8* @inet_ntoa(i32 %64)
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %65)
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %28)
br label %68
68: ; preds = %55, %52
%69 = tail call i64 @strncmp(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %68
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %28)
br label %73
73: ; preds = %68, %71, %46
%74 = load i32, i32* %42
%75 = tail call i32 @ntohs(i32 %74)
%76 = icmp eq i32 %75, 110
br i1 %76, label %83, label %77
77: ; preds = %73
%78 = getelementptr inbounds i8, i8* %14, i64 4
%79 = bitcast i8* %78 to i32*
%80 = load i32, i32* %79
%81 = tail call i32 @ntohs(i32 %80)
%82 = icmp eq i32 %81, 110
br i1 %82, label %83, label %104
83: ; preds = %77, %73
%84 = tail call i64 @strncmp(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %99
86: ; preds = %83
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%88 = getelementptr inbounds i8, i8* %8, i64 12
%89 = bitcast i8* %88 to i32*
%90 = load i32, i32* %89
%91 = tail call i8* @inet_ntoa(i32 %90)
%92 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %91)
%93 = getelementptr inbounds i8, i8* %8, i64 8
%94 = bitcast i8* %93 to i32*
%95 = load i32, i32* %94
%96 = tail call i8* @inet_ntoa(i32 %95)
%97 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %96)
%98 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %28)
br label %99
99: ; preds = %86, %83
%100 = tail call i64 @strncmp(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %104
102: ; preds = %99
%103 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %28)
br label %104
104: ; preds = %23, %99, %102, %77, %19, %1
ret void
}