#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 EINVAL;
int /*<<< orphan*/ logError(char *, int, ...);
int /*<<< orphan*/ *strchr(char const *, char);
int fdfs_check_data_filename(const char *filename, const int len) {
  if (len < 6) {
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/fdfs_global.c"
             ", line: %d, "
             "the length=%d of filename \"%s\" is too short",
             42, len, filename);
    return EINVAL;
  }
  if (!((*filename >= '0' && *filename <= '9') ||
        (*filename >= 'A' && *filename <= 'F')) ||
      !((*(filename + 1) >= '0' && *(filename + 1) <= '9') ||
        (*(filename + 1) >= 'A' && *(filename + 1) <= 'F')) ||
      *(filename + 2) != '/' ||
      !((*(filename + 3) >= '0' && *(filename + 3) <= '9') ||
        (*(filename + 3) >= 'A' && *(filename + 3) <= 'F')) ||
      !((*(filename + 4) >= '0' && *(filename + 4) <= '9') ||
        (*(filename + 4) >= 'A' && *(filename + 4) <= 'F')) ||
      *(filename + 5) != '/') {
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/fdfs_global.c"
             ", line: %d, "
             "the format of filename \"%s\" is invalid",
             54, filename);
    return EINVAL;
  }
  if (strchr(filename + 6, '/') != NULL) {
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/fdfs_global.c"
             ", line: %d, "
             "the format of filename \"%s\" is invalid",
             62, filename);
    return EINVAL;
  }
  return 0;
}


x86 assembly (clang, -O0):
<fdfs_check_data_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    1164 <fdfs_check_data_filename+0x44>
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xeb9(%rip),%rdi
mov    $0x2a,%esi
mov    $0x0,%al
call   1040 <logError@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1305 <fdfs_check_data_filename+0x1e5>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1184 <fdfs_check_data_filename+0x64>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    11a4 <fdfs_check_data_filename+0x84>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     1292 <fdfs_check_data_filename+0x172>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x46,%eax
jg     1292 <fdfs_check_data_filename+0x172>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x30,%eax
jl     11c6 <fdfs_check_data_filename+0xa6>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x39,%eax
jle    11e8 <fdfs_check_data_filename+0xc8>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x41,%eax
jl     1292 <fdfs_check_data_filename+0x172>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x46,%eax
jg     1292 <fdfs_check_data_filename+0x172>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x2f,%eax
jne    1292 <fdfs_check_data_filename+0x172>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x30,%eax
jl     121b <fdfs_check_data_filename+0xfb>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x39,%eax
jle    123d <fdfs_check_data_filename+0x11d>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x41,%eax
jl     1292 <fdfs_check_data_filename+0x172>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x46,%eax
jg     1292 <fdfs_check_data_filename+0x172>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x30,%eax
jl     125f <fdfs_check_data_filename+0x13f>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x39,%eax
jle    1281 <fdfs_check_data_filename+0x161>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x41,%eax
jl     1292 <fdfs_check_data_filename+0x172>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x46,%eax
jg     1292 <fdfs_check_data_filename+0x172>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x2f,%eax
je     12ba <fdfs_check_data_filename+0x19a>
mov    -0x10(%rbp),%rdx
lea    0xe3f(%rip),%rdi
mov    $0x36,%esi
mov    $0x0,%al
call   1040 <logError@plt>
mov    0x2d30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1305 <fdfs_check_data_filename+0x1e5>
mov    -0x10(%rbp),%rdi
add    $0x6,%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     12fe <fdfs_check_data_filename+0x1de>
mov    -0x10(%rbp),%rdx
lea    0xdfb(%rip),%rdi
mov    $0x3e,%esi
mov    $0x0,%al
call   1040 <logError@plt>
mov    0x2cec(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1305 <fdfs_check_data_filename+0x1e5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdfs_check_data_filename>:
push   %rbx
mov    %rdi,%rbx
cmp    $0x5,%esi
jg     1146 <fdfs_check_data_filename+0x26>
mov    %esi,%edx
lea    0xece(%rip),%rdi
mov    $0x2a,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <logError@plt>
jmp    11cc <fdfs_check_data_filename+0xac>
mov    (%rbx),%al
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     1156 <fdfs_check_data_filename+0x36>
add    $0xbf,%al
cmp    $0x5,%al
ja     11b6 <fdfs_check_data_filename+0x96>
mov    0x1(%rbx),%al
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     1167 <fdfs_check_data_filename+0x47>
add    $0xbf,%al
cmp    $0x5,%al
ja     11b6 <fdfs_check_data_filename+0x96>
cmpb   $0x2f,0x2(%rbx)
jne    11b6 <fdfs_check_data_filename+0x96>
mov    0x3(%rbx),%al
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     117e <fdfs_check_data_filename+0x5e>
add    $0xbf,%al
cmp    $0x5,%al
ja     11b6 <fdfs_check_data_filename+0x96>
mov    0x4(%rbx),%al
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     118f <fdfs_check_data_filename+0x6f>
add    $0xbf,%al
cmp    $0x5,%al
ja     11b6 <fdfs_check_data_filename+0x96>
cmpb   $0x2f,0x5(%rbx)
jne    11b6 <fdfs_check_data_filename+0x96>
lea    0x6(%rbx),%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11d7 <fdfs_check_data_filename+0xb7>
lea    0xf2d(%rip),%rdi
mov    $0x3e,%esi
jmp    11c2 <fdfs_check_data_filename+0xa2>
lea    0xf1f(%rip),%rdi
mov    $0x36,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <logError@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [220 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/fdfs_global.c, line: %d, the length=%d of filename \22%s\22 is too short\00"
@EINVAL = global i32 0
@.str.1 = [215 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/fdfs_global.c, line: %d, the format of filename \22%s\22 is invalid\00"
define i32 @fdfs_check_data_filename(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp slt i32 %6, 6
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* %5
%10 = load i8*, i8** %4
%11 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([220 x i8], [220 x i8]* @.str, i64 0, i64 0), i32 42, i32 %9, i8* %10)
%12 = load i32, i32* @EINVAL
store i32 %12, i32* %3
br label %131
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp sge i32 %16, 48
br i1 %17, label %18, label %23
18: ; preds = %13
%19 = load i8*, i8** %4
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 57
br i1 %22, label %33, label %23
23: ; preds = %18, %13
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sge i32 %26, 65
br i1 %27, label %28, label %117
28: ; preds = %23
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp sle i32 %31, 70
br i1 %32, label %33, label %117
33: ; preds = %28, %18
%34 = load i8*, i8** %4
%35 = getelementptr inbounds i8, i8* %34, i64 1
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp sge i32 %37, 48
br i1 %38, label %39, label %45
39: ; preds = %33
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i64 1
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp sle i32 %43, 57
br i1 %44, label %57, label %45
45: ; preds = %39, %33
%46 = load i8*, i8** %4
%47 = getelementptr inbounds i8, i8* %46, i64 1
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp sge i32 %49, 65
br i1 %50, label %51, label %117
51: ; preds = %45
%52 = load i8*, i8** %4
%53 = getelementptr inbounds i8, i8* %52, i64 1
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp sle i32 %55, 70
br i1 %56, label %57, label %117
57: ; preds = %51, %39
%58 = load i8*, i8** %4
%59 = getelementptr inbounds i8, i8* %58, i64 2
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp ne i32 %61, 47
br i1 %62, label %117, label %63
63: ; preds = %57
%64 = load i8*, i8** %4
%65 = getelementptr inbounds i8, i8* %64, i64 3
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp sge i32 %67, 48
br i1 %68, label %69, label %75
69: ; preds = %63
%70 = load i8*, i8** %4
%71 = getelementptr inbounds i8, i8* %70, i64 3
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp sle i32 %73, 57
br i1 %74, label %87, label %75
75: ; preds = %69, %63
%76 = load i8*, i8** %4
%77 = getelementptr inbounds i8, i8* %76, i64 3
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = icmp sge i32 %79, 65
br i1 %80, label %81, label %117
81: ; preds = %75
%82 = load i8*, i8** %4
%83 = getelementptr inbounds i8, i8* %82, i64 3
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = icmp sle i32 %85, 70
br i1 %86, label %87, label %117
87: ; preds = %81, %69
%88 = load i8*, i8** %4
%89 = getelementptr inbounds i8, i8* %88, i64 4
%90 = load i8, i8* %89
%91 = sext i8 %90 to i32
%92 = icmp sge i32 %91, 48
br i1 %92, label %93, label %99
93: ; preds = %87
%94 = load i8*, i8** %4
%95 = getelementptr inbounds i8, i8* %94, i64 4
%96 = load i8, i8* %95
%97 = sext i8 %96 to i32
%98 = icmp sle i32 %97, 57
br i1 %98, label %111, label %99
99: ; preds = %93, %87
%100 = load i8*, i8** %4
%101 = getelementptr inbounds i8, i8* %100, i64 4
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp sge i32 %103, 65
br i1 %104, label %105, label %117
105: ; preds = %99
%106 = load i8*, i8** %4
%107 = getelementptr inbounds i8, i8* %106, i64 4
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp sle i32 %109, 70
br i1 %110, label %111, label %117
111: ; preds = %105, %93
%112 = load i8*, i8** %4
%113 = getelementptr inbounds i8, i8* %112, i64 5
%114 = load i8, i8* %113
%115 = sext i8 %114 to i32
%116 = icmp ne i32 %115, 47
br i1 %116, label %117, label %121
117: ; preds = %111, %105, %99, %81, %75, %57, %51, %45, %28, %23
%118 = load i8*, i8** %4
%119 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([215 x i8], [215 x i8]* @.str.1, i64 0, i64 0), i32 54, i8* %118)
%120 = load i32, i32* @EINVAL
store i32 %120, i32* %3
br label %131
121: ; preds = %111
%122 = load i8*, i8** %4
%123 = getelementptr inbounds i8, i8* %122, i64 6
%124 = call i32* @strchr(i8* %123, i8 signext 47)
%125 = icmp ne i32* %124, null
br i1 %125, label %126, label %130
126: ; preds = %121
%127 = load i8*, i8** %4
%128 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([215 x i8], [215 x i8]* @.str.1, i64 0, i64 0), i32 62, i8* %127)
%129 = load i32, i32* @EINVAL
store i32 %129, i32* %3
br label %131
130: ; preds = %121
store i32 0, i32* %3
br label %131
131: ; preds = %130, %126, %117, %8
%132 = load i32, i32* %3
ret i32 %132
}

LLVM IR (-O2):
@.str = [220 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/fdfs_global.c, line: %d, the length=%d of filename \22%s\22 is too short\00"
@EINVAL = global i32 0
@.str.1 = [215 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/fdfs_global.c, line: %d, the format of filename \22%s\22 is invalid\00"
define i32 @fdfs_check_data_filename(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 6
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([220 x i8], [220 x i8]* @.str, i64 0, i64 0), i32 42, i32 %1, i8* %0)
%6 = load i32, i32* @EINVAL
br label %56
7: ; preds = %2
%8 = load i8, i8* %0
%9 = add i8 %8, -48
%10 = icmp ult i8 %9, 10
%11 = add i8 %8, -65
%12 = icmp ult i8 %11, 6
%13 = or i1 %10, %12
br i1 %13, label %14, label %46
14: ; preds = %7
%15 = getelementptr inbounds i8, i8* %0, i64 1
%16 = load i8, i8* %15
%17 = add i8 %16, -48
%18 = icmp ult i8 %17, 10
%19 = add i8 %16, -65
%20 = icmp ult i8 %19, 6
%21 = or i1 %18, %20
br i1 %21, label %22, label %46
22: ; preds = %14
%23 = getelementptr inbounds i8, i8* %0, i64 2
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 47
br i1 %25, label %26, label %46
26: ; preds = %22
%27 = getelementptr inbounds i8, i8* %0, i64 3
%28 = load i8, i8* %27
%29 = add i8 %28, -48
%30 = icmp ult i8 %29, 10
%31 = add i8 %28, -65
%32 = icmp ult i8 %31, 6
%33 = or i1 %30, %32
br i1 %33, label %34, label %46
34: ; preds = %26
%35 = getelementptr inbounds i8, i8* %0, i64 4
%36 = load i8, i8* %35
%37 = add i8 %36, -48
%38 = icmp ult i8 %37, 10
%39 = add i8 %36, -65
%40 = icmp ult i8 %39, 6
%41 = or i1 %38, %40
br i1 %41, label %42, label %46
42: ; preds = %34
%43 = getelementptr inbounds i8, i8* %0, i64 5
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 47
br i1 %45, label %49, label %46
46: ; preds = %34, %26, %14, %7, %42, %22
%47 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([215 x i8], [215 x i8]* @.str.1, i64 0, i64 0), i32 54, i8* %0)
%48 = load i32, i32* @EINVAL
br label %56
49: ; preds = %42
%50 = getelementptr inbounds i8, i8* %0, i64 6
%51 = tail call i32* @strchr(i8* %50, i8 signext 47)
%52 = icmp eq i32* %51, null
br i1 %52, label %56, label %53
53: ; preds = %49
%54 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([215 x i8], [215 x i8]* @.str.1, i64 0, i64 0), i32 62, i8* %0)
%55 = load i32, i32* @EINVAL
br label %56
56: ; preds = %49, %53, %46, %4
%57 = phi i32 [ %6, %4 ], [ %48, %46 ], [ %55, %53 ], [ 0, %49 ]
ret i32 %57
}