#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_circle_circum(int, int, int, int, char, char, char,
                                      int);
void draw_circle(int xCen, int yCen, int radius, char r, char g, char b,
                 int screen) {
  int x = 0;
  int y = radius;
  int p = (5 - radius * 4) / 4;
  draw_circle_circum(xCen, yCen, x, y, r, g, b, screen);
  while (x < y) {
    x++;
    if (p < 0) {
      p += 2 * x + 1;
    } else {
      y--;
      p += 2 * (x - y) + 1;
    }
    draw_circle_circum(xCen, yCen, x, y, r, g, b, screen);
  }
}


x86 assembly (clang, -O0):
<draw_circle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %r8d,-0x2c(%rbp)
mov    %ecx,%eax
mov    -0x2c(%rbp),%ecx
mov    %eax,-0x28(%rbp)
mov    %edx,%eax
mov    -0x28(%rbp),%edx
mov    %eax,-0x24(%rbp)
mov    %esi,%eax
mov    -0x24(%rbp),%esi
mov    %eax,-0x20(%rbp)
mov    %edi,%r8d
mov    -0x20(%rbp),%edi
mov    %r9b,%al
mov    0x10(%rbp),%r9d
mov    %r8d,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %dl,-0xd(%rbp)
mov    %cl,-0xe(%rbp)
mov    %al,-0xf(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
mov    $0x5,%eax
sub    %ecx,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0xd(%rbp),%r8b
mov    -0xe(%rbp),%r9b
mov    -0xf(%rbp),%r10b
mov    0x10(%rbp),%eax
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <draw_circle_circum@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1234 <draw_circle+0x124>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    11e0 <draw_circle+0xd0>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11fb <draw_circle+0xeb>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0xd(%rbp),%r8b
mov    -0xe(%rbp),%r9b
mov    -0xf(%rbp),%r10b
mov    0x10(%rbp),%eax
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <draw_circle_circum@plt>
jmp    11ad <draw_circle+0x9d>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_circle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r13d
mov    %r8d,%r15d
mov    %ecx,%ebp
mov    %edx,%ebx
mov    0x40(%rsp),%eax
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
xor    %edx,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
mov    %r15d,%r9d
push   %rax
push   %r13
call   1030 <draw_circle_circum@plt>
add    $0x10,%rsp
test   %ebx,%ebx
jle    11c5 <draw_circle+0xb5>
lea    0x0(,%rbx,4),%eax
mov    $0x5,%ecx
sub    %eax,%ecx
mov    $0x8,%r14d
sub    %eax,%r14d
test   %ecx,%ecx
cmovns %ecx,%r14d
sar    $0x2,%r14d
movsbl %r13b,%r12d
movsbl %bpl,%r13d
movsbl %r15b,%r15d
xor    %ebp,%ebp
nopl   0x0(%rax)
add    $0x1,%ebp
lea    -0x1(%rbx),%eax
test   %r14d,%r14d
cmovns %eax,%ebx
mov    $0x0,%ecx
cmovs  %ecx,%eax
mov    %ebp,%ecx
sub    %eax,%ecx
lea    (%r14,%rcx,2),%r14d
add    $0x1,%r14d
mov    (%rsp),%edi
mov    0x4(%rsp),%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %r13d,%r8d
mov    %r15d,%r9d
mov    0x40(%rsp),%eax
push   %rax
push   %r12
call   1030 <draw_circle_circum@plt>
add    $0x10,%rsp
cmp    %ebx,%ebp
jl     1180 <draw_circle+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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