// File: /workspace/github_cpp_makefile_star2_O3/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 0x20806
movq %r14, %rdi
callq 0x20806
cmpl $0x0, 0xa518(%rbx)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
je 0x20a5e
cmpl $0x0, 0xafa8(%rsp)
je 0x20a5e
movl 0xa540(%rsp), %eax
testl %eax, %eax
jle 0x20a11
leaq 0x40(%rsp), %rdx
leaq 0x258(%rsp), %rbp
xorl %esi, %esi
leaq 0x44(%rsp), %r12
xorl %ebx, %ebx
imulq $0xa50, %rsi, %r13      # imm = 0xA50
cmpl $0x0, 0xa48(%rdx,%r13)
jle 0x209f5
movq %rsi, 0x10(%rsp)
addq %rdx, %r13
leaq 0x208(%r13), %rax
movq %rax, 0x20(%rsp)
movq %rbp, 0x18(%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 0x209b2
cmpb $0x1, 0xa564(%rsp,%r15,8)
jne 0x209b2
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 0x1a8be(%rip), %rsi     # 0x3b266
movl %r15d, %r8d
movb $0x3, %al
callq 0xa446
incq %r15
cmpq $0x40, %r15
jne 0x20935
incq %r14
movl 0xc(%rsp), %ebx
incl %ebx
movslq 0xa48(%r13), %rax
addq $0x210, %rbp            # imm = 0x210
cmpq %rax, %r14
jl 0x20922
movl 0xa540(%rsp), %eax
leaq 0x40(%rsp), %rdx
movq 0x18(%rsp), %rbp
movq 0x10(%rsp), %rsi
incq %rsi
movslq %eax, %rcx
movl $0xa50, %edi            # imm = 0xA50
addq %rdi, %rbp
addq %rdi, %r12
cmpq %rcx, %rsi
jl 0x208f0
jmp 0x20a13
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 0x1a85c(%rip), %rsi     # 0x3b2ac
movl $0x3, %edi
movl %ebx, %edx
movb $0x6, %al
callq 0xa446
movl %ebx, %eax
addq $0x14a68, %rsp          # imm = 0x14A68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq