#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*/ 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_casava_1_8_readname(const char *s) {
  regex_t regex;
  int reti;
  int is_casava_1_8 = 0;
  reti = regcomp(&regex, "[A-Z0-9:]* [12]:[YN]:[0-9]*:.*", 0);
  if (reti) {
    fprintf(stderr, "Internal error: Could not compile regex\n");
    exit(2);
  }
  reti = regexec(&regex, s, 0, 0, 0);
  if (!reti) {
    is_casava_1_8 = 1;
  }
  regfree(&regex);
  return is_casava_1_8;
}


x86 assembly (clang, -O0):
<is_casava_1_8_readname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0xc(%rbp),%rdi
lea    0xe92(%rip),%rsi
xor    %edx,%edx
call   1040 <regcomp@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11a1 <is_casava_1_8_readname+0x51>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%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    11cb <is_casava_1_8_readname+0x7b>
movl   $0x1,-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_casava_1_8_readname>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xea2(%rip),%rsi
lea    0x4(%rsp),%rdi
xor    %edx,%edx
call   1040 <regcomp@plt>
test   %eax,%eax
jne    119e <is_casava_1_8_readname+0x4e>
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
sete   %bl
mov    %r14,%rdi
call   1030 <regfree@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
lea    0xe71(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"[A-Z0-9:]* [12]:[YN]:[0-9]*:.*\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"Internal error: Could not compile regex\0A\00"
define i32 @is_casava_1_8_readname(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %5
%6 = call i32 @regcomp(i32* %3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @exit(i32 2)
unreachable
13: ; preds = %1
%14 = load i8*, i8** %2
%15 = call i32 @regexec(i32* %3, i8* %14, i32 0, i32 0, i32 0)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %13
store i32 1, i32* %5
br label %19
19: ; preds = %18, %13
%20 = call i32 @regfree(i32* %3)
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
@.str = [31 x i8] c"[A-Z0-9:]* [12]:[YN]:[0-9]*:.*\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"Internal error: Could not compile regex\0A\00"
define i32 @is_casava_1_8_readname(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @regcomp(i32* %2, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @exit(i32 2)
unreachable
10: ; preds = %1
%11 = call i32 @regexec(i32* %2, i8* %0, i32 0, i32 0, i32 0)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @regfree(i32* %2)
ret i32 %13
}