// File: /workspace/github_c_makefile_star2_O3/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 0x854c
movl %edx, %ebp
movl $0x1, %r13d
leaq 0x4(%rsp), %r15
movslq %r13d, %rax
movq (%r14,%rax,8), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4660
testl %eax, %eax
jne 0x85cb
leal 0x1(%r13), %r12d
cmpl %ebp, %r12d
jge 0x84f9
movslq %r12d, %rax
movq (%r14,%rax,8), %rdi
leaq 0xc667(%rip), %rsi      # 0x14b50
callq 0x4320
testl %eax, %eax
jne 0x84f9
addl $0x2, %r13d
movl %r13d, %r12d
movl %r12d, %r13d
cmpl %ebp, %r12d
jge 0x85a0
cmpl $0x0, 0x4(%rsp)
jne 0x85b1
leal 0x1(%r13), %eax
cmpl %ebp, %eax
jge 0x85c9
cltq
movq (%r14,%rax,8), %r12
cmpb $0x65, (%r12)
jne 0x8573
movq %r12, %rdi
leaq 0xc646(%rip), %rsi      # 0x14b79
callq 0x4320
testl %eax, %eax
jne 0x8573
addl $0x2, %r13d
cmpl %ebp, %r13d
jl 0x84b8
movslq %r13d, %rax
movq -0x8(%r14,%rax,8), %rdx
leaq 0xc5d4(%rip), %rsi      # 0x14b2c
leaq 0xc64d(%rip), %rcx      # 0x14bac
movq %rbx, %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x4510
movl $0x1, %eax
jmp 0x85cb
leaq 0xc606(%rip), %rsi      # 0x14b80
movq %r12, %rdi
callq 0x4320
testl %eax, %eax
jne 0x8596
addl $0x2, %r13d
cmpl %ebp, %r13d
jge 0x85da
movslq %r13d, %rax
movq (%r14,%rax,8), %r12
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
jmp 0x85bd
movslq %r13d, %rax
movq -0x8(%r14,%rax,8), %rdx
leaq 0xc5a6(%rip), %rsi      # 0x14b55
jmp 0x8558
movslq %r13d, %rax
movq (%r14,%rax,8), %rdx
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45c0
jmp 0x85cb
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc5a4(%rip), %rsi      # 0x14b85
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4510
jmp 0x856c