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


x86 assembly (clang, -O0):
<PrintPythagoreanTriple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    11cf <PrintPythagoreanTriple+0xbf>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11bc <PrintPythagoreanTriple+0xac>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a9 <PrintPythagoreanTriple+0x99>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jne    1196 <PrintPythagoreanTriple+0x86>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
jmp    119b <PrintPythagoreanTriple+0x8b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1156 <PrintPythagoreanTriple+0x46>
jmp    11ae <PrintPythagoreanTriple+0x9e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113c <PrintPythagoreanTriple+0x2c>
jmp    11c1 <PrintPythagoreanTriple+0xb1>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <PrintPythagoreanTriple+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintPythagoreanTriple>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x4,%edi
jl     11c7 <PrintPythagoreanTriple+0xb7>
mov    %edi,%ebx
lea    -0x2(%rbx),%eax
mov    %eax,0x10(%rsp)
lea    -0x1(%rbx),%eax
mov    %eax,0xc(%rsp)
mov    $0x1,%eax
jmp    114a <PrintPythagoreanTriple+0x3a>
xchg   %ax,%ax
mov    0x8(%rsp),%eax
cmp    0x10(%rsp),%eax
je     11c7 <PrintPythagoreanTriple+0xb7>
mov    %eax,%r15d
lea    0x1(%r15),%eax
mov    %eax,0x8(%rsp)
cmp    0xc(%rsp),%eax
jge    1140 <PrintPythagoreanTriple+0x30>
mov    %r15d,%eax
imul   %r15d,%eax
mov    %eax,0x14(%rsp)
mov    0x8(%rsp),%r13d
jmp    1177 <PrintPythagoreanTriple+0x67>
nopl   (%rax)
cmp    0xc(%rsp),%r13d
je     1140 <PrintPythagoreanTriple+0x30>
mov    %r13d,%r12d
lea    0x1(%r12),%r13d
cmp    %ebx,%r13d
jge    1170 <PrintPythagoreanTriple+0x60>
mov    %r12d,%r14d
imul   %r12d,%r14d
add    0x14(%rsp),%r14d
mov    %r13d,%ebp
jmp    11a7 <PrintPythagoreanTriple+0x97>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
cmp    %ebx,%ebp
jge    1170 <PrintPythagoreanTriple+0x60>
mov    %ebp,%eax
imul   %ebp,%eax
cmp    %eax,%r14d
jne    11a0 <PrintPythagoreanTriple+0x90>
lea    0xe48(%rip),%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
call   1030 <printf@plt>
jmp    11a0 <PrintPythagoreanTriple+0x90>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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