int main() {
  int n, i, k, l, stat, count = 0;
  float s;
  printf("\nEnter the value of 'n': ");
  scanf("%d", &n);
  i = sqrt(n);
  for (l = i; l > 0; l--) {
    for (k = i; k > 0; k--) {
      stat = l * l + k * k;
      s = sqrt(stat);
      printf("l=%d\n", l);
      printf("k=%d\n", k);
      printf("stat=%d\n", stat);
      printf("%f\n", fmod(s, 1.0));
      if ((fmod(s, 1.0) == 0.0) && (stat == n))
        count++;
    }
  }
  printf("\nCount= %d", (count / 2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
call   1060 <sqrt@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1288 <main+0x148>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1275 <main+0x135>
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm0
call   1060 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdef(%rip),%xmm1
call   1040 <fmod@plt>
lea    0xe1a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdcb(%rip),%xmm1
call   1040 <fmod@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1262 <main+0x122>
jp     1262 <main+0x122>
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1262 <main+0x122>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1267 <main+0x127>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    119d <main+0x5d>
jmp    127a <main+0x13a>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <main+0x4d>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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
sub    $0x18,%rsp
lea    0xeb3(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cvtsi2sdl 0x4(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1187 <main+0x47>
sqrtsd %xmm0,%xmm0
jmp    118c <main+0x4c>
call   1060 <sqrt@plt>
cvttsd2si %xmm0,%eax
test   %eax,%eax
jle    12b6 <main+0x176>
xorpd  %xmm1,%xmm1
lea    0xe94(%rip),%r13
xor    %ebx,%ebx
mov    %eax,%r15d
mov    %eax,0x14(%rsp)
jmp    11c5 <main+0x85>
xchg   %ax,%ax
lea    -0x1(%r15),%eax
cmp    $0x1,%r15d
mov    %eax,%r15d
mov    0x14(%rsp),%eax
jle    12ad <main+0x16d>
mov    %r15d,%r12d
imul   %r15d,%r12d
mov    %eax,%ebp
jmp    1288 <main+0x148>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1060 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
lea    0xe2c(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe21(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe17(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xdc7(%rip),%xmm1
call   1040 <fmod@plt>
mov    %r13,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0xdaa(%rip),%xmm1
call   1040 <fmod@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setnp  %al
sete   %cl
and    %al,%cl
cmp    0x4(%rsp),%r14d
sete   %al
and    %cl,%al
movzbl %al,%eax
add    %eax,%ebx
lea    -0x1(%rbp),%eax
cmp    $0x1,%ebp
mov    %eax,%ebp
jle    11b0 <main+0x70>
mov    %ebp,%r14d
imul   %ebp,%r14d
add    %r12d,%r14d
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
ucomisd %xmm1,%xmm0
jb     11e0 <main+0xa0>
sqrtsd %xmm0,%xmm0
jmp    11e5 <main+0xa5>
mov    %ebx,%ebp
shr    $0x1f,%ebp
add    %ebx,%ebp
sar    %ebp
lea    0xd7e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\0AEnter the value of 'n': \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"l=%d\0A\00"
@.str.3 = [6 x i8] c"k=%d\0A\00"
@.str.4 = [9 x i8] c"stat=%d\0A\00"
@.str.5 = [4 x i8] c"%f\0A\00"
@.str.6 = [11 x i8] c"\0ACount= %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
store i32 0, i32* %1
store i32 0, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to double
%13 = call double @sqrt(double %12)
%14 = fptosi double %13 to i32
store i32 %14, i32* %3
%15 = load i32, i32* %3
store i32 %15, i32* %5
br label %16
16: ; preds = %62, %0
%17 = load i32, i32* %5
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %65
19: ; preds = %16
%20 = load i32, i32* %3
store i32 %20, i32* %4
br label %21
21: ; preds = %58, %19
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %61
24: ; preds = %21
%25 = load i32, i32* %5
%26 = load i32, i32* %5
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %4
%29 = load i32, i32* %4
%30 = mul nsw i32 %28, %29
%31 = add nsw i32 %27, %30
store i32 %31, i32* %6
%32 = load i32, i32* %6
%33 = sitofp i32 %32 to double
%34 = call double @sqrt(double %33)
%35 = fptrunc double %34 to float
store float %35, float* %8
%36 = load i32, i32* %5
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %4
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %6
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %40)
%42 = load float, float* %8
%43 = fpext float %42 to double
%44 = call double @fmod(double %43, double 1.000000e+00)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double %44)
%46 = load float, float* %8
%47 = fpext float %46 to double
%48 = call double @fmod(double %47, double 1.000000e+00)
%49 = fcmp oeq double %48, 0.000000e+00
br i1 %49, label %50, label %57
50: ; preds = %24
%51 = load i32, i32* %6
%52 = load i32, i32* %2
%53 = icmp eq i32 %51, %52
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load i32, i32* %7
%56 = add nsw i32 %55, 1
store i32 %56, i32* %7
br label %57
57: ; preds = %54, %50, %24
br label %58
58: ; preds = %57
%59 = load i32, i32* %4
%60 = add nsw i32 %59, -1
store i32 %60, i32* %4
br label %21
61: ; preds = %21
br label %62
62: ; preds = %61
%63 = load i32, i32* %5
%64 = add nsw i32 %63, -1
store i32 %64, i32* %5
br label %16
65: ; preds = %16
%66 = load i32, i32* %7
%67 = sdiv i32 %66, 2
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %67)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"\0AEnter the value of 'n': \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"l=%d\0A\00"
@.str.3 = [6 x i8] c"k=%d\0A\00"
@.str.4 = [9 x i8] c"stat=%d\0A\00"
@.str.5 = [4 x i8] c"%f\0A\00"
@.str.6 = [11 x i8] c"\0ACount= %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = sitofp i32 %5 to double
%7 = call double @sqrt(double %6)
%8 = fptosi double %7 to i32
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %42
10: ; preds = %0, %37
%11 = phi i32 [ %34, %37 ], [ 0, %0 ]
%12 = phi i32 [ %38, %37 ], [ %8, %0 ]
%13 = mul nsw i32 %12, %12
br label %14
14: ; preds = %10, %14
%15 = phi i32 [ %8, %10 ], [ %35, %14 ]
%16 = phi i32 [ %11, %10 ], [ %34, %14 ]
%17 = mul nsw i32 %15, %15
%18 = add nuw nsw i32 %17, %13
%19 = sitofp i32 %18 to double
%20 = call double @sqrt(double %19)
%21 = fptrunc double %20 to float
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%25 = fpext float %21 to double
%26 = call double @fmod(double %25, double 1.000000e+00)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double %26)
%28 = call double @fmod(double %25, double 1.000000e+00)
%29 = fcmp oeq double %28, 0.000000e+00
%30 = load i32, i32* %1
%31 = icmp eq i32 %18, %30
%32 = select i1 %29, i1 %31, i1 false
%33 = zext i1 %32 to i32
%34 = add nsw i32 %16, %33
%35 = add nsw i32 %15, -1
%36 = icmp sgt i32 %15, 1
br i1 %36, label %14, label %37
37: ; preds = %14
%38 = add nsw i32 %12, -1
%39 = icmp sgt i32 %12, 1
br i1 %39, label %10, label %40
40: ; preds = %37
%41 = sdiv i32 %34, 2
br label %42
42: ; preds = %40, %0
%43 = phi i32 [ 0, %0 ], [ %41, %40 ]
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %43)
ret i32 0
}