// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_canvas.c
// Function: lv_canvas_copy_buf
void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h)
{
    LV_ASSERT_OBJ(canvas, LV_OBJX_NAME);
    LV_ASSERT_NULL(to_copy);

    lv_canvas_ext_t * ext = lv_obj_get_ext_attr(canvas);
    if(x + w >= (lv_coord_t)ext->dsc.header.w || y + h >= (lv_coord_t)ext->dsc.header.h) {
        LV_LOG_WARN("lv_canvas_copy_buf: x or y out of the canvas");
        return;
    }

    uint32_t px_size   = lv_img_color_format_get_px_size(ext->dsc.header.cf) >> 3;
    uint32_t px        = ext->dsc.header.w * y * px_size + x * px_size;
    uint8_t * to_copy8 = (uint8_t *)to_copy;
    lv_coord_t i;
    for(i = 0; i < h; i++) {
        memcpy((void *)&ext->dsc.data[px], to_copy8, w * px_size);
        px += ext->dsc.header.w * px_size;
        to_copy8 += w * px_size;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %r8d, -0x4c(%rbp)
movl %ecx, %eax
movl -0x4c(%rbp), %ecx
movl %eax, -0x48(%rbp)
movl %edx, %eax
movl -0x48(%rbp), %edx
movl %eax, -0x44(%rbp)
movq %rsi, %rax
movl -0x44(%rbp), %esi
movq %rax, -0x40(%rbp)
movq %rdi, %r8
movq -0x40(%rbp), %rdi
movw %r9w, %ax
movq %r8, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movw %si, -0x12(%rbp)
movw %dx, -0x14(%rbp)
movw %cx, -0x16(%rbp)
movw %ax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x26d78
movq -0x8(%rbp), %rsi
leaq 0x4138b(%rip), %rdi     # 0x680fc
callq 0xd410
jmp 0x26d76
movq -0x10(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x26d97
movq -0x10(%rbp), %rsi
leaq 0x4136c(%rip), %rdi     # 0x680fc
callq 0xd410
jmp 0x26d95
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x20(%rbp)
movswl -0x12(%rbp), %eax
movswl -0x16(%rbp), %ecx
addl %ecx, %eax
movq -0x20(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl $0xa, %ecx
andl $0x7ff, %ecx            # imm = 0x7FF
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x26de0
movswl -0x14(%rbp), %eax
movswl -0x18(%rbp), %ecx
addl %ecx, %eax
movq -0x20(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl $0x15, %ecx
movswl %cx, %ecx
cmpl %ecx, %eax
jl 0x26de5
jmp 0x26ea0
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x1f, %eax
movzbl %al, %edi
callq 0x62530
movzbl %al, %eax
sarl $0x3, %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0xa, %eax
andl $0x7ff, %eax            # imm = 0x7FF
movswl -0x14(%rbp), %ecx
imull %ecx, %eax
imull -0x24(%rbp), %eax
movswl -0x12(%rbp), %ecx
imull -0x24(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movw $0x0, -0x32(%rbp)
movswl -0x32(%rbp), %eax
movswl -0x18(%rbp), %ecx
cmpl %ecx, %eax
jge 0x26ea0
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
movl -0x28(%rbp), %eax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
movswl -0x16(%rbp), %eax
imull -0x24(%rbp), %eax
movl %eax, %eax
movl %eax, %edx
callq 0x20e0
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0xa, %eax
andl $0x7ff, %eax            # imm = 0x7FF
imull -0x24(%rbp), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movswl -0x16(%rbp), %ecx
imull -0x24(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movw -0x32(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x32(%rbp)
jmp 0x26e35
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)