#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 x, n, hi, lo;
  for (x = 1;; x++) {
    n = x * x;
    if (n < 1000)
      continue;
    if (n > 9999)
      break;
    hi = n / 100;
    lo = n % 100;
    if (hi / 10 == hi % 10 && lo / 10 == lo % 10)
      printf("%d\n", n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1142 <main+0x32>
jmp    11cc <main+0xbc>
cmpl   $0x270f,-0xc(%rbp)
jle    1154 <main+0x44>
jmp    11da <main+0xca>
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
cmp    %edx,%eax
jne    11c7 <main+0xb7>
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%eax
cmp    %edx,%eax
jne    11c7 <main+0xb7>
mov    -0xc(%rbp),%esi
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
jmp    11cc <main+0xbc>
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   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
lea    0xee1(%rip),%rbx
jmp    1133 <main+0x23>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %ebp,%esi
imul   %ebp,%esi
cmp    $0x3e8,%esi
jb     1130 <main+0x20>
cmp    $0x270f,%esi
ja     11ab <main+0x9b>
movzwl %si,%ecx
mov    %ecx,%eax
shr    $0x2,%eax
imul   $0x147b,%eax,%eax
shr    $0x11,%eax
shr    $0x3,%ecx
imul   $0x20c5,%ecx,%ecx
shr    $0x14,%ecx
movzbl %al,%edx
imul   $0xcd,%edx,%edi
shr    $0xa,%edi
and    $0xfffffffe,%edi
lea    (%rdi,%rdi,4),%edi
sub    %dil,%dl
movzbl %dl,%edx
cmp    %dx,%cx
jne    1130 <main+0x20>
imul   $0x64,%eax,%eax
mov    %esi,%ecx
sub    %eax,%ecx
movzbl %cl,%eax
imul   $0xcd,%eax,%eax
shr    $0xb,%eax
lea    (%rax,%rax,1),%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%cl
cmp    %cl,%al
jne    1130 <main+0x20>
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
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
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %6
6: ; preds = %37, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = mul nsw i32 %7, %8
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 1000
br i1 %11, label %12, label %13
12: ; preds = %6
br label %37
13: ; preds = %6
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 9999
br i1 %15, label %16, label %17
16: ; preds = %13
br label %40
17: ; preds = %13
%18 = load i32, i32* %3
%19 = sdiv i32 %18, 100
store i32 %19, i32* %4
%20 = load i32, i32* %3
%21 = srem i32 %20, 100
store i32 %21, i32* %5
%22 = load i32, i32* %4
%23 = sdiv i32 %22, 10
%24 = load i32, i32* %4
%25 = srem i32 %24, 10
%26 = icmp eq i32 %23, %25
br i1 %26, label %27, label %36
27: ; preds = %17
%28 = load i32, i32* %5
%29 = sdiv i32 %28, 10
%30 = load i32, i32* %5
%31 = srem i32 %30, 10
%32 = icmp eq i32 %29, %31
br i1 %32, label %33, label %36
33: ; preds = %27
%34 = load i32, i32* %3
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33, %27, %17
br label %37
37: ; preds = %36, %12
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %6
40: ; preds = %16
ret i32 0
}

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