#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*/ printf(char *, ...);
void help(const char *appname) {
  printf("%s : capture netcard's traffic and decode it, options include:\n",
         appname);
  printf("\tauth: mushuanli@163.com/lizlok@gmail.com\n");
  printf("\t-i     - ethname to sniff\n"
         "\t-r     - read sniff data from file\n"
         "\t-f     - set mmap buf frame count to fnum(def:200),0: disable mmap "
         "mode\n"
         "\t-p     - use promisc mode(default off)\n"
         "\t-c     - capture package count(default(0) not limit)\n");
  printf(
      "\n\t-P     - which protocol(default all) will be sniff?\n"
      "           protocol include: ARP,RARP,TCP,UDP,IGMP,DALL\n"
      "\t-F     - specialfy sniff filters(default allow all)\n"
      "\t         Filter syntax example:\n"
      "\t         ETH{SMAC=ff:fa:fb:fc:fd:fe,DMAC!ff:fa:fb:fc:fd:fe,DALL}\n"
      "\t         IP{SADDR=10.10.10.10,DADDR!10.20.30.40,DAND}\n"
      "\t         TCP{SPORT!80,DPORT=30,ALL}\n"
      "\t         UDP{SPORT!80,DPORT=30,AND}\n"
      "\t         TIME{[xxxx/xx/xx ]xx:xx:xx-[xxxx/xx/xx ]xx:xx:xx}\n"
      "\t         MAP{from[-to]:dstport}\n"
      "\t         'TCP{PORT=80,PORT=110}UDP{PORT=53}'\n"
      "\t         DALL allow only match (one condition) item\n"
      "\t         DAND deny match all condition item \n"
      "\t         ALL  only deny match (one condition) item\n"
      "\t         AND  only deny match (all condition) item\n"
      "\t-bcast - =[0|1|2] 0: capture all, 1: only capture unicast, 2: only "
      "capture bcast\n"
      "\t-data  - =[0|1|2] 0: capture all, 1: only capture proto,   1: only "
      "capture data\n"
      "\t-tcphead  - [0|1|2] 0 don't show tcp head and zero data, 1: show zero "
      "data, 2: show tcp head and zero data\n"
      "\t-rmxproto - decode ping/pong\n"
      "\t-vnc      - support all VNC port? (0: capture all, 1: skip all vnc, "
      "2: only capture vnc) \n"
      "\t-vncstart=x - VNC port start from x\n"
      "\t-remote - capture remote control package(ignore TCP port 22/23)\n"
      "special keyword: DALL - deny all except spedial, ! - except, = - allow\n"
      "NOTE: the filter param should use '' to quote,else it won't correct "
      "send\n");
  printf("\n\t-m     - only show match record\n"
         "\t-M     - filter match record(don't show)\n"
         "\t-alias - ='name1=1.2.3.4,name2=5.6.7.8',show IP as alias\n"
         "\t-x     - use hex to decode frame\n"
         "\t-X     - use hex to decode all frame\n"
         "\t-w     - write capture result to filename\n"
         "\t-s     - silient mode(don't decode package to screen)\n"
         "\t-ttttt - Print a delta (micro-second resolution) between current "
         "and first line on each dump line.\n"
         "\t-eth   - show ether head\n");
  return;
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1001(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x154f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf07(%rip),%rdi
call   1030 <puts@plt>
lea    0xf25(%rip),%rdi
call   1030 <puts@plt>
lea    0xfff(%rip),%rdi
call   1030 <puts@plt>
lea    0x154e(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"%s : capture netcard's traffic and decode it, options include:\0A\00"
@.str.1 = [43 x i8] c"\09auth: mushuanli@163.com/lizlok@gmail.com\0A\00"
@.str.2 = [231 x i8] c"\09-i - ethname to sniff\0A\09-r - read sniff data from file\0A\09-f - set mmap buf frame count to fnum(def:200),0: disable mmap mode\0A\09-p - use promisc mode(default off)\0A\09-c - capture package count(default(0) not limit)\0A\00"
@.str.3 = [1372 x i8] c"\0A\09-P - which protocol(default all) will be sniff?\0A protocol include: ARP,RARP,TCP,UDP,IGMP,DALL\0A\09-F - specialfy sniff filters(default allow all)\0A\09 Filter syntax example:\0A\09 ETH{SMAC=ff:fa:fb:fc:fd:fe,DMAC!ff:fa:fb:fc:fd:fe,DALL}\0A\09 IP{SADDR=10.10.10.10,DADDR!10.20.30.40,DAND}\0A\09 TCP{SPORT!80,DPORT=30,ALL}\0A\09 UDP{SPORT!80,DPORT=30,AND}\0A\09 TIME{[xxxx/xx/xx ]xx:xx:xx-[xxxx/xx/xx ]xx:xx:xx}\0A\09 MAP{from[-to]:dstport}\0A\09 'TCP{PORT=80,PORT=110}UDP{PORT=53}'\0A\09 DALL allow only match (one condition) item\0A\09 DAND deny match all condition item \0A\09 ALL only deny match (one condition) item\0A\09 AND only deny match (all condition) item\0A\09-bcast - =[0|1|2] 0: capture all, 1: only capture unicast, 2: only capture bcast\0A\09-data - =[0|1|2] 0: capture all, 1: only capture proto, 1: only capture data\0A\09-tcphead - [0|1|2] 0 don't show tcp head and zero data, 1: show zero data, 2: show tcp head and zero data\0A\09-rmxproto - decode ping/pong\0A\09-vnc - support all VNC port? (0: capture all, 1: skip all vnc, 2: only capture vnc) \0A\09-vncstart=x - VNC port start from x\0A\09-remote - capture remote control package(ignore TCP port 22/23)\0Aspecial keyword: DALL - deny all except spedial, ! - except, = - allow\0ANOTE: the filter param should use '' to quote,else it won't correct send\0A\00"
@.str.4 = [431 x i8] c"\0A\09-m - only show match record\0A\09-M - filter match record(don't show)\0A\09-alias - ='name1=1.2.3.4,name2=5.6.7.8',show IP as alias\0A\09-x - use hex to decode frame\0A\09-X - use hex to decode all frame\0A\09-w - write capture result to filename\0A\09-s - silient mode(don't decode package to screen)\0A\09-ttttt - Print a delta (micro-second resolution) between current and first line on each dump line.\0A\09-eth - show ether head\0A\00"
define void @help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([231 x i8], [231 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([1372 x i8], [1372 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([431 x i8], [431 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [64 x i8] c"%s : capture netcard's traffic and decode it, options include:\0A\00"
@str = [42 x i8] c"\09auth: mushuanli@163.com/lizlok@gmail.com\00"
@str.5 = [230 x i8] c"\09-i - ethname to sniff\0A\09-r - read sniff data from file\0A\09-f - set mmap buf frame count to fnum(def:200),0: disable mmap mode\0A\09-p - use promisc mode(default off)\0A\09-c - capture package count(default(0) not limit)\00"
@str.6 = [1371 x i8] c"\0A\09-P - which protocol(default all) will be sniff?\0A protocol include: ARP,RARP,TCP,UDP,IGMP,DALL\0A\09-F - specialfy sniff filters(default allow all)\0A\09 Filter syntax example:\0A\09 ETH{SMAC=ff:fa:fb:fc:fd:fe,DMAC!ff:fa:fb:fc:fd:fe,DALL}\0A\09 IP{SADDR=10.10.10.10,DADDR!10.20.30.40,DAND}\0A\09 TCP{SPORT!80,DPORT=30,ALL}\0A\09 UDP{SPORT!80,DPORT=30,AND}\0A\09 TIME{[xxxx/xx/xx ]xx:xx:xx-[xxxx/xx/xx ]xx:xx:xx}\0A\09 MAP{from[-to]:dstport}\0A\09 'TCP{PORT=80,PORT=110}UDP{PORT=53}'\0A\09 DALL allow only match (one condition) item\0A\09 DAND deny match all condition item \0A\09 ALL only deny match (one condition) item\0A\09 AND only deny match (all condition) item\0A\09-bcast - =[0|1|2] 0: capture all, 1: only capture unicast, 2: only capture bcast\0A\09-data - =[0|1|2] 0: capture all, 1: only capture proto, 1: only capture data\0A\09-tcphead - [0|1|2] 0 don't show tcp head and zero data, 1: show zero data, 2: show tcp head and zero data\0A\09-rmxproto - decode ping/pong\0A\09-vnc - support all VNC port? (0: capture all, 1: skip all vnc, 2: only capture vnc) \0A\09-vncstart=x - VNC port start from x\0A\09-remote - capture remote control package(ignore TCP port 22/23)\0Aspecial keyword: DALL - deny all except spedial, ! - except, = - allow\0ANOTE: the filter param should use '' to quote,else it won't correct send\00"
@str.7 = [430 x i8] c"\0A\09-m - only show match record\0A\09-M - filter match record(don't show)\0A\09-alias - ='name1=1.2.3.4,name2=5.6.7.8',show IP as alias\0A\09-x - use hex to decode frame\0A\09-X - use hex to decode all frame\0A\09-w - write capture result to filename\0A\09-s - silient mode(don't decode package to screen)\0A\09-ttttt - Print a delta (micro-second resolution) between current and first line on each dump line.\0A\09-eth - show ether head\00"
define void @help(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([230 x i8], [230 x i8]* @str.5, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([1371 x i8], [1371 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([430 x i8], [430 x i8]* @str.7, i64 0, i64 0))
ret void
}