#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*/ printf(char *);
int exact_square(float number) {
  int count = 0, replacer;
  if (number - (int)number == 0) {
    replacer = (int)number;
  }
  for (count = 0; count < number; count++) {
    if (count * count == replacer) {
      printf("1\n");
      return 0;
    }
  }
  printf("0\n");
  return 0;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvttss2si -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm1
subss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1150 <exact_square+0x40>
jp     1150 <exact_square+0x40>
cvttss2si -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11a5 <exact_square+0x95>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1192 <exact_square+0x82>
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b8 <exact_square+0xa8>
jmp    1197 <exact_square+0x87>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1157 <exact_square+0x47>
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
lea    0xee9(%rip),%rdi
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    114d <exact_square+0x3d>
cvttss2si %xmm0,%eax
xor    %edx,%edx
lea    0xed6(%rip),%rcx
nopl   0x0(%rax)
mov    %edx,%esi
imul   %edx,%esi
cmp    %eax,%esi
je     114a <exact_square+0x3a>
add    $0x1,%edx
xorps  %xmm1,%xmm1
cvtsi2ss %edx,%xmm1
ucomiss %xmm1,%xmm0
ja     1130 <exact_square+0x20>
jmp    114d <exact_square+0x3d>
mov    %rcx,%rdi
push   %rax
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"0\0A\00"
define i32 @exact_square(float %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store float %0, float* %3
store i32 0, i32* %4
%6 = load float, float* %3
%7 = load float, float* %3
%8 = fptosi float %7 to i32
%9 = sitofp i32 %8 to float
%10 = fsub float %6, %9
%11 = fcmp oeq float %10, 0.000000e+00
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load float, float* %3
%14 = fptosi float %13 to i32
store i32 %14, i32* %5
br label %15
15: ; preds = %12, %1
store i32 0, i32* %4
br label %16
16: ; preds = %30, %15
%17 = load i32, i32* %4
%18 = sitofp i32 %17 to float
%19 = load float, float* %3
%20 = fcmp olt float %18, %19
br i1 %20, label %21, label %33
21: ; preds = %16
%22 = load i32, i32* %4
%23 = load i32, i32* %4
%24 = mul nsw i32 %22, %23
%25 = load i32, i32* %5
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %21
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %35
29: ; preds = %21
br label %30
30: ; preds = %29
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %16
33: ; preds = %16
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %35
35: ; preds = %33, %27
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
@str = [2 x i8] c"0\00"
@str.2 = [2 x i8] c"1\00"
define i32 @exact_square(float %0) {
%2 = fptosi float %0 to i32
%3 = fcmp ogt float %0, 0.000000e+00
br i1 %3, label %7, label %12
4: ; preds = %7
%5 = sitofp i32 %11 to float
%6 = fcmp olt float %5, %0
br i1 %6, label %7, label %12
7: ; preds = %1, %4
%8 = phi i32 [ %11, %4 ], [ 0, %1 ]
%9 = mul nsw i32 %8, %8
%10 = icmp eq i32 %9, %2
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %4
12: ; preds = %4, %7, %1
%13 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), %4 ]
%14 = tail call i32 @puts(i8* dereferenceable(1) %13)
ret i32 0
}