#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("\n1");
      printf("\n");
      printf("\n%d = %d ^ 2", replacer, count);
      printf("\n");
      return 0;
    }
  }
  printf("\n0");
  printf("\n");
  printf("\nThere is no square root of %.2f ", number);
  printf("\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    11d7 <exact_square+0xc7>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11c4 <exact_square+0xb4>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    121f <exact_square+0x10f>
jmp    11c9 <exact_square+0xb9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1157 <exact_square+0x47>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe12(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
push   %rbp
push   %rbx
push   %rax
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1158 <exact_square+0x38>
cvttss2si %xmm0,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%eax
imul   %ebp,%eax
cmp    %ebx,%eax
je     1190 <exact_square+0x70>
add    $0x1,%ebp
xorps  %xmm1,%xmm1
cvtsi2ss %ebp,%xmm1
ucomiss %xmm1,%xmm0
ja     1140 <exact_square+0x20>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
movss  %xmm0,0x4(%rsp)
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11ba <exact_square+0x9a>
lea    0xe69(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe54(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0A1\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [13 x i8] c"\0A%d = %d ^ 2\00"
@.str.3 = [3 x i8] c"\0A0\00"
@.str.4 = [34 x i8] c"\0AThere is no square root of %.2f \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 = %35, %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 %38
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 %34
27: ; preds = %21
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* %5
%31 = load i32, i32* %4
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %45
34: ; preds = %21
br label %35
35: ; preds = %34
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %16
38: ; preds = %16
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%41 = load float, float* %3
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %45
45: ; preds = %38, %27
%46 = load i32, i32* %2
ret i32 %46
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0A1\00"
@.str.2 = [13 x i8] c"\0A%d = %d ^ 2\00"
@.str.3 = [3 x i8] c"\0A0\00"
@.str.4 = [34 x i8] c"\0AThere is no square root of %.2f \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 %4, label %16
4: ; preds = %1, %12
%5 = phi i32 [ %13, %12 ], [ 0, %1 ]
%6 = mul nsw i32 %5, %5
%7 = icmp eq i32 %6, %2
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @putchar(i32 10)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %2, i32 %5)
br label %21
12: ; preds = %4
%13 = add nuw nsw i32 %5, 1
%14 = sitofp i32 %13 to float
%15 = fcmp olt float %14, %0
br i1 %15, label %4, label %16
16: ; preds = %12, %1
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call i32 @putchar(i32 10)
%19 = fpext float %0 to double
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double %19)
br label %21
21: ; preds = %16, %8
%22 = tail call i32 @putchar(i32 10)
ret i32 0
}