// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxCmdAH.c
// Function: Hax_ForeachCmd
int
Hax_ForeachCmd(
    ClientData dummy,			/* Not used. */
    Hax_Interp *interp,			/* Current interpreter. */
    int argc,				/* Number of arguments. */
    char **argv				/* Argument strings. */)
{
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    int listArgc, i, result;
    char **listArgv;

    if (argc != 4) {
	Hax_AppendResult(interp, "wrong # args: should be \"", argv[0],
		" varName list command\"", (char *) NULL);
	return HAX_ERROR;
    }

    /*
     * Break the list up into elements, and execute the command once
     * for each value of the element.
     */

    result = Hax_SplitList(interp, argv[2], &listArgc, &listArgv);
    if (result != HAX_OK) {
	return result;
    }
    for (i = 0; i < listArgc; i++) {
	if (Hax_SetVar(interp, argv[1], listArgv[i], 0) == NULL) {
	    Hax_SetResult(interp, (char *) "couldn't set loop variable",
		    HAX_STATIC);
	    result = HAX_ERROR;
	    break;
	}

	result = Hax_Eval(interp, NULL, argv[3], 0, (char **) NULL);
	if (result != HAX_OK) {
	    if (result == HAX_CONTINUE) {
		result = HAX_OK;
	    } else if (result == HAX_BREAK) {
		result = HAX_OK;
		break;
	    } else if (result == HAX_ERROR) {
		char msg[100];
		sprintf(msg, "\n    (\"foreach\" body line %d)",
			interp->errorLine);
		Hax_AddErrorInfo(interp, msg);
		break;
	    } else {
		break;
	    }
	}
    }
    ckfree(memoryp, (char *) listArgv);
    if (result == HAX_OK) {
	Hax_ResetResult(interp);
    }
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %r15
movq %rsi, %rbx
cmpl $0x4, %edx
jne 0x777e
movq 0x280(%rbx), %r14
movq 0x10(%r15), %rsi
leaq 0x4(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
callq 0x4540
movl %eax, %r12d
testl %eax, %eax
jne 0x77a0
xorl %r13d, %r13d
leaq 0xc098(%rip), %rbp      # 0x137c4
movslq 0x4(%rsp), %rax
cmpq %rax, %r13
jge 0x77b2
movq 0x8(%r15), %rsi
movq 0x8(%rsp), %rax
movq (%rax,%r13,8), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x4470
testq %rax, %rax
je 0x77b7
movq 0x18(%r15), %rdx
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45d0
cmpl $0x4, %eax
ja 0x77ca
movl %eax, %ecx
movslq (%rbp,%rcx,4), %rcx
addq %rbp, %rcx
jmpq *%rcx
incq %r13
jmp 0x772c
movq (%r15), %rdx
leaq 0xc0d8(%rip), %rsi      # 0x13860
leaq 0xc25d(%rip), %rcx      # 0x139ec
movq %rbx, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4520
pushq $0x1
popq %r12
movl %r12d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0x77f7
leaq 0xc245(%rip), %rsi      # 0x13a03
movq %rbx, %rdi
xorl %edx, %edx
callq 0x4500
jmp 0x77f3
movl %eax, %r12d
jmp 0x77f7
movl 0x10(%rbx), %edx
leaq 0xc245(%rip), %rsi      # 0x13a1e
leaq 0x10(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x45f0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4420
pushq $0x1
popq %r12
movq 0x8(%rsp), %rsi
leaq 0xc0cd(%rip), %rdx      # 0x138d0
movq %r14, %rdi
movl $0x259, %ecx            # imm = 0x259
callq 0x4280
testl %r12d, %r12d
jne 0x77a0
movq %rbx, %rdi
callq 0x42d0
xorl %r12d, %r12d
jmp 0x77a0