// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x280(%rax), %rax
movq %rax, -0x38(%rbp)
movq $0x1, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x17e67
callq 0x4630
movq (%rax), %rax
movq -0x48(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x17e57
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x17e59
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x17e1f
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rax
shlq $0x3, %rax
movq -0x48(%rbp), %rcx
movq -0x18(%rbp), %rdx
subq %rdx, %rcx
addq %rcx, %rax
addq $0x1, %rax
movl %eax, %eax
movl %eax, %esi
leaq 0x798e(%rip), %rdx      # 0x1f82a
movl $0x176, %ecx            # imm = 0x176
callq 0x44c0
movq %rax, -0x40(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x40(%rbp), %rax
movq -0x58(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x17ff1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq -0x18(%rbp), %rcx
leaq -0x68(%rbp), %r8
leaq -0x50(%rbp), %r9
callq 0x4350
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x17f1f
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq 0x7920(%rip), %rdx      # 0x1f82a
movl $0x17b, %ecx            # imm = 0x17B
callq 0x4260
movl -0x4c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1801f
movq -0x70(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x17f30
jmp 0x17ff1
movq -0x60(%rbp), %rax
cmpq -0x58(%rbp), %rax
jl 0x17f73
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq 0x78e1(%rip), %rdx      # 0x1f82a
movl $0x182, %ecx            # imm = 0x182
callq 0x4260
movq -0x10(%rbp), %rdi
leaq 0x78d6(%rip), %rsi      # 0x1f834
xorl %eax, %eax
movl %eax, %edx
callq 0x44e0
movl $0x1, -0x4(%rbp)
jmp 0x1801f
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpl $0x0, -0x50(%rbp)
je 0x17fbb
movq -0x48(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
callq 0x4080
movq -0x68(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movb $0x0, (%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x17fde
movq -0x68(%rbp), %rax
movl %eax, %edi
movq -0x70(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x4140
movq -0x68(%rbp), %rax
addq $0x1, %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x17fe0
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x17ec5
movq -0x40(%rbp), %rax
movq -0x60(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)