; LLVM IR from HRI-EU/Rcs :: src/RcsCore/Rcs_filters.ll (ZN3Rcs12RampFilterND7iterateEPd)

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

%"class.Rcs::RampFilterND" = type { %"class.Rcs::SecondOrderLPFND", double, ptr }
%"class.Rcs::SecondOrderLPFND" = type { ptr, ptr, i64 }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Rcs12RampFilterND7iterateEPd(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %1) unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %8 = getelementptr inbounds %"class.Rcs::RampFilterND", ptr %7, i32 0, i32 1
  %9 = load double, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds %"class.Rcs::SecondOrderLPFND", ptr %7, i32 0, i32 1
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  %12 = getelementptr inbounds ptr, ptr %11, i64 0
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %15 = getelementptr inbounds ptr, ptr %14, i64 16
  %16 = load ptr, ptr %15, align 8
  %17 = call noundef double %16(ptr noundef nonnull align 8 dereferenceable(56) %13)
  %18 = fmul double %9, %17
  store double %18, ptr %5, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  store i64 0, ptr %6, align 8, !tbaa !18
  br label %19

19:                                               ; preds = %93, %2
  %20 = load i64, ptr %6, align 8, !tbaa !18
  %21 = getelementptr inbounds %"class.Rcs::SecondOrderLPFND", ptr %7, i32 0, i32 2
  %22 = load i64, ptr %21, align 8, !tbaa !19
  %23 = icmp ult i64 %20, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %96

25:                                               ; preds = %19
  %26 = getelementptr inbounds %"class.Rcs::SecondOrderLPFND", ptr %7, i32 0, i32 1
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = load i64, ptr %6, align 8, !tbaa !18
  %29 = getelementptr inbounds ptr, ptr %27, i64 %28
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = load ptr, ptr %30, align 8, !tbaa !15
  %32 = getelementptr inbounds ptr, ptr %31, i64 15
  %33 = load ptr, ptr %32, align 8
  %34 = call noundef double %33(ptr noundef nonnull align 8 dereferenceable(56) %30)
  %35 = getelementptr inbounds %"class.Rcs::RampFilterND", ptr %7, i32 0, i32 2
  %36 = load ptr, ptr %35, align 8, !tbaa !20
  %37 = load i64, ptr %6, align 8, !tbaa !18
  %38 = getelementptr inbounds double, ptr %36, i64 %37
  %39 = load double, ptr %38, align 8, !tbaa !17
  %40 = load double, ptr %5, align 8, !tbaa !17
  %41 = fadd double %39, %40
  %42 = fcmp ogt double %34, %41
  br i1 %42, label %43, label %51

43:                                               ; preds = %25
  %44 = load double, ptr %5, align 8, !tbaa !17
  %45 = getelementptr inbounds %"class.Rcs::RampFilterND", ptr %7, i32 0, i32 2
  %46 = load ptr, ptr %45, align 8, !tbaa !20
  %47 = load i64, ptr %6, align 8, !tbaa !18
  %48 = getelementptr inbounds double, ptr %46, i64 %47
  %49 = load double, ptr %48, align 8, !tbaa !17
  %50 = fadd double %49, %44
  store double %50, ptr %48, align 8, !tbaa !17
  br label %92

51:                                               ; preds = %25
  %52 = getelementptr inbounds %"class.Rcs::SecondOrderLPFND", ptr %7, i32 0, i32 1
  %53 = load ptr, ptr %52, align 8, !tbaa !14
  %54 = load i64, ptr %6, align 8, !tbaa !18
  %55 = getelementptr inbounds ptr, ptr %53, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  %58 = getelementptr inbounds ptr, ptr %57, i64 15
  %59 = load ptr, ptr %58, align 8
  %60 = call noundef double %59(ptr noundef nonnull align 8 dereferenceable(56) %56)
  %61 = getelementptr inbounds %"class.Rcs::RampFilterND", ptr %7, i32 0, i32 2
  %62 = load ptr, ptr %61, align 8, !tbaa !20
  %63 = load i64, ptr %6, align 8, !tbaa !18
  %64 = getelementptr inbounds double, ptr %62, i64 %63
  %65 = load double, ptr %64, align 8, !tbaa !17
  %66 = load double, ptr %5, align 8, !tbaa !17
  %67 = fsub double %65, %66
  %68 = fcmp olt double %60, %67
  br i1 %68, label %69, label %77

69:                                               ; preds = %51
  %70 = load double, ptr %5, align 8, !tbaa !17
  %71 = getelementptr inbounds %"class.Rcs::RampFilterND", ptr %7, i32 0, i32 2
  %72 = load ptr, ptr %71, align 8, !tbaa !20
  %73 = load i64, ptr %6, align 8, !tbaa !18
  %74 = getelementptr inbounds double, ptr %72, i64 %73
  %75 = load double, ptr %74, align 8, !tbaa !17
  %76 = fsub double %75, %70
  store double %76, ptr %74, align 8, !tbaa !17
  br label %91

77:                                               ; preds = %51
  %78 = getelementptr inbounds %"class.Rcs::SecondOrderLPFND", ptr %7, i32 0, i32 1
  %79 = load ptr, ptr %78, align 8, !tbaa !14
  %80 = load i64, ptr %6, align 8, !tbaa !18
  %81 = getelementptr inbounds ptr, ptr %79, i64 %80
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  %83 = load ptr, ptr %82, align 8, !tbaa !15
  %84 = getelementptr inbounds ptr, ptr %83, i64 15
  %85 = load ptr, ptr %84, align 8
  %86 = call noundef double %85(ptr noundef nonnull align 8 dereferenceable(56) %82)
  %87 = getelementptr inbounds %"class.Rcs::RampFilterND", ptr %7, i32 0, i32 2
  %88 = load ptr, ptr %87, align 8, !tbaa !20
  %89 = load i64, ptr %6, align 8, !tbaa !18
  %90 = getelementptr inbounds double, ptr %88, i64 %89
  store double %86, ptr %90, align 8, !tbaa !17
  br label %91

91:                                               ; preds = %77, %69
  br label %92

92:                                               ; preds = %91, %43
  br label %93

93:                                               ; preds = %92
  %94 = load i64, ptr %6, align 8, !tbaa !18
  %95 = add i64 %94, 1
  store i64 %95, ptr %6, align 8, !tbaa !18
  br label %19, !llvm.loop !21

96:                                               ; preds = %24
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %"class.Rcs::RampFilterND", ptr %7, i32 0, i32 2
  %99 = load ptr, ptr %98, align 8, !tbaa !20
  %100 = load ptr, ptr %7, align 8, !tbaa !15
  %101 = getelementptr inbounds ptr, ptr %100, i64 6
  %102 = load ptr, ptr %101, align 8
  call void %102(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef %97, ptr noundef %99)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !13, i64 24}
!10 = !{!"_ZTSN3Rcs12RampFilterNDE", !11, i64 0, !13, i64 24, !6, i64 32}
!11 = !{!"_ZTSN3Rcs16SecondOrderLPFNDE", !6, i64 8, !12, i64 16}
!12 = !{!"long", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!11, !6, i64 8}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = !{!13, !13, i64 0}
!18 = !{!12, !12, i64 0}
!19 = !{!11, !12, i64 16}
!20 = !{!10, !6, i64 32}
!21 = distinct !{!21, !22}
!22 = !{!"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 uwtable
define dso_local void @_ZN3Rcs12RampFilterND7iterateEPd(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load double, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !13
  %7 = load ptr, ptr %6, align 8, !tbaa !14
  %8 = load ptr, ptr %7, align 8, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %8, i64 128
  %10 = load ptr, ptr %9, align 8
  %11 = tail call noundef double %10(ptr noundef nonnull align 8 dereferenceable(56) %7)
  %12 = fmul double %4, %11
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load i64, ptr %13, align 8, !tbaa !17
  %.not = icmp eq i64 %14, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 32
  br i1 %.not, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %2
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !18
  br label %._crit_edge

._crit_edge:                                      ; preds = %56, %.._crit_edge_crit_edge
  %15 = phi ptr [ %.pre, %.._crit_edge_crit_edge ], [ %57, %56 ]
  %16 = load ptr, ptr %0, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %16, i64 48
  %18 = load ptr, ptr %17, align 8
  tail call void %18(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1, ptr noundef %15)
  ret void

.lr.ph:                                           ; preds = %2, %56
  %.017 = phi i64 [ %58, %56 ], [ 0, %2 ]
  %19 = load ptr, ptr %5, align 8, !tbaa !13
  %20 = getelementptr inbounds ptr, ptr %19, i64 %.017
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = getelementptr inbounds i8, ptr %22, i64 120
  %24 = load ptr, ptr %23, align 8
  %25 = tail call noundef double %24(ptr noundef nonnull align 8 dereferenceable(56) %21)
  %26 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !18
  %27 = getelementptr inbounds double, ptr %26, i64 %.017
  %28 = load double, ptr %27, align 8, !tbaa !19
  %29 = fadd double %12, %28
  %30 = fcmp ogt double %25, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %.lr.ph
  store double %29, ptr %27, align 8, !tbaa !19
  br label %56

32:                                               ; preds = %.lr.ph
  %33 = load ptr, ptr %5, align 8, !tbaa !13
  %34 = getelementptr inbounds ptr, ptr %33, i64 %.017
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = getelementptr inbounds i8, ptr %36, i64 120
  %38 = load ptr, ptr %37, align 8
  %39 = tail call noundef double %38(ptr noundef nonnull align 8 dereferenceable(56) %35)
  %40 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !18
  %41 = getelementptr inbounds double, ptr %40, i64 %.017
  %42 = load double, ptr %41, align 8, !tbaa !19
  %43 = fsub double %42, %12
  %44 = fcmp olt double %39, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %32
  store double %43, ptr %41, align 8, !tbaa !19
  br label %56

46:                                               ; preds = %32
  %47 = load ptr, ptr %5, align 8, !tbaa !13
  %48 = getelementptr inbounds ptr, ptr %47, i64 %.017
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = load ptr, ptr %49, align 8, !tbaa !15
  %51 = getelementptr inbounds i8, ptr %50, i64 120
  %52 = load ptr, ptr %51, align 8
  %53 = tail call noundef double %52(ptr noundef nonnull align 8 dereferenceable(56) %49)
  %54 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !18
  %55 = getelementptr inbounds double, ptr %54, i64 %.017
  store double %53, ptr %55, align 8, !tbaa !19
  br label %56

56:                                               ; preds = %31, %46, %45
  %57 = phi ptr [ %26, %31 ], [ %54, %46 ], [ %40, %45 ]
  %58 = add nuw i64 %.017, 1
  %59 = load i64, ptr %13, align 8, !tbaa !17
  %60 = icmp ult i64 %58, %59
  br i1 %60, label %.lr.ph, label %._crit_edge, !llvm.loop !20
}

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

!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, !12, i64 24}
!6 = !{!"_ZTSN3Rcs12RampFilterNDE", !7, i64 0, !12, i64 24, !8, i64 32}
!7 = !{!"_ZTSN3Rcs16SecondOrderLPFNDE", !8, i64 8, !11, i64 16}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"double", !9, i64 0}
!13 = !{!7, !8, i64 8}
!14 = !{!8, !8, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !10, i64 0}
!17 = !{!7, !11, i64 16}
!18 = !{!6, !8, i64 32}
!19 = !{!12, !12, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass