// File: /workspace/github_c_makefile_star2_O0/wjdready[P]arduboy2/./src/arduboy2/graph.cpp
// Function: graph::drawCircleHelper(short, short, unsigned char, unsigned char, unsigned char)
void graph::drawCircleHelper(int16_t x0, int16_t y0, uint8_t r, uint8_t corners, uint8_t color)
{
  int16_t f = 1 - r;
  int16_t ddF_x = 1;
  int16_t ddF_y = -2 * r;
  int16_t x = 0;
  int16_t y = r;

  while (x<y)
  {
    if (f >= 0)
    {
      y--;
      ddF_y += 2;
      f += ddF_y;
    }

    x++;
    ddF_x += 2;
    f += ddF_x;

    if (corners & 0x4) // lower right
    {
      drawPixel(x0 + x, y0 + y, color);
      drawPixel(x0 + y, y0 + x, color);
    }
    if (corners & 0x2) // upper right
    {
      drawPixel(x0 + x, y0 - y, color);
      drawPixel(x0 + y, y0 - x, color);
    }
    if (corners & 0x8) // lower left
    {
      drawPixel(x0 - y, y0 + x, color);
      drawPixel(x0 - x, y0 + y, color);
    }
    if (corners & 0x1) // upper left
    {
      drawPixel(x0 - y, y0 - x, color);
      drawPixel(x0 - x, y0 - y, color);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %r8d, -0x38(%rbp)
movl %ecx, %eax
movl -0x38(%rbp), %ecx
movl %eax, -0x34(%rbp)
movl %edx, %eax
movl -0x34(%rbp), %edx
movl %eax, -0x30(%rbp)
movl %esi, %eax
movl -0x30(%rbp), %esi
movl %eax, -0x2c(%rbp)
movq %rdi, %r8
movl -0x2c(%rbp), %edi
movb %r9b, %al
movq %r8, -0x8(%rbp)
movw %di, -0xa(%rbp)
movw %si, -0xc(%rbp)
movb %dl, -0xd(%rbp)
movb %cl, -0xe(%rbp)
movb %al, -0xf(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movzbl -0xd(%rbp), %ecx
movl $0x1, %eax
subl %ecx, %eax
movw %ax, -0x12(%rbp)
movw $0x1, -0x14(%rbp)
movzbl -0xd(%rbp), %eax
imull $0xfffffffe, %eax, %eax # imm = 0xFFFFFFFE
movw %ax, -0x16(%rbp)
movw $0x0, -0x18(%rbp)
movzbl -0xd(%rbp), %eax
movw %ax, -0x1a(%rbp)
movswl -0x18(%rbp), %eax
movswl -0x1a(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1e2b
movswl -0x12(%rbp), %eax
cmpl $0x0, %eax
jl 0x1cc9
movw -0x1a(%rbp), %ax
addw $-0x1, %ax
movw %ax, -0x1a(%rbp)
movswl -0x16(%rbp), %eax
addl $0x2, %eax
movw %ax, -0x16(%rbp)
movswl -0x16(%rbp), %ecx
movswl -0x12(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x12(%rbp)
movw -0x18(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x18(%rbp)
movswl -0x14(%rbp), %eax
addl $0x2, %eax
movw %ax, -0x14(%rbp)
movswl -0x14(%rbp), %ecx
movswl -0x12(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x12(%rbp)
movzbl -0xe(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1d3c
movq -0x28(%rbp), %rdi
movswl -0xa(%rbp), %esi
movswl -0x18(%rbp), %eax
addl %eax, %esi
movswl -0xc(%rbp), %edx
movswl -0x1a(%rbp), %eax
addl %eax, %edx
movzbl -0xf(%rbp), %ecx
callq 0x2fc0
movq -0x28(%rbp), %rdi
movswl -0xa(%rbp), %esi
movswl -0x1a(%rbp), %eax
addl %eax, %esi
movswl -0xc(%rbp), %edx
movswl -0x18(%rbp), %eax
addl %eax, %edx
movzbl -0xf(%rbp), %ecx
callq 0x2fc0
movzbl -0xe(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1d8a
movq -0x28(%rbp), %rdi
movswl -0xa(%rbp), %esi
movswl -0x18(%rbp), %eax
addl %eax, %esi
movswl -0xc(%rbp), %edx
movswl -0x1a(%rbp), %eax
subl %eax, %edx
movzbl -0xf(%rbp), %ecx
callq 0x2fc0
movq -0x28(%rbp), %rdi
movswl -0xa(%rbp), %esi
movswl -0x1a(%rbp), %eax
addl %eax, %esi
movswl -0xc(%rbp), %edx
movswl -0x18(%rbp), %eax
subl %eax, %edx
movzbl -0xf(%rbp), %ecx
callq 0x2fc0
movzbl -0xe(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x1dd8
movq -0x28(%rbp), %rdi
movswl -0xa(%rbp), %esi
movswl -0x1a(%rbp), %eax
subl %eax, %esi
movswl -0xc(%rbp), %edx
movswl -0x18(%rbp), %eax
addl %eax, %edx
movzbl -0xf(%rbp), %ecx
callq 0x2fc0
movq -0x28(%rbp), %rdi
movswl -0xa(%rbp), %esi
movswl -0x18(%rbp), %eax
subl %eax, %esi
movswl -0xc(%rbp), %edx
movswl -0x1a(%rbp), %eax
addl %eax, %edx
movzbl -0xf(%rbp), %ecx
callq 0x2fc0
movzbl -0xe(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1e26
movq -0x28(%rbp), %rdi
movswl -0xa(%rbp), %esi
movswl -0x1a(%rbp), %eax
subl %eax, %esi
movswl -0xc(%rbp), %edx
movswl -0x18(%rbp), %eax
subl %eax, %edx
movzbl -0xf(%rbp), %ecx
callq 0x2fc0
movq -0x28(%rbp), %rdi
movswl -0xa(%rbp), %esi
movswl -0x18(%rbp), %eax
subl %eax, %esi
movswl -0xc(%rbp), %edx
movswl -0x1a(%rbp), %eax
subl %eax, %edx
movzbl -0xf(%rbp), %ecx
callq 0x2fc0
jmp 0x1c8b
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)