#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 _eject(char *);
int _eject_usage();
int getopt(int, char **, char *);
int optind;
int main(int argc, char *argv[]) {
  int ret = 0;
  int o;
  while ((o = getopt(argc, argv, "")) != -1)
    switch (o) {
    default:
      return _eject_usage();
    }
  if (optind == argc)
    return _eject_usage();
  for (o = optind; o < argc; o++)
    ret |= _eject(argv[o]);
  return (ret == 0) ? 0 : 2;
}


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,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xea5(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     117b <main+0x4b>
mov    $0x0,%al
call   1040 <_eject_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11ec <main+0xbc>
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    119c <main+0x6c>
mov    $0x0,%al
call   1040 <_eject_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11ec <main+0xbc>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d9 <main+0xa9>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <_eject@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a8 <main+0x78>
mov    -0x14(%rbp),%edx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
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   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
lea    0xebc(%rip),%rdx
call   1050 <getopt@plt>
cmp    $0xffffffff,%eax
jne    115d <main+0x2d>
mov    0x2e93(%rip),%rax
movslq (%rax),%rcx
cmp    %r15d,%ecx
jne    116e <main+0x3e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <_eject_usage@plt>
xor    %eax,%eax
cmp    %r15d,%ecx
jge    119d <main+0x6d>
lea    (%r14,%rcx,8),%r14
sub    %ecx,%r15d
xor    %ebx,%ebx
xor    %ebp,%ebp
mov    (%r14,%rbx,8),%rdi
call   1030 <_eject@plt>
or     %eax,%ebp
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1180 <main+0x50>
xor    %eax,%eax
test   %ebp,%ebp
setne  %al
add    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@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
store i32 0, i32* %6
br label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %7
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i32, i32* %7
switch i32 %14, label %15 [
]
15: ; preds = %13
%16 = call i32 (...) @_eject_usage()
store i32 %16, i32* %3
br label %46
17: ; preds = %8
%18 = load i32, i32* @optind
%19 = load i32, i32* %4
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 (...) @_eject_usage()
store i32 %22, i32* %3
br label %46
23: ; preds = %17
%24 = load i32, i32* @optind
store i32 %24, i32* %7
br label %25
25: ; preds = %38, %23
%26 = load i32, i32* %7
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %41
29: ; preds = %25
%30 = load i8**, i8*** %5
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 @_eject(i8* %34)
%36 = load i32, i32* %6
%37 = or i32 %36, %35
store i32 %37, i32* %6
br label %38
38: ; preds = %29
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %25
41: ; preds = %25
%42 = load i32, i32* %6
%43 = icmp eq i32 %42, 0
%44 = zext i1 %43 to i64
%45 = select i1 %43, i32 0, i32 2
store i32 %45, i32* %3
br label %46
46: ; preds = %41, %21, %15
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, -1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @_eject_usage()
br label %29
7: ; preds = %2
%8 = load i32, i32* @optind
%9 = icmp eq i32 %8, %0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = icmp slt i32 %8, %0
br i1 %11, label %12, label %29
12: ; preds = %10
%13 = sext i32 %8 to i64
br label %16
14: ; preds = %7
%15 = tail call i32 (...) @_eject_usage()
br label %29
16: ; preds = %12, %16
%17 = phi i64 [ %13, %12 ], [ %23, %16 ]
%18 = phi i32 [ 0, %12 ], [ %22, %16 ]
%19 = getelementptr inbounds i8*, i8** %1, i64 %17
%20 = load i8*, i8** %19
%21 = tail call i32 @_eject(i8* %20)
%22 = or i32 %21, %18
%23 = add nsw i64 %17, 1
%24 = trunc i64 %23 to i32
%25 = icmp eq i32 %24, %0
br i1 %25, label %26, label %16
26: ; preds = %16
%27 = icmp eq i32 %22, 0
%28 = select i1 %27, i32 0, i32 2
br label %29
29: ; preds = %10, %26, %14, %5
%30 = phi i32 [ %6, %5 ], [ %15, %14 ], [ 0, %10 ], [ %28, %26 ]
ret i32 %30
}