#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 main() {
  printf("Ahmad Rashed - arashed31@gmail.com - CSP 03\n");
  int i;
  for (i = 100; i < 1000; i++) {
    if (i * i % 1000 == i)
      printf("%d \n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x64,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    117d <main+0x6d>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cmp    -0x8(%rbp),%edx
jne    116a <main+0x5a>
mov    -0x8(%rbp),%esi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116f <main+0x5f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <main+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
mov    $0x64,%ebx
lea    0xec4(%rip),%r14
jmp    114b <main+0x2b>
xchg   %ax,%ax
add    $0x1,%ebx
cmp    $0x3e8,%ebx
je     1175 <main+0x55>
mov    %ebx,%eax
imul   %eax,%eax
imul   $0x10624dd3,%rax,%rcx
shr    $0x26,%rcx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
cmp    %eax,%ebx
jne    1140 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Ahmad Rashed - arashed31@gmail.com - CSP 03\0A\00"
@.str.1 = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 100, i32* %2
br label %4
4: ; preds = %18, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = mul nsw i32 %8, %9
%11 = srem i32 %10, 1000
%12 = load i32, i32* %2
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %7
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %7
br label %18
18: ; preds = %17
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %4
21: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d \0A\00"
@str = [44 x i8] c"Ahmad Rashed - arashed31@gmail.com - CSP 03\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %9
%3 = phi i32 [ 100, %0 ], [ %10, %9 ]
%4 = mul nuw nsw i32 %3, %3
%5 = urem i32 %4, 1000
%6 = icmp eq i32 %5, %3
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %9
9: ; preds = %2, %7
%10 = add nuw nsw i32 %3, 1
%11 = icmp eq i32 %10, 1000
br i1 %11, label %12, label %2
12: ; preds = %9
ret i32 0
}