#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int go(char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int rc, inverted = 0;
  if (argc < 2 || argc > 3) {
    fprintf(stderr, "usage: s390x_features <feature> [<machine-model>]\n");
    exit(3);
  }
  if (argv[1][0] == '!') {
    assert(argv[2] == NULL);
    inverted = 1;
    ++argv[1];
  }
  rc = go(argv[1], argv[2]);
  if (inverted) {
    switch (rc) {
    case 0:
      rc = 1;
      break;
    case 1:
      rc = 0;
      break;
    case 2:
      rc = 2;
      break;
    }
  }
  return rc;
}


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,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1171 <main+0x31>
cmpl   $0x3,-0x8(%rbp)
jle    1190 <main+0x50>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x3,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x21,%eax
jne    11d1 <main+0x91>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
add    $0x1,%rcx
mov    %rcx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <go@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     124c <main+0x10c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
test   %eax,%eax
je     1228 <main+0xe8>
jmp    1206 <main+0xc6>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
je     1234 <main+0xf4>
jmp    1217 <main+0xd7>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     1240 <main+0x100>
jmp    1247 <main+0x107>
movl   $0x1,-0x14(%rbp)
jmp    1247 <main+0x107>
movl   $0x0,-0x14(%rbp)
jmp    1247 <main+0x107>
movl   $0x2,-0x14(%rbp)
jmp    124c <main+0x10c>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
add    $0xfffffffc,%edi
cmp    $0xfffffffd,%edi
jbe    1195 <main+0x55>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
cmpb   $0x21,(%rdi)
jne    118f <main+0x4f>
xor    %edi,%edi
test   %rsi,%rsi
sete   %dil
call   1040 <assert@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
add    $0x1,%rdi
mov    %rdi,0x8(%rbx)
call   1030 <go@plt>
cmp    $0x2,%eax
ja     118d <main+0x4d>
cltq
lea    0xeaa(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rbx
ret
pop    %rbx
jmp    1030 <go@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe5b(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x3,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"usage: s390x_features <feature> [<machine-model>]\0A\00"
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
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 3
br i1 %12, label %13, label %17
13: ; preds = %10, %2
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 3)
unreachable
17: ; preds = %10
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 33
br i1 %24, label %25, label %36
25: ; preds = %17
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = icmp eq i8* %28, null
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
store i32 1, i32* %7
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %33
br label %36
36: ; preds = %25, %17
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = call i32 @go(i8* %39, i8* %42)
store i32 %43, i32* %6
%44 = load i32, i32* %7
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %52
46: ; preds = %36
%47 = load i32, i32* %6
switch i32 %47, label %51 [
i32 0, label %48
i32 1, label %49
i32 2, label %50
]
48: ; preds = %46
store i32 1, i32* %6
br label %51
49: ; preds = %46
store i32 0, i32* %6
br label %51
50: ; preds = %46
store i32 2, i32* %6
br label %51
51: ; preds = %46, %50, %49, %48
br label %52
52: ; preds = %51, %36
%53 = load i32, i32* %6
ret i32 %53
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"usage: s390x_features <feature> [<machine-model>]\0A\00"
@switch.table.main = [3 x i32] [i32 1, i32 0, i32 2]
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add i32 %0, -4
%4 = icmp ult i32 %3, -2
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 3)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 33
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
br i1 %13, label %18, label %16
16: ; preds = %9
%17 = tail call i32 @go(i8* %11, i8* %15)
br label %31
18: ; preds = %9
%19 = icmp eq i8* %15, null
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = load i8*, i8** %10
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8* %23, i8** %10
%24 = load i8*, i8** %14
%25 = tail call i32 @go(i8* %23, i8* %24)
%26 = icmp ult i32 %25, 3
br i1 %26, label %27, label %31
27: ; preds = %18
%28 = sext i32 %25 to i64
%29 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.main, i64 0, i64 %28
%30 = load i32, i32* %29
br label %31
31: ; preds = %27, %18, %16
%32 = phi i32 [ %25, %18 ], [ %17, %16 ], [ %30, %27 ]
ret i32 %32
}