; LLVM IR from b00dle/libpcc :: src/Encoder.ll (ZN7Encoder13mapVecToFloatERK3VecImERK11BoundingBoxRKS0_IhE)

; 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.Vec = type <{ ptr, float, float, float, [4 x i8] }>
%struct.Vec.0 = type { ptr, i64, i64, i64 }
%struct.BoundingBox = type { %struct.Vec, %struct.Vec }
%struct.Vec.1 = type <{ ptr, i8, i8, i8, [5 x i8] }>

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef, float noundef, float noundef, i8 noundef zeroext, float noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3VecIfEC2Efff(ptr noundef nonnull align 8 dereferenceable(20), float noundef, float noundef, float noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3VecIfED2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Encoder13mapVecToFloatERK3VecImERK11BoundingBoxRKS0_IhE(ptr dead_on_unwind noalias writable sret(%struct.Vec) align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(11) %3) #1 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i1, align 1
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  store i1 false, ptr %9, align 1
  call void @_ZN3VecIfEC2Efff(ptr noundef nonnull align 8 dereferenceable(20) %0, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %10 = load ptr, ptr %6, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.Vec.0, ptr %10, i32 0, i32 1
  %12 = load i64, ptr %11, align 8, !tbaa !9
  %13 = trunc i64 %12 to i32
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.BoundingBox, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds %struct.Vec, ptr %15, i32 0, i32 1
  %17 = load float, ptr %16, align 8, !tbaa !12
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.BoundingBox, ptr %18, i32 0, i32 1
  %20 = getelementptr inbounds %struct.Vec, ptr %19, i32 0, i32 1
  %21 = load float, ptr %20, align 8, !tbaa !16
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.Vec.1, ptr %22, i32 0, i32 1
  %24 = load i8, ptr %23, align 8, !tbaa !17
  %25 = call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %13, float noundef %17, float noundef %21, i8 noundef zeroext %24, float noundef 0.000000e+00)
  %26 = getelementptr inbounds %struct.Vec, ptr %0, i32 0, i32 1
  store float %25, ptr %26, align 8, !tbaa !19
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.Vec.0, ptr %27, i32 0, i32 2
  %29 = load i64, ptr %28, align 8, !tbaa !20
  %30 = trunc i64 %29 to i32
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.BoundingBox, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.Vec, ptr %32, i32 0, i32 2
  %34 = load float, ptr %33, align 4, !tbaa !21
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.BoundingBox, ptr %35, i32 0, i32 1
  %37 = getelementptr inbounds %struct.Vec, ptr %36, i32 0, i32 2
  %38 = load float, ptr %37, align 4, !tbaa !22
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.Vec.1, ptr %39, i32 0, i32 2
  %41 = load i8, ptr %40, align 1, !tbaa !23
  %42 = call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %30, float noundef %34, float noundef %38, i8 noundef zeroext %41, float noundef 0.000000e+00)
  %43 = getelementptr inbounds %struct.Vec, ptr %0, i32 0, i32 2
  store float %42, ptr %43, align 4, !tbaa !24
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.Vec.0, ptr %44, i32 0, i32 3
  %46 = load i64, ptr %45, align 8, !tbaa !25
  %47 = trunc i64 %46 to i32
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.BoundingBox, ptr %48, i32 0, i32 0
  %50 = getelementptr inbounds %struct.Vec, ptr %49, i32 0, i32 3
  %51 = load float, ptr %50, align 8, !tbaa !26
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.BoundingBox, ptr %52, i32 0, i32 1
  %54 = getelementptr inbounds %struct.Vec, ptr %53, i32 0, i32 3
  %55 = load float, ptr %54, align 8, !tbaa !27
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.Vec.1, ptr %56, i32 0, i32 3
  %58 = load i8, ptr %57, align 2, !tbaa !28
  %59 = call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %47, float noundef %51, float noundef %55, i8 noundef zeroext %58, float noundef 0.000000e+00)
  %60 = getelementptr inbounds %struct.Vec, ptr %0, i32 0, i32 3
  store float %59, ptr %60, align 8, !tbaa !29
  store i1 true, ptr %9, align 1
  %61 = load i1, ptr %9, align 1
  br i1 %61, label %63, label %62

62:                                               ; preds = %4
  call void @_ZN3VecIfED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %0) #2
  br label %63

63:                                               ; preds = %62, %4
  ret void
}

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 = { 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, !11, i64 8}
!10 = !{!"_ZTS3VecImE", !11, i64 8, !11, i64 16, !11, i64 24}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !15, i64 8}
!13 = !{!"_ZTS11BoundingBox", !14, i64 0, !14, i64 24}
!14 = !{!"_ZTS3VecIfE", !15, i64 8, !15, i64 12, !15, i64 16}
!15 = !{!"float", !7, i64 0}
!16 = !{!13, !15, i64 32}
!17 = !{!18, !7, i64 8}
!18 = !{!"_ZTS3VecIhE", !7, i64 8, !7, i64 9, !7, i64 10}
!19 = !{!14, !15, i64 8}
!20 = !{!10, !11, i64 16}
!21 = !{!13, !15, i64 12}
!22 = !{!13, !15, i64 36}
!23 = !{!18, !7, i64 9}
!24 = !{!14, !15, i64 12}
!25 = !{!10, !11, i64 24}
!26 = !{!13, !15, i64 16}
!27 = !{!13, !15, i64 40}
!28 = !{!18, !7, i64 10}
!29 = !{!14, !15, i64 16}


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

%struct.Vec = type <{ ptr, float, float, float, [4 x i8] }>

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef, float noundef, float noundef, i8 noundef zeroext, float noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3VecIfEC2Efff(ptr noundef nonnull align 8 dereferenceable(20), float noundef, float noundef, float noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7Encoder13mapVecToFloatERK3VecImERK11BoundingBoxRKS0_IhE(ptr dead_on_unwind noalias nonnull writable sret(%struct.Vec) align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(32) %1, ptr nocapture noundef nonnull readonly align 8 dereferenceable(48) %2, ptr nocapture noundef nonnull readonly align 8 dereferenceable(11) %3) local_unnamed_addr #0 align 2 {
  tail call void @_ZN3VecIfEC2Efff(ptr noundef nonnull align 8 dereferenceable(20) %0, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = trunc i64 %6 to i32
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  %9 = load float, ptr %8, align 8, !tbaa !10
  %10 = getelementptr inbounds i8, ptr %2, i64 32
  %11 = load float, ptr %10, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %3, i64 8
  %13 = load i8, ptr %12, align 8, !tbaa !15
  %14 = tail call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %7, float noundef %9, float noundef %11, i8 noundef zeroext %13, float noundef 0.000000e+00)
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  store float %14, ptr %15, align 8, !tbaa !17
  %16 = getelementptr inbounds i8, ptr %1, i64 16
  %17 = load i64, ptr %16, align 8, !tbaa !18
  %18 = trunc i64 %17 to i32
  %19 = getelementptr inbounds i8, ptr %2, i64 12
  %20 = load float, ptr %19, align 4, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %2, i64 36
  %22 = load float, ptr %21, align 4, !tbaa !20
  %23 = getelementptr inbounds i8, ptr %3, i64 9
  %24 = load i8, ptr %23, align 1, !tbaa !21
  %25 = tail call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %18, float noundef %20, float noundef %22, i8 noundef zeroext %24, float noundef 0.000000e+00)
  %26 = getelementptr inbounds i8, ptr %0, i64 12
  store float %25, ptr %26, align 4, !tbaa !22
  %27 = getelementptr inbounds i8, ptr %1, i64 24
  %28 = load i64, ptr %27, align 8, !tbaa !23
  %29 = trunc i64 %28 to i32
  %30 = getelementptr inbounds i8, ptr %2, i64 16
  %31 = load float, ptr %30, align 8, !tbaa !24
  %32 = getelementptr inbounds i8, ptr %2, i64 40
  %33 = load float, ptr %32, align 8, !tbaa !25
  %34 = getelementptr inbounds i8, ptr %3, i64 10
  %35 = load i8, ptr %34, align 2, !tbaa !26
  %36 = tail call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %29, float noundef %31, float noundef %33, i8 noundef zeroext %35, float noundef 0.000000e+00)
  %37 = getelementptr inbounds i8, ptr %0, i64 16
  store float %36, ptr %37, align 8, !tbaa !27
  ret void
}

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

!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, !7, i64 8}
!6 = !{!"_ZTS3VecImE", !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !13, i64 8}
!11 = !{!"_ZTS11BoundingBox", !12, i64 0, !12, i64 24}
!12 = !{!"_ZTS3VecIfE", !13, i64 8, !13, i64 12, !13, i64 16}
!13 = !{!"float", !8, i64 0}
!14 = !{!11, !13, i64 32}
!15 = !{!16, !8, i64 8}
!16 = !{!"_ZTS3VecIhE", !8, i64 8, !8, i64 9, !8, i64 10}
!17 = !{!12, !13, i64 8}
!18 = !{!6, !7, i64 16}
!19 = !{!11, !13, i64 12}
!20 = !{!11, !13, i64 36}
!21 = !{!16, !8, i64 9}
!22 = !{!12, !13, i64 12}
!23 = !{!6, !7, i64 24}
!24 = !{!11, !13, i64 16}
!25 = !{!11, !13, i64 40}
!26 = !{!16, !8, i64 10}
!27 = !{!12, !13, i64 16}


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