#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*/ printf(char *, int);
int /*<<< orphan*/ sys_dump(int);
int /*<<< orphan*/ sys_halt(int);
void check(int arg, int type, int param) {
  switch (type) {
  case 0:
    if (!(arg >= 0 && arg < 16)) {
      printf("Error: expected SRC for param %i.\n", param);
      sys_dump(0x0);
      sys_halt(0x0);
    }
  case 1:
    if (!(arg >= 2 && arg < 16)) {
      printf("Error: expected DES for param %i.\n", param);
      sys_dump(0x0);
      sys_halt(0x0);
    }
  case 2:
    if (!(arg >= 0 && arg < 16)) {
      printf("Error: expected REG for param %i.\n", param);
      sys_dump(0x0);
      sys_halt(0x0);
    }
  case 3:
    break;
  case 4:
    if (!(arg >= 0 && arg <= 15)) {
      printf("Error: expected CONST4 for param %i.\n", param);
      sys_dump(0x0);
      sys_halt(0x0);
    }
  }
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x4,%rax
ja     1243 <check+0x113>
mov    -0x18(%rbp),%rax
lea    0xea3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x0,-0x4(%rbp)
jl     117a <check+0x4a>
cmpl   $0x10,-0x4(%rbp)
jl     1197 <check+0x67>
mov    -0xc(%rbp),%esi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <sys_dump@plt>
xor    %edi,%edi
call   1040 <sys_halt@plt>
jmp    119c <check+0x6c>
cmpl   $0x2,-0x4(%rbp)
jl     11b0 <check+0x80>
cmpl   $0x10,-0x4(%rbp)
jl     11cd <check+0x9d>
mov    -0xc(%rbp),%esi
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <sys_dump@plt>
xor    %edi,%edi
call   1040 <sys_halt@plt>
jmp    11d2 <check+0xa2>
cmpl   $0x0,-0x4(%rbp)
jl     11e6 <check+0xb6>
cmpl   $0x10,-0x4(%rbp)
jl     1203 <check+0xd3>
mov    -0xc(%rbp),%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <sys_dump@plt>
xor    %edi,%edi
call   1040 <sys_halt@plt>
jmp    1208 <check+0xd8>
jmp    1243 <check+0x113>
cmpl   $0x0,-0x4(%rbp)
jl     1221 <check+0xf1>
cmpl   $0xf,-0x4(%rbp)
jle    123e <check+0x10e>
mov    -0xc(%rbp),%esi
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <sys_dump@plt>
xor    %edi,%edi
call   1040 <sys_halt@plt>
jmp    1243 <check+0x113>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x4,%esi
ja     11a8 <check+0x78>
mov    %edx,%ebp
mov    %edi,%ebx
mov    %esi,%eax
lea    0xebb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmp    $0x10,%ebx
jae    116b <check+0x3b>
lea    -0x2(%rbx),%eax
cmp    $0xe,%eax
jae    1187 <check+0x57>
jmp    11a8 <check+0x78>
cmp    $0x10,%ebx
jb     11a8 <check+0x78>
lea    0xf14(%rip),%rdi
jmp    11b6 <check+0x86>
lea    0xea2(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <sys_dump@plt>
xor    %edi,%edi
call   1040 <sys_halt@plt>
lea    0xea9(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <sys_dump@plt>
xor    %edi,%edi
call   1040 <sys_halt@plt>
cmp    $0x10,%ebx
jae    11af <check+0x7f>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xea4(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <sys_dump@plt>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <sys_halt@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"Error: expected SRC for param %i.\0A\00"
@.str.1 = [35 x i8] c"Error: expected DES for param %i.\0A\00"
@.str.2 = [35 x i8] c"Error: expected REG for param %i.\0A\00"
@.str.3 = [38 x i8] c"Error: expected CONST4 for param %i.\0A\00"
define void @check(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
switch i32 %7, label %57 [
i32 0, label %8
i32 1, label %20
i32 2, label %32
i32 3, label %44
i32 4, label %45
]
8: ; preds = %3
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 16
br i1 %13, label %19, label %14
14: ; preds = %11, %8
%15 = load i32, i32* %6
%16 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 @sys_dump(i32 0)
%18 = call i32 @sys_halt(i32 0)
br label %19
19: ; preds = %14, %11
br label %20
20: ; preds = %3, %19
%21 = load i32, i32* %4
%22 = icmp sge i32 %21, 2
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 16
br i1 %25, label %31, label %26
26: ; preds = %23, %20
%27 = load i32, i32* %6
%28 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = call i32 @sys_dump(i32 0)
%30 = call i32 @sys_halt(i32 0)
br label %31
31: ; preds = %26, %23
br label %32
32: ; preds = %3, %31
%33 = load i32, i32* %4
%34 = icmp sge i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %4
%37 = icmp slt i32 %36, 16
br i1 %37, label %43, label %38
38: ; preds = %35, %32
%39 = load i32, i32* %6
%40 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = call i32 @sys_dump(i32 0)
%42 = call i32 @sys_halt(i32 0)
br label %43
43: ; preds = %38, %35
br label %44
44: ; preds = %3, %43
br label %57
45: ; preds = %3
%46 = load i32, i32* %4
%47 = icmp sge i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i32, i32* %4
%50 = icmp sle i32 %49, 15
br i1 %50, label %56, label %51
51: ; preds = %48, %45
%52 = load i32, i32* %6
%53 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = call i32 @sys_dump(i32 0)
%55 = call i32 @sys_halt(i32 0)
br label %56
56: ; preds = %51, %48
br label %57
57: ; preds = %56, %3, %44
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"Error: expected SRC for param %i.\0A\00"
@.str.1 = [35 x i8] c"Error: expected DES for param %i.\0A\00"
@.str.2 = [35 x i8] c"Error: expected REG for param %i.\0A\00"
@.str.3 = [38 x i8] c"Error: expected CONST4 for param %i.\0A\00"
define void @check(i32 %0, i32 %1, i32 %2) {
switch i32 %1, label %26 [
i32 0, label %4
i32 1, label %10
i32 2, label %17
i32 4, label %19
]
4: ; preds = %3
%5 = icmp ult i32 %0, 16
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %2)
%8 = tail call i32 @sys_dump(i32 0)
%9 = tail call i32 @sys_halt(i32 0)
br label %13
10: ; preds = %4, %3
%11 = add i32 %0, -2
%12 = icmp ult i32 %11, 14
br i1 %12, label %26, label %13
13: ; preds = %6, %10
%14 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%15 = tail call i32 @sys_dump(i32 0)
%16 = tail call i32 @sys_halt(i32 0)
br label %17
17: ; preds = %13, %3
%18 = icmp ult i32 %0, 16
br i1 %18, label %26, label %21
19: ; preds = %3
%20 = icmp ult i32 %0, 16
br i1 %20, label %26, label %21
21: ; preds = %19, %17
%22 = phi i8* [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), %17 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), %19 ]
%23 = tail call i32 @printf(i8* %22, i32 %2)
%24 = tail call i32 @sys_dump(i32 0)
%25 = tail call i32 @sys_halt(i32 0)
br label %26
26: ; preds = %21, %10, %19, %17, %3
ret void
}