#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 a, b, c;
  int stop = 1000;
  for (a = 1; a < stop; a++) {
    for (b = a + 1; b < stop; b++) {
      for (c = b + 1; c < stop; c++) {
        if ((a + b + c) == stop) {
          if ((a * a) + (b * b) == (c * c)) {
            printf("%d\n", a * b * c);
            return (0);
          }
        }
      }
    }
  }
  return (1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e8,-0x14(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f5 <main+0xe5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e2 <main+0xd2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11cf <main+0xbf>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11bc <main+0xac>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jne    11b7 <main+0xa7>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
imul   -0x10(%rbp),%esi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11fc <main+0xec>
jmp    11bc <main+0xac>
jmp    11c1 <main+0xb1>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1157 <main+0x47>
jmp    11d4 <main+0xc4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1142 <main+0x32>
jmp    11e7 <main+0xd7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
movl   $0x1,-0x4(%rbp)
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    $0x28,%rsp
mov    $0x1,%eax
mov    $0x12,%edi
mov    $0xa,%edx
movl   $0x6,0xc(%rsp)
mov    $0x4,%esi
movl   $0x2,0x8(%rsp)
mov    $0x3e2,%r10d
mov    $0x2,%ecx
mov    $0x6,%r14d
mov    $0x12,%ebx
jmp    119b <main+0x8b>
nopw   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rax
add    %eax,%r14d
add    %ebx,%eax
add    $0x6,%ebx
mov    0x1c(%rsp),%edx
add    %edx,0xc(%rsp)
add    $0x4,%edx
add    $0x2,%ecx
mov    0x18(%rsp),%esi
add    %esi,0x8(%rsp)
add    $0x2,%esi
add    $0xfffffffd,%r10d
mov    %eax,%edi
mov    0x10(%rsp),%eax
cmp    $0x3e8,%eax
je     125d <main+0x14d>
mov    %rdi,0x20(%rsp)
mov    %esi,0x18(%rsp)
mov    %edx,0x1c(%rsp)
mov    %eax,%edi
lea    0x1(%rdi),%eax
mov    %eax,0x10(%rsp)
cmp    $0x3e6,%edi
ja     1160 <main+0x50>
mov    %edi,%eax
imul   %edi,%eax
mov    %eax,0x14(%rsp)
mov    %r10d,%r13d
mov    0x8(%rsp),%ebp
mov    %r14d,%edx
mov    0xc(%rsp),%r9d
mov    0x10(%rsp),%r12d
jmp    11fd <main+0xed>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12d
add    %r9d,%edx
add    %ecx,%r9d
add    %edi,%ebp
add    $0xfffffffe,%r13d
cmp    $0x3e8,%r12d
je     1160 <main+0x50>
cmp    $0x3e6,%r12d
ja     11e0 <main+0xd0>
mov    %r12d,%r15d
imul   %r12d,%r15d
add    0x14(%rsp),%r15d
mov    %r13d,%eax
mov    %r12d,%r11d
mov    %edx,%esi
jmp    122b <main+0x11b>
nopl   0x0(%rax)
add    %ebp,%esi
cmp    $0x3e7,%r11d
jae    11e0 <main+0xd0>
add    $0x1,%r11d
sub    $0x1,%eax
jae    1220 <main+0x110>
mov    %r11d,%r8d
imul   %r11d,%r8d
cmp    %r8d,%r15d
jne    1220 <main+0x110>
lea    0xdb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%eax
jmp    124e <main+0x13e>

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

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