; LLVM IR from mkmarek/forex.analytics :: lib/ta-lib/src/ta_func (ta_TEMA)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @TA_EMA_Lookback(i32 noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

declare i32 @TA_INT_EMA(i32 noundef, i32 noundef, ptr noundef, i32 noundef, double noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @TA_S_TEMA(i32 noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #5 {
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca double, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  store i32 %0, ptr %9, align 4, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !9
  store ptr %5, ptr %14, align 8, !tbaa !9
  store ptr %6, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #6
  %33 = load i32, ptr %9, align 4, !tbaa !5
  %34 = icmp slt i32 %33, 0
  br i1 %34, label %35, label %36

35:                                               ; preds = %7
  store i32 12, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

36:                                               ; preds = %7
  %37 = load i32, ptr %10, align 4, !tbaa !5
  %38 = icmp slt i32 %37, 0
  br i1 %38, label %43, label %39

39:                                               ; preds = %36
  %40 = load i32, ptr %10, align 4, !tbaa !5
  %41 = load i32, ptr %9, align 4, !tbaa !5
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %43, label %44

43:                                               ; preds = %39, %36
  store i32 13, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

44:                                               ; preds = %39
  %45 = load ptr, ptr %11, align 8, !tbaa !9
  %46 = icmp ne ptr %45, null
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  store i32 2, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

48:                                               ; preds = %44
  %49 = load i32, ptr %12, align 4, !tbaa !5
  %50 = icmp eq i32 %49, -2147483648
  br i1 %50, label %51, label %52

51:                                               ; preds = %48
  store i32 30, ptr %12, align 4, !tbaa !5
  br label %60

52:                                               ; preds = %48
  %53 = load i32, ptr %12, align 4, !tbaa !5
  %54 = icmp slt i32 %53, 2
  br i1 %54, label %58, label %55

55:                                               ; preds = %52
  %56 = load i32, ptr %12, align 4, !tbaa !5
  %57 = icmp sgt i32 %56, 100000
  br i1 %57, label %58, label %59

58:                                               ; preds = %55, %52
  store i32 2, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

59:                                               ; preds = %55
  br label %60

60:                                               ; preds = %59, %51
  %61 = load ptr, ptr %15, align 8, !tbaa !9
  %62 = icmp ne ptr %61, null
  br i1 %62, label %64, label %63

63:                                               ; preds = %60
  store i32 2, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

64:                                               ; preds = %60
  %65 = load ptr, ptr %14, align 8, !tbaa !9
  store i32 0, ptr %65, align 4, !tbaa !5
  %66 = load ptr, ptr %13, align 8, !tbaa !9
  store i32 0, ptr %66, align 4, !tbaa !5
  %67 = load i32, ptr %12, align 4, !tbaa !5
  %68 = call i32 @TA_EMA_Lookback(i32 noundef %67)
  store i32 %68, ptr %28, align 4, !tbaa !5
  %69 = load i32, ptr %28, align 4, !tbaa !5
  %70 = mul nsw i32 %69, 3
  store i32 %70, ptr %27, align 4, !tbaa !5
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = load i32, ptr %27, align 4, !tbaa !5
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %74, label %76

74:                                               ; preds = %64
  %75 = load i32, ptr %27, align 4, !tbaa !5
  store i32 %75, ptr %9, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %74, %64
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = load i32, ptr %10, align 4, !tbaa !5
  %79 = icmp sgt i32 %77, %78
  br i1 %79, label %80, label %81

80:                                               ; preds = %76
  store i32 0, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

81:                                               ; preds = %76
  %82 = load i32, ptr %27, align 4, !tbaa !5
  %83 = load i32, ptr %10, align 4, !tbaa !5
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = sub nsw i32 %83, %84
  %86 = add nsw i32 %82, %85
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %25, align 4, !tbaa !5
  %88 = load i32, ptr %25, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = mul i64 8, %89
  %91 = call noalias ptr @malloc(i64 noundef %90) #7
  store ptr %91, ptr %16, align 8, !tbaa !9
  %92 = load ptr, ptr %16, align 8, !tbaa !9
  %93 = icmp ne ptr %92, null
  br i1 %93, label %95, label %94

94:                                               ; preds = %81
  store i32 3, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

95:                                               ; preds = %81
  %96 = load i32, ptr %12, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  %98 = sitofp i32 %97 to double
  %99 = fdiv double 2.000000e+00, %98
  store double %99, ptr %18, align 8, !tbaa !11
  %100 = load i32, ptr %9, align 4, !tbaa !5
  %101 = load i32, ptr %28, align 4, !tbaa !5
  %102 = mul nsw i32 %101, 2
  %103 = sub nsw i32 %100, %102
  %104 = load i32, ptr %10, align 4, !tbaa !5
  %105 = load ptr, ptr %11, align 8, !tbaa !9
  %106 = load i32, ptr %12, align 4, !tbaa !5
  %107 = load double, ptr %18, align 8, !tbaa !11
  %108 = load ptr, ptr %16, align 8, !tbaa !9
  %109 = call i32 @TA_S_INT_EMA(i32 noundef %103, i32 noundef %104, ptr noundef %105, i32 noundef %106, double noundef %107, ptr noundef %19, ptr noundef %20, ptr noundef %108)
  store i32 %109, ptr %31, align 4, !tbaa !5
  %110 = load i32, ptr %31, align 4, !tbaa !5
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %115, label %112

112:                                              ; preds = %95
  %113 = load i32, ptr %20, align 4, !tbaa !5
  %114 = icmp eq i32 %113, 0
  br i1 %114, label %115, label %118

115:                                              ; preds = %112, %95
  %116 = load ptr, ptr %16, align 8, !tbaa !9
  call void @free(ptr noundef %116) #6
  %117 = load i32, ptr %31, align 4, !tbaa !5
  store i32 %117, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

118:                                              ; preds = %112
  %119 = load i32, ptr %20, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = mul i64 8, %120
  %122 = call noalias ptr @malloc(i64 noundef %121) #7
  store ptr %122, ptr %17, align 8, !tbaa !9
  %123 = load ptr, ptr %17, align 8, !tbaa !9
  %124 = icmp ne ptr %123, null
  br i1 %124, label %127, label %125

125:                                              ; preds = %118
  %126 = load ptr, ptr %16, align 8, !tbaa !9
  call void @free(ptr noundef %126) #6
  store i32 3, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

127:                                              ; preds = %118
  %128 = load i32, ptr %20, align 4, !tbaa !5
  %129 = sub nsw i32 %128, 1
  %130 = load ptr, ptr %16, align 8, !tbaa !9
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = load double, ptr %18, align 8, !tbaa !11
  %133 = load ptr, ptr %17, align 8, !tbaa !9
  %134 = call i32 @TA_INT_EMA(i32 noundef 0, i32 noundef %129, ptr noundef %130, i32 noundef %131, double noundef %132, ptr noundef %21, ptr noundef %22, ptr noundef %133)
  store i32 %134, ptr %31, align 4, !tbaa !5
  %135 = load i32, ptr %31, align 4, !tbaa !5
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %140, label %137

137:                                              ; preds = %127
  %138 = load i32, ptr %22, align 4, !tbaa !5
  %139 = icmp eq i32 %138, 0
  br i1 %139, label %140, label %144

140:                                              ; preds = %137, %127
  %141 = load ptr, ptr %16, align 8, !tbaa !9
  call void @free(ptr noundef %141) #6
  %142 = load ptr, ptr %17, align 8, !tbaa !9
  call void @free(ptr noundef %142) #6
  %143 = load i32, ptr %31, align 4, !tbaa !5
  store i32 %143, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

144:                                              ; preds = %137
  %145 = load i32, ptr %22, align 4, !tbaa !5
  %146 = sub nsw i32 %145, 1
  %147 = load ptr, ptr %17, align 8, !tbaa !9
  %148 = load i32, ptr %12, align 4, !tbaa !5
  %149 = load double, ptr %18, align 8, !tbaa !11
  %150 = load ptr, ptr %15, align 8, !tbaa !9
  %151 = call i32 @TA_INT_EMA(i32 noundef 0, i32 noundef %146, ptr noundef %147, i32 noundef %148, double noundef %149, ptr noundef %23, ptr noundef %24, ptr noundef %150)
  store i32 %151, ptr %31, align 4, !tbaa !5
  %152 = load i32, ptr %31, align 4, !tbaa !5
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %157, label %154

154:                                              ; preds = %144
  %155 = load i32, ptr %24, align 4, !tbaa !5
  %156 = icmp eq i32 %155, 0
  br i1 %156, label %157, label %161

157:                                              ; preds = %154, %144
  %158 = load ptr, ptr %16, align 8, !tbaa !9
  call void @free(ptr noundef %158) #6
  %159 = load ptr, ptr %17, align 8, !tbaa !9
  call void @free(ptr noundef %159) #6
  %160 = load i32, ptr %31, align 4, !tbaa !5
  store i32 %160, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

161:                                              ; preds = %154
  %162 = load i32, ptr %23, align 4, !tbaa !5
  %163 = load i32, ptr %21, align 4, !tbaa !5
  %164 = add nsw i32 %162, %163
  store i32 %164, ptr %29, align 4, !tbaa !5
  %165 = load i32, ptr %23, align 4, !tbaa !5
  store i32 %165, ptr %30, align 4, !tbaa !5
  %166 = load i32, ptr %29, align 4, !tbaa !5
  %167 = load i32, ptr %19, align 4, !tbaa !5
  %168 = add nsw i32 %166, %167
  %169 = load ptr, ptr %13, align 8, !tbaa !9
  store i32 %168, ptr %169, align 4, !tbaa !5
  store i32 0, ptr %26, align 4, !tbaa !5
  br label %170

170:                                              ; preds = %174, %161
  %171 = load i32, ptr %26, align 4, !tbaa !5
  %172 = load i32, ptr %24, align 4, !tbaa !5
  %173 = icmp slt i32 %171, %172
  br i1 %173, label %174, label %198

174:                                              ; preds = %170
  %175 = load ptr, ptr %16, align 8, !tbaa !9
  %176 = load i32, ptr %29, align 4, !tbaa !5
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %29, align 4, !tbaa !5
  %178 = sext i32 %176 to i64
  %179 = getelementptr inbounds double, ptr %175, i64 %178
  %180 = load double, ptr %179, align 8, !tbaa !11
  %181 = load ptr, ptr %17, align 8, !tbaa !9
  %182 = load i32, ptr %30, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %30, align 4, !tbaa !5
  %184 = sext i32 %182 to i64
  %185 = getelementptr inbounds double, ptr %181, i64 %184
  %186 = load double, ptr %185, align 8, !tbaa !11
  %187 = fmul double 3.000000e+00, %186
  %188 = fneg double %187
  %189 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %180, double %188)
  %190 = load ptr, ptr %15, align 8, !tbaa !9
  %191 = load i32, ptr %26, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds double, ptr %190, i64 %192
  %194 = load double, ptr %193, align 8, !tbaa !11
  %195 = fadd double %194, %189
  store double %195, ptr %193, align 8, !tbaa !11
  %196 = load i32, ptr %26, align 4, !tbaa !5
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %26, align 4, !tbaa !5
  br label %170, !llvm.loop !13

198:                                              ; preds = %170
  %199 = load ptr, ptr %16, align 8, !tbaa !9
  call void @free(ptr noundef %199) #6
  %200 = load ptr, ptr %17, align 8, !tbaa !9
  call void @free(ptr noundef %200) #6
  %201 = load i32, ptr %26, align 4, !tbaa !5
  %202 = load ptr, ptr %14, align 8, !tbaa !9
  store i32 %201, ptr %202, align 4, !tbaa !5
  store i32 0, ptr %8, align 4
  store i32 1, ptr %32, align 4
  br label %203

203:                                              ; preds = %198, %157, %140, %125, %115, %94, %80, %63, %58, %47, %43, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  %204 = load i32, ptr %8, align 4
  ret i32 %204
}

declare i32 @TA_S_INT_EMA(i32 noundef, i32 noundef, ptr noundef, i32 noundef, double noundef, ptr noundef, ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @TA_EMA_Lookback(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

declare i32 @TA_INT_EMA(i32 noundef, i32 noundef, ptr noundef, i32 noundef, double noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @TA_S_TEMA(i32 noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5, ptr noundef %6) local_unnamed_addr #5 {
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #7
  %14 = icmp slt i32 %0, 0
  br i1 %14, label %93, label %15

15:                                               ; preds = %7
  %16 = icmp slt i32 %1, %0
  br i1 %16, label %93, label %17

17:                                               ; preds = %15
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %93, label %18

18:                                               ; preds = %17
  %19 = icmp eq i32 %3, -2147483648
  br i1 %19, label %22, label %20

20:                                               ; preds = %18
  %21 = add i32 %3, -100001
  %or.cond = icmp ult i32 %21, -99999
  br i1 %or.cond, label %93, label %22

22:                                               ; preds = %18, %20
  %.077 = phi i32 [ %3, %20 ], [ 30, %18 ]
  %.not88 = icmp eq ptr %6, null
  br i1 %.not88, label %93, label %23

23:                                               ; preds = %22
  store i32 0, ptr %5, align 4, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  %24 = tail call i32 @TA_EMA_Lookback(i32 noundef %.077) #7
  %25 = mul nsw i32 %24, 3
  %spec.select = tail call i32 @llvm.smax.i32(i32 %25, i32 %0)
  %26 = icmp ugt i32 %spec.select, %1
  br i1 %26, label %93, label %27

27:                                               ; preds = %23
  %28 = add nuw i32 %1, 1
  %29 = add i32 %28, %25
  %30 = sub i32 %29, %spec.select
  %31 = sext i32 %30 to i64
  %32 = shl nsw i64 %31, 3
  %33 = tail call noalias ptr @malloc(i64 noundef %32) #8
  %.not89 = icmp eq ptr %33, null
  br i1 %.not89, label %93, label %34

34:                                               ; preds = %27
  %35 = add nuw nsw i32 %.077, 1
  %36 = uitofp nneg i32 %35 to double
  %37 = fdiv double 2.000000e+00, %36
  %38 = shl nsw i32 %24, 1
  %39 = sub nsw i32 %spec.select, %38
  %40 = call i32 @TA_S_INT_EMA(i32 noundef %39, i32 noundef %1, ptr noundef nonnull %2, i32 noundef %.077, double noundef %37, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %33) #7
  %41 = icmp ne i32 %40, 0
  %42 = load i32, ptr %9, align 4
  %43 = icmp eq i32 %42, 0
  %or.cond3 = select i1 %41, i1 true, i1 %43
  br i1 %or.cond3, label %44, label %45

44:                                               ; preds = %34
  call void @free(ptr noundef nonnull %33) #7
  br label %93

45:                                               ; preds = %34
  %46 = sext i32 %42 to i64
  %47 = shl nsw i64 %46, 3
  %48 = call noalias ptr @malloc(i64 noundef %47) #8
  %.not90 = icmp eq ptr %48, null
  br i1 %.not90, label %49, label %50

49:                                               ; preds = %45
  call void @free(ptr noundef nonnull %33) #7
  br label %93

50:                                               ; preds = %45
  %51 = add nsw i32 %42, -1
  %52 = call i32 @TA_INT_EMA(i32 noundef 0, i32 noundef %51, ptr noundef nonnull %33, i32 noundef %.077, double noundef %37, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %48) #7
  %53 = icmp ne i32 %52, 0
  %54 = load i32, ptr %11, align 4
  %55 = icmp eq i32 %54, 0
  %or.cond5 = select i1 %53, i1 true, i1 %55
  br i1 %or.cond5, label %56, label %57

56:                                               ; preds = %50
  call void @free(ptr noundef nonnull %33) #7
  call void @free(ptr noundef nonnull %48) #7
  br label %93

57:                                               ; preds = %50
  %58 = add nsw i32 %54, -1
  %59 = call i32 @TA_INT_EMA(i32 noundef 0, i32 noundef %58, ptr noundef nonnull %48, i32 noundef %.077, double noundef %37, ptr noundef nonnull %12, ptr noundef nonnull %13, ptr noundef nonnull %6) #7
  %60 = icmp ne i32 %59, 0
  %61 = load i32, ptr %13, align 4
  %62 = icmp eq i32 %61, 0
  %or.cond7 = select i1 %60, i1 true, i1 %62
  br i1 %or.cond7, label %63, label %64

63:                                               ; preds = %57
  call void @free(ptr noundef nonnull %33) #7
  call void @free(ptr noundef nonnull %48) #7
  br label %93

64:                                               ; preds = %57
  %65 = load i32, ptr %12, align 4, !tbaa !5
  %66 = load i32, ptr %10, align 4, !tbaa !5
  %67 = add i32 %66, %65
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = add nsw i32 %67, %68
  store i32 %69, ptr %4, align 4, !tbaa !5
  %70 = icmp sgt i32 %61, 0
  br i1 %70, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %64
  %71 = sext i32 %65 to i64
  %72 = sext i32 %67 to i64
  %wide.trip.count = zext nneg i32 %61 to i64
  %min.iters.check = icmp ult i32 %61, 4
  br i1 %min.iters.check, label %.lr.ph.preheader113, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  %ind.end = add nsw i64 %n.vec, %72
  %ind.end105 = add nsw i64 %n.vec, %71
  %invariant.gep = getelementptr double, ptr %33, i64 %72
  %invariant.gep114 = getelementptr double, ptr %48, i64 %71
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %gep = getelementptr double, ptr %invariant.gep, i64 %index
  %73 = getelementptr inbounds i8, ptr %gep, i64 16
  %wide.load = load <2 x double>, ptr %gep, align 8, !tbaa !9
  %wide.load108 = load <2 x double>, ptr %73, align 8, !tbaa !9
  %gep115 = getelementptr double, ptr %invariant.gep114, i64 %index
  %74 = getelementptr inbounds i8, ptr %gep115, i64 16
  %wide.load109 = load <2 x double>, ptr %gep115, align 8, !tbaa !9
  %wide.load110 = load <2 x double>, ptr %74, align 8, !tbaa !9
  %75 = fmul <2 x double> %wide.load109, <double -3.000000e+00, double -3.000000e+00>
  %76 = fmul <2 x double> %wide.load110, <double -3.000000e+00, double -3.000000e+00>
  %77 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %wide.load, <2 x double> <double 3.000000e+00, double 3.000000e+00>, <2 x double> %75)
  %78 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %wide.load108, <2 x double> <double 3.000000e+00, double 3.000000e+00>, <2 x double> %76)
  %79 = getelementptr inbounds double, ptr %6, i64 %index
  %80 = getelementptr inbounds i8, ptr %79, i64 16
  %wide.load111 = load <2 x double>, ptr %79, align 8, !tbaa !9
  %wide.load112 = load <2 x double>, ptr %80, align 8, !tbaa !9
  %81 = fadd <2 x double> %wide.load111, %77
  %82 = fadd <2 x double> %wide.load112, %78
  store <2 x double> %81, ptr %79, align 8, !tbaa !9
  store <2 x double> %82, ptr %80, align 8, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %83 = icmp eq i64 %index.next, %n.vec
  br i1 %83, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader113

.lr.ph.preheader113:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv97.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %indvars.iv95.ph = phi i64 [ %72, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  %indvars.iv.ph = phi i64 [ %71, %.lr.ph.preheader ], [ %ind.end105, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader113, %.lr.ph
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %.lr.ph ], [ %indvars.iv97.ph, %.lr.ph.preheader113 ]
  %indvars.iv95 = phi i64 [ %indvars.iv.next96, %.lr.ph ], [ %indvars.iv95.ph, %.lr.ph.preheader113 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader113 ]
  %indvars.iv.next96 = add nsw i64 %indvars.iv95, 1
  %84 = getelementptr inbounds double, ptr %33, i64 %indvars.iv95
  %85 = load double, ptr %84, align 8, !tbaa !9
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %86 = getelementptr inbounds double, ptr %48, i64 %indvars.iv
  %87 = load double, ptr %86, align 8, !tbaa !9
  %88 = fmul double %87, -3.000000e+00
  %89 = call double @llvm.fmuladd.f64(double %85, double 3.000000e+00, double %88)
  %90 = getelementptr inbounds double, ptr %6, i64 %indvars.iv97
  %91 = load double, ptr %90, align 8, !tbaa !9
  %92 = fadd double %91, %89
  store double %92, ptr %90, align 8, !tbaa !9
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next98, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %64
  %.076.lcssa = phi i32 [ 0, %64 ], [ %61, %middle.block ], [ %61, %.lr.ph ]
  call void @free(ptr noundef nonnull %33) #7
  call void @free(ptr noundef nonnull %48) #7
  store i32 %.076.lcssa, ptr %5, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %27, %23, %22, %20, %17, %15, %7, %._crit_edge, %63, %56, %49, %44
  %.074 = phi i32 [ %40, %44 ], [ %52, %56 ], [ %59, %63 ], [ 0, %._crit_edge ], [ 3, %49 ], [ 12, %7 ], [ 13, %15 ], [ 2, %17 ], [ 2, %20 ], [ 2, %22 ], [ 0, %23 ], [ 3, %27 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  ret i32 %.074
}

declare i32 @TA_S_INT_EMA(i32 noundef, i32 noundef, ptr noundef, i32 noundef, double noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass