// File: FreeSlave[P]vhlt/hlrad/mathutil.cpp
// Function: LineSegmentIntersectsBounds_r(float const*, float const*, float const*, float const*, int)
bool LineSegmentIntersectsBounds_r (const vec_t* p1, const vec_t* p2, const vec_t* mins, const vec_t* maxs, int d)
{
	vec_t lmin, lmax;
	const vec_t* tmp;
	vec3_t x1, x2;
	int i;
	d--;
	if (p2[d]<p1[d])
		tmp=p1, p1=p2, p2=tmp;
	if (p2[d]<mins[d] || p1[d]>maxs[d])
		return false;
	if (d==0)
		return true;
	lmin = p1[d]>=mins[d]? 0 : (mins[d]-p1[d])/(p2[d]-p1[d]);
	lmax = p2[d]<=maxs[d]? 1 : (p2[d]-maxs[d])/(p2[d]-p1[d]);
	for (i=0; i<d; ++i)
	{
		x1[i]=(1-lmin)*p1[i]+lmin*p2[i];
		x2[i]=(1-lmax)*p2[i]+lmax*p2[i];
	}
	return LineSegmentIntersectsBounds_r (x1, x2, mins, maxs, d);
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movl %r8d, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x3c(%rsp)
movq 0x50(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
movq 0x58(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x4b849
movq 0x58(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
movq 0x48(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
ucomiss %xmm1, %xmm0
ja 0x4b88b
movq 0x58(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
ucomiss (%rax,%rcx,4), %xmm0
jbe 0x4b895
movb $0x0, 0x67(%rsp)
jmp 0x4ba7b
cmpl $0x0, 0x3c(%rsp)
jne 0x4b8a6
movb $0x1, 0x67(%rsp)
jmp 0x4ba7b
movq 0x58(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x48(%rsp), %rax
movslq 0x3c(%rsp), %rcx
ucomiss (%rax,%rcx,4), %xmm0
jb 0x4b8d0
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
jmp 0x4b916
movq 0x48(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x58(%rsp), %rax
movslq 0x3c(%rsp), %rcx
subss (%rax,%rcx,4), %xmm0
movq 0x50(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
movq 0x58(%rsp), %rax
movslq 0x3c(%rsp), %rcx
subss (%rax,%rcx,4), %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0x8(%rsp)
movss 0x8(%rsp), %xmm0
movss %xmm0, 0x38(%rsp)
movq 0x50(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
ucomiss %xmm1, %xmm0
jb 0x4b955
movss 0x1e6ff(%rip), %xmm0    # 0x6a04c
movss %xmm0, 0x4(%rsp)
jmp 0x4b99b
movq 0x50(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
subss (%rax,%rcx,4), %xmm0
movq 0x50(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
movq 0x58(%rsp), %rax
movslq 0x3c(%rsp), %rcx
subss (%rax,%rcx,4), %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0x4(%rsp)
movss 0x4(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x3c(%rsp), %eax
jge 0x4ba57
movss 0x1e687(%rip), %xmm0    # 0x6a04c
subss 0x38(%rsp), %xmm0
movq 0x58(%rsp), %rax
movslq 0xc(%rsp), %rcx
movss (%rax,%rcx,4), %xmm2
movss 0x38(%rsp), %xmm1
movq 0x50(%rsp), %rax
movslq 0xc(%rsp), %rcx
mulss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movslq 0xc(%rsp), %rax
movss %xmm0, 0x1c(%rsp,%rax,4)
movss 0x1e642(%rip), %xmm0    # 0x6a04c
subss 0x34(%rsp), %xmm0
movq 0x50(%rsp), %rax
movslq 0xc(%rsp), %rcx
movss (%rax,%rcx,4), %xmm2
movss 0x34(%rsp), %xmm1
movq 0x50(%rsp), %rax
movslq 0xc(%rsp), %rcx
mulss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movslq 0xc(%rsp), %rax
movss %xmm0, 0x10(%rsp,%rax,4)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x4b9af
leaq 0x1c(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x40(%rsp), %rcx
movl 0x3c(%rsp), %r8d
callq 0x4b7e0
andb $0x1, %al
movb %al, 0x67(%rsp)
movb 0x67(%rsp), %al
andb $0x1, %al
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)