#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*/ mainloop(char *);
int strlen(char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  if (argc != 2 || strlen(argv[1]) != 1 || argv[1][0] < '0' || argv[1][0] > '3')
    usage();
  mainloop(argv[1]);
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    118e <main+0x5e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
jne    118e <main+0x5e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     118e <main+0x5e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x33,%eax
jle    1195 <main+0x65>
mov    $0x0,%al
call   1040 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <mainloop@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1153 <main+0x23>
mov    0x8(%rbx),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
jne    1153 <main+0x23>
mov    0x8(%rbx),%rdi
mov    (%rdi),%al
add    $0xcc,%al
cmp    $0xfb,%al
ja     115e <main+0x2e>
xor    %eax,%eax
call   1040 <usage@plt>
mov    0x8(%rbx),%rdi
call   1050 <mainloop@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %30, label %8
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strlen(i8* %11)
%13 = icmp ne i32 %12, 1
br i1 %13, label %30, label %14
14: ; preds = %8
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp slt i32 %20, 48
br i1 %21, label %30, label %22
22: ; preds = %14
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp sgt i32 %28, 51
br i1 %29, label %30, label %32
30: ; preds = %22, %14, %8, %2
%31 = call i32 (...) @usage()
br label %32
32: ; preds = %30, %22
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @mainloop(i8* %35)
ret i32 -1
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strlen(i8* %6)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = add i8 %11, -52
%13 = icmp ult i8 %12, -4
br i1 %13, label %14, label %18
14: ; preds = %9, %4, %2
%15 = tail call i32 (...) @usage()
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
br label %18
18: ; preds = %9, %14
%19 = phi i8* [ %10, %9 ], [ %17, %14 ]
%20 = tail call i32 @mainloop(i8* %19)
ret i32 -1
}