// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxUtil.c
// Function: HaxCompileRegexp
regexp *
HaxCompileRegexp(
    Hax_Interp *interp,			/* For use in error reporting. */
    char *string			/* String for which to produce
					 * compiled regular expression. */)
{
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    int i, length;
    regexp *result;

    length = strlen(string);
    for (i = 0; i < NUM_REGEXPS; i++) {
	if ((length == iPtr->patLengths[i])
		&& (strcmp(string, iPtr->patterns[i]) == 0)) {
	    /*
	     * Move the matched pattern to the first slot in the
	     * cache and shift the other patterns down one position.
	     */

	    if (i != 0) {
		int j;
		char *cachedString;

		cachedString = iPtr->patterns[i];
		result = iPtr->regexps[i];
		for (j = i-1; j >= 0; j--) {
		    iPtr->patterns[j+1] = iPtr->patterns[j];
		    iPtr->patLengths[j+1] = iPtr->patLengths[j];
		    iPtr->regexps[j+1] = iPtr->regexps[j];
		}
		iPtr->patterns[0] = cachedString;
		iPtr->patLengths[0] = length;
		iPtr->regexps[0] = result;
	    }
	    return iPtr->regexps[0];
	}
    }

    /*
     * No match in the cache.  Compile the string and add it to the
     * cache.
     */

    iPtr->haxRegexpError = NULL;
    result = RegComp(interp, string);
    if (iPtr->haxRegexpError != NULL) {
	Hax_AppendResult(interp,
	    "couldn't compile regular expression pattern: ",
	    iPtr->haxRegexpError, (char *) NULL);
	return NULL;
    }
    if (iPtr->patterns[NUM_REGEXPS-1] != NULL) {
	ckfree(memoryp, iPtr->patterns[NUM_REGEXPS-1]);
	ckfree(memoryp, (char *) iPtr->regexps[NUM_REGEXPS-1]);
    }
    for (i = NUM_REGEXPS - 2; i >= 0; i--) {
	iPtr->patterns[i+1] = iPtr->patterns[i];
	iPtr->patLengths[i+1] = iPtr->patLengths[i];
	iPtr->regexps[i+1] = iPtr->regexps[i];
    }
    iPtr->patterns[0] = (char *) ckalloc(memoryp, (unsigned) (length+1));
    strcpy(iPtr->patterns[0], string);
    iPtr->patLengths[0] = length;
    iPtr->regexps[0] = result;
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x280(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x41b0
movl %eax, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x5, -0x2c(%rbp)
jge 0x19356
movl -0x30(%rbp), %eax
movq -0x20(%rbp), %rcx
movslq -0x2c(%rbp), %rdx
cmpl 0x150(%rcx,%rdx,4), %eax
jne 0x19346
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x128(%rax,%rcx,8), %rsi
callq 0x4300
cmpl $0x0, %eax
jne 0x19346
cmpl $0x0, -0x2c(%rbp)
je 0x19332
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x128(%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x168(%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movl -0x2c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jl 0x19307
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq 0x128(%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rax
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, 0x128(%rax,%rcx,8)
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl 0x150(%rax,%rcx,4), %edx
movq -0x20(%rbp), %rax
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, 0x150(%rax,%rcx,4)
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq 0x168(%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rax
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, 0x168(%rax,%rcx,8)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x19289
movq -0x48(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x128(%rax)
movl -0x30(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x150(%rax)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x168(%rax)
movq -0x20(%rbp), %rax
movq 0x168(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x194ea
jmp 0x19348
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1920a
movq -0x20(%rbp), %rax
movq $0x0, 0x290(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x40b0
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x290(%rax)
je 0x193b2
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x290(%rax), %rdx
leaq 0x64e2(%rip), %rsi      # 0x1f87c
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x4500
movq $0x0, -0x8(%rbp)
jmp 0x194ea
movq -0x20(%rbp), %rax
cmpq $0x0, 0x148(%rax)
je 0x19400
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x148(%rax), %rsi
leaq 0x6454(%rip), %rdx      # 0x1f82a
movl $0x582, %ecx            # imm = 0x582
callq 0x4260
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x188(%rax), %rsi
leaq 0x6434(%rip), %rdx      # 0x1f82a
movl $0x583, %ecx            # imm = 0x583
callq 0x4260
movl $0x3, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x19485
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x128(%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, 0x128(%rax,%rcx,8)
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl 0x150(%rax,%rcx,4), %edx
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, 0x150(%rax,%rcx,4)
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x168(%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, 0x168(%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x19407
movq -0x28(%rbp), %rdi
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x6390(%rip), %rdx      # 0x1f82a
movl $0x58a, %ecx            # imm = 0x58A
callq 0x44c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x128(%rax)
movq -0x20(%rbp), %rax
movq 0x128(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x40d0
movl -0x30(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x150(%rax)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x168(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)