#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, double);
double round(double);
double sqrt(double);
int main(int argc, char const *argv[]) {
  int squares[1000];
  for (int i = 0; i < 1000; i++) {
    squares[i] = i * i;
  }
  for (int a = 2; a < 30; a++) {
    for (int b = 2; b < 30; b++) {
      double cc = a * a + b * b;
      double c = sqrt(cc);
      if (round(c) == c) {
        printf("a=%d, b=%d, c=%.0f\n", a, b, c);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xfb4(%rbp)
cmpl   $0x3e8,-0xfb4(%rbp)
jge    1192 <main+0x62>
mov    -0xfb4(%rbp),%ecx
imul   -0xfb4(%rbp),%ecx
movslq -0xfb4(%rbp),%rax
mov    %ecx,-0xfb0(%rbp,%rax,4)
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    1153 <main+0x23>
movl   $0x2,-0xfb8(%rbp)
cmpl   $0x1e,-0xfb8(%rbp)
jge    1270 <main+0x140>
movl   $0x2,-0xfbc(%rbp)
cmpl   $0x1e,-0xfbc(%rbp)
jge    1257 <main+0x127>
mov    -0xfb8(%rbp),%eax
imul   -0xfb8(%rbp),%eax
mov    -0xfbc(%rbp),%ecx
imul   -0xfbc(%rbp),%ecx
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xfc8(%rbp)
ff
movsd  -0xfc8(%rbp),%xmm0
ff
call   1050 <sqrt@plt>
movsd  %xmm0,-0xfd0(%rbp)
ff
movsd  -0xfd0(%rbp),%xmm0
ff
call   1040 <round@plt>
ucomisd -0xfd0(%rbp),%xmm0
ff
jne    123e <main+0x10e>
jp     123e <main+0x10e>
mov    -0xfb8(%rbp),%esi
mov    -0xfbc(%rbp),%edx
movsd  -0xfd0(%rbp),%xmm0
ff
lea    0xdc7(%rip),%rdi
call   1030 <printf@plt>
jmp    1243 <main+0x113>
mov    -0xfbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfbc(%rbp)
jmp    11b3 <main+0x83>
jmp    125c <main+0x12c>
mov    -0xfb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb8(%rbp)
jmp    119c <main+0x6c>
xor    %eax,%eax
add    $0xfd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x2,%r15d
lea    0xec4(%rip),%r14
jmp    115a <main+0x2a>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    $0x1e,%r15d
je     11d1 <main+0xa1>
mov    %r15d,%ebx
imul   %r15d,%ebx
mov    $0x2,%ebp
jmp    1178 <main+0x48>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x1e,%ebp
je     1150 <main+0x20>
mov    %ebp,%eax
imul   %ebp,%eax
add    %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ucomisd 0xe72(%rip),%xmm0
jb     11a0 <main+0x70>
sqrtsd %xmm0,%xmm0
jmp    11a5 <main+0x75>
cs nopw 0x0(%rax,%rax,1)
call   1050 <sqrt@plt>
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
call   1040 <round@plt>
ucomisd (%rsp),%xmm0
movsd  (%rsp),%xmm0
jne    1170 <main+0x40>
jp     1170 <main+0x40>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"a=%d, b=%d, c=%.0f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %12
12: ; preds = %22, %2
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 1000
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i32, i32* %7
%17 = load i32, i32* %7
%18 = mul nsw i32 %16, %17
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 %20
store i32 %18, i32* %21
br label %22
22: ; preds = %15
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %12
25: ; preds = %12
store i32 2, i32* %8
br label %26
26: ; preds = %58, %25
%27 = load i32, i32* %8
%28 = icmp slt i32 %27, 30
br i1 %28, label %29, label %61
29: ; preds = %26
store i32 2, i32* %9
br label %30
30: ; preds = %54, %29
%31 = load i32, i32* %9
%32 = icmp slt i32 %31, 30
br i1 %32, label %33, label %57
33: ; preds = %30
%34 = load i32, i32* %8
%35 = load i32, i32* %8
%36 = mul nsw i32 %34, %35
%37 = load i32, i32* %9
%38 = load i32, i32* %9
%39 = mul nsw i32 %37, %38
%40 = add nsw i32 %36, %39
%41 = sitofp i32 %40 to double
store double %41, double* %10
%42 = load double, double* %10
%43 = call double @sqrt(double %42)
store double %43, double* %11
%44 = load double, double* %11
%45 = call double @llvm.round.f64(double %44)
%46 = load double, double* %11
%47 = fcmp oeq double %45, %46
br i1 %47, label %48, label %53
48: ; preds = %33
%49 = load i32, i32* %8
%50 = load i32, i32* %9
%51 = load double, double* %11
%52 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %49, i32 %50, double %51)
br label %53
53: ; preds = %48, %33
br label %54
54: ; preds = %53
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %30
57: ; preds = %30
br label %58
58: ; preds = %57
%59 = load i32, i32* %8
%60 = add nsw i32 %59, 1
store i32 %60, i32* %8
br label %26
61: ; preds = %26
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"a=%d, b=%d, c=%.0f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %7
%4 = phi i32 [ %8, %7 ], [ 2, %2 ]
%5 = mul nsw i32 %4, %4
br label %10
6: ; preds = %7
ret i32 0
7: ; preds = %20
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, 30
br i1 %9, label %6, label %3
10: ; preds = %3, %20
%11 = phi i32 [ 2, %3 ], [ %21, %20 ]
%12 = mul nuw nsw i32 %11, %11
%13 = add nuw nsw i32 %12, %5
%14 = sitofp i32 %13 to double
%15 = tail call double @sqrt(double %14)
%16 = tail call double @llvm.round.f64(double %15)
%17 = fcmp oeq double %16, %15
br i1 %17, label %18, label %20
18: ; preds = %10
%19 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %11, double %15)
br label %20
20: ; preds = %18, %10
%21 = add nuw nsw i32 %11, 1
%22 = icmp eq i32 %21, 30
br i1 %22, label %7, label %10
}