#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 */
char *basename(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void usage(char *app) {
  fprintf(stderr, "%s, Ver %s.%s.%s\n", basename(app), "0", "2", "0");
  fprintf(stderr, "Usage: %s [-h] [-s bus_path] tty_device\n", app);
  fprintf(stderr, "-h: shows this help\n");
  fprintf(stderr, "-d: detach from terminal and run as daemon\n");
  fprintf(
      stderr,
      "-s bus_path: uses bus_path as bus path name (default: /tmp/ttybus)\n");
  fprintf(stderr, "-o: temporarly backup tty_device to tty_device.bak, if it "
                  "exists, and restore the original file at exit\n\n");
  fprintf(stderr, "Please also see: tty_bus, tty_attach, tty_plug, dpipe\n");
  fprintf(stderr, "Example of usage:\n");
  fprintf(stderr, "  Create a new bus called /tmp/ttyS0mux\n");
  fprintf(stderr, "    tty_bus -d -s /tmp/ttyS0mux\n");
  fprintf(stderr, "  Connect a real device to the bus /tmp/ttyS0mux\n");
  fprintf(stderr, "    tty_attach -d -s /tmp/ttyS0mux /dev/ttyS0\n");
  fprintf(
      stderr,
      "  Create two fake ttyS0 devices, attached to the bus /tmp/ttyS0mux\n");
  fprintf(stderr, "    tty_fake -d -s /tmp/ttyS0mux /dev/ttyS0.0\n");
  fprintf(stderr, "    tty_fake -d -s /tmp/ttyS0mux /dev/ttyS0.1\n");
  exit(2);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <basename@plt>
mov    -0xc(%rbp),%edi
mov    %rax,%rdx
lea    0xea2(%rip),%rsi
lea    0xead(%rip),%r9
lea    0xea8(%rip),%r8
mov    %r9,%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
lea    0xf31(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
lea    0xf51(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
lea    0xf4d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
lea    0xf5f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
lea    0xf69(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
lea    0xf84(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
lea    0xf9c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
lea    0xfc9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d34(%rip),%rax
mov    (%rax),%edi
lea    0xfe1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2ea2(%rip),%r14
mov    (%r14),%ebp
call   1040 <basename@plt>
lea    0xeb3(%rip),%rsi
lea    0xec0(%rip),%r8
lea    0xeb7(%rip),%rcx
mov    %ebp,%edi
mov    %rax,%rdx
mov    %rcx,%r9
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xea2(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xeb7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xebb(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xed6(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xf09(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xf62(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xf88(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xf8a(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xfa2(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xfb2(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xfd3(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xff1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0x1024(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0x1042(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"%s, Ver %s.%s.%s\0A\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"2\00"
@.str.3 = [41 x i8] c"Usage: %s [-h] [-s bus_path] tty_device\0A\00"
@.str.4 = [21 x i8] c"-h: shows this help\0A\00"
@.str.5 = [44 x i8] c"-d: detach from terminal and run as daemon\0A\00"
@.str.6 = [68 x i8] c"-s bus_path: uses bus_path as bus path name (default: /tmp/ttybus)\0A\00"
@.str.7 = [106 x i8] c"-o: temporarly backup tty_device to tty_device.bak, if it exists, and restore the original file at exit\0A\0A\00"
@.str.8 = [55 x i8] c"Please also see: tty_bus, tty_attach, tty_plug, dpipe\0A\00"
@.str.9 = [19 x i8] c"Example of usage:\0A\00"
@.str.10 = [41 x i8] c" Create a new bus called /tmp/ttyS0mux\0A\00"
@.str.11 = [33 x i8] c" tty_bus -d -s /tmp/ttyS0mux\0A\00"
@.str.12 = [50 x i8] c" Connect a real device to the bus /tmp/ttyS0mux\0A\00"
@.str.13 = [47 x i8] c" tty_attach -d -s /tmp/ttyS0mux /dev/ttyS0\0A\00"
@.str.14 = [68 x i8] c" Create two fake ttyS0 devices, attached to the bus /tmp/ttyS0mux\0A\00"
@.str.15 = [47 x i8] c" tty_fake -d -s /tmp/ttyS0mux /dev/ttyS0.0\0A\00"
@.str.16 = [47 x i8] c" tty_fake -d -s /tmp/ttyS0mux /dev/ttyS0.1\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i8* @basename(i8* %4)
%6 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %2
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.6, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str.7, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.12, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.13, i64 0, i64 0))
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.14, i64 0, i64 0))
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.15, i64 0, i64 0))
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.16, i64 0, i64 0))
%36 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"%s, Ver %s.%s.%s\0A\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"2\00"
@.str.3 = [41 x i8] c"Usage: %s [-h] [-s bus_path] tty_device\0A\00"
@.str.4 = [21 x i8] c"-h: shows this help\0A\00"
@.str.5 = [44 x i8] c"-d: detach from terminal and run as daemon\0A\00"
@.str.6 = [68 x i8] c"-s bus_path: uses bus_path as bus path name (default: /tmp/ttybus)\0A\00"
@.str.7 = [106 x i8] c"-o: temporarly backup tty_device to tty_device.bak, if it exists, and restore the original file at exit\0A\0A\00"
@.str.8 = [55 x i8] c"Please also see: tty_bus, tty_attach, tty_plug, dpipe\0A\00"
@.str.9 = [19 x i8] c"Example of usage:\0A\00"
@.str.10 = [41 x i8] c" Create a new bus called /tmp/ttyS0mux\0A\00"
@.str.11 = [33 x i8] c" tty_bus -d -s /tmp/ttyS0mux\0A\00"
@.str.12 = [50 x i8] c" Connect a real device to the bus /tmp/ttyS0mux\0A\00"
@.str.13 = [47 x i8] c" tty_attach -d -s /tmp/ttyS0mux /dev/ttyS0\0A\00"
@.str.14 = [68 x i8] c" Create two fake ttyS0 devices, attached to the bus /tmp/ttyS0mux\0A\00"
@.str.15 = [47 x i8] c" tty_fake -d -s /tmp/ttyS0mux /dev/ttyS0.0\0A\00"
@.str.16 = [47 x i8] c" tty_fake -d -s /tmp/ttyS0mux /dev/ttyS0.1\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i8* @basename(i8* %0)
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.6, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str.7, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0))
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.12, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.13, i64 0, i64 0))
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.14, i64 0, i64 0))
%29 = load i32, i32* @stderr
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.15, i64 0, i64 0))
%31 = load i32, i32* @stderr
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.16, i64 0, i64 0))
%33 = tail call i32 @exit(i32 2)
unreachable
}