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

; 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 }
%struct.png_info_struct = type { i32, i32, i32, i64, ptr, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, [8 x i8], float, i8, i32, i32, ptr, %struct.png_time_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, %struct.png_color_16_struct, i32, i32, i8, i32, i32, i8, ptr, float, float, float, float, float, float, float, float, ptr, i32, i32, ptr, ptr, i8, i8, i32, ptr, i64, ptr, ptr, i32, i8, ptr, i32, i8, double, double, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.png_time_struct = type { i16, i8, i8, i8, i8, i8 }

@.str.97 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.98 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.99 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.100 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.101 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.102 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.103 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.104 = external hidden unnamed_addr constant [18 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 void @png_error(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 uwtable
declare dso_local void @png_crc_read(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @png_crc_finish(ptr noundef, i32 noundef) #2

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_sCAL(ptr noundef %0, ptr noundef %1, i32 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.png_struct_def, ptr %13, i32 0, i32 13
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = and i32 %15, 1
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %20, label %18

18:                                               ; preds = %3
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %19, ptr noundef @.str.97)
  br label %47

20:                                               ; preds = %3
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.png_struct_def, ptr %21, i32 0, i32 13
  %23 = load i32, ptr %22, align 4, !tbaa !11
  %24 = and i32 %23, 4
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %31

26:                                               ; preds = %20
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %27, ptr noundef @.str.98)
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = call i32 @png_crc_finish(ptr noundef %28, i32 noundef %29)
  store i32 1, ptr %12, align 4
  br label %188

31:                                               ; preds = %20
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %45

34:                                               ; preds = %31
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.png_info_struct, ptr %35, i32 0, i32 2
  %37 = load i32, ptr %36, align 8, !tbaa !21
  %38 = and i32 %37, 16384
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %45

40:                                               ; preds = %34
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %41, ptr noundef @.str.99)
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = load i32, ptr %6, align 4, !tbaa !9
  %44 = call i32 @png_crc_finish(ptr noundef %42, i32 noundef %43)
  store i32 1, ptr %12, align 4
  br label %188

45:                                               ; preds = %34, %31
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46, %18
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = load i32, ptr %6, align 4, !tbaa !9
  %50 = add i32 %49, 1
  %51 = zext i32 %50 to i64
  %52 = call ptr @png_malloc_warn(ptr noundef %48, i64 noundef %51)
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.png_struct_def, ptr %53, i32 0, i32 136
  store ptr %52, ptr %54, align 8, !tbaa !25
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.png_struct_def, ptr %55, i32 0, i32 136
  %57 = load ptr, ptr %56, align 8, !tbaa !25
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %64

59:                                               ; preds = %47
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %60, ptr noundef @.str.100)
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = call i32 @png_crc_finish(ptr noundef %61, i32 noundef %62)
  store i32 1, ptr %12, align 4
  br label %188

64:                                               ; preds = %47
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  store i64 %66, ptr %11, align 8, !tbaa !26
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.png_struct_def, ptr %68, i32 0, i32 136
  %70 = load ptr, ptr %69, align 8, !tbaa !25
  %71 = load i64, ptr %11, align 8, !tbaa !26
  call void @png_crc_read(ptr noundef %67, ptr noundef %70, i64 noundef %71)
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = call i32 @png_crc_finish(ptr noundef %72, i32 noundef 0)
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %82

75:                                               ; preds = %64
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.png_struct_def, ptr %77, i32 0, i32 136
  %79 = load ptr, ptr %78, align 8, !tbaa !25
  call void @png_free(ptr noundef %76, ptr noundef %79)
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.png_struct_def, ptr %80, i32 0, i32 136
  store ptr null, ptr %81, align 8, !tbaa !25
  store i32 1, ptr %12, align 4
  br label %188

82:                                               ; preds = %64
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.png_struct_def, ptr %83, i32 0, i32 136
  %85 = load ptr, ptr %84, align 8, !tbaa !25
  %86 = load i64, ptr %11, align 8, !tbaa !26
  %87 = getelementptr inbounds i8, ptr %85, i64 %86
  store i8 0, ptr %87, align 1, !tbaa !27
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.png_struct_def, ptr %88, i32 0, i32 136
  %90 = load ptr, ptr %89, align 8, !tbaa !25
  %91 = getelementptr inbounds i8, ptr %90, i64 1
  store ptr %91, ptr %7, align 8, !tbaa !5
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = call double @strtod(ptr noundef %92, ptr noundef %10) #4
  store double %93, ptr %8, align 8, !tbaa !28
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = load i8, ptr %94, align 1, !tbaa !27
  %96 = icmp ne i8 %95, 0
  br i1 %96, label %97, label %105

97:                                               ; preds = %82
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %98, ptr noundef @.str.101)
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.png_struct_def, ptr %100, i32 0, i32 136
  %102 = load ptr, ptr %101, align 8, !tbaa !25
  call void @png_free(ptr noundef %99, ptr noundef %102)
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.png_struct_def, ptr %103, i32 0, i32 136
  store ptr null, ptr %104, align 8, !tbaa !25
  store i32 1, ptr %12, align 4
  br label %188

105:                                              ; preds = %82
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.png_struct_def, ptr %106, i32 0, i32 136
  %108 = load ptr, ptr %107, align 8, !tbaa !25
  store ptr %108, ptr %7, align 8, !tbaa !5
  br label %109

109:                                              ; preds = %114, %105
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  %111 = load i8, ptr %110, align 1, !tbaa !27
  %112 = icmp ne i8 %111, 0
  br i1 %112, label %113, label %117

113:                                              ; preds = %109
  br label %114

114:                                              ; preds = %113
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = getelementptr inbounds i8, ptr %115, i32 1
  store ptr %116, ptr %7, align 8, !tbaa !5
  br label %109, !llvm.loop !29

117:                                              ; preds = %109
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = getelementptr inbounds i8, ptr %118, i32 1
  store ptr %119, ptr %7, align 8, !tbaa !5
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.png_struct_def, ptr %120, i32 0, i32 136
  %122 = load ptr, ptr %121, align 8, !tbaa !25
  %123 = load i64, ptr %11, align 8, !tbaa !26
  %124 = getelementptr inbounds i8, ptr %122, i64 %123
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = icmp ult ptr %124, %125
  br i1 %126, label %127, label %135

127:                                              ; preds = %117
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %128, ptr noundef @.str.102)
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.png_struct_def, ptr %130, i32 0, i32 136
  %132 = load ptr, ptr %131, align 8, !tbaa !25
  call void @png_free(ptr noundef %129, ptr noundef %132)
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.png_struct_def, ptr %133, i32 0, i32 136
  store ptr null, ptr %134, align 8, !tbaa !25
  store i32 1, ptr %12, align 4
  br label %188

135:                                              ; preds = %117
  %136 = load ptr, ptr %7, align 8, !tbaa !5
  %137 = call double @strtod(ptr noundef %136, ptr noundef %10) #4
  store double %137, ptr %9, align 8, !tbaa !28
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = load i8, ptr %138, align 1, !tbaa !27
  %140 = icmp ne i8 %139, 0
  br i1 %140, label %141, label %149

141:                                              ; preds = %135
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %142, ptr noundef @.str.103)
  %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 136
  %146 = load ptr, ptr %145, align 8, !tbaa !25
  call void @png_free(ptr noundef %143, ptr noundef %146)
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.png_struct_def, ptr %147, i32 0, i32 136
  store ptr null, ptr %148, align 8, !tbaa !25
  store i32 1, ptr %12, align 4
  br label %188

149:                                              ; preds = %135
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.png_struct_def, ptr %150, i32 0, i32 136
  %152 = load ptr, ptr %151, align 8, !tbaa !25
  %153 = load i64, ptr %11, align 8, !tbaa !26
  %154 = getelementptr inbounds i8, ptr %152, i64 %153
  %155 = load ptr, ptr %7, align 8, !tbaa !5
  %156 = icmp ult ptr %154, %155
  br i1 %156, label %163, label %157

157:                                              ; preds = %149
  %158 = load double, ptr %8, align 8, !tbaa !28
  %159 = fcmp ole double %158, 0.000000e+00
  br i1 %159, label %163, label %160

160:                                              ; preds = %157
  %161 = load double, ptr %9, align 8, !tbaa !28
  %162 = fcmp ole double %161, 0.000000e+00
  br i1 %162, label %163, label %171

163:                                              ; preds = %160, %157, %149
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %164, ptr noundef @.str.104)
  %165 = load ptr, ptr %4, align 8, !tbaa !5
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.png_struct_def, ptr %166, i32 0, i32 136
  %168 = load ptr, ptr %167, align 8, !tbaa !25
  call void @png_free(ptr noundef %165, ptr noundef %168)
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.png_struct_def, ptr %169, i32 0, i32 136
  store ptr null, ptr %170, align 8, !tbaa !25
  store i32 1, ptr %12, align 4
  br label %188

171:                                              ; preds = %160
  %172 = load ptr, ptr %4, align 8, !tbaa !5
  %173 = load ptr, ptr %5, align 8, !tbaa !5
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.png_struct_def, ptr %174, i32 0, i32 136
  %176 = load ptr, ptr %175, align 8, !tbaa !25
  %177 = getelementptr inbounds i8, ptr %176, i64 0
  %178 = load i8, ptr %177, align 1, !tbaa !27
  %179 = sext i8 %178 to i32
  %180 = load double, ptr %8, align 8, !tbaa !28
  %181 = load double, ptr %9, align 8, !tbaa !28
  call void @png_set_sCAL(ptr noundef %172, ptr noundef %173, i32 noundef %179, double noundef %180, double noundef %181)
  %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 136
  %185 = load ptr, ptr %184, align 8, !tbaa !25
  call void @png_free(ptr noundef %182, ptr noundef %185)
  %186 = load ptr, ptr %4, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.png_struct_def, ptr %186, i32 0, i32 136
  store ptr null, ptr %187, align 8, !tbaa !25
  store i32 0, ptr %12, align 4
  br label %188

188:                                              ; preds = %171, %163, %141, %127, %97, %75, %59, %40, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %189 = load i32, ptr %12, align 4
  switch i32 %189, label %191 [
    i32 0, label %190
    i32 1, label %190
  ]

190:                                              ; preds = %188, %188
  ret void

191:                                              ; preds = %188
  unreachable
}

; Function Attrs: nounwind
declare double @strtod(ptr noundef, ptr noundef) #3

declare void @png_set_sCAL(ptr noundef, ptr noundef, i32 noundef, double noundef, double 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 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 = { 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 284}
!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 = !{!22, !10, i64 8}
!22 = !{!"png_info_struct", !10, i64 0, !10, i64 4, !10, i64 8, !14, i64 16, !6, i64 24, !16, i64 32, !16, i64 34, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !17, i64 52, !7, i64 56, !10, i64 60, !10, i64 64, !6, i64 72, !23, i64 80, !19, i64 88, !6, i64 96, !18, i64 104, !18, i64 114, !10, i64 124, !10, i64 128, !7, i64 132, !10, i64 136, !10, i64 140, !7, i64 144, !6, i64 152, !17, i64 160, !17, i64 164, !17, i64 168, !17, i64 172, !17, i64 176, !17, i64 180, !17, i64 184, !17, i64 188, !6, i64 192, !10, i64 200, !10, i64 204, !6, i64 208, !6, i64 216, !7, i64 224, !7, i64 225, !10, i64 228, !6, i64 232, !14, i64 240, !6, i64 248, !6, i64 256, !10, i64 264, !7, i64 268, !6, i64 272, !10, i64 280, !7, i64 284, !24, i64 288, !24, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !10, i64 328, !10, i64 332, !10, i64 336, !10, i64 340, !10, i64 344, !10, i64 348, !10, i64 352, !10, i64 356, !10, i64 360}
!23 = !{!"png_time_struct", !16, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!24 = !{!"double", !7, i64 0}
!25 = !{!12, !6, i64 1160}
!26 = !{!14, !14, i64 0}
!27 = !{!7, !7, i64 0}
!28 = !{!24, !24, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"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.97 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.98 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.99 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.100 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.101 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.102 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.103 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.104 = external hidden unnamed_addr constant [18 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

declare void @png_error(ptr noundef, ptr 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
declare dso_local void @png_crc_read(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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

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

declare ptr @png_malloc_warn(ptr noundef, i64 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_sCAL(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 284
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = and i32 %6, 1
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %9

8:                                                ; preds = %3
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.97) #4
  br label %20

9:                                                ; preds = %3
  %10 = and i32 %6, 4
  %.not74 = icmp eq i32 %10, 0
  br i1 %.not74, label %13, label %11

11:                                               ; preds = %9
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.98) #4
  %12 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  br label %70

13:                                               ; preds = %9
  %.not75 = icmp eq ptr %1, null
  br i1 %.not75, label %20, label %14

14:                                               ; preds = %13
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !19
  %17 = and i32 %16, 16384
  %.not76 = icmp eq i32 %17, 0
  br i1 %.not76, label %20, label %18

18:                                               ; preds = %14
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.99) #4
  %19 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  br label %70

20:                                               ; preds = %14, %13, %8
  %21 = add i32 %2, 1
  %22 = zext i32 %21 to i64
  %23 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %22) #4
  %24 = getelementptr inbounds i8, ptr %0, i64 1160
  store ptr %23, ptr %24, align 8, !tbaa !23
  %25 = icmp eq ptr %23, null
  br i1 %25, label %26, label %28

26:                                               ; preds = %20
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.100) #4
  %27 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  br label %70

28:                                               ; preds = %20
  %29 = zext i32 %2 to i64
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef nonnull %23, i64 noundef %29)
  %30 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef 0)
  %.not77 = icmp eq i32 %30, 0
  %31 = load ptr, ptr %24, align 8, !tbaa !23
  br i1 %.not77, label %33, label %32

32:                                               ; preds = %28
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %31) #4
  store ptr null, ptr %24, align 8, !tbaa !23
  br label %70

33:                                               ; preds = %28
  %34 = getelementptr inbounds i8, ptr %31, i64 %29
  store i8 0, ptr %34, align 1, !tbaa !24
  %35 = load ptr, ptr %24, align 8, !tbaa !23
  %36 = getelementptr inbounds i8, ptr %35, i64 1
  %37 = call double @strtod(ptr noundef nonnull %36, ptr noundef nonnull %4) #4
  %38 = load ptr, ptr %4, align 8, !tbaa !25
  %39 = load i8, ptr %38, align 1, !tbaa !24
  %.not78 = icmp eq i8 %39, 0
  br i1 %.not78, label %42, label %40

40:                                               ; preds = %33
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.101) #4
  %41 = load ptr, ptr %24, align 8, !tbaa !23
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %41) #4
  store ptr null, ptr %24, align 8, !tbaa !23
  br label %70

42:                                               ; preds = %33
  %43 = load ptr, ptr %24, align 8, !tbaa !23
  br label %44

44:                                               ; preds = %44, %42
  %.0 = phi ptr [ %43, %42 ], [ %46, %44 ]
  %45 = load i8, ptr %.0, align 1, !tbaa !24
  %.not79 = icmp eq i8 %45, 0
  %46 = getelementptr inbounds i8, ptr %.0, i64 1
  br i1 %.not79, label %47, label %44, !llvm.loop !26

47:                                               ; preds = %44
  %48 = getelementptr inbounds i8, ptr %43, i64 %29
  %49 = icmp ult ptr %48, %46
  br i1 %49, label %50, label %52

50:                                               ; preds = %47
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.102) #4
  %51 = load ptr, ptr %24, align 8, !tbaa !23
  tail call void @png_free(ptr noundef %0, ptr noundef %51) #4
  store ptr null, ptr %24, align 8, !tbaa !23
  br label %70

52:                                               ; preds = %47
  %53 = call double @strtod(ptr noundef nonnull %46, ptr noundef nonnull %4) #4
  %54 = load ptr, ptr %4, align 8, !tbaa !25
  %55 = load i8, ptr %54, align 1, !tbaa !24
  %.not80 = icmp eq i8 %55, 0
  br i1 %.not80, label %58, label %56

56:                                               ; preds = %52
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.103) #4
  %57 = load ptr, ptr %24, align 8, !tbaa !23
  tail call void @png_free(ptr noundef %0, ptr noundef %57) #4
  store ptr null, ptr %24, align 8, !tbaa !23
  br label %70

58:                                               ; preds = %52
  %59 = load ptr, ptr %24, align 8, !tbaa !23
  %60 = getelementptr inbounds i8, ptr %59, i64 %29
  %61 = icmp ult ptr %60, %46
  %62 = fcmp ole double %37, 0.000000e+00
  %or.cond = select i1 %61, i1 true, i1 %62
  %63 = fcmp ole double %53, 0.000000e+00
  %or.cond3 = select i1 %or.cond, i1 true, i1 %63
  br i1 %or.cond3, label %64, label %66

64:                                               ; preds = %58
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.104) #4
  %65 = load ptr, ptr %24, align 8, !tbaa !23
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %65) #4
  store ptr null, ptr %24, align 8, !tbaa !23
  br label %70

66:                                               ; preds = %58
  %67 = load i8, ptr %59, align 1, !tbaa !24
  %68 = sext i8 %67 to i32
  tail call void @png_set_sCAL(ptr noundef nonnull %0, ptr noundef %1, i32 noundef %68, double noundef %37, double noundef %53) #4
  %69 = load ptr, ptr %24, align 8, !tbaa !23
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %69) #4
  store ptr null, ptr %24, align 8, !tbaa !23
  br label %70

70:                                               ; preds = %66, %64, %56, %50, %40, %32, %26, %18, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn
declare double @strtod(ptr noundef readonly, ptr nocapture noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress 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 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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 284}
!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 = !{!20, !10, i64 8}
!20 = !{!"png_info_struct", !10, i64 0, !10, i64 4, !10, i64 8, !12, i64 16, !9, i64 24, !14, i64 32, !14, i64 34, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !15, i64 52, !7, i64 56, !10, i64 60, !10, i64 64, !9, i64 72, !21, i64 80, !17, i64 88, !9, i64 96, !16, i64 104, !16, i64 114, !10, i64 124, !10, i64 128, !7, i64 132, !10, i64 136, !10, i64 140, !7, i64 144, !9, i64 152, !15, i64 160, !15, i64 164, !15, i64 168, !15, i64 172, !15, i64 176, !15, i64 180, !15, i64 184, !15, i64 188, !9, i64 192, !10, i64 200, !10, i64 204, !9, i64 208, !9, i64 216, !7, i64 224, !7, i64 225, !10, i64 228, !9, i64 232, !12, i64 240, !9, i64 248, !9, i64 256, !10, i64 264, !7, i64 268, !9, i64 272, !10, i64 280, !7, i64 284, !22, i64 288, !22, i64 296, !9, i64 304, !9, i64 312, !9, i64 320, !10, i64 328, !10, i64 332, !10, i64 336, !10, i64 340, !10, i64 344, !10, i64 348, !10, i64 352, !10, i64 356, !10, i64 360}
!21 = !{!"png_time_struct", !14, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!22 = !{!"double", !7, i64 0}
!23 = !{!6, !9, i64 1160}
!24 = !{!7, !7, i64 0}
!25 = !{!9, !9, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass