#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(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char *min_isa;
  int isa_level = 0;
  int debug = 0;
  if ((argc == 3) && (strcmp(argv[2], "-debug") == 0)) {
    debug = 1;
  } else if (argc != 2) {
    fprintf(stderr, "usage: min_power_ISA <ISA> [-debug]\n");
    exit(2);
  }
  min_isa = argv[1];
  if (strcmp(min_isa, "2.05") == 0) {
    return !(isa_level >= 5);
  } else if (strcmp(min_isa, "2.06") == 0) {
    return !(isa_level >= 6);
  } else if (strcmp(min_isa, "2.07") == 0) {
    return !(isa_level >= 7);
  } else {
    fprintf(stderr,
            "ERROR: invalid ISA version.  Valid versions numbers are:\n");
    fprintf(stderr, "       2.05, 2.06, 2.07\n");
    exit(2);
  }
  return 1;
}


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)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    1188 <main+0x58>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe93(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1188 <main+0x58>
movl   $0x1,-0x20(%rbp)
jmp    11b6 <main+0x86>
cmpl   $0x2,-0x8(%rbp)
je     11b1 <main+0x81>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    0xe65(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
jmp    11b6 <main+0x86>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe5f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11f2 <main+0xc2>
cmpl   $0x5,-0x1c(%rbp)
setge  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1286 <main+0x156>
mov    -0x18(%rbp),%rdi
lea    0xe34(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1222 <main+0xf2>
cmpl   $0x6,-0x1c(%rbp)
setge  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1286 <main+0x156>
mov    -0x18(%rbp),%rdi
lea    0xe09(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1252 <main+0x122>
cmpl   $0x7,-0x1c(%rbp)
setge  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1286 <main+0x156>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
lea    0xdd9(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
lea    0xdfe(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1153 <main+0x23>
cmp    $0x3,%edi
jne    119a <main+0x6a>
mov    0x10(%rbx),%rdi
lea    0xeb7(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    119a <main+0x6a>
mov    0x8(%rbx),%rbx
lea    0xece(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1193 <main+0x63>
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1193 <main+0x63>
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    11ac <main+0x7c>
mov    $0x1,%eax
pop    %rbx
ret
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
jmp    11ca <main+0x9a>
mov    0x2e2d(%rip),%rbx
mov    (%rbx),%edi
lea    0xe7f(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeab(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"-debug\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"usage: min_power_ISA <ISA> [-debug]\0A\00"
@.str.2 = [5 x i8] c"2.05\00"
@.str.3 = [5 x i8] c"2.06\00"
@.str.4 = [5 x i8] c"2.07\00"
@.str.5 = [58 x i8] c"ERROR: invalid ISA version. Valid versions numbers are:\0A\00"
@.str.6 = [25 x i8] c" 2.05, 2.06, 2.07\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 2
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 1, i32* %8
br label %26
18: ; preds = %11, %2
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 2
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @exit(i32 2)
unreachable
25: ; preds = %18
br label %26
26: ; preds = %25, %17
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
store i8* %29, i8** %6
%30 = load i8*, i8** %6
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %26
%34 = load i32, i32* %7
%35 = icmp sge i32 %34, 5
%36 = xor i1 %35, true
%37 = zext i1 %36 to i32
store i32 %37, i32* %3
br label %62
38: ; preds = %26
%39 = load i8*, i8** %6
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %38
%43 = load i32, i32* %7
%44 = icmp sge i32 %43, 6
%45 = xor i1 %44, true
%46 = zext i1 %45 to i32
store i32 %46, i32* %3
br label %62
47: ; preds = %38
%48 = load i8*, i8** %6
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %56
51: ; preds = %47
%52 = load i32, i32* %7
%53 = icmp sge i32 %52, 7
%54 = xor i1 %53, true
%55 = zext i1 %54 to i32
store i32 %55, i32* %3
br label %62
56: ; preds = %47
%57 = load i32, i32* @stderr
%58 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.5, i64 0, i64 0))
%59 = load i32, i32* @stderr
%60 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%61 = call i32 @exit(i32 2)
unreachable
62: ; preds = %51, %42, %33
%63 = load i32, i32* %3
ret i32 %63
}

LLVM IR (-O2):
@.str = [7 x i8] c"-debug\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"usage: min_power_ISA <ISA> [-debug]\0A\00"
@.str.2 = [5 x i8] c"2.05\00"
@.str.3 = [5 x i8] c"2.06\00"
@.str.4 = [5 x i8] c"2.07\00"
@.str.5 = [58 x i8] c"ERROR: invalid ISA version. Valid versions numbers are:\0A\00"
@.str.6 = [25 x i8] c" 2.05, 2.06, 2.07\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %8 [
i32 3, label %3
i32 2, label %12
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 2
%5 = load i8*, i8** %4
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %3, %2
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @exit(i32 2)
unreachable
12: ; preds = %2, %3
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %29, label %17
17: ; preds = %12
%18 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %29, label %20
20: ; preds = %17
%21 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.5, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%28 = tail call i32 @exit(i32 2)
unreachable
29: ; preds = %20, %17, %12
ret i32 1
}