; LLVM IR from rdguez-mariano/fast_imas_IPOL :: libSimuTilts/digital_tilt.ll (Z14GaussianBlur1DRSt6vectorIfSaIfEEiifi)

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

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

; 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
declare dso_local void @_Z14ConvHorizontalRSt6vectorIfSaIfEEiiPfi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z12ConvVerticalRSt6vectorIfSaIfEEiiPfi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z14GaussianBlur1DRSt6vectorIfSaIfEEiifi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %1, i32 noundef %2, float noundef %3, i32 noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca float, align 4
  %12 = alloca [100 x float], align 16
  %13 = alloca float, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !11
  store i32 %4, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 400, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store float 0.000000e+00, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %16 = load float, ptr %9, align 4, !tbaa !11
  %17 = fpext float %16 to double
  %18 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %17, double 1.000000e+00)
  %19 = fptosi double %18 to i32
  store i32 %19, ptr %14, align 4, !tbaa !9
  %20 = load i32, ptr %14, align 4, !tbaa !9
  %21 = icmp slt i32 3, %20
  br i1 %21, label %22, label %24

22:                                               ; preds = %5
  %23 = load i32, ptr %14, align 4, !tbaa !9
  br label %25

24:                                               ; preds = %5
  br label %25

25:                                               ; preds = %24, %22
  %26 = phi i32 [ %23, %22 ], [ 3, %24 ]
  store i32 %26, ptr %14, align 4, !tbaa !9
  %27 = load i32, ptr %14, align 4, !tbaa !9
  %28 = srem i32 %27, 2
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %33

30:                                               ; preds = %25
  %31 = load i32, ptr %14, align 4, !tbaa !9
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %14, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %30, %25
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %67, %33
  %35 = load i32, ptr %15, align 4, !tbaa !9
  %36 = load i32, ptr %14, align 4, !tbaa !9
  %37 = icmp sle i32 %35, %36
  br i1 %37, label %38, label %70

38:                                               ; preds = %34
  %39 = load i32, ptr %15, align 4, !tbaa !9
  %40 = load i32, ptr %14, align 4, !tbaa !9
  %41 = sdiv i32 %40, 2
  %42 = sub nsw i32 %39, %41
  %43 = sitofp i32 %42 to float
  store float %43, ptr %11, align 4, !tbaa !11
  %44 = load float, ptr %11, align 4, !tbaa !11
  %45 = fneg float %44
  %46 = load float, ptr %11, align 4, !tbaa !11
  %47 = fmul float %45, %46
  %48 = fpext float %47 to double
  %49 = load float, ptr %9, align 4, !tbaa !11
  %50 = fpext float %49 to double
  %51 = fmul double 2.000000e+00, %50
  %52 = load float, ptr %9, align 4, !tbaa !11
  %53 = fpext float %52 to double
  %54 = fmul double %51, %53
  %55 = fdiv double %48, %54
  %56 = call double @exp(double noundef %55) #4
  %57 = fptrunc double %56 to float
  %58 = load i32, ptr %15, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [100 x float], ptr %12, i64 0, i64 %59
  store float %57, ptr %60, align 4, !tbaa !11
  %61 = load i32, ptr %15, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100 x float], ptr %12, i64 0, i64 %62
  %64 = load float, ptr %63, align 4, !tbaa !11
  %65 = load float, ptr %13, align 4, !tbaa !11
  %66 = fadd float %65, %64
  store float %66, ptr %13, align 4, !tbaa !11
  br label %67

67:                                               ; preds = %38
  %68 = load i32, ptr %15, align 4, !tbaa !9
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %15, align 4, !tbaa !9
  br label %34, !llvm.loop !13

70:                                               ; preds = %34
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %82, %70
  %72 = load i32, ptr %15, align 4, !tbaa !9
  %73 = load i32, ptr %14, align 4, !tbaa !9
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %75, label %85

75:                                               ; preds = %71
  %76 = load float, ptr %13, align 4, !tbaa !11
  %77 = load i32, ptr %15, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100 x float], ptr %12, i64 0, i64 %78
  %80 = load float, ptr %79, align 4, !tbaa !11
  %81 = fdiv float %80, %76
  store float %81, ptr %79, align 4, !tbaa !11
  br label %82

82:                                               ; preds = %75
  %83 = load i32, ptr %15, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %15, align 4, !tbaa !9
  br label %71, !llvm.loop !15

85:                                               ; preds = %71
  %86 = load i32, ptr %10, align 4, !tbaa !9
  %87 = icmp eq i32 %86, 0
  br i1 %87, label %88, label %94

88:                                               ; preds = %85
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = load i32, ptr %7, align 4, !tbaa !9
  %91 = load i32, ptr %8, align 4, !tbaa !9
  %92 = getelementptr inbounds [100 x float], ptr %12, i64 0, i64 0
  %93 = load i32, ptr %14, align 4, !tbaa !9
  call void @_Z14ConvHorizontalRSt6vectorIfSaIfEEiiPfi(ptr noundef nonnull align 8 dereferenceable(24) %89, i32 noundef %90, i32 noundef %91, ptr noundef %92, i32 noundef %93)
  br label %100

94:                                               ; preds = %85
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = load i32, ptr %7, align 4, !tbaa !9
  %97 = load i32, ptr %8, align 4, !tbaa !9
  %98 = getelementptr inbounds [100 x float], ptr %12, i64 0, i64 0
  %99 = load i32, ptr %14, align 4, !tbaa !9
  call void @_Z12ConvVerticalRSt6vectorIfSaIfEEiiPfi(ptr noundef nonnull align 8 dereferenceable(24) %95, i32 noundef %96, i32 noundef %97, ptr noundef %98, i32 noundef %99)
  br label %100

100:                                              ; preds = %94, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 400, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  ret void
}

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

; Function Attrs: nounwind
declare double @exp(double noundef) #3

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 = { 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 = !{!"any pointer", !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 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !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"

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14ConvHorizontalRSt6vectorIfSaIfEEiiPfi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z12ConvVerticalRSt6vectorIfSaIfEEiiPfi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z14GaussianBlur1DRSt6vectorIfSaIfEEiifi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %1, i32 noundef %2, float noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = alloca [100 x float], align 16
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %6) #5
  %7 = fpext float %3 to double
  %8 = tail call double @llvm.fmuladd.f64(double %7, double 8.000000e+00, double 1.000000e+00)
  %9 = fptosi double %8 to i32
  %10 = tail call i32 @llvm.smax.i32(i32 %9, i32 3)
  %spec.select = or i32 %10, 1
  %.neg32 = lshr i32 %10, 1
  %11 = fmul double %7, 2.000000e+00
  %12 = fmul double %11, %7
  %13 = add nuw i32 %spec.select, 1
  %wide.trip.count = zext i32 %13 to i64
  br label %17

.preheader:                                       ; preds = %17
  %wide.trip.count40 = zext nneg i32 %spec.select to i64
  %min.iters.check = icmp slt i32 %9, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %vector.body, %.preheader
  %indvars.iv37.ph = phi i64 [ 0, %.preheader ], [ %n.vec, %vector.body ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader
  %n.vec = and i64 %wide.trip.count40, 2147483644
  %broadcast.splatinsert = insertelement <4 x float> poison, float %28, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %14 = getelementptr inbounds [100 x float], ptr %6, i64 0, i64 %index
  %wide.load = load <4 x float>, ptr %14, align 16, !tbaa !5
  %15 = fdiv <4 x float> %wide.load, %broadcast.splat
  store <4 x float> %15, ptr %14, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %16 = icmp eq i64 %index.next, %n.vec
  br i1 %16, label %scalar.ph.preheader, label %vector.body, !llvm.loop !9

17:                                               ; preds = %5, %17
  %indvars.iv = phi i64 [ 0, %5 ], [ %indvars.iv.next, %17 ]
  %.03133 = phi float [ 0.000000e+00, %5 ], [ %28, %17 ]
  %18 = trunc i64 %indvars.iv to i32
  %19 = sub i32 %18, %.neg32
  %20 = sitofp i32 %19 to float
  %21 = fneg float %20
  %22 = fmul float %21, %20
  %23 = fpext float %22 to double
  %24 = fdiv double %23, %12
  %25 = tail call double @exp(double noundef %24) #5
  %26 = fptrunc double %25 to float
  %27 = getelementptr inbounds [100 x float], ptr %6, i64 0, i64 %indvars.iv
  store float %26, ptr %27, align 4, !tbaa !5
  %28 = fadd float %.03133, %26
  %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 %17, !llvm.loop !13

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv37 = phi i64 [ %indvars.iv.next38, %scalar.ph ], [ %indvars.iv37.ph, %scalar.ph.preheader ]
  %29 = getelementptr inbounds [100 x float], ptr %6, i64 0, i64 %indvars.iv37
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = fdiv float %30, %28
  store float %31, ptr %29, align 4, !tbaa !5
  %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
  %exitcond41.not = icmp eq i64 %indvars.iv.next38, %wide.trip.count40
  br i1 %exitcond41.not, label %.loopexit, label %scalar.ph, !llvm.loop !14

.loopexit:                                        ; preds = %scalar.ph
  %32 = icmp eq i32 %4, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %.loopexit
  call void @_Z14ConvHorizontalRSt6vectorIfSaIfEEiiPfi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %1, i32 noundef %2, ptr noundef nonnull %6, i32 noundef %spec.select)
  br label %35

34:                                               ; preds = %.loopexit
  call void @_Z12ConvVerticalRSt6vectorIfSaIfEEiiPfi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %1, i32 noundef %2, ptr noundef nonnull %6, i32 noundef %spec.select)
  br label %35

35:                                               ; preds = %34, %33
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %6) #5
  ret void
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @exp(double noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }

!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 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass