// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Rectangle.cpp
// Function: gaps::R3Rectangle::Reset(gaps::R3Point const&, gaps::R3Vector const&, gaps::R3Vector const&, double, double)
void R3Rectangle::
Reset(const R3Point& center, 
    const R3Vector& axis0, const R3Vector& axis1, 
    RNLength radius0, RNLength radius1)
{
    // Check axes
    assert(RNIsPositive(axis0.Length()));
    assert(RNIsPositive(axis1.Length()));

    // Normalize and orthogonalize axes
    R3Vector axis[3];
    axis[0] = axis0;
    axis[0].Normalize();
    axis[1] = axis1;
    axis[1].Normalize();
    axis[1] = axis[0] % axis[1];
    axis[1] = axis[1] % axis[0];
    axis[1].Normalize();
    axis[2] = axis[0] % axis[1];
    axis[2].Normalize();

    // Assign radii
    radius[0] = radius0;
    radius[1] = radius1;

    // Sort axes
    R3Vector swap_axis;
    RNScalar swap_radius;
    if (radius[1] > radius[0]) {
      swap_axis = axis[0]; swap_radius = radius[0];
      axis[0] = axis[1]; radius[0] = radius[1];
      axis[1] = swap_axis; radius[1] = swap_radius;
    }

    // Ensure right-handed coordinate system
    axis[2] = axis[0] % axis[1];
    axis[2].Normalize();

    // Set coordinate system
    cs.Reset(center, R3Triad(axis[0], axis[1], axis[2]));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movsd %xmm1, (%rsp)
movsd %xmm0, 0x8(%rsp)
movq %rcx, %r13
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
xorl %r12d, %r12d
leaq (%rsp,%r12), %rdi
addq $0x10, %rdi
callq 0x3d4bc
addq $0x18, %r12
cmpq $0x48, %r12
jne 0x5189f
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x3dc6a
movq %r12, %rdi
callq 0x3d7e0
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x3dc6a
movq %r15, %rdi
callq 0x3d7e0
leaq 0x70(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x3de12
movq %r15, %rdi
movq %r13, %rsi
callq 0x3dc6a
leaq 0x70(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3de12
movq %r15, %rdi
movq %r13, %rsi
callq 0x3dc6a
movq %r15, %rdi
callq 0x3d7e0
leaq 0x70(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x3de12
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x3dc6a
movq %r12, %rdi
callq 0x3d7e0
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x68(%r14)
movsd (%rsp), %xmm0
movsd %xmm0, 0x70(%r14)
leaq 0x58(%rsp), %rdi
callq 0x3d4bc
movsd 0x70(%r14), %xmm0
ucomisd 0x68(%r14), %xmm0
jbe 0x519d1
leaq 0x58(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3dc6a
movsd 0x68(%r14), %xmm0
movsd %xmm0, (%rsp)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3dc6a
movsd 0x70(%r14), %xmm0
movsd %xmm0, 0x68(%r14)
movq %r15, %rdi
movq %r13, %rsi
callq 0x3dc6a
movsd (%rsp), %xmm0
movsd %xmm0, 0x70(%r14)
leaq 0x70(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x3de12
movq %r12, %rdi
movq %r13, %rsi
callq 0x3dc6a
movq %r12, %rdi
callq 0x3d7e0
addq $0x8, %r14
leaq 0x70(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x2ade0
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x2aab8
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq