// File: /workspace/github_c_makefile_star2_O3/haxlang[P]hax/haxGlob.c
// Function: AppendResult
static void
AppendResult(
    Hax_Interp *interp,		/* Interpreter whose result should be
				 * appended to. */
    char *dir,			/* Name of directory, without trailing
				 * slash except for root directory. */
    char *separator,		/* Separator string so use between dir and
				 * name:  either "/" or "" depending on dir. */
    char *name,			/* Name of file withing directory (NOT
				 * necessarily null-terminated!). */
    int nameLength		/* Number of characters in name. */)
{
    Hax_Memoryp *memoryp;
    int dirFlags, nameFlags;
    char *p, saved;

    memoryp = Hax_GetMemoryp (interp);

    /*
     * Next, see if we can put together a valid list element from dir
     * and name by calling Hax_AppendResult.
     */

    if (*dir == 0) {
	dirFlags = 0;
    } else {
	Hax_ScanElement(dir, &dirFlags);
    }
    saved = name[nameLength];
    name[nameLength] = 0;
    Hax_ScanElement(name, &nameFlags);
    if ((dirFlags == 0) && (nameFlags == 0)) {
	if (*interp->result != 0) {
	    Hax_AppendResult(interp, " ", dir, separator, name, (char *) NULL);
	} else {
	    Hax_AppendResult(interp, dir, separator, name, (char *) NULL);
	}
	name[nameLength] = saved;
	return;
    }

    /*
     * This name has weird characters in it, so we have to convert it to
     * a list element.  To do that, we have to merge the characters
     * into a single name.  To do that, malloc a buffer to hold everything.
     */

    p = (char *) ckalloc(memoryp, (unsigned) (strlen(dir) + strlen(separator)
	    + nameLength + 1));
    sprintf(p, "%s%s%s", dir, separator, name);
    name[nameLength] = saved;
    Hax_AppendElement(interp, p, 0);
    ckfree(memoryp, p);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movq %rcx, %rbx
movq %rdx, 0x8(%rsp)
movq %rsi, %r12
movq %rdi, %r14
callq 0x3540
movq %rax, %r15
cmpb $0x0, (%r12)
je 0x4685
leaq 0x4(%rsp), %rsi
movq %r12, %rdi
callq 0x3100
jmp 0x468d
movl $0x0, 0x4(%rsp)
movslq %ebp, %r13
movb (%rbx,%r13), %al
movb %al, 0x3(%rsp)
movb $0x0, (%rbx,%r13)
leaq 0x14(%rsp), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x3100
movl (%rbp), %eax
orl 0x4(%rsp), %eax
jne 0x46eb
movb 0x3(%rsp), %r15b
movq (%r14), %rax
cmpb $0x0, (%rax)
je 0x4769
leaq 0x3da5(%rip), %rsi      # 0x8473
movq %r14, %rdi
movq %r12, %rdx
movq 0x8(%rsp), %rcx
movq %rbx, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
jmp 0x4781
movq %r12, %rdi
callq 0x3190
movq %rax, %rbp
movq 0x8(%rsp), %rdi
callq 0x3190
addl %ebp, %eax
leal (%rax,%r13), %esi
incl %esi
leaq 0x3a2a(%rip), %rdx      # 0x8139
movq %r15, %rdi
movl $0x75, %ecx
callq 0x34c0
movq %rax, %rbp
leaq 0x3ac9(%rip), %rsi      # 0x81ef
movq %rax, %rdi
movq %r12, %rdx
movq 0x8(%rsp), %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x35a0
movb 0x3(%rsp), %al
movb %al, (%rbx,%r13)
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3070
movq %r15, %rdi
movq %rbp, %rsi
leaq 0x39dc(%rip), %rdx      # 0x8139
movl $0x79, %ecx
callq 0x31f0
jmp 0x4785
movq %r14, %rdi
movq %r12, %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x3510
movb %r15b, (%rbx,%r13)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq