// File: /workspace/github_cpp_makefile_star2_O1/Alcaro[P]bridges/arlib/image.cpp
// Function: image::insert_tile_with_border(int, int, unsigned int, unsigned int, image const&, unsigned int, unsigned int, unsigned int, unsigned int)
void image::insert_tile_with_border(int32_t x, int32_t y, uint32_t width, uint32_t height,
                                    const image& other, uint32_t x1, uint32_t x2, uint32_t y1, uint32_t y2)
{
	uint32_t x3 = other.width;
	uint32_t y3 = other.height;
	
	uint32_t w1 = x1-0;
	uint32_t w2 = x2-x1;
	uint32_t w3 = x3-x2;
	uint32_t h1 = y1-0;
	uint32_t h2 = y2-y1;
	uint32_t h3 = y3-y2;
	
	image sub;
	
	insert_sub(x,          y,           other, 0,  0,  x1, y1); // top left
	sub.init_ref_sub(other, x1, 0,  w2, h1); insert_tile(x+x1,       y,           width-w1-w3, h1,           sub); // top
	insert_sub(x+width-w3, y,           other, x2, 0,  w3, y1); // top right
	
	sub.init_ref_sub(other, 0,  y1, w1, h2); insert_tile(x,          y+y1,        w1,          height-h1-h3, sub); // left
	sub.init_ref_sub(other, x1, y1, w2, h2); insert_tile(x+x1,       y+y1,        width-w1-w3, height-h1-h3, sub); // middle
	sub.init_ref_sub(other, x2, y1, w3, h2); insert_tile(x+width-w3, y+y1,        w3,          height-h1-h3, sub); // right
	
	insert_sub(x,          y+height-h3, other, 0,  y2, x1, h3); // bottom left
	sub.init_ref_sub(other, x1, y2, w2, h3); insert_tile(x+x1,       y+height-h3, width-w1-w3, h3,           sub); // bottom
	insert_sub(x+width-w3, y+height-h3, other, x2, y2, w3, h3); // bottom right
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, %rbx
movl %r8d, 0x14(%rsp)
movl %ecx, 0x4(%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, 0x30(%rsp)
movl 0xc0(%rsp), %r10d
movl 0xc8(%rsp), %ecx
movl 0xb0(%rsp), %r13d
movl 0xb8(%rsp), %eax
movl (%r9), %r14d
movl 0x4(%r9), %r9d
movl %eax, %r8d
movl %eax, %r11d
subl %r13d, %r8d
movl %r8d, %r12d
movl %r8d, 0x8(%rsp)
leaq 0x48(%rsp), %r15
movl %r14d, (%r15)
movl %r9d, 0x4(%r15)
movl 0x8(%rbx), %eax
movl %eax, 0x8(%r15)
movl 0xc(%rbx), %eax
movl %eax, 0xc(%r15)
movq 0x10(%rbx), %rax
movq %rax, 0x10(%r15)
movl %ecx, %eax
subl %r10d, %eax
movl %eax, 0x2c(%rsp)
subl %r11d, %r14d
subl %ecx, %r9d
movq %r9, 0x40(%rsp)
movl %r13d, (%r15)
movl %r10d, 0x4(%r15)
movq %r15, %rcx
callq 0xbb06
movl (%rbx), %eax
leaq 0x60(%rsp), %rbp
movl %eax, (%rbp)
movl 0x4(%rbx), %eax
movl %eax, 0x4(%rbp)
movl 0x8(%rbx), %ecx
movl %ecx, 0x8(%rbp)
movl 0xc(%rbx), %eax
movl %eax, 0xc(%rbp)
addl %ecx, %ecx
movl $0x157fff8, %eax        # imm = 0x157FFF8
shrl %cl, %eax
andl $0x3, %eax
incl %eax
imull %r13d, %eax
addq 0x10(%rbx), %rax
movq %rax, 0x10(%rbp)
movl %r12d, (%rbp)
movl 0xc0(%rsp), %r8d
movl %r8d, 0x4(%rbp)
movq 0x20(%rsp), %r12
leal (%r13,%r12), %esi
movl %esi, 0x10(%rsp)
leal (%r14,%r13), %eax
movl 0x4(%rsp), %r13d
movl %r13d, %ecx
subl %eax, %ecx
movl %ecx, 0xc(%rsp)
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rdx
movq %rbp, %r9
callq 0xc182
addl %r12d, %r13d
movl (%rbx), %eax
movl %eax, (%r15)
movl 0x4(%rbx), %eax
movl %eax, 0x4(%r15)
movl 0x8(%rbx), %ecx
movl %ecx, 0x8(%r15)
movl 0xc(%rbx), %eax
movl %eax, 0xc(%r15)
addl %ecx, %ecx
movl $0x157fff8, %eax        # imm = 0x157FFF8
shrl %cl, %eax
andl $0x3, %eax
incl %eax
imull 0xb8(%rsp), %eax
addq 0x10(%rbx), %rax
movq %r14, 0x38(%rsp)
movl %r13d, %esi
subl %r14d, %esi
movl %esi, 0x4(%rsp)
movq %rax, 0x10(%r15)
movl %r14d, (%r15)
movl 0xc0(%rsp), %r13d
movl %r13d, 0x4(%r15)
leaq 0x48(%rsp), %rcx
movq 0x30(%rsp), %r12
movq %r12, %rdi
movq 0x18(%rsp), %r14
movl %r14d, %edx
callq 0xbb06
movl (%rbx), %eax
movl %eax, (%rbp)
movl 0x4(%rbx), %eax
movl %eax, 0x4(%rbp)
movl 0x8(%rbx), %eax
movl %eax, 0x8(%rbp)
movl 0xc(%rbx), %eax
movl %eax, 0xc(%rbp)
movq %r13, %rdx
imull %edx, %eax
addq 0x10(%rbx), %rax
movq %rax, 0x10(%rbp)
movl 0xb0(%rsp), %ecx
movl %ecx, (%rbp)
movl 0x2c(%rsp), %r15d
movl %r15d, 0x4(%rbp)
addl %r14d, %r13d
movq 0x40(%rsp), %rax
addl %edx, %eax
movl 0x14(%rsp), %r14d
subl %eax, %r14d
movq %r12, %rdi
movq 0x20(%rsp), %rsi
movl %r13d, %edx
movl %r14d, %r8d
movq %rbp, %r9
callq 0xc182
movl (%rbx), %eax
movl %eax, (%rbp)
movl 0x4(%rbx), %eax
movl %eax, 0x4(%rbp)
movl 0x8(%rbx), %ecx
movl %ecx, 0x8(%rbp)
movl 0xc(%rbx), %eax
addl %ecx, %ecx
movl $0x157fff8, %edx        # imm = 0x157FFF8
shrl %cl, %edx
movl %eax, 0xc(%rbp)
andl $0x3, %edx
incl %edx
movl 0xb0(%rsp), %ecx
imull %ecx, %edx
movl 0xc0(%rsp), %ecx
imull %ecx, %eax
addl %edx, %eax
addq 0x10(%rbx), %rax
movq %rax, 0x10(%rbp)
movl 0x8(%rsp), %eax
movl %eax, (%rbp)
movl %r15d, 0x4(%rbp)
movq %r12, %rdi
movl 0x10(%rsp), %esi
movl %r13d, %edx
movl 0xc(%rsp), %ecx
movl %r14d, %r8d
movq %rbp, %r9
callq 0xc182
movl (%rbx), %eax
movl %eax, (%rbp)
movl 0x4(%rbx), %eax
movl %eax, 0x4(%rbp)
movl 0x8(%rbx), %ecx
movl %ecx, 0x8(%rbp)
movl 0xc(%rbx), %eax
addl %ecx, %ecx
movl $0x157fff8, %edx        # imm = 0x157FFF8
shrl %cl, %edx
movl %eax, 0xc(%rbp)
andl $0x3, %edx
incl %edx
imull 0xb8(%rsp), %edx
movl 0xc0(%rsp), %ecx
imull %ecx, %eax
addl %edx, %eax
addq 0x10(%rbx), %rax
movq %rax, 0x10(%rbp)
movq 0x38(%rsp), %rcx
movl %ecx, (%rbp)
movl %r15d, 0x4(%rbp)
movq %r12, %rdi
movl 0x4(%rsp), %esi
movl %r13d, %edx
movl %r14d, %r8d
movq %rbp, %r9
callq 0xc182
movl 0x14(%rsp), %r14d
addl 0x18(%rsp), %r14d
movl (%rbx), %eax
leaq 0x48(%rsp), %rsi
movl %eax, (%rsi)
movl 0x4(%rbx), %eax
movl %eax, 0x4(%rsi)
movl 0x8(%rbx), %eax
movl %eax, 0x8(%rsi)
movl 0xc(%rbx), %eax
movl %eax, 0xc(%rsi)
movl 0xc8(%rsp), %ecx
imull %ecx, %eax
addq 0x10(%rbx), %rax
movq 0x40(%rsp), %r15
subl %r15d, %r14d
movq %rax, 0x10(%rsi)
movl 0xb0(%rsp), %r13d
movl %r13d, (%rsi)
movl %r15d, 0x4(%rsi)
leaq 0x48(%rsp), %rcx
movq %r12, %rdi
movq 0x20(%rsp), %rsi
movl %r14d, %edx
callq 0xbb06
movl (%rbx), %eax
movl %eax, (%rbp)
movl 0x4(%rbx), %eax
movl %eax, 0x4(%rbp)
movl 0x8(%rbx), %ecx
movl %ecx, 0x8(%rbp)
movl 0xc(%rbx), %eax
addl %ecx, %ecx
movl $0x157fff8, %edx        # imm = 0x157FFF8
shrl %cl, %edx
movl %eax, 0xc(%rbp)
andl $0x3, %edx
incl %edx
imull %r13d, %edx
movl 0xc8(%rsp), %r13d
imull %r13d, %eax
addl %edx, %eax
addq 0x10(%rbx), %rax
movq %rax, 0x10(%rbp)
movl 0x8(%rsp), %eax
movl %eax, (%rbp)
movl %r15d, 0x4(%rbp)
movq %r12, %rdi
movl 0x10(%rsp), %esi
movl %r14d, %edx
movl 0xc(%rsp), %ecx
movl %r15d, %r8d
movq %rbp, %r9
callq 0xc182
movq %r12, %rdi
movl 0x4(%rsp), %esi
movl %r14d, %edx
movq %rbx, %rcx
movl 0xb8(%rsp), %r8d
movl %r13d, %r9d
pushq %r15
pushq 0x40(%rsp)
callq 0xcda4
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop