#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 main(int argc, char **argv) {
  for (int a = 1; a < 1000 / 3; a++) {
    for (int b = a + 1; b < 1000 / 2; b++) {
      const int c = 1000 - a - b;
      if (a * a + b * b == c * c) {
        printf("%d\n", (a * b * c));
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x14d,-0x14(%rbp)
jge    11ba <main+0xaa>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x1f4,-0x18(%rbp)
jge    11a7 <main+0x97>
mov    $0x3e8,%eax
sub    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    %ecx,%eax
mov    -0x1c(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
cmp    %ecx,%eax
jne    1194 <main+0x84>
mov    -0x14(%rbp),%esi
imul   -0x18(%rbp),%esi
imul   -0x1c(%rbp),%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <main+0x89>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1143 <main+0x33>
jmp    11ac <main+0x9c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
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
sub    $0x18,%rsp
mov    $0x1,%ecx
mov    $0x3e5,%r15d
mov    $0x4,%eax
mov    $0x2,%r13d
lea    0xec5(%rip),%rbx
jmp    1164 <main+0x54>
nopl   (%rax)
mov    0x14(%rsp),%r15d
add    $0xfffffffe,%r15d
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%r13d
add    %eax,%r13d
add    $0x2,%eax
mov    0x8(%rsp),%ecx
cmp    $0x14d,%ecx
je     11ca <main+0xba>
mov    %eax,0x10(%rsp)
mov    %ecx,%ebp
lea    0x1(%rbp),%r14d
mov    %ecx,%r12d
imul   %ecx,%r12d
mov    %r13d,0xc(%rsp)
mov    %r15d,0x14(%rsp)
mov    %r14d,0x8(%rsp)
jmp    11a4 <main+0x94>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r14d
add    $0xffffffff,%r15d
add    %ebp,%r13d
cmp    $0x1f4,%r14d
je     1140 <main+0x30>
mov    %r14d,%eax
imul   %r14d,%eax
add    %r12d,%eax
mov    %r15d,%ecx
imul   %r15d,%ecx
cmp    %ecx,%eax
jne    1190 <main+0x80>
mov    %r13d,%esi
imul   %r15d,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1190 <main+0x80>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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