#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ draw_mp_circle_lines(unsigned char *, int const, int const,
                                        int const, int const, int, int,
                                        int const);
void draw_mp_circle(unsigned char *pixelbuf, const int image_width,
                    const int image_height, const int x0, const int y0,
                    const int r, const int fill) {
  int f = 1 - r;
  int ddF_x = 0;
  int ddF_y = -2 * r;
  int x = 0;
  int y = r;
  draw_mp_circle_lines(pixelbuf, image_width, image_height, x0, y0, x, y, fill);
  while (x < y) {
    if (f >= 0) {
      y--;
      ddF_y += 2;
      f += ddF_y;
    }
    x++;
    ddF_x += 2;
    f += ddF_x + 1;
    draw_mp_circle_lines(pixelbuf, image_width, image_height, x0, y0, x, y,
                         fill);
  }
}


x86 assembly (clang, -O0):
<draw_mp_circle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    $0x1,%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
imul   $0xfffffffe,-0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%r10d
mov    0x10(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <draw_mp_circle_lines@plt>
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    11ff <draw_mp_circle+0xef>
cmpl   $0x0,-0x20(%rbp)
jl     11b3 <draw_mp_circle+0xa3>
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%r10d
mov    0x10(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <draw_mp_circle_lines@plt>
jmp    1182 <draw_mp_circle+0x72>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_mp_circle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%ebx
mov    0x50(%rsp),%eax
xor    %r14d,%r14d
mov    %rdi,0x10(%rsp)
mov    %esi,0x4(%rsp)
mov    %edx,0x8(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r8d,%ebp
xor    %r9d,%r9d
push   %rax
push   %rbx
call   1030 <draw_mp_circle_lines@plt>
add    $0x10,%rsp
test   %ebx,%ebx
jle    11c7 <draw_mp_circle+0xb7>
lea    (%rbx,%rbx,1),%r15d
neg    %r15d
mov    $0x1,%eax
sub    %ebx,%eax
mov    $0x3,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x2(%r15),%ecx
test   %eax,%eax
mov    $0x0,%r13d
cmovns %ecx,%r13d
cmovns %ecx,%r15d
add    %eax,%r13d
sar    $0x1f,%eax
not    %eax
add    %eax,%ebx
add    $0x1,%r14d
add    %r12d,%r13d
mov    0x10(%rsp),%rdi
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %ebp,%r8d
mov    %r14d,%r9d
mov    0x50(%rsp),%eax
push   %rax
push   %rbx
call   1030 <draw_mp_circle_lines@plt>
add    $0x10,%rsp
add    $0x2,%r12d
mov    %r13d,%eax
cmp    %ebx,%r14d
jl     1170 <draw_mp_circle+0x60>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @draw_mp_circle(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%20 = load i32, i32* %13
%21 = sub nsw i32 1, %20
store i32 %21, i32* %15
store i32 0, i32* %16
%22 = load i32, i32* %13
%23 = mul nsw i32 -2, %22
store i32 %23, i32* %17
store i32 0, i32* %18
%24 = load i32, i32* %13
store i32 %24, i32* %19
%25 = load i8*, i8** %8
%26 = load i32, i32* %9
%27 = load i32, i32* %10
%28 = load i32, i32* %11
%29 = load i32, i32* %12
%30 = load i32, i32* %18
%31 = load i32, i32* %19
%32 = load i32, i32* %14
%33 = call i32 @draw_mp_circle_lines(i8* %25, i32 %26, i32 %27, i32 %28, i32 %29, i32 %30, i32 %31, i32 %32)
br label %34
34: ; preds = %49, %7
%35 = load i32, i32* %18
%36 = load i32, i32* %19
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %67
38: ; preds = %34
%39 = load i32, i32* %15
%40 = icmp sge i32 %39, 0
br i1 %40, label %41, label %49
41: ; preds = %38
%42 = load i32, i32* %19
%43 = add nsw i32 %42, -1
store i32 %43, i32* %19
%44 = load i32, i32* %17
%45 = add nsw i32 %44, 2
store i32 %45, i32* %17
%46 = load i32, i32* %17
%47 = load i32, i32* %15
%48 = add nsw i32 %47, %46
store i32 %48, i32* %15
br label %49
49: ; preds = %41, %38
%50 = load i32, i32* %18
%51 = add nsw i32 %50, 1
store i32 %51, i32* %18
%52 = load i32, i32* %16
%53 = add nsw i32 %52, 2
store i32 %53, i32* %16
%54 = load i32, i32* %16
%55 = add nsw i32 %54, 1
%56 = load i32, i32* %15
%57 = add nsw i32 %56, %55
store i32 %57, i32* %15
%58 = load i8*, i8** %8
%59 = load i32, i32* %9
%60 = load i32, i32* %10
%61 = load i32, i32* %11
%62 = load i32, i32* %12
%63 = load i32, i32* %18
%64 = load i32, i32* %19
%65 = load i32, i32* %14
%66 = call i32 @draw_mp_circle_lines(i8* %58, i32 %59, i32 %60, i32 %61, i32 %62, i32 %63, i32 %64, i32 %65)
br label %34
67: ; preds = %34
ret void
}

LLVM IR (-O2):
define void @draw_mp_circle(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = tail call i32 @draw_mp_circle_lines(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 0, i32 %5, i32 %6)
%9 = icmp sgt i32 %5, 0
br i1 %9, label %10, label %33
10: ; preds = %7
%11 = mul nsw i32 %5, -2
%12 = sub nsw i32 1, %5
br label %13
13: ; preds = %10, %13
%14 = phi i32 [ %25, %13 ], [ %5, %10 ]
%15 = phi i32 [ %26, %13 ], [ 0, %10 ]
%16 = phi i32 [ %22, %13 ], [ %11, %10 ]
%17 = phi i32 [ %27, %13 ], [ 0, %10 ]
%18 = phi i32 [ %30, %13 ], [ %12, %10 ]
%19 = icmp sgt i32 %18, -1
%20 = add nsw i32 %16, 2
%21 = select i1 %19, i32 %20, i32 0
%22 = select i1 %19, i32 %20, i32 %16
%23 = ashr i32 %18, 31
%24 = xor i32 %23, -1
%25 = add nsw i32 %14, %24
%26 = add nuw nsw i32 %15, 1
%27 = add nuw nsw i32 %17, 2
%28 = add i32 %18, 3
%29 = add i32 %28, %17
%30 = add i32 %29, %21
%31 = tail call i32 @draw_mp_circle_lines(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %26, i32 %25, i32 %6)
%32 = icmp slt i32 %26, %25
br i1 %32, label %13, label %33
33: ; preds = %13, %7
ret void
}