#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 main(void) {
  int inner;
  int outer;
  int n;
  int factorial = 1;
  float E;
  float current = 1.0f;
  float e = 1.0f;
  printf("Enter your disired n for (e = 1 + 1/n!): ");
  scanf("%d", &n);
  printf("Enter a small floating point number for E: ");
  scanf("%f", &E);
  for (outer = 1; outer <= n; outer++) {
    for (inner = 1; inner <= outer; inner++) {
      factorial *= inner;
    }
    current = 1.0f / factorial;
    if (current < E) {
      break;
    } else {
      e += current;
      printf("e + %.5f (1/%d)\n", current, factorial);
      factorial = 1;
    }
  }
  printf("e = %.5f\n", e);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
movss  0xec2(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xeb5(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     123f <main+0x11f>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11ce <main+0xae>
mov    -0x8(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11aa <main+0x8a>
cvtsi2ssl -0x14(%rbp),%xmm1
movss  0xe25(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11fc <main+0xdc>
jmp    123f <main+0x11f>
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x14(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1231 <main+0x111>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1197 <main+0x77>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe22(%rip),%rdi
mov    $0x1,%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    0xf7b(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf95(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xf85(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xfa3(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    1487 <main+0x367>
mov    $0x1,%r15d
movd   0xe75(%rip),%xmm0
mov    $0x2,%ebp
mov    $0xfffffff9,%r13d
lea    0xf6f(%rip),%r14
movdqa 0xe8a(%rip),%xmm9
movdqa 0xe91(%rip),%xmm10
movdqa 0xe98(%rip),%xmm11
movdqa 0xe9f(%rip),%xmm12
movdqa 0xea6(%rip),%xmm14
movdqa 0xead(%rip),%xmm15
movdqa 0xeb4(%rip),%xmm13
movd   %xmm0,0xc(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rbx),%r12d
mov    $0x1,%esi
mov    $0x1,%edx
cmp    $0x8,%r12d
jb     13e0 <main+0x2c0>
mov    %r13d,%eax
shr    $0x3,%eax
add    $0xfffffff9,%ebx
mov    %ebx,%ecx
shr    $0x3,%ecx
add    $0x1,%ecx
movdqa 0xdff(%rip),%xmm2
movdqa %xmm2,%xmm0
movdqa 0xde3(%rip),%xmm1
cmp    $0x18,%ebx
jb     1331 <main+0x211>
lea    0x1(%rax),%edx
and    $0xfffffffc,%edx
movdqa 0xddc(%rip),%xmm2
movdqa %xmm2,%xmm0
movdqa 0xdc0(%rip),%xmm1
movdqa %xmm1,%xmm3
paddd  %xmm9,%xmm3
pshufd $0xf5,%xmm1,%xmm4
pshufd $0xf5,%xmm0,%xmm5
pmuludq %xmm4,%xmm5
pmuludq %xmm1,%xmm0
pshufd $0xf5,%xmm2,%xmm4
pshufd $0xf5,%xmm3,%xmm6
pmuludq %xmm4,%xmm6
pmuludq %xmm2,%xmm3
movdqa %xmm1,%xmm2
paddd  %xmm10,%xmm2
movdqa %xmm1,%xmm4
paddd  %xmm11,%xmm4
pmuludq %xmm2,%xmm0
pshufd $0xf5,%xmm2,%xmm2
pmuludq %xmm5,%xmm2
pmuludq %xmm4,%xmm3
pshufd $0xf5,%xmm4,%xmm4
pmuludq %xmm6,%xmm4
movdqa %xmm1,%xmm5
paddd  %xmm12,%xmm5
movdqa %xmm1,%xmm6
paddd  %xmm14,%xmm6
pshufd $0xf5,%xmm5,%xmm7
pmuludq %xmm2,%xmm7
pmuludq %xmm0,%xmm5
pshufd $0xf5,%xmm6,%xmm8
pmuludq %xmm4,%xmm8
pmuludq %xmm3,%xmm6
movdqa %xmm1,%xmm2
paddd  %xmm15,%xmm2
movdqa %xmm1,%xmm3
paddd  %xmm13,%xmm3
pmuludq %xmm2,%xmm5
pshufd $0xe8,%xmm5,%xmm0
pshufd $0xf5,%xmm2,%xmm2
pmuludq %xmm7,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm0
pmuludq %xmm3,%xmm6
pshufd $0xe8,%xmm6,%xmm2
pshufd $0xf5,%xmm3,%xmm3
pmuludq %xmm8,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm2
paddd  0xd78(%rip),%xmm1
add    $0xfffffffc,%edx
jne    1250 <main+0x130>
mov    %r12d,%edx
and    $0xfffffff8,%edx
test   $0x3,%cl
je     13a3 <main+0x283>
add    $0x1,%al
movzbl %al,%eax
and    $0x3,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm1,%xmm3
paddd  %xmm9,%xmm3
pshufd $0xf5,%xmm0,%xmm4
pmuludq %xmm1,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pshufd $0xf5,%xmm1,%xmm5
pmuludq %xmm4,%xmm5
pshufd $0xe8,%xmm5,%xmm4
punpckldq %xmm4,%xmm0
pshufd $0xf5,%xmm2,%xmm4
pmuludq %xmm3,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pshufd $0xf5,%xmm3,%xmm3
pmuludq %xmm4,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm2
paddd  %xmm10,%xmm1
add    $0xffffffff,%eax
jne    1350 <main+0x230>
pshufd $0xf5,%xmm0,%xmm1
pshufd $0xf5,%xmm2,%xmm3
pmuludq %xmm1,%xmm3
pmuludq %xmm0,%xmm2
pshufd $0xee,%xmm2,%xmm0
pmuludq %xmm2,%xmm0
pshufd $0xaa,%xmm3,%xmm1
pmuludq %xmm3,%xmm1
pmuludq %xmm0,%xmm1
movd   %xmm1,%esi
cmp    %edx,%r12d
je     13ea <main+0x2ca>
or     $0x1,%edx
nopw   0x0(%rax,%rax,1)
imul   %edx,%esi
add    $0x1,%edx
cmp    %edx,%ebp
jne    13e0 <main+0x2c0>
xorps  %xmm1,%xmm1
cvtsi2ss %esi,%xmm1
movss  0xc07(%rip),%xmm0
divss  %xmm1,%xmm0
movss  0x14(%rsp),%xmm1
ucomiss %xmm0,%xmm1
ja     1495 <main+0x375>
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movdqa 0xc5d(%rip),%xmm13
movdqa 0xc44(%rip),%xmm15
movdqa 0xc2b(%rip),%xmm14
movdqa 0xc12(%rip),%xmm12
movdqa 0xbf9(%rip),%xmm11
movdqa 0xbe0(%rip),%xmm10
movdqa 0xbc7(%rip),%xmm9
lea    0x1(%r15),%eax
add    $0x1,%ebp
add    $0x1,%r13d
mov    %r12d,%ebx
cmp    0x10(%rsp),%r15d
mov    %eax,%r15d
jl     11f0 <main+0xd0>
jmp    1495 <main+0x375>
movd   0xb71(%rip),%xmm0
movd   %xmm0,0xc(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc77(%rip),%rdi
mov    $0x1,%al
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 = [42 x i8] c"Enter your disired n for (e = 1 + 1/n!): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [44 x i8] c"Enter a small floating point number for E: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [17 x i8] c"e + %.5f (1/%d)\0A\00"
@.str.5 = [10 x i8] c"e = %.5f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca float
store i32 0, i32* %1
store i32 1, i32* %5
store float 1.000000e+00, float* %7
store float 1.000000e+00, float* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 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* %4)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %6)
store i32 1, i32* %3
br label %13
13: ; preds = %46, %0
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %49
17: ; preds = %13
store i32 1, i32* %2
br label %18
18: ; preds = %26, %17
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = load i32, i32* %2
%24 = load i32, i32* %5
%25 = mul nsw i32 %24, %23
store i32 %25, i32* %5
br label %26
26: ; preds = %22
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %18
29: ; preds = %18
%30 = load i32, i32* %5
%31 = sitofp i32 %30 to float
%32 = fdiv float 1.000000e+00, %31
store float %32, float* %7
%33 = load float, float* %7
%34 = load float, float* %6
%35 = fcmp olt float %33, %34
br i1 %35, label %36, label %37
36: ; preds = %29
br label %49
37: ; preds = %29
%38 = load float, float* %7
%39 = load float, float* %8
%40 = fadd float %39, %38
store float %40, float* %8
%41 = load float, float* %7
%42 = fpext float %41 to double
%43 = load i32, i32* %5
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %42, i32 %43)
store i32 1, i32* %5
br label %45
45: ; preds = %37
br label %46
46: ; preds = %45
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %13
49: ; preds = %36, %13
%50 = load float, float* %8
%51 = fpext float %50 to double
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double %51)
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"Enter your disired n for (e = 1 + 1/n!): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [44 x i8] c"Enter a small floating point number for E: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [17 x i8] c"e + %.5f (1/%d)\0A\00"
@.str.5 = [10 x i8] c"e = %.5f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 1
br i1 %10, label %99, label %11
11: ; preds = %0, %90
%12 = phi i32 [ %98, %90 ], [ 0, %0 ]
%13 = phi i32 [ %97, %90 ], [ 2, %0 ]
%14 = phi float [ %91, %90 ], [ 1.000000e+00, %0 ]
%15 = phi i32 [ %94, %90 ], [ 1, %0 ]
%16 = add i32 %12, -7
%17 = lshr i32 %16, 3
%18 = add nuw nsw i32 %17, 1
%19 = add i32 %12, 1
%20 = icmp ult i32 %19, 8
br i1 %20, label %75, label %21
21: ; preds = %11
%22 = and i32 %19, -8
%23 = or i32 %22, 1
%24 = and i32 %18, 3
%25 = icmp ult i32 %16, 24
br i1 %25, label %51, label %26
26: ; preds = %21
%27 = and i32 %18, 1073741820
br label %28
28: ; preds = %28, %26
%29 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %26 ], [ %46, %28 ]
%30 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %26 ], [ %47, %28 ]
%31 = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %26 ], [ %48, %28 ]
%32 = phi i32 [ 0, %26 ], [ %49, %28 ]
%33 = add <4 x i32> %31, <i32 4, i32 4, i32 4, i32 4>
%34 = mul <4 x i32> %29, %31
%35 = mul <4 x i32> %30, %33
%36 = add <4 x i32> %31, <i32 8, i32 8, i32 8, i32 8>
%37 = add <4 x i32> %31, <i32 12, i32 12, i32 12, i32 12>
%38 = mul <4 x i32> %34, %36
%39 = mul <4 x i32> %35, %37
%40 = add <4 x i32> %31, <i32 16, i32 16, i32 16, i32 16>
%41 = add <4 x i32> %31, <i32 20, i32 20, i32 20, i32 20>
%42 = mul <4 x i32> %38, %40
%43 = mul <4 x i32> %39, %41
%44 = add <4 x i32> %31, <i32 24, i32 24, i32 24, i32 24>
%45 = add <4 x i32> %31, <i32 28, i32 28, i32 28, i32 28>
%46 = mul <4 x i32> %42, %44
%47 = mul <4 x i32> %43, %45
%48 = add <4 x i32> %31, <i32 32, i32 32, i32 32, i32 32>
%49 = add i32 %32, 4
%50 = icmp eq i32 %49, %27
br i1 %50, label %51, label %28
51: ; preds = %28, %21
%52 = phi <4 x i32> [ undef, %21 ], [ %46, %28 ]
%53 = phi <4 x i32> [ undef, %21 ], [ %47, %28 ]
%54 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %21 ], [ %46, %28 ]
%55 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %21 ], [ %47, %28 ]
%56 = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %21 ], [ %48, %28 ]
%57 = icmp eq i32 %24, 0
br i1 %57, label %69, label %58
58: ; preds = %51, %58
%59 = phi <4 x i32> [ %64, %58 ], [ %54, %51 ]
%60 = phi <4 x i32> [ %65, %58 ], [ %55, %51 ]
%61 = phi <4 x i32> [ %66, %58 ], [ %56, %51 ]
%62 = phi i32 [ %67, %58 ], [ 0, %51 ]
%63 = add <4 x i32> %61, <i32 4, i32 4, i32 4, i32 4>
%64 = mul <4 x i32> %59, %61
%65 = mul <4 x i32> %60, %63
%66 = add <4 x i32> %61, <i32 8, i32 8, i32 8, i32 8>
%67 = add i32 %62, 1
%68 = icmp eq i32 %67, %24
br i1 %68, label %69, label %58
69: ; preds = %58, %51
%70 = phi <4 x i32> [ %52, %51 ], [ %64, %58 ]
%71 = phi <4 x i32> [ %53, %51 ], [ %65, %58 ]
%72 = mul <4 x i32> %71, %70
%73 = call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %72)
%74 = icmp eq i32 %19, %22
br i1 %74, label %84, label %75
75: ; preds = %11, %69
%76 = phi i32 [ 1, %11 ], [ %73, %69 ]
%77 = phi i32 [ 1, %11 ], [ %23, %69 ]
br label %78
78: ; preds = %75, %78
%79 = phi i32 [ %81, %78 ], [ %76, %75 ]
%80 = phi i32 [ %82, %78 ], [ %77, %75 ]
%81 = mul nsw i32 %79, %80
%82 = add nuw i32 %80, 1
%83 = icmp eq i32 %82, %13
br i1 %83, label %84, label %78
84: ; preds = %78, %69
%85 = phi i32 [ %73, %69 ], [ %81, %78 ]
%86 = sitofp i32 %85 to float
%87 = fdiv float 1.000000e+00, %86
%88 = load float, float* %2
%89 = fcmp olt float %87, %88
br i1 %89, label %99, label %90
90: ; preds = %84
%91 = fadd float %14, %87
%92 = fpext float %87 to double
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %92, i32 %85)
%94 = add nuw nsw i32 %15, 1
%95 = load i32, i32* %1
%96 = icmp slt i32 %15, %95
%97 = add nuw i32 %13, 1
%98 = add i32 %12, 1
br i1 %96, label %11, label %99
99: ; preds = %90, %84, %0
%100 = phi float [ 1.000000e+00, %0 ], [ %14, %84 ], [ %91, %90 ]
%101 = fpext float %100 to double
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double %101)
ret i32 0
}