; LLVM IR from team-charls/charls :: src (jpeg_stream_reader)

; 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.charls::jpeg_stream_reader" = type { ptr, ptr, %"class.charls::span", %struct.charls_frame_info, %"struct.charls::coding_parameters", %struct.charls_jpegls_pc_parameters, %"class.std::vector", %"class.std::vector.0", i32, i32, i32, i32, i8, i32, %"struct.charls::callback_function", %"struct.charls::callback_function.5" }
%"class.charls::span" = type { ptr, i64 }
%struct.charls_frame_info = type { i32, i32, i32, i32 }
%"struct.charls::coding_parameters" = type { i32, i32, i32, i32 }
%struct.charls_jpegls_pc_parameters = type { i32, i32, i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<charls::jpeg_stream_reader::component_info, std::allocator<charls::jpeg_stream_reader::component_info>>::_Vector_impl" }
%"struct.std::_Vector_base<charls::jpeg_stream_reader::component_info, std::allocator<charls::jpeg_stream_reader::component_info>>::_Vector_impl" = type { %"struct.std::_Vector_base<charls::jpeg_stream_reader::component_info, std::allocator<charls::jpeg_stream_reader::component_info>>::_Vector_impl_data" }
%"struct.std::_Vector_base<charls::jpeg_stream_reader::component_info, std::allocator<charls::jpeg_stream_reader::component_info>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<charls::jpeg_stream_reader::mapping_table_entry, std::allocator<charls::jpeg_stream_reader::mapping_table_entry>>::_Vector_impl" }
%"struct.std::_Vector_base<charls::jpeg_stream_reader::mapping_table_entry, std::allocator<charls::jpeg_stream_reader::mapping_table_entry>>::_Vector_impl" = type { %"struct.std::_Vector_base<charls::jpeg_stream_reader::mapping_table_entry, std::allocator<charls::jpeg_stream_reader::mapping_table_entry>>::_Vector_impl_data" }
%"struct.std::_Vector_base<charls::jpeg_stream_reader::mapping_table_entry, std::allocator<charls::jpeg_stream_reader::mapping_table_entry>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.charls::callback_function" = type { ptr, ptr }
%"struct.charls::callback_function.5" = type { ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__._ZN6charls18jpeg_stream_reader11read_headerEP19charls_spiff_headerPb = external hidden unnamed_addr constant [69 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6charls4spanIKSt4byteE3endEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6charls18jpeg_stream_reader11read_headerEP19charls_spiff_headerPb(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef %1, ptr noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  %10 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 8
  %11 = load i32, ptr %10, align 8, !tbaa !9
  %12 = icmp ne i32 %11, 4
  br i1 %12, label %13, label %14

13:                                               ; preds = %3
  br label %16

14:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 88, ptr noundef @__PRETTY_FUNCTION__._ZN6charls18jpeg_stream_reader11read_headerEP19charls_spiff_headerPb) #6
  unreachable

15:                                               ; No predecessors!
  br label %16

16:                                               ; preds = %15, %13
  %17 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 8
  %18 = load i32, ptr %17, align 8, !tbaa !9
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %32

20:                                               ; preds = %16
  %21 = call noundef zeroext i8 @_ZN6charls18jpeg_stream_reader21read_next_marker_codeEv(ptr noundef nonnull align 8 dereferenceable(192) %9)
  %22 = icmp ne i8 %21, -40
  %23 = xor i1 %22, true
  %24 = xor i1 %23, true
  %25 = zext i1 %24 to i64
  %26 = call i64 @llvm.expect.i64(i64 %25, i64 0)
  %27 = icmp ne i64 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %20
  call void @_ZN6charls4impl18throw_jpegls_errorENS_11jpegls_errcE(i32 noundef 11) #7
  unreachable

29:                                               ; preds = %20
  %30 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 6
  call void @_ZNSt6vectorIN6charls18jpeg_stream_reader14component_infoESaIS2_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef 4)
  %31 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 8
  store i32 1, ptr %31, align 8, !tbaa !9
  br label %32

32:                                               ; preds = %29, %16
  br label %33

33:                                               ; preds = %92, %32
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #8
  %34 = call noundef zeroext i8 @_ZN6charls18jpeg_stream_reader21read_next_marker_codeEv(ptr noundef nonnull align 8 dereferenceable(192) %9)
  store i8 %34, ptr %7, align 1, !tbaa !32
  %35 = load i8, ptr %7, align 1, !tbaa !32
  %36 = icmp eq i8 %35, -39
  br i1 %36, label %37, label %43

37:                                               ; preds = %33
  %38 = call noundef zeroext i1 @_ZNK6charls18jpeg_stream_reader50is_abbreviated_format_for_table_specification_dataEv(ptr noundef nonnull align 8 dereferenceable(192) %9)
  br i1 %38, label %39, label %42

39:                                               ; preds = %37
  %40 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 8
  store i32 6, ptr %40, align 8, !tbaa !9
  %41 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 13
  store i32 3, ptr %41, align 4, !tbaa !34
  store i32 1, ptr %8, align 4
  br label %90

42:                                               ; preds = %37
  call void @_ZN6charls4impl18throw_jpegls_errorENS_11jpegls_errcE(i32 noundef 19) #7
  unreachable

43:                                               ; preds = %33
  %44 = load i8, ptr %7, align 1, !tbaa !32
  call void @_ZNK6charls18jpeg_stream_reader20validate_marker_codeENS_16jpeg_marker_codeE(ptr noundef nonnull align 8 dereferenceable(192) %9, i8 noundef zeroext %44)
  call void @_ZN6charls18jpeg_stream_reader17read_segment_sizeEv(ptr noundef nonnull align 8 dereferenceable(192) %9)
  %45 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 8
  %46 = load i32, ptr %45, align 8, !tbaa !9
  switch i32 %46, label %49 [
    i32 2, label %47
  ]

47:                                               ; preds = %43
  %48 = load i8, ptr %7, align 1, !tbaa !32
  call void @_ZN6charls18jpeg_stream_reader26read_spiff_directory_entryENS_16jpeg_marker_codeE(ptr noundef nonnull align 8 dereferenceable(192) %9, i8 noundef zeroext %48)
  br label %53

49:                                               ; preds = %43
  %50 = load i8, ptr %7, align 1, !tbaa !32
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN6charls18jpeg_stream_reader19read_marker_segmentENS_16jpeg_marker_codeEP19charls_spiff_headerPb(ptr noundef nonnull align 8 dereferenceable(192) %9, i8 noundef zeroext %50, ptr noundef %51, ptr noundef %52)
  br label %53

53:                                               ; preds = %49, %47
  %54 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 2
  %55 = call noundef ptr @_ZNK6charls4spanIKSt4byteE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %54) #8
  %56 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !35
  %58 = ptrtoint ptr %55 to i64
  %59 = ptrtoint ptr %57 to i64
  %60 = sub i64 %58, %59
  %61 = icmp eq i64 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %53
  br label %65

63:                                               ; preds = %53
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 128, ptr noundef @__PRETTY_FUNCTION__._ZN6charls18jpeg_stream_reader11read_headerEP19charls_spiff_headerPb) #6
  unreachable

64:                                               ; No predecessors!
  br label %65

65:                                               ; preds = %64, %62
  %66 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 8
  %67 = load i32, ptr %66, align 8, !tbaa !9
  %68 = icmp eq i32 %67, 1
  br i1 %68, label %69, label %78

69:                                               ; preds = %65
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %78

72:                                               ; preds = %69
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = load i8, ptr %73, align 1, !tbaa !36, !range !37, !noundef !38
  %75 = trunc i8 %74 to i1
  br i1 %75, label %76, label %78

76:                                               ; preds = %72
  %77 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 8
  store i32 2, ptr %77, align 8, !tbaa !9
  store i32 1, ptr %8, align 4
  br label %90

78:                                               ; preds = %72, %69, %65
  %79 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 8
  %80 = load i32, ptr %79, align 8, !tbaa !9
  %81 = icmp eq i32 %80, 5
  br i1 %81, label %82, label %89

82:                                               ; preds = %78
  %83 = getelementptr inbounds %"class.charls::jpeg_stream_reader", ptr %9, i32 0, i32 3
  %84 = getelementptr inbounds %struct.charls_frame_info, ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 4, !tbaa !39
  %86 = icmp eq i32 %85, 0
  br i1 %86, label %87, label %88

87:                                               ; preds = %82
  call void @_ZN6charls18jpeg_stream_reader44find_and_read_define_number_of_lines_segmentEv(ptr noundef nonnull align 8 dereferenceable(192) %9)
  br label %88

88:                                               ; preds = %87, %82
  call void @_ZNK6charls18jpeg_stream_reader11check_widthEv(ptr noundef nonnull align 8 dereferenceable(192) %9)
  call void @_ZNK6charls18jpeg_stream_reader23check_coding_parametersEv(ptr noundef nonnull align 8 dereferenceable(192) %9)
  store i32 1, ptr %8, align 4
  br label %90

89:                                               ; preds = %78
  store i32 0, ptr %8, align 4
  br label %90

90:                                               ; preds = %89, %88, %76, %39
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #8
  %91 = load i32, ptr %8, align 4
  switch i32 %91, label %94 [
    i32 0, label %92
    i32 1, label %93
  ]

92:                                               ; preds = %90
  br label %33, !llvm.loop !40

93:                                               ; preds = %90
  ret void

94:                                               ; preds = %90
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN6charls18jpeg_stream_reader21read_next_marker_codeEv(ptr noundef nonnull align 8 dereferenceable(192)) #2 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #3

; Function Attrs: mustprogress noinline noreturn uwtable
declare dso_local void @_ZN6charls4impl18throw_jpegls_errorENS_11jpegls_errcE(i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN6charls18jpeg_stream_reader14component_infoESaIS2_EE7reserveEm(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.start.p0(i64 immarg, ptr nocapture) #5

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6charls18jpeg_stream_reader17read_segment_sizeEv(ptr noundef nonnull align 8 dereferenceable(192)) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6charls18jpeg_stream_reader44find_and_read_define_number_of_lines_segmentEv(ptr noundef nonnull align 8 dereferenceable(192)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK6charls18jpeg_stream_reader11check_widthEv(ptr noundef nonnull align 8 dereferenceable(192)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK6charls18jpeg_stream_reader23check_coding_parametersEv(ptr noundef nonnull align 8 dereferenceable(192)) #2 align 2

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

attributes #0 = { 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 #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #4 = { mustprogress noinline noreturn 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { noreturn nounwind }
attributes #7 = { noreturn }
attributes #8 = { 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, !27, i64 136}
!10 = !{!"_ZTSN6charls18jpeg_stream_readerE", !6, i64 0, !6, i64 8, !11, i64 16, !13, i64 32, !15, i64 48, !18, i64 64, !19, i64 88, !23, i64 112, !27, i64 136, !14, i64 140, !14, i64 144, !16, i64 148, !28, i64 152, !29, i64 156, !30, i64 160, !31, i64 176}
!11 = !{!"_ZTSN6charls4spanIKSt4byteEE", !6, i64 0, !12, i64 8}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTS17charls_frame_info", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN6charls17coding_parametersE", !14, i64 0, !14, i64 4, !16, i64 8, !17, i64 12}
!16 = !{!"_ZTSN6charls15interleave_modeE", !7, i64 0}
!17 = !{!"_ZTSN6charls20color_transformationE", !7, i64 0}
!18 = !{!"_ZTS27charls_jpegls_pc_parameters", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16}
!19 = !{!"_ZTSSt6vectorIN6charls18jpeg_stream_reader14component_infoESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIN6charls18jpeg_stream_reader14component_infoESaIS2_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIN6charls18jpeg_stream_reader14component_infoESaIS2_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIN6charls18jpeg_stream_reader14component_infoESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"_ZTSSt6vectorIN6charls18jpeg_stream_reader19mapping_table_entryESaIS2_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIN6charls18jpeg_stream_reader19mapping_table_entryESaIS2_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN6charls18jpeg_stream_reader19mapping_table_entryESaIS2_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN6charls18jpeg_stream_reader19mapping_table_entryESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{!"_ZTSN6charls18jpeg_stream_reader5stateE", !7, i64 0}
!28 = !{!"bool", !7, i64 0}
!29 = !{!"_ZTSN6charls22compressed_data_formatE", !7, i64 0}
!30 = !{!"_ZTSN6charls17callback_functionIPFiPKvmPvEEE", !6, i64 0, !6, i64 8}
!31 = !{!"_ZTSN6charls17callback_functionIPFiiPKvmPvEEE", !6, i64 0, !6, i64 8}
!32 = !{!33, !33, i64 0}
!33 = !{!"_ZTSN6charls16jpeg_marker_codeE", !7, i64 0}
!34 = !{!10, !29, i64 156}
!35 = !{!10, !6, i64 0}
!36 = !{!28, !28, i64 0}
!37 = !{i8 0, i8 2}
!38 = !{}
!39 = !{!10, !14, i64 36}
!40 = distinct !{!40, !41}
!41 = !{!"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"

@.str.1 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__._ZN6charls18jpeg_stream_reader11read_headerEP19charls_spiff_headerPb = external hidden unnamed_addr constant [69 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6charls18jpeg_stream_reader11read_headerEP19charls_spiff_headerPb(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 136
  %5 = load i32, ptr %4, align 8, !tbaa !5
  switch i32 %5, label %12 [
    i32 4, label %6
    i32 0, label %7
  ]

6:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 88, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6charls18jpeg_stream_reader11read_headerEP19charls_spiff_headerPb) #4
  unreachable

7:                                                ; preds = %3
  %8 = tail call noundef zeroext i8 @_ZN6charls18jpeg_stream_reader21read_next_marker_codeEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  %.not13 = icmp eq i8 %8, -40
  br i1 %.not13, label %10, label %9, !prof !31

9:                                                ; preds = %7
  tail call void @_ZN6charls4impl18throw_jpegls_errorENS_11jpegls_errcE(i32 noundef 11) #5
  unreachable

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @_ZNSt6vectorIN6charls18jpeg_stream_reader14component_infoESaIS2_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef 4)
  store i32 1, ptr %4, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %3, %10
  %13 = tail call noundef zeroext i8 @_ZN6charls18jpeg_stream_reader21read_next_marker_codeEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  %14 = icmp eq i8 %13, -39
  br i1 %14, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %12
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.thread.us
  %16 = phi i8 [ %27, %.thread.us ], [ %13, %.lr.ph ]
  tail call void @_ZNK6charls18jpeg_stream_reader20validate_marker_codeENS_16jpeg_marker_codeE(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext %16)
  tail call void @_ZN6charls18jpeg_stream_reader17read_segment_sizeEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  %17 = load i32, ptr %4, align 8, !tbaa !5
  %cond.us = icmp eq i32 %17, 2
  br i1 %cond.us, label %19, label %18

18:                                               ; preds = %.lr.ph.split.us
  tail call void @_ZN6charls18jpeg_stream_reader19read_marker_segmentENS_16jpeg_marker_codeEP19charls_spiff_headerPb(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext %16, ptr noundef %1, ptr noundef null)
  br label %20

19:                                               ; preds = %.lr.ph.split.us
  tail call void @_ZN6charls18jpeg_stream_reader26read_spiff_directory_entryENS_16jpeg_marker_codeE(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext %16)
  br label %20

20:                                               ; preds = %19, %18
  %21 = tail call noundef ptr @_ZNK6charls4spanIKSt4byteE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %15) #6
  %22 = load ptr, ptr %0, align 8, !tbaa !32
  %23 = icmp eq ptr %21, %22
  br i1 %23, label %24, label %.split.us

24:                                               ; preds = %20
  %25 = load i32, ptr %4, align 8, !tbaa !5
  %26 = icmp eq i32 %25, 5
  br i1 %26, label %.split18.us, label %.thread.us

.thread.us:                                       ; preds = %24
  %27 = tail call noundef zeroext i8 @_ZN6charls18jpeg_stream_reader21read_next_marker_codeEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  %28 = icmp eq i8 %27, -39
  br i1 %28, label %._crit_edge, label %.lr.ph.split.us

._crit_edge:                                      ; preds = %.thread, %.thread.us, %12
  %29 = tail call noundef zeroext i1 @_ZNK6charls18jpeg_stream_reader50is_abbreviated_format_for_table_specification_dataEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  br i1 %29, label %30, label %32

30:                                               ; preds = %._crit_edge
  store i32 6, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %0, i64 156
  store i32 3, ptr %31, align 4, !tbaa !33
  br label %54

32:                                               ; preds = %._crit_edge
  tail call void @_ZN6charls4impl18throw_jpegls_errorENS_11jpegls_errcE(i32 noundef 19) #5
  unreachable

.lr.ph.split:                                     ; preds = %.lr.ph, %.thread
  %33 = phi i8 [ %52, %.thread ], [ %13, %.lr.ph ]
  tail call void @_ZNK6charls18jpeg_stream_reader20validate_marker_codeENS_16jpeg_marker_codeE(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext %33)
  tail call void @_ZN6charls18jpeg_stream_reader17read_segment_sizeEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  %34 = load i32, ptr %4, align 8, !tbaa !5
  %cond = icmp eq i32 %34, 2
  br i1 %cond, label %35, label %36

35:                                               ; preds = %.lr.ph.split
  tail call void @_ZN6charls18jpeg_stream_reader26read_spiff_directory_entryENS_16jpeg_marker_codeE(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext %33)
  br label %37

36:                                               ; preds = %.lr.ph.split
  tail call void @_ZN6charls18jpeg_stream_reader19read_marker_segmentENS_16jpeg_marker_codeEP19charls_spiff_headerPb(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext %33, ptr noundef %1, ptr noundef nonnull %2)
  br label %37

37:                                               ; preds = %36, %35
  %38 = tail call noundef ptr @_ZNK6charls4spanIKSt4byteE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %15) #6
  %39 = load ptr, ptr %0, align 8, !tbaa !32
  %40 = icmp eq ptr %38, %39
  br i1 %40, label %41, label %.split.us

.split.us:                                        ; preds = %37, %20
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 128, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6charls18jpeg_stream_reader11read_headerEP19charls_spiff_headerPb) #4
  unreachable

41:                                               ; preds = %37
  %42 = load i32, ptr %4, align 8, !tbaa !5
  switch i32 %42, label %.thread [
    i32 1, label %43
    i32 5, label %.split18.us
  ]

43:                                               ; preds = %41
  %44 = load i8, ptr %2, align 1, !tbaa !34, !range !35, !noundef !36
  %45 = trunc nuw i8 %44 to i1
  br i1 %45, label %46, label %.thread

46:                                               ; preds = %43
  store i32 2, ptr %4, align 8, !tbaa !5
  br label %54

.split18.us:                                      ; preds = %41, %24
  %47 = getelementptr inbounds i8, ptr %0, i64 36
  %48 = load i32, ptr %47, align 4, !tbaa !37
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %.split18.us
  tail call void @_ZN6charls18jpeg_stream_reader44find_and_read_define_number_of_lines_segmentEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  br label %51

51:                                               ; preds = %50, %.split18.us
  tail call void @_ZNK6charls18jpeg_stream_reader11check_widthEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  tail call void @_ZNK6charls18jpeg_stream_reader23check_coding_parametersEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  br label %54

.thread:                                          ; preds = %41, %43
  %52 = tail call noundef zeroext i8 @_ZN6charls18jpeg_stream_reader21read_next_marker_codeEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  %53 = icmp eq i8 %52, -39
  br i1 %53, label %._crit_edge, label %.lr.ph.split

54:                                               ; preds = %30, %46, %51
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN6charls18jpeg_stream_reader21read_next_marker_codeEv(ptr noundef nonnull align 8 dereferenceable(192)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress noinline noreturn uwtable
declare dso_local void @_ZN6charls4impl18throw_jpegls_errorENS_11jpegls_errcE(i32 noundef) local_unnamed_addr #3

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6charls18jpeg_stream_reader17read_segment_sizeEv(ptr noundef nonnull align 8 dereferenceable(192)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6charls18jpeg_stream_reader44find_and_read_define_number_of_lines_segmentEv(ptr noundef nonnull align 8 dereferenceable(192)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK6charls18jpeg_stream_reader11check_widthEv(ptr noundef nonnull align 8 dereferenceable(192)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK6charls18jpeg_stream_reader23check_coding_parametersEv(ptr noundef nonnull align 8 dereferenceable(192)) local_unnamed_addr #2 align 2

attributes #0 = { 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 #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress noinline noreturn 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 = { noreturn }
attributes #6 = { 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, !26, i64 136}
!6 = !{!"_ZTSN6charls18jpeg_stream_readerE", !7, i64 0, !7, i64 8, !10, i64 16, !12, i64 32, !14, i64 48, !17, i64 64, !18, i64 88, !22, i64 112, !26, i64 136, !13, i64 140, !13, i64 144, !15, i64 148, !27, i64 152, !28, i64 156, !29, i64 160, !30, i64 176}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN6charls4spanIKSt4byteEE", !7, i64 0, !11, i64 8}
!11 = !{!"long", !8, i64 0}
!12 = !{!"_ZTS17charls_frame_info", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!13 = !{!"int", !8, i64 0}
!14 = !{!"_ZTSN6charls17coding_parametersE", !13, i64 0, !13, i64 4, !15, i64 8, !16, i64 12}
!15 = !{!"_ZTSN6charls15interleave_modeE", !8, i64 0}
!16 = !{!"_ZTSN6charls20color_transformationE", !8, i64 0}
!17 = !{!"_ZTS27charls_jpegls_pc_parameters", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16}
!18 = !{!"_ZTSSt6vectorIN6charls18jpeg_stream_reader14component_infoESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIN6charls18jpeg_stream_reader14component_infoESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN6charls18jpeg_stream_reader14component_infoESaIS2_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIN6charls18jpeg_stream_reader14component_infoESaIS2_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!22 = !{!"_ZTSSt6vectorIN6charls18jpeg_stream_reader19mapping_table_entryESaIS2_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIN6charls18jpeg_stream_reader19mapping_table_entryESaIS2_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIN6charls18jpeg_stream_reader19mapping_table_entryESaIS2_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN6charls18jpeg_stream_reader19mapping_table_entryESaIS2_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!26 = !{!"_ZTSN6charls18jpeg_stream_reader5stateE", !8, i64 0}
!27 = !{!"bool", !8, i64 0}
!28 = !{!"_ZTSN6charls22compressed_data_formatE", !8, i64 0}
!29 = !{!"_ZTSN6charls17callback_functionIPFiPKvmPvEEE", !7, i64 0, !7, i64 8}
!30 = !{!"_ZTSN6charls17callback_functionIPFiiPKvmPvEEE", !7, i64 0, !7, i64 8}
!31 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!32 = !{!6, !7, i64 0}
!33 = !{!6, !28, i64 156}
!34 = !{!27, !27, i64 0}
!35 = !{i8 0, i8 2}
!36 = !{}
!37 = !{!6, !13, i64 36}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass