#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 exact_square(char *);
int getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  char num[150];
  int isExact, index, temp;
  for (index = 0; index < 150; index++) {
    temp = getchar();
    if (temp == '\n')
      break;
    num[index] = temp;
  }
  isExact = exact_square(num);
  printf("%d \n\n", isExact);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xa8(%rbp)
cmpl   $0x96,-0xa8(%rbp)
jge    11a5 <main+0x75>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0xac(%rbp)
cmpl   $0xa,-0xac(%rbp)
jne    117b <main+0x4b>
jmp    11a5 <main+0x75>
mov    -0xac(%rbp),%eax
mov    %al,%cl
movslq -0xa8(%rbp),%rax
mov    %cl,-0xa0(%rbp,%rax,1)
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    114c <main+0x1c>
lea    -0xa0(%rbp),%rdi
call   1040 <exact_square@plt>
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%esi
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xa0,%rsp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     115c <main+0x2c>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x96,%rbx
jne    1140 <main+0x10>
mov    %rsp,%rdi
call   1040 <exact_square@plt>
lea    0xe95(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d \0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [150 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 150
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = call i32 (...) @getchar()
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 10
br i1 %12, label %13, label %14
13: ; preds = %9
br label %23
14: ; preds = %9
%15 = load i32, i32* %5
%16 = trunc i32 %15 to i8
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [150 x i8], [150 x i8]* %2, i64 0, i64 %18
store i8 %16, i8* %19
br label %20
20: ; preds = %14
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %6
23: ; preds = %13, %6
%24 = getelementptr inbounds [150 x i8], [150 x i8]* %2, i64 0, i64 0
%25 = call i32 @exact_square(i8* %24)
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d \0A\0A\00"
define i32 @main() {
%1 = alloca [150 x i8]
%2 = getelementptr inbounds [150 x i8], [150 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %7
%4 = phi i64 [ 0, %0 ], [ %10, %7 ]
%5 = tail call i32 (...) @getchar()
%6 = icmp eq i32 %5, 10
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = trunc i32 %5 to i8
%9 = getelementptr inbounds [150 x i8], [150 x i8]* %1, i64 0, i64 %4
store i8 %8, i8* %9
%10 = add nuw nsw i64 %4, 1
%11 = icmp eq i64 %10, 150
br i1 %11, label %12, label %3
12: ; preds = %3, %7
%13 = call i32 @exact_square(i8* %2)
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}