#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 */
double fabs(float);
int pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
main() {
  float x, a, S, k = 0, i;
  int N = 0;
  printf("Биномиальный коэффициент(СУММА). Найдите значение "
         "N.\n(-x^k)/(k^2+2)\n|x|<1 |a/S|<=0.001 a=(-x^k)/(k^2+2)\n\n");
  printf("x=");
  scanf("%f", &x);
  if (fabs(x) < 1) {
    S = ((pow(-x, k)) / ((pow(k, 2)) + 2));
    a = ((pow(-x, k)) / ((pow(k, 2)) + 2));
    for (N = 0; fabs(a / S) >= 0.001; N++) {
      k++;
      S += ((pow(-x, k)) / ((pow(k, 2)) + 2));
      a = ((pow(-x, k)) / ((pow(k, 2)) + 2));
    }
    printf("N=%d", N);
  } else
    printf("Модуль x должен быть меньше 1 по условию");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf2b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
call   1040 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xe61(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1314 <main+0x1d4>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvttss2si -0x14(%rbp),%edi
call   1060 <pow@plt>
mov    %eax,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvttss2si -0x14(%rbp),%edi
call   1060 <pow@plt>
mov    %eax,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
call   1040 <fabs@plt>
movsd  0xdbd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12fe <main+0x1be>
movss  0xdb3(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvttss2si -0x14(%rbp),%edi
call   1060 <pow@plt>
mov    %eax,-0x2c(%rbp)
movss  -0x14(%rbp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvttss2si -0x14(%rbp),%edi
call   1060 <pow@plt>
mov    %eax,-0x28(%rbp)
movss  -0x14(%rbp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1234 <main+0xf4>
mov    -0x1c(%rbp),%esi
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1322 <main+0x1e2>
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xf18(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
call   1050 <fabs@plt>
movsd  0xe67(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1309 <main+0x1b9>
movss  0x4(%rsp),%xmm0
xorps  0xe60(%rip),%xmm0
xor    %edi,%edi
call   1070 <pow@plt>
mov    %eax,%ebp
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
xorps  %xmm0,%xmm0
mov    $0x2,%edi
call   1070 <pow@plt>
mov    %eax,%ecx
add    $0x2,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
xorps  0xe1d(%rip),%xmm0
xor    %edi,%edi
call   1070 <pow@plt>
mov    %eax,%ebp
xorps  %xmm0,%xmm0
mov    $0x2,%edi
call   1070 <pow@plt>
mov    %eax,%ecx
add    $0x2,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0x8(%rsp),%xmm0
call   1050 <fabs@plt>
ucomisd 0xddb(%rip),%xmm0
jb     12f6 <main+0x1a6>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm2
addss  0xdd2(%rip),%xmm2
movss  %xmm2,0xc(%rsp)
movss  0x4(%rsp),%xmm0
movaps 0xdaf(%rip),%xmm1
xorps  %xmm1,%xmm0
cvttss2si %xmm2,%ebp
mov    %ebp,%edi
call   1070 <pow@plt>
mov    %eax,%ebx
movss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1070 <pow@plt>
mov    %eax,%ecx
add    $0x2,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
movss  0x4(%rsp),%xmm0
xorps  0xd61(%rip),%xmm0
mov    %ebp,%edi
call   1070 <pow@plt>
mov    %eax,%ebx
movss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1070 <pow@plt>
mov    %eax,%ecx
add    $0x2,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0x8(%rsp),%xmm0
add    $0x1,%r14d
call   1050 <fabs@plt>
ucomisd 0xd18(%rip),%xmm0
jae    1240 <main+0xf0>
lea    0xd2d(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1317 <main+0x1c7>
lea    0xd1f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [149 x i8] c"\D0\91\D0\B8\D0\BD\D0\BE\D0\BC\D0\B8\D0\B0\D0\BB\D1\8C\D0\BD\D1\8B\D0\B9 \D0\BA\D0\BE\D1\8D\D1\84\D1\84\D0\B8\D1\86\D0\B8\D0\B5\D0\BD\D1\82(\D0\A1\D0\A3\D0\9C\D0\9C\D0\90). \D0\9D\D0\B0\D0\B9\D0\B4\D0\B8\D1\82\D0\B5 \D0\B7\D0\BD\D0\B0\D1\87\D0\B5\D0\BD\D0\B8\D0\B5 N.\0A(-x^k)/(k^2+2)\0A|x|<1 |a/S|<=0.001 a=(-x^k)/(k^2+2)\0A\0A\00"
@.str.1 = [3 x i8] c"x=\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [5 x i8] c"N=%d\00"
@.str.4 = [72 x i8] c"\D0\9C\D0\BE\D0\B4\D1\83\D0\BB\D1\8C x \D0\B4\D0\BE\D0\BB\D0\B6\D0\B5\D0\BD \D0\B1\D1\8B\D1\82\D1\8C \D0\BC\D0\B5\D0\BD\D1\8C\D1\88\D0\B5 1 \D0\BF\D0\BE \D1\83\D1\81\D0\BB\D0\BE\D0\B2\D0\B8\D1\8E\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %5
store i32 0, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%11 = load float, float* %2
%12 = call double @fabs(float %11)
%13 = fcmp olt double %12, 1.000000e+00
br i1 %13, label %14, label %72
14: ; preds = %0
%15 = load float, float* %2
%16 = fneg float %15
%17 = load float, float* %5
%18 = fptosi float %17 to i32
%19 = call i32 @pow(float %16, i32 %18)
%20 = load float, float* %5
%21 = call i32 @pow(float %20, i32 2)
%22 = add nsw i32 %21, 2
%23 = sdiv i32 %19, %22
%24 = sitofp i32 %23 to float
store float %24, float* %4
%25 = load float, float* %2
%26 = fneg float %25
%27 = load float, float* %5
%28 = fptosi float %27 to i32
%29 = call i32 @pow(float %26, i32 %28)
%30 = load float, float* %5
%31 = call i32 @pow(float %30, i32 2)
%32 = add nsw i32 %31, 2
%33 = sdiv i32 %29, %32
%34 = sitofp i32 %33 to float
store float %34, float* %3
store i32 0, i32* %7
br label %35
35: ; preds = %66, %14
%36 = load float, float* %3
%37 = load float, float* %4
%38 = fdiv float %36, %37
%39 = call double @fabs(float %38)
%40 = fcmp oge double %39, 1.000000e-03
br i1 %40, label %41, label %69
41: ; preds = %35
%42 = load float, float* %5
%43 = fadd float %42, 1.000000e+00
store float %43, float* %5
%44 = load float, float* %2
%45 = fneg float %44
%46 = load float, float* %5
%47 = fptosi float %46 to i32
%48 = call i32 @pow(float %45, i32 %47)
%49 = load float, float* %5
%50 = call i32 @pow(float %49, i32 2)
%51 = add nsw i32 %50, 2
%52 = sdiv i32 %48, %51
%53 = sitofp i32 %52 to float
%54 = load float, float* %4
%55 = fadd float %54, %53
store float %55, float* %4
%56 = load float, float* %2
%57 = fneg float %56
%58 = load float, float* %5
%59 = fptosi float %58 to i32
%60 = call i32 @pow(float %57, i32 %59)
%61 = load float, float* %5
%62 = call i32 @pow(float %61, i32 2)
%63 = add nsw i32 %62, 2
%64 = sdiv i32 %60, %63
%65 = sitofp i32 %64 to float
store float %65, float* %3
br label %66
66: ; preds = %41
%67 = load i32, i32* %7
%68 = add nsw i32 %67, 1
store i32 %68, i32* %7
br label %35
69: ; preds = %35
%70 = load i32, i32* %7
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %70)
br label %74
72: ; preds = %0
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0))
br label %74
74: ; preds = %72, %69
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"x=\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [5 x i8] c"N=%d\00"
@.str.4 = [72 x i8] c"\D0\9C\D0\BE\D0\B4\D1\83\D0\BB\D1\8C x \D0\B4\D0\BE\D0\BB\D0\B6\D0\B5\D0\BD \D0\B1\D1\8B\D1\82\D1\8C \D0\BC\D0\B5\D0\BD\D1\8C\D1\88\D0\B5 1 \D0\BF\D0\BE \D1\83\D1\81\D0\BB\D0\BE\D0\B2\D0\B8\D1\8E\00"
@str = [148 x i8] c"\D0\91\D0\B8\D0\BD\D0\BE\D0\BC\D0\B8\D0\B0\D0\BB\D1\8C\D0\BD\D1\8B\D0\B9 \D0\BA\D0\BE\D1\8D\D1\84\D1\84\D0\B8\D1\86\D0\B8\D0\B5\D0\BD\D1\82(\D0\A1\D0\A3\D0\9C\D0\9C\D0\90). \D0\9D\D0\B0\D0\B9\D0\B4\D0\B8\D1\82\D0\B5 \D0\B7\D0\BD\D0\B0\D1\87\D0\B5\D0\BD\D0\B8\D0\B5 N.\0A(-x^k)/(k^2+2)\0A|x|<1 |a/S|<=0.001 a=(-x^k)/(k^2+2)\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([148 x i8], [148 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%6 = load float, float* %1
%7 = call double @fabs(float %6)
%8 = fcmp olt double %7, 1.000000e+00
br i1 %8, label %9, label %55
9: ; preds = %0
%10 = load float, float* %1
%11 = fneg float %10
%12 = call i32 @pow(float %11, i32 0)
%13 = call i32 @pow(float 0.000000e+00, i32 2)
%14 = add nsw i32 %13, 2
%15 = sdiv i32 %12, %14
%16 = sitofp i32 %15 to float
%17 = load float, float* %1
%18 = fneg float %17
%19 = call i32 @pow(float %18, i32 0)
%20 = call i32 @pow(float 0.000000e+00, i32 2)
%21 = add nsw i32 %20, 2
%22 = sdiv i32 %19, %21
%23 = sitofp i32 %22 to float
%24 = fdiv float %23, %16
%25 = call double @fabs(float %24)
%26 = fcmp ult double %25, 1.000000e-03
br i1 %26, label %52, label %27
27: ; preds = %9, %27
%28 = phi i32 [ %47, %27 ], [ 0, %9 ]
%29 = phi float [ %31, %27 ], [ 0.000000e+00, %9 ]
%30 = phi float [ %40, %27 ], [ %16, %9 ]
%31 = fadd float %29, 1.000000e+00
%32 = load float, float* %1
%33 = fneg float %32
%34 = fptosi float %31 to i32
%35 = call i32 @pow(float %33, i32 %34)
%36 = call i32 @pow(float %31, i32 2)
%37 = add nsw i32 %36, 2
%38 = sdiv i32 %35, %37
%39 = sitofp i32 %38 to float
%40 = fadd float %30, %39
%41 = load float, float* %1
%42 = fneg float %41
%43 = call i32 @pow(float %42, i32 %34)
%44 = call i32 @pow(float %31, i32 2)
%45 = add nsw i32 %44, 2
%46 = sdiv i32 %43, %45
%47 = add nuw nsw i32 %28, 1
%48 = sitofp i32 %46 to float
%49 = fdiv float %48, %40
%50 = call double @fabs(float %49)
%51 = fcmp ult double %50, 1.000000e-03
br i1 %51, label %52, label %27
52: ; preds = %27, %9
%53 = phi i32 [ 0, %9 ], [ %47, %27 ]
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %53)
br label %57
55: ; preds = %0
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0))
br label %57
57: ; preds = %55, %52
ret i32 0
}