; LLVM IR from facebookresearch/habitat-sim :: src/deps/basis-universal/encoder/basisu_etc.ll (ZN6basisu14etc1_optimizer7computeEv)

; 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.basisu::etc1_optimizer" = type { ptr, ptr, i32, %"class.basisu::vec", i32, i32, i32, i32, %"class.basisu::vector", %"class.basisu::vector.3", %"class.basisu::vector.3", ptr, ptr, %"class.basisu::vector.5", %"class.basisu::vector.5", %"struct.basisu::etc1_optimizer::potential_solution", %"struct.basisu::etc1_optimizer::potential_solution", %"class.basisu::vector.5", [128 x i8] }
%"class.basisu::vec" = type { [3 x float] }
%"class.basisu::vector" = type { ptr, i32, i32 }
%"class.basisu::vector.3" = type { ptr, i32, i32 }
%"struct.basisu::etc1_optimizer::potential_solution" = type <{ %"struct.basisu::etc1_solution_coordinates", [4 x i8], %"class.basisu::vector.5", i64, i8, [7 x i8] }>
%"struct.basisu::etc1_solution_coordinates" = type <{ %"class.basisu::color_rgba", i32, i8, [3 x i8] }>
%"class.basisu::color_rgba" = type { %union.anon }
%union.anon = type { [4 x i8] }
%"class.basisu::vector.5" = type { ptr, i32, i32 }
%"struct.basisu::etc1_optimizer::results" = type <{ i64, %"class.basisu::color_rgba", i32, i32, [4 x i8], ptr, i8, [7 x i8] }>
%"struct.basisu::etc1_optimizer::params" = type { %"struct.basisu::basis_etc1_pack_params", i32, ptr, i8, ptr, i32, %"class.basisu::color_rgba", i8, i8, ptr }
%"struct.basisu::basis_etc1_pack_params" = type { i32, i8, i8, i8, i8, float }

@.str.3 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [24 x i8], align 1
@__PRETTY_FUNCTION__._ZN6basisu14etc1_optimizer7computeEv = external hidden unnamed_addr constant [39 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [40 x i8], align 1

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu14etc1_optimizer7computeEv(ptr noundef nonnull align 8 dereferenceable(384) %0) #3 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 1
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds %"struct.basisu::etc1_optimizer::results", ptr %9, i32 0, i32 5
  %11 = load ptr, ptr %10, align 8, !tbaa !21
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %1
  br label %16

14:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.3, i32 noundef 762, ptr noundef @__PRETTY_FUNCTION__._ZN6basisu14etc1_optimizer7computeEv) #5
  unreachable

15:                                               ; No predecessors!
  br label %16

16:                                               ; preds = %15, %13
  %17 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !23
  %19 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %18, i32 0, i32 9
  %20 = load ptr, ptr %19, align 8, !tbaa !24
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %39

22:                                               ; preds = %16
  %23 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !23
  %25 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !29
  %27 = icmp sge i32 %26, 2
  br i1 %27, label %28, label %29

28:                                               ; preds = %22
  br label %31

29:                                               ; preds = %22
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.3, i32 noundef 766, ptr noundef @__PRETTY_FUNCTION__._ZN6basisu14etc1_optimizer7computeEv) #5
  unreachable

30:                                               ; No predecessors!
  br label %31

31:                                               ; preds = %30, %28
  %32 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !23
  %34 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !29
  %36 = icmp slt i32 %35, 2
  br i1 %36, label %37, label %38

37:                                               ; preds = %31
  store i1 false, ptr %2, align 1
  br label %147

38:                                               ; preds = %31
  br label %39

39:                                               ; preds = %38, %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %40 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !23
  %42 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %41, i32 0, i32 1
  %43 = load i32, ptr %42, align 4, !tbaa !30
  store i32 %43, ptr %4, align 4, !tbaa !31
  %44 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !23
  %46 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %45, i32 0, i32 2
  %47 = load i8, ptr %46, align 1, !tbaa !32, !range !33, !noundef !34
  %48 = trunc i8 %47 to i1
  br i1 %48, label %49, label %74

49:                                               ; preds = %39
  %50 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !23
  %52 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %51, i32 0, i32 0
  %53 = load i32, ptr %52, align 8, !tbaa !29
  %54 = icmp eq i32 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %49
  call void @_ZN6basisu14etc1_optimizer28compute_internal_cluster_fitEj(ptr noundef nonnull align 8 dereferenceable(384) %7, i32 noundef 4)
  br label %73

56:                                               ; preds = %49
  %57 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !23
  %59 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !29
  %61 = icmp eq i32 %60, 1
  br i1 %61, label %62, label %63

62:                                               ; preds = %56
  call void @_ZN6basisu14etc1_optimizer28compute_internal_cluster_fitEj(ptr noundef nonnull align 8 dereferenceable(384) %7, i32 noundef 16)
  br label %72

63:                                               ; preds = %56
  %64 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !23
  %66 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %65, i32 0, i32 0
  %67 = load i32, ptr %66, align 8, !tbaa !29
  %68 = icmp eq i32 %67, 2
  br i1 %68, label %69, label %70

69:                                               ; preds = %63
  call void @_ZN6basisu14etc1_optimizer28compute_internal_cluster_fitEj(ptr noundef nonnull align 8 dereferenceable(384) %7, i32 noundef 64)
  br label %71

70:                                               ; preds = %63
  call void @_ZN6basisu14etc1_optimizer28compute_internal_cluster_fitEj(ptr noundef nonnull align 8 dereferenceable(384) %7, i32 noundef 165)
  br label %71

71:                                               ; preds = %70, %69
  br label %72

72:                                               ; preds = %71, %62
  br label %73

73:                                               ; preds = %72, %55
  br label %81

74:                                               ; preds = %39
  %75 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 4
  %76 = load i32, ptr %75, align 8, !tbaa !35
  %77 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 5
  %78 = load i32, ptr %77, align 4, !tbaa !36
  %79 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 6
  %80 = load i32, ptr %79, align 8, !tbaa !37
  call void @_ZN6basisu14etc1_optimizer29compute_internal_neighborhoodEiii(ptr noundef nonnull align 8 dereferenceable(384) %7, i32 noundef %76, i32 noundef %78, i32 noundef %80)
  br label %81

81:                                               ; preds = %74, %73
  %82 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 15
  %83 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %82, i32 0, i32 4
  %84 = load i8, ptr %83, align 8, !tbaa !38, !range !33, !noundef !34
  %85 = trunc i8 %84 to i1
  br i1 %85, label %90, label %86

86:                                               ; preds = %81
  %87 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !9
  %89 = getelementptr inbounds %"struct.basisu::etc1_optimizer::results", ptr %88, i32 0, i32 0
  store i64 4294967295, ptr %89, align 8, !tbaa !39
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %146

90:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %91 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !23
  %93 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %92, i32 0, i32 9
  %94 = load ptr, ptr %93, align 8, !tbaa !24
  %95 = icmp ne ptr %94, null
  br i1 %95, label %96, label %101

96:                                               ; preds = %90
  %97 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !23
  %99 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %98, i32 0, i32 9
  %100 = load ptr, ptr %99, align 8, !tbaa !24
  br label %105

101:                                              ; preds = %90
  %102 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 15
  %103 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %102, i32 0, i32 2
  %104 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %103, i64 noundef 0)
  br label %105

105:                                              ; preds = %101, %96
  %106 = phi ptr [ %100, %96 ], [ %104, %101 ]
  store ptr %106, ptr %6, align 8, !tbaa !5
  %107 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 15
  %108 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %107, i32 0, i32 3
  %109 = load i64, ptr %108, align 8, !tbaa !40
  %110 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 1
  %111 = load ptr, ptr %110, align 8, !tbaa !9
  %112 = getelementptr inbounds %"struct.basisu::etc1_optimizer::results", ptr %111, i32 0, i32 0
  store i64 %109, ptr %112, align 8, !tbaa !39
  %113 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 15
  %114 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %113, i32 0, i32 0
  %115 = getelementptr inbounds %"struct.basisu::etc1_solution_coordinates", ptr %114, i32 0, i32 0
  %116 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 1
  %117 = load ptr, ptr %116, align 8, !tbaa !9
  %118 = getelementptr inbounds %"struct.basisu::etc1_optimizer::results", ptr %117, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %118, ptr align 8 %115, i64 4, i1 false), !tbaa.struct !41
  %119 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 15
  %120 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %119, i32 0, i32 0
  %121 = getelementptr inbounds %"struct.basisu::etc1_solution_coordinates", ptr %120, i32 0, i32 2
  %122 = load i8, ptr %121, align 8, !tbaa !43, !range !33, !noundef !34
  %123 = trunc i8 %122 to i1
  %124 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 1
  %125 = load ptr, ptr %124, align 8, !tbaa !9
  %126 = getelementptr inbounds %"struct.basisu::etc1_optimizer::results", ptr %125, i32 0, i32 6
  %127 = zext i1 %123 to i8
  store i8 %127, ptr %126, align 8, !tbaa !44
  %128 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 15
  %129 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %128, i32 0, i32 0
  %130 = getelementptr inbounds %"struct.basisu::etc1_solution_coordinates", ptr %129, i32 0, i32 1
  %131 = load i32, ptr %130, align 4, !tbaa !45
  %132 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 1
  %133 = load ptr, ptr %132, align 8, !tbaa !9
  %134 = getelementptr inbounds %"struct.basisu::etc1_optimizer::results", ptr %133, i32 0, i32 2
  store i32 %131, ptr %134, align 4, !tbaa !46
  %135 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !9
  %137 = getelementptr inbounds %"struct.basisu::etc1_optimizer::results", ptr %136, i32 0, i32 5
  %138 = load ptr, ptr %137, align 8, !tbaa !21
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = load i32, ptr %4, align 4, !tbaa !31
  %141 = zext i32 %140 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %138, ptr align 1 %139, i64 %141, i1 false)
  %142 = load i32, ptr %4, align 4, !tbaa !31
  %143 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %7, i32 0, i32 1
  %144 = load ptr, ptr %143, align 8, !tbaa !9
  %145 = getelementptr inbounds %"struct.basisu::etc1_optimizer::results", ptr %144, i32 0, i32 3
  store i32 %142, ptr %145, align 8, !tbaa !47
  store i1 true, ptr %2, align 1
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %146

146:                                              ; preds = %105, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %147

147:                                              ; preds = %146, %37
  %148 = load i1, ptr %2, align 1
  ret i1 %148
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu14etc1_optimizer28compute_internal_cluster_fitEj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu14etc1_optimizer29compute_internal_neighborhoodEiii(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef, i32 noundef, i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { noreturn nounwind }
attributes #6 = { 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, !6, i64 8}
!10 = !{!"_ZTSN6basisu14etc1_optimizerE", !6, i64 0, !6, i64 8, !11, i64 16, !12, i64 20, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !13, i64 48, !14, i64 64, !14, i64 80, !6, i64 96, !6, i64 104, !15, i64 112, !15, i64 128, !16, i64 144, !16, i64 192, !15, i64 240, !7, i64 256}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSN6basisu3vecILj3EfEE", !7, i64 0}
!13 = !{!"_ZTSN6basisu6vectorItEE", !6, i64 0, !11, i64 8, !11, i64 12}
!14 = !{!"_ZTSN6basisu6vectorIjEE", !6, i64 0, !11, i64 8, !11, i64 12}
!15 = !{!"_ZTSN6basisu6vectorIhEE", !6, i64 0, !11, i64 8, !11, i64 12}
!16 = !{!"_ZTSN6basisu14etc1_optimizer18potential_solutionE", !17, i64 0, !15, i64 16, !20, i64 32, !19, i64 40}
!17 = !{!"_ZTSN6basisu25etc1_solution_coordinatesE", !18, i64 0, !11, i64 4, !19, i64 8}
!18 = !{!"_ZTSN6basisu10color_rgbaE", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!22, !6, i64 24}
!22 = !{!"_ZTSN6basisu14etc1_optimizer7resultsE", !20, i64 0, !18, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !19, i64 32}
!23 = !{!10, !6, i64 0}
!24 = !{!25, !6, i64 56}
!25 = !{!"_ZTSN6basisu14etc1_optimizer6paramsE", !26, i64 0, !11, i64 12, !6, i64 16, !19, i64 24, !6, i64 32, !11, i64 40, !18, i64 44, !19, i64 48, !19, i64 49, !6, i64 56}
!26 = !{!"_ZTSN6basisu22basis_etc1_pack_paramsE", !27, i64 0, !19, i64 4, !19, i64 5, !19, i64 6, !19, i64 7, !28, i64 8}
!27 = !{!"_ZTSN6basisu17basis_etc_qualityE", !7, i64 0}
!28 = !{!"float", !7, i64 0}
!29 = !{!26, !27, i64 0}
!30 = !{!25, !11, i64 12}
!31 = !{!11, !11, i64 0}
!32 = !{!26, !19, i64 5}
!33 = !{i8 0, i8 2}
!34 = !{}
!35 = !{!10, !11, i64 32}
!36 = !{!10, !11, i64 36}
!37 = !{!10, !11, i64 40}
!38 = !{!10, !19, i64 184}
!39 = !{!22, !20, i64 0}
!40 = !{!10, !20, i64 176}
!41 = !{i64 0, i64 4, !42}
!42 = !{!7, !7, i64 0}
!43 = !{!10, !19, i64 152}
!44 = !{!22, !19, i64 32}
!45 = !{!10, !11, i64 148}
!46 = !{!22, !11, i64 12}
!47 = !{!22, !11, 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"

@.str.3 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [24 x i8], align 1
@__PRETTY_FUNCTION__._ZN6basisu14etc1_optimizer7computeEv = external hidden unnamed_addr constant [39 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu14etc1_optimizer7computeEv(ptr noundef nonnull align 8 dereferenceable(384) %0) local_unnamed_addr #2 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 24
  %5 = load ptr, ptr %4, align 8, !tbaa !20
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %6, label %7

6:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.3, i32 noundef 762, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6basisu14etc1_optimizer7computeEv) #4
  unreachable

7:                                                ; preds = %1
  %8 = load ptr, ptr %0, align 8, !tbaa !22
  %9 = getelementptr inbounds i8, ptr %8, i64 56
  %10 = load ptr, ptr %9, align 8, !tbaa !23
  %.not6 = icmp eq ptr %10, null
  br i1 %.not6, label %15, label %11

11:                                               ; preds = %7
  %12 = load i32, ptr %8, align 8, !tbaa !28
  %13 = icmp sgt i32 %12, 1
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.3, i32 noundef 766, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6basisu14etc1_optimizer7computeEv) #4
  unreachable

15:                                               ; preds = %11, %7
  %16 = getelementptr inbounds i8, ptr %8, i64 12
  %17 = load i32, ptr %16, align 4, !tbaa !29
  %18 = getelementptr inbounds i8, ptr %8, i64 5
  %19 = load i8, ptr %18, align 1, !tbaa !30, !range !31, !noundef !32
  %20 = trunc nuw i8 %19 to i1
  br i1 %20, label %21, label %27

21:                                               ; preds = %15
  %22 = load i32, ptr %8, align 8, !tbaa !28
  switch i32 %22, label %26 [
    i32 0, label %23
    i32 1, label %24
    i32 2, label %25
  ]

23:                                               ; preds = %21
  tail call void @_ZN6basisu14etc1_optimizer28compute_internal_cluster_fitEj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef 4)
  br label %34

24:                                               ; preds = %21
  tail call void @_ZN6basisu14etc1_optimizer28compute_internal_cluster_fitEj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef 16)
  br label %34

25:                                               ; preds = %21
  tail call void @_ZN6basisu14etc1_optimizer28compute_internal_cluster_fitEj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef 64)
  br label %34

26:                                               ; preds = %21
  tail call void @_ZN6basisu14etc1_optimizer28compute_internal_cluster_fitEj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef 165)
  br label %34

27:                                               ; preds = %15
  %28 = getelementptr inbounds i8, ptr %0, i64 32
  %29 = load i32, ptr %28, align 8, !tbaa !33
  %30 = getelementptr inbounds i8, ptr %0, i64 36
  %31 = load i32, ptr %30, align 4, !tbaa !34
  %32 = getelementptr inbounds i8, ptr %0, i64 40
  %33 = load i32, ptr %32, align 8, !tbaa !35
  tail call void @_ZN6basisu14etc1_optimizer29compute_internal_neighborhoodEiii(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef %29, i32 noundef %31, i32 noundef %33)
  br label %34

34:                                               ; preds = %23, %25, %26, %24, %27
  %35 = getelementptr inbounds i8, ptr %0, i64 144
  %36 = getelementptr inbounds i8, ptr %0, i64 184
  %37 = load i8, ptr %36, align 8, !tbaa !36, !range !31, !noundef !32
  %38 = trunc nuw i8 %37 to i1
  br i1 %38, label %41, label %39

39:                                               ; preds = %34
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  store i64 4294967295, ptr %40, align 8, !tbaa !37
  br label %67

41:                                               ; preds = %34
  %42 = load ptr, ptr %0, align 8, !tbaa !22
  %43 = getelementptr inbounds i8, ptr %42, i64 56
  %44 = load ptr, ptr %43, align 8, !tbaa !23
  %.not7 = icmp eq ptr %44, null
  br i1 %.not7, label %45, label %48

45:                                               ; preds = %41
  %46 = getelementptr inbounds i8, ptr %0, i64 160
  %47 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %46, i64 noundef 0)
  br label %48

48:                                               ; preds = %41, %45
  %49 = phi ptr [ %47, %45 ], [ %44, %41 ]
  %50 = getelementptr inbounds i8, ptr %0, i64 176
  %51 = load i64, ptr %50, align 8, !tbaa !38
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  store i64 %51, ptr %52, align 8, !tbaa !37
  %53 = getelementptr inbounds i8, ptr %52, i64 8
  %54 = load i32, ptr %35, align 8, !tbaa !39
  store i32 %54, ptr %53, align 8, !tbaa !39
  %55 = getelementptr inbounds i8, ptr %0, i64 152
  %56 = load i8, ptr %55, align 8, !tbaa !40, !range !31, !noundef !32
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i64 32
  store i8 %56, ptr %58, align 8, !tbaa !41
  %59 = getelementptr inbounds i8, ptr %0, i64 148
  %60 = load i32, ptr %59, align 4, !tbaa !42
  %61 = getelementptr inbounds i8, ptr %57, i64 12
  store i32 %60, ptr %61, align 4, !tbaa !43
  %62 = getelementptr inbounds i8, ptr %57, i64 24
  %63 = load ptr, ptr %62, align 8, !tbaa !20
  %64 = zext i32 %17 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %63, ptr nonnull align 1 %49, i64 %64, i1 false)
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i64 16
  store i32 %17, ptr %66, align 8, !tbaa !44
  br label %67

67:                                               ; preds = %39, %48
  ret i1 %38
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu14etc1_optimizer28compute_internal_cluster_fitEj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu14etc1_optimizer29compute_internal_neighborhoodEiii(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #3 align 2

attributes #0 = { noreturn 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { noreturn 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, !7, i64 8}
!6 = !{!"_ZTSN6basisu14etc1_optimizerE", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 20, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !12, i64 48, !13, i64 64, !13, i64 80, !7, i64 96, !7, i64 104, !14, i64 112, !14, i64 128, !15, i64 144, !15, i64 192, !14, i64 240, !8, i64 256}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTSN6basisu3vecILj3EfEE", !8, i64 0}
!12 = !{!"_ZTSN6basisu6vectorItEE", !7, i64 0, !10, i64 8, !10, i64 12}
!13 = !{!"_ZTSN6basisu6vectorIjEE", !7, i64 0, !10, i64 8, !10, i64 12}
!14 = !{!"_ZTSN6basisu6vectorIhEE", !7, i64 0, !10, i64 8, !10, i64 12}
!15 = !{!"_ZTSN6basisu14etc1_optimizer18potential_solutionE", !16, i64 0, !14, i64 16, !19, i64 32, !18, i64 40}
!16 = !{!"_ZTSN6basisu25etc1_solution_coordinatesE", !17, i64 0, !10, i64 4, !18, i64 8}
!17 = !{!"_ZTSN6basisu10color_rgbaE", !8, i64 0}
!18 = !{!"bool", !8, i64 0}
!19 = !{!"long", !8, i64 0}
!20 = !{!21, !7, i64 24}
!21 = !{!"_ZTSN6basisu14etc1_optimizer7resultsE", !19, i64 0, !17, i64 8, !10, i64 12, !10, i64 16, !7, i64 24, !18, i64 32}
!22 = !{!6, !7, i64 0}
!23 = !{!24, !7, i64 56}
!24 = !{!"_ZTSN6basisu14etc1_optimizer6paramsE", !25, i64 0, !10, i64 12, !7, i64 16, !18, i64 24, !7, i64 32, !10, i64 40, !17, i64 44, !18, i64 48, !18, i64 49, !7, i64 56}
!25 = !{!"_ZTSN6basisu22basis_etc1_pack_paramsE", !26, i64 0, !18, i64 4, !18, i64 5, !18, i64 6, !18, i64 7, !27, i64 8}
!26 = !{!"_ZTSN6basisu17basis_etc_qualityE", !8, i64 0}
!27 = !{!"float", !8, i64 0}
!28 = !{!25, !26, i64 0}
!29 = !{!24, !10, i64 12}
!30 = !{!25, !18, i64 5}
!31 = !{i8 0, i8 2}
!32 = !{}
!33 = !{!6, !10, i64 32}
!34 = !{!6, !10, i64 36}
!35 = !{!6, !10, i64 40}
!36 = !{!6, !18, i64 184}
!37 = !{!21, !19, i64 0}
!38 = !{!6, !19, i64 176}
!39 = !{!8, !8, i64 0}
!40 = !{!6, !18, i64 152}
!41 = !{!21, !18, i64 32}
!42 = !{!6, !10, i64 148}
!43 = !{!21, !10, i64 12}
!44 = !{!21, !10, i64 16}


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