#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 */
scalar_t__ pow(double, double);
double sqrt(scalar_t__);
void draw_centroid(double x, double y, double radius, int naxis1, int naxis2,
                   int **data, int color) {
  int i, j;
  double r;
  for (j = 0; j < naxis2; j++) {
    for (i = 0; i < naxis1; i++) {
      r = sqrt(pow((double)i - x, 2.0) + pow((double)j - y, 2.0));
      if (r <= radius) {
        data[j][i] = color;
      }
    }
  }
  return;
}


x86 assembly (clang, -O0):
<draw_centroid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11fd <draw_centroid+0xdd>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11ea <draw_centroid+0xca>
cvtsi2sdl -0x30(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xe84(%rip),%xmm1
call   1030 <pow@plt>
mov    %rax,-0x48(%rbp)
cvtsi2sdl -0x34(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xe69(%rip),%xmm1
call   1030 <pow@plt>
mov    -0x48(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11d7 <draw_centroid+0xb7>
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    11dc <draw_centroid+0xbc>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    115e <draw_centroid+0x3e>
jmp    11ef <draw_centroid+0xcf>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    114b <draw_centroid+0x2b>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_centroid>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %ecx,0xc(%rsp)
movsd  %xmm1,0x38(%rsp)
test   %esi,%esi
jle    1315 <draw_centroid+0x1f5>
mov    %rdx,%rbx
mov    %edi,%r14d
movapd %xmm0,%xmm1
mov    %esi,%eax
mov    %rax,0x40(%rsp)
mov    %edi,%r13d
mov    %r13,0x30(%rsp)
and    $0xfffffffe,%r13d
xor    %r12d,%r12d
movsd  %xmm2,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %edi,0x2c(%rsp)
jmp    118f <draw_centroid+0x6f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r12
cmp    0x40(%rsp),%r12
je     1315 <draw_centroid+0x1f5>
test   %r14d,%r14d
jle    1180 <draw_centroid+0x60>
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
subsd  0x38(%rsp),%xmm0
cmp    $0x1,%r14d
movsd  %xmm0,0x20(%rsp)
jne    11c0 <draw_centroid+0xa0>
xor    %r15d,%r15d
testb  $0x1,0x30(%rsp)
je     1180 <draw_centroid+0x60>
jmp    12b4 <draw_centroid+0x194>
nopl   (%rax)
xor    %r14d,%r14d
jmp    11e3 <draw_centroid+0xc3>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r14
cmp    %r13,%r14
movsd  0x10(%rsp),%xmm1
je     12a0 <draw_centroid+0x180>
mov    %r14,%r15
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
subsd  %xmm1,%xmm0
movsd  0xe06(%rip),%xmm1
call   1030 <pow@plt>
mov    %rax,%rbp
movsd  0x20(%rsp),%xmm0
movsd  0xdf0(%rip),%xmm1
call   1030 <pow@plt>
add    %rax,%rbp
mov    %rbp,%rdi
call   1040 <sqrt@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jb     1238 <draw_centroid+0x118>
mov    (%rbx,%r12,8),%rax
mov    0xc(%rsp),%ecx
mov    %ecx,(%rax,%r15,4)
lea    0x1(%r15),%r14
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
subsd  0x10(%rsp),%xmm0
movsd  0xdae(%rip),%xmm1
call   1030 <pow@plt>
mov    %rax,%rbp
movsd  0x20(%rsp),%xmm0
movsd  0xd98(%rip),%xmm1
call   1030 <pow@plt>
add    %rax,%rbp
mov    %rbp,%rdi
call   1040 <sqrt@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jb     11d0 <draw_centroid+0xb0>
mov    (%rbx,%r12,8),%rax
mov    0xc(%rsp),%ecx
mov    %ecx,0x4(%rax,%r15,4)
jmp    11d0 <draw_centroid+0xb0>
nopw   0x0(%rax,%rax,1)
add    $0x2,%r15
mov    0x2c(%rsp),%r14d
testb  $0x1,0x30(%rsp)
je     1180 <draw_centroid+0x60>
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
subsd  %xmm1,%xmm0
movsd  0xd38(%rip),%xmm1
call   1030 <pow@plt>
mov    %rax,%rbp
movsd  0x20(%rsp),%xmm0
movsd  0xd22(%rip),%xmm1
call   1030 <pow@plt>
add    %rax,%rbp
mov    %rbp,%rdi
call   1040 <sqrt@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movsd  0x10(%rsp),%xmm1
jb     1180 <draw_centroid+0x60>
mov    (%rbx,%r12,8),%rax
mov    0xc(%rsp),%ecx
mov    %ecx,(%rax,%r15,4)
jmp    1180 <draw_centroid+0x60>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @draw_centroid(double %0, double %1, double %2, i32 %3, i32 %4, i32** %5, i32 %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32**
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32** %5, i32*** %13
store i32 %6, i32* %14
store i32 0, i32* %16
br label %18
18: ; preds = %58, %7
%19 = load i32, i32* %16
%20 = load i32, i32* %12
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %61
22: ; preds = %18
store i32 0, i32* %15
br label %23
23: ; preds = %54, %22
%24 = load i32, i32* %15
%25 = load i32, i32* %11
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %57
27: ; preds = %23
%28 = load i32, i32* %15
%29 = sitofp i32 %28 to double
%30 = load double, double* %8
%31 = fsub double %29, %30
%32 = call i64 @pow(double %31, double 2.000000e+00)
%33 = load i32, i32* %16
%34 = sitofp i32 %33 to double
%35 = load double, double* %9
%36 = fsub double %34, %35
%37 = call i64 @pow(double %36, double 2.000000e+00)
%38 = add nsw i64 %32, %37
%39 = call double @sqrt(i64 %38)
store double %39, double* %17
%40 = load double, double* %17
%41 = load double, double* %10
%42 = fcmp ole double %40, %41
br i1 %42, label %43, label %53
43: ; preds = %27
%44 = load i32, i32* %14
%45 = load i32**, i32*** %13
%46 = load i32, i32* %16
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32*, i32** %45, i64 %47
%49 = load i32*, i32** %48
%50 = load i32, i32* %15
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
store i32 %44, i32* %52
br label %53
53: ; preds = %43, %27
br label %54
54: ; preds = %53
%55 = load i32, i32* %15
%56 = add nsw i32 %55, 1
store i32 %56, i32* %15
br label %23
57: ; preds = %23
br label %58
58: ; preds = %57
%59 = load i32, i32* %16
%60 = add nsw i32 %59, 1
store i32 %60, i32* %16
br label %18
61: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @draw_centroid(double %0, double %1, double %2, i32 %3, i32 %4, i32** nocapture %5, i32 %6) {
%8 = icmp sgt i32 %4, 0
br i1 %8, label %9, label %72
9: ; preds = %7
%10 = icmp sgt i32 %3, 0
%11 = zext i32 %4 to i64
%12 = zext i32 %3 to i64
%13 = and i64 %12, 1
%14 = icmp eq i32 %3, 1
%15 = and i64 %12, 4294967294
%16 = icmp eq i64 %13, 0
br label %17
17: ; preds = %9, %69
%18 = phi i64 [ 0, %9 ], [ %70, %69 ]
br i1 %10, label %19, label %69
19: ; preds = %17
%20 = trunc i64 %18 to i32
%21 = sitofp i32 %20 to double
%22 = fsub double %21, %1
%23 = getelementptr inbounds i32*, i32** %5, i64 %18
br i1 %14, label %55, label %24
24: ; preds = %19, %51
%25 = phi i64 [ %52, %51 ], [ 0, %19 ]
%26 = phi i64 [ %53, %51 ], [ 0, %19 ]
%27 = trunc i64 %25 to i32
%28 = sitofp i32 %27 to double
%29 = fsub double %28, %0
%30 = tail call i64 @pow(double %29, double 2.000000e+00)
%31 = tail call i64 @pow(double %22, double 2.000000e+00)
%32 = add nsw i64 %31, %30
%33 = tail call double @sqrt(i64 %32)
%34 = fcmp ugt double %33, %2
br i1 %34, label %38, label %35
35: ; preds = %24
%36 = load i32*, i32** %23
%37 = getelementptr inbounds i32, i32* %36, i64 %25
store i32 %6, i32* %37
br label %38
38: ; preds = %24, %35
%39 = or i64 %25, 1
%40 = trunc i64 %39 to i32
%41 = sitofp i32 %40 to double
%42 = fsub double %41, %0
%43 = tail call i64 @pow(double %42, double 2.000000e+00)
%44 = tail call i64 @pow(double %22, double 2.000000e+00)
%45 = add nsw i64 %44, %43
%46 = tail call double @sqrt(i64 %45)
%47 = fcmp ugt double %46, %2
br i1 %47, label %51, label %48
48: ; preds = %38
%49 = load i32*, i32** %23
%50 = getelementptr inbounds i32, i32* %49, i64 %39
store i32 %6, i32* %50
br label %51
51: ; preds = %48, %38
%52 = add nuw nsw i64 %25, 2
%53 = add i64 %26, 2
%54 = icmp eq i64 %53, %15
br i1 %54, label %55, label %24
55: ; preds = %51, %19
%56 = phi i64 [ 0, %19 ], [ %52, %51 ]
br i1 %16, label %69, label %57
57: ; preds = %55
%58 = trunc i64 %56 to i32
%59 = sitofp i32 %58 to double
%60 = fsub double %59, %0
%61 = tail call i64 @pow(double %60, double 2.000000e+00)
%62 = tail call i64 @pow(double %22, double 2.000000e+00)
%63 = add nsw i64 %62, %61
%64 = tail call double @sqrt(i64 %63)
%65 = fcmp ugt double %64, %2
br i1 %65, label %69, label %66
66: ; preds = %57
%67 = load i32*, i32** %23
%68 = getelementptr inbounds i32, i32* %67, i64 %56
store i32 %6, i32* %68
br label %69
69: ; preds = %55, %66, %57, %17
%70 = add nuw nsw i64 %18, 1
%71 = icmp eq i64 %70, %11
br i1 %71, label %72, label %17
72: ; preds = %69, %7
ret void
}