#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 */
scalar_t__ pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  int a, b, c;
  for (c = 0; c < 1000; c++) {
    for (b = 0; b < c; b++) {
      for (a = 0; a < b; a++) {
        if (a + b + c == 1000 && pow(a, 2) + pow(b, 2) == pow(c, 2)) {
          printf("%d\n", a * b * c);
          return 0;
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    1229 <main+0x109>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1216 <main+0xf6>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1203 <main+0xe3>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    $0x3e8,%eax
jne    11f0 <main+0xd0>
mov    -0x14(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jne    11f0 <main+0xd0>
mov    -0x14(%rbp),%esi
imul   -0x18(%rbp),%esi
imul   -0x1c(%rbp),%esi
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1230 <main+0x110>
jmp    11f5 <main+0xd5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1164 <main+0x44>
jmp    1208 <main+0xe8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1151 <main+0x31>
jmp    121b <main+0xfb>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <main+0x1d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %r14d,%r14d
movl   $0x3e8,0xc(%rsp)
test   %r14d,%r14d
je     11d0 <main+0xb0>
xor    %eax,%eax
mov    0xc(%rsp),%ecx
xor    %r15d,%r15d
jmp    115f <main+0x3f>
nopl   (%rax)
add    $0x1,%r15d
add    %r14d,%eax
add    $0xffffffff,%ecx
cmp    %r14d,%r15d
je     11d0 <main+0xb0>
test   %r15d,%r15d
je     1150 <main+0x30>
xor    %ebx,%ebx
xor    %ebp,%ebp
mov    %eax,0x14(%rsp)
mov    %ecx,0x10(%rsp)
jmp    118a <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
add    %eax,%ebx
cmp    %ebp,%r15d
je     1150 <main+0x30>
cmp    %ebp,%ecx
jne    1180 <main+0x60>
mov    %ebp,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%r12
mov    %r15d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%r13
add    %r12,%r13
mov    %r14d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    0x10(%rsp),%ecx
cmp    %rax,%r13
mov    0x14(%rsp),%eax
jne    1180 <main+0x60>
jmp    11e8 <main+0xc8>
nopl   0x0(%rax)
add    $0x1,%r14d
addl   $0xffffffff,0xc(%rsp)
cmp    $0x3e8,%r14d
jne    1139 <main+0x19>
jmp    11f6 <main+0xd6>
lea    0xe11(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
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 0, i32* %8
br label %9
9: ; preds = %54, %2
%10 = load i32, i32* %8
%11 = icmp slt i32 %10, 1000
br i1 %11, label %12, label %57
12: ; preds = %9
store i32 0, i32* %7
br label %13
13: ; preds = %50, %12
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %53
17: ; preds = %13
store i32 0, i32* %6
br label %18
18: ; preds = %46, %17
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %49
22: ; preds = %18
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = add nsw i32 %23, %24
%26 = load i32, i32* %8
%27 = add nsw i32 %25, %26
%28 = icmp eq i32 %27, 1000
br i1 %28, label %29, label %45
29: ; preds = %22
%30 = load i32, i32* %6
%31 = call i64 @pow(i32 %30, i32 2)
%32 = load i32, i32* %7
%33 = call i64 @pow(i32 %32, i32 2)
%34 = add nsw i64 %31, %33
%35 = load i32, i32* %8
%36 = call i64 @pow(i32 %35, i32 2)
%37 = icmp eq i64 %34, %36
br i1 %37, label %38, label %45
38: ; preds = %29
%39 = load i32, i32* %6
%40 = load i32, i32* %7
%41 = mul nsw i32 %39, %40
%42 = load i32, i32* %8
%43 = mul nsw i32 %41, %42
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %43)
store i32 0, i32* %3
br label %58
45: ; preds = %29, %22
br label %46
46: ; preds = %45
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %18
49: ; preds = %18
br label %50
50: ; preds = %49
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %13
53: ; preds = %13
br label %54
54: ; preds = %53
%55 = load i32, i32* %8
%56 = add nsw i32 %55, 1
store i32 %56, i32* %8
br label %9
57: ; preds = %9
store i32 0, i32* %3
br label %58
58: ; preds = %57, %38
%59 = load i32, i32* %3
ret i32 %59
}

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