#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 EXIT_SUCCESS;
int /*<<< orphan*/ print_usage();
int rpi_gpio_header_type(int);
int rpi_version();
int /*<<< orphan*/ set_rts_cts(int, int);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int enable, disable, version, header_type;
  version = rpi_version();
  header_type = rpi_gpio_header_type(version);
  if (argc != 2) {
    print_usage();
  } else {
    enable = !strcmp(argv[1], "on");
    disable = !strcmp(argv[1], "off");
    if (enable)
      set_rts_cts(1, header_type);
    else if (disable)
      set_rts_cts(0, header_type);
    else
      print_usage();
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <rpi_version@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1070 <rpi_gpio_header_type@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1191 <main+0x41>
mov    $0x0,%al
call   1060 <print_usage@plt>
jmp    121f <main+0xcf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe60(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11f5 <main+0xa5>
mov    -0x20(%rbp),%esi
mov    $0x1,%edi
call   1040 <set_rts_cts@plt>
jmp    121a <main+0xca>
cmpl   $0x0,-0x18(%rbp)
je     120e <main+0xbe>
mov    -0x20(%rbp),%esi
xor    %edi,%edi
call   1040 <set_rts_cts@plt>
jmp    1215 <main+0xc5>
mov    $0x0,%al
call   1060 <print_usage@plt>
jmp    121a <main+0xca>
jmp    121f <main+0xcf>
mov    0x2dba(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <rpi_version@plt>
mov    %eax,%edi
call   1070 <rpi_gpio_header_type@plt>
cmp    $0x2,%ebp
jne    1199 <main+0x49>
mov    %eax,%r14d
mov    0x8(%rbx),%rbx
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a2 <main+0x52>
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11a9 <main+0x59>
xor    %eax,%eax
call   1060 <print_usage@plt>
jmp    11b3 <main+0x63>
mov    $0x1,%edi
jmp    11ab <main+0x5b>
xor    %edi,%edi
mov    %r14d,%esi
call   1040 <set_rts_cts@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"on\00"
@.str.1 = [4 x i8] c"off\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (...) @rpi_version()
store i32 %10, i32* %8
%11 = load i32, i32* %8
%12 = call i32 @rpi_gpio_header_type(i32 %11)
store i32 %12, i32* %9
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 (...) @print_usage()
br label %47
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
store i32 %24, i32* %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
%30 = xor i1 %29, true
%31 = zext i1 %30 to i32
store i32 %31, i32* %7
%32 = load i32, i32* %6
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %17
%35 = load i32, i32* %9
%36 = call i32 @set_rts_cts(i32 1, i32 %35)
br label %46
37: ; preds = %17
%38 = load i32, i32* %7
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* %9
%42 = call i32 @set_rts_cts(i32 0, i32 %41)
br label %45
43: ; preds = %37
%44 = call i32 (...) @print_usage()
br label %45
45: ; preds = %43, %40
br label %46
46: ; preds = %45, %34
br label %47
47: ; preds = %46, %15
%48 = load i32, i32* @EXIT_SUCCESS
ret i32 %48
}

LLVM IR (-O2):
@.str = [3 x i8] c"on\00"
@.str.1 = [4 x i8] c"off\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @rpi_version()
%4 = tail call i32 @rpi_gpio_header_type(i32 %3)
%5 = icmp eq i32 %0, 2
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @print_usage()
br label %22
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 @set_rts_cts(i32 1, i32 %4)
br label %22
15: ; preds = %8
%16 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @set_rts_cts(i32 0, i32 %4)
br label %22
20: ; preds = %15
%21 = tail call i32 (...) @print_usage()
br label %22
22: ; preds = %13, %20, %18, %6
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}