// File: /workspace/github_cpp_makefile_star2_O3/arnoldrobbins[P]mcilroy-regex/re2.cpp
// Function: regcomp
int
regcomp(regex_t *preg, const char *pattern, int cflags)
{
	preg->rex = 0;
	if(Done::done==0 && (Done::done=new Done)==0)
		return REG_ESPACE;
	if(cflags & REG_AUGMENTED)
		cflags |= REG_EXTENDED;
	cflags &= CFLAGS|GFLAGS;
	Cenv env(pattern, cflags);
	if(env.flags&SPACE)
		return REG_ESPACE;

	preg->rex = regAlt(1, &env);
	cflags |= special(preg, &env);
	if(preg->rex == ERROR)
		return env.flags&SPACE? REG_ESPACE: REG_BADPAT;

	preg->rex->serialize(1);
	Stat st = preg->rex->stat(&env);
	if(st.o) {
		regfree(preg);
		return REG_ESPACE;
	}
	cflags |= hard(&st);
	if(cflags & REG_ANCH)
		cflags |= ONCE;
	preg->flags = cflags;
	preg->re_nsub = st.p;
	preg->map = env.map;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
movq $0x0, 0x8(%rdi)
cmpq $0x0, 0x8df0(%rip)      # 0x138c0
jne 0xaafd
movl $0x18, %edi
callq 0x5170
movb $0x11, 0x8(%rax)
movq $0x0, 0x10(%rax)
leaq 0x7ec9(%rip), %rcx      # 0x129b8
addq $0x10, %rcx
movq %rcx, (%rax)
movq %rax, 0x8dc3(%rip)      # 0x138c0
movl %ebp, %eax
shrl $0x9, %eax
andl $0x1, %eax
movl %ebp, %r14d
andl $0x3cf, %r14d           # imm = 0x3CF
orl %eax, %r14d
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xa338
movl $0xc, %r15d
testb $0x4, 0x1(%r12)
jne 0xac34
leaq 0x8(%rsp), %rsi
movl $0x1, %edi
callq 0xad80
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0xac20
movq %rax, %r12
movzbl 0x8(%rax), %eax
cmpq $0x9, %rax
ja 0xabd6
leaq 0x2949(%rip), %rcx      # 0xd4b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1000, %r13d          # imm = 0x1000
testb $0x40, 0x8(%rsp)
jne 0xabd9
movq (%r12), %rax
movq %r12, %rdi
callq *0x8(%rax)
movq $0x0, 0x8(%rbx)
jmp 0xac20
movq 0x20(%r12), %r12
movzbl 0x8(%r12), %eax
cmpl $0x9, %eax
je 0xab94
cmpl $0x1, %eax
je 0xabc9
cmpl $0x3, %eax
jne 0xabd6
cmpl $0x0, 0x18(%r12)
jne 0xabd6
movl $0x1000, %r13d          # imm = 0x1000
cmpl $0x40000000, 0x1c(%r12) # imm = 0x40000000
jne 0xabd6
jmp 0xabd9
movl $0x1000, %r13d          # imm = 0x1000
testb $0x8, 0x8(%rsp)
je 0xabd9
xorl %r13d, %r13d
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0xac20
movq (%rdi), %rax
movl $0x1, %esi
callq *0x18(%rax)
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
leaq 0x8(%rsp), %rsi
callq *0x10(%rax)
movq %rdx, %rcx
shrq $0x28, %rcx
testb %cl, %cl
je 0xac46
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0xac16
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x8(%rbx)
jmp 0xac34
testb $0x4, 0x9(%rsp)
movl $0x2, %eax
movl $0xc, %r15d
cmovel %eax, %r15d
movl %r15d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rcx
shrq $0x30, %rcx
movzbl %cl, %ecx
orl %edx, %ecx
sete %cl
movq %rax, %rsi
shrq $0x39, %rsi
sete %sil
andb %cl, %sil
movl $0x800, %ecx            # imm = 0x800
cmpb $0x1, %sil
jne 0xad28
movq %rax, %rsi
shrq $0x28, %rsi
testb %sil, %sil
je 0xad26
movq %rax, %rdi
shrq $0x38, %rdi
jne 0xad28
movl $0x0, %ecx
cmpb $0x1, %sil
je 0xad28
shrq $0x20, %rax
xorl %ecx, %ecx
cmpb %sil, %al
setne %cl
shll $0xb, %ecx
jmp 0xad28
xorl %r13d, %r13d
movzwl 0x8(%rsp), %eax
testl $0x180, %eax            # imm = 0x180
jne 0xabd9
movl $0x88, %edi
callq 0x5170
movq 0x18(%r12), %rsi
movl 0x20(%r12), %edx
leaq 0x8(%rsp), %rcx
movq %rax, (%rsp)
movq %rax, %rdi
callq 0x8810
testb $0x4, 0x9(%rsp)
jne 0xad58
movq 0x10(%r12), %rax
movq (%rsp), %rcx
movq %rax, 0x10(%rcx)
movq %rcx, 0x8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r12)
movl $0x0, 0x20(%r12)
movq (%r12), %rax
movq %r12, %rdi
callq *0x8(%rax)
movl $0x1000, %r13d          # imm = 0x1000
jmp 0xabd9
xorl %ecx, %ecx
orl %ecx, %r13d
shll $0x5, %ebp
andl $0x1000, %ebp           # imm = 0x1000
orl %r13d, %ebp
orl %r14d, %ebp
movl %ebp, 0x10(%rbx)
shrq $0x20, %rdx
movzbl %dl, %eax
movq %rax, (%rbx)
movq 0x30(%rsp), %rax
movq %rax, 0x18(%rbx)
xorl %r15d, %r15d
jmp 0xac34
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0xabd9
movq %rax, %rbx
movl $0x88, %esi
movq (%rsp), %rdi
callq 0x5180
movq %rbx, %rdi
callq 0x52b0