#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int usage(char *err) {
  if (err)
    fprintf(stderr, "%s\n", err);
  printf("twd [options] addr [addr:port...]\n");
  printf("twd [options] -S [addr:port...]\n");
  printf("    -D --debug     X   debug output level\n"
         "    -v --verbose       provide more verbose insight\n"
         "    -h --help          this message\n"
         "    -F --dontfork      remain in foreground\n"
         "    -1 --up            test up direction only\n"
         "    -2 --down          test down direction only\n"
         "    -3 --bidir         test bidirectionally\n"
         "    -4 --ipv4          test ipv4\n"
         "    -6 --ipv6          test ipv6\n"
         "    -r --random-data   use a random data size\n"
         "    -i --interval      interval [default 10ms]\n"
         "    -L --logdir        log directory [default .]\n"
         "    -l --length        length of test [default 300ms]\n"
         "    -s --size          packet size [default 240 + headers] \n"
         "    -S --server        run in server mode\n"
         "    -P --passfail      report pass/fail only\n"
         "    -e --ecn           enable ecn on all tests\n"
         "    -d --diffserv      [value] \n"
         "    -T --test-all      run all tests\n"
         "    -t --test-all      run bw test\n"
         "       --test-ecn      test for ecn\n"
         "       --test-diffserv test diffserv\n"
         "       --test-tos      test all tos bits\n"
         "       --test-self     test various bits of self\n"
         "    -Q --test-fq       test for presence of fair queuing\n"
         "    -B --test-bw       test bandwidth\n"
         "    -C --test-call     test call\n"
         "    -o --output        [type]\n"
         "    -w --write         [filename]\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1160 <usage+0x30>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xea5(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
test   %rdi,%rdi
je     114e <usage+0x1e>
mov    %rdi,%rdx
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [35 x i8] c"twd [options] addr [addr:port...]\0A\00"
@.str.2 = [33 x i8] c"twd [options] -S [addr:port...]\0A\00"
@.str.3 = [1228 x i8] c" -D --debug X debug output level\0A -v --verbose provide more verbose insight\0A -h --help this message\0A -F --dontfork remain in foreground\0A -1 --up test up direction only\0A -2 --down test down direction only\0A -3 --bidir test bidirectionally\0A -4 --ipv4 test ipv4\0A -6 --ipv6 test ipv6\0A -r --random-data use a random data size\0A -i --interval interval [default 10ms]\0A -L --logdir log directory [default .]\0A -l --length length of test [default 300ms]\0A -s --size packet size [default 240 + headers] \0A -S --server run in server mode\0A -P --passfail report pass/fail only\0A -e --ecn enable ecn on all tests\0A -d --diffserv [value] \0A -T --test-all run all tests\0A -t --test-all run bw test\0A --test-ecn test for ecn\0A --test-diffserv test diffserv\0A --test-tos test all tos bits\0A --test-self test various bits of self\0A -Q --test-fq test for presence of fair queuing\0A -B --test-bw test bandwidth\0A -C --test-call test call\0A -o --output [type]\0A -w --write [filename]\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %2
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %5, %1
%10 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([1228 x i8], [1228 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@str = [34 x i8] c"twd [options] addr [addr:port...]\00"
@str.4 = [32 x i8] c"twd [options] -S [addr:port...]\00"
@str.5 = [1227 x i8] c" -D --debug X debug output level\0A -v --verbose provide more verbose insight\0A -h --help this message\0A -F --dontfork remain in foreground\0A -1 --up test up direction only\0A -2 --down test down direction only\0A -3 --bidir test bidirectionally\0A -4 --ipv4 test ipv4\0A -6 --ipv6 test ipv6\0A -r --random-data use a random data size\0A -i --interval interval [default 10ms]\0A -L --logdir log directory [default .]\0A -l --length length of test [default 300ms]\0A -s --size packet size [default 240 + headers] \0A -S --server run in server mode\0A -P --passfail report pass/fail only\0A -e --ecn enable ecn on all tests\0A -d --diffserv [value] \0A -T --test-all run all tests\0A -t --test-all run bw test\0A --test-ecn test for ecn\0A --test-diffserv test diffserv\0A --test-tos test all tos bits\0A --test-self test various bits of self\0A -Q --test-fq test for presence of fair queuing\0A -B --test-bw test bandwidth\0A -C --test-call test call\0A -o --output [type]\0A -w --write [filename]\00"
define i32 @usage(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %3, %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([1227 x i8], [1227 x i8]* @str.5, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
}