// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxUtil.c
// Function: Hax_SplitList
int
Hax_SplitList(
    Hax_Interp *interp,		/* Interpreter to use for error reporting. */
    char *list,			/* Pointer to string with list structure. */
    int *argcPtr,		/* Pointer to location to fill in with
				 * the number of elements in the list. */
    char ***argvPtr		/* Pointer to place to store pointer to array
				 * of pointers to list elements. */)
{
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    char **argv;
    char *p;
    int result, brace;
    long int size, i, elSize;
    char *element;

    /*
     * Figure out how much space to allocate.  There must be enough
     * space for both the array of pointers and also for a copy of
     * the list.  To estimate the number of pointers needed, count
     * the number of space characters in the list.
     */

    for (size = 1, p = list; *p != 0; p++) {
	if (isspace(*p)) {
	    size++;
	}
    }
    size++;			/* Leave space for final NULL pointer. */
    argv = (char **) ckalloc(memoryp, (unsigned)
	    ((size * sizeof(char *)) + (p - list) + 1));
    for (i = 0, p = ((char *) argv) + size*sizeof(char *);
	    *list != 0; i++) {
	result = HaxFindElement(interp, list, &element, &list, &elSize, &brace);
	if (result != HAX_OK) {
	    ckfree(memoryp, (char *) argv);
	    return result;
	}
	if (*element == 0) {
	    break;
	}
	if (i >= size) {
	    ckfree(memoryp, (char *) argv);
	    Hax_SetResult(interp, (char *) "internal error in Hax_SplitList",
		    HAX_STATIC);
	    return HAX_ERROR;
	}
	argv[i] = p;
	if (brace) {
	    strncpy(p, element, elSize);
	    p += elSize;
	    *p = 0;
	    p++;
	} else {
	    HaxCopyAndCollapse(elSize, element, p);
	    p += elSize+1;
	}
    }

    argv[i] = NULL;
    *argvPtr = argv;
    *argcPtr = i;
    return HAX_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, 0x18(%rsp)
movq 0x280(%rdi), %rbp
pushq $0x1
popq %r12
pushq $0x9
popq %r14
movsbq -0x9(%r15,%r14), %r13
testq %r13, %r13
je 0xff47
callq 0x4660
movq (%rax), %rax
movzwl (%rax,%r13,2), %eax
btl $0xd, %eax
adcq $0x0, %r12
incq %r14
jmp 0xff22
leaq (,%r12,8), %rsi
addl %r14d, %esi
leaq 0x51b5(%rip), %rdx      # 0x1510e
movq %rbp, 0x10(%rsp)
movq %rbp, %rdi
movl $0x176, %ecx            # imm = 0x176
callq 0x44e0
movq %rax, %r13
leaq (%rax,%r12,8), %rbp
addq $0x8, %rbp
xorl %r14d, %r14d
cmpb $0x0, (%r15)
je 0xfff5
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x30(%rsp), %rdx
leaq 0x18(%rsp), %rcx
movq %rsp, %r8
leaq 0xc(%rsp), %r9
callq 0x4380
testl %eax, %eax
jne 0x1000f
movq 0x30(%rsp), %rsi
cmpb $0x0, (%rsi)
je 0xfff5
cmpq %r12, %r14
jg 0x1002a
movq %rbp, (%r13,%r14,8)
cmpl $0x0, 0xc(%rsp)
movq (%rsp), %rdx
je 0xffd7
movq %rbp, %rdi
callq 0x40a0
movq (%rsp), %rax
addq %rax, %rbp
incq %rbp
movb $0x0, -0x1(%rbp)
jmp 0xffeb
movl %edx, %edi
movq %rbp, %rdx
callq 0x4160
movq (%rsp), %rax
addq %rax, %rbp
incq %rbp
incq %r14
movq 0x18(%rsp), %r15
jmp 0xff79
andq $0x0, (%r13,%r14,8)
movq 0x20(%rsp), %rax
movq %r13, (%rax)
movq 0x28(%rsp), %rax
movl %r14d, (%rax)
xorl %eax, %eax
jmp 0x10057
leaq 0x50f8(%rip), %rdx      # 0x1510e
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movl $0x17b, %ecx            # imm = 0x17B
callq 0x4280
jmp 0x10054
leaq 0x50dd(%rip), %rdx      # 0x1510e
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movl $0x182, %ecx            # imm = 0x182
callq 0x4280
leaq 0x50ce(%rip), %rsi      # 0x15118
movq %rbx, %rdi
xorl %edx, %edx
callq 0x4500
pushq $0x1
popq %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq