; LLVM IR from GCY/wxECGAnalyzer :: src/MAC/HC_Chen_detect.ll (Z14HC_Chen_detectf)

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

@_ZL8ecg_buff = external hidden global [10 x float], align 16
@_ZL15ecg_buff_WR_idx = external hidden global i32, align 4
@_ZL6sample = external hidden global i32, align 4
@_ZL11number_iter = external hidden global i32, align 4
@_ZL15ecg_buff_RD_idx = external hidden global i32, align 4
@_ZL6hp_sum = external hidden global float, align 4
@_ZL7hp_buff = external hidden global [55 x float], align 16
@_ZL14hp_buff_WR_idx = external hidden global i32, align 4
@_ZL14hp_buff_RD_idx = external hidden global i32, align 4
@_ZL6lp_sum = external hidden global float, align 4
@_ZL12next_eval_pt = external hidden global float, align 4
@_ZL8treshold = external hidden global float, align 4
@_ZL9triggered = external hidden global i8, align 1
@_ZL9trig_time = external hidden global i32, align 4
@_ZL10DELAY_TIME = external hidden global i32, align 4
@_ZL7win_max = external hidden global float, align 4
@_ZL14last_qrs_point = external hidden global i32, align 4
@_ZL7win_idx = external hidden global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z14HC_Chen_detectf(float noundef %0) #0 {
  %2 = alloca i1, align 1
  %3 = alloca float, align 4
  %4 = alloca i32, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  store float %0, ptr %3, align 4, !tbaa !5
  %10 = load float, ptr %3, align 4, !tbaa !5
  %11 = load i32, ptr @_ZL15ecg_buff_WR_idx, align 4, !tbaa !9
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr @_ZL15ecg_buff_WR_idx, align 4, !tbaa !9
  %13 = sext i32 %11 to i64
  %14 = getelementptr inbounds [10 x float], ptr @_ZL8ecg_buff, i64 0, i64 %13
  store float %10, ptr %14, align 4, !tbaa !5
  %15 = load i32, ptr @_ZL15ecg_buff_WR_idx, align 4, !tbaa !9
  store i32 %15, ptr @_ZL6sample, align 4, !tbaa !9
  %16 = load i32, ptr @_ZL15ecg_buff_WR_idx, align 4, !tbaa !9
  %17 = urem i32 %16, 10
  store i32 %17, ptr @_ZL15ecg_buff_WR_idx, align 4, !tbaa !9
  %18 = load i32, ptr @_ZL11number_iter, align 4, !tbaa !9
  %19 = icmp ult i32 %18, 9
  br i1 %19, label %20, label %30

20:                                               ; preds = %1
  %21 = load i32, ptr @_ZL15ecg_buff_RD_idx, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [10 x float], ptr @_ZL8ecg_buff, i64 0, i64 %22
  %24 = load float, ptr %23, align 4, !tbaa !5
  %25 = load float, ptr @_ZL6hp_sum, align 4, !tbaa !5
  %26 = fadd float %25, %24
  store float %26, ptr @_ZL6hp_sum, align 4, !tbaa !5
  %27 = load i32, ptr @_ZL14hp_buff_WR_idx, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [55 x float], ptr @_ZL7hp_buff, i64 0, i64 %28
  store float 0.000000e+00, ptr %29, align 4, !tbaa !5
  br label %71

30:                                               ; preds = %1
  %31 = load i32, ptr @_ZL15ecg_buff_RD_idx, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [10 x float], ptr @_ZL8ecg_buff, i64 0, i64 %32
  %34 = load float, ptr %33, align 4, !tbaa !5
  %35 = load float, ptr @_ZL6hp_sum, align 4, !tbaa !5
  %36 = fadd float %35, %34
  store float %36, ptr @_ZL6hp_sum, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %37 = load i32, ptr @_ZL15ecg_buff_RD_idx, align 4, !tbaa !9
  %38 = sub i32 %37, 9
  store i32 %38, ptr %4, align 4, !tbaa !9
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = icmp slt i32 %39, 0
  br i1 %40, label %41, label %44

41:                                               ; preds = %30
  %42 = load i32, ptr %4, align 4, !tbaa !9
  %43 = add i32 %42, 10
  store i32 %43, ptr %4, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %41, %30
  %45 = load i32, ptr %4, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [10 x float], ptr @_ZL8ecg_buff, i64 0, i64 %46
  %48 = load float, ptr %47, align 4, !tbaa !5
  %49 = load float, ptr @_ZL6hp_sum, align 4, !tbaa !5
  %50 = fsub float %49, %48
  store float %50, ptr @_ZL6hp_sum, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store float 0.000000e+00, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store float 0.000000e+00, ptr %6, align 4, !tbaa !5
  %51 = load i32, ptr @_ZL15ecg_buff_RD_idx, align 4, !tbaa !9
  %52 = sub i32 %51, 5
  store i32 %52, ptr %4, align 4, !tbaa !9
  %53 = load i32, ptr %4, align 4, !tbaa !9
  %54 = icmp slt i32 %53, 0
  br i1 %54, label %55, label %58

55:                                               ; preds = %44
  %56 = load i32, ptr %4, align 4, !tbaa !9
  %57 = add i32 %56, 10
  store i32 %57, ptr %4, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %55, %44
  %59 = load i32, ptr %4, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [10 x float], ptr @_ZL8ecg_buff, i64 0, i64 %60
  %62 = load float, ptr %61, align 4, !tbaa !5
  store float %62, ptr %6, align 4, !tbaa !5
  %63 = load float, ptr @_ZL6hp_sum, align 4, !tbaa !5
  %64 = fmul float 0x3FBC71C720000000, %63
  store float %64, ptr %5, align 4, !tbaa !5
  %65 = load float, ptr %6, align 4, !tbaa !5
  %66 = load float, ptr %5, align 4, !tbaa !5
  %67 = fsub float %65, %66
  %68 = load i32, ptr @_ZL14hp_buff_WR_idx, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [55 x float], ptr @_ZL7hp_buff, i64 0, i64 %69
  store float %67, ptr %70, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %71

71:                                               ; preds = %58, %20
  %72 = load i32, ptr @_ZL15ecg_buff_RD_idx, align 4, !tbaa !9
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr @_ZL15ecg_buff_RD_idx, align 4, !tbaa !9
  %74 = load i32, ptr @_ZL15ecg_buff_RD_idx, align 4, !tbaa !9
  %75 = urem i32 %74, 10
  store i32 %75, ptr @_ZL15ecg_buff_RD_idx, align 4, !tbaa !9
  %76 = load i32, ptr @_ZL14hp_buff_WR_idx, align 4, !tbaa !9
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr @_ZL14hp_buff_WR_idx, align 4, !tbaa !9
  %78 = load i32, ptr @_ZL14hp_buff_WR_idx, align 4, !tbaa !9
  %79 = urem i32 %78, 55
  store i32 %79, ptr @_ZL14hp_buff_WR_idx, align 4, !tbaa !9
  %80 = load i32, ptr @_ZL14hp_buff_RD_idx, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [55 x float], ptr @_ZL7hp_buff, i64 0, i64 %81
  %83 = load float, ptr %82, align 4, !tbaa !5
  %84 = load i32, ptr @_ZL14hp_buff_RD_idx, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [55 x float], ptr @_ZL7hp_buff, i64 0, i64 %85
  %87 = load float, ptr %86, align 4, !tbaa !5
  %88 = load float, ptr @_ZL6lp_sum, align 4, !tbaa !5
  %89 = call float @llvm.fmuladd.f32(float %83, float %87, float %88)
  store float %89, ptr @_ZL6lp_sum, align 4, !tbaa !5
  %90 = load i32, ptr @_ZL11number_iter, align 4, !tbaa !9
  %91 = icmp ult i32 %90, 54
  br i1 %91, label %92, label %93

92:                                               ; preds = %71
  store float 0.000000e+00, ptr @_ZL12next_eval_pt, align 4, !tbaa !5
  br label %114

93:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %94 = load i32, ptr @_ZL14hp_buff_RD_idx, align 4, !tbaa !9
  %95 = sub i32 %94, 54
  store i32 %95, ptr %7, align 4, !tbaa !9
  %96 = load i32, ptr %7, align 4, !tbaa !9
  %97 = icmp slt i32 %96, 0
  br i1 %97, label %98, label %101

98:                                               ; preds = %93
  %99 = load i32, ptr %7, align 4, !tbaa !9
  %100 = add i32 %99, 55
  store i32 %100, ptr %7, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %98, %93
  %102 = load i32, ptr %7, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [55 x float], ptr @_ZL7hp_buff, i64 0, i64 %103
  %105 = load float, ptr %104, align 4, !tbaa !5
  %106 = load i32, ptr %7, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [55 x float], ptr @_ZL7hp_buff, i64 0, i64 %107
  %109 = load float, ptr %108, align 4, !tbaa !5
  %110 = load float, ptr @_ZL6lp_sum, align 4, !tbaa !5
  %111 = fneg float %105
  %112 = call float @llvm.fmuladd.f32(float %111, float %109, float %110)
  store float %112, ptr @_ZL6lp_sum, align 4, !tbaa !5
  %113 = load float, ptr @_ZL6lp_sum, align 4, !tbaa !5
  store float %113, ptr @_ZL12next_eval_pt, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %114

114:                                              ; preds = %101, %92
  %115 = load i32, ptr @_ZL14hp_buff_RD_idx, align 4, !tbaa !9
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr @_ZL14hp_buff_RD_idx, align 4, !tbaa !9
  %117 = load i32, ptr @_ZL14hp_buff_RD_idx, align 4, !tbaa !9
  %118 = urem i32 %117, 55
  store i32 %118, ptr @_ZL14hp_buff_RD_idx, align 4, !tbaa !9
  %119 = load i32, ptr @_ZL11number_iter, align 4, !tbaa !9
  %120 = icmp ult i32 %119, 360
  br i1 %120, label %121, label %130

121:                                              ; preds = %114
  %122 = load float, ptr @_ZL12next_eval_pt, align 4, !tbaa !5
  %123 = load float, ptr @_ZL8treshold, align 4, !tbaa !5
  %124 = fcmp ogt float %122, %123
  br i1 %124, label %125, label %127

125:                                              ; preds = %121
  %126 = load float, ptr @_ZL12next_eval_pt, align 4, !tbaa !5
  store float %126, ptr @_ZL8treshold, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %125, %121
  %128 = load i32, ptr @_ZL11number_iter, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr @_ZL11number_iter, align 4, !tbaa !9
  br label %130

130:                                              ; preds = %127, %114
  %131 = load i8, ptr @_ZL9triggered, align 1, !tbaa !11, !range !13, !noundef !14
  %132 = trunc i8 %131 to i1
  br i1 %132, label %133, label %141

133:                                              ; preds = %130
  %134 = load i32, ptr @_ZL9trig_time, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr @_ZL9trig_time, align 4, !tbaa !9
  %136 = load i32, ptr @_ZL9trig_time, align 4, !tbaa !9
  %137 = load i32, ptr @_ZL10DELAY_TIME, align 4, !tbaa !9
  %138 = icmp sge i32 %136, %137
  br i1 %138, label %139, label %140

139:                                              ; preds = %133
  store i8 0, ptr @_ZL9triggered, align 1, !tbaa !11
  store i32 0, ptr @_ZL9trig_time, align 4, !tbaa !9
  br label %140

140:                                              ; preds = %139, %133
  br label %141

141:                                              ; preds = %140, %130
  %142 = load float, ptr @_ZL12next_eval_pt, align 4, !tbaa !5
  %143 = load float, ptr @_ZL7win_max, align 4, !tbaa !5
  %144 = fcmp ogt float %142, %143
  br i1 %144, label %145, label %147

145:                                              ; preds = %141
  %146 = load float, ptr @_ZL12next_eval_pt, align 4, !tbaa !5
  store float %146, ptr @_ZL7win_max, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %145, %141
  %148 = load float, ptr @_ZL12next_eval_pt, align 4, !tbaa !5
  %149 = load float, ptr @_ZL8treshold, align 4, !tbaa !5
  %150 = fcmp ogt float %148, %149
  br i1 %150, label %151, label %156

151:                                              ; preds = %147
  %152 = load i8, ptr @_ZL9triggered, align 1, !tbaa !11, !range !13, !noundef !14
  %153 = trunc i8 %152 to i1
  br i1 %153, label %156, label %154

154:                                              ; preds = %151
  %155 = load i32, ptr @_ZL6sample, align 4, !tbaa !9
  store i32 %155, ptr @_ZL14last_qrs_point, align 4, !tbaa !9
  store i8 1, ptr @_ZL9triggered, align 1, !tbaa !11
  store i1 true, ptr %2, align 1
  br label %176

156:                                              ; preds = %151, %147
  br label %157

157:                                              ; preds = %156
  %158 = load i32, ptr @_ZL7win_idx, align 4, !tbaa !9
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr @_ZL7win_idx, align 4, !tbaa !9
  %160 = icmp uge i32 %158, 360
  br i1 %160, label %161, label %175

161:                                              ; preds = %157
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store float 0x3FC6666680000000, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %162 = call i32 @rand() #4
  %163 = sitofp i32 %162 to float
  %164 = fdiv float %163, 0x41E0000000000000
  %165 = call float @llvm.fmuladd.f32(float %164, float 0x3FB70A3D80000000, float 0x3F847AE140000000)
  store float %165, ptr %9, align 4, !tbaa !5
  %166 = load float, ptr %9, align 4, !tbaa !5
  %167 = load float, ptr %8, align 4, !tbaa !5
  %168 = fmul float %166, %167
  %169 = load float, ptr @_ZL7win_max, align 4, !tbaa !5
  %170 = load float, ptr %9, align 4, !tbaa !5
  %171 = fsub float 1.000000e+00, %170
  %172 = load float, ptr @_ZL8treshold, align 4, !tbaa !5
  %173 = fmul float %171, %172
  %174 = call float @llvm.fmuladd.f32(float %168, float %169, float %173)
  store float %174, ptr @_ZL8treshold, align 4, !tbaa !5
  store i32 0, ptr @_ZL7win_idx, align 4, !tbaa !9
  store float -1.000000e+07, ptr @_ZL7win_max, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %175

175:                                              ; preds = %161, %157
  store i1 false, ptr %2, align 1
  br label %176

176:                                              ; preds = %175, %154
  %177 = load i1, ptr %2, align 1
  ret i1 %177
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind
declare i32 @rand() #3

attributes #0 = { mustprogress 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { nounwind }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!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"

@_ZL8ecg_buff = external hidden local_unnamed_addr global [10 x float], align 16
@_ZL15ecg_buff_WR_idx = external hidden local_unnamed_addr global i32, align 4
@_ZL6sample = external hidden local_unnamed_addr global i32, align 4
@_ZL11number_iter = external hidden local_unnamed_addr global i32, align 4
@_ZL15ecg_buff_RD_idx = external hidden local_unnamed_addr global i32, align 4
@_ZL6hp_sum = external hidden local_unnamed_addr global float, align 4
@_ZL7hp_buff = external hidden local_unnamed_addr global [55 x float], align 16
@_ZL14hp_buff_WR_idx = external hidden local_unnamed_addr global i32, align 4
@_ZL14hp_buff_RD_idx = external hidden local_unnamed_addr global i32, align 4
@_ZL6lp_sum = external hidden local_unnamed_addr global float, align 4
@_ZL12next_eval_pt = external hidden local_unnamed_addr global float, align 4
@_ZL8treshold = external hidden local_unnamed_addr global float, align 4
@_ZL9triggered = external hidden local_unnamed_addr global i8, align 1
@_ZL9trig_time = external hidden local_unnamed_addr global i32, align 4
@_ZL10DELAY_TIME = external hidden local_unnamed_addr global i32, align 4
@_ZL7win_max = external hidden local_unnamed_addr global float, align 4
@_ZL14last_qrs_point = external hidden local_unnamed_addr global i32, align 4
@_ZL7win_idx = external hidden local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z14HC_Chen_detectf(float noundef %0) local_unnamed_addr #0 {
  %2 = load i32, ptr @_ZL15ecg_buff_WR_idx, align 4, !tbaa !5
  %3 = add nsw i32 %2, 1
  %4 = sext i32 %2 to i64
  %5 = getelementptr inbounds [10 x float], ptr @_ZL8ecg_buff, i64 0, i64 %4
  store float %0, ptr %5, align 4, !tbaa !9
  store i32 %3, ptr @_ZL6sample, align 4, !tbaa !5
  %6 = urem i32 %3, 10
  store i32 %6, ptr @_ZL15ecg_buff_WR_idx, align 4, !tbaa !5
  %7 = load i32, ptr @_ZL11number_iter, align 4, !tbaa !5
  %8 = icmp ult i32 %7, 9
  %9 = load i32, ptr @_ZL15ecg_buff_RD_idx, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [10 x float], ptr @_ZL8ecg_buff, i64 0, i64 %10
  %12 = load float, ptr %11, align 4, !tbaa !9
  %13 = load float, ptr @_ZL6hp_sum, align 4, !tbaa !9
  %14 = fadd float %12, %13
  br i1 %8, label %15, label %19

15:                                               ; preds = %1
  %16 = load i32, ptr @_ZL14hp_buff_WR_idx, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [55 x float], ptr @_ZL7hp_buff, i64 0, i64 %17
  store float 0.000000e+00, ptr %18, align 4, !tbaa !9
  %.pre = add nsw i32 %9, 1
  br label %38

19:                                               ; preds = %1
  %20 = add i32 %9, -9
  %21 = icmp slt i32 %20, 0
  %22 = add i32 %9, 1
  %spec.select = select i1 %21, i32 %22, i32 %20
  %23 = sext i32 %spec.select to i64
  %24 = getelementptr inbounds [10 x float], ptr @_ZL8ecg_buff, i64 0, i64 %23
  %25 = load float, ptr %24, align 4, !tbaa !9
  %26 = fsub float %14, %25
  %27 = add i32 %9, -5
  %28 = icmp slt i32 %27, 0
  %29 = add i32 %9, 5
  %.1 = select i1 %28, i32 %29, i32 %27
  %30 = sext i32 %.1 to i64
  %31 = getelementptr inbounds [10 x float], ptr @_ZL8ecg_buff, i64 0, i64 %30
  %32 = load float, ptr %31, align 4, !tbaa !9
  %33 = fmul float %26, 0x3FBC71C720000000
  %34 = fsub float %32, %33
  %35 = load i32, ptr @_ZL14hp_buff_WR_idx, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [55 x float], ptr @_ZL7hp_buff, i64 0, i64 %36
  store float %34, ptr %37, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %19, %15
  %.pre-phi = phi i32 [ %22, %19 ], [ %.pre, %15 ]
  %39 = phi i32 [ %35, %19 ], [ %16, %15 ]
  %.sink = phi float [ %26, %19 ], [ %14, %15 ]
  store float %.sink, ptr @_ZL6hp_sum, align 4
  %40 = urem i32 %.pre-phi, 10
  store i32 %40, ptr @_ZL15ecg_buff_RD_idx, align 4, !tbaa !5
  %41 = add nsw i32 %39, 1
  %42 = urem i32 %41, 55
  store i32 %42, ptr @_ZL14hp_buff_WR_idx, align 4, !tbaa !5
  %43 = load i32, ptr @_ZL14hp_buff_RD_idx, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [55 x float], ptr @_ZL7hp_buff, i64 0, i64 %44
  %46 = load float, ptr %45, align 4, !tbaa !9
  %47 = load float, ptr @_ZL6lp_sum, align 4, !tbaa !9
  %48 = tail call float @llvm.fmuladd.f32(float %46, float %46, float %47)
  store float %48, ptr @_ZL6lp_sum, align 4, !tbaa !9
  %49 = icmp ult i32 %7, 54
  br i1 %49, label %.thread, label %52

.thread:                                          ; preds = %38
  store float 0.000000e+00, ptr @_ZL12next_eval_pt, align 4, !tbaa !9
  %50 = add nsw i32 %43, 1
  %51 = urem i32 %50, 55
  store i32 %51, ptr @_ZL14hp_buff_RD_idx, align 4, !tbaa !5
  br label %63

52:                                               ; preds = %38
  %53 = add i32 %43, -54
  %54 = icmp slt i32 %53, 0
  %55 = add i32 %43, 1
  %spec.select26 = select i1 %54, i32 %55, i32 %53
  %56 = sext i32 %spec.select26 to i64
  %57 = getelementptr inbounds [55 x float], ptr @_ZL7hp_buff, i64 0, i64 %56
  %58 = load float, ptr %57, align 4, !tbaa !9
  %59 = fneg float %58
  %60 = tail call float @llvm.fmuladd.f32(float %59, float %58, float %48)
  store float %60, ptr @_ZL6lp_sum, align 4, !tbaa !9
  store float %60, ptr @_ZL12next_eval_pt, align 4, !tbaa !9
  %61 = urem i32 %55, 55
  store i32 %61, ptr @_ZL14hp_buff_RD_idx, align 4, !tbaa !5
  %62 = icmp ult i32 %7, 360
  br i1 %62, label %63, label %69

63:                                               ; preds = %.thread, %52
  %storemerge28 = phi float [ 0.000000e+00, %.thread ], [ %60, %52 ]
  %64 = load float, ptr @_ZL8treshold, align 4, !tbaa !9
  %65 = fcmp ogt float %storemerge28, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %63
  store float %storemerge28, ptr @_ZL8treshold, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %66, %63
  %68 = add nuw nsw i32 %7, 1
  store i32 %68, ptr @_ZL11number_iter, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %67, %52
  %storemerge29 = phi float [ %storemerge28, %67 ], [ %60, %52 ]
  %70 = load i8, ptr @_ZL9triggered, align 1, !tbaa !11, !range !13, !noundef !14
  %71 = trunc nuw i8 %70 to i1
  br i1 %71, label %72, label %77

72:                                               ; preds = %69
  %73 = load i32, ptr @_ZL9trig_time, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr @_ZL9trig_time, align 4, !tbaa !5
  %75 = load i32, ptr @_ZL10DELAY_TIME, align 4, !tbaa !5
  %.not = icmp slt i32 %74, %75
  br i1 %.not, label %77, label %76

76:                                               ; preds = %72
  store i8 0, ptr @_ZL9triggered, align 1, !tbaa !11
  store i32 0, ptr @_ZL9trig_time, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %72, %76, %69
  %78 = phi i8 [ %70, %72 ], [ 0, %76 ], [ %70, %69 ]
  %79 = load float, ptr @_ZL7win_max, align 4, !tbaa !9
  %80 = fcmp ogt float %storemerge29, %79
  br i1 %80, label %81, label %82

81:                                               ; preds = %77
  store float %storemerge29, ptr @_ZL7win_max, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %81, %77
  %83 = load float, ptr @_ZL8treshold, align 4, !tbaa !9
  %84 = fcmp ogt float %storemerge29, %83
  br i1 %84, label %85, label %88

85:                                               ; preds = %82
  %86 = trunc nuw i8 %78 to i1
  br i1 %86, label %88, label %87

87:                                               ; preds = %85
  store i32 %3, ptr @_ZL14last_qrs_point, align 4, !tbaa !5
  store i8 1, ptr @_ZL9triggered, align 1, !tbaa !11
  br label %103

88:                                               ; preds = %82, %85
  %89 = load i32, ptr @_ZL7win_idx, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr @_ZL7win_idx, align 4, !tbaa !5
  %91 = icmp ugt i32 %89, 359
  br i1 %91, label %92, label %103

92:                                               ; preds = %88
  %93 = tail call i32 @rand() #3
  %94 = sitofp i32 %93 to float
  %95 = fmul float %94, 0x3E00000000000000
  %96 = tail call float @llvm.fmuladd.f32(float %95, float 0x3FB70A3D80000000, float 0x3F847AE140000000)
  %97 = fmul float %96, 0x3FC6666680000000
  %98 = load float, ptr @_ZL7win_max, align 4, !tbaa !9
  %99 = fsub float 1.000000e+00, %96
  %100 = load float, ptr @_ZL8treshold, align 4, !tbaa !9
  %101 = fmul float %100, %99
  %102 = tail call float @llvm.fmuladd.f32(float %97, float %98, float %101)
  store float %102, ptr @_ZL8treshold, align 4, !tbaa !9
  store i32 0, ptr @_ZL7win_idx, align 4, !tbaa !5
  store float -1.000000e+07, ptr @_ZL7win_max, align 4, !tbaa !9
  br label %103

103:                                              ; preds = %88, %92, %87
  %.0 = phi i1 [ true, %87 ], [ false, %92 ], [ false, %88 ]
  ret i1 %.0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #2

attributes #0 = { mustprogress 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { nounwind }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass