#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 *, long);
long sqrt(long);
void main() {
  long int i;
  long int x, y;
  for (i = 1; i <= 100000; i++) {
    x = sqrt(i + 100);
    y = sqrt(i + 168);
    if (x * x == i + 100 && y * y == i + 168)
      printf("%d\n", i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x1,-0x8(%rbp)
cmpq   $0x186a0,-0x8(%rbp)
jg     11c0 <main+0xa0>
mov    -0x8(%rbp),%rdi
add    $0x64,%rdi
call   1040 <sqrt@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0xa8,%rdi
call   1040 <sqrt@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    $0x64,%rcx
cmp    %rcx,%rax
jne    11aa <main+0x8a>
mov    -0x18(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    $0xa8,%rcx
cmp    %rcx,%rax
jne    11aa <main+0x8a>
mov    -0x8(%rbp),%rsi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    11af <main+0x8f>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1130 <main+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0xa9,%ebx
lea    0xecc(%rip),%r14
jmp    114d <main+0x2d>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x18749,%rbx
je     1187 <main+0x67>
lea    -0x44(%rbx),%r15
mov    %r15,%rdi
call   1040 <sqrt@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   1040 <sqrt@plt>
imul   %r12,%r12
cmp    %r12,%r15
jne    1140 <main+0x20>
imul   %rax,%rax
cmp    %rax,%rbx
jne    1140 <main+0x20>
lea    -0xa8(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
jmp    1140 <main+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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