#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 */
scalar_t__ pow(double, int);
int /*<<< orphan*/ printf(char *, double, ...);
int main(int argc, char *argv[]) {
  double a, b, c;
  int sum = 1000;
  for (a = 0; a < sum; a++) {
    for (b = a + 1; b < sum; b++) {
      for (c = b + 1; c < sum; c++) {
        if (a + b + c == sum) {
          if (pow(a, 2) + pow(b, 2) == pow(c, 2)) {
            printf("%.0f + %.0f + %.0f is a triplet.\n", a, b, c);
            printf("The product a*b*c is %.0f\n", a * b * c);
          }
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3e8,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
cvtsi2sdl -0x2c(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12ab <main+0x18b>
movsd  0xe9f(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x2c(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    128f <main+0x16f>
movsd  0xe79(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
cvtsi2sdl -0x2c(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1273 <main+0x153>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jne    1257 <main+0x137>
jp     1257 <main+0x137>
movsd  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %rax,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
jne    1252 <main+0x132>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
lea    0xdda(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
lea    0xddf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1257 <main+0x137>
jmp    125c <main+0x13c>
movsd  0xd9c(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1191 <main+0x71>
jmp    1278 <main+0x158>
movsd  0xd80(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    116b <main+0x4b>
jmp    1294 <main+0x174>
movsd  0xd64(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1145 <main+0x25>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xecb(%rip),%xmm1
lea    0xecc(%rip),%r14
lea    0xee7(%rip),%r15
jmp    115c <main+0x3c>
nopl   (%rax)
ucomisd 0x8(%rsp),%xmm1
jbe    129d <main+0x17d>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
addsd  0xe90(%rip),%xmm0
ucomisd %xmm0,%xmm1
movsd  %xmm0,0x8(%rsp)
ja     119a <main+0x7a>
jmp    129d <main+0x17d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
ucomisd %xmm3,%xmm1
movapd %xmm3,%xmm0
jbe    1150 <main+0x30>
movapd %xmm0,%xmm3
addsd  0xe5a(%rip),%xmm3
ucomisd %xmm3,%xmm1
jbe    1150 <main+0x30>
movapd %xmm0,%xmm2
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm4
addsd  %xmm2,%xmm4
movsd  %xmm4,0x30(%rsp)
movsd  %xmm2,0x20(%rsp)
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x28(%rsp)
movapd %xmm3,%xmm2
movsd  %xmm3,0x18(%rsp)
jmp    11ee <main+0xce>
addsd  0xe18(%rip),%xmm2
ucomisd %xmm2,%xmm1
jbe    1190 <main+0x70>
movsd  0x30(%rsp),%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jne    11e0 <main+0xc0>
jp     11e0 <main+0xc0>
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
movsd  %xmm2,(%rsp)
call   1040 <pow@plt>
mov    %rax,%r12
movsd  0x20(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %rax,%rbx
add    %r12,%rbx
movsd  (%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  (%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0xdb8(%rip),%xmm1
cmp    %rax,%rbx
jne    11e0 <main+0xc0>
mov    %r14,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
movsd  0x28(%rsp),%xmm0
mulsd  (%rsp),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0xd70(%rip),%xmm1
jmp    11e0 <main+0xc0>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [34 x i8] c"%.0f + %.0f + %.0f is a triplet.\0A\00"
@.str.1 = [27 x i8] c"The product a*b*c is %.0f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1000, i32* %9
store double 0.000000e+00, double* %6
br label %10
10: ; preds = %70, %2
%11 = load double, double* %6
%12 = load i32, i32* %9
%13 = sitofp i32 %12 to double
%14 = fcmp olt double %11, %13
br i1 %14, label %15, label %73
15: ; preds = %10
%16 = load double, double* %6
%17 = fadd double %16, 1.000000e+00
store double %17, double* %7
br label %18
18: ; preds = %66, %15
%19 = load double, double* %7
%20 = load i32, i32* %9
%21 = sitofp i32 %20 to double
%22 = fcmp olt double %19, %21
br i1 %22, label %23, label %69
23: ; preds = %18
%24 = load double, double* %7
%25 = fadd double %24, 1.000000e+00
store double %25, double* %8
br label %26
26: ; preds = %62, %23
%27 = load double, double* %8
%28 = load i32, i32* %9
%29 = sitofp i32 %28 to double
%30 = fcmp olt double %27, %29
br i1 %30, label %31, label %65
31: ; preds = %26
%32 = load double, double* %6
%33 = load double, double* %7
%34 = fadd double %32, %33
%35 = load double, double* %8
%36 = fadd double %34, %35
%37 = load i32, i32* %9
%38 = sitofp i32 %37 to double
%39 = fcmp oeq double %36, %38
br i1 %39, label %40, label %61
40: ; preds = %31
%41 = load double, double* %6
%42 = call i64 @pow(double %41, i32 2)
%43 = load double, double* %7
%44 = call i64 @pow(double %43, i32 2)
%45 = add nsw i64 %42, %44
%46 = load double, double* %8
%47 = call i64 @pow(double %46, i32 2)
%48 = icmp eq i64 %45, %47
br i1 %48, label %49, label %60
49: ; preds = %40
%50 = load double, double* %6
%51 = load double, double* %7
%52 = load double, double* %8
%53 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %50, double %51, double %52)
%54 = load double, double* %6
%55 = load double, double* %7
%56 = fmul double %54, %55
%57 = load double, double* %8
%58 = fmul double %56, %57
%59 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), double %58)
br label %60
60: ; preds = %49, %40
br label %61
61: ; preds = %60, %31
br label %62
62: ; preds = %61
%63 = load double, double* %8
%64 = fadd double %63, 1.000000e+00
store double %64, double* %8
br label %26
65: ; preds = %26
br label %66
66: ; preds = %65
%67 = load double, double* %7
%68 = fadd double %67, 1.000000e+00
store double %68, double* %7
br label %18
69: ; preds = %18
br label %70
70: ; preds = %69
%71 = load double, double* %6
%72 = fadd double %71, 1.000000e+00
store double %72, double* %6
br label %10
73: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"%.0f + %.0f + %.0f is a triplet.\0A\00"
@.str.1 = [27 x i8] c"The product a*b*c is %.0f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %4
3: ; preds = %9, %8
br i1 %7, label %4, label %33
4: ; preds = %2, %3
%5 = phi double [ 0.000000e+00, %2 ], [ %6, %3 ]
%6 = fadd double %5, 1.000000e+00
%7 = fcmp olt double %6, 1.000000e+03
br i1 %7, label %9, label %33
8: ; preds = %30
br i1 %12, label %9, label %3
9: ; preds = %4, %8
%10 = phi double [ %11, %8 ], [ %6, %4 ]
%11 = fadd double %10, 1.000000e+00
%12 = fcmp olt double %11, 1.000000e+03
br i1 %12, label %13, label %3
13: ; preds = %9
%14 = fadd double %5, %10
%15 = fmul double %5, %10
br label %16
16: ; preds = %13, %30
%17 = phi double [ %11, %13 ], [ %31, %30 ]
%18 = fadd double %14, %17
%19 = fcmp oeq double %18, 1.000000e+03
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = tail call i64 @pow(double %5, i32 2)
%22 = tail call i64 @pow(double %10, i32 2)
%23 = add nsw i64 %22, %21
%24 = tail call i64 @pow(double %17, i32 2)
%25 = icmp eq i64 %23, %24
br i1 %25, label %26, label %30
26: ; preds = %20
%27 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %5, double %10, double %17)
%28 = fmul double %15, %17
%29 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), double %28)
br label %30
30: ; preds = %16, %26, %20
%31 = fadd double %17, 1.000000e+00
%32 = fcmp olt double %31, 1.000000e+03
br i1 %32, label %16, label %8
33: ; preds = %4, %3
ret i32 0
}