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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK5o3dgc12BinaryStream7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(28)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK5o3dgc6VectorIlE7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5o3dgc6VectorIlEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5o3dgc22CompressedTriangleFans10SaveUIntACERKNS_6VectorIlEEmRNS_12BinaryStreamE(ptr noundef nonnull align 8 dereferenceable(164) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %2, ptr noundef nonnull align 8 dereferenceable(28) %3) #1 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca %"class.o3dgc::Arithmetic_Codec", align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.o3dgc::Adaptive_Data_Model", align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = call noundef i64 @_ZNK5o3dgc12BinaryStream7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %22)
  store i64 %23, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = call noundef i64 @_ZNK5o3dgc6VectorIlE7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(24) %24)
  %26 = mul i64 %25, 8
  %27 = add i64 %26, 100
  %28 = trunc i64 %27 to i32
  store i32 %28, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = call noundef i64 @_ZNK5o3dgc6VectorIlE7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(24) %29)
  store i64 %30, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 2147483647, ptr %12, align 8, !tbaa !9
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEm(ptr noundef nonnull align 8 dereferenceable(28) %31, i64 noundef 0)
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = load i64, ptr %11, align 8, !tbaa !9
  call void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEm(ptr noundef nonnull align 8 dereferenceable(28) %32, i64 noundef %33)
  %34 = load i64, ptr %11, align 8, !tbaa !9
  %35 = icmp ugt i64 %34, 0
  br i1 %35, label %36, label %152

36:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !9
  br label %37

37:                                               ; preds = %55, %36
  %38 = load i64, ptr %13, align 8, !tbaa !9
  %39 = load i64, ptr %11, align 8, !tbaa !9
  %40 = icmp ult i64 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %58

42:                                               ; preds = %37
  %43 = load i64, ptr %12, align 8, !tbaa !9
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = load i64, ptr %13, align 8, !tbaa !9
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5o3dgc6VectorIlEixEm(ptr noundef nonnull align 8 dereferenceable(24) %44, i64 noundef %45)
  %47 = load i64, ptr %46, align 8, !tbaa !9
  %48 = icmp sgt i64 %43, %47
  br i1 %48, label %49, label %54

49:                                               ; preds = %42
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = load i64, ptr %13, align 8, !tbaa !9
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5o3dgc6VectorIlEixEm(ptr noundef nonnull align 8 dereferenceable(24) %50, i64 noundef %51)
  %53 = load i64, ptr %52, align 8, !tbaa !9
  store i64 %53, ptr %12, align 8, !tbaa !9
  br label %54

54:                                               ; preds = %49, %42
  br label %55

55:                                               ; preds = %54
  %56 = load i64, ptr %13, align 8, !tbaa !9
  %57 = add i64 %56, 1
  store i64 %57, ptr %13, align 8, !tbaa !9
  br label %37, !llvm.loop !13

58:                                               ; preds = %41
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = load i64, ptr %12, align 8, !tbaa !9
  call void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEm(ptr noundef nonnull align 8 dereferenceable(28) %59, i64 noundef %60)
  %61 = getelementptr inbounds %"class.o3dgc::CompressedTriangleFans", ptr %21, i32 0, i32 7
  %62 = load i64, ptr %61, align 8, !tbaa !15
  %63 = load i32, ptr %10, align 4, !tbaa !11
  %64 = zext i32 %63 to i64
  %65 = icmp ult i64 %62, %64
  br i1 %65, label %66, label %79

66:                                               ; preds = %58
  %67 = getelementptr inbounds %"class.o3dgc::CompressedTriangleFans", ptr %21, i32 0, i32 6
  %68 = load ptr, ptr %67, align 8, !tbaa !19
  %69 = icmp eq ptr %68, null
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  call void @_ZdaPv(ptr noundef %68) #8
  br label %71

71:                                               ; preds = %70, %66
  %72 = load i32, ptr %10, align 4, !tbaa !11
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds %"class.o3dgc::CompressedTriangleFans", ptr %21, i32 0, i32 7
  store i64 %73, ptr %74, align 8, !tbaa !15
  %75 = getelementptr inbounds %"class.o3dgc::CompressedTriangleFans", ptr %21, i32 0, i32 7
  %76 = load i64, ptr %75, align 8, !tbaa !15
  %77 = call noalias noundef nonnull ptr @_Znam(i64 noundef %76) #9
  %78 = getelementptr inbounds %"class.o3dgc::CompressedTriangleFans", ptr %21, i32 0, i32 6
  store ptr %77, ptr %78, align 8, !tbaa !19
  br label %79

79:                                               ; preds = %71, %58
  call void @llvm.lifetime.start.p0(i64 48, ptr %14) #7
  call void @_ZN5o3dgc16Arithmetic_CodecC1Ev(ptr noundef nonnull align 8 dereferenceable(44) %14)
  %80 = load i32, ptr %10, align 4, !tbaa !11
  %81 = getelementptr inbounds %"class.o3dgc::CompressedTriangleFans", ptr %21, i32 0, i32 6
  %82 = load ptr, ptr %81, align 8, !tbaa !19
  invoke void @_ZN5o3dgc16Arithmetic_Codec10set_bufferEjPh(ptr noundef nonnull align 8 dereferenceable(44) %14, i32 noundef %80, ptr noundef %82)
          to label %83 unwind label %94

83:                                               ; preds = %79
  invoke void @_ZN5o3dgc16Arithmetic_Codec13start_encoderEv(ptr noundef nonnull align 8 dereferenceable(44) %14)
          to label %84 unwind label %94

84:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 56, ptr %17) #7
  %85 = load i64, ptr %7, align 8, !tbaa !9
  %86 = add i64 %85, 1
  %87 = trunc i64 %86 to i32
  invoke void @_ZN5o3dgc19Adaptive_Data_ModelC1Ej(ptr noundef nonnull align 8 dereferenceable(52) %17, i32 noundef %87)
          to label %88 unwind label %98

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

89:                                               ; preds = %112, %88
  %90 = load i64, ptr %18, align 8, !tbaa !9
  %91 = load i64, ptr %11, align 8, !tbaa !9
  %92 = icmp ult i64 %90, %91
  br i1 %92, label %102, label %93

93:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %119

94:                                               ; preds = %83, %79
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %15, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %16, align 4
  br label %151

98:                                               ; preds = %84
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %15, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %16, align 4
  br label %150

102:                                              ; preds = %89
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = load i64, ptr %18, align 8, !tbaa !9
  %105 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5o3dgc6VectorIlEixEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef %104)
          to label %106 unwind label %115

106:                                              ; preds = %102
  %107 = load i64, ptr %105, align 8, !tbaa !9
  %108 = load i64, ptr %12, align 8, !tbaa !9
  %109 = sub nsw i64 %107, %108
  %110 = trunc i64 %109 to i32
  invoke void @_ZN5o3dgc16Arithmetic_Codec6encodeEjRNS_19Adaptive_Data_ModelE(ptr noundef nonnull align 8 dereferenceable(44) %14, i32 noundef %110, ptr noundef nonnull align 8 dereferenceable(52) %17)
          to label %111 unwind label %115

111:                                              ; preds = %106
  br label %112

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

115:                                              ; preds = %106, %102
  %116 = landingpad { ptr, i32 }
          cleanup
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %15, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %149

119:                                              ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %120 = invoke noundef i32 @_ZN5o3dgc16Arithmetic_Codec12stop_encoderEv(ptr noundef nonnull align 8 dereferenceable(44) %14)
          to label %121 unwind label %128

121:                                              ; preds = %119
  %122 = zext i32 %120 to i64
  store i64 %122, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  store i64 0, ptr %20, align 8, !tbaa !9
  br label %123

123:                                              ; preds = %140, %121
  %124 = load i64, ptr %20, align 8, !tbaa !9
  %125 = load i64, ptr %19, align 8, !tbaa !9
  %126 = icmp ult i64 %124, %125
  br i1 %126, label %132, label %127

127:                                              ; preds = %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %147

128:                                              ; preds = %119
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %15, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %16, align 4
  br label %148

132:                                              ; preds = %123
  %133 = load ptr, ptr %8, align 8, !tbaa !5
  %134 = getelementptr inbounds %"class.o3dgc::CompressedTriangleFans", ptr %21, i32 0, i32 6
  %135 = load ptr, ptr %134, align 8, !tbaa !19
  %136 = load i64, ptr %20, align 8, !tbaa !9
  %137 = getelementptr inbounds i8, ptr %135, i64 %136
  %138 = load i8, ptr %137, align 1, !tbaa !21
  invoke void @_ZN5o3dgc12BinaryStream14WriteUChar8BinEh(ptr noundef nonnull align 8 dereferenceable(28) %133, i8 noundef zeroext %138)
          to label %139 unwind label %143

139:                                              ; preds = %132
  br label %140

140:                                              ; preds = %139
  %141 = load i64, ptr %20, align 8, !tbaa !9
  %142 = add i64 %141, 1
  store i64 %142, ptr %20, align 8, !tbaa !9
  br label %123, !llvm.loop !22

143:                                              ; preds = %132
  %144 = landingpad { ptr, i32 }
          cleanup
  %145 = extractvalue { ptr, i32 } %144, 0
  store ptr %145, ptr %15, align 8
  %146 = extractvalue { ptr, i32 } %144, 1
  store i32 %146, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %148

147:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @_ZN5o3dgc19Adaptive_Data_ModelD1Ev(ptr noundef nonnull align 8 dereferenceable(52) %17) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr %17) #7
  call void @_ZN5o3dgc16Arithmetic_CodecD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %14) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %14) #7
  br label %152

148:                                              ; preds = %143, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %149

149:                                              ; preds = %148, %115
  call void @_ZN5o3dgc19Adaptive_Data_ModelD1Ev(ptr noundef nonnull align 8 dereferenceable(52) %17) #7
  br label %150

150:                                              ; preds = %149, %98
  call void @llvm.lifetime.end.p0(i64 56, ptr %17) #7
  br label %151

151:                                              ; preds = %150, %94
  call void @_ZN5o3dgc16Arithmetic_CodecD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %14) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %159

152:                                              ; preds = %147, %4
  %153 = load ptr, ptr %8, align 8, !tbaa !5
  %154 = load i64, ptr %9, align 8, !tbaa !9
  %155 = load ptr, ptr %8, align 8, !tbaa !5
  %156 = call noundef i64 @_ZNK5o3dgc12BinaryStream7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %155)
  %157 = load i64, ptr %9, align 8, !tbaa !9
  %158 = sub i64 %156, %157
  call void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEmm(ptr noundef nonnull align 8 dereferenceable(28) %153, i64 noundef %154, i64 noundef %158)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  ret i32 0

159:                                              ; preds = %151
  %160 = load ptr, ptr %15, align 8
  %161 = load i32, ptr %16, align 4
  %162 = insertvalue { ptr, i32 } poison, ptr %160, 0
  %163 = insertvalue { ptr, i32 } %162, i32 %161, 1
  resume { ptr, i32 } %163
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEm(ptr noundef nonnull align 8 dereferenceable(28), i64 noundef) #1 align 2

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

declare void @_ZN5o3dgc16Arithmetic_Codec6encodeEjRNS_19Adaptive_Data_ModelE(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef, ptr noundef nonnull align 8 dereferenceable(52)) #5

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5o3dgc12BinaryStream14WriteUChar8BinEh(ptr noundef nonnull align 8 dereferenceable(28), i8 noundef zeroext) #1 align 2

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEmm(ptr noundef nonnull align 8 dereferenceable(28), i64 noundef, i64 noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 #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 = { "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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 152}
!16 = !{!"_ZTSN5o3dgc22CompressedTriangleFansE", !17, i64 0, !17, i64 24, !17, i64 48, !17, i64 72, !17, i64 96, !17, i64 120, !6, i64 144, !10, i64 152, !18, i64 160}
!17 = !{!"_ZTSN5o3dgc6VectorIlEE", !6, i64 0, !10, i64 8, !10, i64 16}
!18 = !{!"_ZTSN5o3dgc15O3DGCStreamTypeE", !7, i64 0}
!19 = !{!16, !6, i64 144}
!20 = distinct !{!20, !14}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !14}


; 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::Adaptive_Data_Model" = type <{ ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>

; 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 uwtable
declare dso_local noundef i64 @_ZNK5o3dgc12BinaryStream7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK5o3dgc6VectorIlE7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5o3dgc6VectorIlEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5o3dgc22CompressedTriangleFans10SaveUIntACERKNS_6VectorIlEEmRNS_12BinaryStreamE(ptr nocapture noundef nonnull align 8 dereferenceable(164) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %2, ptr noundef nonnull align 8 dereferenceable(28) %3) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.o3dgc::Arithmetic_Codec", align 8
  %6 = alloca %"class.o3dgc::Adaptive_Data_Model", align 8
  %7 = tail call noundef i64 @_ZNK5o3dgc12BinaryStream7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %3)
  %8 = tail call noundef i64 @_ZNK5o3dgc6VectorIlE7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.tr = trunc i64 %8 to i32
  %9 = shl i32 %.tr, 3
  %10 = add i32 %9, 100
  %11 = tail call noundef i64 @_ZNK5o3dgc6VectorIlE7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  tail call void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEm(ptr noundef nonnull align 8 dereferenceable(28) %3, i64 noundef 0)
  tail call void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEm(ptr noundef nonnull align 8 dereferenceable(28) %3, i64 noundef %11)
  %.not = icmp eq i64 %11, 0
  br i1 %.not, label %67, label %.preheader55

12:                                               ; preds = %23
  tail call void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEm(ptr noundef nonnull align 8 dereferenceable(28) %3, i64 noundef %.1)
  %13 = getelementptr inbounds i8, ptr %0, i64 152
  %14 = load i64, ptr %13, align 8, !tbaa !5
  %15 = zext i32 %10 to i64
  %16 = icmp ult i64 %14, %15
  br i1 %16, label %25, label %32

.preheader55:                                     ; preds = %4, %23
  %.03857 = phi i64 [ %.1, %23 ], [ 2147483647, %4 ]
  %.04656 = phi i64 [ %24, %23 ], [ 0, %4 ]
  %17 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5o3dgc6VectorIlEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.04656)
  %18 = load i64, ptr %17, align 8, !tbaa !13
  %19 = icmp sgt i64 %.03857, %18
  br i1 %19, label %20, label %23

20:                                               ; preds = %.preheader55
  %21 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5o3dgc6VectorIlEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.04656)
  %22 = load i64, ptr %21, align 8, !tbaa !13
  br label %23

23:                                               ; preds = %.preheader55, %20
  %.1 = phi i64 [ %22, %20 ], [ %.03857, %.preheader55 ]
  %24 = add nuw i64 %.04656, 1
  %exitcond.not = icmp eq i64 %24, %11
  br i1 %exitcond.not, label %12, label %.preheader55, !llvm.loop !14

25:                                               ; preds = %12
  %26 = getelementptr inbounds i8, ptr %0, i64 144
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = icmp eq ptr %27, null
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  tail call void @_ZdaPv(ptr noundef nonnull %27) #7
  br label %30

30:                                               ; preds = %29, %25
  store i64 %15, ptr %13, align 8, !tbaa !5
  %31 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %15) #8
  store ptr %31, ptr %26, align 8, !tbaa !16
  br label %32

32:                                               ; preds = %30, %12
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #9
  call void @_ZN5o3dgc16Arithmetic_CodecC1Ev(ptr noundef nonnull align 8 dereferenceable(44) %5)
  %33 = getelementptr inbounds i8, ptr %0, i64 144
  %34 = load ptr, ptr %33, align 8, !tbaa !16
  invoke void @_ZN5o3dgc16Arithmetic_Codec10set_bufferEjPh(ptr noundef nonnull align 8 dereferenceable(44) %5, i32 noundef %10, ptr noundef %34)
          to label %35 unwind label %41

35:                                               ; preds = %32
  invoke void @_ZN5o3dgc16Arithmetic_Codec13start_encoderEv(ptr noundef nonnull align 8 dereferenceable(44) %5)
          to label %36 unwind label %41

36:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %6) #9
  %37 = trunc i64 %2 to i32
  %38 = add i32 %37, 1
  invoke void @_ZN5o3dgc19Adaptive_Data_ModelC1Ej(ptr noundef nonnull align 8 dereferenceable(52) %6, i32 noundef %38)
          to label %.preheader unwind label %43

39:                                               ; preds = %49
  %40 = invoke noundef i32 @_ZN5o3dgc16Arithmetic_Codec12stop_encoderEv(ptr noundef nonnull align 8 dereferenceable(44) %5)
          to label %53 unwind label %55

41:                                               ; preds = %35, %32
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %66

43:                                               ; preds = %36
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %65

.preheader:                                       ; preds = %36, %49
  %.03958 = phi i64 [ %50, %49 ], [ 0, %36 ]
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5o3dgc6VectorIlEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.03958)
  %46 = load i64, ptr %45, align 8, !tbaa !13
  %47 = sub nsw i64 %46, %.1
  %48 = trunc i64 %47 to i32
  invoke void @_ZN5o3dgc16Arithmetic_Codec6encodeEjRNS_19Adaptive_Data_ModelE(ptr noundef nonnull align 8 dereferenceable(44) %5, i32 noundef %48, ptr noundef nonnull align 8 dereferenceable(52) %6)
          to label %49 unwind label %51

49:                                               ; preds = %.preheader
  %50 = add nuw i64 %.03958, 1
  %exitcond61.not = icmp eq i64 %50, %11
  br i1 %exitcond61.not, label %39, label %.preheader, !llvm.loop !17

51:                                               ; preds = %.preheader
  %52 = landingpad { ptr, i32 }
          cleanup
  br label %64

53:                                               ; preds = %39
  %54 = zext i32 %40 to i64
  %.not60 = icmp eq i32 %40, 0
  br i1 %.not60, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %60, %53
  call void @_ZN5o3dgc19Adaptive_Data_ModelD1Ev(ptr noundef nonnull align 8 dereferenceable(52) %6) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %6) #9
  call void @_ZN5o3dgc16Arithmetic_CodecD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %5) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #9
  br label %67

55:                                               ; preds = %39
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %64

.lr.ph:                                           ; preds = %53, %60
  %.059 = phi i64 [ %61, %60 ], [ 0, %53 ]
  %57 = load ptr, ptr %33, align 8, !tbaa !16
  %58 = getelementptr inbounds i8, ptr %57, i64 %.059
  %59 = load i8, ptr %58, align 1, !tbaa !18
  invoke void @_ZN5o3dgc12BinaryStream14WriteUChar8BinEh(ptr noundef nonnull align 8 dereferenceable(28) %3, i8 noundef zeroext %59)
          to label %60 unwind label %62

60:                                               ; preds = %.lr.ph
  %61 = add nuw nsw i64 %.059, 1
  %exitcond62.not = icmp eq i64 %61, %54
  br i1 %exitcond62.not, label %._crit_edge, label %.lr.ph, !llvm.loop !19

62:                                               ; preds = %.lr.ph
  %63 = landingpad { ptr, i32 }
          cleanup
  br label %64

64:                                               ; preds = %55, %62, %51
  %.pn51 = phi { ptr, i32 } [ %52, %51 ], [ %63, %62 ], [ %56, %55 ]
  call void @_ZN5o3dgc19Adaptive_Data_ModelD1Ev(ptr noundef nonnull align 8 dereferenceable(52) %6) #9
  br label %65

65:                                               ; preds = %64, %43
  %.pn51.pn = phi { ptr, i32 } [ %.pn51, %64 ], [ %44, %43 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %6) #9
  br label %66

66:                                               ; preds = %65, %41
  %.pn51.pn.pn = phi { ptr, i32 } [ %.pn51.pn, %65 ], [ %42, %41 ]
  call void @_ZN5o3dgc16Arithmetic_CodecD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %5) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #9
  resume { ptr, i32 } %.pn51.pn.pn

67:                                               ; preds = %._crit_edge, %4
  %68 = call noundef i64 @_ZNK5o3dgc12BinaryStream7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %3)
  %69 = sub i64 %68, %7
  call void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEmm(ptr noundef nonnull align 8 dereferenceable(28) %3, i64 noundef %7, i64 noundef %69)
  ret i32 0
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEm(ptr noundef nonnull align 8 dereferenceable(28), i64 noundef) local_unnamed_addr #1 align 2

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

declare void @_ZN5o3dgc16Arithmetic_Codec6encodeEjRNS_19Adaptive_Data_ModelE(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef, ptr noundef nonnull align 8 dereferenceable(52)) local_unnamed_addr #5

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5o3dgc12BinaryStream14WriteUChar8BinEh(ptr noundef nonnull align 8 dereferenceable(28), i8 noundef zeroext) local_unnamed_addr #1 align 2

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5o3dgc12BinaryStream14WriteUInt32BinEmm(ptr noundef nonnull align 8 dereferenceable(28), i64 noundef, i64 noundef) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 #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 = { "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 = { builtin nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { 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, !11, i64 152}
!6 = !{!"_ZTSN5o3dgc22CompressedTriangleFansE", !7, i64 0, !7, i64 24, !7, i64 48, !7, i64 72, !7, i64 96, !7, i64 120, !8, i64 144, !11, i64 152, !12, i64 160}
!7 = !{!"_ZTSN5o3dgc6VectorIlEE", !8, i64 0, !11, i64 8, !11, i64 16}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"_ZTSN5o3dgc15O3DGCStreamTypeE", !9, i64 0}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!6, !8, i64 144}
!17 = distinct !{!17, !15}
!18 = !{!9, !9, i64 0}
!19 = distinct !{!19, !15}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass