#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *const);
int getopt(int, char *const *, char *);
int /*<<< orphan*/ stderr;
int check_for_options(int argc, char *const argv[]) {
  int flags, opt;
  flags = 0;
  while ((opt = getopt(argc, argv, "v")) != -1) {
    if (opt == 'v')
      flags = 1;
    else {
      fprintf(stderr, "Usage: %s [-v] number of nodes in tree\n", argv[0]);
      exit(EXIT_FAILURE);
    }
  }
  if (!flags && argc > 1) {
    fprintf(stderr, "Usage: %s [-v] number of nodes in tree\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  return flags;
}


x86 assembly (clang, -O0):
<check_for_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeac(%rip),%rdx
call   1040 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     11aa <check_for_options+0x7a>
cmpl   $0x76,-0x18(%rbp)
jne    117b <check_for_options+0x4b>
movl   $0x1,-0x14(%rbp)
jmp    11a5 <check_for_options+0x75>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe70(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
jmp    1146 <check_for_options+0x16>
cmpl   $0x0,-0x14(%rbp)
jne    11e8 <check_for_options+0xb8>
cmpl   $0x1,-0x4(%rbp)
jle    11e8 <check_for_options+0xb8>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe2d(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_for_options>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%r12d
xor    %ecx,%ecx
mov    $0x1,%dl
lea    0xeb7(%rip),%r15
nopl   0x0(%rax)
mov    %ecx,%ebp
mov    %edx,%ebx
mov    %r12d,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <getopt@plt>
mov    $0x1,%ecx
xor    %edx,%edx
cmp    $0x76,%eax
je     1150 <check_for_options+0x20>
cmp    $0xffffffff,%eax
jne    118e <check_for_options+0x5e>
cmp    $0x2,%r12d
setl   %al
not    %bl
or     %al,%bl
test   $0x1,%bl
je     118e <check_for_options+0x5e>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe61(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"v\00"
@stderr = global i32 0
@.str.1 = [40 x i8] c"Usage: %s [-v] number of nodes in tree\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @check_for_options(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
br label %7
7: ; preds = %24, %2
%8 = load i32, i32* %3
%9 = load i8**, i8*** %4
%10 = call i32 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %6
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %25
12: ; preds = %7
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 118
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 1, i32* %5
br label %24
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %15
br label %7
25: ; preds = %7
%26 = load i32, i32* %5
%27 = icmp ne i32 %26, 0
br i1 %27, label %39, label %28
28: ; preds = %25
%29 = load i32, i32* %3
%30 = icmp sgt i32 %29, 1
br i1 %30, label %31, label %39
31: ; preds = %28
%32 = load i32, i32* @stderr
%33 = load i8**, i8*** %4
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = load i32, i32* @EXIT_FAILURE
%38 = call i32 @exit(i32 %37)
unreachable
39: ; preds = %28, %25
%40 = load i32, i32* %5
ret i32 %40
}

LLVM IR (-O2):
@.str = [2 x i8] c"v\00"
@stderr = global i32 0
@.str.1 = [40 x i8] c"Usage: %s [-v] number of nodes in tree\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @check_for_options(i32 %0, i8** %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i1 [ true, %2 ], [ false, %3 ]
%5 = phi i32 [ 0, %2 ], [ 1, %3 ]
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %7 [
i32 -1, label %13
i32 118, label %3
]
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %1
%10 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %3
%14 = icmp sgt i32 %0, 1
%15 = and i1 %14, %4
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %1
%19 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %13
ret i32 %5
}