// File: /workspace/github_c_makefile_star2_O1/haxlang[P]hax/haxCmdIL.c
// Function: Hax_IfCmd
int
Hax_IfCmd(
    ClientData dummy,			/* Not used. */
    Hax_Interp *interp,			/* Current interpreter. */
    int argc,				/* Number of arguments. */
    char **argv				/* Argument strings. */)
{
    int i, result, value;

    i = 1;
    while (1) {
	/*
	 * At this point in the loop, argv and argc refer to an expression
	 * to test, either for the main expression or an expression
	 * following an "elseif".  The arguments after the expression must
	 * be "then" (optional) and a script to execute if the expression is
	 * true.
	 */

	if (i >= argc) {
	    Hax_AppendResult(interp, "wrong # args: no expression after \"",
		    argv[i-1], "\" argument", (char *) NULL);
	    return HAX_ERROR;
	}
	result = Hax_ExprBoolean(interp, argv[i], &value);
	if (result != HAX_OK) {
	    return result;
	}
	i++;
	if ((i < argc) && (strcmp(argv[i], "then") == 0)) {
	    i++;
	}
	if (i >= argc) {
	    Hax_AppendResult(interp, "wrong # args: no script following \"",
		    argv[i-1], "\" argument", (char *) NULL);
	    return HAX_ERROR;
	}
	if (value) {
	    return Hax_Eval(interp, NULL, argv[i], 0, (char **) NULL);
	}

	/*
	 * The expression evaluated to false.  Skip the command, then
	 * see if there is an "else" or "elseif" clause.
	 */

	i++;
	if (i >= argc) {
	    return HAX_OK;
	}
	if ((argv[i][0] == 'e') && (strcmp(argv[i], "elseif") == 0)) {
	    i++;
	    continue;
	}
	break;
    }

    /*
     * Couldn't find a "then" or "elseif" clause to execute.  Check now
     * for an "else" clause.  We know that there's at least one more
     * argument when we get here.
     */

    if (strcmp(argv[i], "else") == 0) {
	i++;
	if (i >= argc) {
	    Hax_AppendResult(interp,
		    "wrong # args: no script following \"else\" argument",
		    (char *) NULL);
	    return HAX_ERROR;
	}
    }
    return Hax_Eval(interp, NULL, argv[i], 0, (char **) NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rsi, %rbx
movl $0x1, %eax
cmpl $0x2, %edx
jl 0x8797
movl %edx, %ebp
movl $0x1, %r13d
movslq %r13d, %rax
movq (%r14,%rax,8), %rsi
movq %rbx, %rdi
leaq 0x4(%rsp), %rdx
callq 0x4650
testl %eax, %eax
jne 0x880d
leal 0x1(%r13), %r15d
cmpl %ebp, %r15d
jge 0x8742
movslq %r15d, %rax
movq (%r14,%rax,8), %rdi
leaq 0xd5c2(%rip), %rsi      # 0x15cf4
callq 0x4310
testl %eax, %eax
jne 0x8742
addl $0x2, %r13d
movl %r13d, %r15d
movl %r15d, %r13d
cmpl %ebp, %r15d
jge 0x87e2
cmpl $0x0, 0x4(%rsp)
jne 0x87f3
leal 0x1(%r13), %r15d
cmpl %ebp, %r15d
jge 0x880b
movslq %r15d, %rax
movq (%r14,%rax,8), %r12
cmpb $0x65, (%r12)
jne 0x87be
movq %r12, %rdi
leaq 0xd59f(%rip), %rsi      # 0x15d1d
callq 0x4310
testl %eax, %eax
jne 0x87be
addl $0x2, %r13d
cmpl %ebp, %r13d
jl 0x86ff
movslq %r13d, %rax
movq -0x8(%r14,%rax,8), %rdx
leaq 0xd52d(%rip), %rsi      # 0x15cd0
leaq 0xd5a6(%rip), %rcx      # 0x15d50
movq %rbx, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4500
movl $0x1, %eax
jmp 0x880d
leaq 0xd55f(%rip), %rsi      # 0x15d24
movq %r12, %rdi
callq 0x4310
testl %eax, %eax
jne 0x87dd
addl $0x2, %r13d
movl %r13d, %r15d
cmpl %ebp, %r13d
jge 0x881c
movslq %r15d, %rax
jmp 0x87f6
movslq %r13d, %rax
movq -0x8(%r14,%rax,8), %rdx
leaq 0xd508(%rip), %rsi      # 0x15cf9
jmp 0x87a3
movslq %r13d, %rax
movq (%r14,%rax,8), %rdx
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45b0
jmp 0x880d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd506(%rip), %rsi      # 0x15d29
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4500
jmp 0x87b7