; 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] }

@.str.3 = external hidden unnamed_addr constant [110 x i8], align 1
@_ZN6basisu19g_etc1_inten_tablesE = external dso_local constant [8 x [4 x i32]], align 16
@.str.8 = external hidden unnamed_addr constant [37 x i8], align 1
@__PRETTY_FUNCTION__._ZN6basisu9etc_block23get_abs_subblock_colorsEPNS_10color_rgbaEtj = external hidden unnamed_addr constant [89 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: mustprogress uwtable
declare dso_local void @_ZN6basisu9etc_block13unpack_color4ERjS1_S1_tb(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), i16 noundef zeroext, i1 noundef zeroext) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6basisu9etc_block23get_abs_subblock_colorsEPNS_10color_rgbaEtj(ptr noundef %0, i16 noundef zeroext %1, i32 noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i16, align 2
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i16 %1, ptr %5, align 2, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !11
  %18 = load i32, ptr %6, align 4, !tbaa !11
  %19 = icmp ult i32 %18, 8
  br i1 %19, label %20, label %21

20:                                               ; preds = %3
  br label %23

21:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.3, i32 noundef 567, ptr noundef @__PRETTY_FUNCTION__._ZN6basisu9etc_block23get_abs_subblock_colorsEPNS_10color_rgbaEtj) #4
  unreachable

22:                                               ; No predecessors!
  br label %23

23:                                               ; preds = %22, %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %24 = load i32, ptr %6, align 4, !tbaa !11
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds [8 x [4 x i32]], ptr @_ZN6basisu19g_etc1_inten_tablesE, i64 0, i64 %25
  %27 = getelementptr inbounds [4 x i32], ptr %26, i64 0, i64 0
  store ptr %27, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %28 = load i16, ptr %5, align 2, !tbaa !9
  call void @_ZN6basisu9etc_block13unpack_color4ERjS1_S1_tb(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, i16 noundef zeroext %28, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %29 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %29, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %30 = load i32, ptr %9, align 4, !tbaa !11
  store i32 %30, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %31 = load i32, ptr %10, align 4, !tbaa !11
  store i32 %31, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds i32, ptr %32, i64 0
  %34 = load i32, ptr %33, align 4, !tbaa !11
  store i32 %34, ptr %14, align 4, !tbaa !11
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.basisu::color_rgba", ptr %35, i64 0
  %37 = load i32, ptr %11, align 4, !tbaa !11
  %38 = load i32, ptr %14, align 4, !tbaa !11
  %39 = add nsw i32 %37, %38
  %40 = load i32, ptr %12, align 4, !tbaa !11
  %41 = load i32, ptr %14, align 4, !tbaa !11
  %42 = add nsw i32 %40, %41
  %43 = load i32, ptr %13, align 4, !tbaa !11
  %44 = load i32, ptr %14, align 4, !tbaa !11
  %45 = add nsw i32 %43, %44
  %46 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %36, i32 noundef %39, i32 noundef %42, i32 noundef %45, i32 noundef 255)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds i32, ptr %47, i64 1
  %49 = load i32, ptr %48, align 4, !tbaa !11
  store i32 %49, ptr %15, align 4, !tbaa !11
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.basisu::color_rgba", ptr %50, i64 1
  %52 = load i32, ptr %11, align 4, !tbaa !11
  %53 = load i32, ptr %15, align 4, !tbaa !11
  %54 = add nsw i32 %52, %53
  %55 = load i32, ptr %12, align 4, !tbaa !11
  %56 = load i32, ptr %15, align 4, !tbaa !11
  %57 = add nsw i32 %55, %56
  %58 = load i32, ptr %13, align 4, !tbaa !11
  %59 = load i32, ptr %15, align 4, !tbaa !11
  %60 = add nsw i32 %58, %59
  %61 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %51, i32 noundef %54, i32 noundef %57, i32 noundef %60, i32 noundef 255)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds i32, ptr %62, i64 2
  %64 = load i32, ptr %63, align 4, !tbaa !11
  store i32 %64, ptr %16, align 4, !tbaa !11
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %"class.basisu::color_rgba", ptr %65, i64 2
  %67 = load i32, ptr %11, align 4, !tbaa !11
  %68 = load i32, ptr %16, align 4, !tbaa !11
  %69 = add nsw i32 %67, %68
  %70 = load i32, ptr %12, align 4, !tbaa !11
  %71 = load i32, ptr %16, align 4, !tbaa !11
  %72 = add nsw i32 %70, %71
  %73 = load i32, ptr %13, align 4, !tbaa !11
  %74 = load i32, ptr %16, align 4, !tbaa !11
  %75 = add nsw i32 %73, %74
  %76 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %66, i32 noundef %69, i32 noundef %72, i32 noundef %75, i32 noundef 255)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds i32, ptr %77, i64 3
  %79 = load i32, ptr %78, align 4, !tbaa !11
  store i32 %79, ptr %17, align 4, !tbaa !11
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %"class.basisu::color_rgba", ptr %80, i64 3
  %82 = load i32, ptr %11, align 4, !tbaa !11
  %83 = load i32, ptr %17, align 4, !tbaa !11
  %84 = add nsw i32 %82, %83
  %85 = load i32, ptr %12, align 4, !tbaa !11
  %86 = load i32, ptr %17, align 4, !tbaa !11
  %87 = add nsw i32 %85, %86
  %88 = load i32, ptr %13, align 4, !tbaa !11
  %89 = load i32, ptr %17, align 4, !tbaa !11
  %90 = add nsw i32 %88, %89
  %91 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %81, i32 noundef %84, i32 noundef %87, i32 noundef %90, i32 noundef 255)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret void
}

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 = { 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 = { noreturn nounwind }
attributes #5 = { 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 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, 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"

@.str.3 = external hidden unnamed_addr constant [110 x i8], align 1
@_ZN6basisu19g_etc1_inten_tablesE = external dso_local local_unnamed_addr constant [8 x [4 x i32]], align 16
@.str.8 = external hidden unnamed_addr constant [37 x i8], align 1
@__PRETTY_FUNCTION__._ZN6basisu9etc_block23get_abs_subblock_colorsEPNS_10color_rgbaEtj = external hidden unnamed_addr constant [89 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu9etc_block13unpack_color4ERjS1_S1_tb(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), i16 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6basisu9etc_block23get_abs_subblock_colorsEPNS_10color_rgbaEtj(ptr noundef %0, i16 noundef zeroext %1, i32 noundef %2) local_unnamed_addr #2 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = icmp ult i32 %2, 8
  br i1 %7, label %9, label %8

8:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.3, i32 noundef 567, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6basisu9etc_block23get_abs_subblock_colorsEPNS_10color_rgbaEtj) #4
  unreachable

9:                                                ; preds = %3
  %10 = zext nneg i32 %2 to i64
  %11 = getelementptr inbounds [8 x [4 x i32]], ptr @_ZN6basisu19g_etc1_inten_tablesE, i64 0, i64 %10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  call void @_ZN6basisu9etc_block13unpack_color4ERjS1_S1_tb(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6, i16 noundef zeroext %1, i1 noundef zeroext true)
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = load i32, ptr %5, align 4, !tbaa !5
  %14 = load i32, ptr %6, align 4, !tbaa !5
  %15 = load i32, ptr %11, align 16, !tbaa !5
  %16 = add nsw i32 %15, %12
  %17 = add nsw i32 %15, %13
  %18 = add nsw i32 %15, %14
  %19 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %0, i32 noundef %16, i32 noundef %17, i32 noundef %18, i32 noundef 255)
  %20 = getelementptr inbounds i8, ptr %11, i64 4
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %0, i64 4
  %23 = add nsw i32 %21, %12
  %24 = add nsw i32 %21, %13
  %25 = add nsw i32 %21, %14
  %26 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %22, i32 noundef %23, i32 noundef %24, i32 noundef %25, i32 noundef 255)
  %27 = getelementptr inbounds i8, ptr %11, i64 8
  %28 = load i32, ptr %27, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %0, i64 8
  %30 = add nsw i32 %28, %12
  %31 = add nsw i32 %28, %13
  %32 = add nsw i32 %28, %14
  %33 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %29, i32 noundef %30, i32 noundef %31, i32 noundef %32, i32 noundef 255)
  %34 = getelementptr inbounds i8, ptr %11, i64 12
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %0, i64 12
  %37 = add nsw i32 %35, %12
  %38 = add nsw i32 %35, %13
  %39 = add nsw i32 %35, %14
  %40 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %36, i32 noundef %37, i32 noundef %38, i32 noundef %39, i32 noundef 255)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  ret void
}

attributes #0 = { mustprogress 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 = { 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 = { noreturn nounwind }
attributes #5 = { 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,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass