#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, int, int);
main() {
  int a, b, c;
  for (a = 1; a < 1000; a++) {
    for (b = 1; b < 1000; b++) {
      c = 1000 - a - b;
      if (pow(a, 2) + pow(b, 2) == pow(c, 2)) {
        printf("The solution is %i * %i * %i = %i\n", a, b, c, a * b * c);
        return 1;
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    1203 <main+0xe3>
movl   $0x1,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    11f0 <main+0xd0>
mov    $0x3e8,%eax
sub    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jne    11dd <main+0xbd>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%r8d
imul   -0xc(%rbp),%r8d
imul   -0x10(%rbp),%r8d
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1203 <main+0xe3>
jmp    11e2 <main+0xc2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114a <main+0x2a>
jmp    11f5 <main+0xd5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
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
mov    $0x1,%r14d
mov    $0x3e6,%eax
mov    %eax,0x4(%rsp)
mov    %eax,%r15d
mov    $0x2,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    -0x1(%r12),%ebp
mov    %r14d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%r13
mov    %ebp,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rbx
add    %r13,%rbx
mov    %r15d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
cmp    %rax,%rbx
je     11fc <main+0xdc>
cmp    $0x3e8,%r12d
je     11e0 <main+0xc0>
lea    -0x1(%r15),%ebp
mov    %r14d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%r13
mov    %r12d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rbx
add    %r13,%rbx
mov    %ebp,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
cmp    %rax,%rbx
je     1202 <main+0xe2>
add    $0x2,%r12d
add    $0xfffffffe,%r15d
jmp    1150 <main+0x30>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14d
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3e8,%r14d
jne    1136 <main+0x16>
xor    %eax,%eax
jmp    1226 <main+0x106>
mov    %ebp,%r12d
mov    %r15d,%ebp
mov    %r12d,%r8d
imul   %r14d,%r8d
imul   %ebp,%r8d
lea    0xdec(%rip),%rdi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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