#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 */
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int /*<<< orphan*/ REG_EXTENDED;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int regcomp(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int regexec(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/,
            int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int is_nosuffix_readname(const char *s) {
  regex_t regex;
  int reti;
  int is_nosuffix_name = 1;
  reti = regcomp(&regex, "[# \t/:][0-9abAB][\n\r]?$", REG_EXTENDED);
  if (reti) {
    {
      fprintf(stderr, "\nERROR: ");
      fprintf(stderr, "Internal error: Could not compile regex");
      fprintf(stderr, "\n");
    };
    exit(2);
  }
  reti = regexec(&regex, s, 0, 0, 0);
  if (!reti) {
    is_nosuffix_name = 0;
  }
  regfree(&regex);
  return is_nosuffix_name;
}


x86 assembly (clang, -O0):
<is_nosuffix_readname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
mov    0x2e6e(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1040 <regcomp@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11d2 <is_nosuffix_readname+0x82>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
lea    0xe7e(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
lea    0xe72(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1070 <exit@plt>
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <regexec@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11fc <is_nosuffix_readname+0xac>
movl   $0x0,-0x14(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <regfree@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_nosuffix_readname>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
lea    0xe99(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1040 <regcomp@plt>
test   %eax,%eax
jne    11a5 <is_nosuffix_readname+0x55>
lea    0x4(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <regexec@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
mov    %r14,%rdi
call   1030 <regfree@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e34(%rip),%rbx
mov    (%rbx),%edi
lea    0xe62(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe5d(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe77(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"[# \09/:][0-9abAB][\0A\0D]?$\00"
@REG_EXTENDED = global i32 0
@stderr = global i32 0
@.str.1 = [9 x i8] c"\0AERROR: \00"
@.str.2 = [40 x i8] c"Internal error: Could not compile regex\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @is_nosuffix_readname(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %5
%6 = load i32, i32* @REG_EXTENDED
%7 = call i32 @regcomp(i32* %3, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %1
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @exit(i32 2)
unreachable
18: ; preds = %1
%19 = load i8*, i8** %2
%20 = call i32 @regexec(i32* %3, i8* %19, i32 0, i32 0, i32 0)
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %18
store i32 0, i32* %5
br label %24
24: ; preds = %23, %18
%25 = call i32 @regfree(i32* %3)
%26 = load i32, i32* %5
ret i32 %26
}

LLVM IR (-O2):
@.str = [23 x i8] c"[# \09/:][0-9abAB][\0A\0D]?$\00"
@REG_EXTENDED = global i32 0
@stderr = global i32 0
@.str.1 = [9 x i8] c"\0AERROR: \00"
@.str.2 = [40 x i8] c"Internal error: Could not compile regex\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @is_nosuffix_readname(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @REG_EXTENDED
%5 = call i32 @regcomp(i32* %2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @exit(i32 2)
unreachable
15: ; preds = %1
%16 = call i32 @regexec(i32* %2, i8* %0, i32 0, i32 0, i32 0)
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @regfree(i32* %2)
ret i32 %18
}