// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/./intel/blt.h
// Function: xy_setup_blt
static inline void
xy_setup_blt(struct intel_batch *batch,
             bool monochrome_source_transparency,
             uint8_t raster_operation,
             uint32_t background_color,
             uint32_t foreground_color,
             drm_intel_bo *dst, uint16_t dst_pitch)
{
	uint32_t tiling_mode, swizzle_mode;

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

	drm_intel_bo_get_tiling(dst, &tiling_mode, &swizzle_mode);
	drm_intel_bo_emit_reloc_fence(batch->bo, intel_batch_offset(batch, 4), dst, 0,
	                              I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);

	intel_batch_add_dwords(batch, 4,
	                       BLT_BR00_CLIENT(INTEL_CLIENT_BLT)
	                           | BLT_BR00_OP(BLT_OP_XY_SETUP_BLT)
	                           | BLT_BR00_32BPP_MASK(BLT_32BPP_MASK_ALPHA | BLT_32BPP_MASK_RGB)
	                           | BLT_BR00_DST_TILING_ENABLE(tiling_mode != I915_TILING_NONE)
	                           | BLT_BR00_DWORD_LENGTH(GEN(batch, 8) ? 8 : 6),

	                       BLT_BR01_CLIPPING_ENABLE(false)
	                           | BLT_BR01_MONO_SRC_TRANSPARENCY(monochrome_source_transparency)
	                           | BLT_BR01_COLOR_DEPTH(BLT_COLOR_DEPTH_32BIT)
	                           | BLT_BR01_RASTER_OPERATION(raster_operation)
	                           | BLT_BR01_DST_PITCH(tiling_mode == I915_TILING_NONE
	                                                    ? dst_pitch
	                                                    : dst_pitch >> 2),

	                       /* XXX: No clipping yet */
	                       BLT_BR24_CLP_Y1(0)
	                           | BLT_BR24_CLP_X1(0),

	                       BLT_BR25_CLP_Y2(0)
	                           | BLT_BR25_CLP_X2(0));

	intel_batch_add_dwords(batch, GEN(batch, 8) ? 2 : 1,
	                       BLT_BR09_DST_ADDRESS(dst->offset64),
	                       /* if gen8 */
	                       BLT_BR27_DST_ADDRESS_HI(dst->offset64 >> 32));

	intel_batch_add_dwords(batch, 2,
	                       BLT_BR05_BACKGROUND_COLOR(background_color),
	                       BLT_BR06_FOREGROUND_COLOR(foreground_color));

	intel_batch_add_dwords(batch, GEN(batch, 8) ? 2 : 1,
	                       BLT_BR07_PAT_ADDRESS(0),
	                       /* if gen8 */
	                       BLT_BR30_PAT_ADDRESS_HI(0));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %dl, %al
movb %sil, %dl
movw 0x10(%rbp), %si
movq %rdi, -0x8(%rbp)
andb $0x1, %dl
movb %dl, -0x9(%rbp)
movb %al, -0xa(%rbp)
movl %ecx, -0x10(%rbp)
movl %r8d, -0x14(%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 -0x24(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0x9360
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movl $0x4, %esi
callq 0xc720
movq -0x40(%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 %rax, -0x38(%rbp)
cmpl $0x0, -0x24(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
shll $0xb, %eax
orl $0x40700000, %eax       # imm = 0x40700000
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)
movb -0x9(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
shll $0x1d, %eax
orl $0x0, %eax
orl $0x3000000, %eax        # imm = 0x3000000
movzbl -0xa(%rbp), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0xcc5b
movzwl 0x10(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0xcc65
movzwl 0x10(%rbp), %eax
sarl $0x2, %eax
movl %eax, -0x44(%rbp)
movl -0x30(%rbp), %edx
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %ecx
movl -0x44(%rbp), %eax
shll $0x0, %eax
orl %eax, %ecx
movl $0x4, %esi
xorl %r9d, %r9d
movl %r9d, %r8d
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), %rdi
movl -0x10(%rbp), %edx
shll $0x0, %edx
movl -0x14(%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
xorl %ecx, %ecx
movl %ecx, %edx
movb $0x0, %al
callq 0xc740
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)