// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxProc.c
// Function: HaxGetFrame
int
HaxGetFrame(
    Hax_Interp *interp,		/* Interpreter in which to find frame. */
    char *string,		/* String describing frame. */
    CallFrame **framePtrPtr	/* Store pointer to frame here (or NULL
				 * if global frame indicated). */)
{
    Interp *iPtr = (Interp *) interp;
    int level, result;
    CallFrame *framePtr;

    if (iPtr->varFramePtr == NULL) {
	iPtr->result = (char *) "already at top level";
	return -1;
    }

    /*
     * Parse string to figure out which level number to go to.
     */

    result = 1;
    if (*string == '#') {
	if (Hax_GetInt(interp, string+1, &level) != HAX_OK) {
	    return -1;
	}
	if (level < 0) {
	    levelError:
	    Hax_AppendResult(interp, "bad level \"", string, "\"",
		    (char *) NULL);
	    return -1;
	}
    } else if (isdigit(*string)) {
	if (Hax_GetInt(interp, string, &level) != HAX_OK) {
	    return -1;
	}
	level = iPtr->varFramePtr->level - level;
    } else {
	level = iPtr->varFramePtr->level - 1;
	result = 0;
    }

    /*
     * Figure out which frame to use, and modify the interpreter so
     * its variables come from that frame.
     */

    if (level == 0) {
	framePtr = NULL;
    } else {
	for (framePtr = iPtr->varFramePtr; framePtr != NULL;
		framePtr = framePtr->callerVarPtr) {
	    if (framePtr->level == level) {
		break;
	    }
	}
	if (framePtr == NULL) {
	    goto levelError;
	}
    }
    *framePtrPtr = framePtr;
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0xc8(%rax)
jne 0x17264
movq -0x28(%rbp), %rax
leaq 0x80d0(%rip), %rcx      # 0x1f325
movq %rcx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x173ad
movl $0x1, -0x30(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x172d5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x1, %rsi
leaq -0x2c(%rbp), %rdx
callq 0x41a0
cmpl $0x0, %eax
je 0x1729d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x173ad
cmpl $0x0, -0x2c(%rbp)
jge 0x172d3
jmp 0x172a5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x6b5d(%rip), %rsi      # 0x1de11
leaq 0x5fb5(%rip), %rcx      # 0x1d270
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x4500
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x173ad
jmp 0x1734a
callq 0x4630
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x1732d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x41a0
cmpl $0x0, %eax
je 0x17317
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x173ad
movq -0x28(%rbp), %rax
movq 0xc8(%rax), %rax
movl 0x50(%rax), %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x17348
movq -0x28(%rbp), %rax
movq 0xc8(%rax), %rax
movl 0x50(%rax), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
jmp 0x1734a
cmpl $0x0, -0x2c(%rbp)
jne 0x1735a
movq $0x0, -0x38(%rbp)
jmp 0x1739c
movq -0x28(%rbp), %rax
movq 0xc8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x1738e
movq -0x38(%rbp), %rax
movl 0x50(%rax), %eax
cmpl -0x2c(%rbp), %eax
jne 0x1737e
jmp 0x1738e
jmp 0x17380
movq -0x38(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x17369
cmpq $0x0, -0x38(%rbp)
jne 0x1739a
jmp 0x172a5
jmp 0x1739c
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)