; LLVM IR from mkazhdan/DMG :: Util/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_sPLT_struct = type { ptr, i8, ptr, i64 }
%struct.png_struct_def = type { [1 x %struct.__jmp_buf_tag], ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i64, i64, i64, %struct.z_stream_s, ptr, i64, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_row_info_struct, i64, i64, 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, i64, i64, 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, i64, i64, i64, i64, i64, i64, i32, i32, i64, i64, ptr, ptr, ptr, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr, ptr, i32, ptr, i8, i16, i16, i16, i64, i64, i8, i8, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i64, i64, %struct.png_unknown_chunk_t, i64, i64 }
%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 { i64, 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_sPLT_entry_struct = type { i16, i16, i16, i16, i16 }

@.str.61 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [36 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 zeroext i16 @png_get_uint_16(ptr noundef) #2

; 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, i64 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 ptr @png_malloc(ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_sPLT(ptr noundef %0, ptr noundef %1, i64 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.png_sPLT_struct, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !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 32, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  store i64 0, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.png_struct_def, ptr %17, i32 0, i32 12
  %19 = load i64, ptr %18, align 8, !tbaa !11
  %20 = and i64 %19, 1
  %21 = icmp ne i64 %20, 0
  br i1 %21, label %24, label %22

22:                                               ; preds = %3
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %23, ptr noundef @.str.61)
  br label %36

24:                                               ; preds = %3
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.png_struct_def, ptr %25, i32 0, i32 12
  %27 = load i64, ptr %26, align 8, !tbaa !11
  %28 = and i64 %27, 4
  %29 = icmp ne i64 %28, 0
  br i1 %29, label %30, label %35

30:                                               ; preds = %24
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %31, ptr noundef @.str.62)
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load i64, ptr %6, align 8, !tbaa !9
  %34 = call i32 @png_crc_finish(ptr noundef %32, i64 noundef %33)
  store i32 1, ptr %15, align 4
  br label %215

35:                                               ; preds = %24
  br label %36

36:                                               ; preds = %35, %22
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = load i64, ptr %6, align 8, !tbaa !9
  %39 = add i64 %38, 1
  %40 = call ptr @png_malloc(ptr noundef %37, i64 noundef %39)
  store ptr %40, ptr %7, align 8, !tbaa !5
  %41 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %41, ptr %14, align 8, !tbaa !9
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = load i64, ptr %14, align 8, !tbaa !9
  call void @png_crc_read(ptr noundef %42, ptr noundef %43, i64 noundef %44)
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = load i64, ptr %13, align 8, !tbaa !9
  %47 = call i32 @png_crc_finish(ptr noundef %45, i64 noundef %46)
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %52

49:                                               ; preds = %36
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %50, ptr noundef %51)
  store i32 1, ptr %15, align 4
  br label %215

52:                                               ; preds = %36
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load i64, ptr %14, align 8, !tbaa !9
  %55 = getelementptr inbounds i8, ptr %53, i64 %54
  store i8 0, ptr %55, align 1, !tbaa !21
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %56, ptr %8, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %62, %52
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = load i8, ptr %58, align 1, !tbaa !21
  %60 = icmp ne i8 %59, 0
  br i1 %60, label %61, label %65

61:                                               ; preds = %57
  br label %62

62:                                               ; preds = %61
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %63, i32 1
  store ptr %64, ptr %8, align 8, !tbaa !5
  br label %57, !llvm.loop !22

65:                                               ; preds = %57
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %66, i32 1
  store ptr %67, ptr %8, align 8, !tbaa !5
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load i64, ptr %14, align 8, !tbaa !9
  %71 = getelementptr inbounds i8, ptr %69, i64 %70
  %72 = getelementptr inbounds i8, ptr %71, i64 -2
  %73 = icmp ugt ptr %68, %72
  br i1 %73, label %74, label %78

74:                                               ; preds = %65
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %75, ptr noundef %76)
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %77, ptr noundef @.str.63)
  store i32 1, ptr %15, align 4
  br label %215

78:                                               ; preds = %65
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i32 1
  store ptr %80, ptr %8, align 8, !tbaa !5
  %81 = load i8, ptr %79, align 1, !tbaa !21
  %82 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 1
  store i8 %81, ptr %82, align 8, !tbaa !24
  %83 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 1
  %84 = load i8, ptr %83, align 8, !tbaa !24
  %85 = zext i8 %84 to i32
  %86 = icmp eq i32 %85, 8
  %87 = zext i1 %86 to i64
  %88 = select i1 %86, i32 6, i32 10
  store i32 %88, ptr %11, align 4, !tbaa !26
  %89 = load i64, ptr %14, align 8, !tbaa !9
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = ptrtoint ptr %90 to i64
  %93 = ptrtoint ptr %91 to i64
  %94 = sub i64 %92, %93
  %95 = sub i64 %89, %94
  %96 = trunc i64 %95 to i32
  store i32 %96, ptr %10, align 4, !tbaa !26
  %97 = load i32, ptr %10, align 4, !tbaa !26
  %98 = load i32, ptr %11, align 4, !tbaa !26
  %99 = srem i32 %97, %98
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %105

101:                                              ; preds = %78
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %102, ptr noundef %103)
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %104, ptr noundef @.str.64)
  store i32 1, ptr %15, align 4
  br label %215

105:                                              ; preds = %78
  %106 = load i32, ptr %10, align 4, !tbaa !26
  %107 = load i32, ptr %11, align 4, !tbaa !26
  %108 = sdiv i32 %106, %107
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 3
  store i64 %109, ptr %110, align 8, !tbaa !27
  %111 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 3
  %112 = load i64, ptr %111, align 8, !tbaa !27
  %113 = icmp ugt i64 %112, 1844674407370955161
  br i1 %113, label %114, label %116

114:                                              ; preds = %105
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %115, ptr noundef @.str.65)
  store i32 1, ptr %15, align 4
  br label %215

116:                                              ; preds = %105
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 3
  %119 = load i64, ptr %118, align 8, !tbaa !27
  %120 = mul i64 %119, 10
  %121 = call ptr @png_malloc_warn(ptr noundef %117, i64 noundef %120)
  %122 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 2
  store ptr %121, ptr %122, align 8, !tbaa !28
  %123 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 2
  %124 = load ptr, ptr %123, align 8, !tbaa !28
  %125 = icmp eq ptr %124, null
  br i1 %125, label %126, label %128

126:                                              ; preds = %116
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %127, ptr noundef @.str.66)
  store i32 1, ptr %15, align 4
  br label %215

128:                                              ; preds = %116
  store i32 0, ptr %12, align 4, !tbaa !26
  br label %129

129:                                              ; preds = %202, %128
  %130 = load i32, ptr %12, align 4, !tbaa !26
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 3
  %133 = load i64, ptr %132, align 8, !tbaa !27
  %134 = icmp slt i64 %131, %133
  br i1 %134, label %135, label %205

135:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %136 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 2
  %137 = load ptr, ptr %136, align 8, !tbaa !28
  %138 = load i32, ptr %12, align 4, !tbaa !26
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %137, i64 %139
  store ptr %140, ptr %16, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 1
  %142 = load i8, ptr %141, align 8, !tbaa !24
  %143 = zext i8 %142 to i32
  %144 = icmp eq i32 %143, 8
  br i1 %144, label %145, label %170

145:                                              ; preds = %135
  %146 = load ptr, ptr %8, align 8, !tbaa !5
  %147 = getelementptr inbounds i8, ptr %146, i32 1
  store ptr %147, ptr %8, align 8, !tbaa !5
  %148 = load i8, ptr %146, align 1, !tbaa !21
  %149 = zext i8 %148 to i16
  %150 = load ptr, ptr %16, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %150, i32 0, i32 0
  store i16 %149, ptr %151, align 2, !tbaa !29
  %152 = load ptr, ptr %8, align 8, !tbaa !5
  %153 = getelementptr inbounds i8, ptr %152, i32 1
  store ptr %153, ptr %8, align 8, !tbaa !5
  %154 = load i8, ptr %152, align 1, !tbaa !21
  %155 = zext i8 %154 to i16
  %156 = load ptr, ptr %16, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %156, i32 0, i32 1
  store i16 %155, ptr %157, align 2, !tbaa !31
  %158 = load ptr, ptr %8, align 8, !tbaa !5
  %159 = getelementptr inbounds i8, ptr %158, i32 1
  store ptr %159, ptr %8, align 8, !tbaa !5
  %160 = load i8, ptr %158, align 1, !tbaa !21
  %161 = zext i8 %160 to i16
  %162 = load ptr, ptr %16, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %162, i32 0, i32 2
  store i16 %161, ptr %163, align 2, !tbaa !32
  %164 = load ptr, ptr %8, align 8, !tbaa !5
  %165 = getelementptr inbounds i8, ptr %164, i32 1
  store ptr %165, ptr %8, align 8, !tbaa !5
  %166 = load i8, ptr %164, align 1, !tbaa !21
  %167 = zext i8 %166 to i16
  %168 = load ptr, ptr %16, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %168, i32 0, i32 3
  store i16 %167, ptr %169, align 2, !tbaa !33
  br label %195

170:                                              ; preds = %135
  %171 = load ptr, ptr %8, align 8, !tbaa !5
  %172 = call zeroext i16 @png_get_uint_16(ptr noundef %171)
  %173 = load ptr, ptr %16, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %173, i32 0, i32 0
  store i16 %172, ptr %174, align 2, !tbaa !29
  %175 = load ptr, ptr %8, align 8, !tbaa !5
  %176 = getelementptr inbounds i8, ptr %175, i64 2
  store ptr %176, ptr %8, align 8, !tbaa !5
  %177 = load ptr, ptr %8, align 8, !tbaa !5
  %178 = call zeroext i16 @png_get_uint_16(ptr noundef %177)
  %179 = load ptr, ptr %16, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %179, i32 0, i32 1
  store i16 %178, ptr %180, align 2, !tbaa !31
  %181 = load ptr, ptr %8, align 8, !tbaa !5
  %182 = getelementptr inbounds i8, ptr %181, i64 2
  store ptr %182, ptr %8, align 8, !tbaa !5
  %183 = load ptr, ptr %8, align 8, !tbaa !5
  %184 = call zeroext i16 @png_get_uint_16(ptr noundef %183)
  %185 = load ptr, ptr %16, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %185, i32 0, i32 2
  store i16 %184, ptr %186, align 2, !tbaa !32
  %187 = load ptr, ptr %8, align 8, !tbaa !5
  %188 = getelementptr inbounds i8, ptr %187, i64 2
  store ptr %188, ptr %8, align 8, !tbaa !5
  %189 = load ptr, ptr %8, align 8, !tbaa !5
  %190 = call zeroext i16 @png_get_uint_16(ptr noundef %189)
  %191 = load ptr, ptr %16, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %191, i32 0, i32 3
  store i16 %190, ptr %192, align 2, !tbaa !33
  %193 = load ptr, ptr %8, align 8, !tbaa !5
  %194 = getelementptr inbounds i8, ptr %193, i64 2
  store ptr %194, ptr %8, align 8, !tbaa !5
  br label %195

195:                                              ; preds = %170, %145
  %196 = load ptr, ptr %8, align 8, !tbaa !5
  %197 = call zeroext i16 @png_get_uint_16(ptr noundef %196)
  %198 = load ptr, ptr %16, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %198, i32 0, i32 4
  store i16 %197, ptr %199, align 2, !tbaa !34
  %200 = load ptr, ptr %8, align 8, !tbaa !5
  %201 = getelementptr inbounds i8, ptr %200, i64 2
  store ptr %201, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %202

202:                                              ; preds = %195
  %203 = load i32, ptr %12, align 4, !tbaa !26
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %12, align 4, !tbaa !26
  br label %129, !llvm.loop !35

205:                                              ; preds = %129
  %206 = load ptr, ptr %7, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 0
  store ptr %206, ptr %207, align 8, !tbaa !36
  %208 = load ptr, ptr %4, align 8, !tbaa !5
  %209 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_set_sPLT(ptr noundef %208, ptr noundef %209, ptr noundef %9, i32 noundef 1)
  %210 = load ptr, ptr %4, align 8, !tbaa !5
  %211 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %210, ptr noundef %211)
  %212 = load ptr, ptr %4, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.png_sPLT_struct, ptr %9, i32 0, i32 2
  %214 = load ptr, ptr %213, align 8, !tbaa !28
  call void @png_free(ptr noundef %212, ptr noundef %214)
  store i32 0, ptr %15, align 4
  br label %215

215:                                              ; preds = %205, %126, %114, %101, %74, %49, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 32, 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
  %216 = load i32, ptr %15, align 4
  switch i32 %216, label %218 [
    i32 0, label %217
    i32 1, label %217
  ]

217:                                              ; preds = %215, %215
  ret void

218:                                              ; preds = %215
  unreachable
}

declare void @png_set_sPLT(ptr noundef, ptr noundef, ptr noundef, i32 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 }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 280}
!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, !7, i64 272, !7, i64 273, !10, i64 280, !10, i64 288, !10, i64 296, !13, i64 304, !6, i64 416, !10, i64 424, !14, i64 432, !14, i64 436, !14, i64 440, !14, i64 444, !14, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !15, i64 568, !10, i64 592, !10, i64 600, !6, i64 608, !16, i64 616, !16, i64 618, !7, i64 620, !7, i64 625, !7, i64 626, !7, i64 627, !7, i64 628, !7, i64 629, !7, i64 630, !7, i64 631, !7, i64 632, !7, i64 633, !7, i64 634, !7, i64 635, !7, i64 636, !16, i64 638, !7, i64 640, !17, i64 644, !18, i64 648, !18, i64 658, !6, i64 672, !10, i64 680, !10, i64 688, !14, i64 696, !17, i64 700, !17, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !19, i64 760, !19, i64 765, !6, i64 776, !18, i64 784, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !6, i64 840, !6, i64 848, !6, i64 856, !6, i64 864, !10, i64 872, !10, i64 880, !10, i64 888, !10, i64 896, !10, i64 904, !10, i64 912, !14, i64 920, !14, i64 924, !10, i64 928, !10, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !7, i64 984, !7, i64 985, !6, i64 992, !6, i64 1000, !6, i64 1008, !6, i64 1016, !6, i64 1024, !6, i64 1032, !10, i64 1040, !6, i64 1048, !6, i64 1056, !14, i64 1064, !6, i64 1072, !7, i64 1080, !16, i64 1082, !16, i64 1084, !16, i64 1086, !10, i64 1088, !10, i64 1096, !7, i64 1104, !7, i64 1105, !10, i64 1112, !10, i64 1120, !6, i64 1128, !6, i64 1136, !6, i64 1144, !6, i64 1152, !6, i64 1160, !6, i64 1168, !6, i64 1176, !7, i64 1184, !10, i64 1192, !10, i64 1200, !20, i64 1208, !10, i64 1240, !10, i64 1248}
!13 = !{!"z_stream_s", !6, i64 0, !14, i64 8, !10, i64 16, !6, i64 24, !14, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !14, i64 88, !10, i64 96, !10, i64 104}
!14 = !{!"int", !7, i64 0}
!15 = !{!"png_row_info_struct", !10, i64 0, !10, 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, !10, i64 16, !7, i64 24}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!25, !7, i64 8}
!25 = !{!"png_sPLT_struct", !6, i64 0, !7, i64 8, !6, i64 16, !10, i64 24}
!26 = !{!14, !14, i64 0}
!27 = !{!25, !10, i64 24}
!28 = !{!25, !6, i64 16}
!29 = !{!30, !16, i64 0}
!30 = !{!"png_sPLT_entry_struct", !16, i64 0, !16, i64 2, !16, i64 4, !16, i64 6, !16, i64 8}
!31 = !{!30, !16, i64 2}
!32 = !{!30, !16, i64 4}
!33 = !{!30, !16, i64 6}
!34 = !{!30, !16, i64 8}
!35 = distinct !{!35, !23}
!36 = !{!25, !6, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.png_sPLT_struct = type { ptr, i8, ptr, i64 }
%struct.png_sPLT_entry_struct = type { i16, i16, i16, i16, i16 }

@.str.61 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [36 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 zeroext i16 @png_get_uint_16(ptr noundef) local_unnamed_addr #2

; 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, i64 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 ptr @png_malloc(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_sPLT(ptr noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct.png_sPLT_struct, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 280
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = and i64 %6, 1
  %.not = icmp eq i64 %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.61) #3
  br label %13

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

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

13:                                               ; preds = %9, %8
  %14 = add i64 %2, 1
  %15 = tail call ptr @png_malloc(ptr noundef nonnull %0, i64 noundef %14) #3
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef %15, i64 noundef %2)
  %16 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i64 noundef 0)
  %.not78 = icmp eq i32 %16, 0
  br i1 %.not78, label %18, label %17

17:                                               ; preds = %13
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %15) #3
  br label %86

18:                                               ; preds = %13
  %19 = getelementptr inbounds i8, ptr %15, i64 %2
  store i8 0, ptr %19, align 1, !tbaa !19
  br label %20

20:                                               ; preds = %20, %18
  %.0 = phi ptr [ %15, %18 ], [ %22, %20 ]
  %21 = load i8, ptr %.0, align 1, !tbaa !19
  %.not79 = icmp eq i8 %21, 0
  %22 = getelementptr inbounds i8, ptr %.0, i64 1
  br i1 %.not79, label %23, label %20, !llvm.loop !20

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %19, i64 -2
  %25 = icmp ugt ptr %22, %24
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  tail call void @png_free(ptr noundef %0, ptr noundef %15) #3
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.63) #3
  br label %86

27:                                               ; preds = %23
  %28 = getelementptr inbounds i8, ptr %.0, i64 2
  %29 = load i8, ptr %22, align 1, !tbaa !19
  %30 = getelementptr inbounds i8, ptr %4, i64 8
  store i8 %29, ptr %30, align 8, !tbaa !22
  %31 = icmp eq i8 %29, 8
  %32 = select i1 %31, i32 6, i32 10
  %33 = ptrtoint ptr %28 to i64
  %34 = ptrtoint ptr %15 to i64
  %.neg = add i64 %34, %2
  %35 = sub i64 %.neg, %33
  %36 = trunc i64 %35 to i32
  %37 = srem i32 %36, %32
  %38 = sdiv i32 %36, %32
  %.not80 = icmp eq i32 %37, 0
  br i1 %.not80, label %40, label %39

39:                                               ; preds = %27
  tail call void @png_free(ptr noundef %0, ptr noundef %15) #3
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.64) #3
  br label %86

40:                                               ; preds = %27
  %41 = sext i32 %38 to i64
  %42 = getelementptr inbounds i8, ptr %4, i64 24
  store i64 %41, ptr %42, align 8, !tbaa !24
  %43 = icmp slt i32 %38, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %40
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.65) #3
  br label %86

45:                                               ; preds = %40
  %46 = mul nuw nsw i64 %41, 10
  %47 = tail call ptr @png_malloc_warn(ptr noundef %0, i64 noundef %46) #3
  %48 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr %47, ptr %48, align 8, !tbaa !25
  %49 = icmp eq ptr %47, null
  br i1 %49, label %69, label %.preheader

.preheader:                                       ; preds = %45
  %.not90 = icmp eq i32 %38, 0
  br i1 %.not90, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  br i1 %31, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.lr.ph.split.us
  %indvars.iv86 = phi i64 [ %indvars.iv.next87, %.lr.ph.split.us ], [ 0, %.lr.ph ]
  %.183.us = phi ptr [ %68, %.lr.ph.split.us ], [ %28, %.lr.ph ]
  %50 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %47, i64 %indvars.iv86
  %51 = getelementptr inbounds i8, ptr %.183.us, i64 1
  %52 = load i8, ptr %.183.us, align 1, !tbaa !19
  %53 = zext i8 %52 to i16
  store i16 %53, ptr %50, align 2, !tbaa !26
  %54 = getelementptr inbounds i8, ptr %.183.us, i64 2
  %55 = load i8, ptr %51, align 1, !tbaa !19
  %56 = zext i8 %55 to i16
  %57 = getelementptr inbounds i8, ptr %50, i64 2
  store i16 %56, ptr %57, align 2, !tbaa !28
  %58 = getelementptr inbounds i8, ptr %.183.us, i64 3
  %59 = load i8, ptr %54, align 1, !tbaa !19
  %60 = zext i8 %59 to i16
  %61 = getelementptr inbounds i8, ptr %50, i64 4
  store i16 %60, ptr %61, align 2, !tbaa !29
  %62 = getelementptr inbounds i8, ptr %.183.us, i64 4
  %63 = load i8, ptr %58, align 1, !tbaa !19
  %64 = zext i8 %63 to i16
  %65 = getelementptr inbounds i8, ptr %50, i64 6
  store i16 %64, ptr %65, align 2, !tbaa !30
  %66 = tail call zeroext i16 @png_get_uint_16(ptr noundef nonnull %62)
  %67 = getelementptr inbounds i8, ptr %50, i64 8
  store i16 %66, ptr %67, align 2, !tbaa !31
  %68 = getelementptr inbounds i8, ptr %.183.us, i64 6
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %exitcond89.not = icmp eq i64 %indvars.iv.next87, %41
  br i1 %exitcond89.not, label %._crit_edge, label %.lr.ph.split.us, !llvm.loop !32

69:                                               ; preds = %45
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.66) #3
  br label %86

.lr.ph.split:                                     ; preds = %.lr.ph, %.lr.ph.split
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph.split ], [ 0, %.lr.ph ]
  %.183 = phi ptr [ %84, %.lr.ph.split ], [ %28, %.lr.ph ]
  %70 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %47, i64 %indvars.iv
  %71 = tail call zeroext i16 @png_get_uint_16(ptr noundef nonnull %.183)
  store i16 %71, ptr %70, align 2, !tbaa !26
  %72 = getelementptr inbounds i8, ptr %.183, i64 2
  %73 = tail call zeroext i16 @png_get_uint_16(ptr noundef nonnull %72)
  %74 = getelementptr inbounds i8, ptr %70, i64 2
  store i16 %73, ptr %74, align 2, !tbaa !28
  %75 = getelementptr inbounds i8, ptr %.183, i64 4
  %76 = tail call zeroext i16 @png_get_uint_16(ptr noundef nonnull %75)
  %77 = getelementptr inbounds i8, ptr %70, i64 4
  store i16 %76, ptr %77, align 2, !tbaa !29
  %78 = getelementptr inbounds i8, ptr %.183, i64 6
  %79 = tail call zeroext i16 @png_get_uint_16(ptr noundef nonnull %78)
  %80 = getelementptr inbounds i8, ptr %70, i64 6
  store i16 %79, ptr %80, align 2, !tbaa !30
  %81 = getelementptr inbounds i8, ptr %.183, i64 8
  %82 = tail call zeroext i16 @png_get_uint_16(ptr noundef nonnull %81)
  %83 = getelementptr inbounds i8, ptr %70, i64 8
  store i16 %82, ptr %83, align 2, !tbaa !31
  %84 = getelementptr inbounds i8, ptr %.183, i64 10
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %41
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph.split, !llvm.loop !32

._crit_edge:                                      ; preds = %.lr.ph.split, %.lr.ph.split.us, %.preheader
  store ptr %15, ptr %4, align 8, !tbaa !33
  call void @png_set_sPLT(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %4, i32 noundef 1) #3
  call void @png_free(ptr noundef %0, ptr noundef %15) #3
  %85 = load ptr, ptr %48, align 8, !tbaa !25
  call void @png_free(ptr noundef %0, ptr noundef %85) #3
  br label %86

86:                                               ; preds = %._crit_edge, %69, %44, %39, %26, %17, %11
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #3
  ret void
}

declare void @png_set_sPLT(ptr noundef, ptr noundef, ptr noundef, i32 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 = { 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 280}
!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, !7, i64 272, !7, i64 273, !10, i64 280, !10, i64 288, !10, i64 296, !11, i64 304, !9, i64 416, !10, i64 424, !12, i64 432, !12, i64 436, !12, i64 440, !12, i64 444, !12, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !9, i64 520, !9, i64 528, !9, i64 536, !9, i64 544, !9, i64 552, !9, i64 560, !13, i64 568, !10, i64 592, !10, i64 600, !9, i64 608, !14, i64 616, !14, i64 618, !7, i64 620, !7, i64 625, !7, i64 626, !7, i64 627, !7, i64 628, !7, i64 629, !7, i64 630, !7, i64 631, !7, i64 632, !7, i64 633, !7, i64 634, !7, i64 635, !7, i64 636, !14, i64 638, !7, i64 640, !15, i64 644, !16, i64 648, !16, i64 658, !9, i64 672, !10, i64 680, !10, i64 688, !12, i64 696, !15, i64 700, !15, i64 704, !9, i64 712, !9, i64 720, !9, i64 728, !9, i64 736, !9, i64 744, !9, i64 752, !17, i64 760, !17, i64 765, !9, i64 776, !16, i64 784, !9, i64 800, !9, i64 808, !9, i64 816, !9, i64 824, !9, i64 832, !9, i64 840, !9, i64 848, !9, i64 856, !9, i64 864, !10, i64 872, !10, i64 880, !10, i64 888, !10, i64 896, !10, i64 904, !10, i64 912, !12, i64 920, !12, i64 924, !10, i64 928, !10, i64 936, !9, i64 944, !9, i64 952, !9, i64 960, !9, i64 968, !9, i64 976, !7, i64 984, !7, i64 985, !9, i64 992, !9, i64 1000, !9, i64 1008, !9, i64 1016, !9, i64 1024, !9, i64 1032, !10, i64 1040, !9, i64 1048, !9, i64 1056, !12, i64 1064, !9, i64 1072, !7, i64 1080, !14, i64 1082, !14, i64 1084, !14, i64 1086, !10, i64 1088, !10, i64 1096, !7, i64 1104, !7, i64 1105, !10, i64 1112, !10, i64 1120, !9, i64 1128, !9, i64 1136, !9, i64 1144, !9, i64 1152, !9, i64 1160, !9, i64 1168, !9, i64 1176, !7, i64 1184, !10, i64 1192, !10, i64 1200, !18, i64 1208, !10, i64 1240, !10, i64 1248}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!"z_stream_s", !9, i64 0, !12, i64 8, !10, i64 16, !9, i64 24, !12, i64 32, !10, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !12, i64 88, !10, i64 96, !10, i64 104}
!12 = !{!"int", !7, i64 0}
!13 = !{!"png_row_info_struct", !10, i64 0, !10, 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, !10, i64 16, !7, i64 24}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !7, i64 8}
!23 = !{!"png_sPLT_struct", !9, i64 0, !7, i64 8, !9, i64 16, !10, i64 24}
!24 = !{!23, !10, i64 24}
!25 = !{!23, !9, i64 16}
!26 = !{!27, !14, i64 0}
!27 = !{!"png_sPLT_entry_struct", !14, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!28 = !{!27, !14, i64 2}
!29 = !{!27, !14, i64 4}
!30 = !{!27, !14, i64 6}
!31 = !{!27, !14, i64 8}
!32 = distinct !{!32, !21}
!33 = !{!23, !9, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DivRemPairsPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass