; LLVM IR from cpuimage/cpuimagelib :: cpuimage (CalGaussianCoeff)

; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; 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: nounwind
declare float @expf(float noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @CalGaussianCoeff(float noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8) #3 {
  %10 = alloca float, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  store float %0, ptr %10, align 4, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !9
  store ptr %2, ptr %12, align 8, !tbaa !9
  store ptr %3, ptr %13, align 8, !tbaa !9
  store ptr %4, ptr %14, align 8, !tbaa !9
  store ptr %5, ptr %15, align 8, !tbaa !9
  store ptr %6, ptr %16, align 8, !tbaa !9
  store ptr %7, ptr %17, align 8, !tbaa !9
  store ptr %8, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %22 = load float, ptr %10, align 4, !tbaa !5
  %23 = fcmp olt float %22, 5.000000e-01
  br i1 %23, label %24, label %25

24:                                               ; preds = %9
  store float 5.000000e-01, ptr %10, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %24, %9
  %26 = call float @expf(float noundef 0x3FE0DDCE80000000) #4, !tbaa !11
  %27 = load float, ptr %10, align 4, !tbaa !5
  %28 = fdiv float %26, %27
  store float %28, ptr %19, align 4, !tbaa !5
  %29 = load float, ptr %19, align 4, !tbaa !5
  %30 = fneg float %29
  %31 = call float @expf(float noundef %30) #4, !tbaa !11
  store float %31, ptr %20, align 4, !tbaa !5
  %32 = load float, ptr %19, align 4, !tbaa !5
  %33 = fmul float -2.000000e+00, %32
  %34 = call float @expf(float noundef %33) #4, !tbaa !11
  %35 = load ptr, ptr %16, align 8, !tbaa !9
  store float %34, ptr %35, align 4, !tbaa !5
  %36 = load float, ptr %20, align 4, !tbaa !5
  %37 = fsub float 1.000000e+00, %36
  %38 = load float, ptr %20, align 4, !tbaa !5
  %39 = fsub float 1.000000e+00, %38
  %40 = fmul float %37, %39
  %41 = load float, ptr %19, align 4, !tbaa !5
  %42 = fmul float 2.000000e+00, %41
  %43 = load float, ptr %20, align 4, !tbaa !5
  %44 = call float @llvm.fmuladd.f32(float %42, float %43, float 1.000000e+00)
  %45 = load ptr, ptr %16, align 8, !tbaa !9
  %46 = load float, ptr %45, align 4, !tbaa !5
  %47 = fsub float %44, %46
  %48 = fdiv float %40, %47
  store float %48, ptr %21, align 4, !tbaa !5
  %49 = load float, ptr %21, align 4, !tbaa !5
  %50 = load ptr, ptr %11, align 8, !tbaa !9
  store float %49, ptr %50, align 4, !tbaa !5
  %51 = load float, ptr %21, align 4, !tbaa !5
  %52 = load float, ptr %19, align 4, !tbaa !5
  %53 = fsub float %52, 1.000000e+00
  %54 = fmul float %51, %53
  %55 = load float, ptr %20, align 4, !tbaa !5
  %56 = fmul float %54, %55
  %57 = load ptr, ptr %12, align 8, !tbaa !9
  store float %56, ptr %57, align 4, !tbaa !5
  %58 = load float, ptr %21, align 4, !tbaa !5
  %59 = load float, ptr %19, align 4, !tbaa !5
  %60 = fadd float %59, 1.000000e+00
  %61 = fmul float %58, %60
  %62 = load float, ptr %20, align 4, !tbaa !5
  %63 = fmul float %61, %62
  %64 = load ptr, ptr %13, align 8, !tbaa !9
  store float %63, ptr %64, align 4, !tbaa !5
  %65 = load float, ptr %21, align 4, !tbaa !5
  %66 = fneg float %65
  %67 = load ptr, ptr %16, align 8, !tbaa !9
  %68 = load float, ptr %67, align 4, !tbaa !5
  %69 = fmul float %66, %68
  %70 = load ptr, ptr %14, align 8, !tbaa !9
  store float %69, ptr %70, align 4, !tbaa !5
  %71 = load float, ptr %20, align 4, !tbaa !5
  %72 = fmul float -2.000000e+00, %71
  %73 = load ptr, ptr %15, align 8, !tbaa !9
  store float %72, ptr %73, align 4, !tbaa !5
  %74 = load ptr, ptr %11, align 8, !tbaa !9
  %75 = load float, ptr %74, align 4, !tbaa !5
  %76 = load ptr, ptr %12, align 8, !tbaa !9
  %77 = load float, ptr %76, align 4, !tbaa !5
  %78 = fadd float %75, %77
  %79 = load ptr, ptr %15, align 8, !tbaa !9
  %80 = load float, ptr %79, align 4, !tbaa !5
  %81 = fadd float 1.000000e+00, %80
  %82 = load ptr, ptr %16, align 8, !tbaa !9
  %83 = load float, ptr %82, align 4, !tbaa !5
  %84 = fadd float %81, %83
  %85 = fdiv float %78, %84
  %86 = load ptr, ptr %17, align 8, !tbaa !9
  store float %85, ptr %86, align 4, !tbaa !5
  %87 = load ptr, ptr %13, align 8, !tbaa !9
  %88 = load float, ptr %87, align 4, !tbaa !5
  %89 = load ptr, ptr %14, align 8, !tbaa !9
  %90 = load float, ptr %89, align 4, !tbaa !5
  %91 = fadd float %88, %90
  %92 = load ptr, ptr %15, align 8, !tbaa !9
  %93 = load float, ptr %92, align 4, !tbaa !5
  %94 = fadd float 1.000000e+00, %93
  %95 = load ptr, ptr %16, align 8, !tbaa !9
  %96 = load float, ptr %95, align 4, !tbaa !5
  %97 = fadd float %94, %96
  %98 = fdiv float %91, %97
  %99 = load ptr, ptr %18, align 8, !tbaa !9
  store float %98, ptr %99, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @expf(float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local void @CalGaussianCoeff(float noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3, ptr nocapture noundef %4, ptr nocapture noundef %5, ptr nocapture noundef %6, ptr nocapture noundef writeonly %7, ptr nocapture noundef writeonly %8) local_unnamed_addr #2 {
  %10 = fcmp olt float %0, 5.000000e-01
  %.0 = select i1 %10, float 5.000000e-01, float %0
  %11 = fdiv float 0x3FFB1A8240000000, %.0
  %12 = fneg float %11
  %13 = tail call float @expf(float noundef %12) #3, !tbaa !5
  %14 = fmul float %11, -2.000000e+00
  %15 = tail call float @expf(float noundef %14) #3, !tbaa !5
  store float %15, ptr %6, align 4, !tbaa !9
  %16 = fsub float 1.000000e+00, %13
  %17 = fmul float %16, %16
  %18 = fmul float %11, 2.000000e+00
  %19 = tail call float @llvm.fmuladd.f32(float %18, float %13, float 1.000000e+00)
  %20 = fsub float %19, %15
  %21 = fdiv float %17, %20
  store float %21, ptr %1, align 4, !tbaa !9
  %22 = fadd float %11, -1.000000e+00
  %23 = fmul float %22, %21
  %24 = fmul float %13, %23
  store float %24, ptr %2, align 4, !tbaa !9
  %25 = fadd float %11, 1.000000e+00
  %26 = fmul float %25, %21
  %27 = fmul float %13, %26
  store float %27, ptr %3, align 4, !tbaa !9
  %28 = fneg float %21
  %29 = load float, ptr %6, align 4, !tbaa !9
  %30 = fmul float %29, %28
  store float %30, ptr %4, align 4, !tbaa !9
  %31 = fmul float %13, -2.000000e+00
  store float %31, ptr %5, align 4, !tbaa !9
  %32 = load float, ptr %1, align 4, !tbaa !9
  %33 = load float, ptr %2, align 4, !tbaa !9
  %34 = fadd float %32, %33
  %35 = fadd float %31, 1.000000e+00
  %36 = load float, ptr %6, align 4, !tbaa !9
  %37 = fadd float %35, %36
  %38 = fdiv float %34, %37
  store float %38, ptr %7, align 4, !tbaa !9
  %39 = load float, ptr %3, align 4, !tbaa !9
  %40 = load float, ptr %4, align 4, !tbaa !9
  %41 = fadd float %39, %40
  %42 = load float, ptr %5, align 4, !tbaa !9
  %43 = fadd float %42, 1.000000e+00
  %44 = load float, ptr %6, align 4, !tbaa !9
  %45 = fadd float %43, %44
  %46 = fdiv float %41, %45
  store float %46, ptr %8, align 4, !tbaa !9
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass