#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char const *, char *);
int validation_crypto(char const *, char *, size_t);
int validation_filename(char const *, char *, size_t);
int validation_id(char const *, char *, size_t);
int validation_iv(char const *, char *, size_t);
int validation_key(char const *, char *, size_t);
int validation_key_length(char const *, char *, size_t);
int validation_max_speed(char const *, char *, size_t);
int validation_mode(char const *, char *, size_t);
int validation_url(char const *, char *, size_t);
int validation(const char *pname, const char *pparam, char *perr, size_t size) {
  int ret = 0;
  if (strcmp(pname, "id") == 0) {
    ret = validation_id(pparam, perr, size);
  } else if (strcmp(pname, "max_speed") == 0) {
    ret = validation_max_speed(pparam, perr, size);
  } else if (strcmp(pname, "url") == 0) {
    ret = validation_url(pparam, perr, size);
  } else if (strcmp(pname, "filename") == 0) {
    ret = validation_filename(pparam, perr, size);
  } else if (strcmp(pname, "crypto") == 0) {
    ret = validation_crypto(pparam, perr, size);
  } else if (strcmp(pname, "key_length") == 0) {
    ret = validation_key_length(pparam, perr, size);
  } else if (strcmp(pname, "mode") == 0) {
    ret = validation_mode(pparam, perr, size);
  } else if (strcmp(pname, "key") == 0) {
    ret = validation_key(pparam, perr, size);
  } else if (strcmp(pname, "iv") == 0) {
    ret = validation_iv(pparam, perr, size);
  } else {
    ret = 1;
    (void)fprintf(stderr, "%s is invalid parameter pname", pname);
  }
  return ret;
}


x86 assembly (clang, -O0):
<validation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1202 <validation+0x52>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <validation_id@plt>
mov    %eax,-0x24(%rbp)
jmp    13e2 <validation+0x232>
mov    -0x8(%rbp),%rdi
lea    0xdf6(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1235 <validation+0x85>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <validation_max_speed@plt>
mov    %eax,-0x24(%rbp)
jmp    13dd <validation+0x22d>
mov    -0x8(%rbp),%rdi
lea    0xdcd(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1268 <validation+0xb8>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1080 <validation_url@plt>
mov    %eax,-0x24(%rbp)
jmp    13d8 <validation+0x228>
mov    -0x8(%rbp),%rdi
lea    0xd9e(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    129b <validation+0xeb>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10c0 <validation_filename@plt>
mov    %eax,-0x24(%rbp)
jmp    13d3 <validation+0x223>
mov    -0x8(%rbp),%rdi
lea    0xd74(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12ce <validation+0x11e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10d0 <validation_crypto@plt>
mov    %eax,-0x24(%rbp)
jmp    13ce <validation+0x21e>
mov    -0x8(%rbp),%rdi
lea    0xd48(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1301 <validation+0x151>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1060 <validation_key_length@plt>
mov    %eax,-0x24(%rbp)
jmp    13c9 <validation+0x219>
mov    -0x8(%rbp),%rdi
lea    0xd20(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1334 <validation+0x184>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <validation_mode@plt>
mov    %eax,-0x24(%rbp)
jmp    13c4 <validation+0x214>
mov    -0x8(%rbp),%rdi
lea    0xcf2(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1367 <validation+0x1b7>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1070 <validation_key@plt>
mov    %eax,-0x24(%rbp)
jmp    13bf <validation+0x20f>
mov    -0x8(%rbp),%rdi
lea    0xcc3(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    139a <validation+0x1ea>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <validation_iv@plt>
mov    %eax,-0x24(%rbp)
jmp    13ba <validation+0x20a>
movl   $0x1,-0x24(%rbp)
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xc83(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    13bf <validation+0x20f>
jmp    13c4 <validation+0x214>
jmp    13c9 <validation+0x219>
jmp    13ce <validation+0x21e>
jmp    13d3 <validation+0x223>
jmp    13d8 <validation+0x228>
jmp    13dd <validation+0x22d>
jmp    13e2 <validation+0x232>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validation>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0xe35(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12c2 <validation+0x112>
lea    0xe23(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12db <validation+0x12b>
lea    0xe15(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12f4 <validation+0x144>
lea    0xe01(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     130d <validation+0x15d>
lea    0xdf2(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1326 <validation+0x176>
lea    0xde1(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     133f <validation+0x18f>
lea    0xdd4(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1358 <validation+0x1a8>
lea    0xdc1(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1371 <validation+0x1c1>
lea    0xdad(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     138a <validation+0x1da>
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
lea    0xd8f(%rip),%rsi
mov    %rbx,%rdx
call   10a0 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <validation_id@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    10b0 <validation_max_speed@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1080 <validation_url@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    10c0 <validation_filename@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    10d0 <validation_crypto@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1060 <validation_key_length@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <validation_mode@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1070 <validation_key@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <validation_iv@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"id\00"
@.str.1 = [10 x i8] c"max_speed\00"
@.str.2 = [4 x i8] c"url\00"
@.str.3 = [9 x i8] c"filename\00"
@.str.4 = [7 x i8] c"crypto\00"
@.str.5 = [11 x i8] c"key_length\00"
@.str.6 = [5 x i8] c"mode\00"
@.str.7 = [4 x i8] c"key\00"
@.str.8 = [3 x i8] c"iv\00"
@stderr = global i32 0
@.str.9 = [30 x i8] c"%s is invalid parameter pname\00"
define i32 @validation(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
store i32 0, i32* %9
%10 = load i8*, i8** %5
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %4
%14 = load i8*, i8** %6
%15 = load i8*, i8** %7
%16 = load i64, i64* %8
%17 = call i32 @validation_id(i8* %14, i8* %15, i64 %16)
store i32 %17, i32* %9
br label %102
18: ; preds = %4
%19 = load i8*, i8** %5
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = load i8*, i8** %6
%24 = load i8*, i8** %7
%25 = load i64, i64* %8
%26 = call i32 @validation_max_speed(i8* %23, i8* %24, i64 %25)
store i32 %26, i32* %9
br label %101
27: ; preds = %18
%28 = load i8*, i8** %5
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = load i8*, i8** %6
%33 = load i8*, i8** %7
%34 = load i64, i64* %8
%35 = call i32 @validation_url(i8* %32, i8* %33, i64 %34)
store i32 %35, i32* %9
br label %100
36: ; preds = %27
%37 = load i8*, i8** %5
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %36
%41 = load i8*, i8** %6
%42 = load i8*, i8** %7
%43 = load i64, i64* %8
%44 = call i32 @validation_filename(i8* %41, i8* %42, i64 %43)
store i32 %44, i32* %9
br label %99
45: ; preds = %36
%46 = load i8*, i8** %5
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %45
%50 = load i8*, i8** %6
%51 = load i8*, i8** %7
%52 = load i64, i64* %8
%53 = call i32 @validation_crypto(i8* %50, i8* %51, i64 %52)
store i32 %53, i32* %9
br label %98
54: ; preds = %45
%55 = load i8*, i8** %5
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %63
58: ; preds = %54
%59 = load i8*, i8** %6
%60 = load i8*, i8** %7
%61 = load i64, i64* %8
%62 = call i32 @validation_key_length(i8* %59, i8* %60, i64 %61)
store i32 %62, i32* %9
br label %97
63: ; preds = %54
%64 = load i8*, i8** %5
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %72
67: ; preds = %63
%68 = load i8*, i8** %6
%69 = load i8*, i8** %7
%70 = load i64, i64* %8
%71 = call i32 @validation_mode(i8* %68, i8* %69, i64 %70)
store i32 %71, i32* %9
br label %96
72: ; preds = %63
%73 = load i8*, i8** %5
%74 = call i64 @strcmp(i8* %73, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %81
76: ; preds = %72
%77 = load i8*, i8** %6
%78 = load i8*, i8** %7
%79 = load i64, i64* %8
%80 = call i32 @validation_key(i8* %77, i8* %78, i64 %79)
store i32 %80, i32* %9
br label %95
81: ; preds = %72
%82 = load i8*, i8** %5
%83 = call i64 @strcmp(i8* %82, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %90
85: ; preds = %81
%86 = load i8*, i8** %6
%87 = load i8*, i8** %7
%88 = load i64, i64* %8
%89 = call i32 @validation_iv(i8* %86, i8* %87, i64 %88)
store i32 %89, i32* %9
br label %94
90: ; preds = %81
store i32 1, i32* %9
%91 = load i32, i32* @stderr
%92 = load i8*, i8** %5
%93 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i8* %92)
br label %94
94: ; preds = %90, %85
br label %95
95: ; preds = %94, %76
br label %96
96: ; preds = %95, %67
br label %97
97: ; preds = %96, %58
br label %98
98: ; preds = %97, %49
br label %99
99: ; preds = %98, %40
br label %100
100: ; preds = %99, %31
br label %101
101: ; preds = %100, %22
br label %102
102: ; preds = %101, %13
%103 = load i32, i32* %9
ret i32 %103
}

LLVM IR (-O2):
@.str = [3 x i8] c"id\00"
@.str.1 = [10 x i8] c"max_speed\00"
@.str.2 = [4 x i8] c"url\00"
@.str.3 = [9 x i8] c"filename\00"
@.str.4 = [7 x i8] c"crypto\00"
@.str.5 = [11 x i8] c"key_length\00"
@.str.6 = [5 x i8] c"mode\00"
@.str.7 = [4 x i8] c"key\00"
@.str.8 = [3 x i8] c"iv\00"
@stderr = global i32 0
@.str.9 = [30 x i8] c"%s is invalid parameter pname\00"
define i32 @validation(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @validation_id(i8* %1, i8* %2, i64 %3)
br label %52
9: ; preds = %4
%10 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @validation_max_speed(i8* %1, i8* %2, i64 %3)
br label %52
14: ; preds = %9
%15 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @validation_url(i8* %1, i8* %2, i64 %3)
br label %52
19: ; preds = %14
%20 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = tail call i32 @validation_filename(i8* %1, i8* %2, i64 %3)
br label %52
24: ; preds = %19
%25 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = tail call i32 @validation_crypto(i8* %1, i8* %2, i64 %3)
br label %52
29: ; preds = %24
%30 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = tail call i32 @validation_key_length(i8* %1, i8* %2, i64 %3)
br label %52
34: ; preds = %29
%35 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = tail call i32 @validation_mode(i8* %1, i8* %2, i64 %3)
br label %52
39: ; preds = %34
%40 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = tail call i32 @validation_key(i8* %1, i8* %2, i64 %3)
br label %52
44: ; preds = %39
%45 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = tail call i32 @validation_iv(i8* %1, i8* %2, i64 %3)
br label %52
49: ; preds = %44
%50 = load i32, i32* @stderr
%51 = tail call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i8* %0)
br label %52
52: ; preds = %12, %22, %32, %42, %49, %47, %37, %27, %17, %7
%53 = phi i32 [ %8, %7 ], [ %13, %12 ], [ %18, %17 ], [ %23, %22 ], [ %28, %27 ], [ %33, %32 ], [ %38, %37 ], [ %43, %42 ], [ %48, %47 ], [ 1, %49 ]
ret i32 %53
}