#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 if (strcmp(min_isa, "3.00") == 0) {
    return !(isa_level >= 8);
  } else {
    fprintf(stderr,
            "ERROR: invalid ISA version '%s'.  Valid versions numbers are:\n",
            min_isa);
    fprintf(stderr, "       2.05, 2.06, 2.07, 3.00\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    11b8 <main+0x88>
cmpl   $0x2,-0x8(%rbp)
je     11b3 <main+0x83>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    0xe65(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
jmp    11b8 <main+0x88>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11f4 <main+0xc4>
cmpl   $0x5,-0x1c(%rbp)
setge  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    12c0 <main+0x190>
mov    -0x18(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1224 <main+0xf4>
cmpl   $0x6,-0x1c(%rbp)
setge  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    12c0 <main+0x190>
mov    -0x18(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1254 <main+0x124>
cmpl   $0x7,-0x1c(%rbp)
setge  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    12c0 <main+0x190>
mov    -0x18(%rbp),%rdi
lea    0xddc(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1284 <main+0x154>
cmpl   $0x8,-0x1c(%rbp)
setge  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    12c0 <main+0x190>
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
lea    0xdd0(%rip),%rsi
mov    $0x0,%al
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   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1156 <main+0x26>
cmp    $0x3,%edi
jne    11b7 <main+0x87>
mov    0x10(%rbx),%rdi
lea    0xeb4(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    11b7 <main+0x87>
mov    0x8(%rbx),%rbx
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11aa <main+0x7a>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11aa <main+0x7a>
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11aa <main+0x7a>
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    11c9 <main+0x99>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    0xe40(%rip),%rsi
jmp    11ee <main+0xbe>
mov    0x2e10(%rip),%r14
mov    (%r14),%edi
lea    0xe66(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xe91(%rip),%rsi
xor    %eax,%eax
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 = [5 x i8] c"3.00\00"
@.str.6 = [63 x i8] c"ERROR: invalid ISA version '%s'. Valid versions numbers are:\0A\00"
@.str.7 = [31 x i8] c" 2.05, 2.06, 2.07, 3.00\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 (i32, i8*, ...) @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 %72
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 %72
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 %72
56: ; preds = %47
%57 = load i8*, i8** %6
%58 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %65
60: ; preds = %56
%61 = load i32, i32* %7
%62 = icmp sge i32 %61, 8
%63 = xor i1 %62, true
%64 = zext i1 %63 to i32
store i32 %64, i32* %3
br label %72
65: ; preds = %56
%66 = load i32, i32* @stderr
%67 = load i8*, i8** %6
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i8* %67)
%69 = load i32, i32* @stderr
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%71 = call i32 @exit(i32 2)
unreachable
72: ; preds = %60, %51, %42, %33
%73 = load i32, i32* %3
ret i32 %73
}

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 = [5 x i8] c"3.00\00"
@.str.6 = [63 x i8] c"ERROR: invalid ISA version '%s'. Valid versions numbers are:\0A\00"
@.str.7 = [31 x i8] c" 2.05, 2.06, 2.07, 3.00\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 (i32, i8*, ...) @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 %32, 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 %32, 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 %32, label %23
23: ; preds = %20
%24 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %32, label %26
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i8* %14)
%29 = load i32, i32* @stderr
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%31 = tail call i32 @exit(i32 2)
unreachable
32: ; preds = %23, %20, %17, %12
ret i32 1
}