#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(int number) {
  int something;
  for (something = 0; something <= number; something++) {
    if (number == something * something) {
      printf("1\n");
      return 0;
    }
  }
  printf("0\n");
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     116b <exact_square+0x5b>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    1158 <exact_square+0x48>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1177 <exact_square+0x67>
jmp    115d <exact_square+0x4d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <exact_square+0x12>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
mov    %edi,%eax
lea    0xee7(%rip),%rdi
test   %eax,%eax
js     1145 <exact_square+0x35>
lea    0x1(%rax),%ecx
xor    %edx,%edx
lea    0xed9(%rip),%r8
nopl   0x0(%rax)
mov    %edx,%esi
imul   %edx,%esi
cmp    %eax,%esi
je     1142 <exact_square+0x32>
add    $0x1,%edx
cmp    %edx,%ecx
jne    1130 <exact_square+0x20>
jmp    1145 <exact_square+0x35>
mov    %r8,%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(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %18, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = load i32, i32* %4
%13 = mul nsw i32 %11, %12
%14 = icmp eq i32 %10, %13
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %23
17: ; preds = %9
br label %18
18: ; preds = %17
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %5
21: ; preds = %5
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %15
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
@str = [2 x i8] c"0\00"
@str.2 = [2 x i8] c"1\00"
define i32 @exact_square(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %10, label %6
3: ; preds = %6
%4 = add nuw i32 %7, 1
%5 = icmp eq i32 %7, %0
br i1 %5, label %10, label %6
6: ; preds = %1, %3
%7 = phi i32 [ %4, %3 ], [ 0, %1 ]
%8 = mul nsw i32 %7, %7
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %3, %6, %1
%11 = 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), %6 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), %3 ]
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
ret i32 0
}