// File: /workspace/github_c_makefile_star2_O1/nkanaev[P]tipsy/src/tigr.c
// Function: tigrCircle
void tigrCircle(Tigr* bmp, int x0, int y0, int r, TPixel color) {
    int E = 1 - r;
    int dx = 0;
    int dy = -2 * r;
    int x = 0;
    int y = r;

    tigrPlot(bmp, x0, y0 + r, color);
    tigrPlot(bmp, x0, y0 - r, color);
    tigrPlot(bmp, x0 + r, y0, color);
    tigrPlot(bmp, x0 - r, y0, color);

    while (x < y - 1) {
        x++;

        if (E >= 0) {
            y--;
            dy += 2;
            E += dy;
        }

        dx += 2;
        E += dx + 1;

        tigrPlot(bmp, x0 + x, y0 + y, color);
        tigrPlot(bmp, x0 - x, y0 + y, color);
        tigrPlot(bmp, x0 + x, y0 - y, color);
        tigrPlot(bmp, x0 - x, y0 - y, color);

        if (x != y) {
            tigrPlot(bmp, x0 + y, y0 + x, color);
            tigrPlot(bmp, x0 - y, y0 + x, color);
            tigrPlot(bmp, x0 + y, y0 - x, color);
            tigrPlot(bmp, x0 - y, y0 - x, color);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, %ebx
movl %ecx, %r13d
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %r12
leal (%r14,%r13), %edx
movl %r8d, %ecx
callq 0x3c26
movl %r14d, %edx
subl %r13d, %edx
movq %r12, %rdi
movl %r15d, %esi
movl %ebx, %ecx
callq 0x3c26
leal (%r15,%r13), %esi
movq %r12, %rdi
movl %r14d, %edx
movl %ebx, %ecx
callq 0x3c26
movq %r15, 0x40(%rsp)
movl %r15d, %esi
subl %r13d, %esi
movq %r12, 0x38(%rsp)
movq %r12, %rdi
movq %r14, 0x20(%rsp)
movl %r14d, %edx
movl %ebx, 0xc(%rsp)
movl %ebx, %ecx
callq 0x3c26
cmpl $0x2, %r13d
jl 0x42aa
leal -0x1(%r13), %eax
leal (,%r13,2), %esi
negl %esi
movl $0x1, %edi
movl $0x1, %ebx
subl %r13d, %ebx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rcx, 0x18(%rsp)
movl $0x3, %ecx
movl %ecx, 0x30(%rsp)
movq %rdi, 0x48(%rsp)
leal 0x2(%rsi), %ecx
testl %ebx, %ebx
movl $0x0, %edx
cmovnsl %ecx, %edx
movl %edx, 0x34(%rsp)
movl %r13d, %edx
cmovnsl %ecx, %esi
movq %rsi, 0x50(%rsp)
movl %eax, %r13d
cmovsl %edx, %r13d
movq 0x40(%rsp), %r15
leal (%r15,%rdi), %esi
movl %esi, 0x10(%rsp)
movq 0x20(%rsp), %rax
leal (%r13,%rax), %r14d
movq 0x38(%rsp), %rbp
movq %rbp, %rdi
movl %r14d, %edx
movl 0xc(%rsp), %r12d
movl %r12d, %ecx
callq 0x3c26
movq 0x18(%rsp), %rax
addl %eax, %r15d
movq %rbp, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %r12d, %ecx
callq 0x3c26
movq 0x20(%rsp), %rax
movl %eax, %r14d
subl %r13d, %r14d
movq %rbp, %rdi
movl 0x10(%rsp), %esi
movl %r14d, %edx
movl %r12d, %ecx
callq 0x3c26
movq %rbp, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %r12d, %ecx
callq 0x3c26
movq 0x48(%rsp), %rdx
cmpl %r13d, %edx
je 0x4275
movq 0x40(%rsp), %r15
leal (%r15,%r13), %esi
movl %esi, 0x2c(%rsp)
movq %r13, 0x10(%rsp)
movq 0x20(%rsp), %r13
leal (%r13,%rdx), %r14d
movq 0x38(%rsp), %rbp
movq %rbp, %rdi
movl %r14d, %edx
movl 0xc(%rsp), %r12d
movl %r12d, %ecx
callq 0x3c26
subl 0x10(%rsp), %r15d
movq %rbp, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %r12d, %ecx
callq 0x3c26
movq 0x18(%rsp), %rax
leal (%rax,%r13), %r14d
movq 0x10(%rsp), %r13
movq %rbp, %rdi
movl 0x2c(%rsp), %esi
movl %r14d, %edx
movl %r12d, %ecx
callq 0x3c26
movq %rbp, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %r12d, %ecx
callq 0x3c26
movq 0x48(%rsp), %rdx
movl 0x30(%rsp), %r8d
addl %r8d, %ebx
addl 0x34(%rsp), %ebx
leal -0x1(%r13), %eax
leal 0x1(%rdx), %ecx
movq 0x18(%rsp), %rsi
decl %esi
movq %rsi, 0x18(%rsp)
addl $0x2, %r8d
cmpl %eax, %edx
movl %ecx, %edi
movq 0x50(%rsp), %rsi
movl %r8d, %ecx
jl 0x4145
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq