#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 */
scalar_t__ strcasecmp(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncat(char *, char *, int);
bool chk_op_f_to_s(char *op, char *errstr) {
  int is_ok = 1;
  if ((op == NULL) || (*op == '\0')) {
    is_ok = 0;
  }
  if (is_ok == 1) {
    if ((strcasecmp(op, "Print") != 0) && (strcasecmp(op, "Min") != 0) &&
        (strcasecmp(op, "Max") != 0) && (strcasecmp(op, "Avg") != 0) &&
        (strcasecmp(op, "Sum") != 0) && (strcasecmp(op, "NDV") != 0) &&
        (strcasecmp(op, "Print") != 0) && (strcasecmp(op, "ValAtIdx") != 0) &&
        (strcasecmp(op, "IdxAtVal") != 0) &&
        (strcasecmp(op, "ApproxNDV") != 0)) {
      is_ok = 0;
    }
  }
  if (is_ok == 0) {
    strcpy(errstr, "op can be any one of [Print,Min,Max,Sum,Avg,");
    strcpy(errstr, "NDV,Print,ValAtIdx,IdxAtVal,ApproxNDV]");
    strcat(errstr, "First 8 characters of user provided op = ");
    strncat(errstr, op, 8);
    return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<chk_op_f_to_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1172 <chk_op_f_to_s+0x32>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1179 <chk_op_f_to_s+0x39>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    1293 <chk_op_f_to_s+0x153>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     128e <chk_op_f_to_s+0x14e>
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     128e <chk_op_f_to_s+0x14e>
mov    -0x10(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     128e <chk_op_f_to_s+0x14e>
mov    -0x10(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     128e <chk_op_f_to_s+0x14e>
mov    -0x10(%rbp),%rdi
lea    0xe1c(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     128e <chk_op_f_to_s+0x14e>
mov    -0x10(%rbp),%rdi
lea    0xe1e(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     128e <chk_op_f_to_s+0x14e>
mov    -0x10(%rbp),%rdi
lea    0xdd6(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     128e <chk_op_f_to_s+0x14e>
mov    -0x10(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     128e <chk_op_f_to_s+0x14e>
mov    -0x10(%rbp),%rdi
lea    0xdc1(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     128e <chk_op_f_to_s+0x14e>
mov    -0x10(%rbp),%rdi
lea    0xdb0(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     128e <chk_op_f_to_s+0x14e>
movl   $0x0,-0x1c(%rbp)
jmp    1293 <chk_op_f_to_s+0x153>
cmpl   $0x0,-0x1c(%rbp)
jne    12eb <chk_op_f_to_s+0x1ab>
mov    -0x18(%rbp),%rdi
lea    0xd8a(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xda7(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xdbe(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1050 <strncat@plt>
movl   $0x0,-0x4(%rbp)
jmp    12f2 <chk_op_f_to_s+0x1b2>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chk_op_f_to_s>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
je     1229 <chk_op_f_to_s+0xe9>
cmpb   $0x0,(%rbx)
je     1229 <chk_op_f_to_s+0xe9>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1268 <chk_op_f_to_s+0x128>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1268 <chk_op_f_to_s+0x128>
lea    0xe72(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1268 <chk_op_f_to_s+0x128>
lea    0xe5e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1268 <chk_op_f_to_s+0x128>
lea    0xe4a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1268 <chk_op_f_to_s+0x128>
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1268 <chk_op_f_to_s+0x128>
lea    0xe22(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1268 <chk_op_f_to_s+0x128>
lea    0xe17(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1268 <chk_op_f_to_s+0x128>
lea    0xe0c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1268 <chk_op_f_to_s+0x128>
lea    0xe02(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcpy@plt>
lea    0xe20(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcpy@plt>
lea    0xe38(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1050 <strncat@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Print\00"
@.str.1 = [4 x i8] c"Min\00"
@.str.2 = [4 x i8] c"Max\00"
@.str.3 = [4 x i8] c"Avg\00"
@.str.4 = [4 x i8] c"Sum\00"
@.str.5 = [4 x i8] c"NDV\00"
@.str.6 = [9 x i8] c"ValAtIdx\00"
@.str.7 = [9 x i8] c"IdxAtVal\00"
@.str.8 = [10 x i8] c"ApproxNDV\00"
@.str.9 = [45 x i8] c"op can be any one of [Print,Min,Max,Sum,Avg,\00"
@.str.10 = [39 x i8] c"NDV,Print,ValAtIdx,IdxAtVal,ApproxNDV]\00"
@.str.11 = [42 x i8] c"First 8 characters of user provided op = \00"
define i32 @chk_op_f_to_s(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 1, i32* %6
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9, %2
store i32 0, i32* %6
br label %15
15: ; preds = %14, %9
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %60
18: ; preds = %15
%19 = load i8*, i8** %4
%20 = call i64 @strcasecmp(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %59
22: ; preds = %18
%23 = load i8*, i8** %4
%24 = call i64 @strcasecmp(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %59
26: ; preds = %22
%27 = load i8*, i8** %4
%28 = call i64 @strcasecmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %59
30: ; preds = %26
%31 = load i8*, i8** %4
%32 = call i64 @strcasecmp(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %59
34: ; preds = %30
%35 = load i8*, i8** %4
%36 = call i64 @strcasecmp(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %59
38: ; preds = %34
%39 = load i8*, i8** %4
%40 = call i64 @strcasecmp(i8* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %59
42: ; preds = %38
%43 = load i8*, i8** %4
%44 = call i64 @strcasecmp(i8* %43, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %59
46: ; preds = %42
%47 = load i8*, i8** %4
%48 = call i64 @strcasecmp(i8* %47, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %59
50: ; preds = %46
%51 = load i8*, i8** %4
%52 = call i64 @strcasecmp(i8* %51, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %59
54: ; preds = %50
%55 = load i8*, i8** %4
%56 = call i64 @strcasecmp(i8* %55, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %54
store i32 0, i32* %6
br label %59
59: ; preds = %58, %54, %50, %46, %42, %38, %34, %30, %26, %22, %18
br label %60
60: ; preds = %59, %15
%61 = load i32, i32* %6
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %73
63: ; preds = %60
%64 = load i8*, i8** %5
%65 = call i32 @strcpy(i8* %64, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0))
%66 = load i8*, i8** %5
%67 = call i32 @strcpy(i8* %66, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0))
%68 = load i8*, i8** %5
%69 = call i32 @strcat(i8* %68, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0))
%70 = load i8*, i8** %5
%71 = load i8*, i8** %4
%72 = call i32 @strncat(i8* %70, i8* %71, i32 8)
store i32 0, i32* %3
br label %74
73: ; preds = %60
store i32 1, i32* %3
br label %74
74: ; preds = %73, %63
%75 = load i32, i32* %3
ret i32 %75
}

LLVM IR (-O2):
@.str = [6 x i8] c"Print\00"
@.str.1 = [4 x i8] c"Min\00"
@.str.2 = [4 x i8] c"Max\00"
@.str.3 = [4 x i8] c"Avg\00"
@.str.4 = [4 x i8] c"Sum\00"
@.str.5 = [4 x i8] c"NDV\00"
@.str.6 = [9 x i8] c"ValAtIdx\00"
@.str.7 = [9 x i8] c"IdxAtVal\00"
@.str.8 = [10 x i8] c"ApproxNDV\00"
@.str.9 = [45 x i8] c"op can be any one of [Print,Min,Max,Sum,Avg,\00"
@.str.10 = [39 x i8] c"NDV,Print,ValAtIdx,IdxAtVal,ApproxNDV]\00"
@.str.11 = [42 x i8] c"First 8 characters of user provided op = \00"
define i32 @chk_op_f_to_s(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %34, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %34, label %7
7: ; preds = %4
%8 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %39, label %10
10: ; preds = %7
%11 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %39, label %13
13: ; preds = %10
%14 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %39, label %16
16: ; preds = %13
%17 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %39, label %19
19: ; preds = %16
%20 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %39, label %22
22: ; preds = %19
%23 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %39, label %25
25: ; preds = %22
%26 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %39, label %28
28: ; preds = %25
%29 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %39, label %31
31: ; preds = %28
%32 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %4, %2, %31
%35 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0))
%36 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0))
%37 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0))
%38 = tail call i32 @strncat(i8* %1, i8* %0, i32 8)
br label %39
39: ; preds = %31, %7, %10, %13, %16, %19, %22, %25, %28, %34
%40 = phi i32 [ 0, %34 ], [ 1, %28 ], [ 1, %25 ], [ 1, %22 ], [ 1, %19 ], [ 1, %16 ], [ 1, %13 ], [ 1, %10 ], [ 1, %7 ], [ 1, %31 ]
ret i32 %40
}