// File: /workspace/github_c_makefile_star2_O1/haxlang[P]hax/haxEnv.c
// Function: HaxSetupEnv
void
HaxSetupEnv(
    Hax_Interp *interp,		/* Interpreter whose "env" array is to be
				 * managed. */
    UnixClientData *unixClientData	/* Unix Client Data */)
{
    Hax_Memoryp *memoryp;
    int i;

    /*
     * First, initialize our environment-related information, if
     * necessary.
     */

    if (unixClientData->environSize != 0) {
	Hax_Panic ((char *) "Unexpected initialized environ");
    }

    EnvInit(interp, unixClientData);

    /*
     * Next, get the pointer to Memoryp.
     */

    memoryp = Hax_GetMemoryp(interp);

    /*
     * Store the environment variable values into the interpreter's
     * "env" array, and arrange for us to be notified on future
     * writes and unsets to that array.
     */

    (void) Hax_UnsetVar2(interp, (char *) "env", (char *) NULL, HAX_GLOBAL_ONLY);
    for (i = 0; ; i++) {
	char *p, *p2;

	p = unixClientData->haxEnviron[i];
	if (p == NULL) {
	    break;
	}
	for (p2 = p; *p2 != '='; p2++) {
	    /* Empty loop body. */
	}
	*p2 = 0;
	(void) Hax_SetVar2(interp, (char *) "env", p, p2+1, HAX_GLOBAL_ONLY);
	*p2 = '=';
    }
    Hax_TraceVar2(interp, (char *) "env", (char *) NULL,
	    HAX_GLOBAL_ONLY | HAX_TRACE_WRITES | HAX_TRACE_UNSETS,
	    EnvTraceProc, (ClientData) unixClientData);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, 0x60(%rsi)
je 0x3751
leaq 0x58b6(%rip), %rdi      # 0x9000
xorl %eax, %eax
callq 0x3130
cmpl $0x0, 0x60(%rbx)
je 0x3765
leaq 0x595e(%rip), %rdi      # 0x90bc
xorl %eax, %eax
callq 0x3130
movq %r14, (%rsp)
movq %r14, %rdi
callq 0x3540
movq %rax, %r15
movq 0x9855(%rip), %r13      # 0xcfd0
movq (%r13), %rcx
movq $-0x1, %rbp
movl $0x4, %eax
incl %eax
cmpq $0x0, 0x8(%rcx,%rbp,8)
leaq 0x1(%rbp), %rbp
jne 0x378b
movl %eax, 0x60(%rbx)
movl %eax, %esi
shlq $0x3, %rsi
leaq 0x589b(%rip), %rdx      # 0x9044
movq %r15, %rdi
movl $0x1ff, %ecx            # imm = 0x1FF
callq 0x34c0
movq %rax, 0x68(%rbx)
testq %rbp, %rbp
je 0x380f
movl %ebp, %r14d
xorl %r12d, %r12d
movq (%r13), %rax
movq (%rax,%r12,8), %rdi
callq 0x3190
leaq 0x1(%rax), %rsi
movq %r15, %rdi
leaq 0x5864(%rip), %rdx      # 0x9044
movl $0x202, %ecx            # imm = 0x202
callq 0x34c0
movq 0x68(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x68(%rbx), %rax
movq (%rax,%r12,8), %rdi
movq (%r13), %rax
movq (%rax,%r12,8), %rsi
callq 0x30e0
incq %r12
cmpq %r12, %r14
jne 0x37c5
movq 0x68(%rbx), %rax
movq $0x0, (%rax,%rbp,8)
movq (%rsp), %r14
movq %r14, %rdi
callq 0x3540
leaq 0x57f1(%rip), %rsi      # 0x901f
movq %r14, %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x3210
movq 0x68(%rbx), %rax
movq (%rax), %rdx
testq %rdx, %rdx
sete %bpl
je 0x38a1
xorl %r13d, %r13d
leaq 0x57c8(%rip), %r15      # 0x901f
movq %rdx, %r12
cmpb $0x3d, (%r12)
leaq 0x1(%r12), %r12
jne 0x385a
movb $0x0, -0x1(%r12)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rcx
movl $0x1, %r8d
callq 0x30c0
movb $0x3d, -0x1(%r12)
testb $0x1, %bpl
jne 0x38a1
movq 0x68(%rbx), %rax
movq 0x8(%rax,%r13,8), %rdx
incq %r13
testq %rdx, %rdx
sete %bpl
jne 0x3857
leaq 0x5777(%rip), %rsi      # 0x901f
leaq 0x20(%rip), %r8         # 0x38cf
movq %r14, %rdi
xorl %edx, %edx
movl $0x61, %ecx
movq %rbx, %r9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31a0