; LLVM IR from fhanau/Efficient-Compression-Tool :: src/optipng (codec)

; 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.opng_codec_context = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64, i32, i32, i32, i8 }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [14 x i8], align 1
@_ZTIPKc = external constant ptr

; Function Attrs: mustprogress uwtable
define dso_local i32 @opng_decode_image(ptr noundef %0, ptr noundef %1, ptr noundef %2, i1 noundef zeroext %3, i32 noundef %4) #0 personality ptr @__gxx_personality_v0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  %17 = zext i1 %3 to i8
  store i8 %17, ptr %10, align 1, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !11
  %18 = call noalias ptr @png_create_read_struct(ptr noundef @.str, ptr noundef null, ptr noundef @_ZL15opng_read_errorP14png_struct_defPKc, ptr noundef @_ZL17opng_read_warningP14png_struct_defPKc)
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.opng_codec_context, ptr %19, i32 0, i32 4
  store ptr %18, ptr %20, align 8, !tbaa !13
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.opng_codec_context, ptr %21, i32 0, i32 4
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = call noalias ptr @png_create_info_struct(ptr noundef %23)
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.opng_codec_context, ptr %25, i32 0, i32 5
  store ptr %24, ptr %26, align 8, !tbaa !16
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.opng_codec_context, ptr %27, i32 0, i32 4
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %36

31:                                               ; preds = %5
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.opng_codec_context, ptr %32, i32 0, i32 5
  %34 = load ptr, ptr %33, align 8, !tbaa !16
  %35 = icmp ne ptr %34, null
  br i1 %35, label %41, label %36

36:                                               ; preds = %31, %5
  call void @opng_error(ptr noundef null, ptr noundef @.str.1)
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.opng_codec_context, ptr %37, i32 0, i32 4
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.opng_codec_context, ptr %39, i32 0, i32 5
  call void @png_destroy_read_struct(ptr noundef %38, ptr noundef %40, ptr noundef null)
  call void @exit(i32 noundef 1) #6
  unreachable

41:                                               ; preds = %31
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.opng_codec_context, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !17
  call void @opng_init_image(ptr noundef %44)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.opng_codec_context, ptr %45, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !18
  store ptr %47, ptr %12, align 8, !tbaa !5
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZL15opng_init_statsP19opng_encoding_stats(ptr noundef %48)
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.opng_codec_context, ptr %50, i32 0, i32 2
  store ptr %49, ptr %51, align 8, !tbaa !19
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.opng_codec_context, ptr %53, i32 0, i32 3
  store ptr %52, ptr %54, align 8, !tbaa !20
  %55 = load i8, ptr %10, align 1, !tbaa !9, !range !21, !noundef !22
  %56 = trunc i8 %55 to i1
  br i1 %56, label %57, label %61

57:                                               ; preds = %41
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.opng_codec_context, ptr %58, i32 0, i32 4
  %60 = load ptr, ptr %59, align 8, !tbaa !13
  call void @png_set_palette_to_rgb(ptr noundef %60)
  br label %61

61:                                               ; preds = %57, %41
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.opng_codec_context, ptr %62, i32 0, i32 4
  %64 = load ptr, ptr %63, align 8, !tbaa !13
  invoke void @png_set_keep_unknown_chunks(ptr noundef %64, i32 noundef 3, ptr noundef null, i32 noundef 0)
          to label %65 unwind label %78

65:                                               ; preds = %61
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.opng_codec_context, ptr %66, i32 0, i32 4
  %68 = load ptr, ptr %67, align 8, !tbaa !13
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @png_set_read_fn(ptr noundef %68, ptr noundef %69, ptr noundef @_ZL14opng_read_dataP14png_struct_defPhm)
          to label %70 unwind label %78

70:                                               ; preds = %65
  %71 = load i32, ptr %11, align 4, !tbaa !11
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %102, label %73

73:                                               ; preds = %70
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.opng_codec_context, ptr %74, i32 0, i32 4
  %76 = load ptr, ptr %75, align 8, !tbaa !13
  invoke void @png_set_read_user_transform_fn(ptr noundef %76, ptr noundef @_ZL28pngcrush_transform_pixels_fnP14png_struct_defP19png_row_info_structPh)
          to label %77 unwind label %78

77:                                               ; preds = %73
  br label %102

78:                                               ; preds = %102, %73, %65, %61
  %79 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTIPKc
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %13, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %14, align 4
  br label %82

82:                                               ; preds = %78
  %83 = load i32, ptr %14, align 4
  %84 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIPKc) #7
  %85 = icmp eq i32 %83, %84
  br i1 %85, label %86, label %134

86:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %87 = load ptr, ptr %13, align 8
  %88 = call ptr @__cxa_begin_catch(ptr %87) #7
  store ptr %88, ptr %15, align 8
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.opng_codec_context, ptr %89, i32 0, i32 4
  %91 = load ptr, ptr %90, align 8, !tbaa !13
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.opng_codec_context, ptr %92, i32 0, i32 5
  %94 = load ptr, ptr %93, align 8, !tbaa !16
  %95 = invoke i32 @opng_validate_image(ptr noundef %91, ptr noundef %94)
          to label %96 unwind label %110

96:                                               ; preds = %86
  %97 = icmp ne i32 %95, 0
  br i1 %97, label %98, label %114

98:                                               ; preds = %96
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = load ptr, ptr %15, align 8, !tbaa !5
  invoke void @opng_warning(ptr noundef %99, ptr noundef %100)
          to label %101 unwind label %110

101:                                              ; preds = %98
  br label %118

102:                                              ; preds = %77, %70
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.opng_codec_context, ptr %103, i32 0, i32 4
  %105 = load ptr, ptr %104, align 8, !tbaa !13
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.opng_codec_context, ptr %106, i32 0, i32 5
  %108 = load ptr, ptr %107, align 8, !tbaa !16
  invoke void @png_read_png(ptr noundef %105, ptr noundef %108, i32 noundef 0, ptr noundef null)
          to label %109 unwind label %78

109:                                              ; preds = %102
  br label %122

110:                                              ; preds = %114, %98, %86
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %13, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %14, align 4
  call void @__cxa_end_catch() #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %134

114:                                              ; preds = %96
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = load ptr, ptr %15, align 8, !tbaa !5
  invoke void @opng_error(ptr noundef %115, ptr noundef %116)
          to label %117 unwind label %110

117:                                              ; preds = %114
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %119

118:                                              ; preds = %101
  store i32 0, ptr %16, align 4
  br label %119

119:                                              ; preds = %118, %117
  call void @__cxa_end_catch() #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  %120 = load i32, ptr %16, align 4
  switch i32 %120, label %132 [
    i32 0, label %121
  ]

121:                                              ; preds = %119
  br label %122

122:                                              ; preds = %121, %109
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.opng_codec_context, ptr %123, i32 0, i32 0
  %125 = load ptr, ptr %124, align 8, !tbaa !17
  %126 = load ptr, ptr %7, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.opng_codec_context, ptr %126, i32 0, i32 4
  %128 = load ptr, ptr %127, align 8, !tbaa !13
  %129 = load ptr, ptr %7, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.opng_codec_context, ptr %129, i32 0, i32 5
  %131 = load ptr, ptr %130, align 8, !tbaa !16
  call void @opng_load_image(ptr noundef %125, ptr noundef %128, ptr noundef %131)
  store i32 0, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %132

132:                                              ; preds = %122, %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %133 = load i32, ptr %6, align 4
  ret i32 %133

134:                                              ; preds = %110, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %135

135:                                              ; preds = %134
  %136 = load ptr, ptr %13, align 8
  %137 = load i32, ptr %14, align 4
  %138 = insertvalue { ptr, i32 } poison, ptr %136, 0
  %139 = insertvalue { ptr, i32 } %138, i32 %137, 1
  resume { ptr, i32 } %139
}

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL15opng_read_errorP14png_struct_defPKc(ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL17opng_read_warningP14png_struct_defPKc(ptr noundef, ptr noundef) #0

declare noalias ptr @png_create_info_struct(ptr noundef) #1

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

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

declare void @opng_init_image(ptr noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL15opng_init_statsP19opng_encoding_stats(ptr noundef) #4

declare void @png_set_palette_to_rgb(ptr noundef) #1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL14opng_read_dataP14png_struct_defPhm(ptr noundef, ptr noundef, i64 noundef) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL28pngcrush_transform_pixels_fnP14png_struct_defP19png_row_info_structPh(ptr noundef, ptr noundef, ptr noundef) #4

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

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #5

declare ptr @__cxa_begin_catch(ptr)

declare i32 @opng_validate_image(ptr noundef, ptr noundef) #1

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

declare void @__cxa_end_catch()

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

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

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 = { "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 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind memory(none) }
attributes #6 = { noreturn nounwind }
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, !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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 32}
!14 = !{!"_ZTS18opng_codec_context", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !15, i64 56, !15, i64 64, !12, i64 72, !12, i64 76, !12, i64 80, !10, i64 84}
!15 = !{!"long", !7, i64 0}
!16 = !{!14, !6, i64 40}
!17 = !{!14, !6, i64 0}
!18 = !{!14, !6, i64 8}
!19 = !{!14, !6, i64 16}
!20 = !{!14, !6, i64 24}
!21 = !{i8 0, i8 2}
!22 = !{}


; 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 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [14 x i8], align 1
@_ZTIPKc = external constant ptr

; Function Attrs: mustprogress uwtable
define dso_local range(i32 -1, 1) i32 @opng_decode_image(ptr noundef %0, ptr noundef %1, ptr noundef %2, i1 noundef zeroext %3, i32 noundef %4) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %6 = tail call noalias ptr @png_create_read_struct(ptr noundef nonnull @.str, ptr noundef null, ptr noundef nonnull @_ZL15opng_read_errorP14png_struct_defPKc, ptr noundef nonnull @_ZL17opng_read_warningP14png_struct_defPKc)
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %6, ptr %7, align 8, !tbaa !5
  %8 = tail call noalias ptr @png_create_info_struct(ptr noundef %6)
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %8, ptr %9, align 8, !tbaa !13
  %10 = load ptr, ptr %7, align 8, !tbaa !5
  %.not = icmp eq ptr %10, null
  %.not41 = icmp eq ptr %8, null
  %or.cond = select i1 %.not, i1 true, i1 %.not41
  br i1 %or.cond, label %11, label %12

11:                                               ; preds = %5
  tail call void @opng_error(ptr noundef null, ptr noundef nonnull @.str.1)
  tail call void @png_destroy_read_struct(ptr noundef nonnull %7, ptr noundef nonnull %9, ptr noundef null)
  tail call void @exit(i32 noundef 1) #5
  unreachable

12:                                               ; preds = %5
  %13 = load ptr, ptr %0, align 8, !tbaa !14
  tail call void @opng_init_image(ptr noundef %13)
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  tail call void @_ZL15opng_init_statsP19opng_encoding_stats(ptr noundef %15)
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %1, ptr %16, align 8, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %2, ptr %17, align 8, !tbaa !17
  br i1 %3, label %18, label %20

18:                                               ; preds = %12
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  tail call void @png_set_palette_to_rgb(ptr noundef %19)
  br label %20

20:                                               ; preds = %18, %12
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @png_set_keep_unknown_chunks(ptr noundef %21, i32 noundef 3, ptr noundef null, i32 noundef 0)
          to label %22 unwind label %27

22:                                               ; preds = %20
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @png_set_read_fn(ptr noundef %23, ptr noundef nonnull %0, ptr noundef nonnull @_ZL14opng_read_dataP14png_struct_defPhm)
          to label %24 unwind label %27

24:                                               ; preds = %22
  %.not42 = icmp eq i32 %4, 0
  br i1 %.not42, label %25, label %40

25:                                               ; preds = %24
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @png_set_read_user_transform_fn(ptr noundef %26, ptr noundef nonnull @_ZL28pngcrush_transform_pixels_fnP14png_struct_defP19png_row_info_structPh)
          to label %40 unwind label %27

27:                                               ; preds = %40, %25, %22, %20
  %28 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTIPKc
  %29 = extractvalue { ptr, i32 } %28, 1
  %30 = tail call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIPKc) #6
  %31 = icmp eq i32 %29, %30
  br i1 %31, label %32, label %52

32:                                               ; preds = %27
  %33 = extractvalue { ptr, i32 } %28, 0
  %34 = tail call ptr @__cxa_begin_catch(ptr %33) #6
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = load ptr, ptr %9, align 8, !tbaa !13
  %37 = invoke i32 @opng_validate_image(ptr noundef %35, ptr noundef %36)
          to label %38 unwind label %43

38:                                               ; preds = %32
  %.not43.not = icmp eq i32 %37, 0
  br i1 %.not43.not, label %45, label %39

39:                                               ; preds = %38
  invoke void @opng_warning(ptr noundef %2, ptr noundef %34)
          to label %46 unwind label %43

40:                                               ; preds = %25, %24
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = load ptr, ptr %9, align 8, !tbaa !13
  invoke void @png_read_png(ptr noundef %41, ptr noundef %42, i32 noundef 0, ptr noundef null)
          to label %47 unwind label %27

43:                                               ; preds = %45, %39, %32
  %44 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_end_catch() #6
  br label %52

45:                                               ; preds = %38
  invoke void @opng_error(ptr noundef %2, ptr noundef %34)
          to label %.thread unwind label %43

.thread:                                          ; preds = %45
  tail call void @__cxa_end_catch() #6
  br label %51

46:                                               ; preds = %39
  tail call void @__cxa_end_catch() #6
  br label %47

47:                                               ; preds = %46, %40
  %48 = load ptr, ptr %0, align 8, !tbaa !14
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = load ptr, ptr %9, align 8, !tbaa !13
  tail call void @opng_load_image(ptr noundef %48, ptr noundef %49, ptr noundef %50)
  br label %51

51:                                               ; preds = %.thread, %47
  %.1 = phi i32 [ 0, %47 ], [ -1, %.thread ]
  ret i32 %.1

52:                                               ; preds = %43, %27
  %.merged = phi { ptr, i32 } [ %44, %43 ], [ %28, %27 ]
  resume { ptr, i32 } %.merged
}

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL15opng_read_errorP14png_struct_defPKc(ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL17opng_read_warningP14png_struct_defPKc(ptr noundef, ptr noundef) #0

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

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

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

declare void @opng_init_image(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL15opng_init_statsP19opng_encoding_stats(ptr noundef) local_unnamed_addr #3

declare void @png_set_palette_to_rgb(ptr noundef) local_unnamed_addr #1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL14opng_read_dataP14png_struct_defPhm(ptr noundef, ptr noundef, i64 noundef) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL28pngcrush_transform_pixels_fnP14png_struct_defP19png_row_info_structPh(ptr noundef, ptr noundef, ptr noundef) #3

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

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #4

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

declare i32 @opng_validate_image(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare void @__cxa_end_catch() local_unnamed_addr

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

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 = { "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 = { 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 #3 = { 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 = { nofree nosync nounwind memory(none) }
attributes #5 = { noreturn nounwind }
attributes #6 = { 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, !7, i64 32}
!6 = !{!"_ZTS18opng_codec_context", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !10, i64 64, !11, i64 72, !11, i64 76, !11, i64 80, !12, i64 84}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"bool", !8, i64 0}
!13 = !{!6, !7, i64 40}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !7, i64 16}
!17 = !{!6, !7, i64 24}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass