; LLVM IR from ermig1979/Simd :: src/Simd/SimdBaseImageLoadPpm.ll (ZN4Simd4Base17ImagePgmTxtLoader10FromStreamEv)

; 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.Simd::ImageLoader" = type { ptr, %"struct.Simd::ImageLoaderParam", %"class.Simd::InputMemoryStream", %"struct.Simd::View" }
%"struct.Simd::ImageLoaderParam" = type { ptr, i64, i32, i32 }
%"class.Simd::InputMemoryStream" = type { ptr, i64, i64, i64, i64 }
%"struct.Simd::View" = type <{ i64, i64, i64, i32, [4 x i8], ptr, i8, [7 x i8] }>
%"class.Simd::Base::ImagePxmLoader" = type { %"class.Simd::ImageLoader", ptr, ptr, %"struct.Simd::Array", i64, i64 }
%"struct.Simd::Array" = type { ptr, i64 }

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4Simd4Base14ImagePxmLoader10ReadHeaderEm(ptr noundef nonnull align 8 dereferenceable(168), i64 noundef) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4Simd4Base17ImagePgmTxtLoader10FromStreamEv(ptr noundef nonnull align 8 dereferenceable(168) %0) unnamed_addr #0 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  %12 = call noundef zeroext i1 @_ZN4Simd4Base14ImagePxmLoader10ReadHeaderEm(ptr noundef nonnull align 8 dereferenceable(168) %11, i64 noundef 2)
  br i1 %12, label %14, label %13

13:                                               ; preds = %1
  store i1 false, ptr %2, align 1
  br label %161

14:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %15 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 1
  %16 = getelementptr inbounds %"struct.Simd::ImageLoaderParam", ptr %15, i32 0, i32 3
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = icmp eq i32 %17, 1
  br i1 %18, label %19, label %23

19:                                               ; preds = %14
  %20 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 3
  %21 = getelementptr inbounds %"struct.Simd::View", ptr %20, i32 0, i32 2
  %22 = load i64, ptr %21, align 8, !tbaa !19
  br label %26

23:                                               ; preds = %14
  %24 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %11, i32 0, i32 5
  %25 = load i64, ptr %24, align 8, !tbaa !20
  br label %26

26:                                               ; preds = %23, %19
  %27 = phi i64 [ %22, %19 ], [ %25, %23 ]
  store i64 %27, ptr %4, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !23
  br label %28

28:                                               ; preds = %156, %26
  %29 = load i64, ptr %5, align 8, !tbaa !23
  %30 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 3
  %31 = getelementptr inbounds %"struct.Simd::View", ptr %30, i32 0, i32 1
  %32 = load i64, ptr %31, align 8, !tbaa !24
  %33 = icmp ult i64 %29, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %28
  store i32 2, ptr %6, align 4
  br label %157

35:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %36 = load i64, ptr %5, align 8, !tbaa !23
  %37 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %11, i32 0, i32 4
  %38 = load i64, ptr %37, align 8, !tbaa !25
  %39 = add i64 %36, %38
  %40 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 3
  %41 = getelementptr inbounds %"struct.Simd::View", ptr %40, i32 0, i32 1
  %42 = load i64, ptr %41, align 8, !tbaa !24
  %43 = call noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef %39, i64 noundef %42)
  %44 = load i64, ptr %5, align 8, !tbaa !23
  %45 = sub i64 %43, %44
  store i64 %45, ptr %7, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %46 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 1
  %47 = getelementptr inbounds %"struct.Simd::ImageLoaderParam", ptr %46, i32 0, i32 3
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = icmp eq i32 %48, 1
  br i1 %49, label %50, label %54

50:                                               ; preds = %35
  %51 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 3
  %52 = load i64, ptr %5, align 8, !tbaa !23
  %53 = call noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41) %51, i64 noundef %52)
  br label %58

54:                                               ; preds = %35
  %55 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %11, i32 0, i32 3
  %56 = getelementptr inbounds %"struct.Simd::Array", ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !26
  br label %58

58:                                               ; preds = %54, %50
  %59 = phi ptr [ %53, %50 ], [ %57, %54 ]
  store ptr %59, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 0, ptr %9, align 8, !tbaa !23
  br label %60

60:                                               ; preds = %89, %58
  %61 = load i64, ptr %9, align 8, !tbaa !23
  %62 = load i64, ptr %7, align 8, !tbaa !23
  %63 = icmp ult i64 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 4, ptr %6, align 4
  br label %92

65:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store i64 0, ptr %10, align 8, !tbaa !23
  br label %66

66:                                               ; preds = %80, %65
  %67 = load i64, ptr %10, align 8, !tbaa !23
  %68 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %11, i32 0, i32 5
  %69 = load i64, ptr %68, align 8, !tbaa !20
  %70 = icmp ult i64 %67, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %66
  store i32 7, ptr %6, align 4
  br label %83

72:                                               ; preds = %66
  %73 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 2
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = load i64, ptr %10, align 8, !tbaa !23
  %76 = getelementptr inbounds i8, ptr %74, i64 %75
  %77 = call noundef zeroext i1 @_ZN4Simd17InputMemoryStream12ReadUnsignedIhEEbRT_(ptr noundef nonnull align 8 dereferenceable(40) %73, ptr noundef nonnull align 1 dereferenceable(1) %76)
  br i1 %77, label %79, label %78

78:                                               ; preds = %72
  store i1 false, ptr %2, align 1
  store i32 1, ptr %6, align 4
  br label %83

79:                                               ; preds = %72
  br label %80

80:                                               ; preds = %79
  %81 = load i64, ptr %10, align 8, !tbaa !23
  %82 = add i64 %81, 1
  store i64 %82, ptr %10, align 8, !tbaa !23
  br label %66, !llvm.loop !27

83:                                               ; preds = %78, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %84 = load i32, ptr %6, align 4
  switch i32 %84, label %92 [
    i32 7, label %85
  ]

85:                                               ; preds = %83
  %86 = load i64, ptr %4, align 8, !tbaa !23
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %87, i64 %86
  store ptr %88, ptr %8, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %85
  %90 = load i64, ptr %9, align 8, !tbaa !23
  %91 = add i64 %90, 1
  store i64 %91, ptr %9, align 8, !tbaa !23
  br label %60, !llvm.loop !29

92:                                               ; preds = %83, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %93 = load i32, ptr %6, align 4
  switch i32 %93, label %154 [
    i32 4, label %94
  ]

94:                                               ; preds = %92
  %95 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 1
  %96 = getelementptr inbounds %"struct.Simd::ImageLoaderParam", ptr %95, i32 0, i32 3
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = icmp eq i32 %97, 3
  br i1 %98, label %104, label %99

99:                                               ; preds = %94
  %100 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 1
  %101 = getelementptr inbounds %"struct.Simd::ImageLoaderParam", ptr %100, i32 0, i32 3
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = icmp eq i32 %102, 16
  br i1 %103, label %104, label %122

104:                                              ; preds = %99, %94
  %105 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %11, i32 0, i32 1
  %106 = load ptr, ptr %105, align 8, !tbaa !30
  %107 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %11, i32 0, i32 3
  %108 = getelementptr inbounds %"struct.Simd::Array", ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !26
  %110 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 3
  %111 = getelementptr inbounds %"struct.Simd::View", ptr %110, i32 0, i32 0
  %112 = load i64, ptr %111, align 8, !tbaa !31
  %113 = load i64, ptr %7, align 8, !tbaa !23
  %114 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %11, i32 0, i32 5
  %115 = load i64, ptr %114, align 8, !tbaa !20
  %116 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 3
  %117 = load i64, ptr %5, align 8, !tbaa !23
  %118 = call noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41) %116, i64 noundef %117)
  %119 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 3
  %120 = getelementptr inbounds %"struct.Simd::View", ptr %119, i32 0, i32 2
  %121 = load i64, ptr %120, align 8, !tbaa !19
  call void %106(ptr noundef %109, i64 noundef %112, i64 noundef %113, i64 noundef %115, ptr noundef %118, i64 noundef %121)
  br label %122

122:                                              ; preds = %104, %99
  %123 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 1
  %124 = getelementptr inbounds %"struct.Simd::ImageLoaderParam", ptr %123, i32 0, i32 3
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = icmp eq i32 %125, 4
  br i1 %126, label %132, label %127

127:                                              ; preds = %122
  %128 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 1
  %129 = getelementptr inbounds %"struct.Simd::ImageLoaderParam", ptr %128, i32 0, i32 3
  %130 = load i32, ptr %129, align 4, !tbaa !9
  %131 = icmp eq i32 %130, 17
  br i1 %131, label %132, label %150

132:                                              ; preds = %127, %122
  %133 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %11, i32 0, i32 2
  %134 = load ptr, ptr %133, align 8, !tbaa !32
  %135 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %11, i32 0, i32 3
  %136 = getelementptr inbounds %"struct.Simd::Array", ptr %135, i32 0, i32 0
  %137 = load ptr, ptr %136, align 8, !tbaa !26
  %138 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 3
  %139 = getelementptr inbounds %"struct.Simd::View", ptr %138, i32 0, i32 0
  %140 = load i64, ptr %139, align 8, !tbaa !31
  %141 = load i64, ptr %7, align 8, !tbaa !23
  %142 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %11, i32 0, i32 5
  %143 = load i64, ptr %142, align 8, !tbaa !20
  %144 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 3
  %145 = load i64, ptr %5, align 8, !tbaa !23
  %146 = call noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41) %144, i64 noundef %145)
  %147 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %11, i32 0, i32 3
  %148 = getelementptr inbounds %"struct.Simd::View", ptr %147, i32 0, i32 2
  %149 = load i64, ptr %148, align 8, !tbaa !19
  call void %134(ptr noundef %137, i64 noundef %140, i64 noundef %141, i64 noundef %143, ptr noundef %146, i64 noundef %149, i8 noundef zeroext -1)
  br label %150

150:                                              ; preds = %132, %127
  %151 = load i64, ptr %7, align 8, !tbaa !23
  %152 = load i64, ptr %5, align 8, !tbaa !23
  %153 = add i64 %152, %151
  store i64 %153, ptr %5, align 8, !tbaa !23
  store i32 0, ptr %6, align 4
  br label %154

154:                                              ; preds = %150, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %155 = load i32, ptr %6, align 4
  switch i32 %155, label %157 [
    i32 0, label %156
  ]

156:                                              ; preds = %154
  br label %28, !llvm.loop !33

157:                                              ; preds = %154, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  %158 = load i32, ptr %6, align 4
  switch i32 %158, label %160 [
    i32 2, label %159
  ]

159:                                              ; preds = %157
  store i1 true, ptr %2, align 1
  store i32 1, ptr %6, align 4
  br label %160

160:                                              ; preds = %159, %157
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %161

161:                                              ; preds = %160, %13
  %162 = load i1, ptr %2, align 1
  ret i1 %162
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef, i64 noundef) #2

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4Simd17InputMemoryStream12ReadUnsignedIhEEbRT_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 1 dereferenceable(1)) #3 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline 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 = { alwaysinline 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 }

!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, !14, i64 28}
!10 = !{!"_ZTSN4Simd11ImageLoaderE", !11, i64 8, !15, i64 32, !16, i64 72}
!11 = !{!"_ZTSN4Simd16ImageLoaderParamE", !6, i64 0, !12, i64 8, !13, i64 16, !14, i64 20}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTS17SimdImageFileType", !7, i64 0}
!14 = !{!"_ZTS19SimdPixelFormatType", !7, i64 0}
!15 = !{!"_ZTSN4Simd17InputMemoryStreamE", !6, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!16 = !{!"_ZTSN4Simd4ViewINS_9AllocatorEEE", !12, i64 0, !12, i64 8, !12, i64 16, !17, i64 24, !6, i64 32, !18, i64 40}
!17 = !{!"_ZTSN4Simd4ViewINS_9AllocatorEE6FormatE", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!10, !12, i64 88}
!20 = !{!21, !12, i64 160}
!21 = !{!"_ZTSN4Simd4Base14ImagePxmLoaderE", !10, i64 0, !6, i64 120, !6, i64 128, !22, i64 136, !12, i64 152, !12, i64 160}
!22 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !12, i64 8}
!23 = !{!12, !12, i64 0}
!24 = !{!10, !12, i64 80}
!25 = !{!21, !12, i64 152}
!26 = !{!21, !6, i64 136}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}
!30 = !{!21, !6, i64 120}
!31 = !{!10, !12, i64 72}
!32 = !{!21, !6, i64 128}
!33 = distinct !{!33, !28}


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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4Simd4Base14ImagePxmLoader10ReadHeaderEm(ptr noundef nonnull align 8 dereferenceable(168), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4Simd4Base17ImagePgmTxtLoader10FromStreamEv(ptr noundef nonnull align 8 dereferenceable(168) %0) unnamed_addr #0 align 2 {
  %2 = tail call noundef zeroext i1 @_ZN4Simd4Base14ImagePxmLoader10ReadHeaderEm(ptr noundef nonnull align 8 dereferenceable(168) %0, i64 noundef 2)
  br i1 %2, label %3, label %.critedge44

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 28
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = icmp eq i32 %5, 1
  %7 = getelementptr inbounds i8, ptr %0, i64 88
  %8 = getelementptr inbounds i8, ptr %0, i64 160
  %.val = load i64, ptr %7, align 8
  %.val46 = load i64, ptr %8, align 8
  %9 = select i1 %6, i64 %.val, i64 %.val46
  %10 = getelementptr inbounds i8, ptr %0, i64 72
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  %12 = load i64, ptr %11, align 8, !tbaa !18
  %.not39.not52.not = icmp eq i64 %12, 0
  br i1 %.not39.not52.not, label %.critedge44, label %.lr.ph54

.lr.ph54:                                         ; preds = %3
  %13 = getelementptr inbounds i8, ptr %0, i64 152
  %14 = getelementptr inbounds i8, ptr %0, i64 136
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = getelementptr inbounds i8, ptr %0, i64 120
  %17 = getelementptr inbounds i8, ptr %0, i64 128
  br label %18

18:                                               ; preds = %.lr.ph54, %59
  %19 = phi i64 [ %12, %.lr.ph54 ], [ %60, %59 ]
  %.03453 = phi i64 [ 0, %.lr.ph54 ], [ %22, %59 ]
  %20 = load i64, ptr %13, align 8, !tbaa !19
  %21 = add i64 %20, %.03453
  %22 = tail call noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef %21, i64 noundef %19)
  %23 = sub i64 %22, %.03453
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %28

26:                                               ; preds = %18
  %27 = tail call noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41) %10, i64 noundef %.03453)
  br label %30

28:                                               ; preds = %18
  %29 = load ptr, ptr %14, align 8, !tbaa !22
  br label %30

30:                                               ; preds = %28, %26
  %31 = phi ptr [ %27, %26 ], [ %29, %28 ]
  %.not40.not49.not = icmp eq i64 %22, %.03453
  %32 = load i64, ptr %8, align 8
  %.not57 = icmp eq i64 %32, 0
  %or.cond = select i1 %.not40.not49.not, i1 true, i1 %.not57
  br i1 %or.cond, label %.critedge42, label %.preheader

.preheader:                                       ; preds = %30, %.critedge
  %33 = phi i64 [ %39, %.critedge ], [ 1, %30 ]
  %.02751 = phi i64 [ %41, %.critedge ], [ 0, %30 ]
  %.02850 = phi ptr [ %40, %.critedge ], [ %31, %30 ]
  %.not47.not = icmp eq i64 %33, 0
  br i1 %.not47.not, label %.critedge, label %.lr.ph

34:                                               ; preds = %.lr.ph
  %35 = add nuw i64 %.048, 1
  %36 = load i64, ptr %8, align 8, !tbaa !23
  %.not = icmp ult i64 %35, %36
  br i1 %.not, label %.lr.ph, label %.critedge, !llvm.loop !24

.lr.ph:                                           ; preds = %.preheader, %34
  %.048 = phi i64 [ %35, %34 ], [ 0, %.preheader ]
  %37 = getelementptr inbounds i8, ptr %.02850, i64 %.048
  %38 = tail call noundef zeroext i1 @_ZN4Simd17InputMemoryStream12ReadUnsignedIhEEbRT_(ptr noundef nonnull align 8 dereferenceable(40) %15, ptr noundef nonnull align 1 dereferenceable(1) %37)
  br i1 %38, label %34, label %.critedge44

.critedge:                                        ; preds = %34, %.preheader
  %39 = phi i64 [ 0, %.preheader ], [ %36, %34 ]
  %40 = getelementptr inbounds i8, ptr %.02850, i64 %9
  %41 = add nuw i64 %.02751, 1
  %exitcond.not = icmp eq i64 %41, %23
  br i1 %exitcond.not, label %.critedge42, label %.preheader, !llvm.loop !26

.critedge42:                                      ; preds = %.critedge, %30
  %42 = load i32, ptr %4, align 4, !tbaa !5
  switch i32 %42, label %50 [
    i32 3, label %43
    i32 16, label %43
  ]

43:                                               ; preds = %.critedge42, %.critedge42
  %44 = load ptr, ptr %16, align 8, !tbaa !28
  %45 = load ptr, ptr %14, align 8, !tbaa !22
  %46 = load i64, ptr %10, align 8, !tbaa !29
  %47 = load i64, ptr %8, align 8, !tbaa !23
  %48 = tail call noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41) %10, i64 noundef %.03453)
  %49 = load i64, ptr %7, align 8, !tbaa !30
  tail call void %44(ptr noundef %45, i64 noundef %46, i64 noundef %23, i64 noundef %47, ptr noundef %48, i64 noundef %49)
  %.pr = load i32, ptr %4, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %.critedge42, %43
  %51 = phi i32 [ %42, %.critedge42 ], [ %.pr, %43 ]
  switch i32 %51, label %59 [
    i32 4, label %52
    i32 17, label %52
  ]

52:                                               ; preds = %50, %50
  %53 = load ptr, ptr %17, align 8, !tbaa !31
  %54 = load ptr, ptr %14, align 8, !tbaa !22
  %55 = load i64, ptr %10, align 8, !tbaa !29
  %56 = load i64, ptr %8, align 8, !tbaa !23
  %57 = tail call noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41) %10, i64 noundef %.03453)
  %58 = load i64, ptr %7, align 8, !tbaa !30
  tail call void %53(ptr noundef %54, i64 noundef %55, i64 noundef %23, i64 noundef %56, ptr noundef %57, i64 noundef %58, i8 noundef zeroext -1)
  br label %59

59:                                               ; preds = %52, %50
  %60 = load i64, ptr %11, align 8, !tbaa !18
  %.not39.not = icmp ult i64 %22, %60
  br i1 %.not39.not, label %18, label %.critedge44

.critedge44:                                      ; preds = %59, %.lr.ph, %3, %1
  %.6 = phi i1 [ false, %1 ], [ true, %3 ], [ false, %.lr.ph ], [ true, %59 ]
  ret i1 %.6
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4Simd17InputMemoryStream12ReadUnsignedIhEEbRT_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2 align 2

attributes #0 = { 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 #1 = { alwaysinline 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 = { alwaysinline 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" }

!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, !13, i64 28}
!6 = !{!"_ZTSN4Simd11ImageLoaderE", !7, i64 8, !14, i64 32, !15, i64 72}
!7 = !{!"_ZTSN4Simd16ImageLoaderParamE", !8, i64 0, !11, i64 8, !12, i64 16, !13, i64 20}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"_ZTS17SimdImageFileType", !9, i64 0}
!13 = !{!"_ZTS19SimdPixelFormatType", !9, i64 0}
!14 = !{!"_ZTSN4Simd17InputMemoryStreamE", !8, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!15 = !{!"_ZTSN4Simd4ViewINS_9AllocatorEEE", !11, i64 0, !11, i64 8, !11, i64 16, !16, i64 24, !8, i64 32, !17, i64 40}
!16 = !{!"_ZTSN4Simd4ViewINS_9AllocatorEE6FormatE", !9, i64 0}
!17 = !{!"bool", !9, i64 0}
!18 = !{!6, !11, i64 80}
!19 = !{!20, !11, i64 152}
!20 = !{!"_ZTSN4Simd4Base14ImagePxmLoaderE", !6, i64 0, !8, i64 120, !8, i64 128, !21, i64 136, !11, i64 152, !11, i64 160}
!21 = !{!"_ZTSN4Simd5ArrayIhEE", !8, i64 0, !11, i64 8}
!22 = !{!20, !8, i64 136}
!23 = !{!20, !11, i64 160}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25, !27}
!27 = !{!"llvm.loop.unswitch.partial.disable"}
!28 = !{!20, !8, i64 120}
!29 = !{!6, !11, i64 72}
!30 = !{!6, !11, i64 88}
!31 = !{!20, !8, i64 128}


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