#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void usage(char *name, int exitval) {
  printf("repeater_tcp - utility to dump, forward and replicate messages\n\n");
  printf("Usage: %s <listen-port> [ [host]:<port> ]*\n\n", name);
  printf("TCP message repeater - this program listens on a local TCP port and\n"
         "forward messages to one or more [remote] TCP ports.\n"
         "If the hostname is not specified, 'localhost' is used.\n"
         "When no forwarding address is given, raw TCP messages are printed to "
         "stdout\n"
         "\n"
         "Examples:\n"
         "repeater_tcp 3333\n"
         "  Print TCP message arriving on port 3333 to stdout.\n"
         "repeater_tcp 3333 :3334 :3335 192.168.6.66:666 example.org:3333\n"
         "  Forward TCP message arriving on port 3333 to port 3334, 3335 on "
         "localhost\n"
         "  as well as to port 666 on 192.168.6.66 and 3333 example.org\n"
         "\n"
         "Report bugs to <robin@gareus.org>.\n");
  exit(exitval);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xeee(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [65 x i8] c"repeater_tcp - utility to dump, forward and replicate messages\0A\0A\00"
@.str.1 = [45 x i8] c"Usage: %s <listen-port> [ [host]:<port> ]*\0A\0A\00"
@.str.2 = [572 x i8] c"TCP message repeater - this program listens on a local TCP port and\0Aforward messages to one or more [remote] TCP ports.\0AIf the hostname is not specified, 'localhost' is used.\0AWhen no forwarding address is given, raw TCP messages are printed to stdout\0A\0AExamples:\0Arepeater_tcp 3333\0A Print TCP message arriving on port 3333 to stdout.\0Arepeater_tcp 3333 :3334 :3335 192.168.6.66:666 example.org:3333\0A Forward TCP message arriving on port 3333 to port 3334, 3335 on localhost\0A as well as to port 666 on 192.168.6.66 and 3333 example.org\0A\0AReport bugs to <robin@gareus.org>.\0A\00"
define void @usage(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([572 x i8], [572 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* %4
%10 = call i32 @exit(i32 %9)
unreachable
}

LLVM IR (-O2):
@.str.1 = [45 x i8] c"Usage: %s <listen-port> [ [host]:<port> ]*\0A\0A\00"
@str = [64 x i8] c"repeater_tcp - utility to dump, forward and replicate messages\0A\00"
@str.3 = [571 x i8] c"TCP message repeater - this program listens on a local TCP port and\0Aforward messages to one or more [remote] TCP ports.\0AIf the hostname is not specified, 'localhost' is used.\0AWhen no forwarding address is given, raw TCP messages are printed to stdout\0A\0AExamples:\0Arepeater_tcp 3333\0A Print TCP message arriving on port 3333 to stdout.\0Arepeater_tcp 3333 :3334 :3335 192.168.6.66:666 example.org:3333\0A Forward TCP message arriving on port 3333 to port 3334, 3335 on localhost\0A as well as to port 666 on 192.168.6.66 and 3333 example.org\0A\0AReport bugs to <robin@gareus.org>.\00"
define void @usage(i8* %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([571 x i8], [571 x i8]* @str.3, i64 0, i64 0))
%6 = tail call i32 @exit(i32 %1)
unreachable
}