; LLVM IR from niessner/Matterport :: code/gaps/pkgs/png (pngwrite)

; 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.png_struct_def = type { [1 x %struct.__jmp_buf_tag], ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i32, i32, i32, %struct.z_stream_s, ptr, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_row_info_struct, i32, i32, ptr, i16, i16, [5 x i8], i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, float, %struct.png_color_16_struct, %struct.png_color_16_struct, ptr, i32, i32, i32, float, float, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_color_8_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i64, i64, i64, i32, i32, i64, i64, ptr, ptr, ptr, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, i32, ptr, i8, i16, i16, i16, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i32, i32, %struct.png_unknown_chunk_t, i32, i32, ptr, i32 }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%struct.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%struct.png_row_info_struct = type { i32, i64, i8, i8, i8, i8 }
%struct.png_color_8_struct = type { i8, i8, i8, i8, i8 }
%struct.png_color_16_struct = type { i8, i16, i16, i16, i16 }
%struct.png_unknown_chunk_t = type { [5 x i8], ptr, i64, i8 }

@.str.9 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1

declare void @png_warning(ptr noundef, ptr noundef) #0

declare void @png_error(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @png_set_filter(ptr noundef %0, i32 noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %3
  br label %208

10:                                               ; preds = %3
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.png_struct_def, ptr %11, i32 0, i32 119
  %13 = load i32, ptr %12, align 8, !tbaa !11
  %14 = and i32 %13, 4
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %20

16:                                               ; preds = %10
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = icmp eq i32 %17, 64
  br i1 %18, label %19, label %20

19:                                               ; preds = %16
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %19, %16, %10
  %21 = load i32, ptr %5, align 4, !tbaa !9
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %206

23:                                               ; preds = %20
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = and i32 %24, 255
  switch i32 %25, label %43 [
    i32 5, label %26
    i32 6, label %26
    i32 7, label %26
    i32 0, label %28
    i32 1, label %31
    i32 2, label %34
    i32 3, label %37
    i32 4, label %40
  ]

26:                                               ; preds = %23, %23, %23
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %27, ptr noundef @.str.9)
  br label %28

28:                                               ; preds = %26, %23
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.png_struct_def, ptr %29, i32 0, i32 49
  store i8 8, ptr %30, align 1, !tbaa !21
  br label %48

31:                                               ; preds = %23
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.png_struct_def, ptr %32, i32 0, i32 49
  store i8 16, ptr %33, align 1, !tbaa !21
  br label %48

34:                                               ; preds = %23
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.png_struct_def, ptr %35, i32 0, i32 49
  store i8 32, ptr %36, align 1, !tbaa !21
  br label %48

37:                                               ; preds = %23
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.png_struct_def, ptr %38, i32 0, i32 49
  store i8 64, ptr %39, align 1, !tbaa !21
  br label %48

40:                                               ; preds = %23
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.png_struct_def, ptr %41, i32 0, i32 49
  store i8 -128, ptr %42, align 1, !tbaa !21
  br label %48

43:                                               ; preds = %23
  %44 = load i32, ptr %6, align 4, !tbaa !9
  %45 = trunc i32 %44 to i8
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.png_struct_def, ptr %46, i32 0, i32 49
  store i8 %45, ptr %47, align 1, !tbaa !21
  br label %48

48:                                               ; preds = %43, %40, %37, %34, %31, %28
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.png_struct_def, ptr %49, i32 0, i32 33
  %51 = load ptr, ptr %50, align 8, !tbaa !22
  %52 = icmp ne ptr %51, null
  br i1 %52, label %53, label %205

53:                                               ; preds = %48
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.png_struct_def, ptr %54, i32 0, i32 49
  %56 = load i8, ptr %55, align 1, !tbaa !21
  %57 = zext i8 %56 to i32
  %58 = and i32 %57, 16
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %78

60:                                               ; preds = %53
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.png_struct_def, ptr %61, i32 0, i32 34
  %63 = load ptr, ptr %62, align 8, !tbaa !23
  %64 = icmp eq ptr %63, null
  br i1 %64, label %65, label %78

65:                                               ; preds = %60
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.png_struct_def, ptr %67, i32 0, i32 28
  %69 = load i64, ptr %68, align 8, !tbaa !24
  %70 = add i64 %69, 1
  %71 = call ptr @png_malloc(ptr noundef %66, i64 noundef %70)
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.png_struct_def, ptr %72, i32 0, i32 34
  store ptr %71, ptr %73, align 8, !tbaa !23
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.png_struct_def, ptr %74, i32 0, i32 34
  %76 = load ptr, ptr %75, align 8, !tbaa !23
  %77 = getelementptr inbounds i8, ptr %76, i64 0
  store i8 1, ptr %77, align 1, !tbaa !25
  br label %78

78:                                               ; preds = %65, %60, %53
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.png_struct_def, ptr %79, i32 0, i32 49
  %81 = load i8, ptr %80, align 1, !tbaa !21
  %82 = zext i8 %81 to i32
  %83 = and i32 %82, 32
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %117

85:                                               ; preds = %78
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.png_struct_def, ptr %86, i32 0, i32 35
  %88 = load ptr, ptr %87, align 8, !tbaa !26
  %89 = icmp eq ptr %88, null
  br i1 %89, label %90, label %117

90:                                               ; preds = %85
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.png_struct_def, ptr %91, i32 0, i32 32
  %93 = load ptr, ptr %92, align 8, !tbaa !27
  %94 = icmp eq ptr %93, null
  br i1 %94, label %95, label %103

95:                                               ; preds = %90
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %96, ptr noundef @.str.10)
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.png_struct_def, ptr %97, i32 0, i32 49
  %99 = load i8, ptr %98, align 1, !tbaa !21
  %100 = zext i8 %99 to i32
  %101 = and i32 %100, -33
  %102 = trunc i32 %101 to i8
  store i8 %102, ptr %98, align 1, !tbaa !21
  br label %116

103:                                              ; preds = %90
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = load ptr, ptr %4, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.png_struct_def, ptr %105, i32 0, i32 28
  %107 = load i64, ptr %106, align 8, !tbaa !24
  %108 = add i64 %107, 1
  %109 = call ptr @png_malloc(ptr noundef %104, i64 noundef %108)
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.png_struct_def, ptr %110, i32 0, i32 35
  store ptr %109, ptr %111, align 8, !tbaa !26
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.png_struct_def, ptr %112, i32 0, i32 35
  %114 = load ptr, ptr %113, align 8, !tbaa !26
  %115 = getelementptr inbounds i8, ptr %114, i64 0
  store i8 2, ptr %115, align 1, !tbaa !25
  br label %116

116:                                              ; preds = %103, %95
  br label %117

117:                                              ; preds = %116, %85, %78
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.png_struct_def, ptr %118, i32 0, i32 49
  %120 = load i8, ptr %119, align 1, !tbaa !21
  %121 = zext i8 %120 to i32
  %122 = and i32 %121, 64
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %156

124:                                              ; preds = %117
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.png_struct_def, ptr %125, i32 0, i32 36
  %127 = load ptr, ptr %126, align 8, !tbaa !28
  %128 = icmp eq ptr %127, null
  br i1 %128, label %129, label %156

129:                                              ; preds = %124
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.png_struct_def, ptr %130, i32 0, i32 32
  %132 = load ptr, ptr %131, align 8, !tbaa !27
  %133 = icmp eq ptr %132, null
  br i1 %133, label %134, label %142

134:                                              ; preds = %129
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %135, ptr noundef @.str.11)
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.png_struct_def, ptr %136, i32 0, i32 49
  %138 = load i8, ptr %137, align 1, !tbaa !21
  %139 = zext i8 %138 to i32
  %140 = and i32 %139, -65
  %141 = trunc i32 %140 to i8
  store i8 %141, ptr %137, align 1, !tbaa !21
  br label %155

142:                                              ; preds = %129
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.png_struct_def, ptr %144, i32 0, i32 28
  %146 = load i64, ptr %145, align 8, !tbaa !24
  %147 = add i64 %146, 1
  %148 = call ptr @png_malloc(ptr noundef %143, i64 noundef %147)
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.png_struct_def, ptr %149, i32 0, i32 36
  store ptr %148, ptr %150, align 8, !tbaa !28
  %151 = load ptr, ptr %4, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.png_struct_def, ptr %151, i32 0, i32 36
  %153 = load ptr, ptr %152, align 8, !tbaa !28
  %154 = getelementptr inbounds i8, ptr %153, i64 0
  store i8 3, ptr %154, align 1, !tbaa !25
  br label %155

155:                                              ; preds = %142, %134
  br label %156

156:                                              ; preds = %155, %124, %117
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.png_struct_def, ptr %157, i32 0, i32 49
  %159 = load i8, ptr %158, align 1, !tbaa !21
  %160 = zext i8 %159 to i32
  %161 = and i32 %160, 128
  %162 = icmp ne i32 %161, 0
  br i1 %162, label %163, label %195

163:                                              ; preds = %156
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.png_struct_def, ptr %164, i32 0, i32 37
  %166 = load ptr, ptr %165, align 8, !tbaa !29
  %167 = icmp eq ptr %166, null
  br i1 %167, label %168, label %195

168:                                              ; preds = %163
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.png_struct_def, ptr %169, i32 0, i32 32
  %171 = load ptr, ptr %170, align 8, !tbaa !27
  %172 = icmp eq ptr %171, null
  br i1 %172, label %173, label %181

173:                                              ; preds = %168
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %174, ptr noundef @.str.12)
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.png_struct_def, ptr %175, i32 0, i32 49
  %177 = load i8, ptr %176, align 1, !tbaa !21
  %178 = zext i8 %177 to i32
  %179 = and i32 %178, 127
  %180 = trunc i32 %179 to i8
  store i8 %180, ptr %176, align 1, !tbaa !21
  br label %194

181:                                              ; preds = %168
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.png_struct_def, ptr %183, i32 0, i32 28
  %185 = load i64, ptr %184, align 8, !tbaa !24
  %186 = add i64 %185, 1
  %187 = call ptr @png_malloc(ptr noundef %182, i64 noundef %186)
  %188 = load ptr, ptr %4, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.png_struct_def, ptr %188, i32 0, i32 37
  store ptr %187, ptr %189, align 8, !tbaa !29
  %190 = load ptr, ptr %4, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.png_struct_def, ptr %190, i32 0, i32 37
  %192 = load ptr, ptr %191, align 8, !tbaa !29
  %193 = getelementptr inbounds i8, ptr %192, i64 0
  store i8 4, ptr %193, align 1, !tbaa !25
  br label %194

194:                                              ; preds = %181, %173
  br label %195

195:                                              ; preds = %194, %163, %156
  %196 = load ptr, ptr %4, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.png_struct_def, ptr %196, i32 0, i32 49
  %198 = load i8, ptr %197, align 1, !tbaa !21
  %199 = zext i8 %198 to i32
  %200 = icmp eq i32 %199, 0
  br i1 %200, label %201, label %204

201:                                              ; preds = %195
  %202 = load ptr, ptr %4, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.png_struct_def, ptr %202, i32 0, i32 49
  store i8 8, ptr %203, align 1, !tbaa !21
  br label %204

204:                                              ; preds = %201, %195
  br label %205

205:                                              ; preds = %204, %48
  br label %208

206:                                              ; preds = %20
  %207 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %207, ptr noundef @.str.13)
  br label %208

208:                                              ; preds = %206, %205, %9
  ret void
}

declare ptr @png_malloc(ptr noundef, i64 noundef) #0

attributes #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 = { 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" }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 1032}
!12 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !7, i64 280, !7, i64 281, !10, i64 284, !10, i64 288, !10, i64 292, !13, i64 296, !6, i64 408, !14, i64 416, !10, i64 424, !10, i64 428, !10, i64 432, !10, i64 436, !10, i64 440, !10, i64 444, !10, i64 448, !10, i64 452, !10, i64 456, !14, i64 464, !14, i64 472, !10, i64 480, !10, i64 484, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !15, i64 536, !10, i64 560, !10, i64 564, !6, i64 568, !16, i64 576, !16, i64 578, !7, i64 580, !7, i64 585, !7, i64 586, !7, i64 587, !7, i64 588, !7, i64 589, !7, i64 590, !7, i64 591, !7, i64 592, !7, i64 593, !7, i64 594, !7, i64 595, !7, i64 596, !16, i64 598, !7, i64 600, !17, i64 604, !18, i64 608, !18, i64 618, !6, i64 632, !10, i64 640, !10, i64 644, !10, i64 648, !17, i64 652, !17, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !19, i64 712, !19, i64 717, !6, i64 728, !18, i64 736, !6, i64 752, !6, i64 760, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !10, i64 824, !10, i64 828, !14, i64 832, !14, i64 840, !14, i64 848, !14, i64 856, !10, i64 864, !10, i64 868, !14, i64 872, !14, i64 880, !6, i64 888, !6, i64 896, !6, i64 904, !6, i64 912, !6, i64 920, !7, i64 928, !7, i64 929, !6, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !10, i64 984, !6, i64 992, !6, i64 1000, !10, i64 1008, !6, i64 1016, !7, i64 1024, !16, i64 1026, !16, i64 1028, !16, i64 1030, !10, i64 1032, !10, i64 1036, !7, i64 1040, !6, i64 1048, !6, i64 1056, !6, i64 1064, !6, i64 1072, !6, i64 1080, !6, i64 1088, !6, i64 1096, !7, i64 1104, !10, i64 1108, !10, i64 1112, !10, i64 1116, !20, i64 1120, !10, i64 1152, !10, i64 1156, !6, i64 1160, !10, i64 1168}
!13 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !14, i64 16, !6, i64 24, !10, i64 32, !14, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !14, i64 96, !14, i64 104}
!14 = !{!"long", !7, i64 0}
!15 = !{!"png_row_info_struct", !10, i64 0, !14, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!16 = !{!"short", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"png_color_16_struct", !7, i64 0, !16, i64 2, !16, i64 4, !16, i64 6, !16, i64 8}
!19 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!20 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !14, i64 16, !7, i64 24}
!21 = !{!12, !7, i64 589}
!22 = !{!12, !6, i64 496}
!23 = !{!12, !6, i64 504}
!24 = !{!12, !14, i64 464}
!25 = !{!7, !7, i64 0}
!26 = !{!12, !6, i64 512}
!27 = !{!12, !6, i64 488}
!28 = !{!12, !6, i64 520}
!29 = !{!12, !6, i64 528}


; 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.9 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1

declare void @png_warning(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @png_error(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @png_set_filter(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = icmp eq ptr %0, null
  br i1 %4, label %thread-pre-split54.thread, label %5

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 1032
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = and i32 %7, 4
  %9 = icmp ne i32 %8, 0
  %10 = icmp eq i32 %1, 64
  %or.cond = and i1 %10, %9
  %11 = icmp eq i32 %1, 0
  %12 = or i1 %11, %or.cond
  br i1 %12, label %13, label %94

13:                                               ; preds = %5
  %trunc = trunc i32 %2 to i8
  switch i8 %trunc, label %19 [
    i8 5, label %14
    i8 6, label %14
    i8 7, label %14
    i8 0, label %20
    i8 1, label %15
    i8 2, label %16
    i8 3, label %17
    i8 4, label %18
  ]

14:                                               ; preds = %13, %13, %13
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.9) #2
  br label %20

15:                                               ; preds = %13
  br label %20

16:                                               ; preds = %13
  br label %20

17:                                               ; preds = %13
  br label %20

18:                                               ; preds = %13
  br label %20

19:                                               ; preds = %13
  br label %20

20:                                               ; preds = %13, %14, %19, %18, %17, %16, %15
  %trunc.sink = phi i8 [ %trunc, %19 ], [ -128, %18 ], [ 64, %17 ], [ 32, %16 ], [ 16, %15 ], [ 8, %14 ], [ 8, %13 ]
  %21 = getelementptr inbounds i8, ptr %0, i64 589
  store i8 %trunc.sink, ptr %21, align 1, !tbaa !19
  %22 = getelementptr inbounds i8, ptr %0, i64 496
  %23 = load ptr, ptr %22, align 8, !tbaa !20
  %.not = icmp eq ptr %23, null
  br i1 %.not, label %thread-pre-split54.thread, label %24

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %0, i64 589
  %26 = and i8 %trunc.sink, 16
  %.not50 = icmp eq i8 %26, 0
  br i1 %.not50, label %36, label %27

27:                                               ; preds = %24
  %28 = getelementptr inbounds i8, ptr %0, i64 504
  %29 = load ptr, ptr %28, align 8, !tbaa !21
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %36

31:                                               ; preds = %27
  %32 = getelementptr inbounds i8, ptr %0, i64 464
  %33 = load i64, ptr %32, align 8, !tbaa !22
  %34 = add i64 %33, 1
  %35 = tail call ptr @png_malloc(ptr noundef nonnull %0, i64 noundef %34) #2
  store ptr %35, ptr %28, align 8, !tbaa !21
  store i8 1, ptr %35, align 1, !tbaa !23
  %.pre = load i8, ptr %25, align 1, !tbaa !19
  br label %36

36:                                               ; preds = %31, %27, %24
  %37 = phi i8 [ %.pre, %31 ], [ %trunc.sink, %27 ], [ %trunc.sink, %24 ]
  %38 = and i8 %37, 32
  %.not51 = icmp eq i8 %38, 0
  br i1 %.not51, label %55, label %39

39:                                               ; preds = %36
  %40 = getelementptr inbounds i8, ptr %0, i64 512
  %41 = load ptr, ptr %40, align 8, !tbaa !24
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %55

43:                                               ; preds = %39
  %44 = getelementptr inbounds i8, ptr %0, i64 488
  %45 = load ptr, ptr %44, align 8, !tbaa !25
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %50

47:                                               ; preds = %43
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.10) #2
  %48 = load i8, ptr %25, align 1, !tbaa !19
  %49 = and i8 %48, -33
  store i8 %49, ptr %25, align 1, !tbaa !19
  br label %55

50:                                               ; preds = %43
  %51 = getelementptr inbounds i8, ptr %0, i64 464
  %52 = load i64, ptr %51, align 8, !tbaa !22
  %53 = add i64 %52, 1
  %54 = tail call ptr @png_malloc(ptr noundef nonnull %0, i64 noundef %53) #2
  store ptr %54, ptr %40, align 8, !tbaa !24
  store i8 2, ptr %54, align 1, !tbaa !23
  %.pre56 = load i8, ptr %25, align 1, !tbaa !19
  br label %55

55:                                               ; preds = %47, %50, %39, %36
  %56 = phi i8 [ %49, %47 ], [ %.pre56, %50 ], [ %37, %39 ], [ %37, %36 ]
  %57 = and i8 %56, 64
  %.not52 = icmp eq i8 %57, 0
  br i1 %.not52, label %thread-pre-split, label %58

58:                                               ; preds = %55
  %59 = getelementptr inbounds i8, ptr %0, i64 520
  %60 = load ptr, ptr %59, align 8, !tbaa !26
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %thread-pre-split

62:                                               ; preds = %58
  %63 = getelementptr inbounds i8, ptr %0, i64 488
  %64 = load ptr, ptr %63, align 8, !tbaa !25
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %69

66:                                               ; preds = %62
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.11) #2
  %67 = load i8, ptr %25, align 1, !tbaa !19
  %68 = and i8 %67, -65
  store i8 %68, ptr %25, align 1, !tbaa !19
  br label %thread-pre-split

69:                                               ; preds = %62
  %70 = getelementptr inbounds i8, ptr %0, i64 464
  %71 = load i64, ptr %70, align 8, !tbaa !22
  %72 = add i64 %71, 1
  %73 = tail call ptr @png_malloc(ptr noundef nonnull %0, i64 noundef %72) #2
  store ptr %73, ptr %59, align 8, !tbaa !26
  store i8 3, ptr %73, align 1, !tbaa !23
  %.pr.pre = load i8, ptr %25, align 1, !tbaa !19
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %69, %58, %66, %55
  %74 = phi i8 [ %68, %66 ], [ %56, %55 ], [ %56, %58 ], [ %.pr.pre, %69 ]
  %.not53 = icmp sgt i8 %74, -1
  br i1 %.not53, label %thread-pre-split54, label %75

75:                                               ; preds = %thread-pre-split
  %76 = getelementptr inbounds i8, ptr %0, i64 528
  %77 = load ptr, ptr %76, align 8, !tbaa !27
  %78 = icmp eq ptr %77, null
  br i1 %78, label %79, label %thread-pre-split54.thread

79:                                               ; preds = %75
  %80 = getelementptr inbounds i8, ptr %0, i64 488
  %81 = load ptr, ptr %80, align 8, !tbaa !25
  %82 = icmp eq ptr %81, null
  br i1 %82, label %83, label %86

83:                                               ; preds = %79
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.12) #2
  %84 = load i8, ptr %25, align 1, !tbaa !19
  %85 = and i8 %84, 127
  store i8 %85, ptr %25, align 1, !tbaa !19
  br label %thread-pre-split54

86:                                               ; preds = %79
  %87 = getelementptr inbounds i8, ptr %0, i64 464
  %88 = load i64, ptr %87, align 8, !tbaa !22
  %89 = add i64 %88, 1
  %90 = tail call ptr @png_malloc(ptr noundef nonnull %0, i64 noundef %89) #2
  store ptr %90, ptr %76, align 8, !tbaa !27
  store i8 4, ptr %90, align 1, !tbaa !23
  %.pr55.pre = load i8, ptr %25, align 1, !tbaa !19
  br label %thread-pre-split54

thread-pre-split54:                               ; preds = %86, %thread-pre-split, %83
  %91 = phi i8 [ %85, %83 ], [ %74, %thread-pre-split ], [ %.pr55.pre, %86 ]
  %92 = icmp eq i8 %91, 0
  br i1 %92, label %93, label %thread-pre-split54.thread

93:                                               ; preds = %thread-pre-split54
  store i8 8, ptr %25, align 1, !tbaa !19
  br label %thread-pre-split54.thread

94:                                               ; preds = %5
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.13) #2
  br label %thread-pre-split54.thread

thread-pre-split54.thread:                        ; preds = %75, %20, %93, %thread-pre-split54, %3, %94
  ret void
}

declare ptr @png_malloc(ptr noundef, i64 noundef) local_unnamed_addr #0

attributes #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 1032}
!6 = !{!"png_struct_def", !7, i64 0, !9, i64 200, !9, i64 208, !9, i64 216, !9, i64 224, !9, i64 232, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !9, i64 272, !7, i64 280, !7, i64 281, !10, i64 284, !10, i64 288, !10, i64 292, !11, i64 296, !9, i64 408, !12, i64 416, !10, i64 424, !10, i64 428, !10, i64 432, !10, i64 436, !10, i64 440, !10, i64 444, !10, i64 448, !10, i64 452, !10, i64 456, !12, i64 464, !12, i64 472, !10, i64 480, !10, i64 484, !9, i64 488, !9, i64 496, !9, i64 504, !9, i64 512, !9, i64 520, !9, i64 528, !13, i64 536, !10, i64 560, !10, i64 564, !9, i64 568, !14, i64 576, !14, i64 578, !7, i64 580, !7, i64 585, !7, i64 586, !7, i64 587, !7, i64 588, !7, i64 589, !7, i64 590, !7, i64 591, !7, i64 592, !7, i64 593, !7, i64 594, !7, i64 595, !7, i64 596, !14, i64 598, !7, i64 600, !15, i64 604, !16, i64 608, !16, i64 618, !9, i64 632, !10, i64 640, !10, i64 644, !10, i64 648, !15, i64 652, !15, i64 656, !9, i64 664, !9, i64 672, !9, i64 680, !9, i64 688, !9, i64 696, !9, i64 704, !17, i64 712, !17, i64 717, !9, i64 728, !16, i64 736, !9, i64 752, !9, i64 760, !9, i64 768, !9, i64 776, !9, i64 784, !9, i64 792, !9, i64 800, !9, i64 808, !9, i64 816, !10, i64 824, !10, i64 828, !12, i64 832, !12, i64 840, !12, i64 848, !12, i64 856, !10, i64 864, !10, i64 868, !12, i64 872, !12, i64 880, !9, i64 888, !9, i64 896, !9, i64 904, !9, i64 912, !9, i64 920, !7, i64 928, !7, i64 929, !9, i64 936, !9, i64 944, !9, i64 952, !9, i64 960, !9, i64 968, !9, i64 976, !10, i64 984, !9, i64 992, !9, i64 1000, !10, i64 1008, !9, i64 1016, !7, i64 1024, !14, i64 1026, !14, i64 1028, !14, i64 1030, !10, i64 1032, !10, i64 1036, !7, i64 1040, !9, i64 1048, !9, i64 1056, !9, i64 1064, !9, i64 1072, !9, i64 1080, !9, i64 1088, !9, i64 1096, !7, i64 1104, !10, i64 1108, !10, i64 1112, !10, i64 1116, !18, i64 1120, !10, i64 1152, !10, i64 1156, !9, i64 1160, !10, i64 1168}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!"z_stream_s", !9, i64 0, !10, i64 8, !12, i64 16, !9, i64 24, !10, i64 32, !12, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !10, i64 88, !12, i64 96, !12, i64 104}
!12 = !{!"long", !7, i64 0}
!13 = !{!"png_row_info_struct", !10, i64 0, !12, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!14 = !{!"short", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!"png_color_16_struct", !7, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!17 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!18 = !{!"png_unknown_chunk_t", !7, i64 0, !9, i64 8, !12, i64 16, !7, i64 24}
!19 = !{!6, !7, i64 589}
!20 = !{!6, !9, i64 496}
!21 = !{!6, !9, i64 504}
!22 = !{!6, !12, i64 464}
!23 = !{!7, !7, i64 0}
!24 = !{!6, !9, i64 512}
!25 = !{!6, !9, i64 488}
!26 = !{!6, !9, i64 520}
!27 = !{!6, !9, i64 528}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass