#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 EOF;
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ console_level(int);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
scalar_t__ opterr;
int /*<<< orphan*/ switch_printk_console(int);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int op, i;
  if (argc <= 1)
    usage();
  opterr = 0;
  while ((op = getopt(argc, argv, "l:r:")) != EOF) {
    switch (op) {
    case 'l': {
      i = atoi(optarg);
      console_level(i);
      break;
    }
    case 'r': {
      i = atoi(optarg);
      switch_printk_console(i);
      break;
    }
    default: {
      usage();
    }
    }
  }
  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)
cmpl   $0x1,-0x8(%rbp)
jg     1177 <main+0x27>
mov    $0x0,%al
call   1050 <usage@plt>
mov    0x2e52(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe6d(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e3e(%rip),%rcx
cmp    (%rcx),%eax
je     1217 <main+0xc7>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x6c,%eax
je     11cf <main+0x7f>
jmp    11be <main+0x6e>
mov    -0x1c(%rbp),%eax
sub    $0x72,%eax
je     11ed <main+0x9d>
jmp    120b <main+0xbb>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <console_level@plt>
jmp    1212 <main+0xc2>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <switch_printk_console@plt>
jmp    1212 <main+0xc2>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    1185 <main+0x35>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x1,%edi
jg     1169 <main+0x19>
xor    %eax,%eax
call   1050 <usage@plt>
mov    0x2e60(%rip),%rax
movq   $0x0,(%rax)
lea    0xe82(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1060 <getopt@plt>
mov    0x2e51(%rip),%r15
cmp    (%r15),%eax
jne    119f <main+0x4f>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e52(%rip),%r12
lea    0xe53(%rip),%r14
jmp    11c9 <main+0x79>
nop
xor    %eax,%eax
call   1050 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
cmp    (%r15),%eax
je     1194 <main+0x44>
cmp    $0x72,%eax
je     11f0 <main+0xa0>
cmp    $0x6c,%eax
jne    11b0 <main+0x60>
mov    (%r12),%edi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1030 <console_level@plt>
jmp    11b7 <main+0x67>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12),%edi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1040 <switch_printk_console@plt>
jmp    11b7 <main+0x67>

LLVM IR (-O0):
@opterr = global i64 0
@.str = [5 x i8] c"l:r:\00"
@EOF = global i32 0
@optarg = 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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp sle i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @usage()
br label %12
12: ; preds = %10, %2
store i64 0, i64* @opterr
br label %13
13: ; preds = %33, %12
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @getopt(i32 %14, i8** %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %16, i32* %6
%17 = load i32, i32* @EOF
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %34
19: ; preds = %13
%20 = load i32, i32* %6
switch i32 %20, label %31 [
i32 108, label %21
i32 114, label %26
]
21: ; preds = %19
%22 = load i32, i32* @optarg
%23 = call i32 @atoi(i32 %22)
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = call i32 @console_level(i32 %24)
br label %33
26: ; preds = %19
%27 = load i32, i32* @optarg
%28 = call i32 @atoi(i32 %27)
store i32 %28, i32* %7
%29 = load i32, i32* %7
%30 = call i32 @switch_printk_console(i32 %29)
br label %33
31: ; preds = %19
%32 = call i32 (...) @usage()
br label %33
33: ; preds = %31, %26, %21
br label %13
34: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [5 x i8] c"l:r:\00"
@EOF = global i32 0
@optarg = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %6
6: ; preds = %4, %2
store i64 0, i64* @opterr
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %26, label %10
10: ; preds = %6, %22
%11 = phi i32 [ %23, %22 ], [ %7, %6 ]
switch i32 %11, label %20 [
i32 108, label %12
i32 114, label %16
]
12: ; preds = %10
%13 = load i32, i32* @optarg
%14 = tail call i32 @atoi(i32 %13)
%15 = tail call i32 @console_level(i32 %14)
br label %22
16: ; preds = %10
%17 = load i32, i32* @optarg
%18 = tail call i32 @atoi(i32 %17)
%19 = tail call i32 @switch_printk_console(i32 %18)
br label %22
20: ; preds = %10
%21 = tail call i32 (...) @usage()
br label %22
22: ; preds = %20, %16, %12
%23 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %10
26: ; preds = %22, %6
ret i32 0
}