#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);
int main() {
  int i, m, n;
  for (i = 0; i < 256; i++) {
    n = i * i;
    m = 0;
    while (n) {
      m = m * 10 + n % 10;
      n = n / 10;
    }
    if (m == i * i)
      printf("%d\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    11af <main+0x9f>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     117b <main+0x6b>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
add    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    1144 <main+0x34>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jne    119c <main+0x8c>
mov    -0x8(%rbp),%esi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
jmp    11a1 <main+0x91>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
jmp    112b <main+0x1b>
nop
add    $0x1,%ebx
cmp    $0x100,%ebx
je     1190 <main+0x80>
mov    %ebx,%r8d
imul   %ebx,%r8d
mov    $0x0,%edx
test   %r8d,%r8d
je     117f <main+0x6f>
xor    %edx,%edx
mov    %r8d,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rdx,%rdx,4),%edx
movslq %ecx,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rcx
add    %edi,%ecx
lea    (%rcx,%rcx,1),%edi
lea    (%rdi,%rdi,4),%edi
mov    %eax,%esi
sub    %edi,%esi
lea    (%rsi,%rdx,2),%edx
add    $0x9,%eax
cmp    $0x12,%eax
ja     1150 <main+0x40>
cmp    %r8d,%edx
jne    1120 <main+0x10>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %19
%2 = phi i32 [ 0, %0 ], [ %20, %19 ]
%3 = mul nuw nsw i32 %2, %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %11, %5 ], [ %3, %1 ]
%7 = phi i32 [ %10, %5 ], [ 0, %1 ]
%8 = mul nsw i32 %7, 10
%9 = srem i32 %6, 10
%10 = add nsw i32 %9, %8
%11 = sdiv i32 %6, 10
%12 = add i32 %6, 9
%13 = icmp ult i32 %12, 19
br i1 %13, label %14, label %5
14: ; preds = %5, %1
%15 = phi i32 [ 0, %1 ], [ %10, %5 ]
%16 = icmp eq i32 %15, %3
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %19
19: ; preds = %14, %17
%20 = add nuw nsw i32 %2, 1
%21 = icmp eq i32 %20, 256
br i1 %21, label %22, label %1
22: ; preds = %19
ret i32 0
}