; LLVM IR from ermig1979/Simd :: src/Simd/SimdBaseRecursiveBilateralFilter.ll (ZN4Simd8RbfParam4InitEv)

; 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.Simd::RbfParam" = type <{ i64, i64, i64, float, float, i32, [4 x i8], i64, float, [256 x float], [4 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd8RbfParam4InitEv(ptr noundef nonnull align 8 dereferenceable(1076) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %8 = call noundef float @_ZSt4sqrtf(float noundef 2.000000e+00)
  %9 = fneg float %8
  %10 = getelementptr inbounds %"struct.Simd::RbfParam", ptr %7, i32 0, i32 3
  %11 = load float, ptr %10, align 8, !tbaa !9
  %12 = fmul float %11, 2.550000e+02
  %13 = fdiv float %9, %12
  %14 = call noundef float @_ZSt3expf(float noundef %13)
  store float %14, ptr %3, align 4, !tbaa !14
  %15 = load float, ptr %3, align 4, !tbaa !14
  %16 = fsub float 1.000000e+00, %15
  %17 = getelementptr inbounds %"struct.Simd::RbfParam", ptr %7, i32 0, i32 8
  store float %16, ptr %17, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %18 = getelementptr inbounds %"struct.Simd::RbfParam", ptr %7, i32 0, i32 4
  %19 = load float, ptr %18, align 4, !tbaa !16
  %20 = fmul float %19, 2.550000e+02
  %21 = fdiv float 1.000000e+00, %20
  store float %21, ptr %4, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store float 0.000000e+00, ptr %5, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !17
  br label %22

22:                                               ; preds = %37, %1
  %23 = load i32, ptr %6, align 4, !tbaa !17
  %24 = icmp slt i32 %23, 256
  br i1 %24, label %26, label %25

25:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %42

26:                                               ; preds = %22
  %27 = load float, ptr %3, align 4, !tbaa !14
  %28 = load float, ptr %5, align 4, !tbaa !14
  %29 = load float, ptr %4, align 4, !tbaa !14
  %30 = fmul float %28, %29
  %31 = call noundef float @_ZSt3expf(float noundef %30)
  %32 = fmul float %27, %31
  %33 = getelementptr inbounds %"struct.Simd::RbfParam", ptr %7, i32 0, i32 9
  %34 = load i32, ptr %6, align 4, !tbaa !17
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [256 x float], ptr %33, i64 0, i64 %35
  store float %32, ptr %36, align 4, !tbaa !14
  br label %37

37:                                               ; preds = %26
  %38 = load i32, ptr %6, align 4, !tbaa !17
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %6, align 4, !tbaa !17
  %40 = load float, ptr %5, align 4, !tbaa !14
  %41 = fsub float %40, 1.000000e+00
  store float %41, ptr %5, align 4, !tbaa !14
  br label %22, !llvm.loop !19

42:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

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

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

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

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

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 nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 24}
!10 = !{!"_ZTSN4Simd8RbfParamE", !11, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 28, !13, i64 32, !11, i64 40, !12, i64 48, !7, i64 52}
!11 = !{!"long", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"_ZTS33SimdRecursiveBilateralFilterFlags", !7, i64 0}
!14 = !{!12, !12, i64 0}
!15 = !{!10, !12, i64 48}
!16 = !{!10, !12, i64 28}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"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 nounwind uwtable
define dso_local void @_ZN4Simd8RbfParam4InitEv(ptr nocapture noundef nonnull align 8 dereferenceable(1076) %0) local_unnamed_addr #0 align 2 {
  %2 = tail call noundef float @_ZSt4sqrtf(float noundef 2.000000e+00)
  %3 = fneg float %2
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = load float, ptr %4, align 8, !tbaa !5
  %6 = fmul float %5, 2.550000e+02
  %7 = fdiv float %3, %6
  %8 = tail call noundef float @_ZSt3expf(float noundef %7)
  %9 = fsub float 1.000000e+00, %8
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  store float %9, ptr %10, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %0, i64 28
  %12 = load float, ptr %11, align 4, !tbaa !13
  %13 = fmul float %12, 2.550000e+02
  %14 = fdiv float 1.000000e+00, %13
  %15 = getelementptr inbounds i8, ptr %0, i64 52
  br label %17

16:                                               ; preds = %17
  ret void

17:                                               ; preds = %1, %17
  %indvars.iv = phi i64 [ 0, %1 ], [ %indvars.iv.next, %17 ]
  %.089 = phi float [ 0.000000e+00, %1 ], [ %22, %17 ]
  %18 = fmul float %14, %.089
  %19 = tail call noundef float @_ZSt3expf(float noundef %18)
  %20 = fmul float %8, %19
  %21 = getelementptr inbounds [256 x float], ptr %15, i64 0, i64 %indvars.iv
  store float %20, ptr %21, align 4, !tbaa !14
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = fadd float %.089, -1.000000e+00
  %exitcond.not = icmp eq i64 %indvars.iv.next, 256
  br i1 %exitcond.not, label %16, label %17, !llvm.loop !15
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3expf(float noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4sqrtf(float noundef) local_unnamed_addr #1

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 = { 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, !10, i64 24}
!6 = !{!"_ZTSN4Simd8RbfParamE", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !11, i64 32, !7, i64 40, !10, i64 48, !8, i64 52}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"_ZTS33SimdRecursiveBilateralFilterFlags", !8, i64 0}
!12 = !{!6, !10, i64 48}
!13 = !{!6, !10, i64 28}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass