#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);
void main() {
  int a, b, c;
  for (a = 1; a <= 50; a += 1) {
    for (b = a; b <= 50; b += 1) {
      for (c = b; c <= 50; c += 1) {
        if ((a * a + b * b) == (c * c))
          printf("%d, %d, %d\n", a, b, c);
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0x32,-0x4(%rbp)
jg     11b6 <main+0xa6>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jg     11a3 <main+0x93>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x32,-0xc(%rbp)
jg     1190 <main+0x80>
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    117d <main+0x6d>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
jmp    1182 <main+0x72>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <main+0x2f>
jmp    1195 <main+0x85>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <main+0x1f>
jmp    11a8 <main+0x98>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <main+0xf>
add    $0x10,%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,%r13d
xor    %r12d,%r12d
lea    0xed5(%rip),%r14
jmp    1142 <main+0x32>
nopl   (%rax)
add    $0x1,%r13d
mov    (%rsp),%r12d
add    $0x1,%r12d
cmp    $0x33,%r13d
je     11b3 <main+0xa3>
mov    %r13d,%eax
imul   %r13d,%eax
mov    %eax,0x4(%rsp)
mov    %r12d,(%rsp)
mov    %r13d,%r15d
jmp    116e <main+0x5e>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15d
add    $0x1,%r12d
cmp    $0x33,%r15d
je     1130 <main+0x20>
cmp    $0x32,%r15d
ja     1160 <main+0x50>
mov    %r15d,%ebp
imul   %r15d,%ebp
add    0x4(%rsp),%ebp
mov    %r12d,%ebx
jmp    1195 <main+0x85>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x32,%ebx
jae    1160 <main+0x50>
add    $0x1,%ebx
mov    %ebx,%eax
imul   %ebx,%eax
cmp    %eax,%ebp
jne    1190 <main+0x80>
mov    %r14,%rdi
mov    %r13d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
call   1030 <printf@plt>
jmp    1190 <main+0x80>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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