; LLVM IR from tessarin/dither :: src (DTImage)

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

%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%struct.DTImage = type { i32, i32, i32, i64, ptr }
%struct.DTPixel = type { i8, i8, i8 }

@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 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 void @perror(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

declare i32 @fclose(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 uwtable
define dso_local void @WriteImageToFile(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call noalias ptr @fopen(ptr noundef %13, ptr noundef @.str.5)
  store ptr %14, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %18

17:                                               ; preds = %2
  call void @perror(ptr noundef @.str.6)
  store i32 1, ptr %6, align 4
  br label %108

18:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = call i64 @strlen(ptr noundef %19) #8
  store i64 %20, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 4, ptr %8, align 8, !tbaa !9
  %21 = load i64, ptr %7, align 8, !tbaa !9
  %22 = load i64, ptr %8, align 8, !tbaa !9
  %23 = icmp ugt i64 %21, %22
  br i1 %23, label %24, label %74

24:                                               ; preds = %18
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = load i64, ptr %7, align 8, !tbaa !9
  %27 = getelementptr inbounds i8, ptr %25, i64 %26
  %28 = load i64, ptr %8, align 8, !tbaa !9
  %29 = sub i64 0, %28
  %30 = getelementptr inbounds i8, ptr %27, i64 %29
  %31 = call i32 @strcmp(ptr noundef %30, ptr noundef @.str.7) #8
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %74, label %33

33:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %34 = call noalias ptr @png_create_write_struct(ptr noundef @.str.8, ptr noundef null, ptr noundef null, ptr noundef null)
  store ptr %34, ptr %9, align 8, !tbaa !5
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 1, ptr %6, align 4
  br label %71

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = call noalias ptr @png_create_info_struct(ptr noundef %39)
  store ptr %40, ptr %10, align 8, !tbaa !5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %44, label %43

43:                                               ; preds = %38
  store i32 1, ptr %6, align 4
  br label %70

44:                                               ; preds = %38
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = call ptr @png_set_longjmp_fn(ptr noundef %45, ptr noundef @longjmp, i64 noundef 200)
  %47 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %46, i64 0, i64 0
  %48 = call i32 @_setjmp(ptr noundef %47) #9
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %44
  store i32 1, ptr %6, align 4
  br label %70

51:                                               ; preds = %44
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_init_io(ptr noundef %52, ptr noundef %53)
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.DTImage, ptr %56, i32 0, i32 0
  %58 = load i32, ptr %57, align 8, !tbaa !11
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.DTImage, ptr %59, i32 0, i32 1
  %61 = load i32, ptr %60, align 4, !tbaa !14
  call void @png_set_IHDR(ptr noundef %54, ptr noundef %55, i32 noundef %58, i32 noundef %61, i32 noundef 8, i32 noundef 2, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  call void @png_write_info(ptr noundef %62, ptr noundef %63)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = call ptr @PNGRowPointersForImage(ptr noundef %64)
  store ptr %65, ptr %11, align 8, !tbaa !5
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  call void @png_write_image(ptr noundef %66, ptr noundef %67)
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_write_end(ptr noundef %68, ptr noundef null)
  call void @png_destroy_write_struct(ptr noundef %9, ptr noundef %10)
  %69 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %69) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  store i32 0, ptr %6, align 4
  br label %70

70:                                               ; preds = %51, %50, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %71

71:                                               ; preds = %70, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  %72 = load i32, ptr %6, align 4
  switch i32 %72, label %107 [
    i32 0, label %73
  ]

73:                                               ; preds = %71
  br label %104

74:                                               ; preds = %24, %18
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.DTImage, ptr %76, i32 0, i32 0
  %78 = load i32, ptr %77, align 8, !tbaa !11
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.DTImage, ptr %79, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !14
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef @.str.9, i32 noundef %78, i32 noundef %81) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !15
  br label %83

83:                                               ; preds = %100, %74
  %84 = load i32, ptr %12, align 4, !tbaa !15
  %85 = sext i32 %84 to i64
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.DTImage, ptr %86, i32 0, i32 3
  %88 = load i64, ptr %87, align 8, !tbaa !16
  %89 = icmp ult i64 %85, %88
  br i1 %89, label %91, label %90

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

91:                                               ; preds = %83
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.DTImage, ptr %92, i32 0, i32 4
  %94 = load ptr, ptr %93, align 8, !tbaa !17
  %95 = load i32, ptr %12, align 4, !tbaa !15
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds %struct.DTPixel, ptr %94, i64 %96
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = call i64 @fwrite(ptr noundef %97, i64 noundef 3, i64 noundef 1, ptr noundef %98)
  br label %100

100:                                              ; preds = %91
  %101 = load i32, ptr %12, align 4, !tbaa !15
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %12, align 4, !tbaa !15
  br label %83, !llvm.loop !18

103:                                              ; preds = %90
  br label %104

104:                                              ; preds = %103, %73
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = call i32 @fclose(ptr noundef %105)
  store i32 0, ptr %6, align 4
  br label %107

107:                                              ; preds = %104, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %108

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

110:                                              ; preds = %108, %108
  ret void

111:                                              ; preds = %108
  unreachable
}

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #4

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

declare noalias ptr @png_create_info_struct(ptr noundef) #1

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) #5

declare ptr @png_set_longjmp_fn(ptr noundef, ptr noundef, i64 noundef) #1

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

declare void @png_init_io(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

; Function Attrs: nounwind uwtable
declare dso_local ptr @PNGRowPointersForImage(ptr noundef) #3

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

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

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

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

declare i64 @fwrite(ptr noundef, i64 noundef, i64 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 "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 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 willreturn memory(read) "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 = { nounwind returns_twice "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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind returns_twice }

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !10, i64 16, !6, i64 24}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 4}
!15 = !{!13, !13, i64 0}
!16 = !{!12, !10, i64 16}
!17 = !{!12, !6, i64 24}
!18 = distinct !{!18, !19}
!19 = !{!"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"

%struct.DTPixel = type { i8, i8, i8 }

@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1

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

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

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @WriteImageToFile(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.5)
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %8

7:                                                ; preds = %2
  call void @perror(ptr noundef nonnull @.str.6) #8
  br label %42

8:                                                ; preds = %2
  %9 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #9
  %10 = icmp ugt i64 %9, 4
  br i1 %10, label %11, label %27

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %1, i64 %9
  %13 = getelementptr inbounds i8, ptr %12, i64 -4
  %14 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.7) #9
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %15, label %27

15:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #10
  %16 = call noalias ptr @png_create_write_struct(ptr noundef nonnull @.str.8, ptr noundef null, ptr noundef null, ptr noundef null) #10
  store ptr %16, ptr %3, align 8, !tbaa !5
  %.not28 = icmp eq ptr %16, null
  br i1 %.not28, label %.critedge, label %17

17:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #10
  %18 = call noalias ptr @png_create_info_struct(ptr noundef nonnull %16) #10
  store ptr %18, ptr %4, align 8, !tbaa !5
  %.not29 = icmp eq ptr %18, null
  br i1 %.not29, label %26, label %19

19:                                               ; preds = %17
  %20 = call ptr @png_set_longjmp_fn(ptr noundef nonnull %16, ptr noundef nonnull @longjmp, i64 noundef 200) #10
  %21 = call i32 @_setjmp(ptr noundef %20) #11
  %.not30 = icmp eq i32 %21, 0
  br i1 %.not30, label %.critedge32, label %26

.critedge32:                                      ; preds = %19
  call void @png_init_io(ptr noundef nonnull %16, ptr noundef nonnull %5) #10
  %22 = load i32, ptr %0, align 8, !tbaa !9
  %23 = getelementptr inbounds i8, ptr %0, i64 4
  %24 = load i32, ptr %23, align 4, !tbaa !13
  call void @png_set_IHDR(ptr noundef nonnull %16, ptr noundef nonnull %18, i32 noundef %22, i32 noundef %24, i32 noundef 8, i32 noundef 2, i32 noundef 0, i32 noundef 0, i32 noundef 0) #10
  call void @png_write_info(ptr noundef nonnull %16, ptr noundef nonnull %18) #10
  %25 = call ptr @PNGRowPointersForImage(ptr noundef nonnull %0)
  call void @png_write_image(ptr noundef nonnull %16, ptr noundef %25) #10
  call void @png_write_end(ptr noundef nonnull %16, ptr noundef null) #10
  call void @png_destroy_write_struct(ptr noundef nonnull %3, ptr noundef nonnull %4) #10
  call void @free(ptr noundef %25) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #10
  br label %.loopexit

26:                                               ; preds = %19, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #10
  br label %42

27:                                               ; preds = %11, %8
  %28 = load i32, ptr %0, align 8, !tbaa !9
  %29 = getelementptr inbounds i8, ptr %0, i64 4
  %30 = load i32, ptr %29, align 4, !tbaa !13
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %5, ptr noundef nonnull @.str.9, i32 noundef %28, i32 noundef %30) #10
  %32 = getelementptr inbounds i8, ptr %0, i64 16
  %33 = load i64, ptr %32, align 8, !tbaa !14
  %.not34 = icmp eq i64 %33, 0
  br i1 %.not34, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %27
  %34 = getelementptr inbounds i8, ptr %0, i64 24
  br label %35

35:                                               ; preds = %.lr.ph, %35
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %35 ]
  %36 = load ptr, ptr %34, align 8, !tbaa !15
  %37 = getelementptr inbounds %struct.DTPixel, ptr %36, i64 %indvars.iv
  %38 = call i64 @fwrite(ptr noundef %37, i64 noundef 3, i64 noundef 1, ptr noundef nonnull %5)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %39 = load i64, ptr %32, align 8, !tbaa !14
  %40 = icmp ugt i64 %39, %indvars.iv.next
  br i1 %40, label %35, label %.loopexit, !llvm.loop !16

.loopexit:                                        ; preds = %35, %27, %.critedge32
  %41 = call i32 @fclose(ptr noundef nonnull %5)
  br label %42

.critedge:                                        ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #10
  br label %42

42:                                               ; preds = %26, %.loopexit, %.critedge, %7
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) local_unnamed_addr #5

declare ptr @png_set_longjmp_fn(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #4

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

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

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 #4

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @PNGRowPointersForImage(ptr noundef) local_unnamed_addr #2

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

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

declare void @png_destroy_write_struct(ptr noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { "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 = { nounwind returns_twice "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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { cold }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind }
attributes #11 = { nounwind returns_twice }

!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/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !12, i64 16}
!15 = !{!10, !6, i64 24}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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