#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i;
  float sum = 0;
  printf("Enter the length of the series: ");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    printf("%d/%d ", i * i, i);
    if (i < n)
      printf("+ ");
    sum += pow(i, 2) / i;
  }
  printf("= %.f\n", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11d7 <main+0xa7>
mov    -0xc(%rbp),%esi
imul   -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11aa <main+0x7a>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1050 <pow@plt>
cltd
idivl  -0xc(%rbp)
cvtsi2ss %eax,%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116c <main+0x3c>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe47(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11db <main+0xab>
xorps  %xmm0,%xmm0
lea    0xebc(%rip),%rbx
lea    0xebc(%rip),%r14
xor    %ebp,%ebp
jmp    11a9 <main+0x79>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
cltd
idiv   %ebp
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
movaps %xmm1,%xmm0
cmp    0x8(%rsp),%ebp
jge    11d5 <main+0xa5>
movss  %xmm0,0xc(%rsp)
add    $0x1,%ebp
mov    %ebp,%esi
imul   %ebp,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
cmp    0x8(%rsp),%ebp
jge    1180 <main+0x50>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1180 <main+0x50>
cvtss2sd %xmm0,%xmm0
jmp    11de <main+0xae>
xorps  %xmm0,%xmm0
lea    0xe49(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Enter the length of the series: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"%d/%d \00"
@.str.3 = [3 x i8] c"+ \00"
@.str.4 = [7 x i8] c"= %.f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %7
7: ; preds = %30, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %33
11: ; preds = %7
%12 = load i32, i32* %3
%13 = load i32, i32* %3
%14 = mul nsw i32 %12, %13
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %15)
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %11
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %11
%23 = load i32, i32* %3
%24 = call i32 @pow(i32 %23, i32 2)
%25 = load i32, i32* %3
%26 = sdiv i32 %24, %25
%27 = sitofp i32 %26 to float
%28 = load float, float* %4
%29 = fadd float %28, %27
store float %29, float* %4
br label %30
30: ; preds = %22
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %7
33: ; preds = %7
%34 = load float, float* %4
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %35)
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@.str = [33 x i8] c"Enter the length of the series: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"%d/%d \00"
@.str.3 = [3 x i8] c"+ \00"
@.str.4 = [7 x i8] c"= %.f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(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 %26, label %7
7: ; preds = %0, %16
%8 = phi float [ %20, %16 ], [ 0.000000e+00, %0 ]
%9 = phi i32 [ %21, %16 ], [ 1, %0 ]
%10 = mul nsw i32 %9, %9
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %9)
%12 = load i32, i32* %1
%13 = icmp slt i32 %9, %12
br i1 %13, label %14, label %16
14: ; preds = %7
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %7
%17 = call i32 @pow(i32 %9, i32 2)
%18 = sdiv i32 %17, %9
%19 = sitofp i32 %18 to float
%20 = fadd float %8, %19
%21 = add nuw nsw i32 %9, 1
%22 = load i32, i32* %1
%23 = icmp slt i32 %9, %22
br i1 %23, label %7, label %24
24: ; preds = %16
%25 = fpext float %20 to double
br label %26
26: ; preds = %24, %0
%27 = phi double [ 0.000000e+00, %0 ], [ %25, %24 ]
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %27)
ret i32 0
}