// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]rbtree/test/bitmap.c
// Function: bitmap_draw_circle
int bitmap_draw_circle(bitmap_t *bitmap, int xc, int yc, int r, int fill, color_t c)
{
	int x = 0, y = r, yi, d;
	int rc = 0;

	/* ����Բ��ͼƬ�ɼ������⣬ֱ���˳� */
	if (xc + r < 0 || xc - r >= bitmap->w ||
		yc + r < 0 || yc - r >= bitmap->h) {
		errno = ERANGE;
		return -1;
	}

	d = 3 - 2 * r;

	if (fill) {
		/* �������䣨��ʵ��Բ��*/
		while (x <= y) {
			for (yi = x; yi <= y; yi++) {
				if (draw_circle_8(bitmap, xc, yc, x, yi, c) != 0)
					rc = -1;
			}

			if (d < 0) {
				d = d + 4 * x + 6;
			}
			else {
				d = d + 4 * (x - y) + 10;
				y--;
			}
			x++;
		}
	}
	else {
		/* ���������䣨������Բ��*/
		while (x <= y) {
			if (draw_circle_8(bitmap, xc, yc, x, y, c) != 0)
				rc = -1;

			if (d < 0) {
				d = d + 4 * x + 6;
			}
			else {
				d = d + 4 * (x - y) + 10;
				y--;
			}
			x++;
		}
	}

	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x14(%rbp), %eax
addl -0x1c(%rbp), %eax
cmpl $0x0, %eax
jl 0x3204
movl -0x14(%rbp), %eax
subl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x3204
movl -0x18(%rbp), %eax
addl -0x1c(%rbp), %eax
cmpl $0x0, %eax
jl 0x3204
movl -0x18(%rbp), %eax
subl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jl 0x321b
callq 0x1050
movl $0x22, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3342
movl -0x1c(%rbp), %ecx
shll %ecx
movl $0x3, %eax
subl %ecx, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x32c9
jmp 0x3236
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jg 0x32c7
movl -0x28(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jg 0x3283
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x28(%rbp), %ecx
movl -0x30(%rbp), %r8d
movl -0x24(%rbp), %r9d
callq 0x3350
cmpl $0x0, %eax
je 0x3276
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
jmp 0x3278
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x3248
cmpl $0x0, -0x34(%rbp)
jge 0x329c
movl -0x34(%rbp), %eax
movl -0x28(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
addl $0x6, %eax
movl %eax, -0x34(%rbp)
jmp 0x32b9
movl -0x34(%rbp), %eax
movl -0x28(%rbp), %ecx
subl -0x2c(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
addl $0xa, %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x3236
jmp 0x333c
jmp 0x32cb
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jg 0x333a
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x28(%rbp), %ecx
movl -0x2c(%rbp), %r8d
movl -0x24(%rbp), %r9d
callq 0x3350
cmpl $0x0, %eax
je 0x32f9
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
cmpl $0x0, -0x34(%rbp)
jge 0x3312
movl -0x34(%rbp), %eax
movl -0x28(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
addl $0x6, %eax
movl %eax, -0x34(%rbp)
jmp 0x332f
movl -0x34(%rbp), %eax
movl -0x28(%rbp), %ecx
subl -0x2c(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
addl $0xa, %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x32cb
jmp 0x333c
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)