; LLVM IR from wmcnamara/crynn :: lib/thirdparty/assimp/contrib/Open3DGC (o3dgcDynamicVectorEncoder)

; 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.o3dgc::Arithmetic_Codec" = type <{ ptr, ptr, ptr, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.o3dgc::Static_Bit_Model" = type { i32 }
%"class.o3dgc::Adaptive_Bit_Model" = type { i32, i32, i32, i32, i32 }
%"class.o3dgc::Adaptive_Data_Model" = type <{ ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.o3dgc::DynamicVectorEncoder" = type <{ i64, i64, i64, i64, i64, ptr, ptr, i32, [4 x i8] }>

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5o3dgc20DynamicVectorEncoder8EncodeACEmmmRm(ptr noundef nonnull align 8 dereferenceable(60) %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %"class.o3dgc::Arithmetic_Codec", align 8
  %12 = alloca %"class.o3dgc::Static_Bit_Model", align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %"class.o3dgc::Adaptive_Bit_Model", align 4
  %16 = alloca %"class.o3dgc::Adaptive_Data_Model", align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !9
  store i64 %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr %11) #7
  call void @_ZN5o3dgc16Arithmetic_CodecC1Ev(ptr noundef nonnull align 8 dereferenceable(44) %11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  invoke void @_ZN5o3dgc16Static_Bit_ModelC1Ev(ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %22 unwind label %53

22:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 20, ptr %15) #7
  invoke void @_ZN5o3dgc18Adaptive_Bit_ModelC1Ev(ptr noundef nonnull align 4 dereferenceable(20) %15)
          to label %23 unwind label %57

23:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 56, ptr %16) #7
  %24 = load i64, ptr %9, align 8, !tbaa !9
  %25 = add i64 %24, 2
  %26 = trunc i64 %25 to i32
  invoke void @_ZN5o3dgc19Adaptive_Data_ModelC1Ej(ptr noundef nonnull align 8 dereferenceable(52) %16, i32 noundef %26)
          to label %27 unwind label %61

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %28 = load i64, ptr %7, align 8, !tbaa !9
  %29 = load i64, ptr %8, align 8, !tbaa !9
  %30 = mul i64 %28, %29
  %31 = mul i64 %30, 8
  %32 = add i64 %31, 100
  %33 = trunc i64 %32 to i32
  store i32 %33, ptr %17, align 4, !tbaa !11
  %34 = getelementptr inbounds %"class.o3dgc::DynamicVectorEncoder", ptr %21, i32 0, i32 1
  %35 = load i64, ptr %34, align 8, !tbaa !13
  %36 = load i32, ptr %17, align 4, !tbaa !11
  %37 = zext i32 %36 to i64
  %38 = icmp ult i64 %35, %37
  br i1 %38, label %39, label %69

39:                                               ; preds = %27
  %40 = getelementptr inbounds %"class.o3dgc::DynamicVectorEncoder", ptr %21, i32 0, i32 5
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  %42 = icmp eq ptr %41, null
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  call void @_ZdaPv(ptr noundef %41) #8
  br label %44

44:                                               ; preds = %43, %39
  %45 = load i32, ptr %17, align 4, !tbaa !11
  %46 = zext i32 %45 to i64
  %47 = getelementptr inbounds %"class.o3dgc::DynamicVectorEncoder", ptr %21, i32 0, i32 1
  store i64 %46, ptr %47, align 8, !tbaa !13
  %48 = getelementptr inbounds %"class.o3dgc::DynamicVectorEncoder", ptr %21, i32 0, i32 1
  %49 = load i64, ptr %48, align 8, !tbaa !13
  %50 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %49) #9
          to label %51 unwind label %65

51:                                               ; preds = %44
  %52 = getelementptr inbounds %"class.o3dgc::DynamicVectorEncoder", ptr %21, i32 0, i32 5
  store ptr %50, ptr %52, align 8, !tbaa !16
  br label %69

53:                                               ; preds = %5
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %13, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %14, align 4
  br label %121

57:                                               ; preds = %22
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %13, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %14, align 4
  br label %120

61:                                               ; preds = %23
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %13, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %14, align 4
  br label %119

65:                                               ; preds = %113, %75, %74, %73, %69, %44
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %13, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %14, align 4
  br label %118

69:                                               ; preds = %51, %27
  %70 = load i32, ptr %17, align 4, !tbaa !11
  %71 = getelementptr inbounds %"class.o3dgc::DynamicVectorEncoder", ptr %21, i32 0, i32 5
  %72 = load ptr, ptr %71, align 8, !tbaa !16
  invoke void @_ZN5o3dgc16Arithmetic_Codec10set_bufferEjPh(ptr noundef nonnull align 8 dereferenceable(44) %11, i32 noundef %70, ptr noundef %72)
          to label %73 unwind label %65

73:                                               ; preds = %69
  invoke void @_ZN5o3dgc16Arithmetic_Codec13start_encoderEv(ptr noundef nonnull align 8 dereferenceable(44) %11)
          to label %74 unwind label %65

74:                                               ; preds = %73
  invoke void @_ZN5o3dgc16Arithmetic_Codec15ExpGolombEncodeEjiRNS_16Static_Bit_ModelERNS_18Adaptive_Bit_ModelE(ptr noundef nonnull align 8 dereferenceable(44) %11, i32 noundef 0, i32 noundef 0, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(20) %15)
          to label %75 unwind label %65

75:                                               ; preds = %74
  %76 = load i64, ptr %9, align 8, !tbaa !9
  %77 = trunc i64 %76 to i32
  invoke void @_ZN5o3dgc16Arithmetic_Codec15ExpGolombEncodeEjiRNS_16Static_Bit_ModelERNS_18Adaptive_Bit_ModelE(ptr noundef nonnull align 8 dereferenceable(44) %11, i32 noundef %77, i32 noundef 0, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(20) %15)
          to label %78 unwind label %65

78:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  store i64 0, ptr %18, align 8, !tbaa !9
  br label %79

79:                                               ; preds = %110, %78
  %80 = load i64, ptr %18, align 8, !tbaa !9
  %81 = load i64, ptr %7, align 8, !tbaa !9
  %82 = icmp ult i64 %80, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %79
  store i32 2, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %113

84:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  store i64 0, ptr %20, align 8, !tbaa !9
  br label %85

85:                                               ; preds = %102, %84
  %86 = load i64, ptr %20, align 8, !tbaa !9
  %87 = load i64, ptr %8, align 8, !tbaa !9
  %88 = icmp ult i64 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  store i32 5, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %109

90:                                               ; preds = %85
  %91 = getelementptr inbounds %"class.o3dgc::DynamicVectorEncoder", ptr %21, i32 0, i32 6
  %92 = load ptr, ptr %91, align 8, !tbaa !17
  %93 = load i64, ptr %20, align 8, !tbaa !9
  %94 = load i64, ptr %7, align 8, !tbaa !9
  %95 = mul i64 %93, %94
  %96 = load i64, ptr %18, align 8, !tbaa !9
  %97 = add i64 %95, %96
  %98 = getelementptr inbounds i64, ptr %92, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !9
  %100 = load i64, ptr %9, align 8, !tbaa !9
  invoke void @_ZN5o3dgc14EncodeIntACEGCElRNS_16Arithmetic_CodecERNS_19Adaptive_Data_ModelERNS_16Static_Bit_ModelERNS_18Adaptive_Bit_ModelEm(i64 noundef %99, ptr noundef nonnull align 8 dereferenceable(44) %11, ptr noundef nonnull align 8 dereferenceable(52) %16, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(20) %15, i64 noundef %100)
          to label %101 unwind label %105

101:                                              ; preds = %90
  br label %102

102:                                              ; preds = %101
  %103 = load i64, ptr %20, align 8, !tbaa !9
  %104 = add i64 %103, 1
  store i64 %104, ptr %20, align 8, !tbaa !9
  br label %85, !llvm.loop !18

105:                                              ; preds = %90
  %106 = landingpad { ptr, i32 }
          cleanup
  %107 = extractvalue { ptr, i32 } %106, 0
  store ptr %107, ptr %13, align 8
  %108 = extractvalue { ptr, i32 } %106, 1
  store i32 %108, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %118

109:                                              ; preds = %89
  br label %110

110:                                              ; preds = %109
  %111 = load i64, ptr %18, align 8, !tbaa !9
  %112 = add i64 %111, 1
  store i64 %112, ptr %18, align 8, !tbaa !9
  br label %79, !llvm.loop !20

113:                                              ; preds = %83
  %114 = invoke noundef i32 @_ZN5o3dgc16Arithmetic_Codec12stop_encoderEv(ptr noundef nonnull align 8 dereferenceable(44) %11)
          to label %115 unwind label %65

115:                                              ; preds = %113
  %116 = zext i32 %114 to i64
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 %116, ptr %117, align 8, !tbaa !9
  store i32 1, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @_ZN5o3dgc19Adaptive_Data_ModelD1Ev(ptr noundef nonnull align 8 dereferenceable(52) %16) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @_ZN5o3dgc16Arithmetic_CodecD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %11) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %11) #7
  ret i32 0

118:                                              ; preds = %105, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @_ZN5o3dgc19Adaptive_Data_ModelD1Ev(ptr noundef nonnull align 8 dereferenceable(52) %16) #7
  br label %119

119:                                              ; preds = %118, %61
  call void @llvm.lifetime.end.p0(i64 56, ptr %16) #7
  br label %120

120:                                              ; preds = %119, %57
  call void @llvm.lifetime.end.p0(i64 20, ptr %15) #7
  br label %121

121:                                              ; preds = %120, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @_ZN5o3dgc16Arithmetic_CodecD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %11) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %11) #7
  br label %122

122:                                              ; preds = %121
  %123 = load ptr, ptr %13, align 8
  %124 = load i32, ptr %14, align 4
  %125 = insertvalue { ptr, i32 } poison, ptr %123, 0
  %126 = insertvalue { ptr, i32 } %125, i32 %124, 1
  resume { ptr, i32 } %126
}

declare void @_ZN5o3dgc16Arithmetic_CodecC1Ev(ptr noundef nonnull align 8 dereferenceable(44)) unnamed_addr #3

declare void @_ZN5o3dgc16Static_Bit_ModelC1Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

declare void @_ZN5o3dgc18Adaptive_Bit_ModelC1Ev(ptr noundef nonnull align 4 dereferenceable(20)) unnamed_addr #3

declare void @_ZN5o3dgc19Adaptive_Data_ModelC1Ej(ptr noundef nonnull align 8 dereferenceable(52), i32 noundef) unnamed_addr #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #4

declare void @_ZN5o3dgc16Arithmetic_Codec10set_bufferEjPh(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef, ptr noundef) #3

declare void @_ZN5o3dgc16Arithmetic_Codec13start_encoderEv(ptr noundef nonnull align 8 dereferenceable(44)) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5o3dgc16Arithmetic_Codec15ExpGolombEncodeEjiRNS_16Static_Bit_ModelERNS_18Adaptive_Bit_ModelE(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(20)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5o3dgc14EncodeIntACEGCElRNS_16Arithmetic_CodecERNS_19Adaptive_Data_ModelERNS_16Static_Bit_ModelERNS_18Adaptive_Bit_ModelEm(i64 noundef, ptr noundef nonnull align 8 dereferenceable(44), ptr noundef nonnull align 8 dereferenceable(52), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(20), i64 noundef) #5

declare noundef i32 @_ZN5o3dgc16Arithmetic_Codec12stop_encoderEv(ptr noundef nonnull align 8 dereferenceable(44)) #3

; Function Attrs: nounwind
declare void @_ZN5o3dgc19Adaptive_Data_ModelD1Ev(ptr noundef nonnull align 8 dereferenceable(52)) unnamed_addr #6

; Function Attrs: nounwind
declare void @_ZN5o3dgc16Arithmetic_CodecD1Ev(ptr noundef nonnull align 8 dereferenceable(44)) unnamed_addr #6

attributes #0 = { nobuiltin 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 = { nocallback nofree nosync 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 = { "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 = { nobuiltin allocsize(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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { builtin nounwind }
attributes #9 = { builtin allocsize(0) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTSN5o3dgc20DynamicVectorEncoderE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40, !6, i64 48, !15, i64 56}
!15 = !{!"_ZTSN5o3dgc15O3DGCStreamTypeE", !7, i64 0}
!16 = !{!14, !6, i64 40}
!17 = !{!14, !6, i64 48}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


; 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.o3dgc::Arithmetic_Codec" = type <{ ptr, ptr, ptr, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.o3dgc::Static_Bit_Model" = type { i32 }
%"class.o3dgc::Adaptive_Bit_Model" = type { i32, i32, i32, i32, i32 }
%"class.o3dgc::Adaptive_Data_Model" = type <{ ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5o3dgc20DynamicVectorEncoder8EncodeACEmmmRm(ptr nocapture noundef nonnull align 8 dereferenceable(60) %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(8) %4) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.o3dgc::Arithmetic_Codec", align 8
  %7 = alloca %"class.o3dgc::Static_Bit_Model", align 4
  %8 = alloca %"class.o3dgc::Adaptive_Bit_Model", align 4
  %9 = alloca %"class.o3dgc::Adaptive_Data_Model", align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #7
  call void @_ZN5o3dgc16Arithmetic_CodecC1Ev(ptr noundef nonnull align 8 dereferenceable(44) %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  invoke void @_ZN5o3dgc16Static_Bit_ModelC1Ev(ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %10 unwind label %30

10:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %8) #7
  invoke void @_ZN5o3dgc18Adaptive_Bit_ModelC1Ev(ptr noundef nonnull align 4 dereferenceable(20) %8)
          to label %11 unwind label %32

11:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %9) #7
  %12 = trunc i64 %3 to i32
  %13 = add i32 %12, 2
  invoke void @_ZN5o3dgc19Adaptive_Data_ModelC1Ej(ptr noundef nonnull align 8 dereferenceable(52) %9, i32 noundef %13)
          to label %14 unwind label %34

14:                                               ; preds = %11
  %15 = mul i64 %2, %1
  %.tr = trunc i64 %15 to i32
  %16 = shl i32 %.tr, 3
  %17 = add i32 %16, 100
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load i64, ptr %18, align 8, !tbaa !5
  %20 = zext i32 %17 to i64
  %21 = icmp ult i64 %19, %20
  %22 = getelementptr inbounds i8, ptr %0, i64 40
  %23 = load ptr, ptr %22, align 8, !tbaa !12
  br i1 %21, label %24, label %._crit_edge

24:                                               ; preds = %14
  %25 = icmp eq ptr %23, null
  br i1 %25, label %27, label %26

26:                                               ; preds = %24
  call void @_ZdaPv(ptr noundef nonnull %23) #8
  br label %27

27:                                               ; preds = %26, %24
  store i64 %20, ptr %18, align 8, !tbaa !5
  %28 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %20) #9
          to label %29 unwind label %36

29:                                               ; preds = %27
  store ptr %28, ptr %22, align 8, !tbaa !12
  br label %._crit_edge

30:                                               ; preds = %5
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %59

32:                                               ; preds = %10
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %58

34:                                               ; preds = %11
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %57

36:                                               ; preds = %._crit_edge36, %41, %40, %39, %._crit_edge, %27
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %56

._crit_edge:                                      ; preds = %14, %29
  %38 = phi ptr [ %28, %29 ], [ %23, %14 ]
  invoke void @_ZN5o3dgc16Arithmetic_Codec10set_bufferEjPh(ptr noundef nonnull align 8 dereferenceable(44) %6, i32 noundef %17, ptr noundef %38)
          to label %39 unwind label %36

39:                                               ; preds = %._crit_edge
  invoke void @_ZN5o3dgc16Arithmetic_Codec13start_encoderEv(ptr noundef nonnull align 8 dereferenceable(44) %6)
          to label %40 unwind label %36

40:                                               ; preds = %39
  invoke void @_ZN5o3dgc16Arithmetic_Codec15ExpGolombEncodeEjiRNS_16Static_Bit_ModelERNS_18Adaptive_Bit_ModelE(ptr noundef nonnull align 8 dereferenceable(44) %6, i32 noundef 0, i32 noundef 0, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(20) %8)
          to label %41 unwind label %36

41:                                               ; preds = %40
  invoke void @_ZN5o3dgc16Arithmetic_Codec15ExpGolombEncodeEjiRNS_16Static_Bit_ModelERNS_18Adaptive_Bit_ModelE(ptr noundef nonnull align 8 dereferenceable(44) %6, i32 noundef %12, i32 noundef 0, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(20) %8)
          to label %.preheader33 unwind label %36

.preheader33:                                     ; preds = %41
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %._crit_edge36, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.preheader33
  %.not37 = icmp eq i64 %2, 0
  %42 = getelementptr inbounds i8, ptr %0, i64 48
  br i1 %.not37, label %._crit_edge36, label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.lr.ph, %._crit_edge.us
  %.02035.us = phi i64 [ %51, %._crit_edge.us ], [ 0, %.preheader.lr.ph ]
  br label %43

43:                                               ; preds = %.preheader.us, %49
  %.034.us = phi i64 [ 0, %.preheader.us ], [ %50, %49 ]
  %44 = load ptr, ptr %42, align 8, !tbaa !13
  %45 = mul i64 %.034.us, %1
  %46 = getelementptr i64, ptr %44, i64 %45
  %47 = getelementptr i64, ptr %46, i64 %.02035.us
  %48 = load i64, ptr %47, align 8, !tbaa !14
  invoke void @_ZN5o3dgc14EncodeIntACEGCElRNS_16Arithmetic_CodecERNS_19Adaptive_Data_ModelERNS_16Static_Bit_ModelERNS_18Adaptive_Bit_ModelEm(i64 noundef %48, ptr noundef nonnull align 8 dereferenceable(44) %6, ptr noundef nonnull align 8 dereferenceable(52) %9, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(20) %8, i64 noundef %3)
          to label %49 unwind label %.split.us

49:                                               ; preds = %43
  %50 = add nuw i64 %.034.us, 1
  %exitcond.not = icmp eq i64 %50, %2
  br i1 %exitcond.not, label %._crit_edge.us, label %43, !llvm.loop !15

._crit_edge.us:                                   ; preds = %49
  %51 = add nuw i64 %.02035.us, 1
  %exitcond39.not = icmp eq i64 %51, %1
  br i1 %exitcond39.not, label %._crit_edge36, label %.preheader.us, !llvm.loop !17

.split.us:                                        ; preds = %43
  %52 = landingpad { ptr, i32 }
          cleanup
  br label %56

._crit_edge36:                                    ; preds = %._crit_edge.us, %.preheader.lr.ph, %.preheader33
  %53 = invoke noundef i32 @_ZN5o3dgc16Arithmetic_Codec12stop_encoderEv(ptr noundef nonnull align 8 dereferenceable(44) %6)
          to label %54 unwind label %36

54:                                               ; preds = %._crit_edge36
  %55 = zext i32 %53 to i64
  store i64 %55, ptr %4, align 8, !tbaa !14
  call void @_ZN5o3dgc19Adaptive_Data_ModelD1Ev(ptr noundef nonnull align 8 dereferenceable(52) %9) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @_ZN5o3dgc16Arithmetic_CodecD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %6) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #7
  ret i32 0

56:                                               ; preds = %.split.us, %36
  %.pn = phi { ptr, i32 } [ %52, %.split.us ], [ %37, %36 ]
  call void @_ZN5o3dgc19Adaptive_Data_ModelD1Ev(ptr noundef nonnull align 8 dereferenceable(52) %9) #7
  br label %57

57:                                               ; preds = %56, %34
  %.pn.pn = phi { ptr, i32 } [ %.pn, %56 ], [ %35, %34 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %9) #7
  br label %58

58:                                               ; preds = %57, %32
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %57 ], [ %33, %32 ]
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %8) #7
  br label %59

59:                                               ; preds = %58, %30
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %58 ], [ %31, %30 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @_ZN5o3dgc16Arithmetic_CodecD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %6) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #7
  resume { ptr, i32 } %.pn.pn.pn.pn
}

declare void @_ZN5o3dgc16Arithmetic_CodecC1Ev(ptr noundef nonnull align 8 dereferenceable(44)) unnamed_addr #3

declare void @_ZN5o3dgc16Static_Bit_ModelC1Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

declare void @_ZN5o3dgc18Adaptive_Bit_ModelC1Ev(ptr noundef nonnull align 4 dereferenceable(20)) unnamed_addr #3

declare void @_ZN5o3dgc19Adaptive_Data_ModelC1Ej(ptr noundef nonnull align 8 dereferenceable(52), i32 noundef) unnamed_addr #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #4

declare void @_ZN5o3dgc16Arithmetic_Codec10set_bufferEjPh(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef, ptr noundef) local_unnamed_addr #3

declare void @_ZN5o3dgc16Arithmetic_Codec13start_encoderEv(ptr noundef nonnull align 8 dereferenceable(44)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5o3dgc16Arithmetic_Codec15ExpGolombEncodeEjiRNS_16Static_Bit_ModelERNS_18Adaptive_Bit_ModelE(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5o3dgc14EncodeIntACEGCElRNS_16Arithmetic_CodecERNS_19Adaptive_Data_ModelERNS_16Static_Bit_ModelERNS_18Adaptive_Bit_ModelEm(i64 noundef, ptr noundef nonnull align 8 dereferenceable(44), ptr noundef nonnull align 8 dereferenceable(52), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(20), i64 noundef) local_unnamed_addr #5

declare noundef i32 @_ZN5o3dgc16Arithmetic_Codec12stop_encoderEv(ptr noundef nonnull align 8 dereferenceable(44)) local_unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN5o3dgc19Adaptive_Data_ModelD1Ev(ptr noundef nonnull align 8 dereferenceable(52)) unnamed_addr #6

; Function Attrs: nounwind
declare void @_ZN5o3dgc16Arithmetic_CodecD1Ev(ptr noundef nonnull align 8 dereferenceable(44)) unnamed_addr #6

attributes #0 = { nobuiltin 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 nosync 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 = { "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 = { nobuiltin allocsize(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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { builtin nounwind }
attributes #9 = { builtin allocsize(0) }

!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 = !{!"_ZTSN5o3dgc20DynamicVectorEncoderE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !10, i64 48, !11, i64 56}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTSN5o3dgc15O3DGCStreamTypeE", !8, i64 0}
!12 = !{!6, !10, i64 40}
!13 = !{!6, !10, i64 48}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass