#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(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void check_arg_and_exit(int argc, char **argv, int cur_idx, int req_num) {
  if ((cur_idx + req_num) >= argc) {
    fprintf(stderr, "[vpmu-control]  \033[1;31mFatal\033[0;00m: "
                    "# of argument is not enough!"
                    "\n");
    fprintf(stderr,
            "[vpmu-control]  \033[1;31mFatal\033[0;00m: "
            "This is happened due to %dth argument, '%s'."
            "\n",
            cur_idx, argv[cur_idx]);
    exit(4);
  }
}


x86 assembly (clang, -O0):
<check_arg_and_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     118b <check_arg_and_exit+0x6b>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xec9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x4,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_arg_and_exit>:
add    %edx,%ecx
cmp    %edi,%ecx
jge    1127 <check_arg_and_exit+0x7>
ret
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    0x2ea9(%rip),%r14
mov    (%r14),%edi
lea    0xebf(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
movslq %ebp,%rdx
mov    (%rbx,%rdx,8),%rcx
lea    0xeea(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x4,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [67 x i8] c"[vpmu-control] \1B[1;31mFatal\1B[0;00m: # of argument is not enough!\0A\00"
@.str.1 = [83 x i8] c"[vpmu-control] \1B[1;31mFatal\1B[0;00m: This is happened due to %dth argument, '%s'.\0A\00"
define void @check_arg_and_exit(i32 %0, i8** %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = load i32, i32* %8
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %5
%13 = icmp sge i32 %11, %12
br i1 %13, label %14, label %26
14: ; preds = %4
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = load i32, i32* %7
%19 = load i8**, i8*** %6
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.1, i64 0, i64 0), i32 %18, i8* %23)
%25 = call i32 @exit(i32 4)
unreachable
26: ; preds = %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [67 x i8] c"[vpmu-control] \1B[1;31mFatal\1B[0;00m: # of argument is not enough!\0A\00"
@.str.1 = [83 x i8] c"[vpmu-control] \1B[1;31mFatal\1B[0;00m: This is happened due to %dth argument, '%s'.\0A\00"
define void @check_arg_and_exit(i32 %0, i8** nocapture %1, i32 %2, i32 %3) {
%5 = add nsw i32 %3, %2
%6 = icmp slt i32 %5, %0
br i1 %6, label %16, label %7
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = sext i32 %2 to i64
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.1, i64 0, i64 0), i32 %2, i8* %13)
%15 = tail call i32 @exit(i32 4)
unreachable
16: ; preds = %4
ret void
}