#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 cos(double);
int /*<<< orphan*/ printf(char *, int, double, double);
double sin(double);
int main(int argc, const char *argv[]) {
  int k;
  double h, t, x1, x2, x3;
  int n = 100;
  double a = 2, b = 5, x = 0.32;
  h = (b - a) / n;
  t = a;
  for (k = 1; k <= n; k++) {
    x1 = sin(x) + cos(t);
    x2 = x1 * (sin(x) - cos(t));
    x3 = x2 * cos(x) - x1 * x1 * sin(x) - cos(t);
    x = x + h * (x1 + (1 / 2) * h * (x2 + (1 / 3) * h * (x3)));
    t = a + k * h;
    printf("no. of step size %d the value of t is %f solution of Taylor series "
           "is %f\n",
           k, t, x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x64,-0x44(%rbp)
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xea3(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
cvtsi2sdl -0x44(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     1335 <main+0x205>
movsd  -0x60(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x90(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x88(%rbp),%xmm0
ff
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x80(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm3
xorps  %xmm2,%xmm2
mulsd  -0x20(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm5
xorps  %xmm4,%xmm4
mulsd  -0x20(%rbp),%xmm4
movsd  -0x40(%rbp),%xmm6
mulsd  %xmm6,%xmm4
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
lea    0xcf6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a0 <main+0x70>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movsd  0xec1(%rip),%xmm0
mov    $0x1,%ebx
movsd  0xebc(%rip),%xmm1
movsd  0xebc(%rip),%xmm2
movsd  %xmm2,0x10(%rsp)
lea    0xebf(%rip),%r14
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
nopl   (%rax)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x30(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movsd  0x30(%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
movsd  0x28(%rsp),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
mulsd  %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x30(%rsp),%xmm1
movsd  0xdd9(%rip),%xmm2
mulsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xd9d(%rip),%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
movsd  %xmm0,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
call   1030 <printf@plt>
movsd  0x20(%rsp),%xmm0
addsd  0xd81(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [74 x i8] c"no. of step size %d the value of t is %f solution of Taylor series is %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 100, i32* %12
store double 2.000000e+00, double* %13
store double 5.000000e+00, double* %14
store double 3.200000e-01, double* %15
%16 = load double, double* %14
%17 = load double, double* %13
%18 = fsub double %16, %17
%19 = load i32, i32* %12
%20 = sitofp i32 %19 to double
%21 = fdiv double %18, %20
store double %21, double* %7
%22 = load double, double* %13
store double %22, double* %8
store i32 1, i32* %6
br label %23
23: ; preds = %75, %2
%24 = load i32, i32* %6
%25 = load i32, i32* %12
%26 = icmp sle i32 %24, %25
br i1 %26, label %27, label %78
27: ; preds = %23
%28 = load double, double* %15
%29 = call double @sin(double %28)
%30 = load double, double* %8
%31 = call double @cos(double %30)
%32 = fadd double %29, %31
store double %32, double* %9
%33 = load double, double* %9
%34 = load double, double* %15
%35 = call double @sin(double %34)
%36 = load double, double* %8
%37 = call double @cos(double %36)
%38 = fsub double %35, %37
%39 = fmul double %33, %38
store double %39, double* %10
%40 = load double, double* %10
%41 = load double, double* %15
%42 = call double @cos(double %41)
%43 = load double, double* %9
%44 = load double, double* %9
%45 = fmul double %43, %44
%46 = load double, double* %15
%47 = call double @sin(double %46)
%48 = fmul double %45, %47
%49 = fneg double %48
%50 = call double @llvm.fmuladd.f64(double %40, double %42, double %49)
%51 = load double, double* %8
%52 = call double @cos(double %51)
%53 = fsub double %50, %52
store double %53, double* %11
%54 = load double, double* %15
%55 = load double, double* %7
%56 = load double, double* %9
%57 = load double, double* %7
%58 = fmul double 0.000000e+00, %57
%59 = load double, double* %10
%60 = load double, double* %7
%61 = fmul double 0.000000e+00, %60
%62 = load double, double* %11
%63 = call double @llvm.fmuladd.f64(double %61, double %62, double %59)
%64 = call double @llvm.fmuladd.f64(double %58, double %63, double %56)
%65 = call double @llvm.fmuladd.f64(double %55, double %64, double %54)
store double %65, double* %15
%66 = load double, double* %13
%67 = load i32, i32* %6
%68 = sitofp i32 %67 to double
%69 = load double, double* %7
%70 = call double @llvm.fmuladd.f64(double %68, double %69, double %66)
store double %70, double* %8
%71 = load i32, i32* %6
%72 = load double, double* %8
%73 = load double, double* %15
%74 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i32 %71, double %72, double %73)
br label %75
75: ; preds = %27
%76 = load i32, i32* %6
%77 = add nsw i32 %76, 1
store i32 %77, i32* %6
br label %23
78: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@.str = [74 x i8] c"no. of step size %d the value of t is %f solution of Taylor series is %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi double [ 3.200000e-01, %2 ], [ %24, %3 ]
%5 = phi i32 [ 1, %2 ], [ %28, %3 ]
%6 = phi double [ 2.000000e+00, %2 ], [ %26, %3 ]
%7 = tail call double @sin(double %4)
%8 = tail call double @cos(double %6)
%9 = fadd double %7, %8
%10 = tail call double @sin(double %4)
%11 = tail call double @cos(double %6)
%12 = fsub double %10, %11
%13 = fmul double %9, %12
%14 = tail call double @cos(double %4)
%15 = tail call double @sin(double %4)
%16 = fneg double %9
%17 = fmul double %9, %16
%18 = fmul double %17, %15
%19 = tail call double @llvm.fmuladd.f64(double %13, double %14, double %18)
%20 = tail call double @cos(double %6)
%21 = fsub double %19, %20
%22 = tail call double @llvm.fmuladd.f64(double %21, double 0.000000e+00, double %13)
%23 = tail call double @llvm.fmuladd.f64(double %22, double 0.000000e+00, double %9)
%24 = tail call double @llvm.fmuladd.f64(double %23, double 3.000000e-02, double %4)
%25 = sitofp i32 %5 to double
%26 = tail call double @llvm.fmuladd.f64(double %25, double 3.000000e-02, double 2.000000e+00)
%27 = tail call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i32 %5, double %26, double %24)
%28 = add nuw nsw i32 %5, 1
%29 = icmp eq i32 %28, 101
br i1 %29, label %30, label %3
30: ; preds = %3
ret i32 0
}