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

; 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"

declare i32 @TA_MA_Lookback(i32 noundef, i32 noundef) #0

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

36:                                               ; preds = %10
  store i32 12, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

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

40:                                               ; preds = %37
  %41 = load i32, ptr %13, align 4, !tbaa !5
  %42 = load i32, ptr %12, align 4, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %40, %37
  store i32 13, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

45:                                               ; preds = %40
  %46 = load ptr, ptr %14, align 8, !tbaa !9
  %47 = icmp ne ptr %46, null
  br i1 %47, label %49, label %48

48:                                               ; preds = %45
  store i32 2, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

49:                                               ; preds = %45
  %50 = load ptr, ptr %15, align 8, !tbaa !9
  %51 = icmp ne ptr %50, null
  br i1 %51, label %53, label %52

52:                                               ; preds = %49
  store i32 2, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

53:                                               ; preds = %49
  %54 = load i32, ptr %16, align 4, !tbaa !5
  %55 = icmp eq i32 %54, -2147483648
  br i1 %55, label %56, label %57

56:                                               ; preds = %53
  store i32 2, ptr %16, align 4, !tbaa !5
  br label %65

57:                                               ; preds = %53
  %58 = load i32, ptr %16, align 4, !tbaa !5
  %59 = icmp slt i32 %58, 2
  br i1 %59, label %63, label %60

60:                                               ; preds = %57
  %61 = load i32, ptr %16, align 4, !tbaa !5
  %62 = icmp sgt i32 %61, 100000
  br i1 %62, label %63, label %64

63:                                               ; preds = %60, %57
  store i32 2, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

64:                                               ; preds = %60
  br label %65

65:                                               ; preds = %64, %56
  %66 = load i32, ptr %17, align 4, !tbaa !5
  %67 = icmp eq i32 %66, -2147483648
  br i1 %67, label %68, label %69

68:                                               ; preds = %65
  store i32 30, ptr %17, align 4, !tbaa !5
  br label %77

69:                                               ; preds = %65
  %70 = load i32, ptr %17, align 4, !tbaa !5
  %71 = icmp slt i32 %70, 2
  br i1 %71, label %75, label %72

72:                                               ; preds = %69
  %73 = load i32, ptr %17, align 4, !tbaa !5
  %74 = icmp sgt i32 %73, 100000
  br i1 %74, label %75, label %76

75:                                               ; preds = %72, %69
  store i32 2, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

76:                                               ; preds = %72
  br label %77

77:                                               ; preds = %76, %68
  %78 = load i32, ptr %18, align 4, !tbaa !5
  %79 = icmp eq i32 %78, -2147483648
  br i1 %79, label %80, label %81

80:                                               ; preds = %77
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %89

81:                                               ; preds = %77
  %82 = load i32, ptr %18, align 4, !tbaa !5
  %83 = icmp slt i32 %82, 0
  br i1 %83, label %87, label %84

84:                                               ; preds = %81
  %85 = load i32, ptr %18, align 4, !tbaa !5
  %86 = icmp sgt i32 %85, 8
  br i1 %86, label %87, label %88

87:                                               ; preds = %84, %81
  store i32 2, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

88:                                               ; preds = %84
  br label %89

89:                                               ; preds = %88, %80
  %90 = load ptr, ptr %21, align 8, !tbaa !9
  %91 = icmp ne ptr %90, null
  br i1 %91, label %93, label %92

92:                                               ; preds = %89
  store i32 2, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

93:                                               ; preds = %89
  %94 = load i32, ptr %17, align 4, !tbaa !5
  %95 = load i32, ptr %18, align 4, !tbaa !5
  %96 = call i32 @TA_MA_Lookback(i32 noundef %94, i32 noundef %95)
  store i32 %96, ptr %24, align 4, !tbaa !5
  %97 = load i32, ptr %12, align 4, !tbaa !5
  %98 = load i32, ptr %24, align 4, !tbaa !5
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %100, label %102

100:                                              ; preds = %93
  %101 = load i32, ptr %24, align 4, !tbaa !5
  store i32 %101, ptr %12, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %100, %93
  %103 = load i32, ptr %12, align 4, !tbaa !5
  %104 = load i32, ptr %13, align 4, !tbaa !5
  %105 = icmp sgt i32 %103, %104
  br i1 %105, label %106, label %109

106:                                              ; preds = %102
  %107 = load ptr, ptr %19, align 8, !tbaa !9
  store i32 0, ptr %107, align 4, !tbaa !5
  %108 = load ptr, ptr %20, align 8, !tbaa !9
  store i32 0, ptr %108, align 4, !tbaa !5
  store i32 0, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

109:                                              ; preds = %102
  %110 = load i32, ptr %24, align 4, !tbaa !5
  %111 = load i32, ptr %12, align 4, !tbaa !5
  %112 = icmp sgt i32 %110, %111
  br i1 %112, label %113, label %115

113:                                              ; preds = %109
  %114 = load i32, ptr %24, align 4, !tbaa !5
  store i32 %114, ptr %26, align 4, !tbaa !5
  br label %117

115:                                              ; preds = %109
  %116 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %116, ptr %26, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %115, %113
  %118 = load i32, ptr %26, align 4, !tbaa !5
  %119 = load i32, ptr %13, align 4, !tbaa !5
  %120 = icmp sgt i32 %118, %119
  br i1 %120, label %121, label %124

121:                                              ; preds = %117
  %122 = load ptr, ptr %19, align 8, !tbaa !9
  store i32 0, ptr %122, align 4, !tbaa !5
  %123 = load ptr, ptr %20, align 8, !tbaa !9
  store i32 0, ptr %123, align 4, !tbaa !5
  store i32 0, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

124:                                              ; preds = %117
  %125 = load i32, ptr %13, align 4, !tbaa !5
  %126 = load i32, ptr %26, align 4, !tbaa !5
  %127 = sub nsw i32 %125, %126
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %25, align 4, !tbaa !5
  %129 = load i32, ptr %25, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = mul i64 8, %130
  %132 = call noalias ptr @malloc(i64 noundef %131) #6
  store ptr %132, ptr %29, align 8, !tbaa !9
  %133 = load i32, ptr %25, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = mul i64 4, %134
  %136 = call noalias ptr @malloc(i64 noundef %135) #6
  store ptr %136, ptr %28, align 8, !tbaa !9
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %168, %124
  %138 = load i32, ptr %22, align 4, !tbaa !5
  %139 = load i32, ptr %25, align 4, !tbaa !5
  %140 = icmp slt i32 %138, %139
  br i1 %140, label %141, label %171

141:                                              ; preds = %137
  %142 = load ptr, ptr %15, align 8, !tbaa !9
  %143 = load i32, ptr %12, align 4, !tbaa !5
  %144 = load i32, ptr %22, align 4, !tbaa !5
  %145 = add nsw i32 %143, %144
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds double, ptr %142, i64 %146
  %148 = load double, ptr %147, align 8, !tbaa !11
  %149 = fptosi double %148 to i32
  store i32 %149, ptr %26, align 4, !tbaa !5
  %150 = load i32, ptr %26, align 4, !tbaa !5
  %151 = load i32, ptr %16, align 4, !tbaa !5
  %152 = icmp slt i32 %150, %151
  br i1 %152, label %153, label %155

153:                                              ; preds = %141
  %154 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %154, ptr %26, align 4, !tbaa !5
  br label %162

155:                                              ; preds = %141
  %156 = load i32, ptr %26, align 4, !tbaa !5
  %157 = load i32, ptr %17, align 4, !tbaa !5
  %158 = icmp sgt i32 %156, %157
  br i1 %158, label %159, label %161

159:                                              ; preds = %155
  %160 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %160, ptr %26, align 4, !tbaa !5
  br label %161

161:                                              ; preds = %159, %155
  br label %162

162:                                              ; preds = %161, %153
  %163 = load i32, ptr %26, align 4, !tbaa !5
  %164 = load ptr, ptr %28, align 8, !tbaa !9
  %165 = load i32, ptr %22, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds i32, ptr %164, i64 %166
  store i32 %163, ptr %167, align 4, !tbaa !5
  br label %168

168:                                              ; preds = %162
  %169 = load i32, ptr %22, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %22, align 4, !tbaa !5
  br label %137, !llvm.loop !13

171:                                              ; preds = %137
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %172

172:                                              ; preds = %244, %171
  %173 = load i32, ptr %22, align 4, !tbaa !5
  %174 = load i32, ptr %25, align 4, !tbaa !5
  %175 = icmp slt i32 %173, %174
  br i1 %175, label %176, label %247

176:                                              ; preds = %172
  %177 = load ptr, ptr %28, align 8, !tbaa !9
  %178 = load i32, ptr %22, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds i32, ptr %177, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  store i32 %181, ptr %27, align 4, !tbaa !5
  %182 = load i32, ptr %27, align 4, !tbaa !5
  %183 = icmp ne i32 %182, 0
  br i1 %183, label %184, label %243

184:                                              ; preds = %176
  %185 = load i32, ptr %12, align 4, !tbaa !5
  %186 = load i32, ptr %13, align 4, !tbaa !5
  %187 = load ptr, ptr %14, align 8, !tbaa !9
  %188 = load i32, ptr %27, align 4, !tbaa !5
  %189 = load i32, ptr %18, align 4, !tbaa !5
  %190 = load ptr, ptr %29, align 8, !tbaa !9
  %191 = call i32 @TA_MA(i32 noundef %185, i32 noundef %186, ptr noundef %187, i32 noundef %188, i32 noundef %189, ptr noundef %30, ptr noundef %31, ptr noundef %190)
  store i32 %191, ptr %32, align 4, !tbaa !5
  %192 = load i32, ptr %32, align 4, !tbaa !5
  %193 = icmp ne i32 %192, 0
  br i1 %193, label %194, label %200

194:                                              ; preds = %184
  %195 = load ptr, ptr %29, align 8, !tbaa !9
  call void @free(ptr noundef %195) #5
  %196 = load ptr, ptr %28, align 8, !tbaa !9
  call void @free(ptr noundef %196) #5
  %197 = load ptr, ptr %19, align 8, !tbaa !9
  store i32 0, ptr %197, align 4, !tbaa !5
  %198 = load ptr, ptr %20, align 8, !tbaa !9
  store i32 0, ptr %198, align 4, !tbaa !5
  %199 = load i32, ptr %32, align 4, !tbaa !5
  store i32 %199, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

200:                                              ; preds = %184
  %201 = load ptr, ptr %29, align 8, !tbaa !9
  %202 = load i32, ptr %22, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds double, ptr %201, i64 %203
  %205 = load double, ptr %204, align 8, !tbaa !11
  %206 = load ptr, ptr %21, align 8, !tbaa !9
  %207 = load i32, ptr %22, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds double, ptr %206, i64 %208
  store double %205, ptr %209, align 8, !tbaa !11
  %210 = load i32, ptr %22, align 4, !tbaa !5
  %211 = add nsw i32 %210, 1
  store i32 %211, ptr %23, align 4, !tbaa !5
  br label %212

212:                                              ; preds = %239, %200
  %213 = load i32, ptr %23, align 4, !tbaa !5
  %214 = load i32, ptr %25, align 4, !tbaa !5
  %215 = icmp slt i32 %213, %214
  br i1 %215, label %216, label %242

216:                                              ; preds = %212
  %217 = load ptr, ptr %28, align 8, !tbaa !9
  %218 = load i32, ptr %23, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds i32, ptr %217, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !5
  %222 = load i32, ptr %27, align 4, !tbaa !5
  %223 = icmp eq i32 %221, %222
  br i1 %223, label %224, label %238

224:                                              ; preds = %216
  %225 = load ptr, ptr %28, align 8, !tbaa !9
  %226 = load i32, ptr %23, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds i32, ptr %225, i64 %227
  store i32 0, ptr %228, align 4, !tbaa !5
  %229 = load ptr, ptr %29, align 8, !tbaa !9
  %230 = load i32, ptr %23, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds double, ptr %229, i64 %231
  %233 = load double, ptr %232, align 8, !tbaa !11
  %234 = load ptr, ptr %21, align 8, !tbaa !9
  %235 = load i32, ptr %23, align 4, !tbaa !5
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds double, ptr %234, i64 %236
  store double %233, ptr %237, align 8, !tbaa !11
  br label %238

238:                                              ; preds = %224, %216
  br label %239

239:                                              ; preds = %238
  %240 = load i32, ptr %23, align 4, !tbaa !5
  %241 = add nsw i32 %240, 1
  store i32 %241, ptr %23, align 4, !tbaa !5
  br label %212, !llvm.loop !15

242:                                              ; preds = %212
  br label %243

243:                                              ; preds = %242, %176
  br label %244

244:                                              ; preds = %243
  %245 = load i32, ptr %22, align 4, !tbaa !5
  %246 = add nsw i32 %245, 1
  store i32 %246, ptr %22, align 4, !tbaa !5
  br label %172, !llvm.loop !16

247:                                              ; preds = %172
  %248 = load ptr, ptr %29, align 8, !tbaa !9
  call void @free(ptr noundef %248) #5
  %249 = load ptr, ptr %28, align 8, !tbaa !9
  call void @free(ptr noundef %249) #5
  %250 = load i32, ptr %12, align 4, !tbaa !5
  %251 = load ptr, ptr %19, align 8, !tbaa !9
  store i32 %250, ptr %251, align 4, !tbaa !5
  %252 = load i32, ptr %25, align 4, !tbaa !5
  %253 = load ptr, ptr %20, align 8, !tbaa !9
  store i32 %252, ptr %253, align 4, !tbaa !5
  store i32 0, ptr %11, align 4
  store i32 1, ptr %33, align 4
  br label %254

254:                                              ; preds = %247, %194, %121, %106, %92, %87, %75, %63, %52, %48, %44, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  %255 = load i32, ptr %11, align 4
  ret i32 %255
}

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

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

declare i32 @TA_MA(i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #0

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

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

attributes #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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { 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"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; 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"

declare i32 @TA_MA_Lookback(i32 noundef, i32 noundef) local_unnamed_addr #0

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

14:                                               ; preds = %10
  %15 = icmp slt i32 %1, %0
  br i1 %15, label %83, label %16

16:                                               ; preds = %14
  %.not = icmp eq ptr %2, null
  %.not120 = icmp eq ptr %3, null
  %or.cond128 = or i1 %.not, %.not120
  br i1 %or.cond128, label %83, label %17

17:                                               ; preds = %16
  %18 = icmp eq i32 %4, -2147483648
  br i1 %18, label %21, label %19

19:                                               ; preds = %17
  %20 = add i32 %4, -100001
  %or.cond = icmp ult i32 %20, -99999
  br i1 %or.cond, label %83, label %21

21:                                               ; preds = %17, %19
  %.099 = phi i32 [ %4, %19 ], [ 2, %17 ]
  %22 = icmp eq i32 %5, -2147483648
  br i1 %22, label %25, label %23

23:                                               ; preds = %21
  %24 = add i32 %5, -100001
  %or.cond3 = icmp ult i32 %24, -99999
  br i1 %or.cond3, label %83, label %25

25:                                               ; preds = %21, %23
  %.0100 = phi i32 [ %5, %23 ], [ 30, %21 ]
  %26 = icmp eq i32 %6, -2147483648
  br i1 %26, label %28, label %27

27:                                               ; preds = %25
  %or.cond5 = icmp ugt i32 %6, 8
  br i1 %or.cond5, label %83, label %28

28:                                               ; preds = %25, %27
  %.0102 = phi i32 [ %6, %27 ], [ 0, %25 ]
  %.not121 = icmp eq ptr %9, null
  br i1 %.not121, label %83, label %29

29:                                               ; preds = %28
  %30 = tail call i32 @TA_MA_Lookback(i32 noundef %.0100, i32 noundef %.0102) #6
  %spec.select = tail call i32 @llvm.smax.i32(i32 %30, i32 %0)
  %31 = icmp ugt i32 %spec.select, %1
  br i1 %31, label %.sink.split, label %32

32:                                               ; preds = %29
  %33 = sub nsw i32 %1, %spec.select
  %34 = add nsw i32 %33, 1
  %35 = sext i32 %34 to i64
  %36 = shl nsw i64 %35, 3
  %37 = tail call noalias ptr @malloc(i64 noundef %36) #7
  %38 = shl nsw i64 %35, 2
  %39 = tail call noalias ptr @malloc(i64 noundef %38) #7
  %.not122129 = icmp slt i32 %33, 0
  br i1 %.not122129, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %32
  %40 = zext nneg i32 %spec.select to i64
  %41 = add nuw i32 %1, 1
  %42 = sub i32 %41, %spec.select
  %wide.trip.count = zext i32 %42 to i64
  %invariant.gep = getelementptr inbounds double, ptr %3, i64 %40
  %min.iters.check = icmp ult i32 %42, 4
  br i1 %min.iters.check, label %.lr.ph.preheader149, label %vector.ph

.lr.ph.preheader149:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 4294967292
  %broadcast.splatinsert = insertelement <2 x i32> poison, i32 %.099, i64 0
  %broadcast.splat = shufflevector <2 x i32> %broadcast.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert147 = insertelement <2 x i32> poison, i32 %.0100, i64 0
  %broadcast.splat148 = shufflevector <2 x i32> %broadcast.splatinsert147, <2 x i32> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %43 = getelementptr inbounds double, ptr %invariant.gep, i64 %index
  %44 = getelementptr inbounds i8, ptr %43, i64 16
  %wide.load = load <2 x double>, ptr %43, align 8, !tbaa !5
  %wide.load146 = load <2 x double>, ptr %44, align 8, !tbaa !5
  %45 = fptosi <2 x double> %wide.load to <2 x i32>
  %46 = fptosi <2 x double> %wide.load146 to <2 x i32>
  %47 = icmp sgt <2 x i32> %broadcast.splat, %45
  %48 = icmp sgt <2 x i32> %broadcast.splat, %46
  %49 = tail call <2 x i32> @llvm.smin.v2i32(<2 x i32> %broadcast.splat148, <2 x i32> %45)
  %50 = tail call <2 x i32> @llvm.smin.v2i32(<2 x i32> %broadcast.splat148, <2 x i32> %46)
  %51 = select <2 x i1> %47, <2 x i32> %broadcast.splat, <2 x i32> %49
  %52 = select <2 x i1> %48, <2 x i32> %broadcast.splat, <2 x i32> %50
  %53 = getelementptr inbounds i32, ptr %39, i64 %index
  %54 = getelementptr inbounds i8, ptr %53, i64 8
  store <2 x i32> %51, ptr %53, align 4, !tbaa !9
  store <2 x i32> %52, ptr %54, align 4, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %55 = icmp eq i64 %index.next, %n.vec
  br i1 %55, 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 %.preheader, label %.lr.ph.preheader149

.preheader:                                       ; preds = %.lr.ph, %middle.block
  br i1 %.not122129, label %._crit_edge, label %.lr.ph136.preheader

.lr.ph136.preheader:                              ; preds = %.preheader
  %56 = zext nneg i32 %33 to i64
  %57 = add i32 %1, 1
  %58 = sub i32 %57, %spec.select
  %wide.trip.count144 = zext i32 %58 to i64
  br label %.lr.ph136

.lr.ph:                                           ; preds = %.lr.ph.preheader149, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader149 ]
  %gep = getelementptr inbounds double, ptr %invariant.gep, i64 %indvars.iv
  %59 = load double, ptr %gep, align 8, !tbaa !5
  %60 = fptosi double %59 to i32
  %61 = icmp sgt i32 %.099, %60
  %spec.select127 = tail call i32 @llvm.smin.i32(i32 %.0100, i32 %60)
  %.1 = select i1 %61, i32 %.099, i32 %spec.select127
  %62 = getelementptr inbounds i32, ptr %39, i64 %indvars.iv
  store i32 %.1, ptr %62, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph, !llvm.loop !15

.lr.ph136:                                        ; preds = %.lr.ph136.preheader, %.loopexit
  %indvars.iv138 = phi i64 [ 0, %.lr.ph136.preheader ], [ %indvars.iv.next139, %.loopexit ]
  %63 = getelementptr inbounds i32, ptr %39, i64 %indvars.iv138
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %.not124 = icmp eq i32 %64, 0
  br i1 %.not124, label %.loopexit, label %65

65:                                               ; preds = %.lr.ph136
  %66 = call i32 @TA_MA(i32 noundef %spec.select, i32 noundef %1, ptr noundef nonnull %2, i32 noundef %64, i32 noundef %.0102, ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef %37) #6
  %.not125 = icmp eq i32 %66, 0
  br i1 %.not125, label %68, label %67

67:                                               ; preds = %65
  call void @free(ptr noundef %37) #6
  call void @free(ptr noundef nonnull %39) #6
  br label %.sink.split

68:                                               ; preds = %65
  %69 = getelementptr inbounds double, ptr %37, i64 %indvars.iv138
  %70 = load double, ptr %69, align 8, !tbaa !5
  %71 = getelementptr inbounds double, ptr %9, i64 %indvars.iv138
  store double %70, ptr %71, align 8, !tbaa !5
  %72 = icmp ult i64 %indvars.iv138, %56
  br i1 %72, label %.lr.ph133, label %.loopexit

.lr.ph133:                                        ; preds = %68, %80
  %indvars.iv140 = phi i64 [ %indvars.iv.next141, %80 ], [ %indvars.iv138, %68 ]
  %indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
  %73 = getelementptr inbounds i32, ptr %39, i64 %indvars.iv.next141
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = icmp eq i32 %74, %64
  br i1 %75, label %76, label %80

76:                                               ; preds = %.lr.ph133
  store i32 0, ptr %73, align 4, !tbaa !9
  %77 = getelementptr inbounds double, ptr %37, i64 %indvars.iv.next141
  %78 = load double, ptr %77, align 8, !tbaa !5
  %79 = getelementptr inbounds double, ptr %9, i64 %indvars.iv.next141
  store double %78, ptr %79, align 8, !tbaa !5
  br label %80

80:                                               ; preds = %.lr.ph133, %76
  %81 = trunc nuw i64 %indvars.iv.next141 to i32
  %82 = icmp sgt i32 %33, %81
  br i1 %82, label %.lr.ph133, label %.loopexit, !llvm.loop !16

.loopexit:                                        ; preds = %80, %68, %.lr.ph136
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %exitcond145.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count144
  br i1 %exitcond145.not, label %._crit_edge, label %.lr.ph136, !llvm.loop !17

._crit_edge:                                      ; preds = %.loopexit, %32, %.preheader
  call void @free(ptr noundef %37) #6
  call void @free(ptr noundef %39) #6
  br label %.sink.split

.sink.split:                                      ; preds = %29, %67, %._crit_edge
  %spec.select.sink = phi i32 [ %spec.select, %._crit_edge ], [ 0, %67 ], [ 0, %29 ]
  %.sink = phi i32 [ %34, %._crit_edge ], [ 0, %67 ], [ 0, %29 ]
  %.0.ph = phi i32 [ 0, %._crit_edge ], [ %66, %67 ], [ 0, %29 ]
  store i32 %spec.select.sink, ptr %7, align 4, !tbaa !9
  store i32 %.sink, ptr %8, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %.sink.split, %28, %27, %23, %19, %16, %14, %10
  %.0 = phi i32 [ 12, %10 ], [ 13, %14 ], [ 2, %16 ], [ 2, %19 ], [ 2, %23 ], [ 2, %27 ], [ 2, %28 ], [ %.0.ph, %.sink.split ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  ret i32 %.0
}

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

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

declare i32 @TA_MA(i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.smin.v2i32(<2 x i32>, <2 x i32>) #5

attributes #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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !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}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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