#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ *stderr;
void usage(FILE *file) {
  fprintf(
      file,
      "usage: "
      "memtrace"
      "-server <parameters> -- prog [args...]\n"
      "\n"
      " -h or --help             show this help message\n"
      " -s or --socket           server socket path or port (default :"
      "4576"
      ")\n"
      " -d or --depth            max. stack depth (default: "
      "4"
      ")\n"
      " -l or --libpath          path to libmemtrace.so (default: /usr/lib)\n"
      " -e or --follow-exec      follow exec system calls\n"
      " -f or --follow-fork      follow fork sytem calls\n"
      " -v or --verbose          verbose mode\n"
      " -w or --wait             wait for client connection\n");
  exit(file == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    0x2e99(%rip),%rcx
cmp    (%rcx),%rax
jne    1161 <usage+0x41>
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    116d <usage+0x4d>
mov    0x2e68(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    $0x1eb,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    0x2e9c(%rip),%rax
cmp    %rbx,(%rax)
jne    1157 <usage+0x37>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@.str = [492 x i8] c"usage: memtrace-server <parameters> -- prog [args...]\0A\0A -h or --help show this help message\0A -s or --socket server socket path or port (default :4576)\0A -d or --depth max. stack depth (default: 4)\0A -l or --libpath path to libmemtrace.so (default: /usr/lib)\0A -e or --follow-exec follow exec system calls\0A -f or --follow-fork follow fork sytem calls\0A -v or --verbose verbose mode\0A -w or --wait wait for client connection\0A\00"
@stderr = global i32* null
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define void @usage(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([492 x i8], [492 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = load i32*, i32** @stderr
%7 = icmp eq i32* %5, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* @EXIT_FAILURE
br label %12
10: ; preds = %1
%11 = load i32, i32* @EXIT_SUCCESS
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
%14 = call i32 @exit(i32 %13)
unreachable
}

LLVM IR (-O2):
@.str = [492 x i8] c"usage: memtrace-server <parameters> -- prog [args...]\0A\0A -h or --help show this help message\0A -s or --socket server socket path or port (default :4576)\0A -d or --depth max. stack depth (default: 4)\0A -l or --libpath path to libmemtrace.so (default: /usr/lib)\0A -e or --follow-exec follow exec system calls\0A -f or --follow-fork follow fork sytem calls\0A -v or --verbose verbose mode\0A -w or --wait wait for client connection\0A\00"
@stderr = global i32* null
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define void @usage(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([492 x i8], [492 x i8]* @.str, i64 0, i64 0), i64 491, i64 1, i32* %0)
%3 = load i32*, i32** @stderr
%4 = icmp eq i32* %3, %0
%5 = load i32, i32* @EXIT_FAILURE
%6 = load i32, i32* @EXIT_SUCCESS
%7 = select i1 %4, i32 %5, i32 %6
%8 = tail call i32 @exit(i32 %7)
unreachable
}