// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/./intel/blt.h
// Function: xy_src_copy_blt
static inline void
xy_src_copy_blt(struct intel_batch *batch,
                drm_intel_bo *src, uint16_t src_pitch,
                uint16_t src_x, uint16_t src_y,
                drm_intel_bo *dst, uint16_t dst_pitch,
                uint16_t dst_x, uint16_t dst_y,
                uint16_t width, uint16_t height)
{
	uint32_t src_tiling_mode, dst_tiling_mode, swizzle;

	intel_batch_ensure_space(batch, GEN(batch, 8) ? 10 : 8);

	drm_intel_bo_get_tiling(dst, &dst_tiling_mode, &swizzle);
	drm_intel_bo_get_tiling(src, &src_tiling_mode, &swizzle);

	drm_intel_bo_emit_reloc_fence(batch->bo, intel_batch_offset(batch, 4), dst, 0,
	                              I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);
	drm_intel_bo_emit_reloc_fence(batch->bo, intel_batch_offset(batch, GEN(batch, 8) ? 8 : 7), src, 0,
	                              I915_GEM_DOMAIN_RENDER, 0);

	intel_batch_add_dwords(batch, 4,
	                       BLT_BR00_CLIENT(INTEL_CLIENT_BLT)
	                           | BLT_BR00_OP(BLT_OP_XY_SRC_COPY_BLT)
	                           | BLT_BR00_32BPP_MASK(BLT_32BPP_MASK_ALPHA | BLT_32BPP_MASK_RGB)
	                           | BLT_BR00_SRC_TILING_ENABLE(src_tiling_mode != I915_TILING_NONE)
	                           | BLT_BR00_DST_TILING_ENABLE(dst_tiling_mode != I915_TILING_NONE)
	                           | BLT_BR00_DWORD_LENGTH(GEN(batch, 8) ? 8 : 6),

	                       BLT_BR13_CLIPPING_ENABLE(false)
	                           | BLT_BR13_COLOR_DEPTH(BLT_COLOR_DEPTH_32BIT)
	                           | BLT_BR13_RASTER_OPERATION(BLT_RASTER_OPERATION_SRC)
	                           | BLT_BR13_DST_PITCH(dst_tiling_mode == I915_TILING_NONE
	                                                    ? dst_pitch
	                                                    : dst_pitch >> 2),

	                       BLT_BR22_DST_Y1(dst_y) | BLT_BR22_DST_X1(dst_x),

	                       BLT_BR23_DST_Y2(dst_y + height)
	                           | BLT_BR23_DST_X2(dst_x + width));
	intel_batch_add_dwords(batch, GEN(batch, 8) ? 2 : 1,
	                       BLT_BR09_DST_ADDRESS(dst->offset64),
	                       BLT_BR27_DST_ADDRESS_HI(dst->offset64 >> 32));
	intel_batch_add_dwords(batch, 2,
	                       BLT_BR26_SRC_Y1(src_y) | BLT_BR26_SRC_X1(src_x),
	                       BLT_BR11_SRC_PITCH(src_tiling_mode == I915_TILING_NONE
	                                              ? src_pitch
	                                              : src_pitch >> 2));
	intel_batch_add_dwords(batch, GEN(batch, 8) ? 2 : 1,
	                       BLT_BR12_SRC_ADDRESS(src->offset64),
	                       BLT_BR28_SRC_ADDRESS_HI(src->offset64 >> 32));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movw %r8w, %ax
movw 0x30(%rbp), %r8w
movw 0x28(%rbp), %r8w
movw 0x20(%rbp), %r8w
movw 0x18(%rbp), %r8w
movw 0x10(%rbp), %r8w
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movw %dx, -0x12(%rbp)
movw %cx, -0x14(%rbp)
movw %ax, -0x16(%rbp)
movq %r9, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl (%rax), %ecx
movl $0x8, %esi
movl $0xa, %eax
cmpl $0x8, %ecx
cmovgel %eax, %esi
callq 0xc6f0
movq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x9360
movq -0x10(%rbp), %rdi
leaq -0x24(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x9360
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movl $0x4, %esi
callq 0xc720
movq -0x48(%rbp), %rdi
movl %eax, %esi
movq -0x20(%rbp), %rdx
xorl %ecx, %ecx
movl $0x2, %r9d
movl %r9d, %r8d
callq 0x9760
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl (%rax), %ecx
movl $0x7, %esi
movl $0x8, %eax
cmpl $0x8, %ecx
cmovgel %eax, %esi
callq 0xc720
movq -0x40(%rbp), %rdi
movl %eax, %esi
movq -0x10(%rbp), %rdx
xorl %r9d, %r9d
movl $0x2, %r8d
movl %r9d, %ecx
callq 0x9760
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x24(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
shll $0xf, %eax
orl $0x54f00000, %eax       # imm = 0x54F00000
cmpl $0x0, -0x28(%rbp)
setne %cl
andb $0x1, %cl
movzbl %cl, %ecx
shll $0xb, %ecx
orl %ecx, %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movl (%rcx), %esi
movl $0x6, %ecx
movl $0x8, %edx
cmpl $0x8, %esi
cmovgel %edx, %ecx
shll $0x0, %ecx
orl %ecx, %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0xca2c
movzwl 0x10(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0xca36
movzwl 0x10(%rbp), %eax
sarl $0x2, %eax
movl %eax, -0x4c(%rbp)
movl -0x30(%rbp), %edx
movq -0x38(%rbp), %rdi
movl -0x4c(%rbp), %ecx
shll $0x0, %ecx
orl $0x3cc0000, %ecx        # imm = 0x3CC0000
movzwl 0x20(%rbp), %r8d
shll $0x10, %r8d
movzwl 0x18(%rbp), %eax
shll $0x0, %eax
orl %eax, %r8d
movzwl 0x20(%rbp), %r9d
movzwl 0x30(%rbp), %eax
addl %eax, %r9d
shll $0x10, %r9d
movzwl 0x18(%rbp), %eax
movzwl 0x28(%rbp), %esi
addl %esi, %eax
shll $0x0, %eax
orl %eax, %r9d
movl $0x4, %esi
movb $0x0, %al
callq 0xc740
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl (%rax), %ecx
movl $0x1, %esi
movl $0x2, %eax
cmpl $0x8, %ecx
cmovgel %eax, %esi
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdx
shlq $0x0, %rdx
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rcx
shrq $0x20, %rcx
shlq $0x0, %rcx
movb $0x0, %al
callq 0xc740
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movzwl -0x16(%rbp), %eax
shll $0x10, %eax
movzwl -0x14(%rbp), %ecx
shll $0x0, %ecx
orl %ecx, %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0xcaf2
movzwl -0x12(%rbp), %eax
movl %eax, -0x5c(%rbp)
jmp 0xcafc
movzwl -0x12(%rbp), %eax
sarl $0x2, %eax
movl %eax, -0x5c(%rbp)
movl -0x50(%rbp), %edx
movq -0x58(%rbp), %rdi
movl -0x5c(%rbp), %ecx
shll $0x0, %ecx
movl $0x2, %esi
movb $0x0, %al
callq 0xc740
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl (%rax), %ecx
movl $0x1, %esi
movl $0x2, %eax
cmpl $0x8, %ecx
cmovgel %eax, %esi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdx
shlq $0x0, %rdx
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
shrq $0x20, %rcx
shlq $0x0, %rcx
movb $0x0, %al
callq 0xc740
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)