#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*/ printf(char *, ...);
int /*<<< orphan*/ synopsis(char *);
int /*<<< orphan*/ version(char *);
void examples(char *progname) {
  version(progname);
  synopsis(progname);
  printf("\nExamples:\n\n");
  printf("Server:\n");
  printf("The Computer with attached serial device for data aquisition will be "
         "considered a server. It runs:\n");
  printf("	%s -d -p 23000 -s \"9600 raw\" /dev/ttyS0 & \n\n", progname);
  printf("Client with serial port:\n");
  printf("The Computer which gets the data from the server via tcp/ip is a "
         "client.\nIt forwards data from/to the server to/from its attached "
         "serial device. It runs:\n");
  printf(
      "	%s -d -r server-name -p 23000 -s \"1200 raw\" /dev/ttyUSB0  & \n",
      progname);
  printf("Note: speed and serial settings may differ.\nTo this client bridges "
         "the serial port of the server to its serial port.\n\n");
  printf("Client wich fakes a serial port:\n");
  printf("The Computer which gets the data from the server via tcp/ip is a "
         "client.\n");
  printf("It forwards data from/to the server to/from a faked serial device, a "
         "symlink to /dev/ptmx,\n");
  printf("which is a slave pseudo terminal.\nThe client who wants to fool its "
         "own software with a fake serial runs:\n");
  printf("	%s -d -r server-name -p 23000 -l /dev/remserial1 /dev/ptmx &\n",
         progname);
  printf("Note: The fake serial does not need speed and serial setting as it "
         "ignores them.\n");
  printf("This client bridges the serial port of the server to its faked "
         "serial port.\n\n");
  printf("Hint: one can use telnet to connect to remserial and talk to the "
         "remote serial port:\ntelnet server-name 23000\n");
  printf("Note: make sure that remserial gets executed with sufficient rights. "
         "In doubt, run as root\n\n");
}


x86 assembly (clang, -O0):
<examples>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <version@plt>
mov    -0x8(%rbp),%rdi
call   1030 <synopsis@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xfac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xfdd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x1046(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x105a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x1096(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x10e4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0x113c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x116d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x11b1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x11f1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x1252(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<examples>:
push   %rbx
mov    %rdi,%rbx
call   1060 <version@plt>
mov    %rbx,%rdi
call   1040 <synopsis@plt>
lea    0xf54(%rip),%rdi
call   1030 <puts@plt>
lea    0xf54(%rip),%rdi
call   1030 <puts@plt>
lea    0xf50(%rip),%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf96(%rip),%rdi
call   1030 <puts@plt>
lea    0xfa3(%rip),%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1020(%rip),%rdi
call   1030 <puts@plt>
lea    0x108a(%rip),%rdi
call   1030 <puts@plt>
lea    0x109f(%rip),%rdi
call   1030 <puts@plt>
lea    0x10dc(%rip),%rdi
call   1030 <puts@plt>
lea    0x112b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1177(%rip),%rdi
call   1030 <puts@plt>
lea    0x11bc(%rip),%rdi
call   1030 <puts@plt>
lea    0x11fd(%rip),%rdi
call   1030 <puts@plt>
lea    0x125f(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"\0AExamples:\0A\0A\00"
@.str.1 = [9 x i8] c"Server:\0A\00"
@.str.2 = [100 x i8] c"The Computer with attached serial device for data aquisition will be considered a server. It runs:\0A\00"
@.str.3 = [46 x i8] c"\09%s -d -p 23000 -s \229600 raw\22 /dev/ttyS0 & \0A\0A\00"
@.str.4 = [26 x i8] c"Client with serial port:\0A\00"
@.str.5 = [155 x i8] c"The Computer which gets the data from the server via tcp/ip is a client.\0AIt forwards data from/to the server to/from its attached serial device. It runs:\0A\00"
@.str.6 = [63 x i8] c"\09%s -d -r server-name -p 23000 -s \221200 raw\22 /dev/ttyUSB0 & \0A\00"
@.str.7 = [119 x i8] c"Note: speed and serial settings may differ.\0ATo this client bridges the serial port of the server to its serial port.\0A\0A\00"
@.str.8 = [34 x i8] c"Client wich fakes a serial port:\0A\00"
@.str.9 = [74 x i8] c"The Computer which gets the data from the server via tcp/ip is a client.\0A\00"
@.str.10 = [92 x i8] c"It forwards data from/to the server to/from a faked serial device, a symlink to /dev/ptmx,\0A\00"
@.str.11 = [106 x i8] c"which is a slave pseudo terminal.\0AThe client who wants to fool its own software with a fake serial runs:\0A\00"
@.str.12 = [63 x i8] c"\09%s -d -r server-name -p 23000 -l /dev/remserial1 /dev/ptmx &\0A\00"
@.str.13 = [82 x i8] c"Note: The fake serial does not need speed and serial setting as it ignores them.\0A\00"
@.str.14 = [78 x i8] c"This client bridges the serial port of the server to its faked serial port.\0A\0A\00"
@.str.15 = [111 x i8] c"Hint: one can use telnet to connect to remserial and talk to the remote serial port:\0Atelnet server-name 23000\0A\00"
@.str.16 = [93 x i8] c"Note: make sure that remserial gets executed with sufficient rights. In doubt, run as root\0A\0A\00"
define void @examples(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @version(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @synopsis(i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.2, i64 0, i64 0))
%10 = load i8*, i8** %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.5, i64 0, i64 0))
%14 = load i8*, i8** %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.9, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.10, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str.11, i64 0, i64 0))
%21 = load i8*, i8** %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.12, i64 0, i64 0), i8* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.13, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.14, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str.15, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.16, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.3 = [46 x i8] c"\09%s -d -p 23000 -s \229600 raw\22 /dev/ttyS0 & \0A\0A\00"
@.str.6 = [63 x i8] c"\09%s -d -r server-name -p 23000 -s \221200 raw\22 /dev/ttyUSB0 & \0A\00"
@.str.12 = [63 x i8] c"\09%s -d -r server-name -p 23000 -l /dev/remserial1 /dev/ptmx &\0A\00"
@str = [12 x i8] c"\0AExamples:\0A\00"
@str.17 = [8 x i8] c"Server:\00"
@str.18 = [99 x i8] c"The Computer with attached serial device for data aquisition will be considered a server. It runs:\00"
@str.19 = [25 x i8] c"Client with serial port:\00"
@str.20 = [154 x i8] c"The Computer which gets the data from the server via tcp/ip is a client.\0AIt forwards data from/to the server to/from its attached serial device. It runs:\00"
@str.21 = [118 x i8] c"Note: speed and serial settings may differ.\0ATo this client bridges the serial port of the server to its serial port.\0A\00"
@str.22 = [33 x i8] c"Client wich fakes a serial port:\00"
@str.23 = [73 x i8] c"The Computer which gets the data from the server via tcp/ip is a client.\00"
@str.24 = [91 x i8] c"It forwards data from/to the server to/from a faked serial device, a symlink to /dev/ptmx,\00"
@str.25 = [105 x i8] c"which is a slave pseudo terminal.\0AThe client who wants to fool its own software with a fake serial runs:\00"
@str.26 = [81 x i8] c"Note: The fake serial does not need speed and serial setting as it ignores them.\00"
@str.27 = [77 x i8] c"This client bridges the serial port of the server to its faked serial port.\0A\00"
@str.28 = [110 x i8] c"Hint: one can use telnet to connect to remserial and talk to the remote serial port:\0Atelnet server-name 23000\00"
@str.29 = [92 x i8] c"Note: make sure that remserial gets executed with sufficient rights. In doubt, run as root\0A\00"
define void @examples(i8* %0) {
%2 = tail call i32 @version(i8* %0)
%3 = tail call i32 @synopsis(i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.17, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @str.18, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.19, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([154 x i8], [154 x i8]* @str.20, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([118 x i8], [118 x i8]* @str.21, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.22, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.23, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @str.24, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([105 x i8], [105 x i8]* @str.25, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.12, i64 0, i64 0), i8* %0)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.26, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.27, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([110 x i8], [110 x i8]* @str.28, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([92 x i8], [92 x i8]* @str.29, i64 0, i64 0))
ret void
}