// File: /workspace/github_c_makefile_star2_O3/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 0x3765
leaq 0x48b6(%rip), %rdi      # 0x8000
xorl %eax, %eax
callq 0x3130
cmpl $0x0, 0x60(%rbx)
je 0x3765
leaq 0x495e(%rip), %rdi      # 0x80bc
xorl %eax, %eax
callq 0x3130
movq %r14, (%rsp)
movq %r14, %rdi
callq 0x3540
movq %rax, %r15
movq 0x8855(%rip), %rbp      # 0xbfd0
movq (%rbp), %rcx
movq $-0x1, %r13
movl $0x4, %eax
incl %eax
cmpq $0x0, 0x8(%rcx,%r13,8)
leaq 0x1(%r13), %r13
jne 0x378b
movl %eax, 0x60(%rbx)
movl %eax, %esi
shlq $0x3, %rsi
leaq 0x489b(%rip), %rdx      # 0x8044
movq %r15, %rdi
movl $0x1ff, %ecx            # imm = 0x1FF
callq 0x34c0
movq %rax, 0x68(%rbx)
testq %r13, %r13
je 0x3813
movl %r13d, %r14d
xorl %r12d, %r12d
movq (%rbp), %rax
movq (%rax,%r12,8), %rdi
callq 0x3190
leaq 0x1(%rax), %rsi
movq %r15, %rdi
leaq 0x4864(%rip), %rdx      # 0x8044
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 (%rbp), %rax
movq (%rax,%r12,8), %rsi
callq 0x30e0
incq %r12
cmpq %r12, %r14
jne 0x37c5
movq 0x68(%rbx), %rax
movq $0x0, (%rax,%r13,8)
movq (%rsp), %r13
movq %r13, %rdi
callq 0x3540
leaq 0x47f1(%rip), %rsi      # 0x801f
movq %r13, %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x3210
movq 0x68(%rbx), %rax
movq (%rax), %rdx
testq %rdx, %rdx
je 0x3893
xorl %r14d, %r14d
leaq 0x47cc(%rip), %r15      # 0x801f
movq %rdx, %r12
cmpb $0x3d, (%r12)
leaq 0x1(%r12), %r12
jne 0x3856
movb $0x0, -0x1(%r12)
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rcx
movl $0x1, %r8d
callq 0x30c0
movb $0x3d, -0x1(%r12)
movq 0x68(%rbx), %rax
movq 0x8(%rax,%r14,8), %rdx
incq %r14
testq %rdx, %rdx
jne 0x3853
leaq 0x4785(%rip), %rsi      # 0x801f
leaq 0x20(%rip), %r8         # 0x38c1
movq %r13, %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