// File: /workspace/github_cpp_makefile_star2_O3/IsaacLaw12[P]RayTracer/./src/WaveObject.cpp
// Function: WaveObject::generate_waves(int, int)
void WaveObject::generate_waves(int num_waves, int random_seed){
    /*
    Populate component_waves with waves with random amplitude, frequency, and angle
    */
    std::default_random_engine angle_generator(random_seed);
    std::uniform_real_distribution<double> random_angle(0, 2*M_PI);

    std::default_random_engine freq_generator(random_seed * 2);
    std::uniform_real_distribution<double> random_freq(2, 6);

    std::default_random_engine ampl_generator(random_seed * 3);
    std::uniform_real_distribution<double> random_ampl(.5, 1);

    std::default_random_engine pc_generator(random_seed *4);
    std::uniform_real_distribution<double> random_pc(.5, 4);

    for(int i=0; i<num_waves; i++){
        wave_parameters current;
        current.amplitude = random_ampl(ampl_generator);
        current.frequency = random_freq(freq_generator);
        current.direction = get_wave_direction(random_angle(angle_generator));
        current.phase_constant = random_pc(pc_generator);
        component_waves.push_back(current);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %esi, %ebx
movslq %edx, %rcx
movabsq $0x200000005, %r8       # imm = 0x200000005
movq %rcx, %rax
mulq %r8
movq %rcx, %rax
subq %rdx, %rax
shrq %rax
addq %rdx, %rax
shrq $0x1e, %rax
movq %rax, %rdx
shlq $0x1f, %rdx
subq %rdx, %rax
leaq (%rcx,%rax), %rdx
cmpq $0x1, %rdx
adcq %rcx, %rax
movq %rdi, %r14
movq %rax, 0x28(%rsp)
leal (%rcx,%rcx), %eax
movslq %eax, %rsi
movq %rsi, %rax
mulq %r8
movq %rsi, %rax
subq %rdx, %rax
shrq %rax
addq %rdx, %rax
shrq $0x1e, %rax
movq %rax, %rdx
shlq $0x1f, %rdx
subq %rdx, %rax
leaq (%rsi,%rax), %rdx
cmpq $0x1, %rdx
adcq %rsi, %rax
movq %rax, 0x20(%rsp)
leal (%rcx,%rcx,2), %eax
movslq %eax, %rsi
movq %rsi, %rax
mulq %r8
movq %rsi, %rdi
subq %rdx, %rdi
shrq %rdi
addq %rdx, %rdi
shrq $0x1e, %rdi
movq %rdi, %rax
shlq $0x1f, %rax
subq %rax, %rdi
leaq (%rsi,%rdi), %rax
cmpq $0x1, %rax
adcq %rsi, %rdi
shll $0x2, %ecx
movslq %ecx, %rcx
movq %rcx, %rax
mulq %r8
movq %rdi, 0x18(%rsp)
movq %rcx, %rax
subq %rdx, %rax
shrq %rax
addq %rdx, %rax
shrq $0x1e, %rax
movq %rax, %rdx
shlq $0x1f, %rdx
subq %rdx, %rax
leaq (%rcx,%rax), %rdx
cmpq $0x1, %rdx
adcq %rcx, %rax
movq %rax, 0x10(%rsp)
testl %ebx, %ebx
jle 0x12f1c
leaq 0x48(%rsp), %r13
leaq 0x1a0(%r14), %rax
movq %rax, 0x8(%rsp)
leaq 0x28(%rsp), %rbp
leaq 0x60(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0x18(%rsp), %rdi
callq 0x13aff
movsd 0x5aae(%rip), %xmm1     # 0x188f0
mulsd %xmm1, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x13aff
mulsd 0x5a96(%rip), %xmm0     # 0x188f8
addsd 0x5a96(%rip), %xmm0     # 0x18900
movsd %xmm0, 0x50(%rsp)
movq %rbp, %rdi
callq 0x13aff
mulsd 0x5a88(%rip), %xmm0     # 0x18908
addsd 0x4098(%rip), %xmm0     # 0x16f20
movq %r15, %rdi
movq %r14, %rsi
callq 0x13868
movaps 0x60(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movq %r12, %rdi
callq 0x13aff
mulsd 0x5a57(%rip), %xmm0     # 0x18910
addsd 0x5a2f(%rip), %xmm0     # 0x188f0
movsd %xmm0, 0x58(%rsp)
movq 0x1a8(%r14), %rsi
cmpq 0x1b0(%r14), %rsi
je 0x12f05
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rsi)
movupd (%r13), %xmm0
movupd %xmm0, 0x18(%rsi)
movq 0x10(%r13), %rax
movq %rax, 0x28(%rsi)
addq $0x30, 0x1a8(%r14)
jmp 0x12f14
movq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x13c48
decl %ebx
jne 0x12e30
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop