#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 /*<<< orphan*/ scanf_s(char *, int *);
int /*<<< orphan*/ system(char *);
main() {
  int number, i;
  double sum = 0, A = 0, B = 0;
  printf("Enter a number : ");
  scanf_s("%d", &number);
  for (i = 1; i <= number; i = i + 2) {
    A = A + (double)1 / (double)(i * i);
  }
  for (i = 2; i <= number; i = i + 2) {
    B = B + (double)1 / (double)(i * i);
  }
  sum = A - B;
  printf("\n Sum is : %.2f \n", sum);
  printf("\n");
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf_s@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11bb <main+0x8b>
movsd  -0x20(%rbp),%xmm0
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm2
movsd  0xe60(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    117c <main+0x4c>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1201 <main+0xd1>
movsd  -0x28(%rbp),%xmm0
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm2
movsd  0xe1a(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    11c2 <main+0x92>
movsd  -0x20(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe01(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdf7(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf_s@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11e1 <main+0xa1>
mov    $0x1,%ecx
xorpd  %xmm0,%xmm0
movsd  0xe87(%rip),%xmm1
nopl   0x0(%rax)
mov    %ecx,%edx
imul   %ecx,%edx
xorps  %xmm2,%xmm2
cvtsi2sd %edx,%xmm2
movapd %xmm1,%xmm3
divsd  %xmm2,%xmm3
addsd  %xmm3,%xmm0
add    $0x2,%ecx
cmp    %eax,%ecx
jle    1180 <main+0x40>
xorpd  %xmm2,%xmm2
cmp    $0x2,%eax
jl     11e9 <main+0xa9>
mov    $0x2,%ecx
xorpd  %xmm2,%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edx
imul   %ecx,%edx
xorps  %xmm3,%xmm3
cvtsi2sd %edx,%xmm3
movapd %xmm1,%xmm4
divsd  %xmm3,%xmm4
addsd  %xmm4,%xmm2
add    $0x2,%ecx
cmp    %eax,%ecx
jle    11c0 <main+0x80>
jmp    11e9 <main+0xa9>
xorpd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
subsd  %xmm2,%xmm0
lea    0xe29(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe23(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter a number : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"\0A Sum is : %.2f \0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %9
9: ; preds = %21, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %24
13: ; preds = %9
%14 = load double, double* %5
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = mul nsw i32 %15, %16
%18 = sitofp i32 %17 to double
%19 = fdiv double 1.000000e+00, %18
%20 = fadd double %14, %19
store double %20, double* %5
br label %21
21: ; preds = %13
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 2
store i32 %23, i32* %3
br label %9
24: ; preds = %9
store i32 2, i32* %3
br label %25
25: ; preds = %37, %24
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = icmp sle i32 %26, %27
br i1 %28, label %29, label %40
29: ; preds = %25
%30 = load double, double* %6
%31 = load i32, i32* %3
%32 = load i32, i32* %3
%33 = mul nsw i32 %31, %32
%34 = sitofp i32 %33 to double
%35 = fdiv double 1.000000e+00, %34
%36 = fadd double %30, %35
store double %36, double* %6
br label %37
37: ; preds = %29
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 2
store i32 %39, i32* %3
br label %25
40: ; preds = %25
%41 = load double, double* %5
%42 = load double, double* %6
%43 = fsub double %41, %42
store double %43, double* %4
%44 = load double, double* %4
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%48 = load i32, i32* %1
ret i32 %48
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter a number : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"\0A Sum is : %.2f \0A\00"
@.str.4 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1
br i1 %6, label %27, label %9
7: ; preds = %9
%8 = icmp slt i32 %5, 2
br i1 %8, label %27, label %18
9: ; preds = %0, %9
%10 = phi double [ %15, %9 ], [ 0.000000e+00, %0 ]
%11 = phi i32 [ %16, %9 ], [ 1, %0 ]
%12 = mul nsw i32 %11, %11
%13 = sitofp i32 %12 to double
%14 = fdiv double 1.000000e+00, %13
%15 = fadd double %10, %14
%16 = add nuw nsw i32 %11, 2
%17 = icmp sgt i32 %16, %5
br i1 %17, label %7, label %9
18: ; preds = %7, %18
%19 = phi double [ %24, %18 ], [ 0.000000e+00, %7 ]
%20 = phi i32 [ %25, %18 ], [ 2, %7 ]
%21 = mul nsw i32 %20, %20
%22 = sitofp i32 %21 to double
%23 = fdiv double 1.000000e+00, %22
%24 = fadd double %19, %23
%25 = add nuw nsw i32 %20, 2
%26 = icmp sgt i32 %25, %5
br i1 %26, label %27, label %18
27: ; preds = %18, %0, %7
%28 = phi double [ %15, %7 ], [ 0.000000e+00, %0 ], [ %15, %18 ]
%29 = phi double [ 0.000000e+00, %7 ], [ 0.000000e+00, %0 ], [ %24, %18 ]
%30 = fsub double %28, %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %30)
%32 = call i32 @putchar(i32 10)
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}