; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/src/util (MappedValue)

; 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.daisy::MappedFloatValue" = type <{ %"class.daisy::MappedValue", float, float, float, float, i32, [4 x i8], ptr, i8, i8, [6 x i8] }>
%"class.daisy::MappedValue" = type { ptr }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZNK5daisy16MappedFloatValue9GetAs0to1Ev(ptr noundef nonnull align 8 dereferenceable(42) %0) unnamed_addr #1 align 2 {
  %2 = alloca float, align 4
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8
  %13 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 5
  %14 = load i32, ptr %13, align 8, !tbaa !9
  switch i32 %14, label %63 [
    i32 0, label %15
    i32 1, label %27
    i32 2, label %46
  ]

15:                                               ; preds = %1
  %16 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 1
  %17 = load float, ptr %16, align 8, !tbaa !15
  %18 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 2
  %19 = load float, ptr %18, align 4, !tbaa !16
  %20 = fsub float %17, %19
  %21 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 3
  %22 = load float, ptr %21, align 8, !tbaa !17
  %23 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 2
  %24 = load float, ptr %23, align 4, !tbaa !16
  %25 = fsub float %22, %24
  %26 = fdiv float %20, %25
  store float %26, ptr %2, align 4
  br label %64

27:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %28 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 3
  %29 = load float, ptr %28, align 8, !tbaa !17
  %30 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 2
  %31 = load float, ptr %30, align 4, !tbaa !16
  %32 = fdiv float %29, %31
  %33 = call float @log10f(float noundef %32) #4
  %34 = fdiv float 1.000000e+00, %33
  store float %34, ptr %4, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store float 0.000000e+00, ptr %5, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store float 1.000000e+00, ptr %6, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %35 = load float, ptr %4, align 4, !tbaa !18
  %36 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 1
  %37 = load float, ptr %36, align 8, !tbaa !15
  %38 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 2
  %39 = load float, ptr %38, align 4, !tbaa !16
  %40 = fdiv float %37, %39
  %41 = call float @log10f(float noundef %40) #4
  %42 = fmul float %35, %41
  store float %42, ptr %7, align 4, !tbaa !18
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %43)
  %45 = load float, ptr %44, align 4, !tbaa !18
  store float %45, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %64

46:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %47 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 1
  %48 = load float, ptr %47, align 8, !tbaa !15
  %49 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 2
  %50 = load float, ptr %49, align 4, !tbaa !16
  %51 = fsub float %48, %50
  %52 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 3
  %53 = load float, ptr %52, align 8, !tbaa !17
  %54 = getelementptr inbounds %"class.daisy::MappedFloatValue", ptr %12, i32 0, i32 2
  %55 = load float, ptr %54, align 4, !tbaa !16
  %56 = fsub float %53, %55
  %57 = fdiv float %51, %56
  store float %57, ptr %8, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store float 0.000000e+00, ptr %9, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store float 1.000000e+00, ptr %10, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %58 = load float, ptr %8, align 4, !tbaa !18
  %59 = call float @sqrtf(float noundef %58) #4
  store float %59, ptr %11, align 4, !tbaa !18
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %60)
  %62 = load float, ptr %61, align 4, !tbaa !18
  store float %62, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %64

63:                                               ; preds = %1
  store float 0.000000e+00, ptr %2, align 4
  br label %64

64:                                               ; preds = %63, %46, %27, %15
  %65 = load float, ptr %2, align 4
  ret float %65
}

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

; Function Attrs: nounwind
declare float @log10f(float noundef) #3

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

; Function Attrs: nounwind
declare float @sqrtf(float noundef) #3

attributes #0 = { 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 #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 willreturn memory(argmem: readwrite) }
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, !13, i64 24}
!10 = !{!"_ZTSN5daisy16MappedFloatValueE", !11, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !13, i64 24, !6, i64 32, !7, i64 40, !14, i64 41}
!11 = !{!"_ZTSN5daisy11MappedValueE"}
!12 = !{!"float", !7, i64 0}
!13 = !{!"_ZTSN5daisy16MappedFloatValue7MappingE", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!10, !12, i64 8}
!16 = !{!10, !12, i64 12}
!17 = !{!10, !12, i64 16}
!18 = !{!12, !12, 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_ZNK5daisy16MappedFloatValue9GetAs0to1Ev(ptr nocapture noundef nonnull readonly align 8 dereferenceable(42) %0) unnamed_addr #1 align 2 {
  %2 = alloca float, align 4
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = load i32, ptr %8, align 8, !tbaa !5
  switch i32 %9, label %51 [
    i32 0, label %10
    i32 1, label %20
    i32 2, label %37
  ]

10:                                               ; preds = %1
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load float, ptr %11, align 8, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %0, i64 12
  %14 = load float, ptr %13, align 4, !tbaa !15
  %15 = fsub float %12, %14
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  %17 = load float, ptr %16, align 8, !tbaa !16
  %18 = fsub float %17, %14
  %19 = fdiv float %15, %18
  br label %51

20:                                               ; preds = %1
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  %22 = load float, ptr %21, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %0, i64 12
  %24 = load float, ptr %23, align 4, !tbaa !15
  %25 = fdiv float %22, %24
  %26 = tail call float @log10f(float noundef %25) #4
  %27 = fdiv float 1.000000e+00, %26
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  store float 0.000000e+00, ptr %2, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  store float 1.000000e+00, ptr %3, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %28 = getelementptr inbounds i8, ptr %0, i64 8
  %29 = load float, ptr %28, align 8, !tbaa !14
  %30 = load float, ptr %23, align 4, !tbaa !15
  %31 = fdiv float %29, %30
  %32 = tail call float @log10f(float noundef %31) #4
  %33 = fmul float %27, %32
  store float %33, ptr %4, align 4, !tbaa !17
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %35 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %34)
  %36 = load float, ptr %35, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  br label %51

37:                                               ; preds = %1
  %38 = getelementptr inbounds i8, ptr %0, i64 8
  %39 = load float, ptr %38, align 8, !tbaa !14
  %40 = getelementptr inbounds i8, ptr %0, i64 12
  %41 = load float, ptr %40, align 4, !tbaa !15
  %42 = fsub float %39, %41
  %43 = getelementptr inbounds i8, ptr %0, i64 16
  %44 = load float, ptr %43, align 8, !tbaa !16
  %45 = fsub float %44, %41
  %46 = fdiv float %42, %45
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  store float 0.000000e+00, ptr %5, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  store float 1.000000e+00, ptr %6, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %47 = tail call float @sqrtf(float noundef %46) #4
  store float %47, ptr %7, align 4, !tbaa !17
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %48)
  %50 = load float, ptr %49, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  br label %51

51:                                               ; preds = %1, %37, %20, %10
  %.0 = phi float [ %50, %37 ], [ %36, %20 ], [ %19, %10 ], [ 0.000000e+00, %1 ]
  ret float %.0
}

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

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

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

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !11, i64 24}
!6 = !{!"_ZTSN5daisy16MappedFloatValueE", !7, i64 0, !8, i64 8, !8, i64 12, !8, i64 16, !8, i64 20, !11, i64 24, !12, i64 32, !9, i64 40, !13, i64 41}
!7 = !{!"_ZTSN5daisy11MappedValueE"}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN5daisy16MappedFloatValue7MappingE", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"bool", !9, i64 0}
!14 = !{!6, !8, i64 8}
!15 = !{!6, !8, i64 12}
!16 = !{!6, !8, i64 16}
!17 = !{!8, !8, i64 0}


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