#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*/ closeallfd(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void usage(char *s) {
  printf("Socket data transport tool\r\n");
  printf("by bkbll(bkbll@cnhonker.net)\r\n\r\n");
  printf("Usage:%s -m method [-h1 host1] -p1 port1 [-h2 host2] -p2 port2 [-v] "
         "[-log filename]\r\n",
         s);
  printf(" -v: version\r\n");
  printf(" -h1: host1\r\n");
  printf(" -h2: host2\r\n");
  printf(" -p1: port1\r\n");
  printf(" -p2: port2\r\n");
  printf(" -log: log the data\r\n");
  printf(" -m: the action method for this tool\r\n");
  printf(" 1: listen on PORT1 and connect to HOST2:PORT2\r\n");
  printf(" 2: listen on PORT1 and PORT2\r\n");
  printf(" 3: connect to HOST1:PORT1 and HOST2:PORT2\r\n");
  closeallfd(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <closeallfd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xf1b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2b(%rip),%rdi
call   1030 <puts@plt>
lea    0xead(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf2e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf30(%rip),%rdi
call   1030 <puts@plt>
lea    0xf31(%rip),%rdi
call   1030 <puts@plt>
lea    0xf32(%rip),%rdi
call   1030 <puts@plt>
lea    0xf33(%rip),%rdi
call   1030 <puts@plt>
lea    0xf34(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf57(%rip),%rdi
call   1030 <puts@plt>
lea    0xf7b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf8e(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
pop    %rbx
jmp    1050 <closeallfd@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Socket data transport tool\0D\0A\00"
@.str.1 = [33 x i8] c"by bkbll(bkbll@cnhonker.net)\0D\0A\0D\0A\00"
@.str.2 = [86 x i8] c"Usage:%s -m method [-h1 host1] -p1 port1 [-h2 host2] -p2 port2 [-v] [-log filename]\0D\0A\00"
@.str.3 = [15 x i8] c" -v: version\0D\0A\00"
@.str.4 = [14 x i8] c" -h1: host1\0D\0A\00"
@.str.5 = [14 x i8] c" -h2: host2\0D\0A\00"
@.str.6 = [14 x i8] c" -p1: port1\0D\0A\00"
@.str.7 = [14 x i8] c" -p2: port2\0D\0A\00"
@.str.8 = [22 x i8] c" -log: log the data\0D\0A\00"
@.str.9 = [39 x i8] c" -m: the action method for this tool\0D\0A\00"
@.str.10 = [49 x i8] c" 1: listen on PORT1 and connect to HOST2:PORT2\0D\0A\00"
@.str.11 = [32 x i8] c" 2: listen on PORT1 and PORT2\0D\0A\00"
@.str.12 = [45 x i8] c" 3: connect to HOST1:PORT1 and HOST2:PORT2\0D\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.10, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0))
%17 = call i32 @closeallfd(i32 0)
ret void
}

LLVM IR (-O2):
@.str.2 = [86 x i8] c"Usage:%s -m method [-h1 host1] -p1 port1 [-h2 host2] -p2 port2 [-v] [-log filename]\0D\0A\00"
@str = [28 x i8] c"Socket data transport tool\0D\00"
@str.13 = [32 x i8] c"by bkbll(bkbll@cnhonker.net)\0D\0A\0D\00"
@str.14 = [14 x i8] c" -v: version\0D\00"
@str.15 = [13 x i8] c" -h1: host1\0D\00"
@str.16 = [13 x i8] c" -h2: host2\0D\00"
@str.17 = [13 x i8] c" -p1: port1\0D\00"
@str.18 = [13 x i8] c" -p2: port2\0D\00"
@str.19 = [21 x i8] c" -log: log the data\0D\00"
@str.20 = [38 x i8] c" -m: the action method for this tool\0D\00"
@str.21 = [48 x i8] c" 1: listen on PORT1 and connect to HOST2:PORT2\0D\00"
@str.22 = [31 x i8] c" 2: listen on PORT1 and PORT2\0D\00"
@str.23 = [44 x i8] c" 3: connect to HOST1:PORT1 and HOST2:PORT2\0D\00"
define void @usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.13, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.14, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.15, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.16, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.17, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.18, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.19, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.20, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.21, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.22, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.23, i64 0, i64 0))
%15 = tail call i32 @closeallfd(i32 0)
ret void
}