#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 compare(int, char **, int);
int /*<<< orphan*/ errx(int, char *);
int getopt(int, char **, char *);
scalar_t__ optind;
int usage();
int main(int argc, char *argv[]) {
  int opts, ch;
  while ((ch = getopt(argc, argv, "hlsxz")) != -1)
    switch (ch) {
    case 'h':
      opts |= (1 << 0);
      break;
    case 'l':
      opts |= (1 << 3);
      break;
    case 's':
      opts |= (1 << 1);
      opts |= (1 << 2);
      break;
    case 'x':
      opts |= (1 << 3);
      opts |= (1 << 4);
      break;
    case 'z':
      opts |= (1 << 2);
      break;
    case '?':
    default:
      return usage();
    }
  argv += optind;
  argc -= optind;
  if ((opts & (1 << 3)) && (opts & (1 << 1)))
    errx(2, "specifying -s with -l or -x is not permitted");
  if (argc < 2 || argc > 4)
    return usage();
  return compare(argc, argv, opts);
}


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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xf8c(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     120f <main+0xcf>
mov    -0x18(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3b,%eax
ja     11fb <main+0xbb>
mov    -0x20(%rbp),%rax
lea    0xe6b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x14(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    120a <main+0xca>
mov    -0x14(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x14(%rbp)
jmp    120a <main+0xca>
mov    -0x14(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x14(%rbp)
jmp    120a <main+0xca>
mov    -0x14(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
or     $0x10,%eax
mov    %eax,-0x14(%rbp)
jmp    120a <main+0xca>
mov    -0x14(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x14(%rbp)
jmp    120a <main+0xca>
jmp    11fb <main+0xbb>
mov    $0x0,%al
call   1040 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    129d <main+0x15d>
jmp    1156 <main+0x16>
mov    0x2dd2(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2dbc(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1268 <main+0x128>
mov    -0x14(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1268 <main+0x128>
mov    $0x2,%edi
lea    0xe93(%rip),%rsi
call   1030 <errx@plt>
cmpl   $0x2,-0x8(%rbp)
jl     127c <main+0x13c>
cmpl   $0x4,-0x8(%rbp)
jle    128b <main+0x14b>
mov    $0x0,%al
call   1040 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    129d <main+0x15d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1060 <compare@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%r12d
lea    0xef7(%rip),%r15
lea    0xea4(%rip),%rbx
jmp    1165 <main+0x25>
mov    $0x8,%eax
or     %eax,%ebp
mov    %r12d,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <getopt@plt>
lea    -0x68(%rax),%ecx
cmp    $0x12,%ecx
ja     11a4 <main+0x64>
mov    $0x1,%eax
movslq (%rbx,%rcx,4),%rcx
add    %rbx,%rcx
jmp    *%rcx
mov    $0x6,%eax
or     %eax,%ebp
jmp    1165 <main+0x25>
mov    $0x18,%eax
or     %eax,%ebp
jmp    1165 <main+0x25>
mov    $0x4,%eax
or     %eax,%ebp
jmp    1165 <main+0x25>
cmp    $0xffffffff,%eax
jne    11d9 <main+0x99>
mov    0x2e38(%rip),%rax
mov    (%rax),%rbx
sub    %ebx,%r12d
mov    %ebp,%eax
not    %eax
test   $0xa,%al
jne    11cf <main+0x8f>
lea    0xe8d(%rip),%rsi
mov    $0x2,%edi
call   1030 <errx@plt>
lea    -0x5(%r12),%eax
cmp    $0xfffffffc,%eax
ja     11e8 <main+0xa8>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <usage@plt>
lea    (%r14,%rbx,8),%rsi
mov    %r12d,%edi
mov    %ebp,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <compare@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"hlsxz\00"
@optind = global i64 0
@.str.1 = [45 x i8] c"specifying -s with -l or -x is not permitted\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
br label %8
8: ; preds = %37, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %7
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %38
13: ; preds = %8
%14 = load i32, i32* %7
switch i32 %14, label %35 [
i32 104, label %15
i32 108, label %18
i32 115, label %21
i32 120, label %26
i32 122, label %31
i32 63, label %34
]
15: ; preds = %13
%16 = load i32, i32* %6
%17 = or i32 %16, 1
store i32 %17, i32* %6
br label %37
18: ; preds = %13
%19 = load i32, i32* %6
%20 = or i32 %19, 8
store i32 %20, i32* %6
br label %37
21: ; preds = %13
%22 = load i32, i32* %6
%23 = or i32 %22, 2
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = or i32 %24, 4
store i32 %25, i32* %6
br label %37
26: ; preds = %13
%27 = load i32, i32* %6
%28 = or i32 %27, 8
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = or i32 %29, 16
store i32 %30, i32* %6
br label %37
31: ; preds = %13
%32 = load i32, i32* %6
%33 = or i32 %32, 4
store i32 %33, i32* %6
br label %37
34: ; preds = %13
br label %35
35: ; preds = %13, %34
%36 = call i32 (...) @usage()
store i32 %36, i32* %3
br label %69
37: ; preds = %31, %26, %21, %18, %15
br label %8
38: ; preds = %8
%39 = load i64, i64* @optind
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 %39
store i8** %41, i8*** %5
%42 = load i64, i64* @optind
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = sub nsw i64 %44, %42
%46 = trunc i64 %45 to i32
store i32 %46, i32* %4
%47 = load i32, i32* %6
%48 = and i32 %47, 8
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %56
50: ; preds = %38
%51 = load i32, i32* %6
%52 = and i32 %51, 2
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 @errx(i32 2, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %56
56: ; preds = %54, %50, %38
%57 = load i32, i32* %4
%58 = icmp slt i32 %57, 2
br i1 %58, label %62, label %59
59: ; preds = %56
%60 = load i32, i32* %4
%61 = icmp sgt i32 %60, 4
br i1 %61, label %62, label %64
62: ; preds = %59, %56
%63 = call i32 (...) @usage()
store i32 %63, i32* %3
br label %69
64: ; preds = %59
%65 = load i32, i32* %4
%66 = load i8**, i8*** %5
%67 = load i32, i32* %6
%68 = call i32 @compare(i32 %65, i8** %66, i32 %67)
store i32 %68, i32* %3
br label %69
69: ; preds = %64, %62, %35
%70 = load i32, i32* %3
ret i32 %70
}

LLVM IR (-O2):
@.str = [6 x i8] c"hlsxz\00"
@optind = global i64 0
@.str.1 = [45 x i8] c"specifying -s with -l or -x is not permitted\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %12, %2
%4 = phi i32 [ undef, %2 ], [ %14, %12 ]
%5 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %5, label %10 [
i32 -1, label %15
i32 104, label %12
i32 108, label %6
i32 115, label %7
i32 120, label %8
i32 122, label %9
]
6: ; preds = %3
br label %12
7: ; preds = %3
br label %12
8: ; preds = %3
br label %12
9: ; preds = %3
br label %12
10: ; preds = %3
%11 = tail call i32 (...) @usage()
br label %31
12: ; preds = %3, %9, %8, %7, %6
%13 = phi i32 [ 4, %9 ], [ 24, %8 ], [ 6, %7 ], [ 8, %6 ], [ 1, %3 ]
%14 = or i32 %4, %13
br label %3
15: ; preds = %3
%16 = load i64, i64* @optind
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = trunc i64 %16 to i32
%19 = sub i32 %0, %18
%20 = and i32 %4, 10
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %24
22: ; preds = %15
%23 = tail call i32 @errx(i32 2, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %15
%25 = add i32 %19, -5
%26 = icmp ult i32 %25, -3
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = tail call i32 (...) @usage()
br label %31
29: ; preds = %24
%30 = tail call i32 @compare(i32 %19, i8** %17, i32 %4)
br label %31
31: ; preds = %29, %27, %10
%32 = phi i32 [ %11, %10 ], [ %28, %27 ], [ %30, %29 ]
ret i32 %32
}