// File: /workspace/github_c_makefile_star2_O1/blakemcbride[P]LISP9/ls9.c
// Function: apply
int apply(int tail) {
	int	n, m, pn, pm, i;
	cell	k, e;

	if (!closurep(Acc))
		error("application of non-function", Acc);
	if (tail) {
		Ep = closure_env(Acc);
		Prog = closure_prog(Acc);
		m = fixval(stackref(Sp));
		n = fixval(stackref(Sp-m-4));
		pm = Sp-m;
		pn = Sp-m-n-4;
		if (n == m) {
			for (i=0; i<=m; i++)
				stackset(pn+i, stackref(pm+i));
			Fp = fixval(stackref(Sp-m-1));
			Sp -= n+2;
		}
		else {
			e = stackref(Sp-m-3);
			k = stackref(Sp-m-2);
			Fp = fixval(stackref(Sp-m-1));
			for (i=0; i<=m; i++)
				stackset(pn+i, stackref(pm+i));
			Sp -= n+2;
			stackset(Sp-1, e);
			stackset(Sp,   k);
		}
	}
	else {
		push(Ep);
		push(cons(mkfix(Ip+1), Prog));
		Ep = closure_env(Acc);
		Prog = closure_prog(Acc);
	}
	return fixval(closure_ip(Acc));
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movslq 0xb9a3(%rip), %rsi      # 0x191c0
testq %rsi, %rsi
js 0xdb2f
movq 0xbb23(%rip), %rax      # 0x19350
testb $0x1, (%rax,%rsi)
je 0xdb2f
movq 0xbb02(%rip), %rax      # 0x19340
cmpl $-0xd, (%rax,%rsi,4)
jne 0xdb2f
testl %edi, %edi
je 0xd959
movq 0xbae9(%rip), %rdi      # 0x19340
movq 0xbaea(%rip), %rax      # 0x19348
movslq 0xb95b(%rip), %rcx      # 0x191c0
movslq (%rax,%rcx,4), %rdx
movslq (%rax,%rdx,4), %rdx
movl (%rdi,%rdx,4), %edx
movl %edx, 0xb95a(%rip)      # 0x191d0
movslq (%rax,%rcx,4), %rcx
movslq (%rax,%rcx,4), %rcx
movslq (%rax,%rcx,4), %rcx
movl (%rdi,%rcx,4), %ecx
movl %ecx, 0xb931(%rip)      # 0x191bc
movq 0xbac6(%rip), %rcx      # 0x19358
movslq 0xb8c3(%rip), %rdx      # 0x1915c
movslq (%rax,%rdx,4), %rdx
leaq (%rcx,%rdx,4), %rbx
movslq 0xb8b8(%rip), %rsi      # 0x19160
movslq (%rbx,%rsi,4), %rdx
movslq (%rax,%rdx,4), %rdx
movl (%rdi,%rdx,4), %r8d
movslq %r8d, %r11
movq %rsi, %r14
subq %r11, %r14
movslq -0x10(%rbx,%r14,4), %rdx
movslq (%rax,%rdx,4), %rdx
movl (%rdi,%rdx,4), %edx
movl %r14d, %ebp
subl %edx, %ebp
addl $-0x4, %ebp
cmpl %r11d, %edx
jne 0xda66
testl %r8d, %r8d
js 0xd91a
movslq %ebp, %r10
movq %r8, %r9
incq %r9
leaq (%rcx,%r10,4), %r10
shlq $0x2, %rsi
shlq $0x2, %r11
subq %r11, %rsi
addq %rcx, %rsi
movslq 0xb85b(%rip), %r11      # 0x1915c
movslq (%rax,%r11,4), %r11
movl (%rsi,%r11,4), %ebx
movl %ebx, (%r10,%r11,4)
addq $0x4, %r10
addq $0x4, %rsi
decq %r9
jne 0xd8fa
movslq 0xb83b(%rip), %rsi      # 0x1915c
movslq (%rax,%rsi,4), %rsi
leaq (%rcx,%rsi,4), %rcx
movl 0xb831(%rip), %esi      # 0x19160
notl %r8d
addl %esi, %r8d
movslq %r8d, %r8
movslq (%rcx,%r8,4), %rcx
movslq (%rax,%rcx,4), %rax
movl (%rdi,%rax,4), %eax
movl %eax, 0xb87f(%rip)      # 0x191c8
subl %edx, %esi
addl $-0x2, %esi
movl %esi, 0xb80c(%rip)      # 0x19160
jmp 0xdb06
movl 0xb871(%rip), %ebx      # 0x191d0
movl %ebx, 0xb80f(%rip)      # 0x19174
movl $0x1, %edi
callq 0xd64a
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, 0xb7fa(%rip)      # 0x19174
movslq 0xb7df(%rip), %rax      # 0x19160
leaq 0x1(%rax), %rcx
movl %ecx, 0xb7d5(%rip)      # 0x19160
movq 0xb9b6(%rip), %rcx      # 0x19348
movslq 0xb7c3(%rip), %rdx      # 0x1915c
movslq (%rcx,%rdx,4), %rcx
shlq $0x2, %rcx
addq 0xb9b0(%rip), %rcx      # 0x19358
movl %ebx, 0x4(%rcx,%rax,4)
movl 0xbfa6(%rip), %edi      # 0x19958
incl %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x1, %edx
callq 0x3162
movl $0xfffffff2, %edi       # imm = 0xFFFFFFF2
movl %eax, %esi
movl $0x1, %edx
callq 0x3162
movl 0xb7e2(%rip), %esi      # 0x191bc
movl %eax, %edi
xorl %edx, %edx
callq 0x3162
movl %eax, %ebx
movl %eax, 0xb789(%rip)      # 0x19174
movl $0x1, %edi
callq 0xd64a
movl %ebp, 0xb779(%rip)      # 0x19174
movslq 0xb75e(%rip), %rax      # 0x19160
leaq 0x1(%rax), %rcx
movl %ecx, 0xb754(%rip)      # 0x19160
movq 0xb935(%rip), %rcx      # 0x19348
movslq 0xb742(%rip), %rdx      # 0x1915c
movslq (%rcx,%rdx,4), %rdx
shlq $0x2, %rdx
addq 0xb92f(%rip), %rdx      # 0x19358
movl %ebx, 0x4(%rdx,%rax,4)
movq 0xb90c(%rip), %rax      # 0x19340
movslq 0xb785(%rip), %rdx      # 0x191c0
movslq (%rcx,%rdx,4), %rsi
movslq (%rcx,%rsi,4), %rsi
movl (%rax,%rsi,4), %esi
movl %esi, 0xb784(%rip)      # 0x191d0
movslq (%rcx,%rdx,4), %rdx
movslq (%rcx,%rdx,4), %rdx
movslq (%rcx,%rdx,4), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0xb75b(%rip)      # 0x191bc
jmp 0xdb06
movl -0xc(%rbx,%r14,4), %r10d
movl -0x8(%rbx,%r14,4), %r9d
movslq -0x4(%rbx,%r14,4), %r11
movslq (%rax,%r11,4), %r11
movl (%rdi,%r11,4), %edi
movl %edi, 0xb745(%rip)      # 0x191c8
testl %r8d, %r8d
js 0xdac4
movslq %ebp, %r11
leal 0x1(%r8), %edi
leaq (%rcx,%r11,4), %r11
shlq $0x2, %rsi
movslq %r8d, %r8
shlq $0x2, %r8
subq %r8, %rsi
addq %rcx, %rsi
movslq 0xb6b1(%rip), %r8       # 0x1915c
movslq (%rax,%r8,4), %r8
movl (%rsi,%r8,4), %ebx
movl %ebx, (%r11,%r8,4)
addq $0x4, %r11
addq $0x4, %rsi
decq %rdi
jne 0xdaa4
movl 0xb696(%rip), %esi      # 0x19160
subl %edx, %esi
addl $-0x2, %esi
movl %esi, 0xb68b(%rip)      # 0x19160
movslq 0xb680(%rip), %rdx      # 0x1915c
movslq (%rax,%rdx,4), %rdx
leaq (%rcx,%rdx,4), %rdx
movslq %esi, %rsi
movl %r10d, -0x4(%rdx,%rsi,4)
movslq 0xb669(%rip), %rdx      # 0x1915c
movslq (%rax,%rdx,4), %rax
leaq (%rcx,%rax,4), %rax
movslq 0xb65e(%rip), %rcx      # 0x19160
movl %r9d, (%rax,%rcx,4)
movq 0xb833(%rip), %rax      # 0x19340
movq 0xb834(%rip), %rcx      # 0x19348
movslq 0xb6a5(%rip), %rdx      # 0x191c0
movslq (%rcx,%rdx,4), %rdx
movslq (%rax,%rdx,4), %rdx
movslq (%rcx,%rdx,4), %rcx
movl (%rax,%rcx,4), %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x6128(%rip), %rdi      # 0x13c5e
callq 0x264c