#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*/ _usage(int /*<<< orphan*/);
int /*<<< orphan*/ _usage_error();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
void _check_args(int argc, char **argv) {
  if (2 == argc && 0 == strcmp(argv[1], "--help")) {
    _usage(stdout);
    exit(0);
  }
  if (argc < 4) {
    _usage_error();
  }
  if (0 != strcmp(argv[2], "--")) {
    _usage_error();
  }
}


x86 assembly (clang, -O0):
<_check_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2,%eax
cmp    -0x4(%rbp),%eax
jne    1194 <_check_args+0x54>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe94(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1194 <_check_args+0x54>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
call   1030 <_usage@plt>
xor    %edi,%edi
call   1060 <exit@plt>
cmpl   $0x4,-0x4(%rbp)
jge    11a5 <_check_args+0x65>
mov    $0x0,%al
call   1050 <_usage_error@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe53(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11ce <_check_args+0x8e>
mov    $0x0,%al
call   1050 <_usage_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_args>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1173 <_check_args+0x33>
mov    0x8(%rbx),%rdi
lea    0xeac(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1178 <_check_args+0x38>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1030 <_usage@plt>
xor    %edi,%edi
call   1060 <exit@plt>
cmp    $0x3,%edi
jg     117f <_check_args+0x3f>
xor    %eax,%eax
call   1050 <_usage_error@plt>
mov    0x10(%rbx),%rdi
lea    0xe7d(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     119c <_check_args+0x5c>
xor    %eax,%eax
pop    %rbx
jmp    1050 <_usage_error@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"--\00"
define void @_check_args(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 2, %5
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 0, %11
br i1 %12, label %13, label %17
13: ; preds = %7
%14 = load i32, i32* @stdout
%15 = call i32 @_usage(i32 %14)
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %7, %2
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 4
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (...) @_usage_error()
br label %22
22: ; preds = %20, %17
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp ne i64 0, %26
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 (...) @_usage_error()
br label %30
30: ; preds = %28, %22
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"--\00"
define void @_check_args(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = load i32, i32* @stdout
%11 = tail call i32 @_usage(i32 %10)
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %2
%14 = icmp slt i32 %0, 4
br i1 %14, label %15, label %17
15: ; preds = %4, %13
%16 = tail call i32 (...) @_usage_error()
br label %17
17: ; preds = %15, %13
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = tail call i32 (...) @_usage_error()
br label %24
24: ; preds = %22, %17
ret void
}