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

@.str.113 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.114 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.115 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.116 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.117 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.118 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.119 = external hidden unnamed_addr constant [40 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

; Function Attrs: nounwind uwtable
declare dso_local void @png_decompress_chunk(ptr noundef, i32 noundef, i64 noundef, i64 noundef, ptr 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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_zTXt(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 ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = 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) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.png_struct_def, ptr %15, i32 0, i32 132
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %40

19:                                               ; preds = %3
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.png_struct_def, ptr %20, i32 0, i32 132
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %24, label %28

24:                                               ; preds = %19
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = load i32, ptr %6, align 4, !tbaa !9
  %27 = call i32 @png_crc_finish(ptr noundef %25, i32 noundef %26)
  store i32 1, ptr %14, align 4
  br label %208

28:                                               ; preds = %19
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.png_struct_def, ptr %29, i32 0, i32 132
  %31 = load i32, ptr %30, align 4, !tbaa !11
  %32 = add i32 %31, -1
  store i32 %32, ptr %30, align 4, !tbaa !11
  %33 = icmp eq i32 %32, 1
  br i1 %33, label %34, label %39

34:                                               ; preds = %28
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %35, ptr noundef @.str.113)
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = call i32 @png_crc_finish(ptr noundef %36, i32 noundef %37)
  store i32 1, ptr %14, align 4
  br label %208

39:                                               ; preds = %28
  br label %40

40:                                               ; preds = %39, %3
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.png_struct_def, ptr %41, i32 0, i32 13
  %43 = load i32, ptr %42, align 4, !tbaa !21
  %44 = and i32 %43, 1
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %48, label %46

46:                                               ; preds = %40
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %47, ptr noundef @.str.114)
  br label %48

48:                                               ; preds = %46, %40
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.png_struct_def, ptr %49, i32 0, i32 13
  %51 = load i32, ptr %50, align 4, !tbaa !21
  %52 = and i32 %51, 4
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %59

54:                                               ; preds = %48
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.png_struct_def, ptr %55, i32 0, i32 13
  %57 = load i32, ptr %56, align 4, !tbaa !21
  %58 = or i32 %57, 8
  store i32 %58, ptr %56, align 4, !tbaa !21
  br label %59

59:                                               ; preds = %54, %48
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.png_struct_def, ptr %61, i32 0, i32 136
  %63 = load ptr, ptr %62, align 8, !tbaa !22
  call void @png_free(ptr noundef %60, ptr noundef %63)
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = add i32 %65, 1
  %67 = zext i32 %66 to i64
  %68 = call ptr @png_malloc_warn(ptr noundef %64, i64 noundef %67)
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.png_struct_def, ptr %69, i32 0, i32 136
  store ptr %68, ptr %70, align 8, !tbaa !22
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.png_struct_def, ptr %71, i32 0, i32 136
  %73 = load ptr, ptr %72, align 8, !tbaa !22
  %74 = icmp eq ptr %73, null
  br i1 %74, label %75, label %77

75:                                               ; preds = %59
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %76, ptr noundef @.str.115)
  store i32 1, ptr %14, align 4
  br label %208

77:                                               ; preds = %59
  %78 = load i32, ptr %6, align 4, !tbaa !9
  %79 = zext i32 %78 to i64
  store i64 %79, ptr %11, align 8, !tbaa !23
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.png_struct_def, ptr %81, i32 0, i32 136
  %83 = load ptr, ptr %82, align 8, !tbaa !22
  %84 = load i64, ptr %11, align 8, !tbaa !23
  call void @png_crc_read(ptr noundef %80, ptr noundef %83, i64 noundef %84)
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = call i32 @png_crc_finish(ptr noundef %85, i32 noundef 0)
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %95

88:                                               ; preds = %77
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.png_struct_def, ptr %90, i32 0, i32 136
  %92 = load ptr, ptr %91, align 8, !tbaa !22
  call void @png_free(ptr noundef %89, ptr noundef %92)
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.png_struct_def, ptr %93, i32 0, i32 136
  store ptr null, ptr %94, align 8, !tbaa !22
  store i32 1, ptr %14, align 4
  br label %208

95:                                               ; preds = %77
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.png_struct_def, ptr %96, i32 0, i32 136
  %98 = load ptr, ptr %97, align 8, !tbaa !22
  %99 = load i64, ptr %11, align 8, !tbaa !23
  %100 = getelementptr inbounds i8, ptr %98, i64 %99
  store i8 0, ptr %100, align 1, !tbaa !24
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.png_struct_def, ptr %101, i32 0, i32 136
  %103 = load ptr, ptr %102, align 8, !tbaa !22
  store ptr %103, ptr %8, align 8, !tbaa !5
  br label %104

104:                                              ; preds = %109, %95
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = load i8, ptr %105, align 1, !tbaa !24
  %107 = icmp ne i8 %106, 0
  br i1 %107, label %108, label %112

108:                                              ; preds = %104
  br label %109

109:                                              ; preds = %108
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = getelementptr inbounds i8, ptr %110, i32 1
  store ptr %111, ptr %8, align 8, !tbaa !5
  br label %104, !llvm.loop !25

112:                                              ; preds = %104
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.png_struct_def, ptr %114, i32 0, i32 136
  %116 = load ptr, ptr %115, align 8, !tbaa !22
  %117 = load i64, ptr %11, align 8, !tbaa !23
  %118 = getelementptr inbounds i8, ptr %116, i64 %117
  %119 = getelementptr inbounds i8, ptr %118, i64 -2
  %120 = icmp uge ptr %113, %119
  br i1 %120, label %121, label %129

121:                                              ; preds = %112
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %122, ptr noundef @.str.116)
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.png_struct_def, ptr %124, i32 0, i32 136
  %126 = load ptr, ptr %125, align 8, !tbaa !22
  call void @png_free(ptr noundef %123, ptr noundef %126)
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.png_struct_def, ptr %127, i32 0, i32 136
  store ptr null, ptr %128, align 8, !tbaa !22
  store i32 1, ptr %14, align 4
  br label %208

129:                                              ; preds = %112
  %130 = load ptr, ptr %8, align 8, !tbaa !5
  %131 = getelementptr inbounds i8, ptr %130, i32 1
  store ptr %131, ptr %8, align 8, !tbaa !5
  %132 = load i8, ptr %131, align 1, !tbaa !24
  %133 = sext i8 %132 to i32
  store i32 %133, ptr %9, align 4, !tbaa !9
  %134 = load i32, ptr %9, align 4, !tbaa !9
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %138

136:                                              ; preds = %129
  %137 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %137, ptr noundef @.str.117)
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %138

138:                                              ; preds = %136, %129
  %139 = load ptr, ptr %8, align 8, !tbaa !5
  %140 = getelementptr inbounds i8, ptr %139, i32 1
  store ptr %140, ptr %8, align 8, !tbaa !5
  br label %141

141:                                              ; preds = %138
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.png_struct_def, ptr %143, i32 0, i32 136
  %145 = load ptr, ptr %144, align 8, !tbaa !22
  %146 = ptrtoint ptr %142 to i64
  %147 = ptrtoint ptr %145 to i64
  %148 = sub i64 %146, %147
  store i64 %148, ptr %12, align 8, !tbaa !23
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = load i32, ptr %9, align 4, !tbaa !9
  %151 = load i32, ptr %6, align 4, !tbaa !9
  %152 = zext i32 %151 to i64
  %153 = load i64, ptr %12, align 8, !tbaa !23
  call void @png_decompress_chunk(ptr noundef %149, i32 noundef %150, i64 noundef %152, i64 noundef %153, ptr noundef %13)
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = call ptr @png_malloc_warn(ptr noundef %154, i64 noundef 56)
  store ptr %155, ptr %7, align 8, !tbaa !5
  %156 = load ptr, ptr %7, align 8, !tbaa !5
  %157 = icmp eq ptr %156, null
  br i1 %157, label %158, label %166

158:                                              ; preds = %141
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %159, ptr noundef @.str.118)
  %160 = load ptr, ptr %4, align 8, !tbaa !5
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.png_struct_def, ptr %161, i32 0, i32 136
  %163 = load ptr, ptr %162, align 8, !tbaa !22
  call void @png_free(ptr noundef %160, ptr noundef %163)
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.png_struct_def, ptr %164, i32 0, i32 136
  store ptr null, ptr %165, align 8, !tbaa !22
  store i32 1, ptr %14, align 4
  br label %208

166:                                              ; preds = %141
  %167 = load i32, ptr %9, align 4, !tbaa !9
  %168 = load ptr, ptr %7, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.png_text_struct, ptr %168, i32 0, i32 0
  store i32 %167, ptr %169, align 8, !tbaa !27
  %170 = load ptr, ptr %4, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.png_struct_def, ptr %170, i32 0, i32 136
  %172 = load ptr, ptr %171, align 8, !tbaa !22
  %173 = load ptr, ptr %7, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.png_text_struct, ptr %173, i32 0, i32 1
  store ptr %172, ptr %174, align 8, !tbaa !29
  %175 = load ptr, ptr %7, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.png_text_struct, ptr %175, i32 0, i32 5
  store ptr null, ptr %176, align 8, !tbaa !30
  %177 = load ptr, ptr %7, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.png_text_struct, ptr %177, i32 0, i32 6
  store ptr null, ptr %178, align 8, !tbaa !31
  %179 = load ptr, ptr %7, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.png_text_struct, ptr %179, i32 0, i32 4
  store i64 0, ptr %180, align 8, !tbaa !32
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.png_struct_def, ptr %181, i32 0, i32 136
  %183 = load ptr, ptr %182, align 8, !tbaa !22
  %184 = load i64, ptr %12, align 8, !tbaa !23
  %185 = getelementptr inbounds i8, ptr %183, i64 %184
  %186 = load ptr, ptr %7, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.png_text_struct, ptr %186, i32 0, i32 2
  store ptr %185, ptr %187, align 8, !tbaa !33
  %188 = load i64, ptr %13, align 8, !tbaa !23
  %189 = load ptr, ptr %7, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.png_text_struct, ptr %189, i32 0, i32 3
  store i64 %188, ptr %190, align 8, !tbaa !34
  %191 = load ptr, ptr %4, align 8, !tbaa !5
  %192 = load ptr, ptr %5, align 8, !tbaa !5
  %193 = load ptr, ptr %7, align 8, !tbaa !5
  %194 = call i32 @png_set_text_2(ptr noundef %191, ptr noundef %192, ptr noundef %193, i32 noundef 1)
  store i32 %194, ptr %10, align 4, !tbaa !9
  %195 = load ptr, ptr %4, align 8, !tbaa !5
  %196 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %195, ptr noundef %196)
  %197 = load ptr, ptr %4, align 8, !tbaa !5
  %198 = load ptr, ptr %4, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.png_struct_def, ptr %198, i32 0, i32 136
  %200 = load ptr, ptr %199, align 8, !tbaa !22
  call void @png_free(ptr noundef %197, ptr noundef %200)
  %201 = load ptr, ptr %4, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.png_struct_def, ptr %201, i32 0, i32 136
  store ptr null, ptr %202, align 8, !tbaa !22
  %203 = load i32, ptr %10, align 4, !tbaa !9
  %204 = icmp ne i32 %203, 0
  br i1 %204, label %205, label %207

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

207:                                              ; preds = %205, %166
  store i32 0, ptr %14, align 4
  br label %208

208:                                              ; preds = %207, %158, %121, %88, %75, %34, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %209 = load i32, ptr %14, align 4
  switch i32 %209, label %211 [
    i32 0, label %210
    i32 1, label %210
  ]

210:                                              ; preds = %208, %208
  ret void

211:                                              ; preds = %208
  unreachable
}

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 }

!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 1116}
!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, !10, i64 284}
!22 = !{!12, !6, i64 1160}
!23 = !{!14, !14, i64 0}
!24 = !{!7, !7, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!28, !10, i64 0}
!28 = !{!"png_text_struct", !10, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !14, i64 32, !6, i64 40, !6, i64 48}
!29 = !{!28, !6, i64 8}
!30 = !{!28, !6, i64 40}
!31 = !{!28, !6, i64 48}
!32 = !{!28, !14, i64 32}
!33 = !{!28, !6, i64 16}
!34 = !{!28, !14, i64 24}


; 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.113 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.114 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.115 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.116 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.117 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.118 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.119 = external hidden unnamed_addr constant [40 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

; Function Attrs: nounwind uwtable
declare dso_local void @png_decompress_chunk(ptr noundef, i32 noundef, i64 noundef, i64 noundef, ptr 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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_zTXt(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 1116
  %6 = load i32, ptr %5, align 4, !tbaa !5
  switch i32 %6, label %9 [
    i32 0, label %14
    i32 1, label %7
  ]

7:                                                ; preds = %3
  %8 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  br label %72

9:                                                ; preds = %3
  %10 = add i32 %6, -1
  store i32 %10, ptr %5, align 4, !tbaa !5
  %11 = icmp eq i32 %10, 1
  br i1 %11, label %12, label %14

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

14:                                               ; preds = %3, %9
  %15 = getelementptr inbounds i8, ptr %0, i64 284
  %16 = load i32, ptr %15, align 4, !tbaa !19
  %17 = and i32 %16, 1
  %.not80 = icmp eq i32 %17, 0
  br i1 %.not80, label %18, label %19

18:                                               ; preds = %14
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.114) #4
  %.pre = load i32, ptr %15, align 4, !tbaa !19
  br label %19

19:                                               ; preds = %18, %14
  %20 = phi i32 [ %.pre, %18 ], [ %16, %14 ]
  %21 = and i32 %20, 4
  %.not81 = icmp eq i32 %21, 0
  br i1 %.not81, label %24, label %22

22:                                               ; preds = %19
  %23 = or i32 %20, 8
  store i32 %23, ptr %15, align 4, !tbaa !19
  br label %24

24:                                               ; preds = %22, %19
  %25 = getelementptr inbounds i8, ptr %0, i64 1160
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %26) #4
  %27 = add i32 %2, 1
  %28 = zext i32 %27 to i64
  %29 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %28) #4
  store ptr %29, ptr %25, align 8, !tbaa !20
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %24
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.115) #4
  br label %72

32:                                               ; preds = %24
  %33 = zext i32 %2 to i64
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef nonnull %29, i64 noundef %33)
  %34 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef 0)
  %.not82 = icmp eq i32 %34, 0
  %35 = load ptr, ptr %25, align 8, !tbaa !20
  br i1 %.not82, label %37, label %36

36:                                               ; preds = %32
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %35) #4
  store ptr null, ptr %25, align 8, !tbaa !20
  br label %72

37:                                               ; preds = %32
  %38 = getelementptr inbounds i8, ptr %35, i64 %33
  store i8 0, ptr %38, align 1, !tbaa !21
  %39 = load ptr, ptr %25, align 8, !tbaa !20
  br label %40

40:                                               ; preds = %40, %37
  %.0 = phi ptr [ %39, %37 ], [ %42, %40 ]
  %41 = load i8, ptr %.0, align 1, !tbaa !21
  %.not83 = icmp eq i8 %41, 0
  %42 = getelementptr inbounds i8, ptr %.0, i64 1
  br i1 %.not83, label %43, label %40, !llvm.loop !22

43:                                               ; preds = %40
  %44 = getelementptr inbounds i8, ptr %39, i64 %33
  %45 = getelementptr inbounds i8, ptr %44, i64 -2
  %.not84 = icmp ult ptr %.0, %45
  br i1 %.not84, label %48, label %46

46:                                               ; preds = %43
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.116) #4
  %47 = load ptr, ptr %25, align 8, !tbaa !20
  tail call void @png_free(ptr noundef %0, ptr noundef %47) #4
  store ptr null, ptr %25, align 8, !tbaa !20
  br label %72

48:                                               ; preds = %43
  %49 = load i8, ptr %42, align 1, !tbaa !21
  %.not85 = icmp eq i8 %49, 0
  br i1 %.not85, label %51, label %50

50:                                               ; preds = %48
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.117) #4
  %.pre87 = load ptr, ptr %25, align 8, !tbaa !20
  br label %51

51:                                               ; preds = %50, %48
  %52 = phi ptr [ %.pre87, %50 ], [ %39, %48 ]
  %53 = getelementptr inbounds i8, ptr %.0, i64 2
  %54 = ptrtoint ptr %53 to i64
  %55 = ptrtoint ptr %52 to i64
  %56 = sub i64 %54, %55
  call void @png_decompress_chunk(ptr noundef %0, i32 noundef 0, i64 noundef %33, i64 noundef %56, ptr noundef nonnull %4)
  %57 = call ptr @png_malloc_warn(ptr noundef %0, i64 noundef 56) #4
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %61

59:                                               ; preds = %51
  call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.118) #4
  %60 = load ptr, ptr %25, align 8, !tbaa !20
  call void @png_free(ptr noundef nonnull %0, ptr noundef %60) #4
  store ptr null, ptr %25, align 8, !tbaa !20
  br label %72

61:                                               ; preds = %51
  store i32 0, ptr %57, align 8, !tbaa !24
  %62 = load ptr, ptr %25, align 8, !tbaa !20
  %63 = getelementptr inbounds i8, ptr %57, i64 8
  store ptr %62, ptr %63, align 8, !tbaa !26
  %64 = getelementptr inbounds i8, ptr %57, i64 32
  %65 = getelementptr inbounds i8, ptr %62, i64 %56
  %66 = getelementptr inbounds i8, ptr %57, i64 16
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %64, i8 0, i64 24, i1 false)
  store ptr %65, ptr %66, align 8, !tbaa !27
  %67 = load i64, ptr %4, align 8, !tbaa !28
  %68 = getelementptr inbounds i8, ptr %57, i64 24
  store i64 %67, ptr %68, align 8, !tbaa !29
  %69 = call i32 @png_set_text_2(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %57, i32 noundef 1) #4
  call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %57) #4
  %70 = load ptr, ptr %25, align 8, !tbaa !20
  call void @png_free(ptr noundef nonnull %0, ptr noundef %70) #4
  store ptr null, ptr %25, align 8, !tbaa !20
  %.not86 = icmp eq i32 %69, 0
  br i1 %.not86, label %72, label %71

71:                                               ; preds = %61
  call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.119) #4
  br label %72

72:                                               ; preds = %61, %71, %59, %46, %36, %31, %12, %7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 1116}
!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, !10, i64 284}
!20 = !{!6, !9, i64 1160}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!25, !10, i64 0}
!25 = !{!"png_text_struct", !10, i64 0, !9, i64 8, !9, i64 16, !12, i64 24, !12, i64 32, !9, i64 40, !9, i64 48}
!26 = !{!25, !9, i64 8}
!27 = !{!25, !9, i64 16}
!28 = !{!12, !12, i64 0}
!29 = !{!25, !12, i64 24}


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