// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movq %rdi, %r14
movq %rsi, 0x8(%rsp)
movq 0x280(%rdi), %r13
movb (%rsi), %bpl
testb %bpl, %bpl
je 0x113e8
callq 0x4640
movq (%rax), %rcx
movl $0x1, %r12d
movq %rbx, %rax
movsbq %bpl, %rdx
movzwl (%rcx,%rdx,2), %edx
btl $0xd, %edx
adcq $0x0, %r12
movb 0x1(%rax), %bpl
incq %rax
testb %bpl, %bpl
jne 0x113ca
jmp 0x113f1
movl $0x1, %r12d
movq %rbx, %rax
leaq 0x8(,%r12,8), %r15
subl %ebx, %eax
leal (%rax,%r15), %esi
incl %esi
leaq 0x6032(%rip), %rdx      # 0x1743a
movq %r13, %rdi
movl $0x176, %ecx            # imm = 0x176
callq 0x44c0
movq %rax, %rbx
movq 0x8(%rsp), %rsi
cmpb $0x0, (%rsi)
je 0x114c4
movq %r13, 0x18(%rsp)
movq %rbx, %r13
addq %r15, %r13
testq %r12, %r12
movq $-0x1, %r15
cmovnsq %r12, %r15
incq %r15
xorl %ebp, %ebp
movq %r14, %rdi
leaq 0x30(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rsp, %r8
leaq 0x14(%rsp), %r9
callq 0x4360
testl %eax, %eax
jne 0x114ee
movq 0x30(%rsp), %rsi
cmpb $0x0, (%rsi)
je 0x114c6
cmpq %rbp, %r15
je 0x1150f
movq %r13, (%rbx,%rbp,8)
cmpl $0x0, 0x14(%rsp)
movq (%rsp), %rdx
je 0x114a1
movq %r13, %rdi
callq 0x40a0
movq (%rsp), %rax
addq %rax, %r13
incq %r13
movb $0x0, -0x1(%r13)
jmp 0x114b5
movl %edx, %edi
movq %r13, %rdx
callq 0x4160
movq (%rsp), %rax
addq %rax, %r13
incq %r13
incq %rbp
movq 0x8(%rsp), %rsi
cmpb $0x0, (%rsi)
jne 0x11444
jmp 0x114c6
xorl %ebp, %ebp
movq $0x0, (%rbx,%rbp,8)
movq 0x20(%rsp), %rax
movq %rbx, (%rax)
movq 0x28(%rsp), %rax
movl %ebp, (%rax)
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r12d
leaq 0x5f42(%rip), %rdx      # 0x1743a
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl $0x17b, %ecx            # imm = 0x17B
callq 0x4280
movl %r12d, %eax
jmp 0x114df
leaq 0x5f24(%rip), %rdx      # 0x1743a
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl $0x182, %ecx            # imm = 0x182
callq 0x4280
leaq 0x5f15(%rip), %rsi      # 0x17444
movq %r14, %rdi
xorl %edx, %edx
callq 0x44e0
movl $0x1, %eax
jmp 0x114df