// File: /workspace/github_cpp_makefile_star2_O1/eggnot[P]pixel_camera/matrix/lib/framebuffer.cc
// Function: rgb_matrix::internal::Framebuffer::Fill(unsigned char, unsigned char, unsigned char)
void Framebuffer::Fill(uint8_t r, uint8_t g, uint8_t b) {
  const uint16_t red   = MapColor(r);
  const uint16_t green = MapColor(PANEL_SWAP_G_B_ ? b : g);
  const uint16_t blue  = MapColor(PANEL_SWAP_G_B_ ? g : b);

  for (int b = kBitPlanes - pwm_bits_; b < kBitPlanes; ++b) {
    uint16_t mask = 1 << b;
    IoBits plane_bits;
    plane_bits.raw = 0;
    plane_bits.bits.p0_r1 = plane_bits.bits.p0_r2 = (red & mask) == mask;
    plane_bits.bits.p0_g1 = plane_bits.bits.p0_g2 = (green & mask) == mask;
    plane_bits.bits.p0_b1 = plane_bits.bits.p0_b2 = (blue & mask) == mask;

#ifndef ONLY_SINGLE_CHAIN
    plane_bits.bits.p1_r1 = plane_bits.bits.p1_r2 =
      plane_bits.bits.p2_r1 = plane_bits.bits.p2_r2 = (red & mask) == mask;
    plane_bits.bits.p1_g1 = plane_bits.bits.p1_g2 =
      plane_bits.bits.p2_g1 = plane_bits.bits.p2_g2 = (green & mask) == mask;
    plane_bits.bits.p1_b1 = plane_bits.bits.p1_b2 =
      plane_bits.bits.p2_b1 = plane_bits.bits.p2_b2 = (blue & mask) == mask;
#endif
    for (int row = 0; row < double_rows_; ++row) {
      IoBits *row_data = ValueAt(row, 0, b);
      for (int col = 0; col < columns_; ++col) {
        (row_data++)->raw = plane_bits.raw;
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
cmpb $0x1, 0x11(%rdi)
jne 0x3bd1
movb 0x4625(%rip), %al       # 0x81d0
testb %al, %al
je 0x3ded
movzbl %r15b, %eax
movzbl 0x12(%rbx), %ecx
imulq $0xc8, %rax, %rax
addq 0x45ff(%rip), %rax      # 0x81c8
movzwl -0x2(%rax,%rcx,2), %r15d
jmp 0x3bf1
movzbl %r15b, %eax
movzbl 0x12(%rbx), %ecx
imull %eax, %ecx
shrl $0x2, %ecx
imull $0x147b, %ecx, %r15d    # imm = 0x147B
shrl $0xe, %r15d
andl $0x7f8, %r15d           # imm = 0x7F8
cmpb $0x1, 0x11(%rbx)
jne 0x3c23
movb 0x45d3(%rip), %al       # 0x81d0
testb %al, %al
je 0x3e1e
movzbl %r14b, %eax
movzbl 0x12(%rbx), %ecx
imulq $0xc8, %rax, %rax
addq 0x45ad(%rip), %rax      # 0x81c8
movzwl -0x2(%rax,%rcx,2), %r14d
jmp 0x3c43
movzbl %r14b, %eax
movzbl 0x12(%rbx), %ecx
imull %eax, %ecx
shrl $0x2, %ecx
imull $0x147b, %ecx, %r14d    # imm = 0x147B
shrl $0xe, %r14d
andl $0x7f8, %r14d           # imm = 0x7F8
cmpb $0x1, 0x11(%rbx)
jne 0x3c74
movb 0x4581(%rip), %al       # 0x81d0
testb %al, %al
je 0x3e4f
movzbl %bpl, %eax
movzbl 0x12(%rbx), %ecx
imulq $0xc8, %rax, %rax
addq 0x455b(%rip), %rax      # 0x81c8
movzwl -0x2(%rax,%rcx,2), %esi
jmp 0x3c91
movzbl %bpl, %eax
movzbl 0x12(%rbx), %ecx
imull %eax, %ecx
shrl $0x2, %ecx
imull $0x147b, %ecx, %esi     # imm = 0x147B
shrl $0xe, %esi
andl $0x7f8, %esi            # imm = 0x7F8
movzbl 0x10(%rbx), %eax
testl %eax, %eax
je 0x3de4
movl $0xb, %ecx
subl %eax, %ecx
movzwl %r15w, %eax
movzwl %r14w, %edx
movzwl %si, %esi
movl $0x900, %edi            # imm = 0x900
movl $0x1, %r14d
shll %cl, %r14d
movzwl %r14w, %r12d
movl %r14d, %r8d
andl %eax, %r8d
xorl %r10d, %r10d
cmpl %r12d, %r8d
movl $0x0, %ebp
cmovel %edi, %ebp
sete %r11b
movl %r14d, %r8d
andl %edx, %r8d
xorl %r9d, %r9d
cmpl %r12d, %r8d
sete %r15b
andl %esi, %r14d
xorl %r8d, %r8d
cmpl %r12d, %r14d
sete %r14b
cmpl $0x0, 0x14(%rbx)
jle 0x3dd9
movb %r15b, %r9b
movl %r9d, %r15d
shll $0x9, %r15d
orl %r15d, %ebp
movl %r9d, %r15d
shll $0x1b, %r15d
orl %ebp, %r15d
movb %r14b, %r8b
movl %r8d, %ebp
shll $0xa, %ebp
orl %r15d, %ebp
movl %r8d, %r14d
shll $0x7, %r14d
orl %ebp, %r14d
movb %r11b, %r10b
movl %r10d, %r11d
shll $0x1a, %r11d
orl %r14d, %r11d
movl %r10d, %ebp
shll $0xe, %ebp
movl %r10d, %r14d
shll $0x13, %r14d
orl %ebp, %r14d
shll $0xc, %r10d
orl %r14d, %r10d
movl %r9d, %ebp
shll $0x10, %ebp
orl %r10d, %ebp
leal (,%r9,4), %r10d
orl %ebp, %r10d
movl %r9d, %ebp
shll $0xd, %ebp
orl %r10d, %ebp
orl %r11d, %ebp
shll $0x5, %r9d
movl %r8d, %r10d
shll $0x15, %r10d
orl %r9d, %r10d
leal (,%r8,8), %r9d
orl %r10d, %r9d
movl %r8d, %r10d
shll $0x14, %r10d
orl %r9d, %r10d
shll $0x6, %r8d
orl %r10d, %r8d
orl %ebp, %r8d
xorl %r9d, %r9d
movl %ecx, %r10d
movl 0xc(%rbx), %r11d
testl %r11d, %r11d
jle 0x3dcc
imull %r10d, %r11d
movslq %r11d, %r11
shlq $0x2, %r11
addq 0x20(%rbx), %r11
xorl %r14d, %r14d
movl %r8d, (%r11,%r14,4)
incq %r14
cmpl 0xc(%rbx), %r14d
jl 0x3dbf
incl %r9d
addl $0xb, %r10d
cmpl 0x14(%rbx), %r9d
jl 0x3da4
incl %ecx
cmpl $0xb, %ecx
jne 0x3cb4
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x43dc(%rip), %rdi      # 0x81d0
callq 0x22c0
testl %eax, %eax
je 0x3bb3
callq 0x455f
movq %rax, 0x43bb(%rip)      # 0x81c8
leaq 0x43bc(%rip), %rdi      # 0x81d0
callq 0x2100
jmp 0x3bb3
leaq 0x43ab(%rip), %rdi      # 0x81d0
callq 0x22c0
testl %eax, %eax
je 0x3c05
callq 0x455f
movq %rax, 0x438a(%rip)      # 0x81c8
leaq 0x438b(%rip), %rdi      # 0x81d0
callq 0x2100
jmp 0x3c05
leaq 0x437a(%rip), %rdi      # 0x81d0
callq 0x22c0
testl %eax, %eax
je 0x3c57
callq 0x455f
movq %rax, 0x4359(%rip)      # 0x81c8
leaq 0x435a(%rip), %rdi      # 0x81d0
callq 0x2100
jmp 0x3c57
jmp 0x3e84
jmp 0x3e84
movq %rax, %rbx
leaq 0x4342(%rip), %rdi      # 0x81d0
callq 0x20f0
movq %rbx, %rdi
callq 0x22a0
nop