// File: /workspace/github_cpp_makefile_star2_O1/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: MLH_CopyLight(float const*, float const*)
int MLH_CopyLight (const vec3_t from, const vec3_t to)
{
	int i, j, k, count = 0;
	mdllight_t mlfrom, mlto;
	VectorCopy (from, mlfrom.origin);
	VectorCopy (to, mlto.origin);
	MLH_mdllightCreate (&mlfrom);
	MLH_mdllightCreate (&mlto);
	if (mlfrom.facecount == 0 || mlfrom.face[0].samplecount == 0)
		return -1;
	for (i = 0; i < mlto.facecount; ++i)
		for (j = 0; j < mlto.face[i].samplecount; ++j, ++count)
			for (k = 0; k < ALLSTYLES; ++k)
				if (mlto.face[i].style[k].exist && mlfrom.face[0].style[k].exist)
				{
					VectorCopy (mlfrom.face[0].sample[0].style[k],mlto.face[i].sample[j].style[k]);
					Developer (DEVELOPER_LEVEL_SPAM, "Mdl Light Hack: face (%d) sample (%d) style (%d) position (%f,%f,%f)\n",
						mlto.face[i].num, mlto.face[i].sample[j].num, k, 
						mlto.face[i].sample[j].pos[0], mlto.face[i].sample[j].pos[1], mlto.face[i].sample[j].pos[2]);
				}
	Developer (DEVELOPER_LEVEL_MESSAGE, "Mdl Light Hack: %d sample light copied from (%f,%f,%f) to (%f,%f,%f)\n", 
		count, mlfrom.floor[0], mlfrom.floor[1], mlfrom.floor[2], mlto.floor[0], mlto.floor[1], mlto.floor[2]);
	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x14a68, %rsp          # imm = 0x14A68
movsd (%rdi), %xmm0
leaq 0xa548(%rsp), %rbx
movsd %xmm0, (%rbx)
movss 0x8(%rdi), %xmm0
movss %xmm0, 0x8(%rbx)
movsd (%rsi), %xmm0
leaq 0x28(%rsp), %r14
movsd %xmm0, (%r14)
movss 0x8(%rsi), %xmm0
movss %xmm0, 0x8(%r14)
movq %rbx, %rdi
callq 0x2148e
movq %r14, %rdi
callq 0x2148e
cmpl $0x0, 0xa518(%rbx)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
je 0x216e3
cmpl $0x0, 0xafa8(%rsp)
je 0x216e3
cmpl $0x0, 0xa540(%rsp)
jle 0x21696
leaq 0x40(%rsp), %rax
leaq 0x258(%rsp), %rbp
xorl %ecx, %ecx
leaq 0x44(%rsp), %r12
xorl %ebx, %ebx
movq %rcx, 0x10(%rsp)
imulq $0xa50, %rcx, %r13      # imm = 0xA50
cmpl $0x0, 0xa48(%rax,%r13)
movq %rbp, 0x18(%rsp)
jle 0x21666
addq %rax, %r13
leaq 0x208(%r13), %rax
movq %rax, 0x20(%rsp)
xorl %r14d, %r14d
movl %ebx, 0xc(%rsp)
imulq $0x210, %r14, %rbx      # imm = 0x210
addq 0x20(%rsp), %rbx
xorl %r15d, %r15d
cmpb $0x1, (%r12,%r15,8)
jne 0x21639
cmpb $0x1, 0xa564(%rsp,%r15,8)
jne 0x21639
movq 0xa778(%rsp,%r15,8), %rax
movb (%rax), %al
movq (%rbp,%r15,8), %rcx
movb %al, (%rcx)
movq 0xa778(%rsp,%r15,8), %rax
movb 0x1(%rax), %al
movq (%rbp,%r15,8), %rcx
movb %al, 0x1(%rcx)
movq 0xa778(%rsp,%r15,8), %rax
movb 0x2(%rax), %al
movq (%rbp,%r15,8), %rcx
movb %al, 0x2(%rcx)
movl (%r13), %edx
movl (%rbx), %ecx
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x8(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0xc(%rbx), %xmm2
movl $0x5, %edi
leaq 0x1acb7(%rip), %rsi     # 0x3c2e6
movl %r15d, %r8d
movb $0x3, %al
callq 0xa52e
incq %r15
cmpq $0x40, %r15
jne 0x215bc
incq %r14
movl 0xc(%rsp), %ebx
incl %ebx
movslq 0xa48(%r13), %rax
addq $0x210, %rbp            # imm = 0x210
cmpq %rax, %r14
jl 0x215a9
movq 0x10(%rsp), %rcx
incq %rcx
movslq 0xa540(%rsp), %rax
movq 0x18(%rsp), %rbp
movl $0xa50, %edx            # imm = 0xA50
addq %rdx, %rbp
addq %rdx, %r12
cmpq %rax, %rcx
leaq 0x40(%rsp), %rax
jl 0x21577
jmp 0x21698
xorl %ebx, %ebx
xorps %xmm0, %xmm0
cvtss2sd 0xa554(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0xa558(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0xa55c(%rsp), %xmm2
cvtss2sd 0x34(%rsp), %xmm3
cvtss2sd 0x38(%rsp), %xmm4
cvtss2sd 0x3c(%rsp), %xmm5
leaq 0x1ac57(%rip), %rsi     # 0x3c32c
movl $0x3, %edi
movl %ebx, %edx
movb $0x6, %al
callq 0xa52e
movl %ebx, %eax
addq $0x14a68, %rsp          # imm = 0x14A68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq