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

; 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.3 = type <{ ptr, i32, i32, i32, [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) #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_I8BitCountE(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(20) %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.3, ptr %22, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !17
  %25 = trunc i32 %24 to i8
  %26 = call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %13, float noundef %17, float noundef %21, i8 noundef zeroext %25, float noundef 0.000000e+00)
  %27 = getelementptr inbounds %struct.Vec, ptr %0, i32 0, i32 1
  store float %26, ptr %27, align 8, !tbaa !20
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.Vec.0, ptr %28, i32 0, i32 2
  %30 = load i64, ptr %29, align 8, !tbaa !21
  %31 = trunc i64 %30 to i32
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.BoundingBox, ptr %32, i32 0, i32 0
  %34 = getelementptr inbounds %struct.Vec, ptr %33, i32 0, i32 2
  %35 = load float, ptr %34, align 4, !tbaa !22
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.BoundingBox, ptr %36, i32 0, i32 1
  %38 = getelementptr inbounds %struct.Vec, ptr %37, i32 0, i32 2
  %39 = load float, ptr %38, align 4, !tbaa !23
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.Vec.3, ptr %40, i32 0, i32 2
  %42 = load i32, ptr %41, align 4, !tbaa !24
  %43 = trunc i32 %42 to i8
  %44 = call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %31, float noundef %35, float noundef %39, i8 noundef zeroext %43, float noundef 0.000000e+00)
  %45 = getelementptr inbounds %struct.Vec, ptr %0, i32 0, i32 2
  store float %44, ptr %45, align 4, !tbaa !25
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.Vec.0, ptr %46, i32 0, i32 3
  %48 = load i64, ptr %47, align 8, !tbaa !26
  %49 = trunc i64 %48 to i32
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.BoundingBox, ptr %50, i32 0, i32 0
  %52 = getelementptr inbounds %struct.Vec, ptr %51, i32 0, i32 3
  %53 = load float, ptr %52, align 8, !tbaa !27
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.BoundingBox, ptr %54, i32 0, i32 1
  %56 = getelementptr inbounds %struct.Vec, ptr %55, i32 0, i32 3
  %57 = load float, ptr %56, align 8, !tbaa !28
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.Vec.3, ptr %58, i32 0, i32 3
  %60 = load i32, ptr %59, align 8, !tbaa !29
  %61 = trunc i32 %60 to i8
  %62 = call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %49, float noundef %53, float noundef %57, i8 noundef zeroext %61, float noundef 0.000000e+00)
  %63 = getelementptr inbounds %struct.Vec, ptr %0, i32 0, i32 3
  store float %62, ptr %63, align 8, !tbaa !30
  store i1 true, ptr %9, align 1
  %64 = load i1, ptr %9, align 1
  br i1 %64, label %66, label %65

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

66:                                               ; preds = %65, %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, !19, i64 8}
!18 = !{!"_ZTS3VecI8BitCountE", !19, i64 8, !19, i64 12, !19, i64 16}
!19 = !{!"_ZTS8BitCount", !7, i64 0}
!20 = !{!14, !15, i64 8}
!21 = !{!10, !11, i64 16}
!22 = !{!13, !15, i64 12}
!23 = !{!13, !15, i64 36}
!24 = !{!18, !19, i64 12}
!25 = !{!14, !15, i64 12}
!26 = !{!10, !11, i64 24}
!27 = !{!13, !15, i64 16}
!28 = !{!13, !15, i64 40}
!29 = !{!18, !19, i64 16}
!30 = !{!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_I8BitCountE(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(20) %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 i32, ptr %12, align 8, !tbaa !15
  %14 = trunc i32 %13 to i8
  %15 = tail call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %7, float noundef %9, float noundef %11, i8 noundef zeroext %14, float noundef 0.000000e+00)
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  store float %15, ptr %16, align 8, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %1, i64 16
  %18 = load i64, ptr %17, align 8, !tbaa !19
  %19 = trunc i64 %18 to i32
  %20 = getelementptr inbounds i8, ptr %2, i64 12
  %21 = load float, ptr %20, align 4, !tbaa !20
  %22 = getelementptr inbounds i8, ptr %2, i64 36
  %23 = load float, ptr %22, align 4, !tbaa !21
  %24 = getelementptr inbounds i8, ptr %3, i64 12
  %25 = load i32, ptr %24, align 4, !tbaa !22
  %26 = trunc i32 %25 to i8
  %27 = tail call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %19, float noundef %21, float noundef %23, i8 noundef zeroext %26, float noundef 0.000000e+00)
  %28 = getelementptr inbounds i8, ptr %0, i64 12
  store float %27, ptr %28, align 4, !tbaa !23
  %29 = getelementptr inbounds i8, ptr %1, i64 24
  %30 = load i64, ptr %29, align 8, !tbaa !24
  %31 = trunc i64 %30 to i32
  %32 = getelementptr inbounds i8, ptr %2, i64 16
  %33 = load float, ptr %32, align 8, !tbaa !25
  %34 = getelementptr inbounds i8, ptr %2, i64 40
  %35 = load float, ptr %34, align 8, !tbaa !26
  %36 = getelementptr inbounds i8, ptr %3, i64 16
  %37 = load i32, ptr %36, align 8, !tbaa !27
  %38 = trunc i32 %37 to i8
  %39 = tail call noundef float @_ZN7Encoder10mapFromBitEjffhf(i32 noundef %31, float noundef %33, float noundef %35, i8 noundef zeroext %38, float noundef 0.000000e+00)
  %40 = getelementptr inbounds i8, ptr %0, i64 16
  store float %39, ptr %40, align 8, !tbaa !28
  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, !17, i64 8}
!16 = !{!"_ZTS3VecI8BitCountE", !17, i64 8, !17, i64 12, !17, i64 16}
!17 = !{!"_ZTS8BitCount", !8, i64 0}
!18 = !{!12, !13, i64 8}
!19 = !{!6, !7, i64 16}
!20 = !{!11, !13, i64 12}
!21 = !{!11, !13, i64 36}
!22 = !{!16, !17, i64 12}
!23 = !{!12, !13, i64 12}
!24 = !{!6, !7, i64 24}
!25 = !{!11, !13, i64 16}
!26 = !{!11, !13, i64 40}
!27 = !{!16, !17, i64 16}
!28 = !{!12, !13, i64 16}


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