; LLVM IR from EyalAr/lwip :: src/lib/png (pngset)

; 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_info_def = type { i32, i32, i32, i64, ptr, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, [8 x i8], %struct.png_colorspace, ptr, ptr, i32, 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, ptr, i32, i32, ptr, ptr, i8, i8, i32, ptr, i32, ptr, i32, i8, ptr, ptr, ptr }
%struct.png_colorspace = type { i32, %struct.png_xy, %struct.png_XYZ, i16, i16 }
%struct.png_xy = type { i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.png_XYZ = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.png_time_struct = type { i16, i8, 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 }

@.str.10 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

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

declare noalias ptr @png_malloc_warn(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @png_set_pCAL(ptr noalias noundef %0, ptr noalias noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr noundef %7, ptr noundef %8) #3 {
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i64, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store i32 %3, ptr %13, align 4, !tbaa !9
  store i32 %4, ptr %14, align 4, !tbaa !9
  store i32 %5, ptr %15, align 4, !tbaa !9
  store i32 %6, ptr %16, align 4, !tbaa !9
  store ptr %7, ptr %17, align 8, !tbaa !5
  store ptr %8, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %39, label %24

24:                                               ; preds = %9
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %39, label %27

27:                                               ; preds = %24
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %39, label %30

30:                                               ; preds = %27
  %31 = load ptr, ptr %17, align 8, !tbaa !5
  %32 = icmp eq ptr %31, null
  br i1 %32, label %39, label %33

33:                                               ; preds = %30
  %34 = load i32, ptr %16, align 4, !tbaa !9
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %36, label %40

36:                                               ; preds = %33
  %37 = load ptr, ptr %18, align 8, !tbaa !5
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %40

39:                                               ; preds = %36, %30, %27, %24, %9
  store i32 1, ptr %21, align 4
  br label %222

40:                                               ; preds = %36, %33
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = call i64 @strlen(ptr noundef %41) #8
  %43 = add i64 %42, 1
  store i64 %43, ptr %19, align 8, !tbaa !11
  %44 = load i32, ptr %15, align 4, !tbaa !9
  %45 = icmp slt i32 %44, 0
  br i1 %45, label %49, label %46

46:                                               ; preds = %40
  %47 = load i32, ptr %15, align 4, !tbaa !9
  %48 = icmp sgt i32 %47, 3
  br i1 %48, label %49, label %51

49:                                               ; preds = %46, %40
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  call void @png_error(ptr noundef %50, ptr noundef @.str.10) #9
  unreachable

51:                                               ; preds = %46
  %52 = load i32, ptr %16, align 4, !tbaa !9
  %53 = icmp slt i32 %52, 0
  br i1 %53, label %57, label %54

54:                                               ; preds = %51
  %55 = load i32, ptr %16, align 4, !tbaa !9
  %56 = icmp sgt i32 %55, 255
  br i1 %56, label %57, label %59

57:                                               ; preds = %54, %51
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  call void @png_error(ptr noundef %58, ptr noundef @.str.11) #9
  unreachable

59:                                               ; preds = %54
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %88, %59
  %61 = load i32, ptr %20, align 4, !tbaa !9
  %62 = load i32, ptr %16, align 4, !tbaa !9
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %64, label %91

64:                                               ; preds = %60
  %65 = load ptr, ptr %18, align 8, !tbaa !5
  %66 = load i32, ptr %20, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds ptr, ptr %65, i64 %67
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  %70 = icmp eq ptr %69, null
  br i1 %70, label %85, label %71

71:                                               ; preds = %64
  %72 = load ptr, ptr %18, align 8, !tbaa !5
  %73 = load i32, ptr %20, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds ptr, ptr %72, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  %77 = load ptr, ptr %18, align 8, !tbaa !5
  %78 = load i32, ptr %20, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds ptr, ptr %77, i64 %79
  %81 = load ptr, ptr %80, align 8, !tbaa !5
  %82 = call i64 @strlen(ptr noundef %81) #8
  %83 = call i32 @png_check_fp_string(ptr noundef %76, i64 noundef %82)
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %87, label %85

85:                                               ; preds = %71, %64
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  call void @png_error(ptr noundef %86, ptr noundef @.str.12) #9
  unreachable

87:                                               ; preds = %71
  br label %88

88:                                               ; preds = %87
  %89 = load i32, ptr %20, align 4, !tbaa !9
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %20, align 4, !tbaa !9
  br label %60, !llvm.loop !13

91:                                               ; preds = %60
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = load i64, ptr %19, align 8, !tbaa !11
  %94 = call noalias ptr @png_malloc_warn(ptr noundef %92, i64 noundef %93)
  %95 = load ptr, ptr %11, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.png_info_def, ptr %95, i32 0, i32 35
  store ptr %94, ptr %96, align 8, !tbaa !15
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.png_info_def, ptr %97, i32 0, i32 35
  %99 = load ptr, ptr %98, align 8, !tbaa !15
  %100 = icmp eq ptr %99, null
  br i1 %100, label %101, label %103

101:                                              ; preds = %91
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 1, ptr %21, align 4
  br label %222

103:                                              ; preds = %91
  %104 = load ptr, ptr %11, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.png_info_def, ptr %104, i32 0, i32 35
  %106 = load ptr, ptr %105, align 8, !tbaa !15
  %107 = load ptr, ptr %12, align 8, !tbaa !5
  %108 = load i64, ptr %19, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %106, ptr align 1 %107, i64 %108, i1 false)
  %109 = load i32, ptr %13, align 4, !tbaa !9
  %110 = load ptr, ptr %11, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.png_info_def, ptr %110, i32 0, i32 36
  store i32 %109, ptr %111, align 8, !tbaa !24
  %112 = load i32, ptr %14, align 4, !tbaa !9
  %113 = load ptr, ptr %11, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.png_info_def, ptr %113, i32 0, i32 37
  store i32 %112, ptr %114, align 4, !tbaa !25
  %115 = load i32, ptr %15, align 4, !tbaa !9
  %116 = trunc i32 %115 to i8
  %117 = load ptr, ptr %11, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.png_info_def, ptr %117, i32 0, i32 40
  store i8 %116, ptr %118, align 8, !tbaa !26
  %119 = load i32, ptr %16, align 4, !tbaa !9
  %120 = trunc i32 %119 to i8
  %121 = load ptr, ptr %11, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.png_info_def, ptr %121, i32 0, i32 41
  store i8 %120, ptr %122, align 1, !tbaa !27
  %123 = load ptr, ptr %17, align 8, !tbaa !5
  %124 = call i64 @strlen(ptr noundef %123) #8
  %125 = add i64 %124, 1
  store i64 %125, ptr %19, align 8, !tbaa !11
  %126 = load ptr, ptr %10, align 8, !tbaa !5
  %127 = load i64, ptr %19, align 8, !tbaa !11
  %128 = call noalias ptr @png_malloc_warn(ptr noundef %126, i64 noundef %127)
  %129 = load ptr, ptr %11, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.png_info_def, ptr %129, i32 0, i32 38
  store ptr %128, ptr %130, align 8, !tbaa !28
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.png_info_def, ptr %131, i32 0, i32 38
  %133 = load ptr, ptr %132, align 8, !tbaa !28
  %134 = icmp eq ptr %133, null
  br i1 %134, label %135, label %137

135:                                              ; preds = %103
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 1, ptr %21, align 4
  br label %222

137:                                              ; preds = %103
  %138 = load ptr, ptr %11, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.png_info_def, ptr %138, i32 0, i32 38
  %140 = load ptr, ptr %139, align 8, !tbaa !28
  %141 = load ptr, ptr %17, align 8, !tbaa !5
  %142 = load i64, ptr %19, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %140, ptr align 1 %141, i64 %142, i1 false)
  %143 = load ptr, ptr %10, align 8, !tbaa !5
  %144 = load i32, ptr %16, align 4, !tbaa !9
  %145 = add nsw i32 %144, 1
  %146 = sext i32 %145 to i64
  %147 = mul i64 %146, 8
  %148 = call noalias ptr @png_malloc_warn(ptr noundef %143, i64 noundef %147)
  %149 = load ptr, ptr %11, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.png_info_def, ptr %149, i32 0, i32 39
  store ptr %148, ptr %150, align 8, !tbaa !29
  %151 = load ptr, ptr %11, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.png_info_def, ptr %151, i32 0, i32 39
  %153 = load ptr, ptr %152, align 8, !tbaa !29
  %154 = icmp eq ptr %153, null
  br i1 %154, label %155, label %157

155:                                              ; preds = %137
  %156 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 1, ptr %21, align 4
  br label %222

157:                                              ; preds = %137
  %158 = load ptr, ptr %11, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.png_info_def, ptr %158, i32 0, i32 39
  %160 = load ptr, ptr %159, align 8, !tbaa !29
  %161 = load i32, ptr %16, align 4, !tbaa !9
  %162 = add nsw i32 %161, 1
  %163 = sext i32 %162 to i64
  %164 = mul i64 %163, 8
  call void @llvm.memset.p0.i64(ptr align 8 %160, i8 0, i64 %164, i1 false)
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %165

165:                                              ; preds = %210, %157
  %166 = load i32, ptr %20, align 4, !tbaa !9
  %167 = load i32, ptr %16, align 4, !tbaa !9
  %168 = icmp slt i32 %166, %167
  br i1 %168, label %169, label %213

169:                                              ; preds = %165
  %170 = load ptr, ptr %18, align 8, !tbaa !5
  %171 = load i32, ptr %20, align 4, !tbaa !9
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds ptr, ptr %170, i64 %172
  %174 = load ptr, ptr %173, align 8, !tbaa !5
  %175 = call i64 @strlen(ptr noundef %174) #8
  %176 = add i64 %175, 1
  store i64 %176, ptr %19, align 8, !tbaa !11
  %177 = load ptr, ptr %10, align 8, !tbaa !5
  %178 = load i64, ptr %19, align 8, !tbaa !11
  %179 = call noalias ptr @png_malloc_warn(ptr noundef %177, i64 noundef %178)
  %180 = load ptr, ptr %11, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.png_info_def, ptr %180, i32 0, i32 39
  %182 = load ptr, ptr %181, align 8, !tbaa !29
  %183 = load i32, ptr %20, align 4, !tbaa !9
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds ptr, ptr %182, i64 %184
  store ptr %179, ptr %185, align 8, !tbaa !5
  %186 = load ptr, ptr %11, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.png_info_def, ptr %186, i32 0, i32 39
  %188 = load ptr, ptr %187, align 8, !tbaa !29
  %189 = load i32, ptr %20, align 4, !tbaa !9
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds ptr, ptr %188, i64 %190
  %192 = load ptr, ptr %191, align 8, !tbaa !5
  %193 = icmp eq ptr %192, null
  br i1 %193, label %194, label %196

194:                                              ; preds = %169
  %195 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 1, ptr %21, align 4
  br label %222

196:                                              ; preds = %169
  %197 = load ptr, ptr %11, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.png_info_def, ptr %197, i32 0, i32 39
  %199 = load ptr, ptr %198, align 8, !tbaa !29
  %200 = load i32, ptr %20, align 4, !tbaa !9
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds ptr, ptr %199, i64 %201
  %203 = load ptr, ptr %202, align 8, !tbaa !5
  %204 = load ptr, ptr %18, align 8, !tbaa !5
  %205 = load i32, ptr %20, align 4, !tbaa !9
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds ptr, ptr %204, i64 %206
  %208 = load ptr, ptr %207, align 8, !tbaa !5
  %209 = load i64, ptr %19, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %203, ptr align 1 %208, i64 %209, i1 false)
  br label %210

210:                                              ; preds = %196
  %211 = load i32, ptr %20, align 4, !tbaa !9
  %212 = add nsw i32 %211, 1
  store i32 %212, ptr %20, align 4, !tbaa !9
  br label %165, !llvm.loop !30

213:                                              ; preds = %165
  %214 = load ptr, ptr %11, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.png_info_def, ptr %214, i32 0, i32 2
  %216 = load i32, ptr %215, align 8, !tbaa !31
  %217 = or i32 %216, 1024
  store i32 %217, ptr %215, align 8, !tbaa !31
  %218 = load ptr, ptr %11, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.png_info_def, ptr %218, i32 0, i32 42
  %220 = load i32, ptr %219, align 4, !tbaa !32
  %221 = or i32 %220, 128
  store i32 %221, ptr %219, align 4, !tbaa !32
  store i32 0, ptr %21, align 4
  br label %222

222:                                              ; preds = %213, %194, %155, %135, %101, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  %223 = load i32, ptr %21, align 4
  switch i32 %223, label %225 [
    i32 0, label %224
    i32 1, label %224
  ]

224:                                              ; preds = %222, %222
  ret void

225:                                              ; preds = %222
  unreachable
}

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

; Function Attrs: noreturn
declare void @png_error(ptr noundef, ptr noundef) #5

declare i32 @png_check_fp_string(ptr noundef, i64 noundef) #2

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { noreturn "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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { noreturn }

!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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 248}
!16 = !{!"png_info_def", !10, i64 0, !10, i64 4, !10, i64 8, !12, i64 16, !6, i64 24, !17, i64 32, !17, 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, !18, i64 52, !6, i64 128, !6, i64 136, !10, i64 144, !10, i64 148, !10, i64 152, !6, i64 160, !21, i64 168, !22, i64 176, !6, i64 184, !23, i64 192, !23, i64 202, !10, i64 212, !10, i64 216, !7, i64 220, !10, i64 224, !10, i64 228, !7, i64 232, !6, i64 240, !6, i64 248, !10, i64 256, !10, i64 260, !6, i64 264, !6, i64 272, !7, i64 280, !7, i64 281, !10, i64 284, !6, i64 288, !10, i64 296, !6, i64 304, !10, i64 312, !7, i64 316, !6, i64 320, !6, i64 328, !6, i64 336}
!17 = !{!"short", !7, i64 0}
!18 = !{!"png_colorspace", !10, i64 0, !19, i64 4, !20, i64 36, !17, i64 72, !17, i64 74}
!19 = !{!"png_xy", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!20 = !{!"png_XYZ", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32}
!21 = !{!"png_time_struct", !17, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!22 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!23 = !{!"png_color_16_struct", !7, i64 0, !17, i64 2, !17, i64 4, !17, i64 6, !17, i64 8}
!24 = !{!16, !10, i64 256}
!25 = !{!16, !10, i64 260}
!26 = !{!16, !7, i64 280}
!27 = !{!16, !7, i64 281}
!28 = !{!16, !6, i64 264}
!29 = !{!16, !6, i64 272}
!30 = distinct !{!30, !14}
!31 = !{!16, !10, i64 8}
!32 = !{!16, !10, i64 284}


; 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.10 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @png_set_pCAL(ptr noalias noundef %0, ptr noalias noundef %1, ptr noundef readonly %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr noundef readonly %7, ptr noundef readonly %8) local_unnamed_addr #2 {
  %10 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %11 = insertelement <4 x ptr> %10, ptr %1, i64 1
  %12 = insertelement <4 x ptr> %11, ptr %2, i64 2
  %13 = insertelement <4 x ptr> %12, ptr %7, i64 3
  %14 = icmp eq <4 x ptr> %13, zeroinitializer
  %15 = bitcast <4 x i1> %14 to i4
  %.not108 = icmp eq i4 %15, 0
  br i1 %.not108, label %16, label %.loopexit

16:                                               ; preds = %9
  %17 = icmp sgt i32 %6, 0
  %18 = icmp eq ptr %8, null
  %or.cond7 = and i1 %17, %18
  br i1 %or.cond7, label %.loopexit, label %19

19:                                               ; preds = %16
  %20 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %2) #7
  %21 = add i64 %20, 1
  %or.cond9 = icmp ugt i32 %5, 3
  br i1 %or.cond9, label %22, label %23

22:                                               ; preds = %19
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.10) #8
  unreachable

23:                                               ; preds = %19
  %or.cond11 = icmp ugt i32 %6, 255
  br i1 %or.cond11, label %24, label %.preheader

.preheader:                                       ; preds = %23
  %.not100 = icmp eq i32 %6, 0
  br i1 %.not100, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %6 to i64
  br label %.lr.ph

24:                                               ; preds = %23
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.11) #8
  unreachable

25:                                               ; preds = %29
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

.lr.ph:                                           ; preds = %.lr.ph.preheader, %25
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %25 ]
  %26 = getelementptr inbounds ptr, ptr %8, i64 %indvars.iv
  %27 = load ptr, ptr %26, align 8, !tbaa !7
  %28 = icmp eq ptr %27, null
  br i1 %28, label %32, label %29

29:                                               ; preds = %.lr.ph
  %30 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %27) #7
  %31 = tail call i32 @png_check_fp_string(ptr noundef nonnull %27, i64 noundef %30) #9
  %.not = icmp eq i32 %31, 0
  br i1 %.not, label %32, label %25

32:                                               ; preds = %29, %.lr.ph
  tail call void @png_error(ptr noundef %0, ptr noundef nonnull @.str.12) #8
  unreachable

._crit_edge:                                      ; preds = %25, %.preheader
  %33 = tail call noalias ptr @png_malloc_warn(ptr noundef %0, i64 noundef %21) #9
  %34 = getelementptr inbounds i8, ptr %1, i64 248
  store ptr %33, ptr %34, align 8, !tbaa !11
  %35 = icmp eq ptr %33, null
  br i1 %35, label %.loopexit, label %36

36:                                               ; preds = %._crit_edge
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %33, ptr align 1 %2, i64 %21, i1 false)
  %37 = getelementptr inbounds i8, ptr %1, i64 256
  store i32 %3, ptr %37, align 8, !tbaa !22
  %38 = getelementptr inbounds i8, ptr %1, i64 260
  store i32 %4, ptr %38, align 4, !tbaa !23
  %39 = trunc nuw nsw i32 %5 to i8
  %40 = getelementptr inbounds i8, ptr %1, i64 280
  store i8 %39, ptr %40, align 8, !tbaa !24
  %41 = trunc nuw i32 %6 to i8
  %42 = getelementptr inbounds i8, ptr %1, i64 281
  store i8 %41, ptr %42, align 1, !tbaa !25
  %43 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %7) #7
  %44 = add i64 %43, 1
  %45 = tail call noalias ptr @png_malloc_warn(ptr noundef %0, i64 noundef %44) #9
  %46 = getelementptr inbounds i8, ptr %1, i64 264
  store ptr %45, ptr %46, align 8, !tbaa !26
  %47 = icmp eq ptr %45, null
  br i1 %47, label %.loopexit, label %48

48:                                               ; preds = %36
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %45, ptr align 1 %7, i64 %44, i1 false)
  %49 = shl nuw nsw i32 %6, 3
  %50 = add nuw nsw i32 %49, 8
  %51 = zext nneg i32 %50 to i64
  %52 = tail call noalias ptr @png_malloc_warn(ptr noundef %0, i64 noundef %51) #9
  %53 = getelementptr inbounds i8, ptr %1, i64 272
  store ptr %52, ptr %53, align 8, !tbaa !27
  %54 = icmp eq ptr %52, null
  br i1 %54, label %.loopexit, label %55

55:                                               ; preds = %48
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %52, i8 0, i64 %51, i1 false)
  br i1 %.not100, label %._crit_edge99, label %.lr.ph98.preheader

.lr.ph98.preheader:                               ; preds = %55
  %smax = tail call i32 @llvm.smax.i32(i32 %6, i32 1)
  %wide.trip.count106 = zext nneg i32 %smax to i64
  br label %.lr.ph98

.lr.ph98:                                         ; preds = %.lr.ph98.preheader, %67
  %indvars.iv103 = phi i64 [ 0, %.lr.ph98.preheader ], [ %indvars.iv.next104, %67 ]
  %56 = getelementptr inbounds ptr, ptr %8, i64 %indvars.iv103
  %57 = load ptr, ptr %56, align 8, !tbaa !7
  %58 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %57) #7
  %59 = add i64 %58, 1
  %60 = tail call noalias ptr @png_malloc_warn(ptr noundef %0, i64 noundef %59) #9
  %61 = load ptr, ptr %53, align 8, !tbaa !27
  %62 = getelementptr inbounds ptr, ptr %61, i64 %indvars.iv103
  store ptr %60, ptr %62, align 8, !tbaa !7
  %63 = load ptr, ptr %53, align 8, !tbaa !27
  %64 = getelementptr inbounds ptr, ptr %63, i64 %indvars.iv103
  %65 = load ptr, ptr %64, align 8, !tbaa !7
  %66 = icmp eq ptr %65, null
  br i1 %66, label %.loopexit, label %67

67:                                               ; preds = %.lr.ph98
  %68 = load ptr, ptr %56, align 8, !tbaa !7
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %65, ptr align 1 %68, i64 %59, i1 false)
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %exitcond107.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count106
  br i1 %exitcond107.not, label %._crit_edge99, label %.lr.ph98, !llvm.loop !28

._crit_edge99:                                    ; preds = %67, %55
  %69 = getelementptr inbounds i8, ptr %1, i64 8
  %70 = load i32, ptr %69, align 8, !tbaa !29
  %71 = or i32 %70, 1024
  store i32 %71, ptr %69, align 8, !tbaa !29
  %72 = getelementptr inbounds i8, ptr %1, i64 284
  %73 = load i32, ptr %72, align 4, !tbaa !30
  %74 = or i32 %73, 128
  store i32 %74, ptr %72, align 4, !tbaa !30
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph98, %48, %36, %._crit_edge, %9, %16, %._crit_edge99
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: noreturn
declare void @png_error(ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @png_check_fp_string(ptr noundef, i64 noundef) local_unnamed_addr #1

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6

attributes #0 = { mustprogress nocallback nofree 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 memory(argmem: read) "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 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { noreturn nounwind }
attributes #9 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !8, i64 248}
!12 = !{!"png_info_def", !13, i64 0, !13, i64 4, !13, i64 8, !14, i64 16, !8, i64 24, !15, i64 32, !15, i64 34, !9, i64 36, !9, i64 37, !9, i64 38, !9, i64 39, !9, i64 40, !9, i64 41, !9, i64 42, !9, i64 43, !9, i64 44, !16, i64 52, !8, i64 128, !8, i64 136, !13, i64 144, !13, i64 148, !13, i64 152, !8, i64 160, !19, i64 168, !20, i64 176, !8, i64 184, !21, i64 192, !21, i64 202, !13, i64 212, !13, i64 216, !9, i64 220, !13, i64 224, !13, i64 228, !9, i64 232, !8, i64 240, !8, i64 248, !13, i64 256, !13, i64 260, !8, i64 264, !8, i64 272, !9, i64 280, !9, i64 281, !13, i64 284, !8, i64 288, !13, i64 296, !8, i64 304, !13, i64 312, !9, i64 316, !8, i64 320, !8, i64 328, !8, i64 336}
!13 = !{!"int", !9, i64 0}
!14 = !{!"long", !9, i64 0}
!15 = !{!"short", !9, i64 0}
!16 = !{!"png_colorspace", !13, i64 0, !17, i64 4, !18, i64 36, !15, i64 72, !15, i64 74}
!17 = !{!"png_xy", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28}
!18 = !{!"png_XYZ", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32}
!19 = !{!"png_time_struct", !15, i64 0, !9, i64 2, !9, i64 3, !9, i64 4, !9, i64 5, !9, i64 6}
!20 = !{!"png_color_8_struct", !9, i64 0, !9, i64 1, !9, i64 2, !9, i64 3, !9, i64 4}
!21 = !{!"png_color_16_struct", !9, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, i64 8}
!22 = !{!12, !13, i64 256}
!23 = !{!12, !13, i64 260}
!24 = !{!12, !9, i64 280}
!25 = !{!12, !9, i64 281}
!26 = !{!12, !8, i64 264}
!27 = !{!12, !8, i64 272}
!28 = distinct !{!28, !6}
!29 = !{!12, !13, i64 8}
!30 = !{!12, !13, i64 284}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass