#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ tnlIsOption(int);
int /*<<< orphan*/ tnlRequestSubOption(int);
int /*<<< orphan*/ tnlSendSubOption(int, char *);
int cmdPort(int argc, char *argv[]) {
  if (tnlIsOption(129)) {
    if (argc == 2)
      tnlSendSubOption(129, argv[1]);
    else if (argc == 1)
      tnlRequestSubOption(129);
    else {
      fprintf(stderr, "\rusage: port [<settings>]\n\r");
      fprintf(stderr, "\t<settings> can be in the form of "
                      "[8|7|6|5][E|O|N][C0|C1][S0|S1]\n\r");
      fprintf(stderr, "\t\t[E|O|N] Sets the parite\n\r");
      fprintf(stderr, "\t\t[8|7|6|5] Sets the bits / byte\n\r");
      fprintf(stderr, "\t\t[C0|C1] Sets hardware flow control on/off\n\r");
      fprintf(stderr, "\t\t[S0|S1] Sets software flow control on/off\n\r");
      fprintf(stderr, "\n\r");
    }
  } else
    fprintf(stderr, "\rOption PORTSET is disabled\n\r");
  return (0);
}


x86 assembly (clang, -O0):
<cmdPort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x81,%edi
call   1050 <tnlIsOption@plt>
cmp    $0x0,%rax
je     123a <cmdPort+0xfa>
cmpl   $0x2,-0x4(%rbp)
jne    1184 <cmdPort+0x44>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x81,%edi
call   1030 <tnlSendSubOption@plt>
jmp    1235 <cmdPort+0xf5>
cmpl   $0x1,-0x4(%rbp)
jne    119d <cmdPort+0x5d>
mov    $0x81,%edi
call   1060 <tnlRequestSubOption@plt>
jmp    1230 <cmdPort+0xf0>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
lea    0xe53(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
lea    0xe5a(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
lea    0xe31(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1235 <cmdPort+0xf5>
jmp    124f <cmdPort+0x10f>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdPort>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x81,%edi
call   1050 <tnlIsOption@plt>
test   %rax,%rax
je     1174 <cmdPort+0x34>
cmp    $0x1,%ebp
je     1186 <cmdPort+0x46>
cmp    $0x2,%ebp
jne    1192 <cmdPort+0x52>
mov    0x8(%rbx),%rsi
mov    $0x81,%edi
call   1030 <tnlSendSubOption@plt>
jmp    11fb <cmdPort+0xbb>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xf76(%rip),%rsi
jmp    11f6 <cmdPort+0xb6>
mov    $0x81,%edi
call   1060 <tnlRequestSubOption@plt>
jmp    11fb <cmdPort+0xbb>
mov    0x2e47(%rip),%rbx
mov    (%rbx),%edi
lea    0xe5e(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe6c(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xea1(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeaf(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xec4(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee4(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe66(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"\0Dusage: port [<settings>]\0A\0D\00"
@.str.1 = [67 x i8] c"\09<settings> can be in the form of [8|7|6|5][E|O|N][C0|C1][S0|S1]\0A\0D\00"
@.str.2 = [28 x i8] c"\09\09[E|O|N] Sets the parite\0A\0D\00"
@.str.3 = [35 x i8] c"\09\09[8|7|6|5] Sets the bits / byte\0A\0D\00"
@.str.4 = [46 x i8] c"\09\09[C0|C1] Sets hardware flow control on/off\0A\0D\00"
@.str.5 = [46 x i8] c"\09\09[S0|S1] Sets software flow control on/off\0A\0D\00"
@.str.6 = [3 x i8] c"\0A\0D\00"
@.str.7 = [30 x i8] c"\0DOption PORTSET is disabled\0A\0D\00"
define i32 @cmdPort(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i64 @tnlIsOption(i32 129)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %37
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @tnlSendSubOption(i32 129, i8* %13)
br label %36
15: ; preds = %7
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @tnlRequestSubOption(i32 129)
br label %35
20: ; preds = %15
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0))
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %35
35: ; preds = %20, %18
br label %36
36: ; preds = %35, %10
br label %40
37: ; preds = %2
%38 = load i32, i32* @stderr
%39 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
br label %40
40: ; preds = %37, %36
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"\0Dusage: port [<settings>]\0A\0D\00"
@.str.1 = [67 x i8] c"\09<settings> can be in the form of [8|7|6|5][E|O|N][C0|C1][S0|S1]\0A\0D\00"
@.str.2 = [28 x i8] c"\09\09[E|O|N] Sets the parite\0A\0D\00"
@.str.3 = [35 x i8] c"\09\09[8|7|6|5] Sets the bits / byte\0A\0D\00"
@.str.4 = [46 x i8] c"\09\09[C0|C1] Sets hardware flow control on/off\0A\0D\00"
@.str.5 = [46 x i8] c"\09\09[S0|S1] Sets software flow control on/off\0A\0D\00"
@.str.6 = [3 x i8] c"\0A\0D\00"
@.str.7 = [30 x i8] c"\0DOption PORTSET is disabled\0A\0D\00"
define i32 @cmdPort(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @tnlIsOption(i32 129)
%4 = icmp eq i64 %3, 0
br i1 %4, label %27, label %5
5: ; preds = %2
switch i32 %0, label %12 [
i32 2, label %6
i32 1, label %10
]
6: ; preds = %5
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @tnlSendSubOption(i32 129, i8* %8)
br label %30
10: ; preds = %5
%11 = tail call i32 @tnlRequestSubOption(i32 129)
br label %30
12: ; preds = %5
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %30
27: ; preds = %2
%28 = load i32, i32* @stderr
%29 = tail call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
br label %30
30: ; preds = %6, %12, %10, %27
ret i32 0
}