; LLVM IR from thepowersgang/mrustc :: src/hir/serialise_lowlevel.ll (ZN3HIR9serialise11ReaderInner4readEPvm)

; 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.HIR::serialise::ReaderInner" = type { %"class.std::basic_ifstream", %struct.z_stream_s, %"class.std::vector", i32, i32 }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%struct.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZTISt13runtime_error = external constant ptr
@.str.17 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [19 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

declare i32 @__gxx_personality_v0(...)

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

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #1

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare void @__cxa_throw(ptr, ptr, ptr)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN3HIR9serialise11ReaderInner4readEPvm(ptr noundef nonnull align 8 dereferenceable(664) %0, ptr noundef %1, i64 noundef %2) #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  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
  %11 = load ptr, ptr %5, align 8
  %12 = load i64, ptr %7, align 8, !tbaa !9
  %13 = trunc i64 %12 to i32
  %14 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %15 = getelementptr inbounds %struct.z_stream_s, ptr %14, i32 0, i32 4
  store i32 %13, ptr %15, align 8, !tbaa !11
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %18 = getelementptr inbounds %struct.z_stream_s, ptr %17, i32 0, i32 3
  store ptr %16, ptr %18, align 8, !tbaa !28
  br label %19

19:                                               ; preds = %93, %3
  %20 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %21 = getelementptr inbounds %struct.z_stream_s, ptr %20, i32 0, i32 1
  %22 = load i32, ptr %21, align 8, !tbaa !29
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %69

24:                                               ; preds = %19
  %25 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 0
  %26 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 2
  %27 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #5
  %28 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 2
  %29 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #5
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef %27, i64 noundef %29)
  %31 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 0
  %32 = call noundef i64 @_ZNKSi6gcountEv(ptr noundef nonnull align 8 dereferenceable(16) %31)
  %33 = trunc i64 %32 to i32
  %34 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %35 = getelementptr inbounds %struct.z_stream_s, ptr %34, i32 0, i32 1
  store i32 %33, ptr %35, align 8, !tbaa !29
  %36 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %37 = getelementptr inbounds %struct.z_stream_s, ptr %36, i32 0, i32 1
  %38 = load i32, ptr %37, align 8, !tbaa !29
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %58

40:                                               ; preds = %24
  %41 = load i64, ptr %7, align 8, !tbaa !9
  %42 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %43 = getelementptr inbounds %struct.z_stream_s, ptr %42, i32 0, i32 4
  %44 = load i32, ptr %43, align 8, !tbaa !11
  %45 = zext i32 %44 to i64
  %46 = sub i64 %41, %45
  %47 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 3
  %48 = load i32, ptr %47, align 8, !tbaa !30
  %49 = zext i32 %48 to i64
  %50 = add i64 %49, %46
  %51 = trunc i64 %50 to i32
  store i32 %51, ptr %47, align 8, !tbaa !30
  %52 = load i64, ptr %7, align 8, !tbaa !9
  %53 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %54 = getelementptr inbounds %struct.z_stream_s, ptr %53, i32 0, i32 4
  %55 = load i32, ptr %54, align 8, !tbaa !11
  %56 = zext i32 %55 to i64
  %57 = sub i64 %52, %56
  store i64 %57, ptr %4, align 8
  br label %107

58:                                               ; preds = %24
  %59 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 2
  %60 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %59) #5
  %61 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %62 = getelementptr inbounds %struct.z_stream_s, ptr %61, i32 0, i32 0
  store ptr %60, ptr %62, align 8, !tbaa !31
  %63 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %64 = getelementptr inbounds %struct.z_stream_s, ptr %63, i32 0, i32 1
  %65 = load i32, ptr %64, align 8, !tbaa !29
  %66 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 4
  %67 = load i32, ptr %66, align 4, !tbaa !32
  %68 = add i32 %67, %65
  store i32 %68, ptr %66, align 4, !tbaa !32
  br label %69

69:                                               ; preds = %58, %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %70 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %71 = call i32 @inflate(ptr noundef %70, i32 noundef 0)
  store i32 %71, ptr %8, align 4, !tbaa !33
  %72 = load i32, ptr %8, align 4, !tbaa !33
  %73 = icmp eq i32 %72, -2
  br i1 %73, label %74, label %81

74:                                               ; preds = %69
  %75 = call ptr @__cxa_allocate_exception(i64 16) #5
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %75, ptr noundef @.str.17)
          to label %76 unwind label %77

76:                                               ; preds = %74
  call void @__cxa_throw(ptr %75, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #6
  unreachable

77:                                               ; preds = %74
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %9, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %10, align 4
  call void @__cxa_free_exception(ptr %75) #5
  br label %106

81:                                               ; preds = %69
  %82 = load i32, ptr %8, align 4, !tbaa !33
  switch i32 %82, label %91 [
    i32 2, label %83
    i32 -3, label %84
    i32 -4, label %84
  ]

83:                                               ; preds = %81
  store i32 -3, ptr %8, align 4, !tbaa !33
  br label %84

84:                                               ; preds = %83, %81, %81
  %85 = call ptr @__cxa_allocate_exception(i64 16) #5
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %85, ptr noundef @.str.18)
          to label %86 unwind label %87

86:                                               ; preds = %84
  call void @__cxa_throw(ptr %85, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #6
  unreachable

87:                                               ; preds = %84
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %9, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %10, align 4
  call void @__cxa_free_exception(ptr %85) #5
  br label %106

91:                                               ; preds = %81
  br label %92

92:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %93

93:                                               ; preds = %92
  %94 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 1
  %95 = getelementptr inbounds %struct.z_stream_s, ptr %94, i32 0, i32 4
  %96 = load i32, ptr %95, align 8, !tbaa !11
  %97 = icmp ugt i32 %96, 0
  br i1 %97, label %19, label %98, !llvm.loop !34

98:                                               ; preds = %93
  %99 = load i64, ptr %7, align 8, !tbaa !9
  %100 = getelementptr inbounds %"class.HIR::serialise::ReaderInner", ptr %11, i32 0, i32 3
  %101 = load i32, ptr %100, align 8, !tbaa !30
  %102 = zext i32 %101 to i64
  %103 = add i64 %102, %99
  %104 = trunc i64 %103 to i32
  store i32 %104, ptr %100, align 8, !tbaa !30
  %105 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %105, ptr %4, align 8
  br label %107

106:                                              ; preds = %87, %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %109

107:                                              ; preds = %98, %40
  %108 = load i64, ptr %4, align 8
  ret i64 %108

109:                                              ; preds = %106
  %110 = load ptr, ptr %9, align 8
  %111 = load i32, ptr %10, align 4
  %112 = insertvalue { ptr, i32 } poison, ptr %110, 0
  %113 = insertvalue { ptr, i32 } %112, i32 %111, 1
  resume { ptr, i32 } %113
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSi6gcountEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

declare i32 @inflate(ptr noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn }

!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, !22, i64 552}
!12 = !{!"_ZTSN3HIR9serialise11ReaderInnerE", !13, i64 0, !23, i64 520, !24, i64 632, !22, i64 656, !22, i64 660}
!13 = !{!"_ZTSSt14basic_ifstreamIcSt11char_traitsIcEE", !14, i64 0, !15, i64 16}
!14 = !{!"_ZTSSi", !10, i64 8}
!15 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !16, i64 0, !7, i64 64, !18, i64 104, !20, i64 120, !21, i64 124, !21, i64 132, !21, i64 140, !6, i64 152, !10, i64 160, !19, i64 168, !19, i64 169, !19, i64 170, !7, i64 171, !6, i64 176, !6, i64 184, !19, i64 192, !6, i64 200, !6, i64 208, !10, i64 216, !6, i64 224, !6, i64 232}
!16 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !17, i64 56}
!17 = !{!"_ZTSSt6locale", !6, i64 0}
!18 = !{!"_ZTSSt12__basic_fileIcE", !6, i64 0, !19, i64 8}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTSSt13_Ios_Openmode", !7, i64 0}
!21 = !{!"_ZTS11__mbstate_t", !22, i64 0, !7, i64 4}
!22 = !{!"int", !7, i64 0}
!23 = !{!"_ZTS10z_stream_s", !6, i64 0, !22, i64 8, !10, i64 16, !6, i64 24, !22, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !22, i64 88, !10, i64 96, !10, i64 104}
!24 = !{!"_ZTSSt6vectorIhSaIhEE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!12, !6, i64 544}
!29 = !{!12, !22, i64 528}
!30 = !{!12, !22, i64 656}
!31 = !{!12, !6, i64 520}
!32 = !{!12, !22, i64 660}
!33 = !{!22, !22, i64 0}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


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

@_ZTISt13runtime_error = external constant ptr
@.str.17 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [19 x i8], align 1

declare i32 @__gxx_personality_v0(...)

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #0

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN3HIR9serialise11ReaderInner4readEPvm(ptr noundef nonnull align 8 dereferenceable(664) %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = trunc i64 %2 to i32
  %5 = getelementptr inbounds i8, ptr %0, i64 520
  %6 = getelementptr inbounds i8, ptr %0, i64 552
  store i32 %4, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 544
  store ptr %1, ptr %7, align 8, !tbaa !26
  %8 = getelementptr inbounds i8, ptr %0, i64 528
  %9 = getelementptr inbounds i8, ptr %0, i64 632
  %10 = getelementptr inbounds i8, ptr %0, i64 660
  br label %11

11:                                               ; preds = %46, %3
  %12 = load i32, ptr %8, align 8, !tbaa !27
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %14, label %34

14:                                               ; preds = %11
  %15 = tail call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #4
  %16 = tail call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #4
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %15, i64 noundef %16)
  %18 = tail call noundef i64 @_ZNKSi6gcountEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %19 = trunc i64 %18 to i32
  store i32 %19, ptr %8, align 8, !tbaa !27
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %29

21:                                               ; preds = %14
  %22 = load i32, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %0, i64 656
  %24 = load i32, ptr %23, align 8, !tbaa !28
  %25 = sub i32 %4, %22
  %26 = add i32 %25, %24
  store i32 %26, ptr %23, align 8, !tbaa !28
  %27 = zext i32 %22 to i64
  %28 = sub i64 %2, %27
  br label %53

29:                                               ; preds = %14
  %30 = tail call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #4
  store ptr %30, ptr %5, align 8, !tbaa !29
  %31 = load i32, ptr %8, align 8, !tbaa !27
  %32 = load i32, ptr %10, align 4, !tbaa !30
  %33 = add i32 %32, %31
  store i32 %33, ptr %10, align 4, !tbaa !30
  br label %34

34:                                               ; preds = %29, %11
  %35 = tail call i32 @inflate(ptr noundef nonnull %5, i32 noundef 0)
  switch i32 %35, label %46 [
    i32 -2, label %36
    i32 2, label %41
    i32 -3, label %41
    i32 -4, label %41
  ]

36:                                               ; preds = %34
  %37 = tail call ptr @__cxa_allocate_exception(i64 16) #4
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull @.str.17)
          to label %38 unwind label %39

38:                                               ; preds = %36
  tail call void @__cxa_throw(ptr nonnull %37, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #5
  unreachable

39:                                               ; preds = %36
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %52

41:                                               ; preds = %34, %34, %34
  %42 = tail call ptr @__cxa_allocate_exception(i64 16) #4
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull @.str.18)
          to label %43 unwind label %44

43:                                               ; preds = %41
  tail call void @__cxa_throw(ptr nonnull %42, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #5
  unreachable

44:                                               ; preds = %41
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %52

46:                                               ; preds = %34
  %47 = load i32, ptr %6, align 8, !tbaa !5
  %.not = icmp eq i32 %47, 0
  br i1 %.not, label %48, label %11, !llvm.loop !31

48:                                               ; preds = %46
  %49 = getelementptr inbounds i8, ptr %0, i64 656
  %50 = load i32, ptr %49, align 8, !tbaa !28
  %51 = add i32 %50, %4
  store i32 %51, ptr %49, align 8, !tbaa !28
  br label %53

52:                                               ; preds = %44, %39
  %.sink = phi ptr [ %42, %44 ], [ %37, %39 ]
  %.pn = phi { ptr, i32 } [ %45, %44 ], [ %40, %39 ]
  tail call void @__cxa_free_exception(ptr %.sink) #4
  resume { ptr, i32 } %.pn

53:                                               ; preds = %48, %21
  %.012 = phi i64 [ %28, %21 ], [ %2, %48 ]
  ret i64 %.012
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64 noundef) local_unnamed_addr #0

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

declare i32 @inflate(ptr noundef, i32 noundef) local_unnamed_addr #0

attributes #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 #1 = { 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 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 = { 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 }
attributes #5 = { noreturn }

!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, !20, i64 552}
!6 = !{!"_ZTSN3HIR9serialise11ReaderInnerE", !7, i64 0, !21, i64 520, !22, i64 632, !20, i64 656, !20, i64 660}
!7 = !{!"_ZTSSt14basic_ifstreamIcSt11char_traitsIcEE", !8, i64 0, !12, i64 16}
!8 = !{!"_ZTSSi", !9, i64 8}
!9 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !13, i64 0, !10, i64 64, !16, i64 104, !18, i64 120, !19, i64 124, !19, i64 132, !19, i64 140, !14, i64 152, !9, i64 160, !17, i64 168, !17, i64 169, !17, i64 170, !10, i64 171, !14, i64 176, !14, i64 184, !17, i64 192, !14, i64 200, !14, i64 208, !9, i64 216, !14, i64 224, !14, i64 232}
!13 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !15, i64 56}
!14 = !{!"any pointer", !10, i64 0}
!15 = !{!"_ZTSSt6locale", !14, i64 0}
!16 = !{!"_ZTSSt12__basic_fileIcE", !14, i64 0, !17, i64 8}
!17 = !{!"bool", !10, i64 0}
!18 = !{!"_ZTSSt13_Ios_Openmode", !10, i64 0}
!19 = !{!"_ZTS11__mbstate_t", !20, i64 0, !10, i64 4}
!20 = !{!"int", !10, i64 0}
!21 = !{!"_ZTS10z_stream_s", !14, i64 0, !20, i64 8, !9, i64 16, !14, i64 24, !20, i64 32, !9, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !20, i64 88, !9, i64 96, !9, i64 104}
!22 = !{!"_ZTSSt6vectorIhSaIhEE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!26 = !{!6, !14, i64 544}
!27 = !{!6, !20, i64 528}
!28 = !{!6, !20, i64 656}
!29 = !{!6, !14, i64 520}
!30 = !{!6, !20, i64 660}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


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