// File: FreeSlave[P]vhlt/hlrad/qradutil.cpp
// Function: getAdjustedPlaneFromFaceNumber(unsigned int, dplane_t*)
void getAdjustedPlaneFromFaceNumber(unsigned int faceNumber, dplane_t* plane)
{
    dface_t*        face = &g_dfaces[faceNumber];
    const vec_t*    face_offset = g_face_offset[faceNumber];

    plane->type = (planetypes)0;
    
    if (face->side)
    {
        vec_t dist;

        VectorCopy(backplanes[face->planenum].normal, plane->normal);
        dist = DotProduct(plane->normal, face_offset);
        plane->dist = backplanes[face->planenum].dist + dist;
    }
    else
    {
        vec_t dist;

        VectorCopy(g_dplanes[face->planenum].normal, plane->normal);
        dist = DotProduct(plane->normal, face_offset);
        plane->dist = g_dplanes[face->planenum].dist + dist;
    }
}

// Assembly:
movl %edi, -0x4(%rsp)
movq %rsi, -0x10(%rsp)
movl -0x4(%rsp), %eax
movl %eax, %ecx
leaq 0x1b893da(%rip), %rax   # 0x1be6410
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rsp)
movl -0x4(%rsp), %eax
movl %eax, %ecx
leaq 0x54109c1(%rip), %rax   # 0x546da10
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rsp)
movq -0x10(%rsp), %rax
movl $0x0, 0x10(%rax)
movq -0x18(%rsp), %rax
cmpw $0x0, 0x2(%rax)
je 0x5d16c
movq -0x18(%rsp), %rax
movzwl (%rax), %eax
movl %eax, %ecx
leaq 0x5532b68(%rip), %rax   # 0x558fbf0
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
movq -0x10(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
movzwl (%rax), %eax
movl %eax, %ecx
leaq 0x5532b43(%rip), %rax   # 0x558fbf0
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
movq -0x10(%rsp), %rax
movss %xmm0, 0x4(%rax)
movq -0x18(%rsp), %rax
movzwl (%rax), %eax
movl %eax, %ecx
leaq 0x5532b1c(%rip), %rax   # 0x558fbf0
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm0
movq -0x10(%rsp), %rax
movss %xmm0, 0x8(%rax)
movq -0x10(%rsp), %rax
movss (%rax), %xmm1
movq -0x20(%rsp), %rax
movss (%rax), %xmm2
movq -0x10(%rsp), %rax
movss 0x4(%rax), %xmm0
movq -0x20(%rsp), %rax
mulss 0x4(%rax), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movq -0x10(%rsp), %rax
movss 0x8(%rax), %xmm0
movq -0x20(%rsp), %rax
movss 0x8(%rax), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x24(%rsp)
movq -0x18(%rsp), %rax
movzwl (%rax), %eax
movl %eax, %ecx
leaq 0x5532aa5(%rip), %rax   # 0x558fbf0
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss 0xc(%rax), %xmm0
addss -0x24(%rsp), %xmm0
movq -0x10(%rsp), %rax
movss %xmm0, 0xc(%rax)
jmp 0x5d25c
movq -0x18(%rsp), %rax
movzwl (%rax), %eax
movl %eax, %ecx
leaq 0xb09283(%rip), %rax    # 0xb66400
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
movq -0x10(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
movzwl (%rax), %eax
movl %eax, %ecx
leaq 0xb0925e(%rip), %rax    # 0xb66400
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
movq -0x10(%rsp), %rax
movss %xmm0, 0x4(%rax)
movq -0x18(%rsp), %rax
movzwl (%rax), %eax
movl %eax, %ecx
leaq 0xb09237(%rip), %rax    # 0xb66400
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm0
movq -0x10(%rsp), %rax
movss %xmm0, 0x8(%rax)
movq -0x10(%rsp), %rax
movss (%rax), %xmm1
movq -0x20(%rsp), %rax
movss (%rax), %xmm2
movq -0x10(%rsp), %rax
movss 0x4(%rax), %xmm0
movq -0x20(%rsp), %rax
mulss 0x4(%rax), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movq -0x10(%rsp), %rax
movss 0x8(%rax), %xmm0
movq -0x20(%rsp), %rax
movss 0x8(%rax), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x28(%rsp)
movq -0x18(%rsp), %rax
movzwl (%rax), %eax
movl %eax, %ecx
leaq 0xb091c0(%rip), %rax    # 0xb66400
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movss 0xc(%rax), %xmm0
addss -0x28(%rsp), %xmm0
movq -0x10(%rsp), %rax
movss %xmm0, 0xc(%rax)
retq
nopl (%rax)