// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/./intel/blt.h
// Function: xy_text_immediate_blt
static inline int
xy_text_immediate_blt(struct intel_batch *batch,
                      drm_intel_bo *dst,
                      int16_t dst_x1, int16_t dst_y1,
                      int16_t dst_x2, int16_t dst_y2,
                      uint16_t count, uint32_t *immediates)
{
	/* Round up to the next even number. */
	uint8_t dwords = (count + 1) & ~1;
	uint32_t index;
	uint32_t tiling_mode, swizzle_mode;

	if (!intel_batch_check_space(batch, 3 + dwords))
		return INTEL_BATCH_NO_SPACE;

	drm_intel_bo_get_tiling(dst, &tiling_mode, &swizzle_mode);

	intel_batch_add_dwords(batch, 3,
	                       BLT_BR00_CLIENT(INTEL_CLIENT_BLT)
	                           | BLT_BR00_OP(BLT_OP_XY_TEXT_IMMEDIATE_BLT)
	                           | BLT_BR00_PACKING(BLT_PACKING_BYTE)
	                           | BLT_BR00_DST_TILING_ENABLE(tiling_mode != I915_TILING_NONE)
	                           | BLT_BR00_DWORD_LENGTH(1 + dwords),

	                       BLT_BR22_DST_Y1(dst_y1) | BLT_BR22_DST_X1(dst_x1),
	                       BLT_BR23_DST_Y2(dst_y2) | BLT_BR23_DST_X2(dst_x2));

	for (index = 0; index < count; ++index)
		intel_batch_add_dword(batch, *immediates++);

	/* From BLT engine documentation:
	 *
	 * The IMMEDIATE_BLT data MUST transfer an even number of doublewords. The
	 * BLT engine will hang if it does not get an even number of doublewords. */
	if (count & 1)
		intel_batch_add_dword(batch, 0);

	return INTEL_BATCH_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %r8d, -0x44(%rbp)
movl %ecx, %eax
movl -0x44(%rbp), %ecx
movl %eax, -0x40(%rbp)
movl %edx, %eax
movl -0x40(%rbp), %edx
movl %eax, -0x3c(%rbp)
movq %rsi, %rax
movl -0x3c(%rbp), %esi
movq %rax, -0x38(%rbp)
movq %rdi, %r8
movq -0x38(%rbp), %rdi
movw %r9w, %ax
movq 0x18(%rbp), %r9
movw 0x10(%rbp), %r9w
movq %r8, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movw %si, -0x1a(%rbp)
movw %dx, -0x1c(%rbp)
movw %cx, -0x1e(%rbp)
movw %ax, -0x20(%rbp)
movzwl 0x10(%rbp), %eax
addl $0x1, %eax
andl $-0x2, %eax
movb %al, -0x21(%rbp)
movq -0x10(%rbp), %rdi
movzbl -0x21(%rbp), %esi
addl $0x3, %esi
callq 0xc810
cmpl $0x0, %eax
jne 0xcda0
movl $0x1, -0x4(%rbp)
jmp 0xce5a
movq -0x18(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x9360
movq -0x10(%rbp), %rdi
cmpl $0x0, -0x2c(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %edx
shll $0xb, %edx
orl $0x4c410000, %edx       # imm = 0x4C410000
movzbl -0x21(%rbp), %eax
addl $0x1, %eax
shll $0x0, %eax
orl %eax, %edx
movswl -0x1c(%rbp), %ecx
shll $0x10, %ecx
movswl -0x1a(%rbp), %eax
shll $0x0, %eax
orl %eax, %ecx
movswl -0x20(%rbp), %r8d
shll $0x10, %r8d
movswl -0x1e(%rbp), %eax
shll $0x0, %eax
orl %eax, %r8d
movl $0x3, %esi
movb $0x0, %al
callq 0xc740
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movzwl 0x10(%rbp), %ecx
cmpl %ecx, %eax
jae 0xce3c
movq -0x10(%rbp), %rdi
movq 0x18(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, 0x18(%rbp)
movl (%rax), %esi
callq 0xc7e0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xce0c
movzwl 0x10(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xce53
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0xc7e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)