#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 pow(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i = 0, j = 0, count = 0, samples = 0;
  printf("Please enter the sample size.\n");
  scanf("%d", &samples);
  for (i = 0; i < samples; i++) {
    for (j = 0; j < samples; j++) {
      if (pow((j - samples / (float)2), 2) + pow((i - samples / (float)2), 2) <=
          (samples * samples) / (float)4)
        printf("*");
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1254 <main+0x124>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    123a <main+0x10a>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
movss  0xe55(%rip),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %eax,-0x18(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
movss  0xe2a(%rip),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
cvtsi2ss %eax,%xmm1
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  0xdf2(%rip),%xmm2
divss  %xmm2,%xmm0
ucomiss %xmm1,%xmm0
jb     1227 <main+0xf7>
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
jmp    122c <main+0xfc>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1191 <main+0x61>
lea    0xde4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117e <main+0x4e>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
lea    0xeb4(%rip),%rdi
call   1040 <puts@plt>
lea    0xea5(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    125b <main+0x11b>
xor    %r14d,%r14d
jmp    119b <main+0x5b>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
mov    0x8(%rsp),%eax
cmp    %eax,%r14d
jge    125b <main+0x11b>
test   %eax,%eax
jle    1180 <main+0x40>
xorps  %xmm0,%xmm0
cvtsi2ss %r14d,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %ebp,%ebp
jmp    11c7 <main+0x87>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %eax,%ebp
jge    1180 <main+0x40>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movss  0xe23(%rip),%xmm2
mulss  %xmm2,%xmm1
subss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
mov    $0x2,%esi
call   1060 <pow@plt>
mov    %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2ssl 0x8(%rsp),%xmm0
mulss  0xdfa(%rip),%xmm0
movss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
cvttss2si %xmm1,%edi
mov    $0x2,%esi
call   1060 <pow@plt>
add    %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    0x8(%rsp),%eax
mov    %eax,%ecx
imul   %eax,%ecx
xorps  %xmm1,%xmm1
cvtsi2ss %ecx,%xmm1
mulss  0xdc5(%rip),%xmm1
ucomiss %xmm0,%xmm1
jb     11c0 <main+0x80>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%eax
jmp    11c0 <main+0x80>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Please enter the sample size.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
store i32 0, i32* %2
br label %8
8: ; preds = %50, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %53
12: ; preds = %8
store i32 0, i32* %3
br label %13
13: ; preds = %45, %12
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %48
17: ; preds = %13
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to float
%20 = load i32, i32* %5
%21 = sitofp i32 %20 to float
%22 = fdiv float %21, 2.000000e+00
%23 = fsub float %19, %22
%24 = fptosi float %23 to i32
%25 = call i32 @pow(i32 %24, i32 2)
%26 = load i32, i32* %2
%27 = sitofp i32 %26 to float
%28 = load i32, i32* %5
%29 = sitofp i32 %28 to float
%30 = fdiv float %29, 2.000000e+00
%31 = fsub float %27, %30
%32 = fptosi float %31 to i32
%33 = call i32 @pow(i32 %32, i32 2)
%34 = add nsw i32 %25, %33
%35 = sitofp i32 %34 to float
%36 = load i32, i32* %5
%37 = load i32, i32* %5
%38 = mul nsw i32 %36, %37
%39 = sitofp i32 %38 to float
%40 = fdiv float %39, 4.000000e+00
%41 = fcmp ole float %35, %40
br i1 %41, label %42, label %44
42: ; preds = %17
%43 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42, %17
br label %45
45: ; preds = %44
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %13
48: ; preds = %13
%49 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %48
%51 = load i32, i32* %2
%52 = add nsw i32 %51, 1
store i32 %52, i32* %2
br label %8
53: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [30 x i8] c"Please enter the sample size.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %47
7: ; preds = %0, %42
%8 = phi i32 [ %45, %42 ], [ %5, %0 ]
%9 = phi i32 [ %44, %42 ], [ 0, %0 ]
%10 = icmp sgt i32 %8, 0
br i1 %10, label %11, label %42
11: ; preds = %7
%12 = sitofp i32 %9 to float
br label %13
13: ; preds = %11, %38
%14 = phi i32 [ %8, %11 ], [ %39, %38 ]
%15 = phi i32 [ 0, %11 ], [ %40, %38 ]
%16 = sitofp i32 %15 to float
%17 = sitofp i32 %14 to float
%18 = fmul float %17, 5.000000e-01
%19 = fsub float %16, %18
%20 = fptosi float %19 to i32
%21 = call i32 @pow(i32 %20, i32 2)
%22 = load i32, i32* %1
%23 = sitofp i32 %22 to float
%24 = fmul float %23, 5.000000e-01
%25 = fsub float %12, %24
%26 = fptosi float %25 to i32
%27 = call i32 @pow(i32 %26, i32 2)
%28 = add nsw i32 %27, %21
%29 = sitofp i32 %28 to float
%30 = load i32, i32* %1
%31 = mul nsw i32 %30, %30
%32 = sitofp i32 %31 to float
%33 = fmul float %32, 2.500000e-01
%34 = fcmp ult float %33, %29
br i1 %34, label %38, label %35
35: ; preds = %13
%36 = call i32 @putchar(i32 42)
%37 = load i32, i32* %1
br label %38
38: ; preds = %13, %35
%39 = phi i32 [ %30, %13 ], [ %37, %35 ]
%40 = add nuw nsw i32 %15, 1
%41 = icmp slt i32 %40, %39
br i1 %41, label %13, label %42
42: ; preds = %38, %7
%43 = call i32 @putchar(i32 10)
%44 = add nuw nsw i32 %9, 1
%45 = load i32, i32* %1
%46 = icmp slt i32 %44, %45
br i1 %46, label %7, label %47
47: ; preds = %42, %0
ret i32 0
}