#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 *);
double cosTyl(double x, int precision) {
  double cosine;
  double xsquared = x * x;
  double aux;
  if (precision < 0) {
    printf("Warning: Function cosTyl from bmc/core/filter_functions.h: "
           "Precision must be a positive integer. Assuming 0 precision\n");
    precision = 0;
  }
  if (precision >= 0) {
    aux = 0;
    cosine = aux;
    if (precision >= 1) {
      aux = 1;
      cosine = 1;
      if (precision >= 2) {
        aux = xsquared;
        cosine -= aux / 2;
        if (precision >= 3) {
          aux = aux * xsquared;
          cosine += aux / 24;
          if (precision >= 4) {
            aux = aux * xsquared;
            cosine -= aux / 720;
            if (precision >= 5) {
              aux = aux * xsquared;
              cosine += aux / 40320;
              if (precision >= 6) {
                aux = aux * xsquared;
                cosine -= aux / 3628800;
                if (precision >= 7) {
                  aux = aux * xsquared;
                  cosine += aux / 479001600;
                  if (precision >= 8) {
                    printf("Warning: Function sinTyl "
                           "from bmc/core/filter_functions.h: Precision "
                           "representation exceeded. Assuming maximum "
                           "precision of 7\n");
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return cosine;
}


x86 assembly (clang, -O0):
<cosTyl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    114c <cosTyl+0x3c>
lea    0xef8(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1309 <cosTyl+0x1f9>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     1304 <cosTyl+0x1f4>
movsd  0xe86(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe79(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x2,-0xc(%rbp)
jl     12ff <cosTyl+0x1ef>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  0xe5b(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x3,-0xc(%rbp)
jl     12fa <cosTyl+0x1ea>
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe2b(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x4,-0xc(%rbp)
jl     12f5 <cosTyl+0x1e5>
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  0xdff(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x5,-0xc(%rbp)
jl     12f0 <cosTyl+0x1e0>
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdcf(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x6,-0xc(%rbp)
jl     12eb <cosTyl+0x1db>
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  0xda3(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x7,-0xc(%rbp)
jl     12e6 <cosTyl+0x1d6>
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xd73(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x8,-0xc(%rbp)
jl     12e1 <cosTyl+0x1d1>
lea    0xdd3(%rip),%rdi
call   1030 <printf@plt>
jmp    12e6 <cosTyl+0x1d6>
jmp    12eb <cosTyl+0x1db>
jmp    12f0 <cosTyl+0x1e0>
jmp    12f5 <cosTyl+0x1e5>
jmp    12fa <cosTyl+0x1ea>
jmp    12ff <cosTyl+0x1ef>
jmp    1304 <cosTyl+0x1f4>
jmp    1309 <cosTyl+0x1f9>
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cosTyl>:
push   %rax
test   %edi,%edi
js     1126 <cosTyl+0x16>
je     1132 <cosTyl+0x22>
cmp    $0x1,%edi
jne    113c <cosTyl+0x2c>
movsd  0xedc(%rip),%xmm3
jmp    1136 <cosTyl+0x26>
lea    0xf89(%rip),%rdi
call   1030 <puts@plt>
xorpd  %xmm3,%xmm3
movapd %xmm3,%xmm0
pop    %rax
ret
mulsd  %xmm0,%xmm0
movsd  0xec0(%rip),%xmm3
mulsd  %xmm0,%xmm3
addsd  0xeac(%rip),%xmm3
cmp    $0x3,%edi
jb     1136 <cosTyl+0x26>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
divsd  0xea3(%rip),%xmm2
addsd  %xmm2,%xmm3
je     1136 <cosTyl+0x26>
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
divsd  0xe95(%rip),%xmm2
addsd  %xmm2,%xmm3
cmp    $0x5,%edi
jb     1136 <cosTyl+0x26>
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
divsd  0xe84(%rip),%xmm2
addsd  %xmm2,%xmm3
je     1136 <cosTyl+0x26>
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
divsd  0xe76(%rip),%xmm2
addsd  %xmm2,%xmm3
cmp    $0x7,%edi
jb     1136 <cosTyl+0x26>
mulsd  %xmm1,%xmm0
divsd  0xe65(%rip),%xmm0
addsd  %xmm0,%xmm3
je     1136 <cosTyl+0x26>
lea    0xe5c(%rip),%rdi
movsd  %xmm3,(%rsp)
call   1030 <puts@plt>
movsd  (%rsp),%xmm3
jmp    1136 <cosTyl+0x26>

LLVM IR (-O0):
@.str = [119 x i8] c"Warning: Function cosTyl from bmc/core/filter_functions.h: Precision must be a positive integer. Assuming 0 precision\0A\00"
@.str.1 = [127 x i8] c"Warning: Function sinTyl from bmc/core/filter_functions.h: Precision representation exceeded. Assuming maximum precision of 7\0A\00"
define double @cosTyl(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
%8 = load double, double* %3
%9 = load double, double* %3
%10 = fmul double %8, %9
store double %10, double* %6
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %15
15: ; preds = %13, %2
%16 = load i32, i32* %4
%17 = icmp sge i32 %16, 0
br i1 %17, label %18, label %93
18: ; preds = %15
store double 0.000000e+00, double* %7
%19 = load double, double* %7
store double %19, double* %5
%20 = load i32, i32* %4
%21 = icmp sge i32 %20, 1
br i1 %21, label %22, label %92
22: ; preds = %18
store double 1.000000e+00, double* %7
store double 1.000000e+00, double* %5
%23 = load i32, i32* %4
%24 = icmp sge i32 %23, 2
br i1 %24, label %25, label %91
25: ; preds = %22
%26 = load double, double* %6
store double %26, double* %7
%27 = load double, double* %7
%28 = fdiv double %27, 2.000000e+00
%29 = load double, double* %5
%30 = fsub double %29, %28
store double %30, double* %5
%31 = load i32, i32* %4
%32 = icmp sge i32 %31, 3
br i1 %32, label %33, label %90
33: ; preds = %25
%34 = load double, double* %7
%35 = load double, double* %6
%36 = fmul double %34, %35
store double %36, double* %7
%37 = load double, double* %7
%38 = fdiv double %37, 2.400000e+01
%39 = load double, double* %5
%40 = fadd double %39, %38
store double %40, double* %5
%41 = load i32, i32* %4
%42 = icmp sge i32 %41, 4
br i1 %42, label %43, label %89
43: ; preds = %33
%44 = load double, double* %7
%45 = load double, double* %6
%46 = fmul double %44, %45
store double %46, double* %7
%47 = load double, double* %7
%48 = fdiv double %47, 7.200000e+02
%49 = load double, double* %5
%50 = fsub double %49, %48
store double %50, double* %5
%51 = load i32, i32* %4
%52 = icmp sge i32 %51, 5
br i1 %52, label %53, label %88
53: ; preds = %43
%54 = load double, double* %7
%55 = load double, double* %6
%56 = fmul double %54, %55
store double %56, double* %7
%57 = load double, double* %7
%58 = fdiv double %57, 4.032000e+04
%59 = load double, double* %5
%60 = fadd double %59, %58
store double %60, double* %5
%61 = load i32, i32* %4
%62 = icmp sge i32 %61, 6
br i1 %62, label %63, label %87
63: ; preds = %53
%64 = load double, double* %7
%65 = load double, double* %6
%66 = fmul double %64, %65
store double %66, double* %7
%67 = load double, double* %7
%68 = fdiv double %67, 3.628800e+06
%69 = load double, double* %5
%70 = fsub double %69, %68
store double %70, double* %5
%71 = load i32, i32* %4
%72 = icmp sge i32 %71, 7
br i1 %72, label %73, label %86
73: ; preds = %63
%74 = load double, double* %7
%75 = load double, double* %6
%76 = fmul double %74, %75
store double %76, double* %7
%77 = load double, double* %7
%78 = fdiv double %77, 0x41BC8CFC00000000
%79 = load double, double* %5
%80 = fadd double %79, %78
store double %80, double* %5
%81 = load i32, i32* %4
%82 = icmp sge i32 %81, 8
br i1 %82, label %83, label %85
83: ; preds = %73
%84 = call i32 @printf(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str.1, i64 0, i64 0))
br label %85
85: ; preds = %83, %73
br label %86
86: ; preds = %85, %63
br label %87
87: ; preds = %86, %53
br label %88
88: ; preds = %87, %43
br label %89
89: ; preds = %88, %33
br label %90
90: ; preds = %89, %25
br label %91
91: ; preds = %90, %22
br label %92
92: ; preds = %91, %18
br label %93
93: ; preds = %92, %15
%94 = load double, double* %5
ret double %94
}

LLVM IR (-O2):
@str = [126 x i8] c"Warning: Function sinTyl from bmc/core/filter_functions.h: Precision representation exceeded. Assuming maximum precision of 7\00"
@str.2 = [118 x i8] c"Warning: Function cosTyl from bmc/core/filter_functions.h: Precision must be a positive integer. Assuming 0 precision\00"
define double @cosTyl(double %0, i32 %1) {
%3 = fmul double %0, %0
%4 = icmp slt i32 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([118 x i8], [118 x i8]* @str.2, i64 0, i64 0))
br label %40
7: ; preds = %2
switch i32 %1, label %8 [
i32 0, label %40
i32 1, label %39
]
8: ; preds = %7
%9 = fmul double %3, 5.000000e-01
%10 = fsub double 1.000000e+00, %9
%11 = icmp ugt i32 %1, 2
br i1 %11, label %12, label %40
12: ; preds = %8
%13 = fmul double %3, %3
%14 = fdiv double %13, 2.400000e+01
%15 = fadd double %10, %14
%16 = icmp eq i32 %1, 3
br i1 %16, label %40, label %17
17: ; preds = %12
%18 = fmul double %3, %13
%19 = fdiv double %18, 7.200000e+02
%20 = fsub double %15, %19
%21 = icmp ugt i32 %1, 4
br i1 %21, label %22, label %40
22: ; preds = %17
%23 = fmul double %3, %18
%24 = fdiv double %23, 4.032000e+04
%25 = fadd double %20, %24
%26 = icmp eq i32 %1, 5
br i1 %26, label %40, label %27
27: ; preds = %22
%28 = fmul double %3, %23
%29 = fdiv double %28, 3.628800e+06
%30 = fsub double %25, %29
%31 = icmp ugt i32 %1, 6
br i1 %31, label %32, label %40
32: ; preds = %27
%33 = fmul double %3, %28
%34 = fdiv double %33, 0x41BC8CFC00000000
%35 = fadd double %30, %34
%36 = icmp eq i32 %1, 7
br i1 %36, label %40, label %37
37: ; preds = %32
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([126 x i8], [126 x i8]* @str, i64 0, i64 0))
br label %40
39: ; preds = %7
br label %40
40: ; preds = %7, %39, %5, %8, %17, %27, %37, %32, %22, %12
%41 = phi double [ %35, %37 ], [ %35, %32 ], [ %30, %27 ], [ %25, %22 ], [ %20, %17 ], [ %15, %12 ], [ %10, %8 ], [ 0.000000e+00, %7 ], [ 0.000000e+00, %5 ], [ 1.000000e+00, %39 ]
ret double %41
}