// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/nouveau.c
// Function: renderer_copy_rectangle
void
renderer_copy_rectangle(struct wld_renderer *base,
                        struct buffer *buffer_base,
                        int32_t dst_x, int32_t dst_y,
                        int32_t src_x, int32_t src_y,
                        uint32_t width, uint32_t height)
{
	struct nouveau_renderer *renderer = nouveau_renderer(base);

	if (buffer_base->base.impl != &wld_buffer_impl)
		return;

	struct nouveau_buffer *src = nouveau_buffer(&buffer_base->base),
	                      *dst = renderer->target;
	uint32_t src_format, dst_format;

	if (!ensure_space(renderer->pushbuf, 33))
		return;

	src_format = nvc0_format(src->base.base.format);
	dst_format = nvc0_format(dst->base.base.format);

	nouveau_bufctx_reset(renderer->bufctx, 0);
	nvc0_2d_use_buffer(renderer, src, G80_2D_SRC_FORMAT, src_format);
	nvc0_2d_use_buffer(renderer, dst, G80_2D_DST_FORMAT, dst_format);
	nouveau_pushbuf_bufctx(renderer->pushbuf, renderer->bufctx);

	if (nouveau_pushbuf_validate(renderer->pushbuf) != 0)
		return;

	nvc0_2d_inline(renderer->pushbuf, G80_GRAPH_SERIALIZE, 0);
	nvc0_2d_inline(renderer->pushbuf, G80_2D_BLIT_CONTROL,
	               G80_2D_BLIT_CONTROL_ORIGIN_CENTER
	                   | G80_2D_BLIT_CONTROL_FILTER_POINT_SAMPLE);
	nvc0_2d(renderer->pushbuf, G80_2D_BLIT_DST_X, 12,
	        dst_x, dst_y, width, height, 0, 1, 0, 1, 0, src_x, 0, src_y);

	renderer_flush(base);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movl %edx, -0x24(%rbp)
movl %ecx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movl %r9d, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0xfaf0
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
leaq 0xc6ce(%rip), %rcx      # 0x1baf0
cmpq %rcx, (%rax)
je 0xf42c
jmp 0xf59c
movq -0x20(%rbp), %rdi
callq 0xfaa0
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x21, %esi
callq 0xef60
testb $0x1, %al
jne 0xf460
jmp 0xf59c
movq -0x40(%rbp), %rax
movl 0x14(%rax), %edi
callq 0xfb40
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rax
movl 0x14(%rax), %edi
callq 0xfb40
movl %eax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x9120
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x4c(%rbp), %eax
movl $0x230, %edx            # imm = 0x230
movzwl %ax, %ecx
callq 0xfb80
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x50(%rbp), %eax
movl $0x200, %edx            # imm = 0x200
movzwl %ax, %ecx
callq 0xfb80
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x92e0
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x9480
cmpl $0x0, %eax
je 0xf4e9
jmp 0xf59c
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x3, %esi
movl $0x110, %edx            # imm = 0x110
xorl %ecx, %ecx
callq 0xf090
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x3, %esi
movl $0x88c, %edx            # imm = 0x88C
xorl %ecx, %ecx
callq 0xf090
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
movl 0x10(%rbp), %ebx
movl 0x18(%rbp), %r11d
movl -0x2c(%rbp), %r10d
movl -0x30(%rbp), %eax
movl $0x3, %esi
movl $0x8b0, %edx            # imm = 0x8B0
movl $0xc, %ecx
xorl %r14d, %r14d
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x1, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movl $0x1, 0x28(%rsp)
movl $0x0, 0x30(%rsp)
movl %r10d, 0x38(%rsp)
movl $0x0, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movb $0x0, %al
callq 0xefc0
movq -0x18(%rbp), %rdi
callq 0xf8c0
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax,%rax)