; LLVM IR from achilles288/robot-monitor-graphics :: src/base/bitmap_png.ll (ZNK3rmg6Bitmap7savePNGEPKc)

; 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.rmg::Bitmap" = type { i16, i16, i8, ptr }

@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [62 x i8], align 1

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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

declare i32 @printf(ptr noundef, ...) #1

declare i32 @fclose(ptr noundef) #1

declare noalias ptr @png_create_info_struct(ptr noundef) #1

declare void @png_init_io(ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3rmg6Bitmap7savePNGEPKc(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1) #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8
  %14 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 3
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = icmp ne ptr %15, null
  call void @_Z12__rmg_assertbPKcS0_i(i1 noundef zeroext %16, ptr noundef @.str.5, ptr noundef @.str.6, i32 noundef 145)
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  %17 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 2
  %18 = load i8, ptr %17, align 4, !tbaa !12
  %19 = zext i8 %18 to i32
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %22

21:                                               ; preds = %2
  store i8 0, ptr %5, align 1, !tbaa !13
  br label %37

22:                                               ; preds = %2
  %23 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 2
  %24 = load i8, ptr %23, align 4, !tbaa !12
  %25 = zext i8 %24 to i32
  %26 = icmp eq i32 %25, 2
  br i1 %26, label %27, label %28

27:                                               ; preds = %22
  store i8 4, ptr %5, align 1, !tbaa !13
  br label %36

28:                                               ; preds = %22
  %29 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 2
  %30 = load i8, ptr %29, align 4, !tbaa !12
  %31 = zext i8 %30 to i32
  %32 = icmp eq i32 %31, 3
  br i1 %32, label %33, label %34

33:                                               ; preds = %28
  store i8 2, ptr %5, align 1, !tbaa !13
  br label %35

34:                                               ; preds = %28
  store i8 6, ptr %5, align 1, !tbaa !13
  br label %35

35:                                               ; preds = %34, %33
  br label %36

36:                                               ; preds = %35, %27
  br label %37

37:                                               ; preds = %36, %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = call noalias ptr @fopen(ptr noundef %38, ptr noundef @.str.7)
  store ptr %39, ptr %6, align 8, !tbaa !5
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %45, label %42

42:                                               ; preds = %37
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %43)
  store i32 1, ptr %7, align 4
  br label %105

45:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %46 = call noalias ptr @png_create_write_struct(ptr noundef @.str.3, ptr noundef null, ptr noundef null, ptr noundef null)
  store ptr %46, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = call noalias ptr @png_create_info_struct(ptr noundef %47)
  store ptr %48, ptr %9, align 8, !tbaa !5
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  call void @png_init_io(ptr noundef %49, ptr noundef %50)
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 0
  %54 = load i16, ptr %53, align 8, !tbaa !14
  %55 = zext i16 %54 to i32
  %56 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 1
  %57 = load i16, ptr %56, align 2, !tbaa !15
  %58 = zext i16 %57 to i32
  %59 = load i8, ptr %5, align 1, !tbaa !13
  %60 = zext i8 %59 to i32
  call void @png_set_IHDR(ptr noundef %51, ptr noundef %52, i32 noundef %55, i32 noundef %58, i32 noundef 8, i32 noundef %60, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_write_info(ptr noundef %61, ptr noundef %62)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %63 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 1
  %64 = load i16, ptr %63, align 2, !tbaa !15
  %65 = zext i16 %64 to i64
  %66 = mul i64 8, %65
  %67 = call noalias ptr @malloc(i64 noundef %66) #7
  store ptr %67, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %68 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 0
  %69 = load i16, ptr %68, align 8, !tbaa !14
  %70 = zext i16 %69 to i32
  %71 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 2
  %72 = load i8, ptr %71, align 4, !tbaa !12
  %73 = zext i8 %72 to i32
  %74 = mul nsw i32 %70, %73
  %75 = sext i32 %74 to i64
  store i64 %75, ptr %11, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !18
  br label %76

76:                                               ; preds = %95, %45
  %77 = load i32, ptr %12, align 4, !tbaa !18
  %78 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 1
  %79 = load i16, ptr %78, align 2, !tbaa !15
  %80 = zext i16 %79 to i32
  %81 = icmp slt i32 %77, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %76
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %98

83:                                               ; preds = %76
  %84 = getelementptr inbounds %"class.rmg::Bitmap", ptr %13, i32 0, i32 3
  %85 = load ptr, ptr %84, align 8, !tbaa !9
  %86 = load i32, ptr %12, align 4, !tbaa !18
  %87 = sext i32 %86 to i64
  %88 = load i64, ptr %11, align 8, !tbaa !16
  %89 = mul i64 %87, %88
  %90 = getelementptr inbounds i8, ptr %85, i64 %89
  %91 = load ptr, ptr %10, align 8, !tbaa !5
  %92 = load i32, ptr %12, align 4, !tbaa !18
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds ptr, ptr %91, i64 %93
  store ptr %90, ptr %94, align 8, !tbaa !5
  br label %95

95:                                               ; preds = %83
  %96 = load i32, ptr %12, align 4, !tbaa !18
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %12, align 4, !tbaa !18
  br label %76, !llvm.loop !20

98:                                               ; preds = %82
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  call void @png_write_image(ptr noundef %99, ptr noundef %100)
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_write_end(ptr noundef %101, ptr noundef null)
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %102) #6
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = call i32 @fclose(ptr noundef %103)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  store i32 0, ptr %7, align 4
  br label %105

105:                                              ; preds = %98, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  %106 = load i32, ptr %7, align 4
  switch i32 %106, label %108 [
    i32 0, label %107
    i32 1, label %107
  ]

107:                                              ; preds = %105, %105
  ret void

108:                                              ; preds = %105
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z12__rmg_assertbPKcS0_i(i1 noundef zeroext, ptr noundef, ptr noundef, i32 noundef) #5

declare noalias ptr @png_create_write_struct(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare void @png_set_IHDR(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

declare void @png_write_info(ptr noundef, ptr noundef) #1

declare void @png_write_image(ptr noundef, ptr noundef) #1

declare void @png_write_end(ptr noundef, ptr noundef) #1

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

!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, !6, i64 8}
!10 = !{!"_ZTSN3rmg6BitmapE", !11, i64 0, !11, i64 2, !7, i64 4, !6, i64 8}
!11 = !{!"short", !7, i64 0}
!12 = !{!10, !7, i64 4}
!13 = !{!7, !7, i64 0}
!14 = !{!10, !11, i64 0}
!15 = !{!10, !11, i64 2}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"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.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [62 x i8], align 1
@switch.table._ZNK3rmg6Bitmap7savePNGEPKc = private unnamed_addr constant [3 x i32] [i32 0, i32 4, i32 2], align 4

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #0

declare noalias ptr @png_create_info_struct(ptr noundef) local_unnamed_addr #1

declare void @png_init_io(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3rmg6Bitmap7savePNGEPKc(ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %0, ptr noundef %1) local_unnamed_addr #4 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = icmp ne ptr %4, null
  tail call void @_Z12__rmg_assertbPKcS0_i(i1 noundef zeroext %5, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, i32 noundef 145)
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i8, ptr %6, align 4, !tbaa !11
  %switch.tableidx = add i8 %7, -1
  %8 = icmp ult i8 %switch.tableidx, 3
  br i1 %8, label %switch.lookup, label %10

switch.lookup:                                    ; preds = %2
  %9 = zext nneg i8 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [3 x i32], ptr @switch.table._ZNK3rmg6Bitmap7savePNGEPKc, i64 0, i64 %9
  %switch.load = load i32, ptr %switch.gep, align 4
  br label %10

10:                                               ; preds = %2, %switch.lookup
  %.022 = phi i32 [ %switch.load, %switch.lookup ], [ 6, %2 ]
  %11 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.7)
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %14

12:                                               ; preds = %10
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef %1)
  br label %50

14:                                               ; preds = %10
  %15 = tail call noalias ptr @png_create_write_struct(ptr noundef nonnull @.str.3, ptr noundef null, ptr noundef null, ptr noundef null)
  %16 = tail call noalias ptr @png_create_info_struct(ptr noundef %15)
  tail call void @png_init_io(ptr noundef %15, ptr noundef nonnull %11)
  %17 = load i16, ptr %0, align 8, !tbaa !12
  %18 = zext i16 %17 to i32
  %19 = getelementptr inbounds i8, ptr %0, i64 2
  %20 = load i16, ptr %19, align 2, !tbaa !13
  %21 = zext i16 %20 to i32
  tail call void @png_set_IHDR(ptr noundef %15, ptr noundef %16, i32 noundef %18, i32 noundef %21, i32 noundef 8, i32 noundef %.022, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  tail call void @png_write_info(ptr noundef %15, ptr noundef %16)
  %22 = load i16, ptr %19, align 2, !tbaa !13
  %23 = zext i16 %22 to i64
  %24 = shl nuw nsw i64 %23, 3
  %25 = tail call noalias ptr @malloc(i64 noundef %24) #6
  %26 = load i16, ptr %0, align 8, !tbaa !12
  %27 = zext i16 %26 to i64
  %28 = load i8, ptr %6, align 4, !tbaa !11
  %29 = zext i8 %28 to i64
  %30 = mul nuw nsw i64 %29, %27
  %.not26 = icmp eq i16 %22, 0
  br i1 %.not26, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %14
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %wide.trip.count = zext i16 %22 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %32 = icmp ult i16 %22, 4
  br i1 %32, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %wide.trip.count, 65532
  br label %37

._crit_edge.loopexit.unr-lcssa:                   ; preds = %37, %.lr.ph
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.3, %37 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %33 = mul nuw nsw i64 %30, %indvars.iv.epil
  %34 = getelementptr inbounds i8, ptr %31, i64 %33
  %35 = getelementptr inbounds ptr, ptr %25, i64 %indvars.iv.epil
  store ptr %34, ptr %35, align 8, !tbaa !14
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !15

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader, %14
  tail call void @png_write_image(ptr noundef %15, ptr noundef %25)
  tail call void @png_write_end(ptr noundef %15, ptr noundef null)
  tail call void @free(ptr noundef %25) #7
  %36 = tail call i32 @fclose(ptr noundef nonnull %11)
  br label %50

37:                                               ; preds = %37, %.lr.ph.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next.3, %37 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.3, %37 ]
  %38 = mul nuw nsw i64 %30, %indvars.iv
  %39 = getelementptr inbounds i8, ptr %31, i64 %38
  %40 = getelementptr inbounds ptr, ptr %25, i64 %indvars.iv
  store ptr %39, ptr %40, align 8, !tbaa !14
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %41 = mul nuw nsw i64 %30, %indvars.iv.next
  %42 = getelementptr inbounds i8, ptr %31, i64 %41
  %43 = getelementptr inbounds ptr, ptr %25, i64 %indvars.iv.next
  store ptr %42, ptr %43, align 8, !tbaa !14
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %44 = mul nuw nsw i64 %30, %indvars.iv.next.1
  %45 = getelementptr inbounds i8, ptr %31, i64 %44
  %46 = getelementptr inbounds ptr, ptr %25, i64 %indvars.iv.next.1
  store ptr %45, ptr %46, align 8, !tbaa !14
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %47 = mul nuw nsw i64 %30, %indvars.iv.next.2
  %48 = getelementptr inbounds i8, ptr %31, i64 %47
  %49 = getelementptr inbounds ptr, ptr %25, i64 %indvars.iv.next.2
  store ptr %48, ptr %49, align 8, !tbaa !14
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %37, !llvm.loop !17

50:                                               ; preds = %._crit_edge, %12
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z12__rmg_assertbPKcS0_i(i1 noundef zeroext, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

declare noalias ptr @png_create_write_struct(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @png_set_IHDR(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @png_write_info(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @png_write_image(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @png_write_end(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { nofree 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 = { "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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint 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 #6 = { nounwind allocsize(0) }
attributes #7 = { 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, !10, i64 8}
!6 = !{!"_ZTSN3rmg6BitmapE", !7, i64 0, !7, i64 2, !8, i64 4, !10, i64 8}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !8, i64 4}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 2}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass