#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*/ error(char *);
int /*<<< orphan*/ strcmp(char *const, char *);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ version();
int check_arguments(int argc, char *const *argv) {
  if (argc < 2)
    error("missing command");
  if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
    usage();
    return 1;
  }
  if (!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version")) {
    version();
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_arguments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1165 <check_arguments+0x25>
lea    0xea0(%rip),%rdi
call   1060 <error@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9c(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     119f <check_arguments+0x5f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11b2 <check_arguments+0x72>
mov    $0x0,%al
call   1050 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    1206 <check_arguments+0xc6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe59(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     11ec <check_arguments+0xac>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11ff <check_arguments+0xbf>
mov    $0x0,%al
call   1040 <version@plt>
movl   $0x1,-0x4(%rbp)
jmp    1206 <check_arguments+0xc6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_arguments>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     1155 <check_arguments+0x15>
lea    0xeb0(%rip),%rdi
call   1060 <error@plt>
mov    0x8(%rbx),%rbx
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ab <check_arguments+0x6b>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ab <check_arguments+0x6b>
lea    0xe94(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11b4 <check_arguments+0x74>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     11b4 <check_arguments+0x74>
pop    %rbx
ret
xor    %eax,%eax
call   1050 <usage@plt>
jmp    11bb <check_arguments+0x7b>
xor    %eax,%eax
call   1040 <version@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"missing command\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c"--help\00"
@.str.3 = [3 x i8] c"-v\00"
@.str.4 = [10 x i8] c"--version\00"
define i32 @check_arguments(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %10
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %16, %10
%23 = call i32 (...) @usage()
store i32 1, i32* %3
br label %39
24: ; preds = %16
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %24
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @strcmp(i8* %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %30, %24
%37 = call i32 (...) @version()
store i32 1, i32* %3
br label %39
38: ; preds = %30
store i32 0, i32* %3
br label %39
39: ; preds = %38, %36, %22
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str = [16 x i8] c"missing command\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c"--help\00"
@.str.3 = [3 x i8] c"-v\00"
@.str.4 = [10 x i8] c"--version\00"
define i32 @check_arguments(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11, %6
%15 = tail call i32 (...) @usage()
br label %24
16: ; preds = %11
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19, %16
%23 = tail call i32 (...) @version()
br label %24
24: ; preds = %19, %22, %14
%25 = phi i32 [ 1, %22 ], [ 1, %14 ], [ 0, %19 ]
ret i32 %25
}