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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x28,-0x8(%rbp)
jg     11c3 <main+0xb3>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b0 <main+0xa0>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119d <main+0x8d>
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jne    118a <main+0x7a>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    118f <main+0x7f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114a <main+0x3a>
jmp    11a2 <main+0x92>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <main+0x27>
jmp    11b5 <main+0xa5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
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,%r15d
jmp    113a <main+0x2a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r15d
cmp    $0x29,%r15d
je     11b5 <main+0xa5>
cmp    $0x2,%r15d
jb     1130 <main+0x20>
mov    %r15d,%r12d
imul   %r15d,%r12d
mov    $0x1,%r14d
xor    %ebp,%ebp
jmp    116c <main+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14d
add    $0xffffffff,%ebp
cmp    %r15d,%r14d
je     1130 <main+0x20>
cmp    $0x2,%r14d
jb     1160 <main+0x50>
mov    %r14d,%r13d
imul   %r14d,%r13d
mov    $0x1,%ebx
jmp    1192 <main+0x82>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     1160 <main+0x50>
mov    %ebx,%eax
imul   %ebx,%eax
add    %r13d,%eax
cmp    %r12d,%eax
jne    1180 <main+0x70>
lea    0xe5a(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %r15d,%ecx
call   1030 <printf@plt>
jmp    1180 <main+0x70>
xor    %eax,%eax
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 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 = %44, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 40
br i1 %7, label %8, label %47
8: ; preds = %5
store i32 1, i32* %3
br label %9
9: ; preds = %40, %8
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %43
13: ; preds = %9
store i32 1, i32* %4
br label %14
14: ; preds = %36, %13
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %39
18: ; preds = %14
%19 = load i32, i32* %4
%20 = load i32, i32* %4
%21 = mul nsw i32 %19, %20
%22 = load i32, i32* %3
%23 = load i32, i32* %3
%24 = mul nsw i32 %22, %23
%25 = add nsw i32 %21, %24
%26 = load i32, i32* %2
%27 = load i32, i32* %2
%28 = mul nsw i32 %26, %27
%29 = icmp eq i32 %25, %28
br i1 %29, label %30, label %35
30: ; preds = %18
%31 = load i32, i32* %4
%32 = load i32, i32* %3
%33 = load i32, i32* %2
%34 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %31, i32 %32, i32 %33)
br label %35
35: ; preds = %30, %18
br label %36
36: ; preds = %35
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %14
39: ; preds = %14
br label %40
40: ; preds = %39
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %9
43: ; preds = %9
br label %44
44: ; preds = %43
%45 = load i32, i32* %2
%46 = add nsw i32 %45, 1
store i32 %46, i32* %2
br label %5
47: ; preds = %5
ret i32 0
}

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