// File: /workspace/github_c_makefile_star2_O2/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 0x3755
leaq 0x48c6(%rip), %rdi      # 0x8000
xorl %eax, %eax
callq 0x3130
cmpl $0x0, 0x60(%rbx)
je 0x3755
leaq 0x496e(%rip), %rdi      # 0x80bc
xorl %eax, %eax
callq 0x3130
movq %r14, (%rsp)
movq %r14, %rdi
callq 0x3530
movq %rax, %r15
movq 0x8865(%rip), %r13      # 0xbfd0
movq (%r13), %rcx
pushq $-0x1
popq %rbp
pushq $0x4
popq %rax
incl %eax
cmpq $0x0, 0x8(%rcx,%rbp,8)
leaq 0x1(%rbp), %rbp
jne 0x3775
movl %eax, 0x60(%rbx)
movl %eax, %esi
shlq $0x3, %rsi
leaq 0x48b1(%rip), %rdx      # 0x8044
movq %r15, %rdi
movl $0x1ff, %ecx            # imm = 0x1FF
callq 0x34b0
movq %rax, 0x68(%rbx)
movl %ebp, %r14d
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x37f6
movq (%r13), %rax
movq (%rax,%r12,8), %rdi
callq 0x3190
leaq 0x1(%rax), %rsi
movq %r15, %rdi
leaq 0x487a(%rip), %rdx      # 0x8044
movl $0x202, %ecx            # imm = 0x202
callq 0x34b0
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
jmp 0x37aa
movq 0x68(%rbx), %rax
andq $0x0, (%rax,%rbp,8)
movq (%rsp), %r13
movq %r13, %rdi
callq 0x3530
leaq 0x480d(%rip), %r15      # 0x801f
xorl %r14d, %r14d
pushq $0x1
popq %rbp
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x3210
movq 0x68(%rbx), %rax
movq (%rax,%r14,8), %rdx
testq %rdx, %rdx
je 0x3865
movq %rdx, %r12
cmpb $0x3d, (%r12)
leaq 0x1(%r12), %r12
jne 0x3837
movb $0x0, -0x1(%r12)
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rcx
movl %ebp, %r8d
callq 0x30c0
movb $0x3d, -0x1(%r12)
incq %r14
jmp 0x3827
leaq 0x47b3(%rip), %rsi      # 0x801f
leaq 0x1e(%rip), %r8         # 0x3891
pushq $0x61
popq %rcx
movq %r13, %rdi
xorl %edx, %edx
movq %rbx, %r9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31a0