#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 ck_m(char *);
scalar_t__ ck_mic(int, char **, int);
scalar_t__ ck_micfs(int, char **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ usage();
int para_chk(int argc, char *argv[], int atrn) {
  if (argc < 5 || argc > 7) {
    printf("Parameter error!\n");
    usage();
    return 0;
  }
  if (ck_m(argv[1]) == 0) {
    if (ck_mic(argc, argv, atrn)) {
      return 1;
    }
  }
  if (ck_m(argv[1]) == 1) {
    if (ck_micfs(argc, argv)) {
      return 2;
    }
  }
  if (ck_m(argv[1]) == 2) {
    usage();
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<para_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x5,-0x8(%rbp)
jl     1176 <para_chk+0x26>
cmpl   $0x7,-0x8(%rbp)
jle    1195 <para_chk+0x45>
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1242 <para_chk+0xf2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <ck_m@plt>
cmp    $0x0,%eax
jne    11d5 <para_chk+0x85>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <ck_mic@plt>
cmp    $0x0,%rax
je     11d0 <para_chk+0x80>
movl   $0x1,-0x4(%rbp)
jmp    1242 <para_chk+0xf2>
jmp    11d5 <para_chk+0x85>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <ck_m@plt>
cmp    $0x1,%eax
jne    1212 <para_chk+0xc2>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <ck_micfs@plt>
cmp    $0x0,%rax
je     120d <para_chk+0xbd>
movl   $0x2,-0x4(%rbp)
jmp    1242 <para_chk+0xf2>
jmp    1212 <para_chk+0xc2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <ck_m@plt>
cmp    $0x2,%eax
jne    123b <para_chk+0xeb>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1242 <para_chk+0xf2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<para_chk>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    -0x8(%rbx),%eax
cmp    $0xfffffffc,%eax
ja     117a <para_chk+0x2a>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <usage@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %edx,%ebp
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   1070 <ck_m@plt>
test   %eax,%eax
jne    11a2 <para_chk+0x52>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %ebp,%edx
call   1050 <ck_mic@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1173 <para_chk+0x23>
mov    0x8(%r14),%rdi
call   1070 <ck_m@plt>
cmp    $0x1,%eax
jne    11c4 <para_chk+0x74>
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <ck_micfs@plt>
mov    $0x2,%ebp
test   %rax,%rax
jne    1173 <para_chk+0x23>
mov    0x8(%r14),%rdi
call   1070 <ck_m@plt>
xor    %ebp,%ebp
cmp    $0x2,%eax
je     116a <para_chk+0x1a>
jmp    1173 <para_chk+0x23>

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

LLVM IR (-O2):
@str = [17 x i8] c"Parameter error!\00"
define i32 @para_chk(i32 %0, i8** %1, i32 %2) {
%4 = add i32 %0, -8
%5 = icmp ult i32 %4, -3
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %27
8: ; preds = %3
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @ck_m(i8* %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = tail call i64 @ck_mic(i32 %0, i8** %1, i32 %2)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %29
16: ; preds = %13, %8
%17 = load i8*, i8** %9
%18 = tail call i32 @ck_m(i8* %17)
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = tail call i64 @ck_micfs(i32 %0, i8** %1)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %20, %16
%24 = load i8*, i8** %9
%25 = tail call i32 @ck_m(i8* %24)
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %29
27: ; preds = %23, %6
%28 = tail call i32 (...) @usage()
br label %29
29: ; preds = %27, %23, %20, %13
%30 = phi i32 [ 1, %13 ], [ 2, %20 ], [ 0, %23 ], [ 0, %27 ]
ret i32 %30
}