// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0xb128(%rip), %rax      # 0x17a90
cmpq %rax, (%rdi)
jne 0xcc3a
movq %rsi, %r13
leaq 0xb15d(%rip), %rax      # 0x17ad8
cmpq %rax, (%rsi)
jne 0xcbc1
movl %r9d, %ebp
movl %r8d, %r15d
movl %ecx, %r8d
movl %edx, %r12d
movq %rdi, %rbx
movl 0x68(%rsp), %eax
movq %rax, 0x10(%rsp)
movl 0x60(%rsp), %eax
movq %rax, 0x18(%rsp)
movq 0x18(%rdi), %rdi
movq 0x30(%rbx), %r14
movq 0x38(%rdi), %rax
subq 0x30(%rdi), %rax
cmpq $0x84, %rax
jg 0xc9e7
movl $0x21, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r14, (%rsp)
movl %r12d, %r14d
movl %r8d, %r12d
callq 0x9860
movl %r12d, %r8d
movl %r14d, %r12d
movq (%rsp), %r14
testl %eax, %eax
jne 0xcbc1
movl %r8d, 0xc(%rsp)
movq %rbp, 0x20(%rsp)
movq %r15, (%rsp)
movl 0x14(%r13), %ebp
movl 0x14(%r14), %r15d
movq 0x20(%rbx), %rdi
xorl %esi, %esi
callq 0x9110
cmpl $0x34325241, %ebp       # imm = 0x34325241
movl $0x80cf608c, %eax       # imm = 0x80CF608C
movl $0x8000608c, %ecx       # imm = 0x8000608C
cmovel %eax, %ecx
cmpl $0x34325258, %ebp       # imm = 0x34325258
movl $0x80e6608c, %edx       # imm = 0x80E6608C
cmovnel %ecx, %edx
movq 0x18(%rbx), %rdi
movq 0x30(%rdi), %rax
leaq 0x4(%rax), %rcx
movq %rcx, 0x30(%rdi)
movl %edx, (%rax)
movq 0x68(%r13), %rcx
cmpl $0x0, 0x30(%rcx)
je 0xca61
movl 0x34(%rcx), %r9d
xorl %esi, %esi
movl $0x234, %edx            # imm = 0x234
movl $0x2, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xc655
jmp 0xca87
leaq 0x8(%rax), %rcx
movq %rcx, 0x30(%rdi)
movl $0x8001608d, 0x4(%rax)  # imm = 0x8001608D
movl 0x10(%r13), %r8d
xorl %esi, %esi
movl $0x244, %edx            # imm = 0x244
movl $0x1, %ecx
xorl %eax, %eax
callq 0xc655
movq 0x18(%rbx), %rdi
movl 0x8(%r13), %r8d
movl 0xc(%r13), %r9d
movq 0x68(%r13), %rax
movq 0x20(%rax), %r10
xorl %esi, %esi
movl $0x248, %edx            # imm = 0x248
movl $0x4, %ecx
xorl %eax, %eax
pushq %r10
shrq $0x20, %r10
pushq %r10
callq 0xc655
addq $0x10, %rsp
movq 0x20(%rbx), %rdi
movq 0x68(%r13), %rdx
xorl %esi, %esi
movl $0x201, %ecx            # imm = 0x201
callq 0x95c0
cmpl $0x34325241, %r15d      # imm = 0x34325241
movl $0x80cf6080, %eax       # imm = 0x80CF6080
movl $0x80006080, %ecx       # imm = 0x80006080
cmovel %eax, %ecx
cmpl $0x34325258, %r15d      # imm = 0x34325258
movl $0x80e66080, %edx       # imm = 0x80E66080
cmovnel %ecx, %edx
movq 0x18(%rbx), %rdi
movq 0x30(%rdi), %rax
leaq 0x4(%rax), %rcx
movq %rcx, 0x30(%rdi)
movl %edx, (%rax)
movq 0x68(%r14), %rcx
cmpl $0x0, 0x30(%rcx)
movq (%rsp), %r13
movq 0x20(%rsp), %rbp
je 0xcb32
movl 0x34(%rcx), %r9d
xorl %esi, %esi
movl $0x204, %edx            # imm = 0x204
movl $0x2, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xc655
jmp 0xcb58
leaq 0x8(%rax), %rcx
movq %rcx, 0x30(%rdi)
movl $0x80016081, 0x4(%rax)  # imm = 0x80016081
movl 0x10(%r14), %r8d
xorl %esi, %esi
movl $0x214, %edx            # imm = 0x214
movl $0x1, %ecx
xorl %eax, %eax
callq 0xc655
movq 0x18(%rbx), %rdi
movl 0x8(%r14), %r8d
movl 0xc(%r14), %r9d
movq 0x68(%r14), %rax
movq 0x20(%rax), %r10
xorl %r15d, %r15d
xorl %esi, %esi
movl $0x218, %edx            # imm = 0x218
movl $0x4, %ecx
xorl %eax, %eax
pushq %r10
shrq $0x20, %r10
pushq %r10
callq 0xc655
addq $0x10, %rsp
movq 0x20(%rbx), %rdi
movq 0x68(%r14), %rdx
xorl %esi, %esi
movl $0x201, %ecx            # imm = 0x201
callq 0x95c0
movq 0x18(%rbx), %rdi
movq 0x20(%rbx), %rsi
callq 0x92d0
movq 0x18(%rbx), %rdi
callq 0x9460
testl %eax, %eax
movl 0xc(%rsp), %r9d
je 0xcbd0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rbx), %rdi
movq 0x30(%rdi), %rax
movl $0x80006044, (%rax)     # imm = 0x80006044
leaq 0x8(%rax), %rcx
movq %rcx, 0x30(%rdi)
movl $0x80006223, 0x4(%rax)  # imm = 0x80006223
movl $0x1, %r10d
xorl %esi, %esi
movl $0x8b0, %edx            # imm = 0x8B0
movl $0xc, %ecx
movl %r12d, %r8d
xorl %eax, %eax
pushq %rbp
pushq %r15
pushq %r13
pushq %r15
pushq %r10
pushq %r15
pushq %r10
pushq %r15
pushq 0x50(%rsp)
pushq 0x60(%rsp)
callq 0xc655
addq $0x50, %rsp
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcfae
leaq 0x41b8(%rip), %rdi      # 0x10df9
leaq 0x47b8(%rip), %rsi      # 0x11400
leaq 0x4834(%rip), %rcx      # 0x11483
movl $0x4b, %edx
callq 0x9380