// File: /workspace/github_c_makefile_star2_O0/pje[P]pixelsort/sorting.c
// Function: sync_pixels
void sync_pixels(struct image * img, const sort_plan_t * plan_ptr, const pixel_t * pixels) {
    if (ROW != plan_ptr->orientation) {
        for (size_t column_index = 0; column_index < img->width; column_index++) {
            for (size_t row_index = 0; row_index < img->height; row_index++) {
                size_t destination_index = (img->width * row_index) + column_index;
                size_t source_index = (img->height * column_index) + row_index;
                img->buffer[(destination_index * sizeof(pixel_t)) + 0] = pixels[source_index].r;
                img->buffer[(destination_index * sizeof(pixel_t)) + 1] = pixels[source_index].g;
                img->buffer[(destination_index * sizeof(pixel_t)) + 2] = pixels[source_index].b;
                img->buffer[(destination_index * sizeof(pixel_t)) + 3] = pixels[source_index].a;
            }
        }
    } else {
        for (size_t index = 0; index < ((img->width) * (img->height)); index++) {
            img->buffer[(index * sizeof(pixel_t)) + 0] = pixels[index].r;
            img->buffer[(index * sizeof(pixel_t)) + 1] = pixels[index].g;
            img->buffer[(index * sizeof(pixel_t)) + 2] = pixels[index].b;
            img->buffer[(index * sizeof(pixel_t)) + 3] = pixels[index].a;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rcx
movl $0x1, %eax
cmpl 0x8(%rcx), %eax
je 0x11c95
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jae 0x11c90
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
cmpq %rcx, %rax
jae 0x11c7d
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
imulq -0x28(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
imulq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
movb (%rax,%rcx,4), %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
movb 0x1(%rax,%rcx,4), %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
movb 0x2(%rax,%rcx,4), %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x2(%rax,%rcx)
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
movb 0x3(%rax,%rcx,4), %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x3(%rax,%rcx)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x11bb6
jmp 0x11c7f
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x11b9a
jmp 0x11d48
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x8(%rbp), %rdx
imull 0xc(%rdx), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x11d46
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
movb (%rax,%rcx,4), %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
movb 0x1(%rax,%rcx,4), %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
movb 0x2(%rax,%rcx,4), %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x2(%rax,%rcx)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
movb 0x3(%rax,%rcx,4), %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x3(%rax,%rcx)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x11c9d
jmp 0x11d48
popq %rbp
retq
nopw (%rax,%rax)