// File: /workspace/github_c_makefile_star2_O0/FredTheDino[P]Fog/src/engine/renderer/command.cpp
// Function: Renderer::push_sprite_rect(unsigned int, int, Vec2, Vec2, float, Vec2, Vec2, Vec4)
void push_sprite_rect(u32 layer, s32 slot, Vec2 position, Vec2 dimension, f32 angle,
                 Vec2 uv_min, Vec2 uv_dimension, Vec4 color) {
    Vec2 inv_dimension = {1.0f / (f32) OPENGL_TEXTURE_WIDTH,
                          1.0f / (f32) OPENGL_TEXTURE_HEIGHT};
    uv_min = hadamard(uv_min, inv_dimension);
    Vec2 uv_max = uv_min + hadamard(uv_dimension, inv_dimension);

    Vec2 right = angle ? rotate(V2(1, 0), angle) : V2(1, 0);
    Vec2 up = rotate_ccw(right);
    right *= dimension.x * 0.5;
    up *= dimension.y * 0.5;

    struct {
        Vec2 p;
        Vec2 uv;
    } coords[] = {
        {position - right - up, uv_min},
        {position + right - up, V2(uv_max.x, uv_min.y)},
        {position + right + up, uv_max},
        {position - right + up, V2(uv_min.x, uv_max.y)},
    };

    Impl::push_triangle(layer,
                        coords[0].p, coords[1].p, coords[2].p,
                        coords[0].uv, coords[1].uv, coords[2].uv, color, color,
                        color, slot);
    Impl::push_triangle(layer,
                        coords[0].p, coords[2].p, coords[3].p,
                        coords[0].uv, coords[2].uv, coords[3].uv, color, color,
                        color, slot);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movlpd %xmm0, -0x8(%rbp)
movlpd %xmm1, -0x10(%rbp)
movlpd %xmm3, -0x18(%rbp)
movlpd %xmm4, -0x20(%rbp)
movlpd %xmm5, -0x30(%rbp)
movlpd %xmm6, -0x28(%rbp)
movl %edi, -0x34(%rbp)
movl %esi, -0x38(%rbp)
movss %xmm2, -0x3c(%rbp)
movabsq $0x3b0000003b000000, %rax # imm = 0x3B0000003B000000
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x60(%rbp)
movsd -0x58(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
callq 0xb450
movlpd %xmm0, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x80(%rbp)
movsd -0x78(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
callq 0xb450
movlpd %xmm0, -0x70(%rbp)
movsd -0x70(%rbp), %xmm0
leaq -0x18(%rbp), %rdi
callq 0x40dc0
movlpd %xmm0, -0x68(%rbp)
movss -0x3c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x2dda6
jp 0x2dda6
jmp 0x2ddda
movss 0x1725a(%rip), %xmm0    # 0x45008
xorps %xmm1, %xmm1
callq 0xbc10
movlpd %xmm0, -0x90(%rbp)
movss -0x3c(%rbp), %xmm1
movsd -0x90(%rbp), %xmm0
callq 0xb500
movlpd %xmm0, -0x88(%rbp)
jmp 0x2ddf2
movss 0x17226(%rip), %xmm0    # 0x45008
xorps %xmm1, %xmm1
callq 0xbc10
movlpd %xmm0, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0xa0(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0xb4d0
movlpd %xmm0, -0x98(%rbp)
movss -0x10(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x1722a(%rip), %xmm1    # 0x45050
movsd %xmm1, -0x210(%rbp)
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
leaq -0x88(%rbp), %rdi
callq 0x420d0
movsd -0x210(%rbp), %xmm1
movss -0xc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
leaq -0x98(%rbp), %rdi
callq 0x420d0
movq -0x88(%rbp), %rax
movq %rax, -0xf0(%rbp)
movsd -0xf0(%rbp), %xmm0
leaq -0x8(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x5850
movlpd %xmm0, -0xe8(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xf8(%rbp)
movsd -0xf8(%rbp), %xmm0
leaq -0xe8(%rbp), %rdi
callq 0x5850
movq -0x208(%rbp), %rdi
movlpd %xmm0, -0xe0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x108(%rbp)
movsd -0x108(%rbp), %xmm0
callq 0x40dc0
movlpd %xmm0, -0x100(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x110(%rbp)
movsd -0x110(%rbp), %xmm0
leaq -0x100(%rbp), %rdi
callq 0x5850
movlpd %xmm0, -0xd0(%rbp)
movss -0x68(%rbp), %xmm0
movss -0x14(%rbp), %xmm1
callq 0xbc10
movq -0x208(%rbp), %rdi
movlpd %xmm0, -0xc8(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x120(%rbp)
movsd -0x120(%rbp), %xmm0
callq 0x40dc0
movlpd %xmm0, -0x118(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x128(%rbp)
movsd -0x128(%rbp), %xmm0
leaq -0x118(%rbp), %rdi
callq 0x40dc0
movq -0x208(%rbp), %rdi
movlpd %xmm0, -0xc0(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x138(%rbp)
movsd -0x138(%rbp), %xmm0
callq 0x5850
movlpd %xmm0, -0x130(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x140(%rbp)
movsd -0x140(%rbp), %xmm0
leaq -0x130(%rbp), %rdi
callq 0x40dc0
movlpd %xmm0, -0xb0(%rbp)
movss -0x18(%rbp), %xmm0
movss -0x64(%rbp), %xmm1
callq 0xbc10
movlpd %xmm0, -0xa8(%rbp)
movl -0x34(%rbp), %edi
movq -0xe0(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x170(%rbp)
movups -0x30(%rbp), %xmm0
movaps %xmm0, -0x180(%rbp)
movups -0x30(%rbp), %xmm0
movaps %xmm0, -0x190(%rbp)
movups -0x30(%rbp), %xmm0
movaps %xmm0, -0x1a0(%rbp)
cvtsi2ssl -0x38(%rbp), %xmm8
movsd -0x148(%rbp), %xmm0
movsd -0x150(%rbp), %xmm1
movsd -0x158(%rbp), %xmm2
movsd -0x160(%rbp), %xmm3
movsd -0x168(%rbp), %xmm4
movsd -0x170(%rbp), %xmm5
movsd -0x180(%rbp), %xmm6
movsd -0x178(%rbp), %xmm7
movaps -0x1a0(%rbp), %xmm9
movq %rsp, %rax
movups %xmm9, 0x10(%rax)
movaps -0x190(%rbp), %xmm9
movups %xmm9, (%rax)
movss %xmm8, 0x20(%rax)
callq 0x2c740
movl -0x34(%rbp), %edi
movq -0xe0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movups -0x30(%rbp), %xmm0
movaps %xmm0, -0x1e0(%rbp)
movups -0x30(%rbp), %xmm0
movaps %xmm0, -0x1f0(%rbp)
movups -0x30(%rbp), %xmm0
movaps %xmm0, -0x200(%rbp)
cvtsi2ssl -0x38(%rbp), %xmm8
movsd -0x1a8(%rbp), %xmm0
movsd -0x1b0(%rbp), %xmm1
movsd -0x1b8(%rbp), %xmm2
movsd -0x1c0(%rbp), %xmm3
movsd -0x1c8(%rbp), %xmm4
movsd -0x1d0(%rbp), %xmm5
movsd -0x1e0(%rbp), %xmm6
movsd -0x1d8(%rbp), %xmm7
movups -0x200(%rbp), %xmm9
movq %rsp, %rax
movups %xmm9, 0x10(%rax)
movups -0x1f0(%rbp), %xmm9
movups %xmm9, (%rax)
movss %xmm8, 0x20(%rax)
callq 0x2c740
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
nopw %cs:(%rax,%rax)