#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);
int getopt(int, char **, char *);
int /*<<< orphan*/ list();
int optind;
int scanner_init();
int /*<<< orphan*/ test(char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  int err;
  int opt;
  err = scanner_init();
  assert(!err);
  if (err)
    return 1;
  while ((opt = getopt(argc, argv, "hl")) != -1) {
    switch (opt) {
    case 'l':
      list();
      return 1;
    default:
      usage(argv[0]);
      return 1;
    }
  }
  if (argc - optind != 1) {
    usage(argv[0]);
    return 1;
  }
  test(argv[optind]);
  return 0;
}


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    $0x0,%al
call   1030 <scanner_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x14(%rbp)
je     11a9 <main+0x49>
movl   $0x1,-0x4(%rbp)
jmp    1254 <main+0xf4>
jmp    11ae <main+0x4e>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe44(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     1209 <main+0xa9>
mov    -0x18(%rbp),%eax
sub    $0x6c,%eax
jne    11f1 <main+0x91>
jmp    11de <main+0x7e>
mov    $0x0,%al
call   1050 <list@plt>
movl   $0x1,-0x4(%rbp)
jmp    1254 <main+0xf4>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    1254 <main+0xf4>
mov    -0x8(%rbp),%eax
mov    0x2dd5(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x1,%eax
je     1236 <main+0xd6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    1254 <main+0xf4>
mov    -0x10(%rbp),%rax
mov    0x2da7(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1080 <test@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <scanner_init@plt>
mov    %eax,%ebx
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    $0x1,%r15d
test   %ebx,%ebx
jne    11d7 <main+0x77>
lea    0xe6d(%rip),%rdx
mov    %ebp,%edi
mov    %r14,%rsi
call   1070 <getopt@plt>
cmp    $0xffffffff,%eax
je     11b0 <main+0x50>
cmp    $0x6c,%eax
jne    11cf <main+0x6f>
xor    %eax,%eax
call   1050 <list@plt>
jmp    11d7 <main+0x77>
mov    0x2e31(%rip),%rax
movslq (%rax),%rax
sub    %eax,%ebp
cmp    $0x1,%ebp
jne    11cf <main+0x6f>
mov    (%r14,%rax,8),%rdi
call   1080 <test@plt>
xor    %r15d,%r15d
jmp    11d7 <main+0x77>
mov    (%r14),%rdi
call   1060 <usage@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"hl\00"
@optind = global i32 0
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
%8 = call i32 (...) @scanner_init()
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 1, i32* %3
br label %49
17: ; preds = %2
br label %18
18: ; preds = %17
%19 = load i32, i32* %4
%20 = load i8**, i8*** %5
%21 = call i32 @getopt(i32 %19, i8** %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %21, i32* %7
%22 = icmp ne i32 %21, -1
br i1 %22, label %23, label %32
23: ; preds = %18
%24 = load i32, i32* %7
switch i32 %24, label %27 [
i32 108, label %25
]
25: ; preds = %23
%26 = call i32 (...) @list()
store i32 1, i32* %3
br label %49
27: ; preds = %23
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = call i32 @usage(i8* %30)
store i32 1, i32* %3
br label %49
32: ; preds = %18
%33 = load i32, i32* %4
%34 = load i32, i32* @optind
%35 = sub nsw i32 %33, %34
%36 = icmp ne i32 %35, 1
br i1 %36, label %37, label %42
37: ; preds = %32
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
%41 = call i32 @usage(i8* %40)
store i32 1, i32* %3
br label %49
42: ; preds = %32
%43 = load i8**, i8*** %5
%44 = load i32, i32* @optind
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
%48 = call i32 @test(i8* %47)
store i32 0, i32* %3
br label %49
49: ; preds = %42, %37, %27, %25, %16
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [3 x i8] c"hl\00"
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @scanner_init()
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
br i1 %4, label %7, label %26
7: ; preds = %2
%8 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %8, label %11 [
i32 -1, label %14
i32 108, label %9
]
9: ; preds = %7
%10 = tail call i32 (...) @list()
br label %26
11: ; preds = %7
%12 = load i8*, i8** %1
%13 = tail call i32 @usage(i8* %12)
br label %26
14: ; preds = %7
%15 = load i32, i32* @optind
%16 = sub nsw i32 %0, %15
%17 = icmp eq i32 %16, 1
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = load i8*, i8** %1
%20 = tail call i32 @usage(i8* %19)
br label %26
21: ; preds = %14
%22 = sext i32 %15 to i64
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = tail call i32 @test(i8* %24)
br label %26
26: ; preds = %2, %21, %18, %11, %9
%27 = phi i32 [ 1, %9 ], [ 1, %11 ], [ 1, %18 ], [ 0, %21 ], [ 1, %2 ]
ret i32 %27
}