// File: /workspace/github_c_makefile_star2_O0/FredTheDino[P]Fog/src/engine/renderer/particle_system.cpp
// Function: Renderer::ParticleSystemInt::generate()
Particle ParticleSystemInt::generate() {
    ASSERT(particles, "Trying to use uninitalized/destroyed particle system");

    f32 particle_spawn_size = spawn_size.random();
    f32 particle_spawn_size_deriv = spawn_size_deriv.random();
    f32 particle_die_size = one_size ? particle_spawn_size : die_size.random();
    f32 particle_die_size_deriv = die_size_deriv.random();

    Vec4 particle_spawn_color = V4(spawn_red.random(), spawn_green.random(),
            spawn_blue.random(), spawn_alpha.random());
    f32 particle_spawn_color_deriv = spawn_color_deriv.random();

    Vec4 particle_die_color;
    f32 particle_die_color_deriv;
    if (one_color) {
        particle_die_color = particle_spawn_color;
        particle_die_color_deriv = particle_spawn_color_deriv;
    } else {
        particle_die_color = V4(die_red.random(), die_green.random(),
                die_blue.random(), particle_spawn_color.w);
        particle_die_color_deriv = die_color_deriv.random();
    }

    if (!one_alpha) {
        particle_die_color.w = die_alpha.random();
    }
    return {
        0,
            1.0f / alive_time.random(),
            (b8) keep_alive,
            true,

            rotation.random(),
            angular_velocity.random(),

            position + V2(position_x.random(), position_y.random()),
            rotate(V2(1, 0), velocity_dir.random()) * velocity.random(),
            rotate(V2(1, 0), acceleration_dir.random()) * acceleration.random(),
            damping.random(),

            particle_spawn_size,
            particle_spawn_size_deriv,
            particle_die_size,
            particle_die_size_deriv,
            &progress_func_size,
            V2(width.random(), height.random()),

            particle_spawn_color,
            particle_spawn_color_deriv,
            particle_die_color,
            particle_die_color_deriv,
            &progress_func_color,
            (s16) (num_sprites ?  random_int() % num_sprites : -1),
    };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x90(%rbp)
movq %rdi, -0x88(%rbp)
movq %rsi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, 0x118(%rax)
setne %al
andb $0x1, %al
leaq 0x1718a(%rip), %rdi     # 0x463e3
movl $0x3e, %esi
leaq 0x171a6(%rip), %rdx     # 0x4640b
movzbl %al, %ecx
callq 0xb210
movq -0x80(%rbp), %rdi
addq $0x188, %rdi            # imm = 0x188
callq 0x42250
movq -0x80(%rbp), %rdi
movss %xmm0, -0xc(%rbp)
addq $0x190, %rdi            # imm = 0x190
callq 0x42250
movq -0x80(%rbp), %rax
movss %xmm0, -0x10(%rbp)
cmpb $0x0, 0x12c(%rax)
je 0x2f2b3
movss -0xc(%rbp), %xmm0
movss %xmm0, -0x94(%rbp)
jmp 0x2f2cb
movq -0x80(%rbp), %rdi
addq $0x198, %rdi            # imm = 0x198
callq 0x42250
movss %xmm0, -0x94(%rbp)
movq -0x80(%rbp), %rdi
movss -0x94(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
addq $0x1a0, %rdi            # imm = 0x1A0
callq 0x42250
movq -0x80(%rbp), %rdi
movss %xmm0, -0x18(%rbp)
addq $0x1b8, %rdi            # imm = 0x1B8
callq 0x42250
movq -0x80(%rbp), %rdi
movss %xmm0, -0x98(%rbp)
addq $0x1c0, %rdi            # imm = 0x1C0
callq 0x42250
movq -0x80(%rbp), %rdi
movss %xmm0, -0xa0(%rbp)
addq $0x1c8, %rdi            # imm = 0x1C8
callq 0x42250
movq -0x80(%rbp), %rdi
movss %xmm0, -0x9c(%rbp)
addq $0x1d0, %rdi            # imm = 0x1D0
callq 0x42250
movss -0xa0(%rbp), %xmm1
movss -0x9c(%rbp), %xmm2
movaps %xmm0, %xmm3
movss -0x98(%rbp), %xmm0
callq 0xbc90
movq -0x80(%rbp), %rdi
movlpd %xmm0, -0x28(%rbp)
movlpd %xmm1, -0x20(%rbp)
addq $0x1d8, %rdi            # imm = 0x1D8
callq 0x42250
movq -0x80(%rbp), %rax
movss %xmm0, -0x2c(%rbp)
cmpb $0x0, 0x12a(%rax)
je 0x2f3b0
movq -0x28(%rbp), %rax
movq %rax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x34(%rbp)
movss -0x2c(%rbp), %xmm0
movss %xmm0, -0x40(%rbp)
jmp 0x2f43c
movq -0x80(%rbp), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
callq 0x42250
movq -0x80(%rbp), %rdi
movss %xmm0, -0xa4(%rbp)
addq $0x1e8, %rdi            # imm = 0x1E8
callq 0x42250
movq -0x80(%rbp), %rdi
movss %xmm0, -0xa8(%rbp)
addq $0x1f0, %rdi            # imm = 0x1F0
callq 0x42250
movss -0xa8(%rbp), %xmm1
movaps %xmm0, %xmm2
movss -0xa4(%rbp), %xmm0
movss -0x1c(%rbp), %xmm3
callq 0xbc90
movq -0x80(%rbp), %rdi
movlpd %xmm0, -0x50(%rbp)
movlpd %xmm1, -0x48(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x3c(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x34(%rbp)
addq $0x200, %rdi            # imm = 0x200
callq 0x42250
movss %xmm0, -0x40(%rbp)
movq -0x80(%rbp), %rax
cmpb $0x0, 0x12b(%rax)
jne 0x2f45e
movq -0x80(%rbp), %rdi
addq $0x1f8, %rdi            # imm = 0x1F8
callq 0x42250
movss %xmm0, -0x30(%rbp)
movq -0x80(%rbp), %rdi
movq -0x90(%rbp), %rax
movl $0x0, (%rax)
addq $0x138, %rdi            # imm = 0x138
callq 0x42250
movq -0x90(%rbp), %rax
movq -0x80(%rbp), %rdi
movaps %xmm0, %xmm1
movss 0x15b77(%rip), %xmm0    # 0x45008
movss %xmm0, -0xb8(%rbp)
divss %xmm1, %xmm0
movss %xmm0, 0x4(%rax)
movb 0x129(%rdi), %cl
movb %cl, 0x8(%rax)
movb $0x1, 0x9(%rax)
addq $0x140, %rdi            # imm = 0x140
callq 0x42250
movq -0x90(%rbp), %rax
movq -0x80(%rbp), %rdi
movss %xmm0, 0xc(%rax)
addq $0x148, %rdi            # imm = 0x148
callq 0x42250
movq -0x90(%rbp), %rax
movq -0x80(%rbp), %rdi
movss %xmm0, 0x10(%rax)
movq %rdi, %rax
addq $0x130, %rax            # imm = 0x130
movq %rax, -0xc8(%rbp)
addq $0x150, %rdi            # imm = 0x150
callq 0x42250
movq -0x80(%rbp), %rdi
movss %xmm0, -0xcc(%rbp)
addq $0x158, %rdi            # imm = 0x158
callq 0x42250
movaps %xmm0, %xmm1
movss -0xcc(%rbp), %xmm0
callq 0xbc10
movq -0xc8(%rbp), %rdi
movlpd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
callq 0x40dc0
movq -0x90(%rbp), %rax
movaps %xmm0, %xmm1
movss -0xb8(%rbp), %xmm0
movlpd %xmm1, 0x14(%rax)
xorps %xmm1, %xmm1
movss %xmm1, -0xbc(%rbp)
callq 0xbc10
movq -0x80(%rbp), %rdi
movlpd %xmm0, -0x68(%rbp)
addq $0x160, %rdi            # imm = 0x160
callq 0x42250
movaps %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
callq 0xb500
movq -0x80(%rbp), %rdi
movlpd %xmm0, -0x60(%rbp)
addq $0x168, %rdi            # imm = 0x168
callq 0x42250
leaq -0x60(%rbp), %rdi
callq 0x5810
movss -0xbc(%rbp), %xmm1
movq -0x90(%rbp), %rax
movaps %xmm0, %xmm2
movss -0xb8(%rbp), %xmm0
movlpd %xmm2, 0x1c(%rax)
callq 0xbc10
movq -0x80(%rbp), %rdi
movlpd %xmm0, -0x78(%rbp)
addq $0x178, %rdi            # imm = 0x178
callq 0x42250
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
callq 0xb500
movq -0x80(%rbp), %rdi
movlpd %xmm0, -0x70(%rbp)
addq $0x180, %rdi            # imm = 0x180
callq 0x42250
leaq -0x70(%rbp), %rdi
callq 0x5810
movq -0x90(%rbp), %rax
movq -0x80(%rbp), %rdi
movlpd %xmm0, 0x24(%rax)
addq $0x170, %rdi            # imm = 0x170
callq 0x42250
movq -0x90(%rbp), %rax
movq -0x80(%rbp), %rdi
movss %xmm0, 0x2c(%rax)
movss -0xc(%rbp), %xmm0
movss %xmm0, 0x30(%rax)
movss -0x10(%rbp), %xmm0
movss %xmm0, 0x34(%rax)
movss -0x14(%rbp), %xmm0
movss %xmm0, 0x38(%rax)
movss -0x18(%rbp), %xmm0
movss %xmm0, 0x3c(%rax)
movq %rdi, %rcx
addq $0x208, %rcx            # imm = 0x208
movq %rcx, 0x40(%rax)
addq $0x1a8, %rdi            # imm = 0x1A8
callq 0x42250
movq -0x80(%rbp), %rdi
movss %xmm0, -0xb4(%rbp)
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0x42250
movaps %xmm0, %xmm1
movss -0xb4(%rbp), %xmm0
callq 0xbc10
movq -0x90(%rbp), %rcx
movq -0x80(%rbp), %rax
movlpd %xmm0, 0x48(%rcx)
movq -0x28(%rbp), %rdx
movq %rdx, 0x50(%rcx)
movq -0x20(%rbp), %rdx
movq %rdx, 0x58(%rcx)
movss -0x2c(%rbp), %xmm0
movss %xmm0, 0x60(%rcx)
movq -0x3c(%rbp), %rdx
movq %rdx, 0x64(%rcx)
movq -0x34(%rbp), %rdx
movq %rdx, 0x6c(%rcx)
movss -0x40(%rbp), %xmm0
movss %xmm0, 0x74(%rcx)
movq %rax, %rdx
addq $0x210, %rdx            # imm = 0x210
movq %rdx, 0x78(%rcx)
addq $0x80, %rcx
movq %rcx, -0xb0(%rbp)
cmpl $0x0, (%rax)
je 0x2f71c
callq 0xe2c0
movq -0x80(%rbp), %rcx
xorl %edx, %edx
divl (%rcx)
movl %edx, -0xd0(%rbp)
jmp 0x2f729
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0xd0(%rbp)
jmp 0x2f729
movq -0x88(%rbp), %rax
movq -0xb0(%rbp), %rcx
movl -0xd0(%rbp), %edx
movw %dx, (%rcx)
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax)