#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 pow(int, int);
int /*<<< orphan*/ printf(char *, int);
float sqrt(int);
int main() {
  for (int a = 1; a < 999; a++) {
    for (int b = 01; b < 999; b++) {
      int c2 = pow(a, 2) + pow(b, 2);
      float c = sqrt(c2);
      if (a + b + c == 1000) {
        printf("%f\n", a * b * c);
        break;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e7,-0x8(%rbp)
jge    120c <main+0xdc>
movl   $0x1,-0xc(%rbp)
cmpl   $0x3e7,-0xc(%rbp)
jge    11f9 <main+0xc9>
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <sqrt@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
addss  -0x14(%rbp),%xmm0
movss  0xe4e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11e6 <main+0xb6>
jp     11e6 <main+0xb6>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
mulss  -0x14(%rbp),%xmm0
cvttss2si %xmm0,%esi
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
jmp    11f9 <main+0xc9>
jmp    11eb <main+0xbb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115a <main+0x2a>
jmp    11fe <main+0xce>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x20,%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
mov    $0x3,%r12d
mov    $0x2,%r13d
jmp    118f <main+0x5f>
nop
add    $0x2,%r14d
mov    %r14d,%ebp
imul   %r15d,%ebp
xorps  %xmm1,%xmm1
cvtsi2ss %ebp,%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%esi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
add    $0x1,%r15d
add    $0x1,%r12d
add    $0x1,%r13d
cmp    $0x3e7,%r15d
je     1240 <main+0x110>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%r14),%ebp
mov    %r15d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
add    %eax,%ebx
mov    %ebx,%edi
call   1050 <sqrt@plt>
lea    (%r14,%r13,1),%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
addss  %xmm0,%xmm1
ucomiss 0xe22(%rip),%xmm1
jne    11e6 <main+0xb6>
jnp    1157 <main+0x27>
lea    0x2(%r14),%ebp
mov    %r15d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
add    %eax,%ebx
mov    %ebx,%edi
call   1050 <sqrt@plt>
lea    (%r12,%r14,1),%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
addss  %xmm0,%xmm1
ucomiss 0xddc(%rip),%xmm1
jne    122c <main+0xfc>
jnp    1150 <main+0x20>
mov    %ebp,%r14d
cmp    $0x3e6,%ebp
jne    11a0 <main+0x70>
jmp    1176 <main+0x46>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 0, i32* %1
store i32 1, i32* %2
br label %6
6: ; preds = %42, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 999
br i1 %8, label %9, label %45
9: ; preds = %6
store i32 1, i32* %3
br label %10
10: ; preds = %38, %9
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 999
br i1 %12, label %13, label %41
13: ; preds = %10
%14 = load i32, i32* %2
%15 = call i32 @pow(i32 %14, i32 2)
%16 = load i32, i32* %3
%17 = call i32 @pow(i32 %16, i32 2)
%18 = add nsw i32 %15, %17
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = call float @sqrt(i32 %19)
store float %20, float* %5
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = add nsw i32 %21, %22
%24 = sitofp i32 %23 to float
%25 = load float, float* %5
%26 = fadd float %24, %25
%27 = fcmp oeq float %26, 1.000000e+03
br i1 %27, label %28, label %37
28: ; preds = %13
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = mul nsw i32 %29, %30
%32 = sitofp i32 %31 to float
%33 = load float, float* %5
%34 = fmul float %32, %33
%35 = fptosi float %34 to i32
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %35)
br label %41
37: ; preds = %13
br label %38
38: ; preds = %37
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %10
41: ; preds = %28, %10
br label %42
42: ; preds = %41
%43 = load i32, i32* %2
%44 = add nsw i32 %43, 1
store i32 %44, i32* %2
br label %6
45: ; preds = %6
ret i32 0
}

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