#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 sqrt(int);
int main(void) {
  int a, b, c;
  printf("Side 1     Side 2     Hypotenuse\n");
  for (a = 2; (a <= 1000); a++) {
    for (b = a; (b <= 1000); b++) {
      for (c = b; c <= 1000; c++) {
        if (c == (sqrt(a * a + b * b))) {
          printf("%6d    %6d    %10d\n", a, b, c);
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jg     11ef <main+0xcf>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jg     11dc <main+0xbc>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x3e8,-0x10(%rbp)
jg     11c9 <main+0xa9>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
imul   -0x8(%rbp),%edi
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
add    %eax,%edi
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jne    11b6 <main+0x96>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bb <main+0x9b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116a <main+0x4a>
jmp    11ce <main+0xae>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1157 <main+0x37>
jmp    11e1 <main+0xc1>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%r15d
mov    $0x1,%r13d
lea    0xea6(%rip),%r14
jmp    1175 <main+0x45>
nopl   0x0(%rax)
add    $0x1,%r15d
mov    (%rsp),%r13d
add    $0x1,%r13d
cmp    $0x3e9,%r15d
je     11ea <main+0xba>
mov    %r15d,%eax
imul   %r15d,%eax
mov    %eax,0x4(%rsp)
mov    %r13d,(%rsp)
mov    %r15d,%r12d
jmp    11a1 <main+0x71>
nopl   0x0(%rax)
add    $0x1,%r12d
add    $0x1,%r13d
cmp    $0x3e9,%r12d
je     1160 <main+0x30>
cmp    $0x3e8,%r12d
ja     1190 <main+0x60>
mov    %r12d,%ebp
imul   %r12d,%ebp
add    0x4(%rsp),%ebp
mov    %r13d,%ebx
jmp    11c8 <main+0x98>
nopw   0x0(%rax,%rax,1)
cmp    $0x3e8,%ebx
jae    1190 <main+0x60>
add    $0x1,%ebx
mov    %ebp,%edi
call   1050 <sqrt@plt>
cmp    %eax,%ebx
jne    11c0 <main+0x90>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c0 <main+0x90>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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