// File: /workspace/github_cpp_makefile_star2_O2/IsaacLaw12[P]RayTracer/./src/WaveObject.cpp
// Function: WaveObject::find_min_max(Eigen::Matrix<double, 3, 1, 0, 3, 1>&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&)
void WaveObject::find_min_max(Eigen::Vector3d &min, Eigen::Vector3d &max){
    // On the bounded 2d wave space find the min and max x,y,z values
    double safety_margin = 2;
    for (int dir_one=0; dir_one<=1; dir_one++){
        for (int dir_two=0; dir_two<=1; dir_two++){
            Eigen::Vector3d current = first_corner + dir_one*side_len_one*direction_one
                                                   + dir_two*side_len_two*direction_two;
            for (int i=1; i<=2; i++){
                int sign = 3 - i * 2;  // Extract 1 or -1
                Eigen::Vector3d with_wave = current + sign * surface_normal * wave_height * safety_margin;
                extract_vector_extremes(with_wave, min, max);
            }

        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdx, 0x58(%rsp)
movq %rsi, %r14
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
leaq 0x60(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x1e0(%rdi), %rax
movq %rax, 0x38(%rsp)
leaq 0x210(%rdi), %rax
movq %rax, 0x30(%rsp)
leaq 0x228(%rdi), %rax
movq %rax, 0x28(%rsp)
leaq 0x240(%rdi), %r13
movq %rdi, 0x40(%rsp)
leaq 0x1c0(%rdi), %rbp
xorl %eax, %eax
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x198(%rsp), %r12
leaq 0x1c0(%rsp), %r15
cmpl $0x2, %eax
je 0x14fc9
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movl %eax, 0x1c(%rsp)
cmpl $0x2, %ecx
je 0x14fae
movl %ecx, 0x20(%rsp)
movq 0x40(%rsp), %rbx
movsd 0x1d0(%rbx), %xmm0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x198(%rsp)
leaq 0x130(%rsp), %rdi
movq %r12, %rsi
movq 0x30(%rsp), %rdx
callq 0x5423
movsd 0x140(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x148(%rsp), %rax
movq %rax, 0x48(%rsp)
movsd 0x1d8(%rbx), %xmm0
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movq %r15, %rdi
leaq 0x68(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x5423
movq 0x38(%rsp), %rax
movq %rax, 0xa8(%rsp)
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0xc0(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0xc8(%rsp)
movsd 0x1d0(%rsp), %xmm0
movsd %xmm0, 0xf0(%rsp)
movq 0x1d8(%rsp), %rax
movq %rax, 0xf8(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x15642
pushq $0x4
popq %rax
movl %eax, %ebx
testl %ebx, %ebx
je 0x14f8b
leal -0x3(%rbx), %eax
movl %eax, 0x24(%rsp)
movq %r12, %rdi
leaq 0x24(%rsp), %rsi
movq %r13, %rdx
callq 0x62ea
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x1530e
leaq 0x130(%rsp), %rdi
movq %r15, %rsi
leaq 0x60(%rsp), %rdx
callq 0x1536a
leaq 0x118(%rsp), %rax
movq %rax, 0xa0(%rsp)
movsd 0x150(%rsp), %xmm0
movsd %xmm0, 0xc8(%rsp)
movq 0x158(%rsp), %rax
movq %rax, 0xd0(%rsp)
movsd 0x170(%rsp), %xmm0
movsd %xmm0, 0xe8(%rsp)
movsd 0x188(%rsp), %xmm0
movsd %xmm0, 0x100(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x1568c
movupd 0x68(%rsp), %xmm0
movapd %xmm0, 0x80(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x90(%rsp)
leaq 0x80(%rsp), %rsi
movq %r14, %rdx
movq 0x58(%rsp), %rcx
callq 0x14fdc
addl $-0x2, %ebx
jmp 0x14ea8
movsd 0x10(%rsp), %xmm0
addsd 0x3097(%rip), %xmm0     # 0x18030
movsd %xmm0, 0x10(%rsp)
movl 0x20(%rsp), %ecx
incl %ecx
movl 0x1c(%rsp), %eax
jmp 0x14dc3
movsd 0x8(%rsp), %xmm0
addsd 0x3074(%rip), %xmm0     # 0x18030
movsd %xmm0, 0x8(%rsp)
incl %eax
jmp 0x14daa
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop