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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e8,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x14d,-0xc(%rbp)
jg     11b8 <main+0xa8>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1f4,-0x10(%rbp)
jg     11a5 <main+0x95>
mov    $0x3e8,%eax
sub    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
cmp    %ecx,%eax
jne    1192 <main+0x82>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
jmp    1197 <main+0x87>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1143 <main+0x33>
jmp    11aa <main+0x9a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%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
push   %rax
mov    $0x1,%eax
mov    $0x3e5,%r12d
lea    0xed3(%rip),%r14
jmp    113f <main+0x2f>
nop
add    $0xfffffffe,%r12d
mov    0x4(%rsp),%eax
cmp    $0x14e,%eax
je     1190 <main+0x80>
mov    %eax,%r15d
lea    0x1(%r15),%ebx
mov    %eax,%r13d
imul   %eax,%r13d
mov    %r12d,%ebp
mov    %ebx,0x4(%rsp)
jmp    116e <main+0x5e>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0xffffffff,%ebp
cmp    $0x1f5,%ebx
je     1130 <main+0x20>
mov    %ebx,%eax
imul   %ebx,%eax
add    %r13d,%eax
mov    %ebp,%ecx
imul   %ebp,%ecx
cmp    %ecx,%eax
jne    1160 <main+0x50>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1030 <printf@plt>
jmp    1160 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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