#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 getopt(int, char **, char const *);
int /*<<< orphan*/ ringreenable_do();
int /*<<< orphan*/ ringstatusget_do();
int /*<<< orphan*/ usage_do();
int main(int argc, char *argv[]) {
  const char *options = "sr";
  int opt;
  if (argc == 1) {
    usage_do();
  }
  while ((opt = getopt(argc, argv, options)) != -1) {
    switch (opt) {
    case 's':
      ringstatusget_do();
      break;
    case 'r':
      ringreenable_do();
      break;
    }
  }
  return (0);
}


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)
lea    0xea3(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1172 <main+0x32>
mov    $0x0,%al
call   1030 <usage_do@plt>
jmp    1177 <main+0x37>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     11d0 <main+0x90>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x72,%eax
je     11c4 <main+0x84>
jmp    11a7 <main+0x67>
mov    -0x20(%rbp),%eax
sub    $0x73,%eax
jne    11cb <main+0x8b>
jmp    11b8 <main+0x78>
mov    $0x0,%al
call   1060 <ringstatusget_do@plt>
jmp    11cb <main+0x8b>
mov    $0x0,%al
call   1040 <ringreenable_do@plt>
jmp    1177 <main+0x37>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x1,%edi
jne    1155 <main+0x15>
xor    %eax,%eax
call   1030 <usage_do@plt>
lea    0xea4(%rip),%r14
jmp    1167 <main+0x27>
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <ringstatusget_do@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <getopt@plt>
cmp    $0x72,%eax
je     1190 <main+0x50>
cmp    $0x73,%eax
je     1160 <main+0x20>
cmp    $0xffffffff,%eax
jne    1167 <main+0x27>
jmp    1199 <main+0x59>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1040 <ringreenable_do@plt>
jmp    1167 <main+0x27>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"sr\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %6
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @usage_do()
br label %12
12: ; preds = %10, %2
br label %13
13: ; preds = %25, %12
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = load i8*, i8** %6
%17 = call i32 @getopt(i32 %14, i8** %15, i8* %16)
store i32 %17, i32* %7
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %26
19: ; preds = %13
%20 = load i32, i32* %7
switch i32 %20, label %25 [
i32 115, label %21
i32 114, label %23
]
21: ; preds = %19
%22 = call i32 (...) @ringstatusget_do()
br label %25
23: ; preds = %19
%24 = call i32 (...) @ringreenable_do()
br label %25
25: ; preds = %19, %23, %21
br label %13
26: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"sr\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage_do()
br label %6
6: ; preds = %4, %2
br label %7
7: ; preds = %9, %6
%8 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %8, label %9 [
i32 -1, label %14
i32 115, label %10
i32 114, label %12
]
9: ; preds = %7, %12, %10
br label %7
10: ; preds = %7
%11 = tail call i32 (...) @ringstatusget_do()
br label %9
12: ; preds = %7
%13 = tail call i32 (...) @ringreenable_do()
br label %9
14: ; preds = %7
ret i32 0
}