#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_pixel(int, int, int);
void draw_circle(int x0, int y0, int radius, int color) {
  for (int y = -radius; y <= radius; y++)
    for (int x = -radius; x <= radius; x++)
      if (x * x + y * y <= radius * radius)
        draw_pixel(x0 + x, y0 + y, color);
}


x86 assembly (clang, -O0):
<draw_circle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11a5 <draw_circle+0x95>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1192 <draw_circle+0x82>
mov    -0x18(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     117f <draw_circle+0x6f>
mov    -0x4(%rbp),%edi
add    -0x18(%rbp),%edi
mov    -0x8(%rbp),%esi
add    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <draw_pixel@plt>
jmp    1184 <draw_circle+0x74>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1140 <draw_circle+0x30>
jmp    1197 <draw_circle+0x87>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112c <draw_circle+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_circle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,0xc(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdx,0x10(%rsp)
test   %edx,%edx
js     11ca <draw_circle+0xba>
mov    %edi,%ebx
mov    0x10(%rsp),%rax
mov    %eax,%ecx
neg    %ecx
mov    %eax,%r15d
imul   %eax,%r15d
add    %eax,%eax
add    $0x1,%eax
mov    %eax,0x4(%rsp)
mov    %ecx,0x8(%rsp)
jmp    1170 <draw_circle+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x20(%rsp),%rcx
lea    0x1(%rcx),%eax
cmp    0x10(%rsp),%ecx
mov    %eax,%ecx
je     11ca <draw_circle+0xba>
mov    %ecx,%r13d
imul   %ecx,%r13d
mov    0x18(%rsp),%rax
mov    %rcx,0x20(%rsp)
lea    (%rcx,%rax,1),%ebp
mov    0x4(%rsp),%r14d
mov    0x8(%rsp),%eax
mov    %eax,%r12d
jmp    11aa <draw_circle+0x9a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r12d
add    $0xffffffff,%r14d
je     1160 <draw_circle+0x50>
mov    %r12d,%eax
imul   %r12d,%eax
add    %r13d,%eax
cmp    %r15d,%eax
ja     11a0 <draw_circle+0x90>
lea    (%rbx,%r12,1),%edi
mov    %ebp,%esi
mov    0xc(%rsp),%edx
call   1030 <draw_pixel@plt>
jmp    11a0 <draw_circle+0x90>
add    $0x28,%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, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %7
%12 = sub nsw i32 0, %11
store i32 %12, i32* %9
br label %13
13: ; preds = %50, %4
%14 = load i32, i32* %9
%15 = load i32, i32* %7
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %53
17: ; preds = %13
%18 = load i32, i32* %7
%19 = sub nsw i32 0, %18
store i32 %19, i32* %10
br label %20
20: ; preds = %46, %17
%21 = load i32, i32* %10
%22 = load i32, i32* %7
%23 = icmp sle i32 %21, %22
br i1 %23, label %24, label %49
24: ; preds = %20
%25 = load i32, i32* %10
%26 = load i32, i32* %10
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %9
%29 = load i32, i32* %9
%30 = mul nsw i32 %28, %29
%31 = add nsw i32 %27, %30
%32 = load i32, i32* %7
%33 = load i32, i32* %7
%34 = mul nsw i32 %32, %33
%35 = icmp sle i32 %31, %34
br i1 %35, label %36, label %45
36: ; preds = %24
%37 = load i32, i32* %5
%38 = load i32, i32* %10
%39 = add nsw i32 %37, %38
%40 = load i32, i32* %6
%41 = load i32, i32* %9
%42 = add nsw i32 %40, %41
%43 = load i32, i32* %8
%44 = call i32 @draw_pixel(i32 %39, i32 %42, i32 %43)
br label %45
45: ; preds = %36, %24
br label %46
46: ; preds = %45
%47 = load i32, i32* %10
%48 = add nsw i32 %47, 1
store i32 %48, i32* %10
br label %20
49: ; preds = %20
br label %50
50: ; preds = %49
%51 = load i32, i32* %9
%52 = add nsw i32 %51, 1
store i32 %52, i32* %9
br label %13
53: ; preds = %13
ret void
}

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