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


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)
cmpl   $0x3e8,-0x8(%rbp)
jg     11ce <main+0xbe>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jg     11bb <main+0xab>
mov    -0x14(%rbp),%eax
sub    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
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    11a8 <main+0x98>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
imul   -0x10(%rbp),%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ad <main+0x9d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1140 <main+0x30>
jmp    11c0 <main+0xb0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%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    $0x3e6,%ebx
mov    $0x3,%eax
mov    $0x1,%r14d
lea    0xed5(%rip),%r15
mov    $0x1,%r12d
jmp    1163 <main+0x53>
nopl   (%rax)
add    $0x1,%r12d
mov    0x14(%rsp),%ebx
add    $0xfffffffe,%ebx
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%r14d
add    %eax,%r14d
add    $0x2,%eax
cmp    $0x3e9,%r12d
je     11c9 <main+0xb9>
mov    %eax,0x10(%rsp)
mov    %r12d,%r13d
imul   %r12d,%r13d
mov    %r14d,0xc(%rsp)
mov    %ebx,0x14(%rsp)
mov    %r12d,%ebp
jmp    1191 <main+0x81>
nopl   0x0(%rax)
add    $0x1,%ebp
add    $0xffffffff,%ebx
add    %r12d,%r14d
cmp    $0x3e9,%ebp
je     1140 <main+0x30>
mov    %ebp,%eax
imul   %ebp,%eax
add    %r13d,%eax
mov    %ebx,%ecx
imul   %ebx,%ecx
cmp    %ecx,%eax
jne    1180 <main+0x70>
lea    0xe57(%rip),%rdi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%esi
imul   %ebx,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1180 <main+0x70>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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