#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 */
scalar_t__ _printf(char *, int, char **);
int _usage();
int getopt(int, char **, char *);
int optind;
int main(int argc, char *argv[]) {
  int o;
  if ((o = getopt(argc, argv, "")) != -1)
    return _usage();
  if (optind == argc)
    return _usage();
  return _printf(argv[optind], argc - optind - 1, &argv[optind + 1]) == 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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeac(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1174 <main+0x44>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11e8 <main+0xb8>
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    1195 <main+0x65>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11e8 <main+0xb8>
mov    -0x10(%rbp),%rax
mov    0x2e48(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x8(%rbp),%esi
mov    0x2e37(%rip),%rax
sub    (%rax),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%rdx
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
call   1040 <_printf@plt>
mov    %rax,%rdx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
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   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xec1(%rip),%rdx
call   1050 <getopt@plt>
cmp    $0xffffffff,%eax
jne    1157 <main+0x27>
mov    0x2e98(%rip),%rax
movslq (%rax),%rax
cmp    %ebp,%eax
jne    1164 <main+0x34>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <_usage@plt>
mov    (%rbx,%rax,8),%rdi
mov    %eax,%esi
not    %esi
add    %ebp,%esi
lea    (%rbx,%rax,8),%rdx
add    $0x8,%rdx
call   1040 <_printf@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
add    %ecx,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @getopt(i32 %7, i8** %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 %9, i32* %6
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @_usage()
store i32 %12, i32* %3
br label %38
13: ; preds = %2
%14 = load i32, i32* @optind
%15 = load i32, i32* %4
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 (...) @_usage()
store i32 %18, i32* %3
br label %38
19: ; preds = %13
%20 = load i8**, i8*** %5
%21 = load i32, i32* @optind
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = load i32, i32* %4
%26 = load i32, i32* @optind
%27 = sub nsw i32 %25, %26
%28 = sub nsw i32 %27, 1
%29 = load i8**, i8*** %5
%30 = load i32, i32* @optind
%31 = add nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %29, i64 %32
%34 = call i64 @_printf(i8* %24, i32 %28, i8** %33)
%35 = icmp eq i64 %34, 0
%36 = zext i1 %35 to i64
%37 = select i1 %35, i32 0, i32 2
store i32 %37, i32* %3
br label %38
38: ; preds = %19, %17, %11
%39 = load i32, i32* %3
ret i32 %39
}

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 (...) @_usage()
br label %24
7: ; preds = %2
%8 = load i32, i32* @optind
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 (...) @_usage()
br label %24
12: ; preds = %7
%13 = sext i32 %8 to i64
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = xor i32 %8, -1
%17 = add i32 %16, %0
%18 = add nsw i32 %8, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %1, i64 %19
%21 = tail call i64 @_printf(i8* %15, i32 %17, i8** %20)
%22 = icmp eq i64 %21, 0
%23 = select i1 %22, i32 0, i32 2
br label %24
24: ; preds = %12, %10, %5
%25 = phi i32 [ %6, %5 ], [ %11, %10 ], [ %23, %12 ]
ret i32 %25
}