#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 *, int, char *);
int /*<<< orphan*/ sprintf(char *, char *, char, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
bool chk_tbl_name(char *tbl, char *errstr) {
  int i = 0;
  if ((tbl == NULL) || (*tbl == '\0')) {
    strcpy(errstr, "Null Table name");
    {
      fprintf(stderr, "Line %3d of File %s \n", 973,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/"
              "DEPRECATED_Q2/AUX/auxil.c");
    };
    return false;
  }
  if (*tbl == '_') {
    strcpy(errstr, "Table name cannot start with underscore");
    {
      fprintf(stderr, "Line %3d of File %s \n", 977,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/"
              "DEPRECATED_Q2/AUX/auxil.c");
    };
    return false;
  }
  for (char *cptr = tbl; *cptr != '\0'; cptr++, i++) {
    if (i > 31) {
      sprintf(errstr, "Table name too long. Exceeds %d characters", 31);
      {
        fprintf(stderr, "Line %3d of File %s \n", 982,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/AUX/auxil.c");
      };
      return false;
    }
    char letter = *cptr;
    if (((letter >= '0') && (letter <= '9')) ||
        ((letter >= 'a') && (letter <= 'z')) || (letter == '_') ||
        ((letter >= 'A') && (letter <= 'Z'))) {
    } else {
      sprintf(errstr, "Non alphanumeric character [%c] at position %d", letter,
              i);
      {
        fprintf(stderr, "Line %3d of File %s \n", 994,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/AUX/auxil.c");
      };
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<chk_tbl_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1162 <chk_tbl_name+0x32>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    119f <chk_tbl_name+0x6f>
mov    -0x18(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
mov    $0x3cd,%edx
lea    0xe98(%rip),%rcx
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1329 <chk_tbl_name+0x1f9>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
jne    11ec <chk_tbl_name+0xbc>
mov    -0x18(%rbp),%rdi
lea    0xf02(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
mov    $0x3d1,%edx
lea    0xe4b(%rip),%rcx
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1329 <chk_tbl_name+0x1f9>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1322 <chk_tbl_name+0x1f2>
cmpl   $0x1f,-0x1c(%rbp)
jle    1252 <chk_tbl_name+0x122>
mov    -0x18(%rbp),%rdi
lea    0xecb(%rip),%rsi
mov    $0x1f,%edx
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
lea    0xddb(%rip),%rsi
mov    $0x3d6,%edx
lea    0xde5(%rip),%rcx
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1329 <chk_tbl_name+0x1f9>
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%eax
cmp    $0x30,%eax
jl     1275 <chk_tbl_name+0x145>
movsbl -0x29(%rbp),%eax
cmp    $0x39,%eax
jle    12b6 <chk_tbl_name+0x186>
movsbl -0x29(%rbp),%eax
cmp    $0x61,%eax
jl     128f <chk_tbl_name+0x15f>
movsbl -0x29(%rbp),%eax
cmp    $0x7a,%eax
jle    12b6 <chk_tbl_name+0x186>
movsbl -0x29(%rbp),%eax
cmp    $0x5f,%eax
je     12b6 <chk_tbl_name+0x186>
movsbl -0x29(%rbp),%eax
cmp    $0x41,%eax
jl     12bb <chk_tbl_name+0x18b>
movsbl -0x29(%rbp),%eax
cmp    $0x5a,%eax
jg     12bb <chk_tbl_name+0x18b>
jmp    1303 <chk_tbl_name+0x1d3>
mov    -0x18(%rbp),%rdi
mov    -0x29(%rbp),%al
mov    -0x1c(%rbp),%ecx
lea    0xe43(%rip),%rsi
movsbl %al,%edx
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    0x2d03(%rip),%rax
mov    (%rax),%edi
lea    0xd2a(%rip),%rsi
mov    $0x3e2,%edx
lea    0xd34(%rip),%rcx
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1329 <chk_tbl_name+0x1f9>
jmp    1308 <chk_tbl_name+0x1d8>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f4 <chk_tbl_name+0xc4>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chk_tbl_name>:
push   %rax
test   %rdi,%rdi
je     115d <chk_tbl_name+0x2d>
mov    (%rdi),%r8b
test   %r8b,%r8b
je     115d <chk_tbl_name+0x2d>
cmp    $0x5f,%r8b
jne    1194 <chk_tbl_name+0x64>
lea    0xf71(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    $0x3d1,%edx
jmp    1174 <chk_tbl_name+0x44>
lea    0xe9c(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    $0x3cd,%edx
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
lea    0xe9b(%rip),%rcx
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret
xor    %ecx,%ecx
jmp    11af <chk_tbl_name+0x7f>
nopl   0x0(%rax,%rax,1)
movzbl 0x2(%rdi,%rcx,1),%r8d
add    $0x2,%rcx
test   %r8b,%r8b
je     1192 <chk_tbl_name+0x62>
cmp    $0x20,%ecx
je     121f <chk_tbl_name+0xef>
lea    -0x30(%r8),%eax
cmp    $0xa,%al
jb     11cd <chk_tbl_name+0x9d>
cmp    $0x5f,%r8b
je     11cd <chk_tbl_name+0x9d>
mov    %r8d,%eax
and    $0xdf,%al
add    $0xbf,%al
cmp    $0x1a,%al
jae    11fd <chk_tbl_name+0xcd>
movzbl 0x1(%rdi,%rcx,1),%r8d
mov    $0x1,%eax
test   %r8b,%r8b
je     1192 <chk_tbl_name+0x62>
lea    -0x30(%r8),%edx
cmp    $0xa,%dl
jb     11a0 <chk_tbl_name+0x70>
cmp    $0x5f,%r8b
je     11a0 <chk_tbl_name+0x70>
mov    %r8d,%edx
and    $0xdf,%dl
add    $0xbf,%dl
cmp    $0x19,%dl
jbe    11a0 <chk_tbl_name+0x70>
add    $0x1,%ecx
movsbl %r8b,%edx
lea    0xf07(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    $0x3e2,%edx
jmp    1174 <chk_tbl_name+0x44>
lea    0xebe(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x1f,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    $0x3d6,%edx
jmp    1174 <chk_tbl_name+0x44>

LLVM IR (-O0):
@.str = [16 x i8] c"Null Table name\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.2 = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/DEPRECATED_Q2/AUX/auxil.c\00"
@.str.3 = [40 x i8] c"Table name cannot start with underscore\00"
@.str.4 = [43 x i8] c"Table name too long. Exceeds %d characters\00"
@.str.5 = [47 x i8] c"Non alphanumeric character [%c] at position %d\00"
define i32 @chk_tbl_name(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
%9 = load i8*, i8** %4
%10 = icmp eq i8* %9, null
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %11, %2
%17 = load i8*, i8** %5
%18 = call i32 @strcpy(i8* %17, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 973, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %91
21: ; preds = %11
%22 = load i8*, i8** %4
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 95
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i8*, i8** %5
%28 = call i32 @strcpy(i8* %27, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 977, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %91
31: ; preds = %21
%32 = load i8*, i8** %4
store i8* %32, i8** %7
br label %33
33: ; preds = %85, %31
%34 = load i8*, i8** %7
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %90
38: ; preds = %33
%39 = load i32, i32* %6
%40 = icmp sgt i32 %39, 31
br i1 %40, label %41, label %46
41: ; preds = %38
%42 = load i8*, i8** %5
%43 = call i32 (i8*, i8*, i8, ...) @sprintf(i8* %42, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8 signext 31)
%44 = load i32, i32* @stderr
%45 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 982, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %91
46: ; preds = %38
%47 = load i8*, i8** %7
%48 = load i8, i8* %47
store i8 %48, i8* %8
%49 = load i8, i8* %8
%50 = sext i8 %49 to i32
%51 = icmp sge i32 %50, 48
br i1 %51, label %52, label %56
52: ; preds = %46
%53 = load i8, i8* %8
%54 = sext i8 %53 to i32
%55 = icmp sle i32 %54, 57
br i1 %55, label %76, label %56
56: ; preds = %52, %46
%57 = load i8, i8* %8
%58 = sext i8 %57 to i32
%59 = icmp sge i32 %58, 97
br i1 %59, label %60, label %64
60: ; preds = %56
%61 = load i8, i8* %8
%62 = sext i8 %61 to i32
%63 = icmp sle i32 %62, 122
br i1 %63, label %76, label %64
64: ; preds = %60, %56
%65 = load i8, i8* %8
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 95
br i1 %67, label %76, label %68
68: ; preds = %64
%69 = load i8, i8* %8
%70 = sext i8 %69 to i32
%71 = icmp sge i32 %70, 65
br i1 %71, label %72, label %77
72: ; preds = %68
%73 = load i8, i8* %8
%74 = sext i8 %73 to i32
%75 = icmp sle i32 %74, 90
br i1 %75, label %76, label %77
76: ; preds = %72, %64, %60, %52
br label %84
77: ; preds = %72, %68
%78 = load i8*, i8** %5
%79 = load i8, i8* %8
%80 = load i32, i32* %6
%81 = call i32 (i8*, i8*, i8, ...) @sprintf(i8* %78, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8 signext %79, i32 %80)
%82 = load i32, i32* @stderr
%83 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 994, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %91
84: ; preds = %76
br label %85
85: ; preds = %84
%86 = load i8*, i8** %7
%87 = getelementptr inbounds i8, i8* %86, i32 1
store i8* %87, i8** %7
%88 = load i32, i32* %6
%89 = add nsw i32 %88, 1
store i32 %89, i32* %6
br label %33
90: ; preds = %33
store i32 1, i32* %3
br label %91
91: ; preds = %90, %77, %41, %26, %16
%92 = load i32, i32* %3
ret i32 %92
}

LLVM IR (-O2):
@.str = [16 x i8] c"Null Table name\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.2 = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/DEPRECATED_Q2/AUX/auxil.c\00"
@.str.3 = [40 x i8] c"Table name cannot start with underscore\00"
@.str.4 = [43 x i8] c"Table name too long. Exceeds %d characters\00"
@.str.5 = [47 x i8] c"Non alphanumeric character [%c] at position %d\00"
define i32 @chk_tbl_name(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = load i8, i8* %0
switch i8 %5, label %10 [
i8 0, label %6
i8 95, label %8
]
6: ; preds = %4, %2
%7 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %50
8: ; preds = %4
%9 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
br label %50
10: ; preds = %4, %45
%11 = phi i8* [ %46, %45 ], [ %0, %4 ]
%12 = phi i32 [ %47, %45 ], [ 0, %4 ]
%13 = phi i8 [ %48, %45 ], [ %5, %4 ]
%14 = icmp eq i32 %12, 32
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = tail call i32 (i8*, i8*, i8, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8 signext 31)
br label %50
17: ; preds = %10
%18 = add i8 %13, -48
%19 = icmp ult i8 %18, 10
br i1 %19, label %32, label %20
20: ; preds = %17
%21 = icmp eq i8 %13, 95
%22 = and i8 %13, -33
%23 = add i8 %22, -65
%24 = icmp ult i8 %23, 26
%25 = or i1 %21, %24
br i1 %25, label %32, label %28
26: ; preds = %39
%27 = or i32 %12, 1
br label %28
28: ; preds = %20, %26
%29 = phi i32 [ %27, %26 ], [ %12, %20 ]
%30 = phi i8 [ %34, %26 ], [ %13, %20 ]
%31 = tail call i32 (i8*, i8*, i8, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8 signext %30, i32 %29)
br label %50
32: ; preds = %17, %20
%33 = getelementptr inbounds i8, i8* %11, i64 1
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 0
br i1 %35, label %54, label %36
36: ; preds = %32
%37 = add i8 %34, -48
%38 = icmp ult i8 %37, 10
br i1 %38, label %45, label %39
39: ; preds = %36
%40 = icmp eq i8 %34, 95
%41 = and i8 %34, -33
%42 = add i8 %41, -65
%43 = icmp ult i8 %42, 26
%44 = or i1 %40, %43
br i1 %44, label %45, label %26
45: ; preds = %39, %36
%46 = getelementptr inbounds i8, i8* %11, i64 2
%47 = add nuw nsw i32 %12, 2
%48 = load i8, i8* %46
%49 = icmp eq i8 %48, 0
br i1 %49, label %54, label %10
50: ; preds = %6, %8, %15, %28
%51 = phi i32 [ 994, %28 ], [ 982, %15 ], [ 977, %8 ], [ 973, %6 ]
%52 = load i32, i32* @stderr
%53 = tail call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %51, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0))
br label %54
54: ; preds = %32, %45, %50
%55 = phi i32 [ 0, %50 ], [ 1, %45 ], [ 1, %32 ]
ret i32 %55
}