#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*/ EXIT_FAILURE;
int /*<<< orphan*/ display_current_setting();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getopt(int, char **, char *);
int optind;
int /*<<< orphan*/ set_value_to(char);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int opt;
  while ((opt = getopt(argc, argv, "")) != -1) {
    fprintf(stderr, "Usage: %s [0|1|2]\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  if (optind >= argc) {
    display_current_setting();
  } else {
    switch (argv[optind][0]) {
    case '0':
    case '1':
    case '2':
      set_value_to(argv[optind][0]);
      display_current_setting();
      break;
    default:
      fprintf(stderr, "Usage: %s [0|1|2]\n", argv[0]);
      exit(EXIT_FAILURE);
    }
  }
  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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe9e(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11af <main+0x5f>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe64(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jl     11cd <main+0x7d>
mov    $0x0,%al
call   1030 <display_current_setting@plt>
jmp    1248 <main+0xf8>
mov    -0x10(%rbp),%rax
mov    0x2e10(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
add    $0xffffffd0,%eax
sub    $0x2,%eax
ja     1219 <main+0xc9>
jmp    11f3 <main+0xa3>
mov    -0x10(%rbp),%rax
mov    0x2dea(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%edi
call   1040 <set_value_to@plt>
mov    $0x0,%al
call   1030 <display_current_setting@plt>
jmp    1243 <main+0xf3>
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd0(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
jmp    1248 <main+0xf8>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeb3(%rip),%rdx
call   1060 <getopt@plt>
cmp    $0xffffffff,%eax
jne    119e <main+0x4e>
mov    0x2e78(%rip),%rax
movslq (%rax),%rax
cmp    %ebp,%eax
jge    118e <main+0x3e>
mov    (%rbx,%rax,8),%rax
movsbl (%rax),%eax
lea    -0x30(%rax),%ecx
cmp    $0x2,%ecx
ja     119e <main+0x4e>
movsbl %al,%edi
call   1040 <set_value_to@plt>
xor    %eax,%eax
call   1030 <display_current_setting@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe4f(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [19 x i8] c"Usage: %s [0|1|2]\0A\00"
@EXIT_FAILURE = global i32 0
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %6
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %20
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %7
%21 = load i32, i32* @optind
%22 = load i32, i32* %4
%23 = icmp sge i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (...) @display_current_setting()
br label %54
26: ; preds = %20
%27 = load i8**, i8*** %5
%28 = load i32, i32* @optind
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = getelementptr inbounds i8, i8* %31, i64 0
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
switch i32 %34, label %45 [
i32 48, label %35
i32 49, label %35
i32 50, label %35
]
35: ; preds = %26, %26, %26
%36 = load i8**, i8*** %5
%37 = load i32, i32* @optind
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i8, i8* %40, i64 0
%42 = load i8, i8* %41
%43 = call i32 @set_value_to(i8 signext %42)
%44 = call i32 (...) @display_current_setting()
br label %53
45: ; preds = %26
%46 = load i32, i32* @stderr
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 0
%49 = load i8*, i8** %48
%50 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @EXIT_FAILURE
%52 = call i32 @exit(i32 %51)
unreachable
53: ; preds = %35
br label %54
54: ; preds = %53, %24
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [19 x i8] c"Usage: %s [0|1|2]\0A\00"
@EXIT_FAILURE = global i32 0
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, -1
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = load i32, i32* @optind
%13 = icmp slt i32 %12, %0
br i1 %13, label %14, label %30
14: ; preds = %11
%15 = sext i32 %12 to i64
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = add nsw i32 %19, -48
%21 = icmp ult i32 %20, 3
br i1 %21, label %22, label %24
22: ; preds = %14
%23 = tail call i32 @set_value_to(i8 signext %18)
br label %30
24: ; preds = %14
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %1
%27 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @exit(i32 %28)
unreachable
30: ; preds = %11, %22
%31 = tail call i32 (...) @display_current_setting()
ret i32 0
}