#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*/ exitc(int, char *);
int /*<<< orphan*/ printcmds();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
void check_arg_cnt(int argc, char *argv[]) {
  if (argc < 5 && (!strcmp(argv[2], "create") || !strcmp(argv[2], "add") ||
                   !strcmp(argv[2], "get"))) {
    printf("%s needs more arguments.\n", argv[2]);
    printcmds();
    exitc(66, "");
  }
  if (argc < 4 && !strcmp(argv[2], "delete")) {
    printf("%s needs more arguments.\n", argv[2]);
    printcmds();
    exitc(66, "");
  }
}


x86 assembly (clang, -O0):
<check_arg_cnt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    11dc <check_arg_cnt+0x9c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe98(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     11b0 <check_arg_cnt+0x70>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe82(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     11b0 <check_arg_cnt+0x70>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe69(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11dc <check_arg_cnt+0x9c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <printcmds@plt>
mov    $0x42,%edi
lea    0xe51(%rip),%rsi
call   1060 <exitc@plt>
cmpl   $0x4,-0x4(%rbp)
jge    122f <check_arg_cnt+0xef>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe34(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    122f <check_arg_cnt+0xef>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xdfd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <printcmds@plt>
mov    $0x42,%edi
lea    0xdfe(%rip),%rsi
call   1060 <exitc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_arg_cnt>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x4,%edi
jg     11d9 <check_arg_cnt+0x99>
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x10(%rsi),%rbx
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1196 <check_arg_cnt+0x56>
lea    0xe97(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1196 <check_arg_cnt+0x56>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1196 <check_arg_cnt+0x56>
cmp    $0x3,%ebp
jle    11c2 <check_arg_cnt+0x82>
jmp    11d9 <check_arg_cnt+0x99>
lea    0xe72(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <printcmds@plt>
lea    0xe75(%rip),%rsi
mov    $0x42,%edi
call   1060 <exitc@plt>
cmp    $0x3,%ebp
jg     11d9 <check_arg_cnt+0x99>
mov    0x10(%r14),%rbx
lea    0xe5c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11de <check_arg_cnt+0x9e>
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe2a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <printcmds@plt>
lea    0xe2d(%rip),%rsi
mov    $0x42,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <exitc@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"create\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [4 x i8] c"get\00"
@.str.3 = [26 x i8] c"%s needs more arguments.\0A\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [7 x i8] c"delete\00"
define void @check_arg_cnt(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 slt i32 %5, 5
br i1 %6, label %7, label %32
7: ; preds = %2
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 2
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %25
13: ; preds = %7
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @strcmp(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %13
%20 = load i8**, i8*** %4
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @strcmp(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %32, label %25
25: ; preds = %19, %13, %7
%26 = load i8**, i8*** %4
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %28)
%30 = call i32 (...) @printcmds()
%31 = call i32 @exitc(i32 66, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %25, %19, %2
%33 = load i32, i32* %3
%34 = icmp slt i32 %33, 4
br i1 %34, label %35, label %48
35: ; preds = %32
%36 = load i8**, i8*** %4
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %48, label %41
41: ; preds = %35
%42 = load i8**, i8*** %4
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
%45 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %44)
%46 = call i32 (...) @printcmds()
%47 = call i32 @exitc(i32 66, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %48
48: ; preds = %41, %35, %32
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"create\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [4 x i8] c"get\00"
@.str.3 = [26 x i8] c"%s needs more arguments.\0A\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [7 x i8] c"delete\00"
define void @check_arg_cnt(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 5
br i1 %3, label %4, label %29
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12, %9, %4
%16 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%17 = tail call i32 (...) @printcmds()
%18 = tail call i32 @exitc(i32 66, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %15, %12
%20 = icmp slt i32 %0, 4
br i1 %20, label %21, label %29
21: ; preds = %19
%22 = load i8*, i8** %5
%23 = tail call i32 @strcmp(i8* dereferenceable(1) %22, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%27 = tail call i32 (...) @printcmds()
%28 = tail call i32 @exitc(i32 66, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %29
29: ; preds = %2, %25, %21, %19
ret void
}