#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(char *, int *);
int main(void) {
  int numbers_term = 1;
  float e = 1.00f, term = 1.0f;
  printf("enter the term of series\n");
  scanf("%d", &numbers_term);
  for (int i = 1; i < numbers_term + 1; i++) {
    term = term / i;
    e = e + term;
  }
  printf("e:%.4f\n", e);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movss  0xec2(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xeb5(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11b6 <main+0x96>
movss  -0x10(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1175 <main+0x55>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x1,0x4(%rsp)
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1177 <main+0x47>
cmp    $0x1,%eax
jne    1181 <main+0x51>
movss  0xe9d(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
test   $0x1,%al
jne    11d3 <main+0xa3>
jmp    11db <main+0xab>
movsd  0xe81(%rip),%xmm0
jmp    11e2 <main+0xb2>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
movss  0xe7a(%rip),%xmm0
mov    $0x1,%edx
movaps %xmm0,%xmm1
cs nopw 0x0(%rax,%rax,1)
xorps  %xmm2,%xmm2
cvtsi2ss %edx,%xmm2
divss  %xmm2,%xmm0
addss  %xmm0,%xmm1
lea    0x1(%rdx),%esi
xorps  %xmm2,%xmm2
cvtsi2ss %esi,%xmm2
divss  %xmm2,%xmm0
addss  %xmm0,%xmm1
add    $0x2,%edx
cmp    %ecx,%esi
jne    11a0 <main+0x70>
xorps  %xmm2,%xmm2
cvtsi2ss %edx,%xmm2
test   $0x1,%al
je     11db <main+0xab>
divss  %xmm2,%xmm0
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe26(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"e:%.4f\0A\00"
@str = [25 x i8] c"enter the term of series\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 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
%8 = and i32 %5, 1
%9 = icmp eq i32 %5, 1
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = and i32 %5, -2
br label %29
12: ; preds = %29
%13 = sitofp i32 %41 to float
br label %14
14: ; preds = %12, %7
%15 = phi float [ undef, %7 ], [ %40, %12 ]
%16 = phi float [ 1.000000e+00, %7 ], [ %13, %12 ]
%17 = phi float [ 1.000000e+00, %7 ], [ %39, %12 ]
%18 = phi float [ 1.000000e+00, %7 ], [ %40, %12 ]
%19 = icmp eq i32 %8, 0
br i1 %19, label %23, label %20
20: ; preds = %14
%21 = fdiv float %17, %16
%22 = fadd float %18, %21
br label %23
23: ; preds = %14, %20
%24 = phi float [ %15, %14 ], [ %22, %20 ]
%25 = fpext float %24 to double
br label %26
26: ; preds = %23, %0
%27 = phi double [ 1.000000e+00, %0 ], [ %25, %23 ]
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %27)
ret i32 0
29: ; preds = %29, %10
%30 = phi i32 [ 1, %10 ], [ %41, %29 ]
%31 = phi float [ 1.000000e+00, %10 ], [ %39, %29 ]
%32 = phi float [ 1.000000e+00, %10 ], [ %40, %29 ]
%33 = phi i32 [ 0, %10 ], [ %42, %29 ]
%34 = sitofp i32 %30 to float
%35 = fdiv float %31, %34
%36 = fadd float %32, %35
%37 = add nuw i32 %30, 1
%38 = sitofp i32 %37 to float
%39 = fdiv float %35, %38
%40 = fadd float %36, %39
%41 = add nuw i32 %30, 2
%42 = add i32 %33, 2
%43 = icmp eq i32 %42, %11
br i1 %43, label %12, label %29
}