#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*/ fflush(int /*<<< orphan*/);
long lround(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, long, long, long);
int /*<<< orphan*/ sqrt(long long);
int /*<<< orphan*/ stdout;
void pifagor() {
  long a, b, c;
  long long a2, b2, c2;
  for (a = 3; a < 10000; ++a) {
    a2 = (long long)a * a;
    for (b = 1; b < a; ++b) {
      b2 = (long long)b * b;
      c = lround(sqrt(a2 - b2));
      c2 = (long long)c * c;
      if (c2 + b2 == a2) {
        printf("%ld\t%ld\t%ld\n", a, b, c);
        fflush(stdout);
      }
    }
  }
}


x86 assembly (clang, -O0):
<pifagor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x3,-0x8(%rbp)
cmpq   $0x2710,-0x8(%rbp)
jge    1217 <pifagor+0xd7>
mov    -0x8(%rbp),%rax
imul   -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movq   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    1201 <pifagor+0xc1>
mov    -0x10(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
sub    -0x28(%rbp),%rdi
call   1060 <sqrt@plt>
mov    %eax,%edi
call   1030 <lround@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    11eb <pifagor+0xab>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
jmp    11f0 <pifagor+0xb0>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1173 <pifagor+0x33>
jmp    1206 <pifagor+0xc6>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1150 <pifagor+0x10>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pifagor>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x3,%r15d
mov    $0xfffffffffffffffe,%r12
mov    0x2e81(%rip),%r13
jmp    1181 <pifagor+0x41>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
add    $0xffffffffffffffff,%r12
cmp    $0x2710,%r15
je     11ea <pifagor+0xaa>
mov    %r15,%rbp
imul   %r15,%rbp
mov    $0x1,%r14d
jmp    11a2 <pifagor+0x62>
lea    (%r12,%r14,1),%rax
add    $0x1,%rax
add    $0x1,%r14
cmp    $0x1,%rax
je     1170 <pifagor+0x30>
mov    %r14,%rbx
imul   %r14,%rbx
mov    %rbp,%rdi
sub    %rbx,%rdi
call   1060 <sqrt@plt>
mov    %eax,%edi
call   1030 <lround@plt>
mov    %rax,%rcx
imul   %rax,%rcx
add    %rbx,%rcx
cmp    %rbp,%rcx
jne    1190 <pifagor+0x50>
lea    0xe2f(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rax,%rcx
call   1040 <printf@plt>
mov    0x0(%r13),%edi
call   1050 <fflush@plt>
jmp    1190 <pifagor+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"%ld\09%ld\09%ld\0A\00"
@stdout = global i32 0
define void @pifagor() {
br label %1
1: ; preds = %0, %20
%2 = phi i64 [ 3, %0 ], [ %21, %20 ]
%3 = mul nuw nsw i64 %2, %2
br label %4
4: ; preds = %1, %17
%5 = phi i64 [ 1, %1 ], [ %18, %17 ]
%6 = mul nsw i64 %5, %5
%7 = sub nsw i64 %3, %6
%8 = tail call i32 @sqrt(i64 %7)
%9 = tail call i64 @lround(i32 %8)
%10 = mul nsw i64 %9, %9
%11 = add nuw nsw i64 %10, %6
%12 = icmp eq i64 %11, %3
br i1 %12, label %13, label %17
13: ; preds = %4
%14 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %2, i64 %5, i64 %9)
%15 = load i32, i32* @stdout
%16 = tail call i32 @fflush(i32 %15)
br label %17
17: ; preds = %4, %13
%18 = add nuw nsw i64 %5, 1
%19 = icmp eq i64 %18, %2
br i1 %19, label %20, label %4
20: ; preds = %17
%21 = add nuw nsw i64 %2, 1
%22 = icmp eq i64 %21, 10000
br i1 %22, label %23, label %1
23: ; preds = %20
ret void
}