// File: /workspace/github_cpp_makefile_star2_O2/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 0x28(%rsp), %rbx
movsd %xmm0, (%rbx)
movss 0x8(%rdi), %xmm0
movss %xmm0, 0x8(%rbx)
movsd (%rsi), %xmm0
leaq 0xa548(%rsp), %r14
movsd %xmm0, (%r14)
movss 0x8(%rsi), %xmm0
movss %xmm0, 0x8(%r14)
movq %rbx, %rdi
callq 0x1d8ed
movq %r14, %rdi
callq 0x1d8ed
cmpl $0x0, 0xa518(%rbx)
pushq $-0x1
popq %rbp
je 0x1db0f
cmpl $0x0, 0xa88(%rsp)
je 0x1db0f
leaq 0xa778(%rsp), %rbx
xorl %ecx, %ecx
leaq 0xa564(%rsp), %r13
xorl %ebp, %ebp
movslq 0x14a60(%rsp), %rax
cmpq %rax, %rcx
jge 0x1dacf
movq %rcx, 0x10(%rsp)
imulq $0xa50, %rcx, %rax      # imm = 0xA50
leaq 0xa560(%rsp), %rcx
leaq (%rcx,%rax), %r12
addq %rcx, %rax
addq $0x208, %rax            # imm = 0x208
movq %rax, 0x20(%rsp)
movq %rbx, 0x18(%rsp)
xorl %r14d, %r14d
movslq 0xa48(%r12), %rax
cmpq %rax, %r14
jge 0x1dab2
movl %ebp, 0xc(%rsp)
imulq $0x210, %r14, %rbp      # imm = 0x210
addq 0x20(%rsp), %rbp
xorl %r15d, %r15d
cmpq $0x40, %r15
je 0x1da9d
cmpb $0x1, (%r13,%r15,8)
jne 0x1da98
cmpb $0x1, 0x44(%rsp,%r15,8)
jne 0x1da98
movq 0x258(%rsp,%r15,8), %rax
movb (%rax), %al
movq (%rbx,%r15,8), %rcx
movb %al, (%rcx)
movq 0x258(%rsp,%r15,8), %rax
movb 0x1(%rax), %al
movq (%rbx,%r15,8), %rcx
movb %al, 0x1(%rcx)
movq 0x258(%rsp,%r15,8), %rax
movb 0x2(%rax), %al
movq (%rbx,%r15,8), %rcx
movb %al, 0x2(%rcx)
movl (%r12), %edx
movl (%rbp), %ecx
cvtss2sd 0x4(%rbp), %xmm0
cvtss2sd 0x8(%rbp), %xmm1
cvtss2sd 0xc(%rbp), %xmm2
pushq $0x5
popq %rdi
leaq 0x18798(%rip), %rsi     # 0x36226
movl %r15d, %r8d
movb $0x3, %al
callq 0x9045
incq %r15
jmp 0x1da24
incq %r14
movl 0xc(%rsp), %ebp
incl %ebp
addq $0x210, %rbx            # imm = 0x210
jmp 0x1da00
movq 0x10(%rsp), %rcx
incq %rcx
movq 0x18(%rsp), %rbx
movl $0xa50, %eax            # imm = 0xA50
addq %rax, %rbx
addq %rax, %r13
jmp 0x1d9c1
cvtss2sd 0x34(%rsp), %xmm0
cvtss2sd 0x38(%rsp), %xmm1
cvtss2sd 0x3c(%rsp), %xmm2
cvtss2sd 0xa554(%rsp), %xmm3
cvtss2sd 0xa558(%rsp), %xmm4
cvtss2sd 0xa55c(%rsp), %xmm5
leaq 0x18769(%rip), %rsi     # 0x3626c
pushq $0x3
popq %rdi
movl %ebp, %edx
movb $0x6, %al
callq 0x9045
movl %ebp, %eax
addq $0x14a68, %rsp          # imm = 0x14A68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq