#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__ _halt();
int _halt_usage();
int getopt(int, char **, char *);
int optind;
int main(int argc, char *argv[]) {
  int o;
  while ((o = getopt(argc, argv, "")) != -1)
    return _halt_usage();
  if (optind != argc)
    return _halt_usage();
  return _halt() ? 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 <_halt_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11b0 <main+0x80>
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
je     1195 <main+0x65>
mov    $0x0,%al
call   1030 <_halt_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11b0 <main+0x80>
mov    $0x0,%al
call   1040 <_halt@plt>
mov    %rax,%rdx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdx
call   1050 <getopt@plt>
cmp    $0xffffffff,%eax
jne    1164 <main+0x34>
mov    0x2e9d(%rip),%rax
cmp    %ebx,(%rax)
jne    1164 <main+0x34>
xor    %eax,%eax
call   1040 <_halt@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
add    %ecx,%ecx
mov    %ecx,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
jmp    1030 <_halt_usage@plt>

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
br label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %6
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 (...) @_halt_usage()
store i32 %13, i32* %3
br label %25
14: ; preds = %7
%15 = load i32, i32* @optind
%16 = load i32, i32* %4
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 (...) @_halt_usage()
store i32 %19, i32* %3
br label %25
20: ; preds = %14
%21 = call i64 (...) @_halt()
%22 = icmp ne i64 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 0, i32 2
store i32 %24, i32* %3
br label %25
25: ; preds = %20, %18, %12
%26 = load i32, i32* %3
ret i32 %26
}

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 (...) @_halt_usage()
br label %16
7: ; preds = %2
%8 = load i32, i32* @optind
%9 = icmp eq i32 %8, %0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 (...) @_halt_usage()
br label %16
12: ; preds = %7
%13 = tail call i64 (...) @_halt()
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, i32 2, i32 0
br label %16
16: ; preds = %12, %10, %5
%17 = phi i32 [ %6, %5 ], [ %11, %10 ], [ %15, %12 ]
ret i32 %17
}