#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;
scalar_t__ all_input_files_exist(int, char **);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usage(char const *);
int handle_args(int argc, char *argv[]) {
  int verbose = 0;
  const char *program_name = argv[0];
  if (argc < 3) {
    usage(program_name);
    exit(EXIT_FAILURE);
  }
  if (0 == strcmp("-v", argv[1])) {
    verbose = 1;
  } else if (0 == strcmp("-n", argv[1])) {
    verbose = -1;
  } else if (0 == strcmp("-V", argv[1])) {
    verbose = 2;
  } else {
    usage(program_name);
    exit(EXIT_FAILURE);
  }
  if (0 == all_input_files_exist(argc, argv)) {
    exit(EXIT_FAILURE);
  }
  return verbose;
}


x86 assembly (clang, -O0):
<handle_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    1182 <handle_args+0x42>
mov    -0x20(%rbp),%rdi
call   1050 <usage@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe6f(%rip),%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11b0 <handle_args+0x70>
movl   $0x1,-0x14(%rbp)
jmp    122d <handle_args+0xed>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe44(%rip),%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11de <handle_args+0x9e>
movl   $0xffffffff,-0x14(%rbp)
jmp    1228 <handle_args+0xe8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe19(%rip),%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    120c <handle_args+0xcc>
movl   $0x2,-0x14(%rbp)
jmp    1223 <handle_args+0xe3>
mov    -0x20(%rbp),%rdi
call   1050 <usage@plt>
mov    0x2dc4(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
jmp    1228 <handle_args+0xe8>
jmp    122d <handle_args+0xed>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <all_input_files_exist@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1255 <handle_args+0x115>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_args>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rsi),%r14
cmp    $0x2,%edi
jle    1199 <handle_args+0x59>
mov    %rsi,%rbx
mov    %edi,%r15d
mov    0x8(%rsi),%rsi
lea    0xea0(%rip),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a3 <handle_args+0x63>
mov    0x8(%rbx),%rsi
lea    0xe8e(%rip),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11aa <handle_args+0x6a>
mov    0x8(%rbx),%rsi
lea    0xe7c(%rip),%rdi
call   1030 <strcmp@plt>
mov    $0x2,%ebp
test   %rax,%rax
je     11af <handle_args+0x6f>
mov    %r14,%rdi
call   1050 <usage@plt>
jmp    11cc <handle_args+0x8c>
mov    $0x1,%ebp
jmp    11af <handle_args+0x6f>
mov    $0xffffffff,%ebp
mov    %r15d,%edi
mov    %rbx,%rsi
call   1040 <all_input_files_exist@plt>
test   %rax,%rax
je     11cc <handle_args+0x8c>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c"-v\00"
@.str.1 = [3 x i8] c"-n\00"
@.str.2 = [3 x i8] c"-V\00"
define i32 @handle_args(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
%7 = load i8**, i8*** %4
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
store i8* %9, i8** %6
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8*, i8** %6
%14 = call i32 @usage(i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = icmp eq i64 0, %21
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 1, i32* %5
br label %45
24: ; preds = %17
%25 = load i8**, i8*** %4
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = icmp eq i64 0, %28
br i1 %29, label %30, label %31
30: ; preds = %24
store i32 -1, i32* %5
br label %44
31: ; preds = %24
%32 = load i8**, i8*** %4
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%36 = icmp eq i64 0, %35
br i1 %36, label %37, label %38
37: ; preds = %31
store i32 2, i32* %5
br label %43
38: ; preds = %31
%39 = load i8*, i8** %6
%40 = call i32 @usage(i8* %39)
%41 = load i32, i32* @EXIT_FAILURE
%42 = call i32 @exit(i32 %41)
unreachable
43: ; preds = %37
br label %44
44: ; preds = %43, %30
br label %45
45: ; preds = %44, %23
%46 = load i32, i32* %3
%47 = load i8**, i8*** %4
%48 = call i64 @all_input_files_exist(i32 %46, i8** %47)
%49 = icmp eq i64 0, %48
br i1 %49, label %50, label %53
50: ; preds = %45
%51 = load i32, i32* @EXIT_FAILURE
%52 = call i32 @exit(i32 %51)
unreachable
53: ; preds = %45
%54 = load i32, i32* %5
ret i32 %54
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c"-v\00"
@.str.1 = [3 x i8] c"-n\00"
@.str.2 = [3 x i8] c"-V\00"
define i32 @handle_args(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = icmp slt i32 %0, 3
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 @usage(i8* %3)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %26, label %14
14: ; preds = %9
%15 = load i8*, i8** %10
%16 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %26, label %18
18: ; preds = %14
%19 = load i8*, i8** %10
%20 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = tail call i32 @usage(i8* %3)
%24 = load i32, i32* @EXIT_FAILURE
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %18, %14, %9
%27 = phi i32 [ 1, %9 ], [ -1, %14 ], [ 2, %18 ]
%28 = tail call i64 @all_input_files_exist(i32 %0, i8** %1)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load i32, i32* @EXIT_FAILURE
%32 = tail call i32 @exit(i32 %31)
unreachable
33: ; preds = %26
ret i32 %27
}