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

; 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::color_rgba" = type { %union.anon }
%union.anon = type { [4 x i8] }

@_ZN6basisu20g_etc1_pixel_indicesE = external dso_local constant [2 x [2 x [8 x i32]]], align 16

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6basisu11unpack_etc1ERKNS_9etc_blockEPNS_10color_rgbaEb(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i1 noundef zeroext) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZNK6basisu9etc_block19evaluate_etc1_errorEPKNS_10color_rgbaEbi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %1, i1 noundef zeroext %2, i32 noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca [16 x %"class.basisu::color_rgba"], align 16
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i8, align 1
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  %15 = zext i1 %2 to i8
  store i8 %15, ptr %7, align 1, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !11
  %16 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr %9) #4
  %17 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %9, i32 0, i32 0
  %18 = getelementptr inbounds %"class.basisu::color_rgba", ptr %17, i64 16
  br label %19

19:                                               ; preds = %19, %4
  %20 = phi ptr [ %17, %4 ], [ %21, %19 ]
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %20)
  %21 = getelementptr inbounds %"class.basisu::color_rgba", ptr %20, i64 1
  %22 = icmp eq ptr %21, %18
  br i1 %22, label %23, label %19

23:                                               ; preds = %19
  %24 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %9, i64 0, i64 0
  %25 = call noundef zeroext i1 @_ZN6basisu11unpack_etc1ERKNS_9etc_blockEPNS_10color_rgbaEb(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef %24, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store i64 0, ptr %10, align 8, !tbaa !13
  %26 = load i32, ptr %8, align 4, !tbaa !11
  %27 = icmp slt i32 %26, 0
  br i1 %27, label %28, label %51

28:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %29

29:                                               ; preds = %47, %28
  %30 = load i32, ptr %11, align 4, !tbaa !11
  %31 = icmp ult i32 %30, 16
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %50

33:                                               ; preds = %29
  %34 = load i8, ptr %7, align 1, !tbaa !9, !range !15, !noundef !16
  %35 = trunc i8 %34 to i1
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load i32, ptr %11, align 4, !tbaa !11
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds %"class.basisu::color_rgba", ptr %36, i64 %38
  %40 = load i32, ptr %11, align 4, !tbaa !11
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %9, i64 0, i64 %41
  %43 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %35, ptr noundef nonnull align 1 dereferenceable(4) %39, ptr noundef nonnull align 1 dereferenceable(4) %42, i1 noundef zeroext false)
  %44 = zext i32 %43 to i64
  %45 = load i64, ptr %10, align 8, !tbaa !13
  %46 = add i64 %45, %44
  store i64 %46, ptr %10, align 8, !tbaa !13
  br label %47

47:                                               ; preds = %33
  %48 = load i32, ptr %11, align 4, !tbaa !11
  %49 = add i32 %48, 1
  store i32 %49, ptr %11, align 4, !tbaa !11
  br label %29, !llvm.loop !17

50:                                               ; preds = %32
  br label %87

51:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #4
  %52 = call noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %16)
  %53 = zext i1 %52 to i8
  store i8 %53, ptr %12, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %54

54:                                               ; preds = %83, %51
  %55 = load i32, ptr %13, align 4, !tbaa !11
  %56 = icmp ult i32 %55, 8
  br i1 %56, label %58, label %57

57:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %86

58:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %59 = load i8, ptr %12, align 1, !tbaa !9, !range !15, !noundef !16
  %60 = trunc i8 %59 to i1
  %61 = zext i1 %60 to i64
  %62 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %61
  %63 = load i32, ptr %8, align 4, !tbaa !11
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [2 x [8 x i32]], ptr %62, i64 0, i64 %64
  %66 = load i32, ptr %13, align 4, !tbaa !11
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds [8 x i32], ptr %65, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !11
  store i32 %69, ptr %14, align 4, !tbaa !11
  %70 = load i8, ptr %7, align 1, !tbaa !9, !range !15, !noundef !16
  %71 = trunc i8 %70 to i1
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = load i32, ptr %14, align 4, !tbaa !11
  %74 = zext i32 %73 to i64
  %75 = getelementptr inbounds %"class.basisu::color_rgba", ptr %72, i64 %74
  %76 = load i32, ptr %14, align 4, !tbaa !11
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %9, i64 0, i64 %77
  %79 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %71, ptr noundef nonnull align 1 dereferenceable(4) %75, ptr noundef nonnull align 1 dereferenceable(4) %78, i1 noundef zeroext false)
  %80 = zext i32 %79 to i64
  %81 = load i64, ptr %10, align 8, !tbaa !13
  %82 = add i64 %81, %80
  store i64 %82, ptr %10, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %83

83:                                               ; preds = %58
  %84 = load i32, ptr %13, align 4, !tbaa !11
  %85 = add i32 %84, 1
  store i32 %85, ptr %13, align 4, !tbaa !11
  br label %54, !llvm.loop !19

86:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  br label %87

87:                                               ; preds = %86, %50
  %88 = load i64, ptr %10, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %9) #4
  ret i64 %88
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext, ptr noundef nonnull align 1 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(4), i1 noundef zeroext) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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

%"class.basisu::color_rgba" = type { %union.anon }
%union.anon = type { [4 x i8] }

@_ZN6basisu20g_etc1_pixel_indicesE = external dso_local local_unnamed_addr constant [2 x [2 x [8 x i32]]], align 16

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6basisu11unpack_etc1ERKNS_9etc_blockEPNS_10color_rgbaEb(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZNK6basisu9etc_block19evaluate_etc1_errorEPKNS_10color_rgbaEbi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %1, i1 noundef zeroext %2, i32 noundef %3) local_unnamed_addr #2 align 2 {
  %5 = alloca [16 x %"class.basisu::color_rgba"], align 16
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #4
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %5)
  %.ptr.1 = getelementptr inbounds i8, ptr %5, i64 4
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %5, i64 8
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.2)
  %.ptr.3 = getelementptr inbounds i8, ptr %5, i64 12
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.3)
  %.ptr.4 = getelementptr inbounds i8, ptr %5, i64 16
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.4)
  %.ptr.5 = getelementptr inbounds i8, ptr %5, i64 20
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.5)
  %.ptr.6 = getelementptr inbounds i8, ptr %5, i64 24
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.6)
  %.ptr.7 = getelementptr inbounds i8, ptr %5, i64 28
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.7)
  %.ptr.8 = getelementptr inbounds i8, ptr %5, i64 32
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.8)
  %.ptr.9 = getelementptr inbounds i8, ptr %5, i64 36
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.9)
  %.ptr.10 = getelementptr inbounds i8, ptr %5, i64 40
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.10)
  %.ptr.11 = getelementptr inbounds i8, ptr %5, i64 44
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.11)
  %.ptr.12 = getelementptr inbounds i8, ptr %5, i64 48
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.12)
  %.ptr.13 = getelementptr inbounds i8, ptr %5, i64 52
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.13)
  %.ptr.14 = getelementptr inbounds i8, ptr %5, i64 56
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.14)
  %.ptr.15 = getelementptr inbounds i8, ptr %5, i64 60
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.15)
  %6 = call noundef zeroext i1 @_ZN6basisu11unpack_etc1ERKNS_9etc_blockEPNS_10color_rgbaEb(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %5, i1 noundef zeroext false)
  %7 = icmp slt i32 %3, 0
  br i1 %7, label %.preheader.preheader, label %.loopexit.loopexit28

.preheader.preheader:                             ; preds = %4
  %8 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %1, ptr noundef nonnull align 1 dereferenceable(4) %5, i1 noundef zeroext false)
  %9 = zext i32 %8 to i64
  %10 = getelementptr inbounds i8, ptr %1, i64 4
  %11 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %10, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.1, i1 noundef zeroext false)
  %12 = zext i32 %11 to i64
  %13 = add nuw nsw i64 %9, %12
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %14, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.2, i1 noundef zeroext false)
  %16 = zext i32 %15 to i64
  %17 = add nuw nsw i64 %13, %16
  %18 = getelementptr inbounds i8, ptr %1, i64 12
  %19 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %18, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.3, i1 noundef zeroext false)
  %20 = zext i32 %19 to i64
  %21 = add nuw nsw i64 %17, %20
  %22 = getelementptr inbounds i8, ptr %1, i64 16
  %23 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %22, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.4, i1 noundef zeroext false)
  %24 = zext i32 %23 to i64
  %25 = add nuw nsw i64 %21, %24
  %26 = getelementptr inbounds i8, ptr %1, i64 20
  %27 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %26, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.5, i1 noundef zeroext false)
  %28 = zext i32 %27 to i64
  %29 = add nuw nsw i64 %25, %28
  %30 = getelementptr inbounds i8, ptr %1, i64 24
  %31 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %30, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.6, i1 noundef zeroext false)
  %32 = zext i32 %31 to i64
  %33 = add nuw nsw i64 %29, %32
  %34 = getelementptr inbounds i8, ptr %1, i64 28
  %35 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %34, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.7, i1 noundef zeroext false)
  %36 = zext i32 %35 to i64
  %37 = add nuw nsw i64 %33, %36
  %38 = getelementptr inbounds i8, ptr %1, i64 32
  %39 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %38, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.8, i1 noundef zeroext false)
  %40 = zext i32 %39 to i64
  %41 = add nuw nsw i64 %37, %40
  %42 = getelementptr inbounds i8, ptr %1, i64 36
  %43 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %42, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.9, i1 noundef zeroext false)
  %44 = zext i32 %43 to i64
  %45 = add nuw nsw i64 %41, %44
  %46 = getelementptr inbounds i8, ptr %1, i64 40
  %47 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %46, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.10, i1 noundef zeroext false)
  %48 = zext i32 %47 to i64
  %49 = add nuw nsw i64 %45, %48
  %50 = getelementptr inbounds i8, ptr %1, i64 44
  %51 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %50, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.11, i1 noundef zeroext false)
  %52 = zext i32 %51 to i64
  %53 = add nuw nsw i64 %49, %52
  %54 = getelementptr inbounds i8, ptr %1, i64 48
  %55 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %54, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.12, i1 noundef zeroext false)
  %56 = zext i32 %55 to i64
  %57 = add nuw nsw i64 %53, %56
  %58 = getelementptr inbounds i8, ptr %1, i64 52
  %59 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %58, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.13, i1 noundef zeroext false)
  %60 = zext i32 %59 to i64
  %61 = add nuw nsw i64 %57, %60
  %62 = getelementptr inbounds i8, ptr %1, i64 56
  %63 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %62, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.14, i1 noundef zeroext false)
  %64 = zext i32 %63 to i64
  %65 = add nuw nsw i64 %61, %64
  %66 = getelementptr inbounds i8, ptr %1, i64 60
  %67 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %66, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.15, i1 noundef zeroext false)
  br label %.loopexit

.loopexit.loopexit28:                             ; preds = %4
  %68 = call noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %69 = zext i1 %68 to i64
  %70 = zext nneg i32 %3 to i64
  %71 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %69, i64 %70, i64 0
  %72 = load i32, ptr %71, align 16, !tbaa !5
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds %"class.basisu::color_rgba", ptr %1, i64 %73
  %75 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %5, i64 0, i64 %73
  %76 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %74, ptr noundef nonnull align 1 dereferenceable(4) %75, i1 noundef zeroext false)
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %69, i64 %70, i64 1
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = zext i32 %79 to i64
  %81 = getelementptr inbounds %"class.basisu::color_rgba", ptr %1, i64 %80
  %82 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %5, i64 0, i64 %80
  %83 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %81, ptr noundef nonnull align 1 dereferenceable(4) %82, i1 noundef zeroext false)
  %84 = zext i32 %83 to i64
  %85 = add nuw nsw i64 %77, %84
  %86 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %69, i64 %70, i64 2
  %87 = load i32, ptr %86, align 8, !tbaa !5
  %88 = zext i32 %87 to i64
  %89 = getelementptr inbounds %"class.basisu::color_rgba", ptr %1, i64 %88
  %90 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %5, i64 0, i64 %88
  %91 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %89, ptr noundef nonnull align 1 dereferenceable(4) %90, i1 noundef zeroext false)
  %92 = zext i32 %91 to i64
  %93 = add nuw nsw i64 %85, %92
  %94 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %69, i64 %70, i64 3
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = zext i32 %95 to i64
  %97 = getelementptr inbounds %"class.basisu::color_rgba", ptr %1, i64 %96
  %98 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %5, i64 0, i64 %96
  %99 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %97, ptr noundef nonnull align 1 dereferenceable(4) %98, i1 noundef zeroext false)
  %100 = zext i32 %99 to i64
  %101 = add nuw nsw i64 %93, %100
  %102 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %69, i64 %70, i64 4
  %103 = load i32, ptr %102, align 16, !tbaa !5
  %104 = zext i32 %103 to i64
  %105 = getelementptr inbounds %"class.basisu::color_rgba", ptr %1, i64 %104
  %106 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %5, i64 0, i64 %104
  %107 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %105, ptr noundef nonnull align 1 dereferenceable(4) %106, i1 noundef zeroext false)
  %108 = zext i32 %107 to i64
  %109 = add nuw nsw i64 %101, %108
  %110 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %69, i64 %70, i64 5
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = zext i32 %111 to i64
  %113 = getelementptr inbounds %"class.basisu::color_rgba", ptr %1, i64 %112
  %114 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %5, i64 0, i64 %112
  %115 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %113, ptr noundef nonnull align 1 dereferenceable(4) %114, i1 noundef zeroext false)
  %116 = zext i32 %115 to i64
  %117 = add nuw nsw i64 %109, %116
  %118 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %69, i64 %70, i64 6
  %119 = load i32, ptr %118, align 8, !tbaa !5
  %120 = zext i32 %119 to i64
  %121 = getelementptr inbounds %"class.basisu::color_rgba", ptr %1, i64 %120
  %122 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %5, i64 0, i64 %120
  %123 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %121, ptr noundef nonnull align 1 dereferenceable(4) %122, i1 noundef zeroext false)
  %124 = zext i32 %123 to i64
  %125 = add nuw nsw i64 %117, %124
  %126 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %69, i64 %70, i64 7
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = zext i32 %127 to i64
  %129 = getelementptr inbounds %"class.basisu::color_rgba", ptr %1, i64 %128
  %130 = getelementptr inbounds [16 x %"class.basisu::color_rgba"], ptr %5, i64 0, i64 %128
  %131 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %2, ptr noundef nonnull align 1 dereferenceable(4) %129, ptr noundef nonnull align 1 dereferenceable(4) %130, i1 noundef zeroext false)
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit28, %.preheader.preheader
  %.sink33 = phi i32 [ %131, %.loopexit.loopexit28 ], [ %67, %.preheader.preheader ]
  %.sink = phi i64 [ %125, %.loopexit.loopexit28 ], [ %65, %.preheader.preheader ]
  %132 = zext i32 %.sink33 to i64
  %133 = add nuw nsw i64 %.sink, %132
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #4
  ret i64 %133
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext, ptr noundef nonnull align 1 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(4), i1 noundef zeroext) local_unnamed_addr #3

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass