#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 x, y, z;
  for (x = 1; x < 1000; x++) {
    for (y = x + 1; y < 1000; y++) {
      for (z = y + 1; x + y + z <= 1000; z++) {
        if ((z * z) == ((x * x) + (y * y)) && ((x + y + z) == 1000)) {
          printf("the numbers are x=%d y=%d z=%d\n", x, y, z);
          printf("product %lu\n", (x * y * z));
          return 0;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    120e <main+0xfe>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    11fb <main+0xeb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    $0x3e8,%eax
jg     11e8 <main+0xd8>
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
cmp    %ecx,%eax
jne    11d5 <main+0xc5>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    $0x3e8,%eax
jne    11d5 <main+0xc5>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
imul   -0x10(%rbp),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    120e <main+0xfe>
jmp    11da <main+0xca>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1152 <main+0x42>
jmp    11ed <main+0xdd>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113c <main+0x2c>
jmp    1200 <main+0xf0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%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,%ecx
mov    $0x12,%eax
mov    %rax,0x20(%rsp)
movl   $0xa,0x14(%rsp)
movl   $0x6,0xc(%rsp)
movl   $0x4,0x10(%rsp)
movl   $0x2,0x8(%rsp)
mov    $0x2,%eax
movl   $0x6,0x4(%rsp)
mov    $0x12,%ebp
mov    $0x6,%r12d
mov    %ecx,%esi
lea    0x1(%rsi),%ecx
mov    %ecx,0x18(%rsp)
cmp    $0x3e6,%esi
ja     1220 <main+0x110>
mov    %esi,%ecx
imul   %esi,%ecx
mov    %ecx,0x1c(%rsp)
mov    0x8(%rsp),%r11d
mov    0x4(%rsp),%r15d
mov    0xc(%rsp),%r9d
mov    %r12d,%r8d
mov    0x18(%rsp),%r14d
jmp    11b6 <main+0xa6>
nopl   0x0(%rax)
add    $0x2,%r8d
add    %r9d,%r15d
add    %eax,%r9d
add    %esi,%r11d
cmp    $0x3e8,%r14d
je     1220 <main+0x110>
mov    %r14d,%edx
lea    0x1(%rdx),%r14d
lea    (%rdx,%rsi,1),%ecx
add    %edx,%ecx
add    $0x1,%ecx
cmp    $0x3e8,%ecx
ja     11a0 <main+0x90>
mov    %edx,%r10d
imul   %edx,%r10d
add    0x1c(%rsp),%r10d
mov    %r15d,%ebx
mov    %r8d,%edi
mov    %r14d,%r13d
jmp    1202 <main+0xf2>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r13d
add    $0x1,%edi
add    %r11d,%ebx
cmp    $0x3e9,%edi
jae    11a0 <main+0x90>
mov    %r13d,%ecx
imul   %r13d,%ecx
cmp    %r10d,%ecx
jne    11f0 <main+0xe0>
cmp    $0x3e8,%edi
jne    11f0 <main+0xe0>
jmp    126a <main+0x15a>
nopl   0x0(%rax,%rax,1)
add    $0x3,%r12d
mov    0x20(%rsp),%rcx
add    %ecx,0x4(%rsp)
add    %ebp,%ecx
add    $0x6,%ebp
mov    0x14(%rsp),%edx
add    %edx,0xc(%rsp)
add    $0x4,%edx
mov    %edx,0x14(%rsp)
add    $0x2,%eax
mov    0x10(%rsp),%edx
add    %edx,0x8(%rsp)
add    $0x2,%edx
mov    %edx,0x10(%rsp)
mov    %rcx,0x20(%rsp)
mov    0x18(%rsp),%ecx
cmp    $0x3e8,%ecx
jne    1165 <main+0x55>
jmp    128b <main+0x17b>
lea    0xd8f(%rip),%rdi
mov    %r13d,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd9e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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