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

; 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: 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4Simd4Base17ImagePgmBinLoader10FromStreamEv(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
  store ptr %0, ptr %3, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8
  %11 = call noundef zeroext i1 @_ZN4Simd4Base14ImagePxmLoader10ReadHeaderEm(ptr noundef nonnull align 8 dereferenceable(168) %10, i64 noundef 5)
  br i1 %11, label %13, label %12

12:                                               ; preds = %1
  store i1 false, ptr %2, align 1
  br label %150

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

18:                                               ; preds = %13
  %19 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 3
  %20 = getelementptr inbounds %"struct.Simd::View", ptr %19, i32 0, i32 2
  %21 = load i64, ptr %20, align 8, !tbaa !19
  br label %25

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

25:                                               ; preds = %22, %18
  %26 = phi i64 [ %21, %18 ], [ %24, %22 ]
  store i64 %26, 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 %27

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

33:                                               ; preds = %27
  store i32 2, ptr %6, align 4
  br label %146

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

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

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

57:                                               ; preds = %53, %49
  %58 = phi ptr [ %52, %49 ], [ %56, %53 ]
  store ptr %58, 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 %59

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

63:                                               ; preds = %59
  store i32 4, ptr %6, align 4
  br label %81

64:                                               ; preds = %59
  %65 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 2
  %66 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %10, i32 0, i32 5
  %67 = load i64, ptr %66, align 8, !tbaa !20
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = call noundef i64 @_ZN4Simd17InputMemoryStream4ReadEmPv(ptr noundef nonnull align 8 dereferenceable(40) %65, i64 noundef %67, ptr noundef %68)
  %70 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %10, i32 0, i32 5
  %71 = load i64, ptr %70, align 8, !tbaa !20
  %72 = icmp ne i64 %69, %71
  br i1 %72, label %73, label %74

73:                                               ; preds = %64
  store i1 false, ptr %2, align 1
  store i32 1, ptr %6, align 4
  br label %81

74:                                               ; preds = %64
  %75 = load i64, ptr %4, align 8, !tbaa !23
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %76, i64 %75
  store ptr %77, ptr %8, align 8, !tbaa !5
  br label %78

78:                                               ; preds = %74
  %79 = load i64, ptr %9, align 8, !tbaa !23
  %80 = add i64 %79, 1
  store i64 %80, ptr %9, align 8, !tbaa !23
  br label %59, !llvm.loop !27

81:                                               ; preds = %73, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %82 = load i32, ptr %6, align 4
  switch i32 %82, label %143 [
    i32 4, label %83
  ]

83:                                               ; preds = %81
  %84 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 1
  %85 = getelementptr inbounds %"struct.Simd::ImageLoaderParam", ptr %84, i32 0, i32 3
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = icmp eq i32 %86, 3
  br i1 %87, label %93, label %88

88:                                               ; preds = %83
  %89 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 1
  %90 = getelementptr inbounds %"struct.Simd::ImageLoaderParam", ptr %89, i32 0, i32 3
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = icmp eq i32 %91, 16
  br i1 %92, label %93, label %111

93:                                               ; preds = %88, %83
  %94 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %10, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !29
  %96 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %10, i32 0, i32 3
  %97 = getelementptr inbounds %"struct.Simd::Array", ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !26
  %99 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 3
  %100 = getelementptr inbounds %"struct.Simd::View", ptr %99, i32 0, i32 0
  %101 = load i64, ptr %100, align 8, !tbaa !30
  %102 = load i64, ptr %7, align 8, !tbaa !23
  %103 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %10, i32 0, i32 5
  %104 = load i64, ptr %103, align 8, !tbaa !20
  %105 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 3
  %106 = load i64, ptr %5, align 8, !tbaa !23
  %107 = call noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41) %105, i64 noundef %106)
  %108 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 3
  %109 = getelementptr inbounds %"struct.Simd::View", ptr %108, i32 0, i32 2
  %110 = load i64, ptr %109, align 8, !tbaa !19
  call void %95(ptr noundef %98, i64 noundef %101, i64 noundef %102, i64 noundef %104, ptr noundef %107, i64 noundef %110)
  br label %111

111:                                              ; preds = %93, %88
  %112 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 1
  %113 = getelementptr inbounds %"struct.Simd::ImageLoaderParam", ptr %112, i32 0, i32 3
  %114 = load i32, ptr %113, align 4, !tbaa !9
  %115 = icmp eq i32 %114, 4
  br i1 %115, label %121, label %116

116:                                              ; preds = %111
  %117 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 1
  %118 = getelementptr inbounds %"struct.Simd::ImageLoaderParam", ptr %117, i32 0, i32 3
  %119 = load i32, ptr %118, align 4, !tbaa !9
  %120 = icmp eq i32 %119, 17
  br i1 %120, label %121, label %139

121:                                              ; preds = %116, %111
  %122 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %10, i32 0, i32 2
  %123 = load ptr, ptr %122, align 8, !tbaa !31
  %124 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %10, i32 0, i32 3
  %125 = getelementptr inbounds %"struct.Simd::Array", ptr %124, i32 0, i32 0
  %126 = load ptr, ptr %125, align 8, !tbaa !26
  %127 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 3
  %128 = getelementptr inbounds %"struct.Simd::View", ptr %127, i32 0, i32 0
  %129 = load i64, ptr %128, align 8, !tbaa !30
  %130 = load i64, ptr %7, align 8, !tbaa !23
  %131 = getelementptr inbounds %"class.Simd::Base::ImagePxmLoader", ptr %10, i32 0, i32 5
  %132 = load i64, ptr %131, align 8, !tbaa !20
  %133 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 3
  %134 = load i64, ptr %5, align 8, !tbaa !23
  %135 = call noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41) %133, i64 noundef %134)
  %136 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 3
  %137 = getelementptr inbounds %"struct.Simd::View", ptr %136, i32 0, i32 2
  %138 = load i64, ptr %137, align 8, !tbaa !19
  call void %123(ptr noundef %126, i64 noundef %129, i64 noundef %130, i64 noundef %132, ptr noundef %135, i64 noundef %138, i8 noundef zeroext -1)
  br label %139

139:                                              ; preds = %121, %116
  %140 = load i64, ptr %7, align 8, !tbaa !23
  %141 = load i64, ptr %5, align 8, !tbaa !23
  %142 = add i64 %141, %140
  store i64 %142, ptr %5, align 8, !tbaa !23
  store i32 0, ptr %6, align 4
  br label %143

143:                                              ; preds = %139, %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %144 = load i32, ptr %6, align 4
  switch i32 %144, label %146 [
    i32 0, label %145
  ]

145:                                              ; preds = %143
  br label %27, !llvm.loop !32

146:                                              ; preds = %143, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  %147 = load i32, ptr %6, align 4
  switch i32 %147, label %149 [
    i32 2, label %148
  ]

148:                                              ; preds = %146
  store i1 true, ptr %2, align 1
  store i32 1, ptr %6, align 4
  br label %149

149:                                              ; preds = %148, %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %150

150:                                              ; preds = %149, %12
  %151 = load i1, ptr %2, align 1
  ret i1 %151
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef i64 @_ZN4Simd17InputMemoryStream4ReadEmPv(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, ptr noundef) #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 = !{!21, !6, i64 120}
!30 = !{!10, !12, i64 72}
!31 = !{!21, !6, i64 128}
!32 = distinct !{!32, !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: 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4Simd4Base17ImagePgmBinLoader10FromStreamEv(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 5)
  br i1 %2, label %3, label %.critedge35

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
  %.val37 = load i64, ptr %8, align 8
  %9 = select i1 %6, i64 %.val, i64 %.val37
  %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
  %.not33.not42.not = icmp eq i64 %12, 0
  br i1 %.not33.not42.not, label %.critedge35, label %.lr.ph44

.lr.ph44:                                         ; 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.ph44, %55
  %19 = phi i64 [ %12, %.lr.ph44 ], [ %56, %55 ]
  %.02743 = phi i64 [ 0, %.lr.ph44 ], [ %22, %55 ]
  %20 = load i64, ptr %13, align 8, !tbaa !19
  %21 = add i64 %20, %.02743
  %22 = tail call noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef %21, i64 noundef %19)
  %23 = sub i64 %22, %.02743
  %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 %.02743)
  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 ]
  %.not32.not39.not = icmp eq i64 %22, %.02743
  br i1 %.not32.not39.not, label %.critedge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %30
  %.pre = load i64, ptr %8, align 8, !tbaa !23
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %35
  %32 = phi i64 [ %33, %35 ], [ %.pre, %.lr.ph.preheader ]
  %.041 = phi i64 [ %37, %35 ], [ 0, %.lr.ph.preheader ]
  %.02240 = phi ptr [ %36, %35 ], [ %31, %.lr.ph.preheader ]
  %33 = tail call noundef i64 @_ZN4Simd17InputMemoryStream4ReadEmPv(ptr noundef nonnull align 8 dereferenceable(40) %15, i64 noundef %32, ptr noundef %.02240)
  %34 = load i64, ptr %8, align 8, !tbaa !23
  %.not = icmp eq i64 %33, %34
  br i1 %.not, label %35, label %.critedge35

35:                                               ; preds = %.lr.ph
  %36 = getelementptr inbounds i8, ptr %.02240, i64 %9
  %37 = add nuw i64 %.041, 1
  %exitcond.not = icmp eq i64 %37, %23
  br i1 %exitcond.not, label %.critedge, label %.lr.ph, !llvm.loop !24

.critedge:                                        ; preds = %35, %30
  %38 = load i32, ptr %4, align 4, !tbaa !5
  switch i32 %38, label %46 [
    i32 3, label %39
    i32 16, label %39
  ]

39:                                               ; preds = %.critedge, %.critedge
  %40 = load ptr, ptr %16, align 8, !tbaa !26
  %41 = load ptr, ptr %14, align 8, !tbaa !22
  %42 = load i64, ptr %10, align 8, !tbaa !27
  %43 = load i64, ptr %8, align 8, !tbaa !23
  %44 = tail call noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41) %10, i64 noundef %.02743)
  %45 = load i64, ptr %7, align 8, !tbaa !28
  tail call void %40(ptr noundef %41, i64 noundef %42, i64 noundef %23, i64 noundef %43, ptr noundef %44, i64 noundef %45)
  %.pr = load i32, ptr %4, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %.critedge, %39
  %47 = phi i32 [ %38, %.critedge ], [ %.pr, %39 ]
  switch i32 %47, label %55 [
    i32 4, label %48
    i32 17, label %48
  ]

48:                                               ; preds = %46, %46
  %49 = load ptr, ptr %17, align 8, !tbaa !29
  %50 = load ptr, ptr %14, align 8, !tbaa !22
  %51 = load i64, ptr %10, align 8, !tbaa !27
  %52 = load i64, ptr %8, align 8, !tbaa !23
  %53 = tail call noundef ptr @_ZN4Simd4ViewINS_9AllocatorEE3RowIhEEPT_m(ptr noundef nonnull align 8 dereferenceable(41) %10, i64 noundef %.02743)
  %54 = load i64, ptr %7, align 8, !tbaa !28
  tail call void %49(ptr noundef %50, i64 noundef %51, i64 noundef %23, i64 noundef %52, ptr noundef %53, i64 noundef %54, i8 noundef zeroext -1)
  br label %55

55:                                               ; preds = %48, %46
  %56 = load i64, ptr %11, align 8, !tbaa !18
  %.not33.not = icmp ult i64 %22, %56
  br i1 %.not33.not, label %18, label %.critedge35

.critedge35:                                      ; preds = %55, %.lr.ph, %3, %1
  %.4 = phi i1 [ false, %1 ], [ true, %3 ], [ false, %.lr.ph ], [ true, %55 ]
  ret i1 %.4
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef i64 @_ZN4Simd17InputMemoryStream4ReadEmPv(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, ptr noundef) 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 = !{!20, !8, i64 120}
!27 = !{!6, !11, i64 72}
!28 = !{!6, !11, i64 88}
!29 = !{!20, !8, i64 128}


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