; LLVM IR from ermig1979/Simd :: src/Simd/SimdBaseImageSavePpm.ll (ZN4Simd4Base16ImagePgmTxtSaver8ToStreamEPKhm)

; 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::ImageSaver" = type { ptr, %"struct.Simd::ImageSaverParam", %"class.Simd::OutputMemoryStream" }
%"struct.Simd::ImageSaverParam" = type { i64, i64, i32, i32, i32, i32 }
%"class.Simd::OutputMemoryStream" = type { i64, ptr, i64, i64, i64, i64, i64 }
%"class.Simd::Base::ImagePxmSaver" = type { %"class.Simd::ImageSaver", ptr, %"struct.Simd::Array", i64, i64 }
%"struct.Simd::Array" = type { ptr, i64 }

@_ZN4Simd4Base10g_pxmPrintE = external dso_local global [256 x [4 x i8]], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Simd4Base13ImagePxmSaver11WriteHeaderEm(ptr noundef nonnull align 8 dereferenceable(136), 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: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd18OutputMemoryStream5WriteEPKvm(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, i64 noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4Simd4Base16ImagePgmTxtSaver8ToStreamEPKhm(ptr noundef nonnull align 8 dereferenceable(136) %0, ptr noundef %1, i64 noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca [70 x i8], align 16
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %16 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %17 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 1
  %18 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %17, i32 0, i32 2
  %19 = load i32, ptr %18, align 8, !tbaa !11
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %23

21:                                               ; preds = %3
  %22 = load i64, ptr %6, align 8, !tbaa !9
  br label %26

23:                                               ; preds = %3
  %24 = getelementptr inbounds %"class.Simd::Base::ImagePxmSaver", ptr %16, i32 0, i32 4
  %25 = load i64, ptr %24, align 8, !tbaa !19
  br label %26

26:                                               ; preds = %23, %21
  %27 = phi i64 [ %22, %21 ], [ %25, %23 ]
  store i64 %27, ptr %7, align 8, !tbaa !9
  %28 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 2
  %29 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 1
  %30 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %29, i32 0, i32 1
  %31 = load i64, ptr %30, align 8, !tbaa !22
  %32 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 1
  %33 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %32, i32 0, i32 0
  %34 = load i64, ptr %33, align 8, !tbaa !23
  %35 = mul i64 %34, 4
  %36 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 1
  %37 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %36, i32 0, i32 0
  %38 = load i64, ptr %37, align 8, !tbaa !23
  %39 = call noundef i64 @_ZN4Simd5DivHiEmm(i64 noundef %38, i64 noundef 17)
  %40 = add i64 %35, %39
  %41 = mul i64 %31, %40
  %42 = add i64 32, %41
  call void @_ZN4Simd18OutputMemoryStream7ReserveEm(ptr noundef nonnull align 8 dereferenceable(56) %28, i64 noundef %42)
  call void @_ZN4Simd4Base13ImagePxmSaver11WriteHeaderEm(ptr noundef nonnull align 8 dereferenceable(136) %16, i64 noundef 2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %43

43:                                               ; preds = %137, %26
  %44 = load i64, ptr %8, align 8, !tbaa !9
  %45 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 1
  %46 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %45, i32 0, i32 1
  %47 = load i64, ptr %46, align 8, !tbaa !22
  %48 = icmp ult i64 %44, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %43
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %146

50:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %51 = load i64, ptr %8, align 8, !tbaa !9
  %52 = getelementptr inbounds %"class.Simd::Base::ImagePxmSaver", ptr %16, i32 0, i32 3
  %53 = load i64, ptr %52, align 8, !tbaa !24
  %54 = add i64 %51, %53
  %55 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 1
  %56 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %55, i32 0, i32 1
  %57 = load i64, ptr %56, align 8, !tbaa !22
  %58 = call noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef %54, i64 noundef %57)
  %59 = load i64, ptr %8, align 8, !tbaa !9
  %60 = sub i64 %58, %59
  store i64 %60, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %61, ptr %11, align 8, !tbaa !5
  %62 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 1
  %63 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %62, i32 0, i32 2
  %64 = load i32, ptr %63, align 8, !tbaa !11
  %65 = icmp ne i32 %64, 1
  br i1 %65, label %66, label %82

66:                                               ; preds = %50
  %67 = getelementptr inbounds %"class.Simd::Base::ImagePxmSaver", ptr %16, i32 0, i32 1
  %68 = load ptr, ptr %67, align 8, !tbaa !25
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 1
  %71 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %70, i32 0, i32 0
  %72 = load i64, ptr %71, align 8, !tbaa !23
  %73 = load i64, ptr %10, align 8, !tbaa !9
  %74 = load i64, ptr %6, align 8, !tbaa !9
  %75 = getelementptr inbounds %"class.Simd::Base::ImagePxmSaver", ptr %16, i32 0, i32 2
  %76 = getelementptr inbounds %"struct.Simd::Array", ptr %75, i32 0, i32 0
  %77 = load ptr, ptr %76, align 8, !tbaa !26
  %78 = load i64, ptr %7, align 8, !tbaa !9
  call void %68(ptr noundef %69, i64 noundef %72, i64 noundef %73, i64 noundef %74, ptr noundef %77, i64 noundef %78)
  %79 = getelementptr inbounds %"class.Simd::Base::ImagePxmSaver", ptr %16, i32 0, i32 2
  %80 = getelementptr inbounds %"struct.Simd::Array", ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !26
  store ptr %81, ptr %11, align 8, !tbaa !5
  br label %82

82:                                               ; preds = %66, %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store i64 0, ptr %12, align 8, !tbaa !9
  br label %83

83:                                               ; preds = %134, %82
  %84 = load i64, ptr %12, align 8, !tbaa !9
  %85 = load i64, ptr %10, align 8, !tbaa !9
  %86 = icmp ult i64 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 4, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %137

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 70, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store i64 0, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %89

89:                                               ; preds = %127, %88
  %90 = load i64, ptr %14, align 8, !tbaa !9
  %91 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 1
  %92 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %91, i32 0, i32 0
  %93 = load i64, ptr %92, align 8, !tbaa !23
  %94 = icmp ult i64 %90, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %89
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %130

96:                                               ; preds = %89
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = load i64, ptr %14, align 8, !tbaa !9
  %99 = getelementptr inbounds i8, ptr %97, i64 %98
  %100 = load i8, ptr %99, align 1, !tbaa !27
  %101 = zext i8 %100 to i64
  %102 = getelementptr inbounds [256 x [4 x i8]], ptr @_ZN4Simd4Base10g_pxmPrintE, i64 0, i64 %101
  %103 = getelementptr inbounds [4 x i8], ptr %102, i64 0, i64 0
  %104 = load i32, ptr %103, align 4, !tbaa !28
  %105 = getelementptr inbounds [70 x i8], ptr %13, i64 0, i64 0
  %106 = load i64, ptr %15, align 8, !tbaa !9
  %107 = getelementptr inbounds i8, ptr %105, i64 %106
  store i32 %104, ptr %107, align 4, !tbaa !28
  %108 = load i64, ptr %15, align 8, !tbaa !9
  %109 = add i64 %108, 4
  store i64 %109, ptr %15, align 8, !tbaa !9
  %110 = load i64, ptr %15, align 8, !tbaa !9
  %111 = icmp uge i64 %110, 68
  br i1 %111, label %119, label %112

112:                                              ; preds = %96
  %113 = load i64, ptr %14, align 8, !tbaa !9
  %114 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 1
  %115 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %114, i32 0, i32 0
  %116 = load i64, ptr %115, align 8, !tbaa !23
  %117 = sub i64 %116, 1
  %118 = icmp eq i64 %113, %117
  br i1 %118, label %119, label %126

119:                                              ; preds = %112, %96
  %120 = load i64, ptr %15, align 8, !tbaa !9
  %121 = add i64 %120, 1
  store i64 %121, ptr %15, align 8, !tbaa !9
  %122 = getelementptr inbounds [70 x i8], ptr %13, i64 0, i64 %120
  store i8 10, ptr %122, align 1, !tbaa !27
  %123 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %16, i32 0, i32 2
  %124 = getelementptr inbounds [70 x i8], ptr %13, i64 0, i64 0
  %125 = load i64, ptr %15, align 8, !tbaa !9
  call void @_ZN4Simd18OutputMemoryStream5WriteEPKvm(ptr noundef nonnull align 8 dereferenceable(56) %123, ptr noundef %124, i64 noundef %125)
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %126

126:                                              ; preds = %119, %112
  br label %127

127:                                              ; preds = %126
  %128 = load i64, ptr %14, align 8, !tbaa !9
  %129 = add i64 %128, 1
  store i64 %129, ptr %14, align 8, !tbaa !9
  br label %89, !llvm.loop !29

130:                                              ; preds = %95
  %131 = load i64, ptr %7, align 8, !tbaa !9
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = getelementptr inbounds i8, ptr %132, i64 %131
  store ptr %133, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 70, ptr %13) #4
  br label %134

134:                                              ; preds = %130
  %135 = load i64, ptr %12, align 8, !tbaa !9
  %136 = add i64 %135, 1
  store i64 %136, ptr %12, align 8, !tbaa !9
  br label %83, !llvm.loop !31

137:                                              ; preds = %87
  %138 = load i64, ptr %6, align 8, !tbaa !9
  %139 = load i64, ptr %10, align 8, !tbaa !9
  %140 = mul i64 %138, %139
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = getelementptr inbounds i8, ptr %141, i64 %140
  store ptr %142, ptr %5, align 8, !tbaa !5
  %143 = load i64, ptr %10, align 8, !tbaa !9
  %144 = load i64, ptr %8, align 8, !tbaa !9
  %145 = add i64 %144, %143
  store i64 %145, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %43, !llvm.loop !32

146:                                              ; preds = %49
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret i1 true
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd18OutputMemoryStream7ReserveEm(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef) #2 align 2

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

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

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 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 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 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !14, i64 24}
!12 = !{!"_ZTSN4Simd10ImageSaverE", !13, i64 8, !18, i64 40}
!13 = !{!"_ZTSN4Simd15ImageSaverParamE", !10, i64 0, !10, i64 8, !14, i64 16, !15, i64 20, !16, i64 24, !17, i64 28}
!14 = !{!"_ZTS19SimdPixelFormatType", !7, i64 0}
!15 = !{!"_ZTS17SimdImageFileType", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTS11SimdYuvType", !7, i64 0}
!18 = !{!"_ZTSN4Simd18OutputMemoryStreamE", !10, i64 0, !6, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!19 = !{!20, !10, i64 128}
!20 = !{!"_ZTSN4Simd4Base13ImagePxmSaverE", !12, i64 0, !6, i64 96, !21, i64 104, !10, i64 120, !10, i64 128}
!21 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !10, i64 8}
!22 = !{!12, !10, i64 16}
!23 = !{!12, !10, i64 8}
!24 = !{!20, !10, i64 120}
!25 = !{!20, !6, i64 96}
!26 = !{!20, !6, i64 104}
!27 = !{!7, !7, i64 0}
!28 = !{!16, !16, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}
!32 = distinct !{!32, !30}


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

@_ZN4Simd4Base10g_pxmPrintE = external dso_local local_unnamed_addr global [256 x [4 x i8]], align 16

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4Simd4Base16ImagePgmTxtSaver8ToStreamEPKhm(ptr noundef nonnull align 8 dereferenceable(136) %0, ptr noundef %1, i64 noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca [70 x i8], align 16
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp eq i32 %7, 1
  %9 = getelementptr inbounds i8, ptr %0, i64 128
  %10 = load i64, ptr %9, align 8
  %11 = select i1 %8, i64 %2, i64 %10
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load i64, ptr %13, align 8, !tbaa !17
  %15 = load i64, ptr %5, align 8, !tbaa !18
  %16 = shl i64 %15, 2
  %17 = tail call noundef i64 @_ZN4Simd5DivHiEmm(i64 noundef %15, i64 noundef 17)
  %18 = add i64 %16, %17
  %19 = mul i64 %18, %14
  %20 = add i64 %19, 32
  tail call void @_ZN4Simd18OutputMemoryStream7ReserveEm(ptr noundef nonnull align 8 dereferenceable(56) %12, i64 noundef %20)
  tail call void @_ZN4Simd4Base13ImagePxmSaver11WriteHeaderEm(ptr noundef nonnull align 8 dereferenceable(136) %0, i64 noundef 2)
  %21 = load i64, ptr %13, align 8, !tbaa !17
  %.not51 = icmp eq i64 %21, 0
  br i1 %.not51, label %._crit_edge50, label %.lr.ph49

.lr.ph49:                                         ; preds = %3
  %22 = getelementptr inbounds i8, ptr %0, i64 120
  %23 = getelementptr inbounds i8, ptr %0, i64 96
  %24 = getelementptr inbounds i8, ptr %0, i64 104
  br label %25

._crit_edge50:                                    ; preds = %._crit_edge45, %3
  ret i1 true

25:                                               ; preds = %.lr.ph49, %._crit_edge45
  %26 = phi i64 [ %21, %.lr.ph49 ], [ %41, %._crit_edge45 ]
  %.03347 = phi ptr [ %1, %.lr.ph49 ], [ %40, %._crit_edge45 ]
  %.03446 = phi i64 [ 0, %.lr.ph49 ], [ %29, %._crit_edge45 ]
  %27 = load i64, ptr %22, align 8, !tbaa !19
  %28 = add i64 %27, %.03446
  %29 = call noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef %28, i64 noundef %26)
  %30 = sub i64 %29, %.03446
  %31 = load i32, ptr %6, align 8, !tbaa !5
  %.not = icmp eq i32 %31, 1
  br i1 %.not, label %37, label %32

32:                                               ; preds = %25
  %33 = load ptr, ptr %23, align 8, !tbaa !22
  %34 = load i64, ptr %5, align 8, !tbaa !18
  %35 = load ptr, ptr %24, align 8, !tbaa !23
  call void %33(ptr noundef %.03347, i64 noundef %34, i64 noundef %30, i64 noundef %2, ptr noundef %35, i64 noundef %11)
  %36 = load ptr, ptr %24, align 8, !tbaa !23
  br label %37

37:                                               ; preds = %32, %25
  %.031 = phi ptr [ %36, %32 ], [ %.03347, %25 ]
  %.not52 = icmp eq i64 %29, %.03446
  %38 = load i64, ptr %5, align 8
  %.not53 = icmp eq i64 %38, 0
  %or.cond56 = select i1 %.not52, i1 true, i1 %.not53
  br i1 %or.cond56, label %._crit_edge45, label %.lr.ph44.split

._crit_edge45:                                    ; preds = %._crit_edge, %37
  %39 = mul i64 %30, %2
  %40 = getelementptr inbounds i8, ptr %.03347, i64 %39
  %41 = load i64, ptr %13, align 8, !tbaa !17
  %42 = icmp ult i64 %29, %41
  br i1 %42, label %25, label %._crit_edge50, !llvm.loop !24

.lr.ph44.split:                                   ; preds = %37, %._crit_edge
  %43 = phi i64 [ %45, %._crit_edge ], [ %38, %37 ]
  %44 = phi i64 [ %46, %._crit_edge ], [ %38, %37 ]
  %.03042 = phi i64 [ %48, %._crit_edge ], [ 0, %37 ]
  %.13241 = phi ptr [ %47, %._crit_edge ], [ %.031, %37 ]
  call void @llvm.lifetime.start.p0(i64 70, ptr nonnull %4) #4
  %.not54 = icmp eq i64 %44, 0
  br i1 %.not54, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %64, %.lr.ph44.split
  %45 = phi i64 [ %43, %.lr.ph44.split ], [ %65, %64 ]
  %46 = phi i64 [ 0, %.lr.ph44.split ], [ %65, %64 ]
  %47 = getelementptr inbounds i8, ptr %.13241, i64 %11
  call void @llvm.lifetime.end.p0(i64 70, ptr nonnull %4) #4
  %48 = add nuw i64 %.03042, 1
  %exitcond.not = icmp eq i64 %48, %30
  br i1 %exitcond.not, label %._crit_edge45, label %.lr.ph44.split, !llvm.loop !26

.lr.ph:                                           ; preds = %.lr.ph44.split, %64
  %49 = phi i64 [ %65, %64 ], [ %43, %.lr.ph44.split ]
  %50 = phi i64 [ %65, %64 ], [ %44, %.lr.ph44.split ]
  %.040 = phi i64 [ %.1, %64 ], [ 0, %.lr.ph44.split ]
  %.02939 = phi i64 [ %66, %64 ], [ 0, %.lr.ph44.split ]
  %51 = getelementptr inbounds i8, ptr %.13241, i64 %.02939
  %52 = load i8, ptr %51, align 1, !tbaa !28
  %53 = zext i8 %52 to i64
  %54 = getelementptr inbounds [256 x [4 x i8]], ptr @_ZN4Simd4Base10g_pxmPrintE, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !29
  %56 = getelementptr inbounds i8, ptr %4, i64 %.040
  store i32 %55, ptr %56, align 4, !tbaa !29
  %57 = add nsw i64 %.040, 4
  %58 = icmp ugt i64 %57, 67
  %59 = add i64 %50, -1
  %60 = icmp eq i64 %.02939, %59
  %or.cond = or i1 %58, %60
  br i1 %or.cond, label %61, label %64

61:                                               ; preds = %.lr.ph
  %62 = add nsw i64 %.040, 5
  %63 = getelementptr inbounds [70 x i8], ptr %4, i64 0, i64 %57
  store i8 10, ptr %63, align 1, !tbaa !28
  call void @_ZN4Simd18OutputMemoryStream5WriteEPKvm(ptr noundef nonnull align 8 dereferenceable(56) %12, ptr noundef nonnull %4, i64 noundef %62)
  %.pre = load i64, ptr %5, align 8, !tbaa !18
  br label %64

64:                                               ; preds = %.lr.ph, %61
  %65 = phi i64 [ %.pre, %61 ], [ %49, %.lr.ph ]
  %.1 = phi i64 [ 0, %61 ], [ %57, %.lr.ph ]
  %66 = add nuw i64 %.02939, 1
  %67 = icmp ult i64 %66, %65
  br i1 %67, label %.lr.ph, label %._crit_edge, !llvm.loop !30
}

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

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

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #3 = { 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 #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, !11, i64 24}
!6 = !{!"_ZTSN4Simd10ImageSaverE", !7, i64 8, !15, i64 40}
!7 = !{!"_ZTSN4Simd15ImageSaverParamE", !8, i64 0, !8, i64 8, !11, i64 16, !12, i64 20, !13, i64 24, !14, i64 28}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTS19SimdPixelFormatType", !9, i64 0}
!12 = !{!"_ZTS17SimdImageFileType", !9, i64 0}
!13 = !{!"int", !9, i64 0}
!14 = !{!"_ZTS11SimdYuvType", !9, i64 0}
!15 = !{!"_ZTSN4Simd18OutputMemoryStreamE", !8, i64 0, !16, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48}
!16 = !{!"any pointer", !9, i64 0}
!17 = !{!6, !8, i64 16}
!18 = !{!6, !8, i64 8}
!19 = !{!20, !8, i64 120}
!20 = !{!"_ZTSN4Simd4Base13ImagePxmSaverE", !6, i64 0, !16, i64 96, !21, i64 104, !8, i64 120, !8, i64 128}
!21 = !{!"_ZTSN4Simd5ArrayIhEE", !16, i64 0, !8, i64 8}
!22 = !{!20, !16, i64 96}
!23 = !{!20, !16, i64 104}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25, !27}
!27 = !{!"llvm.loop.unswitch.partial.disable"}
!28 = !{!9, !9, i64 0}
!29 = !{!13, !13, i64 0}
!30 = distinct !{!30, !25}


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