#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 */
scalar_t__ checkDigits(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  for (int num = 1000; num < 10000; num++) {
    if (checkDigits(num))
      continue;
    int sum = num / 100 + num % 100;
    if (sum * sum == num)
      printf("%d\n", num);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e8,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    11ad <main+0x8d>
mov    -0x8(%rbp),%edi
call   1040 <checkDigits@plt>
cmp    $0x0,%rax
je     115a <main+0x3a>
jmp    119f <main+0x7f>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
add    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    119a <main+0x7a>
mov    -0x8(%rbp),%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
jmp    119f <main+0x7f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x3e8,%ebx
lea    0xed0(%rip),%r14
jmp    114b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x2710,%ebx
je     1184 <main+0x64>
mov    %ebx,%edi
call   1040 <checkDigits@plt>
test   %rax,%rax
jne    1140 <main+0x20>
movzwl %bx,%eax
shr    $0x2,%eax
imul   $0x147b,%eax,%eax
shr    $0x11,%eax
imul   $0xffffff9d,%eax,%eax
movzwl %ax,%eax
add    %ebx,%eax
movzwl %ax,%eax
imul   %eax,%eax
cmp    %eax,%ebx
jne    1140 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1140 <main+0x20>
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
store i32 0, i32* %1
store i32 1000, i32* %2
br label %4
4: ; preds = %27, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 10000
br i1 %6, label %7, label %30
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i64 @checkDigits(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
br label %27
12: ; preds = %7
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 100
%15 = load i32, i32* %2
%16 = srem i32 %15, 100
%17 = add nsw i32 %14, %16
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = load i32, i32* %3
%20 = mul nsw i32 %18, %19
%21 = load i32, i32* %2
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %12
%24 = load i32, i32* %2
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23, %12
br label %27
27: ; preds = %26, %11
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %4
30: ; preds = %4
%31 = load i32, i32* %1
ret i32 %31
}

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