; LLVM IR from GCY/wxECGAnalyzer :: src/MAC/So_Chen_detect.ll (Z14So_Chen_detect11SignalPointiff)

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

%struct.SignalPoint = type { float, i32 }

@_ZL19signal_window_count = external hidden global i32, align 4
@_ZL13signal_window = external hidden global [5 x %struct.SignalPoint], align 16
@_ZL4slop = external hidden global %struct.SignalPoint, align 4
@_ZL17so_chen_init_flag = external hidden global i8, align 1
@_ZL9maxi_init = external hidden global i8, align 1
@_ZL3max = external hidden global %struct.SignalPoint, align 4
@_ZL4maxi = external hidden global float, align 4
@_ZL10init_count = external hidden global i32, align 4
@_ZL14slop_threshold = external hidden global float, align 4
@_ZL15qrs_on_set_flag = external hidden global i8, align 1
@_ZL10last_point = external hidden global i32, align 4
@_ZL8max_init = external hidden global i8, align 1
@_ZL8max_slop = external hidden global %struct.SignalPoint, align 4
@_ZL15qrs_onset_point = external hidden global %struct.SignalPoint, align 4
@_ZL9last_maxi = external hidden global float, align 4
@_ZL16qrs_on_set_count = external hidden global i32, align 4
@_ZL13qrs_onset_idx = external hidden global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local i64 @_Z14So_Chen_detect11SignalPointiff(i64 %0, i32 noundef %1, float noundef %2, float noundef %3) #0 {
  %5 = alloca %struct.SignalPoint, align 4
  %6 = alloca %struct.SignalPoint, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca %struct.SignalPoint, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i64 %0, ptr %6, align 4
  store i32 %1, ptr %7, align 4, !tbaa !5
  store float %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !9
  %13 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %14 = icmp ult i32 %13, 5
  br i1 %14, label %15, label %23

15:                                               ; preds = %4
  %16 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %17 = urem i32 %16, 5
  %18 = zext i32 %17 to i64
  %19 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %18
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !11
  %20 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %21 = add i32 %20, 1
  store i32 %21, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %22 = getelementptr inbounds %struct.SignalPoint, ptr %5, i32 0, i32 1
  store i32 -1, ptr %22, align 4, !tbaa !12
  br label %204

23:                                               ; preds = %4
  %24 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %25 = urem i32 %24, 5
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %26
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %27, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !11
  %28 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %29 = add i32 %28, 1
  store i32 %29, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %30

30:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %31 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %32 = sub i32 %31, 2
  store i32 %32, ptr %11, align 4, !tbaa !5
  %33 = load i32, ptr %11, align 4, !tbaa !5
  %34 = sub i32 %33, 2
  %35 = urem i32 %34, 5
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %36
  %38 = getelementptr inbounds %struct.SignalPoint, ptr %37, i32 0, i32 0
  %39 = load float, ptr %38, align 8, !tbaa !14
  %40 = load i32, ptr %11, align 4, !tbaa !5
  %41 = sub i32 %40, 1
  %42 = urem i32 %41, 5
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %43
  %45 = getelementptr inbounds %struct.SignalPoint, ptr %44, i32 0, i32 0
  %46 = load float, ptr %45, align 8, !tbaa !14
  %47 = fneg float %46
  %48 = call float @llvm.fmuladd.f32(float -2.000000e+00, float %39, float %47)
  %49 = load i32, ptr %11, align 4, !tbaa !5
  %50 = add i32 %49, 1
  %51 = urem i32 %50, 5
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %52
  %54 = getelementptr inbounds %struct.SignalPoint, ptr %53, i32 0, i32 0
  %55 = load float, ptr %54, align 8, !tbaa !14
  %56 = fadd float %48, %55
  %57 = load i32, ptr %11, align 4, !tbaa !5
  %58 = add i32 %57, 2
  %59 = urem i32 %58, 5
  %60 = zext i32 %59 to i64
  %61 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %60
  %62 = getelementptr inbounds %struct.SignalPoint, ptr %61, i32 0, i32 0
  %63 = load float, ptr %62, align 8, !tbaa !14
  %64 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %63, float %56)
  store float %64, ptr @_ZL4slop, align 4, !tbaa !14
  %65 = load i32, ptr %11, align 4, !tbaa !5
  %66 = urem i32 %65, 5
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %67
  %69 = getelementptr inbounds %struct.SignalPoint, ptr %68, i32 0, i32 1
  %70 = load i32, ptr %69, align 4, !tbaa !12
  store i32 %70, ptr getelementptr inbounds (%struct.SignalPoint, ptr @_ZL4slop, i32 0, i32 1), align 4, !tbaa !12
  %71 = load i8, ptr @_ZL17so_chen_init_flag, align 1, !tbaa !15, !range !17, !noundef !18
  %72 = trunc i8 %71 to i1
  br i1 %72, label %97, label %73

73:                                               ; preds = %30
  %74 = load i8, ptr @_ZL9maxi_init, align 1, !tbaa !15, !range !17, !noundef !18
  %75 = trunc i8 %74 to i1
  br i1 %75, label %78, label %76

76:                                               ; preds = %73
  store float 0.000000e+00, ptr @_ZL3max, align 4, !tbaa !14
  store i32 -1, ptr getelementptr inbounds (%struct.SignalPoint, ptr @_ZL3max, i32 0, i32 1), align 4, !tbaa !12
  %77 = load float, ptr @_ZL4slop, align 4, !tbaa !14
  store float %77, ptr @_ZL4maxi, align 4, !tbaa !9
  store i8 1, ptr @_ZL9maxi_init, align 1, !tbaa !15
  br label %78

78:                                               ; preds = %76, %73
  %79 = load i32, ptr @_ZL10init_count, align 4, !tbaa !5
  %80 = add i32 %79, 1
  store i32 %80, ptr @_ZL10init_count, align 4, !tbaa !5
  %81 = load i32, ptr @_ZL10init_count, align 4, !tbaa !5
  %82 = load i32, ptr %7, align 4, !tbaa !5
  %83 = icmp ugt i32 %81, %82
  br i1 %83, label %84, label %89

84:                                               ; preds = %78
  store i8 1, ptr @_ZL17so_chen_init_flag, align 1, !tbaa !15
  %85 = load float, ptr %8, align 4, !tbaa !9
  %86 = fdiv float %85, 1.600000e+01
  %87 = load float, ptr @_ZL4maxi, align 4, !tbaa !9
  %88 = fmul float %86, %87
  store float %88, ptr @_ZL14slop_threshold, align 4, !tbaa !9
  br label %89

89:                                               ; preds = %84, %78
  %90 = load float, ptr @_ZL4slop, align 4, !tbaa !14
  %91 = load float, ptr @_ZL4maxi, align 4, !tbaa !9
  %92 = fcmp ogt float %90, %91
  br i1 %92, label %93, label %95

93:                                               ; preds = %89
  %94 = load float, ptr @_ZL4slop, align 4, !tbaa !14
  store float %94, ptr @_ZL4maxi, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %93, %89
  %96 = getelementptr inbounds %struct.SignalPoint, ptr %5, i32 0, i32 1
  store i32 -1, ptr %96, align 4, !tbaa !12
  store i32 1, ptr %12, align 4
  br label %203

97:                                               ; preds = %30
  %98 = load i8, ptr @_ZL15qrs_on_set_flag, align 1, !tbaa !15, !range !17, !noundef !18
  %99 = trunc i8 %98 to i1
  br i1 %99, label %100, label %155

100:                                              ; preds = %97
  %101 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %102 = load i32, ptr @_ZL10last_point, align 4, !tbaa !5
  %103 = sub i32 %101, %102
  %104 = icmp ugt i32 %103, 126
  br i1 %104, label %105, label %155

105:                                              ; preds = %100
  %106 = load i8, ptr @_ZL8max_init, align 1, !tbaa !15, !range !17, !noundef !18
  %107 = trunc i8 %106 to i1
  br i1 %107, label %113, label %108

108:                                              ; preds = %105
  %109 = load i32, ptr %11, align 4, !tbaa !5
  %110 = urem i32 %109, 5
  %111 = zext i32 %110 to i64
  %112 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %111
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @_ZL3max, ptr align 8 %112, i64 8, i1 false), !tbaa.struct !11
  store i8 1, ptr @_ZL8max_init, align 1, !tbaa !15
  br label %113

113:                                              ; preds = %108, %105
  %114 = load i32, ptr %11, align 4, !tbaa !5
  %115 = urem i32 %114, 5
  %116 = zext i32 %115 to i64
  %117 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %116
  %118 = getelementptr inbounds %struct.SignalPoint, ptr %117, i32 0, i32 0
  %119 = load float, ptr %118, align 8, !tbaa !14
  %120 = load float, ptr @_ZL3max, align 4, !tbaa !14
  %121 = fcmp ogt float %119, %120
  br i1 %121, label %122, label %127

122:                                              ; preds = %113
  %123 = load i32, ptr %11, align 4, !tbaa !5
  %124 = urem i32 %123, 5
  %125 = zext i32 %124 to i64
  %126 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %125
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @_ZL3max, ptr align 8 %126, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @_ZL8max_slop, ptr align 4 @_ZL4slop, i64 8, i1 false), !tbaa.struct !11
  br label %154

127:                                              ; preds = %113
  %128 = load i32, ptr %11, align 4, !tbaa !5
  %129 = urem i32 %128, 5
  %130 = zext i32 %129 to i64
  %131 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %130
  %132 = getelementptr inbounds %struct.SignalPoint, ptr %131, i32 0, i32 0
  %133 = load float, ptr %132, align 8, !tbaa !14
  %134 = load float, ptr @_ZL3max, align 4, !tbaa !14
  %135 = fcmp olt float %133, %134
  br i1 %135, label %136, label %153

136:                                              ; preds = %127
  %137 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  store i32 %137, ptr @_ZL10last_point, align 4, !tbaa !5
  store i8 0, ptr @_ZL15qrs_on_set_flag, align 1, !tbaa !15
  store i8 0, ptr @_ZL8max_init, align 1, !tbaa !15
  %138 = load float, ptr @_ZL3max, align 4, !tbaa !14
  %139 = load float, ptr @_ZL15qrs_onset_point, align 4, !tbaa !14
  %140 = fsub float %138, %139
  %141 = call noundef float @_ZSt3absf(float noundef %140)
  %142 = load float, ptr @_ZL4maxi, align 4, !tbaa !9
  %143 = fsub float %141, %142
  %144 = load float, ptr %9, align 4, !tbaa !9
  %145 = fdiv float %143, %144
  %146 = load float, ptr @_ZL4maxi, align 4, !tbaa !9
  %147 = fadd float %145, %146
  store float %147, ptr @_ZL4maxi, align 4, !tbaa !9
  %148 = load float, ptr %8, align 4, !tbaa !9
  %149 = fdiv float %148, 1.600000e+01
  %150 = load float, ptr @_ZL4maxi, align 4, !tbaa !9
  %151 = fmul float %149, %150
  store float %151, ptr @_ZL14slop_threshold, align 4, !tbaa !9
  %152 = load float, ptr @_ZL4maxi, align 4, !tbaa !9
  store float %152, ptr @_ZL9last_maxi, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 @_ZL3max, i64 8, i1 false), !tbaa.struct !11
  store i32 1, ptr %12, align 4
  br label %203

153:                                              ; preds = %127
  br label %154

154:                                              ; preds = %153, %122
  br label %201

155:                                              ; preds = %100, %97
  %156 = load float, ptr @_ZL4slop, align 4, !tbaa !14
  %157 = load float, ptr @_ZL14slop_threshold, align 4, !tbaa !9
  %158 = fcmp ogt float %156, %157
  br i1 %158, label %159, label %162

159:                                              ; preds = %155
  %160 = load i32, ptr @_ZL16qrs_on_set_count, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr @_ZL16qrs_on_set_count, align 4, !tbaa !5
  br label %167

162:                                              ; preds = %155
  %163 = load i32, ptr @_ZL16qrs_on_set_count, align 4, !tbaa !5
  %164 = icmp ne i32 %163, 0
  br i1 %164, label %165, label %166

165:                                              ; preds = %162
  store i32 0, ptr @_ZL16qrs_on_set_count, align 4, !tbaa !5
  br label %166

166:                                              ; preds = %165, %162
  br label %167

167:                                              ; preds = %166, %159
  %168 = load i32, ptr @_ZL16qrs_on_set_count, align 4, !tbaa !5
  %169 = icmp sge i32 %168, 2
  br i1 %169, label %170, label %172

170:                                              ; preds = %167
  store i8 1, ptr @_ZL15qrs_on_set_flag, align 1, !tbaa !15
  store i32 0, ptr @_ZL16qrs_on_set_count, align 4, !tbaa !5
  %171 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %171, ptr @_ZL13qrs_onset_idx, align 4, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @_ZL15qrs_onset_point, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !11
  br label %200

172:                                              ; preds = %167
  %173 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %174 = load i32, ptr @_ZL10last_point, align 4, !tbaa !5
  %175 = sub i32 %173, %174
  %176 = icmp ugt i32 %175, 252
  br i1 %176, label %177, label %199

177:                                              ; preds = %172
  %178 = load float, ptr @_ZL14slop_threshold, align 4, !tbaa !9
  %179 = fcmp ogt float %178, 0.000000e+00
  br i1 %179, label %180, label %199

180:                                              ; preds = %177
  %181 = load float, ptr @_ZL4slop, align 4, !tbaa !14
  %182 = load float, ptr @_ZL14slop_threshold, align 4, !tbaa !9
  %183 = fsub float %182, %181
  store float %183, ptr @_ZL14slop_threshold, align 4, !tbaa !9
  %184 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %185 = load i32, ptr @_ZL10last_point, align 4, !tbaa !5
  %186 = sub i32 %184, %185
  %187 = icmp ugt i32 %186, 1080
  br i1 %187, label %188, label %198

188:                                              ; preds = %180
  %189 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %190 = load i32, ptr @_ZL10last_point, align 4, !tbaa !5
  %191 = sub i32 %189, %190
  %192 = load float, ptr %8, align 4, !tbaa !9
  %193 = fptosi float %192 to i32
  %194 = lshr i32 %191, %193
  %195 = uitofp i32 %194 to float
  %196 = load float, ptr @_ZL14slop_threshold, align 4, !tbaa !9
  %197 = fsub float %196, %195
  store float %197, ptr @_ZL14slop_threshold, align 4, !tbaa !9
  br label %198

198:                                              ; preds = %188, %180
  br label %199

199:                                              ; preds = %198, %177, %172
  br label %200

200:                                              ; preds = %199, %170
  br label %201

201:                                              ; preds = %200, %154
  %202 = getelementptr inbounds %struct.SignalPoint, ptr %5, i32 0, i32 1
  store i32 -1, ptr %202, align 4, !tbaa !12
  store i32 1, ptr %12, align 4
  br label %203

203:                                              ; preds = %201, %136, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %204

204:                                              ; preds = %203, %15
  %205 = load i64, ptr %5, align 4
  ret i64 %205
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: 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 float @llvm.fmuladd.f32(float, float, float) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) #4

attributes #0 = { mustprogress 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 nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { inlinehint 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 #5 = { 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 = !{i64 0, i64 4, !9, i64 4, i64 4, !5}
!12 = !{!13, !6, i64 4}
!13 = !{!"_ZTS11SignalPoint", !10, i64 0, !6, i64 4}
!14 = !{!13, !10, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}


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

%struct.SignalPoint = type { float, i32 }

@_ZL19signal_window_count = external hidden local_unnamed_addr global i32, align 4
@_ZL13signal_window = external hidden local_unnamed_addr global [5 x %struct.SignalPoint], align 16
@_ZL4slop = external hidden local_unnamed_addr global %struct.SignalPoint, align 4
@_ZL17so_chen_init_flag = external hidden local_unnamed_addr global i8, align 1
@_ZL9maxi_init = external hidden local_unnamed_addr global i8, align 1
@_ZL3max = external hidden local_unnamed_addr global %struct.SignalPoint, align 4
@_ZL4maxi = external hidden local_unnamed_addr global float, align 4
@_ZL10init_count = external hidden local_unnamed_addr global i32, align 4
@_ZL14slop_threshold = external hidden local_unnamed_addr global float, align 4
@_ZL15qrs_on_set_flag = external hidden local_unnamed_addr global i8, align 1
@_ZL10last_point = external hidden local_unnamed_addr global i32, align 4
@_ZL8max_init = external hidden local_unnamed_addr global i8, align 1
@_ZL8max_slop = external hidden local_unnamed_addr global %struct.SignalPoint, align 4
@_ZL15qrs_onset_point = external hidden local_unnamed_addr global %struct.SignalPoint, align 4
@_ZL9last_maxi = external hidden local_unnamed_addr global float, align 4
@_ZL16qrs_on_set_count = external hidden local_unnamed_addr global i32, align 4
@_ZL13qrs_onset_idx = external hidden local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local i64 @_Z14So_Chen_detect11SignalPointiff(i64 %0, i32 noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #0 {
  %5 = load i32, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %6 = icmp ult i32 %5, 5
  br i1 %6, label %7, label %11

7:                                                ; preds = %4
  %8 = zext nneg i32 %5 to i64
  %9 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %8
  store i64 %0, ptr %9, align 8
  %10 = add nuw nsw i32 %5, 1
  store i32 %10, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  br label %114

11:                                               ; preds = %4
  %12 = urem i32 %5, 5
  %13 = zext nneg i32 %12 to i64
  %14 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %13
  store i64 %0, ptr %14, align 8
  %15 = add i32 %5, 1
  store i32 %15, ptr @_ZL19signal_window_count, align 4, !tbaa !5
  %16 = add i32 %5, -1
  %17 = add i32 %5, -3
  %18 = urem i32 %17, 5
  %19 = zext nneg i32 %18 to i64
  %20 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %19
  %21 = load float, ptr %20, align 8, !tbaa !9
  %22 = add i32 %5, -2
  %23 = urem i32 %22, 5
  %24 = zext nneg i32 %23 to i64
  %25 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %24
  %26 = load float, ptr %25, align 8, !tbaa !9
  %27 = fneg float %26
  %28 = tail call float @llvm.fmuladd.f32(float %21, float -2.000000e+00, float %27)
  %29 = trunc i64 %0 to i32
  %30 = bitcast i32 %29 to float
  %31 = fadd float %28, %30
  %32 = urem i32 %15, 5
  %33 = zext nneg i32 %32 to i64
  %34 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %33
  %35 = load float, ptr %34, align 8, !tbaa !9
  %36 = tail call float @llvm.fmuladd.f32(float %35, float 2.000000e+00, float %31)
  store float %36, ptr @_ZL4slop, align 4, !tbaa !9
  %37 = urem i32 %16, 5
  %38 = zext nneg i32 %37 to i64
  %39 = getelementptr inbounds [5 x %struct.SignalPoint], ptr @_ZL13signal_window, i64 0, i64 %38
  %40 = getelementptr inbounds i8, ptr %39, i64 4
  %41 = load i32, ptr %40, align 4, !tbaa !12
  store i32 %41, ptr getelementptr inbounds (i8, ptr @_ZL4slop, i64 4), align 4, !tbaa !12
  %42 = load i8, ptr @_ZL17so_chen_init_flag, align 1, !tbaa !13, !range !15, !noundef !16
  %43 = trunc nuw i8 %42 to i1
  br i1 %43, label %58, label %44

44:                                               ; preds = %11
  %45 = load i8, ptr @_ZL9maxi_init, align 1, !tbaa !13, !range !15, !noundef !16
  %46 = trunc nuw i8 %45 to i1
  br i1 %46, label %._crit_edge26, label %47

._crit_edge26:                                    ; preds = %44
  %.pre.pre = load float, ptr @_ZL4maxi, align 4, !tbaa !17
  br label %48

47:                                               ; preds = %44
  store float 0.000000e+00, ptr @_ZL3max, align 4, !tbaa !9
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZL3max, i64 4), align 4, !tbaa !12
  store float %36, ptr @_ZL4maxi, align 4, !tbaa !17
  store i8 1, ptr @_ZL9maxi_init, align 1, !tbaa !13
  br label %48

48:                                               ; preds = %._crit_edge26, %47
  %.pre = phi float [ %.pre.pre, %._crit_edge26 ], [ %36, %47 ]
  %49 = load i32, ptr @_ZL10init_count, align 4, !tbaa !5
  %50 = add i32 %49, 1
  store i32 %50, ptr @_ZL10init_count, align 4, !tbaa !5
  %51 = icmp ugt i32 %50, %1
  br i1 %51, label %52, label %55

52:                                               ; preds = %48
  store i8 1, ptr @_ZL17so_chen_init_flag, align 1, !tbaa !13
  %53 = fmul float %2, 6.250000e-02
  %54 = fmul float %53, %.pre
  store float %54, ptr @_ZL14slop_threshold, align 4, !tbaa !17
  br label %55

55:                                               ; preds = %52, %48
  %56 = fcmp ogt float %36, %.pre
  br i1 %56, label %57, label %111

57:                                               ; preds = %55
  store float %36, ptr @_ZL4maxi, align 4, !tbaa !17
  br label %111

58:                                               ; preds = %11
  %59 = load i8, ptr @_ZL15qrs_on_set_flag, align 1, !tbaa !13, !range !15, !noundef !16
  %60 = trunc nuw i8 %59 to i1
  br i1 %60, label %61, label %89

61:                                               ; preds = %58
  %62 = load i32, ptr @_ZL10last_point, align 4, !tbaa !5
  %63 = sub i32 %15, %62
  %64 = icmp ugt i32 %63, 126
  br i1 %64, label %65, label %89

65:                                               ; preds = %61
  %66 = load i8, ptr @_ZL8max_init, align 1, !tbaa !13, !range !15, !noundef !16
  %67 = trunc nuw i8 %66 to i1
  br i1 %67, label %69, label %.thread29

.thread29:                                        ; preds = %65
  %68 = load i64, ptr %39, align 8
  store i64 %68, ptr @_ZL3max, align 4
  store i8 1, ptr @_ZL8max_init, align 1, !tbaa !13
  br label %111

69:                                               ; preds = %65
  %.pre24 = load float, ptr %39, align 8, !tbaa !9
  %.pre25 = load float, ptr @_ZL3max, align 4, !tbaa !9
  %70 = fcmp ogt float %.pre24, %.pre25
  br i1 %70, label %71, label %74

71:                                               ; preds = %69
  %72 = load i64, ptr %39, align 8
  store i64 %72, ptr @_ZL3max, align 4
  %73 = load i64, ptr @_ZL4slop, align 4
  store i64 %73, ptr @_ZL8max_slop, align 4
  br label %111

74:                                               ; preds = %69
  %75 = fcmp olt float %.pre24, %.pre25
  br i1 %75, label %76, label %111

76:                                               ; preds = %74
  store i32 %15, ptr @_ZL10last_point, align 4, !tbaa !5
  store i8 0, ptr @_ZL15qrs_on_set_flag, align 1, !tbaa !13
  store i8 0, ptr @_ZL8max_init, align 1, !tbaa !13
  %77 = load float, ptr @_ZL15qrs_onset_point, align 4, !tbaa !9
  %78 = fsub float %.pre25, %77
  %79 = tail call noundef float @_ZSt3absf(float noundef %78)
  %80 = load float, ptr @_ZL4maxi, align 4, !tbaa !17
  %81 = fsub float %79, %80
  %82 = fdiv float %81, %3
  %83 = fadd float %80, %82
  store float %83, ptr @_ZL4maxi, align 4, !tbaa !17
  %84 = fmul float %2, 6.250000e-02
  %85 = fmul float %84, %83
  store float %85, ptr @_ZL14slop_threshold, align 4, !tbaa !17
  store float %83, ptr @_ZL9last_maxi, align 4, !tbaa !17
  %.sroa.017.0.copyload23 = load i32, ptr @_ZL3max, align 4, !tbaa !17
  %.sroa.2.0.copyload = load i32, ptr getelementptr inbounds (i8, ptr @_ZL3max, i64 4), align 4, !tbaa !5
  %86 = zext i32 %.sroa.2.0.copyload to i64
  %87 = shl nuw i64 %86, 32
  %88 = zext i32 %.sroa.017.0.copyload23 to i64
  br label %111

89:                                               ; preds = %61, %58
  %90 = load float, ptr @_ZL14slop_threshold, align 4
  %91 = fcmp ogt float %36, %90
  %92 = load i32, ptr @_ZL16qrs_on_set_count, align 4, !tbaa !5
  br i1 %91, label %95, label %93

93:                                               ; preds = %89
  %.not = icmp eq i32 %92, 0
  br i1 %.not, label %.thread, label %94

94:                                               ; preds = %93
  store i32 0, ptr @_ZL16qrs_on_set_count, align 4, !tbaa !5
  br label %.thread

95:                                               ; preds = %89
  %96 = add nsw i32 %92, 1
  store i32 %96, ptr @_ZL16qrs_on_set_count, align 4, !tbaa !5
  %97 = icmp sgt i32 %92, 0
  br i1 %97, label %98, label %.thread

98:                                               ; preds = %95
  store i8 1, ptr @_ZL15qrs_on_set_flag, align 1, !tbaa !13
  store i32 0, ptr @_ZL16qrs_on_set_count, align 4, !tbaa !5
  store i32 %16, ptr @_ZL13qrs_onset_idx, align 4, !tbaa !5
  store i64 %0, ptr @_ZL15qrs_onset_point, align 4
  br label %111

.thread:                                          ; preds = %94, %93, %95
  %99 = load i32, ptr @_ZL10last_point, align 4, !tbaa !5
  %100 = sub i32 %15, %99
  %101 = icmp ugt i32 %100, 252
  %102 = fcmp ogt float %90, 0.000000e+00
  %or.cond = and i1 %102, %101
  br i1 %or.cond, label %103, label %111

103:                                              ; preds = %.thread
  %104 = fsub float %90, %36
  store float %104, ptr @_ZL14slop_threshold, align 4, !tbaa !17
  %105 = icmp ugt i32 %100, 1080
  br i1 %105, label %106, label %111

106:                                              ; preds = %103
  %107 = fptosi float %2 to i32
  %108 = lshr i32 %100, %107
  %109 = uitofp i32 %108 to float
  %110 = fsub float %104, %109
  store float %110, ptr @_ZL14slop_threshold, align 4, !tbaa !17
  br label %111

111:                                              ; preds = %.thread29, %74, %71, %.thread, %106, %103, %98, %55, %57, %76
  %112 = phi i64 [ %88, %76 ], [ 0, %57 ], [ 0, %55 ], [ 0, %98 ], [ 0, %103 ], [ 0, %106 ], [ 0, %.thread ], [ 0, %71 ], [ 0, %74 ], [ 0, %.thread29 ]
  %.sroa.2.0 = phi i64 [ %87, %76 ], [ -4294967296, %57 ], [ -4294967296, %55 ], [ -4294967296, %98 ], [ -4294967296, %103 ], [ -4294967296, %106 ], [ -4294967296, %.thread ], [ -4294967296, %71 ], [ -4294967296, %74 ], [ -4294967296, %.thread29 ]
  %113 = or disjoint i64 %.sroa.2.0, %112
  br label %114

114:                                              ; preds = %111, %7
  %.sroa.017.0.insert.insert = phi i64 [ -4294967296, %7 ], [ %113, %111 ]
  ret i64 %.sroa.017.0.insert.insert
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) 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 = { inlinehint 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" }

!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, !11, i64 0}
!10 = !{!"_ZTS11SignalPoint", !11, i64 0, !6, i64 4}
!11 = !{!"float", !7, i64 0}
!12 = !{!10, !6, i64 4}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!11, !11, i64 0}


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