// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxCmdMZ.c
// Function: Hax_RegexpCmd
int
Hax_RegexpCmd(
    ClientData dummy,			/* Not used. */
    Hax_Interp *interp,			/* Current interpreter. */
    int argc,				/* Number of arguments. */
    char **argv				/* Argument strings. */)
{
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    int noCase = 0;
    int indices = 0;
    regexp *regexpPtr;
    char **argPtr, *string;
    int match, i;

    if (argc < 3) {
	wrongNumArgs:
	Hax_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" ?-nocase? exp string ?matchVar? ?subMatchVar ",
		"subMatchVar ...?\"", (char *) NULL);
	return HAX_ERROR;
    }
    argPtr = argv+1;
    argc--;
    while ((argc > 0) && (argPtr[0][0] == '-')) {
	if (strcmp(argPtr[0], "-indices") == 0) {
	    argPtr++;
	    argc--;
	    indices = 1;
	} else if (strcmp(argPtr[0], "-nocase") == 0) {
	    argPtr++;
	    argc--;
	    noCase = 1;
	} else {
	    break;
	}
    }
    if (argc < 2) {
	goto wrongNumArgs;
    }
    regexpPtr = HaxCompileRegexp(interp, argPtr[0]);
    if (regexpPtr == NULL) {
	return HAX_ERROR;
    }

    /*
     * Convert the string to lower case, if desired, and perform
     * the match.
     */

    if (noCase) {
	char *dst, *src;

	string = (char *) ckalloc(memoryp, (unsigned) (strlen(argPtr[1]) + 1));
	for (src = argPtr[1], dst = string; *src != 0; src++, dst++) {
	    if (isupper(*src)) {
		*dst = tolower(*src);
	    } else {
		*dst = *src;
	    }
	}
	*dst = 0;
    } else {
	string = argPtr[1];
    }
    iPtr->haxRegexpError = NULL;
    match = RegExec(interp, regexpPtr, string);
    if (string != argPtr[1]) {
	ckfree(memoryp, string);
    }
    if (iPtr->haxRegexpError != NULL) {
	Hax_AppendResult(interp, "error while matching pattern: ",
		iPtr->haxRegexpError, (char *) NULL);
	return HAX_ERROR;
    }
    if (!match) {
	interp->result = (char *) "0";
	return HAX_OK;
    }

    /*
     * If additional variable names have been specified, return
     * index information in those variables.
     */

    argc -= 2;
    if (argc > NSUBEXP) {
	interp->result = (char *) "too many substring variables";
	return HAX_ERROR;
    }
    for (i = 0; i < argc; i++) {
	char *result, info[50];

	if (regexpPtr->startp[i] == NULL) {
	    if (indices) {
		result = Hax_SetVar(interp, argPtr[i+2], (char *) "-1 -1", 0);
	    } else {
		result = Hax_SetVar(interp, argPtr[i+2], (char *) "", 0);
	    }
	} else {
	    if (indices) {
		sprintf(info, "%ld %ld", regexpPtr->startp[i] - string,
			regexpPtr->endp[i] - string - 1);
		result = Hax_SetVar(interp, argPtr[i+2], info, 0);
	    } else {
		char savedChar, *first, *last;

		first = argPtr[1] + (regexpPtr->startp[i] - string);
		last = argPtr[1] + (regexpPtr->endp[i] - string);
		savedChar = *last;
		*last = 0;
		result = Hax_SetVar(interp, argPtr[i+2], first, 0);
		*last = savedChar;
	    }
	}
	if (result == NULL) {
	    Hax_AppendResult(interp, "couldn't set variable \"",
		    argPtr[i+2], "\"", (char *) NULL);
	    return HAX_ERROR;
	}
    }
    interp->result = (char *) "1";
    return HAX_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x280(%rax), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
cmpl $0x3, -0x1c(%rbp)
jge 0xc9ff
jmp 0xc9c7
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq 0x10f9b(%rip), %rsi     # 0x1d974
leaq 0x11850(%rip), %rcx     # 0x1e230
leaq 0x11878(%rip), %r8      # 0x1e25f
xorl %eax, %eax
movl %eax, %r9d
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0xce81
movq -0x28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x1c(%rbp)
movb %al, -0xc9(%rbp)
jle 0xca38
movq -0x50(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
sete %al
movb %al, -0xc9(%rbp)
movb -0xc9(%rbp), %al
testb $0x1, %al
jne 0xca44
jmp 0xcab9
movq -0x50(%rbp), %rax
movq (%rax), %rdi
leaq 0x1181f(%rip), %rsi     # 0x1e271
callq 0x4300
cmpl $0x0, %eax
jne 0xca7a
movq -0x50(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
movl $0x1, -0x40(%rbp)
jmp 0xcab4
movq -0x50(%rbp), %rax
movq (%rax), %rdi
leaq 0x117f2(%rip), %rsi     # 0x1e27a
callq 0x4300
cmpl $0x0, %eax
jne 0xcab0
movq -0x50(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0xcab2
jmp 0xcab9
jmp 0xcab4
jmp 0xca14
cmpl $0x2, -0x1c(%rbp)
jge 0xcac4
jmp 0xc9c7
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rax
movq (%rax), %rsi
callq 0x4090
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xcaeb
movl $0x1, -0x4(%rbp)
jmp 0xce81
cmpl $0x0, -0x3c(%rbp)
je 0xcbb8
movq -0x38(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x41b0
movq -0xd8(%rbp), %rdi
addq $0x1, %rax
movl %eax, %eax
movl %eax, %esi
leaq 0x1175f(%rip), %rdx     # 0x1e282
movl $0x77, %ecx
callq 0x44c0
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x70(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xcbaf
callq 0x4630
movq (%rax), %rax
movq -0x70(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0xcb87
movq -0x70(%rbp), %rax
movsbl (%rax), %edi
callq 0x4400
movb %al, %cl
movq -0x68(%rbp), %rax
movb %cl, (%rax)
jmp 0xcb93
movq -0x70(%rbp), %rax
movb (%rax), %cl
movq -0x68(%rbp), %rax
movb %cl, (%rax)
jmp 0xcb95
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0xcb45
movq -0x68(%rbp), %rax
movb $0x0, (%rax)
jmp 0xcbc4
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rax
movq $0x0, 0x290(%rax)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x58(%rbp), %rdx
callq 0x4570
movl %eax, -0x5c(%rbp)
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
cmpq 0x8(%rcx), %rax
je 0xcc0e
movq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq 0x1167e(%rip), %rdx     # 0x1e282
movl $0x86, %ecx
callq 0x4260
movq -0x30(%rbp), %rax
cmpq $0x0, 0x290(%rax)
je 0xcc49
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x290(%rax), %rdx
leaq 0x1165b(%rip), %rsi     # 0x1e28d
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0xce81
cmpl $0x0, -0x5c(%rbp)
jne 0xcc69
movq -0x18(%rbp), %rax
leaq 0x11249(%rip), %rcx     # 0x1dea3
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xce81
movl -0x1c(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x1c(%rbp)
cmpl $0xa, -0x1c(%rbp)
jle 0xcc92
movq -0x18(%rbp), %rax
leaq 0x11629(%rip), %rcx     # 0x1e2ac
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xce81
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xce6c
movq -0x48(%rbp), %rax
movslq -0x60(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0xcd0f
cmpl $0x0, -0x40(%rbp)
je 0xcce3
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rax
movl -0x60(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x115f3(%rip), %rdx     # 0x1e2c9
xorl %ecx, %ecx
callq 0x4450
movq %rax, -0x78(%rbp)
jmp 0xcd0a
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rax
movl -0x60(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x12174(%rip), %rdx     # 0x1ee73
xorl %ecx, %ecx
callq 0x4450
movq %rax, -0x78(%rbp)
jmp 0xce1d
cmpl $0x0, -0x40(%rbp)
je 0xcd81
leaq -0xb0(%rbp), %rdi
movq -0x48(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x58(%rbp), %rax
subq %rax, %rdx
movq -0x48(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq 0x50(%rax,%rcx,8), %rcx
movq -0x58(%rbp), %rax
subq %rax, %rcx
subq $0x1, %rcx
leaq 0x11581(%rip), %rsi     # 0x1e2cf
movb $0x0, %al
callq 0x45d0
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rax
movl -0x60(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq -0xb0(%rbp), %rdx
xorl %ecx, %ecx
callq 0x4450
movq %rax, -0x78(%rbp)
jmp 0xce1b
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movslq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq -0x58(%rbp), %rdx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movslq -0x60(%rbp), %rdx
movq 0x50(%rcx,%rdx,8), %rcx
movq -0x58(%rbp), %rdx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movb (%rax), %al
movb %al, -0xb1(%rbp)
movq -0xc8(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rax
movl -0x60(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
movq -0xc0(%rbp), %rdx
xorl %ecx, %ecx
callq 0x4450
movq %rax, -0x78(%rbp)
movb -0xb1(%rbp), %cl
movq -0xc8(%rbp), %rax
movb %cl, (%rax)
jmp 0xce1d
cmpq $0x0, -0x78(%rbp)
jne 0xce5c
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rax
movl -0x60(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x11497(%rip), %rsi     # 0x1e2d7
leaq 0x10429(%rip), %rcx     # 0x1d270
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x4500
movl $0x1, -0x4(%rbp)
jmp 0xce81
jmp 0xce5e
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0xcc99
movq -0x18(%rbp), %rax
leaq 0x11456(%rip), %rcx     # 0x1e2cd
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)