#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, int, int, int, int);
int main(void) {
  int i, num1, num2, soma, quad;
  for (i = 1000; i < 10000; i++) {
    num1 = i / 100;
    num2 = i % 100;
    soma = num1 + num2;
    quad = soma * soma;
    if (i == quad)
      printf("\n%d\t%d + %d = %d\t%d^2 = %d\n", i, num1, num2, soma, soma,
             quad);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e8,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    11a4 <main+0x94>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1191 <main+0x81>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%eax
lea    0xe77(%rip),%rdi
mov    %eax,(%rsp)
call   1030 <printf@plt>
jmp    1196 <main+0x86>
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
mov    $0x3e8,%ebx
lea    0xee0(%rip),%r14
jmp    113b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x2710,%ebx
je     1180 <main+0x70>
mov    %ebx,%eax
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
imul   $0xffffff9d,%eax,%r8d
add    %ebx,%r8d
mov    %r8d,%ecx
imul   %r8d,%ecx
cmp    %ecx,%ebx
jne    1130 <main+0x20>
imul   $0xffffff9c,%eax,%ecx
movzwl %bx,%eax
shr    $0x2,%eax
imul   $0x147b,%eax,%edx
shr    $0x11,%edx
add    %ebx,%ecx
mov    %ebx,(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r8d,%r9d
call   1030 <printf@plt>
jmp    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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