#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__ _getconf(char const *, char *, char *);
int _usage();
int getopt(int, char **, char *);
char *optarg;
int optind;
int main(int argc, char *argv[]) {
  int o;
  char const *specification = NULL;
  while ((o = getopt(argc, argv, "v:")) != -1)
    switch (o) {
    case 'v':
      specification = optarg;
      break;
    default:
      return _usage();
    }
  if (optind + 1 != argc && optind + 2 != argc)
    return _usage();
  return (_getconf(specification, argv[optind], 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)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xea4(%rip),%rdx
call   1040 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11a5 <main+0x75>
mov    -0x14(%rbp),%eax
sub    $0x76,%eax
jne    1191 <main+0x61>
jmp    117e <main+0x4e>
mov    0x2e73(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    11a0 <main+0x70>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    1224 <main+0xf4>
jmp    114e <main+0x1e>
mov    0x2e34(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
je     11de <main+0xae>
mov    0x2e1f(%rip),%rax
mov    (%rax),%eax
add    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     11de <main+0xae>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    1224 <main+0xf4>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x2df3(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rax
mov    0x2de1(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
call   1050 <_getconf@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   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r14d,%r14d
lea    0xeb9(%rip),%r15
mov    0x2eaa(%rip),%r12
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1040 <getopt@plt>
cmp    $0x76,%eax
jne    1168 <main+0x38>
mov    (%r12),%r14
jmp    1150 <main+0x20>
cmp    $0xffffffff,%eax
jne    1185 <main+0x55>
mov    0x2e6c(%rip),%rax
movslq (%rax),%rax
lea    0x1(%rax),%ecx
cmp    %ebp,%ecx
je     1194 <main+0x64>
lea    0x2(%rax),%ecx
cmp    %ebp,%ecx
je     1194 <main+0x64>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <_usage@plt>
mov    (%rbx,%rax,8),%rsi
mov    0x8(%rbx,%rax,8),%rdx
mov    %r14,%rdi
call   1050 <_getconf@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
add    %ecx,%ecx
mov    %ecx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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