; LLVM IR from Try/Tempest :: Engine/thirdparty/libpng (pngwrite)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.png_struct_def = type { [1 x %struct.__jmp_buf_tag], ptr, ptr, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i32, i32, i32, i32, %struct.z_stream_s, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, ptr, ptr, ptr, ptr, i64, i32, i32, ptr, i16, i32, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, i32, %struct.png_color_16_struct, %struct.png_color_16_struct, ptr, i32, i32, i32, i32, 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, ptr, ptr, i32, [29 x i8], i32, ptr, ptr, i32, i32, ptr, i8, i8, i16, i16, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i32, i32, i64, %struct.png_unknown_chunk_t, i64, ptr, i64, i32, i32, ptr, [4 x ptr], %struct.png_colorspace }
%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_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_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_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, i32, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, i8, i8, i32, ptr, i32, ptr, i32, i8, ptr, ptr, ptr }
%struct.png_time_struct = type { i16, i8, i8, i8, i8, i8 }
%struct.png_text_struct = type { i32, ptr, ptr, i64, i64, ptr, ptr }

@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
declare hidden void @write_unknown_chunks(ptr noalias noundef, ptr noalias noundef, i32 noundef) #0

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

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

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

declare void @png_write_eXIf(ptr noundef, ptr noundef, i32 noundef) #3

declare void @png_write_tIME(ptr noundef, ptr noundef) #3

declare void @png_write_iTXt(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare void @png_write_zTXt(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #3

declare void @png_write_tEXt(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #3

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

8:                                                ; preds = %2
  br label %239

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

15:                                               ; preds = %9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  call void @png_error(ptr noundef %16, ptr noundef @.str.3) #4
  unreachable

17:                                               ; preds = %9
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.png_struct_def, ptr %18, i32 0, i32 54
  %20 = load i32, ptr %19, align 4, !tbaa !21
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.png_struct_def, ptr %21, i32 0, i32 53
  %23 = load i16, ptr %22, align 8, !tbaa !22
  %24 = zext i16 %23 to i32
  %25 = icmp sgt i32 %20, %24
  br i1 %25, label %26, label %28

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

28:                                               ; preds = %26, %17
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %233

31:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.png_info_def, ptr %32, i32 0, i32 2
  %34 = load i32, ptr %33, align 8, !tbaa !23
  %35 = and i32 %34, 512
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %47

37:                                               ; preds = %31
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.png_struct_def, ptr %38, i32 0, i32 15
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = and i32 %40, 512
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %47

43:                                               ; preds = %37
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.png_info_def, ptr %45, i32 0, i32 23
  call void @png_write_tIME(ptr noundef %44, ptr noundef %46)
  br label %47

47:                                               ; preds = %43, %37, %31
  store i32 0, ptr %5, align 4, !tbaa !26
  br label %48

48:                                               ; preds = %213, %47
  %49 = load i32, ptr %5, align 4, !tbaa !26
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.png_info_def, ptr %50, i32 0, i32 20
  %52 = load i32, ptr %51, align 4, !tbaa !27
  %53 = icmp slt i32 %49, %52
  br i1 %53, label %54, label %216

54:                                               ; preds = %48
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.png_info_def, ptr %55, i32 0, i32 22
  %57 = load ptr, ptr %56, align 8, !tbaa !28
  %58 = load i32, ptr %5, align 4, !tbaa !26
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds %struct.png_text_struct, ptr %57, i64 %59
  %61 = getelementptr inbounds %struct.png_text_struct, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %61, align 8, !tbaa !29
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %64, label %132

64:                                               ; preds = %54
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.png_info_def, ptr %66, i32 0, i32 22
  %68 = load ptr, ptr %67, align 8, !tbaa !28
  %69 = load i32, ptr %5, align 4, !tbaa !26
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds %struct.png_text_struct, ptr %68, i64 %70
  %72 = getelementptr inbounds %struct.png_text_struct, ptr %71, i32 0, i32 0
  %73 = load i32, ptr %72, align 8, !tbaa !29
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.png_info_def, ptr %74, i32 0, i32 22
  %76 = load ptr, ptr %75, align 8, !tbaa !28
  %77 = load i32, ptr %5, align 4, !tbaa !26
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds %struct.png_text_struct, ptr %76, i64 %78
  %80 = getelementptr inbounds %struct.png_text_struct, ptr %79, i32 0, i32 1
  %81 = load ptr, ptr %80, align 8, !tbaa !31
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.png_info_def, ptr %82, i32 0, i32 22
  %84 = load ptr, ptr %83, align 8, !tbaa !28
  %85 = load i32, ptr %5, align 4, !tbaa !26
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds %struct.png_text_struct, ptr %84, i64 %86
  %88 = getelementptr inbounds %struct.png_text_struct, ptr %87, i32 0, i32 5
  %89 = load ptr, ptr %88, align 8, !tbaa !32
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.png_info_def, ptr %90, i32 0, i32 22
  %92 = load ptr, ptr %91, align 8, !tbaa !28
  %93 = load i32, ptr %5, align 4, !tbaa !26
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds %struct.png_text_struct, ptr %92, i64 %94
  %96 = getelementptr inbounds %struct.png_text_struct, ptr %95, i32 0, i32 6
  %97 = load ptr, ptr %96, align 8, !tbaa !33
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.png_info_def, ptr %98, i32 0, i32 22
  %100 = load ptr, ptr %99, align 8, !tbaa !28
  %101 = load i32, ptr %5, align 4, !tbaa !26
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds %struct.png_text_struct, ptr %100, i64 %102
  %104 = getelementptr inbounds %struct.png_text_struct, ptr %103, i32 0, i32 2
  %105 = load ptr, ptr %104, align 8, !tbaa !34
  call void @png_write_iTXt(ptr noundef %65, i32 noundef %73, ptr noundef %81, ptr noundef %89, ptr noundef %97, ptr noundef %105)
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.png_info_def, ptr %106, i32 0, i32 22
  %108 = load ptr, ptr %107, align 8, !tbaa !28
  %109 = load i32, ptr %5, align 4, !tbaa !26
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds %struct.png_text_struct, ptr %108, i64 %110
  %112 = getelementptr inbounds %struct.png_text_struct, ptr %111, i32 0, i32 0
  %113 = load i32, ptr %112, align 8, !tbaa !29
  %114 = icmp eq i32 %113, -1
  br i1 %114, label %115, label %123

115:                                              ; preds = %64
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.png_info_def, ptr %116, i32 0, i32 22
  %118 = load ptr, ptr %117, align 8, !tbaa !28
  %119 = load i32, ptr %5, align 4, !tbaa !26
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds %struct.png_text_struct, ptr %118, i64 %120
  %122 = getelementptr inbounds %struct.png_text_struct, ptr %121, i32 0, i32 0
  store i32 -3, ptr %122, align 8, !tbaa !29
  br label %131

123:                                              ; preds = %64
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.png_info_def, ptr %124, i32 0, i32 22
  %126 = load ptr, ptr %125, align 8, !tbaa !28
  %127 = load i32, ptr %5, align 4, !tbaa !26
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds %struct.png_text_struct, ptr %126, i64 %128
  %130 = getelementptr inbounds %struct.png_text_struct, ptr %129, i32 0, i32 0
  store i32 -2, ptr %130, align 8, !tbaa !29
  br label %131

131:                                              ; preds = %123, %115
  br label %212

132:                                              ; preds = %54
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.png_info_def, ptr %133, i32 0, i32 22
  %135 = load ptr, ptr %134, align 8, !tbaa !28
  %136 = load i32, ptr %5, align 4, !tbaa !26
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds %struct.png_text_struct, ptr %135, i64 %137
  %139 = getelementptr inbounds %struct.png_text_struct, ptr %138, i32 0, i32 0
  %140 = load i32, ptr %139, align 8, !tbaa !29
  %141 = icmp sge i32 %140, 0
  br i1 %141, label %142, label %175

142:                                              ; preds = %132
  %143 = load ptr, ptr %3, align 8, !tbaa !5
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.png_info_def, ptr %144, i32 0, i32 22
  %146 = load ptr, ptr %145, align 8, !tbaa !28
  %147 = load i32, ptr %5, align 4, !tbaa !26
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds %struct.png_text_struct, ptr %146, i64 %148
  %150 = getelementptr inbounds %struct.png_text_struct, ptr %149, i32 0, i32 1
  %151 = load ptr, ptr %150, align 8, !tbaa !31
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.png_info_def, ptr %152, i32 0, i32 22
  %154 = load ptr, ptr %153, align 8, !tbaa !28
  %155 = load i32, ptr %5, align 4, !tbaa !26
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds %struct.png_text_struct, ptr %154, i64 %156
  %158 = getelementptr inbounds %struct.png_text_struct, ptr %157, i32 0, i32 2
  %159 = load ptr, ptr %158, align 8, !tbaa !34
  %160 = load ptr, ptr %4, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.png_info_def, ptr %160, i32 0, i32 22
  %162 = load ptr, ptr %161, align 8, !tbaa !28
  %163 = load i32, ptr %5, align 4, !tbaa !26
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds %struct.png_text_struct, ptr %162, i64 %164
  %166 = getelementptr inbounds %struct.png_text_struct, ptr %165, i32 0, i32 0
  %167 = load i32, ptr %166, align 8, !tbaa !29
  call void @png_write_zTXt(ptr noundef %143, ptr noundef %151, ptr noundef %159, i32 noundef %167)
  %168 = load ptr, ptr %4, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.png_info_def, ptr %168, i32 0, i32 22
  %170 = load ptr, ptr %169, align 8, !tbaa !28
  %171 = load i32, ptr %5, align 4, !tbaa !26
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds %struct.png_text_struct, ptr %170, i64 %172
  %174 = getelementptr inbounds %struct.png_text_struct, ptr %173, i32 0, i32 0
  store i32 -2, ptr %174, align 8, !tbaa !29
  br label %211

175:                                              ; preds = %132
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.png_info_def, ptr %176, i32 0, i32 22
  %178 = load ptr, ptr %177, align 8, !tbaa !28
  %179 = load i32, ptr %5, align 4, !tbaa !26
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds %struct.png_text_struct, ptr %178, i64 %180
  %182 = getelementptr inbounds %struct.png_text_struct, ptr %181, i32 0, i32 0
  %183 = load i32, ptr %182, align 8, !tbaa !29
  %184 = icmp eq i32 %183, -1
  br i1 %184, label %185, label %210

185:                                              ; preds = %175
  %186 = load ptr, ptr %3, align 8, !tbaa !5
  %187 = load ptr, ptr %4, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.png_info_def, ptr %187, i32 0, i32 22
  %189 = load ptr, ptr %188, align 8, !tbaa !28
  %190 = load i32, ptr %5, align 4, !tbaa !26
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds %struct.png_text_struct, ptr %189, i64 %191
  %193 = getelementptr inbounds %struct.png_text_struct, ptr %192, i32 0, i32 1
  %194 = load ptr, ptr %193, align 8, !tbaa !31
  %195 = load ptr, ptr %4, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.png_info_def, ptr %195, i32 0, i32 22
  %197 = load ptr, ptr %196, align 8, !tbaa !28
  %198 = load i32, ptr %5, align 4, !tbaa !26
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds %struct.png_text_struct, ptr %197, i64 %199
  %201 = getelementptr inbounds %struct.png_text_struct, ptr %200, i32 0, i32 2
  %202 = load ptr, ptr %201, align 8, !tbaa !34
  call void @png_write_tEXt(ptr noundef %186, ptr noundef %194, ptr noundef %202, i64 noundef 0)
  %203 = load ptr, ptr %4, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.png_info_def, ptr %203, i32 0, i32 22
  %205 = load ptr, ptr %204, align 8, !tbaa !28
  %206 = load i32, ptr %5, align 4, !tbaa !26
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds %struct.png_text_struct, ptr %205, i64 %207
  %209 = getelementptr inbounds %struct.png_text_struct, ptr %208, i32 0, i32 0
  store i32 -3, ptr %209, align 8, !tbaa !29
  br label %210

210:                                              ; preds = %185, %175
  br label %211

211:                                              ; preds = %210, %142
  br label %212

212:                                              ; preds = %211, %131
  br label %213

213:                                              ; preds = %212
  %214 = load i32, ptr %5, align 4, !tbaa !26
  %215 = add nsw i32 %214, 1
  store i32 %215, ptr %5, align 4, !tbaa !26
  br label %48, !llvm.loop !35

216:                                              ; preds = %48
  %217 = load ptr, ptr %4, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.png_info_def, ptr %217, i32 0, i32 2
  %219 = load i32, ptr %218, align 8, !tbaa !23
  %220 = and i32 %219, 65536
  %221 = icmp ne i32 %220, 0
  br i1 %221, label %222, label %230

222:                                              ; preds = %216
  %223 = load ptr, ptr %3, align 8, !tbaa !5
  %224 = load ptr, ptr %4, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.png_info_def, ptr %224, i32 0, i32 35
  %226 = load ptr, ptr %225, align 8, !tbaa !37
  %227 = load ptr, ptr %4, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.png_info_def, ptr %227, i32 0, i32 34
  %229 = load i32, ptr %228, align 4, !tbaa !38
  call void @png_write_eXIf(ptr noundef %223, ptr noundef %226, i32 noundef %229)
  br label %230

230:                                              ; preds = %222, %216
  %231 = load ptr, ptr %3, align 8, !tbaa !5
  %232 = load ptr, ptr %4, align 8, !tbaa !5
  call void @write_unknown_chunks(ptr noundef %231, ptr noundef %232, i32 noundef 8)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %233

233:                                              ; preds = %230, %28
  %234 = load ptr, ptr %3, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.png_struct_def, ptr %234, i32 0, i32 15
  %236 = load i32, ptr %235, align 4, !tbaa !9
  %237 = or i32 %236, 8
  store i32 %237, ptr %235, align 4, !tbaa !9
  %238 = load ptr, ptr %3, align 8, !tbaa !5
  call void @png_write_IEND(ptr noundef %238)
  br label %239

239:                                              ; preds = %233, %8
  ret void
}

declare void @png_benign_error(ptr noundef, ptr noundef) #3

declare void @png_write_IEND(ptr noundef) #3

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 }
attributes #5 = { 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, !12, i64 300}
!10 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !11, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !12, i64 300, !12, i64 304, !12, i64 308, !12, i64 312, !13, i64 320, !6, i64 432, !12, i64 440, !12, i64 444, !12, i64 448, !12, i64 452, !12, i64 456, !12, i64 460, !12, i64 464, !12, i64 468, !12, i64 472, !12, i64 476, !12, i64 480, !12, i64 484, !12, i64 488, !12, i64 492, !12, i64 496, !12, i64 500, !12, i64 504, !12, i64 508, !12, i64 512, !12, i64 516, !11, i64 520, !12, i64 528, !12, i64 532, !12, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !11, i64 576, !12, i64 584, !12, i64 588, !6, i64 592, !14, i64 600, !12, i64 604, !14, i64 608, !7, i64 610, !7, i64 611, !7, i64 612, !7, i64 613, !7, i64 614, !7, i64 615, !7, i64 616, !7, i64 617, !7, i64 618, !7, i64 619, !7, i64 620, !7, i64 621, !7, i64 622, !7, i64 623, !7, i64 624, !14, i64 626, !7, i64 628, !12, i64 632, !15, i64 636, !15, i64 646, !6, i64 656, !12, i64 664, !12, i64 668, !12, i64 672, !12, i64 676, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !6, i64 712, !6, i64 720, !16, i64 728, !16, i64 733, !6, i64 744, !15, i64 752, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !12, i64 840, !12, i64 844, !11, i64 848, !11, i64 856, !11, i64 864, !11, i64 872, !12, i64 880, !12, i64 884, !6, i64 888, !6, i64 896, !12, i64 904, !7, i64 908, !12, i64 940, !6, i64 944, !6, i64 952, !12, i64 960, !12, i64 964, !6, i64 968, !7, i64 976, !7, i64 977, !14, i64 978, !14, i64 980, !12, i64 984, !7, i64 988, !6, i64 992, !6, i64 1000, !6, i64 1008, !6, i64 1016, !6, i64 1024, !6, i64 1032, !6, i64 1040, !7, i64 1048, !12, i64 1052, !12, i64 1056, !12, i64 1060, !11, i64 1064, !17, i64 1072, !11, i64 1104, !6, i64 1112, !11, i64 1120, !12, i64 1128, !12, i64 1132, !6, i64 1136, !7, i64 1144, !18, i64 1176}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"z_stream_s", !6, i64 0, !12, i64 8, !11, i64 16, !6, i64 24, !12, i64 32, !11, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !12, i64 88, !11, i64 96, !11, i64 104}
!14 = !{!"short", !7, i64 0}
!15 = !{!"png_color_16_struct", !7, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!16 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!17 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !11, i64 16, !7, i64 24}
!18 = !{!"png_colorspace", !12, i64 0, !19, i64 4, !20, i64 36, !14, i64 72, !14, i64 74}
!19 = !{!"png_xy", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28}
!20 = !{!"png_XYZ", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32}
!21 = !{!10, !12, i64 604}
!22 = !{!10, !14, i64 600}
!23 = !{!24, !12, i64 8}
!24 = !{!"png_info_def", !12, i64 0, !12, i64 4, !12, i64 8, !11, i64 16, !6, i64 24, !14, i64 32, !14, i64 34, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !18, i64 52, !6, i64 128, !6, i64 136, !12, i64 144, !12, i64 148, !12, i64 152, !6, i64 160, !25, i64 168, !16, i64 176, !6, i64 184, !15, i64 192, !15, i64 202, !12, i64 212, !12, i64 216, !7, i64 220, !12, i64 224, !12, i64 228, !7, i64 232, !12, i64 236, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !12, i64 272, !12, i64 276, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !12, i64 300, !6, i64 304, !12, i64 312, !6, i64 320, !12, i64 328, !7, i64 332, !6, i64 336, !6, i64 344, !6, i64 352}
!25 = !{!"png_time_struct", !14, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!26 = !{!12, !12, i64 0}
!27 = !{!24, !12, i64 148}
!28 = !{!24, !6, i64 160}
!29 = !{!30, !12, i64 0}
!30 = !{!"png_text_struct", !12, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 32, !6, i64 40, !6, i64 48}
!31 = !{!30, !6, i64 8}
!32 = !{!30, !6, i64 40}
!33 = !{!30, !6, i64 48}
!34 = !{!30, !6, i64 16}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!24, !6, i64 240}
!38 = !{!24, !12, i64 236}


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

@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
declare hidden void @write_unknown_chunks(ptr noalias noundef, ptr noalias noundef, i32 noundef) local_unnamed_addr #0

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

declare void @png_write_eXIf(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @png_write_tIME(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @png_write_iTXt(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @png_write_zTXt(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @png_write_tEXt(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @png_write_end(ptr noalias noundef %0, ptr noalias noundef %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %0, null
  br i1 %3, label %88, label %4

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 300
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = and i32 %6, 4
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %9, label %10

9:                                                ; preds = %4
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.3) #3
  unreachable

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %0, i64 604
  %12 = load i32, ptr %11, align 4, !tbaa !20
  %13 = getelementptr inbounds i8, ptr %0, i64 600
  %14 = load i16, ptr %13, align 8, !tbaa !21
  %15 = zext i16 %14 to i32
  %16 = icmp sgt i32 %12, %15
  br i1 %16, label %17, label %18

17:                                               ; preds = %10
  tail call void @png_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.4) #4
  br label %18

18:                                               ; preds = %17, %10
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %85, label %19

19:                                               ; preds = %18
  %20 = getelementptr inbounds i8, ptr %1, i64 8
  %21 = load i32, ptr %20, align 8, !tbaa !22
  %22 = and i32 %21, 512
  %.not63 = icmp eq i32 %22, 0
  br i1 %.not63, label %29, label %23

23:                                               ; preds = %19
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = and i32 %24, 512
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %23
  %28 = getelementptr inbounds i8, ptr %1, i64 168
  tail call void @png_write_tIME(ptr noundef nonnull %0, ptr noundef nonnull %28) #4
  br label %29

29:                                               ; preds = %27, %23, %19
  %30 = getelementptr inbounds i8, ptr %1, i64 148
  %31 = load i32, ptr %30, align 4, !tbaa !25
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %29
  %33 = getelementptr inbounds i8, ptr %1, i64 160
  %.pre = load ptr, ptr %33, align 8, !tbaa !26
  br label %34

34:                                               ; preds = %.lr.ph, %72
  %35 = phi ptr [ %.pre, %.lr.ph ], [ %73, %72 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %72 ]
  %36 = getelementptr inbounds %struct.png_text_struct, ptr %35, i64 %indvars.iv
  %37 = load i32, ptr %36, align 8, !tbaa !27
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %39, label %54

39:                                               ; preds = %34
  %40 = getelementptr inbounds i8, ptr %36, i64 8
  %41 = load ptr, ptr %40, align 8, !tbaa !29
  %42 = getelementptr inbounds i8, ptr %36, i64 40
  %43 = load ptr, ptr %42, align 8, !tbaa !30
  %44 = getelementptr inbounds i8, ptr %36, i64 48
  %45 = load ptr, ptr %44, align 8, !tbaa !31
  %46 = getelementptr inbounds i8, ptr %36, i64 16
  %47 = load ptr, ptr %46, align 8, !tbaa !32
  tail call void @png_write_iTXt(ptr noundef nonnull %0, i32 noundef %37, ptr noundef %41, ptr noundef %43, ptr noundef %45, ptr noundef %47) #4
  %48 = load ptr, ptr %33, align 8, !tbaa !26
  %49 = getelementptr inbounds %struct.png_text_struct, ptr %48, i64 %indvars.iv
  %50 = load i32, ptr %49, align 8, !tbaa !27
  %51 = icmp eq i32 %50, -1
  br i1 %51, label %52, label %53

52:                                               ; preds = %39
  store i32 -3, ptr %49, align 8, !tbaa !27
  br label %72

53:                                               ; preds = %39
  store i32 -2, ptr %49, align 8, !tbaa !27
  br label %72

54:                                               ; preds = %34
  %55 = icmp sgt i32 %37, -1
  br i1 %55, label %56, label %63

56:                                               ; preds = %54
  %57 = getelementptr inbounds i8, ptr %36, i64 8
  %58 = load ptr, ptr %57, align 8, !tbaa !29
  %59 = getelementptr inbounds i8, ptr %36, i64 16
  %60 = load ptr, ptr %59, align 8, !tbaa !32
  tail call void @png_write_zTXt(ptr noundef nonnull %0, ptr noundef %58, ptr noundef %60, i32 noundef 0) #4
  %61 = load ptr, ptr %33, align 8, !tbaa !26
  %62 = getelementptr inbounds %struct.png_text_struct, ptr %61, i64 %indvars.iv
  store i32 -2, ptr %62, align 8, !tbaa !27
  br label %72

63:                                               ; preds = %54
  %64 = icmp eq i32 %37, -1
  br i1 %64, label %65, label %72

65:                                               ; preds = %63
  %66 = getelementptr inbounds i8, ptr %36, i64 8
  %67 = load ptr, ptr %66, align 8, !tbaa !29
  %68 = getelementptr inbounds i8, ptr %36, i64 16
  %69 = load ptr, ptr %68, align 8, !tbaa !32
  tail call void @png_write_tEXt(ptr noundef nonnull %0, ptr noundef %67, ptr noundef %69, i64 noundef 0) #4
  %70 = load ptr, ptr %33, align 8, !tbaa !26
  %71 = getelementptr inbounds %struct.png_text_struct, ptr %70, i64 %indvars.iv
  store i32 -3, ptr %71, align 8, !tbaa !27
  br label %72

72:                                               ; preds = %53, %52, %63, %65, %56
  %73 = phi ptr [ %48, %53 ], [ %48, %52 ], [ %35, %63 ], [ %70, %65 ], [ %61, %56 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %74 = load i32, ptr %30, align 4, !tbaa !25
  %75 = sext i32 %74 to i64
  %76 = icmp slt i64 %indvars.iv.next, %75
  br i1 %76, label %34, label %._crit_edge, !llvm.loop !33

._crit_edge:                                      ; preds = %72, %29
  %77 = load i32, ptr %20, align 8, !tbaa !22
  %78 = and i32 %77, 65536
  %.not64 = icmp eq i32 %78, 0
  br i1 %.not64, label %84, label %79

79:                                               ; preds = %._crit_edge
  %80 = getelementptr inbounds i8, ptr %1, i64 240
  %81 = load ptr, ptr %80, align 8, !tbaa !35
  %82 = getelementptr inbounds i8, ptr %1, i64 236
  %83 = load i32, ptr %82, align 4, !tbaa !36
  tail call void @png_write_eXIf(ptr noundef nonnull %0, ptr noundef %81, i32 noundef %83) #4
  br label %84

84:                                               ; preds = %79, %._crit_edge
  tail call void @write_unknown_chunks(ptr noundef nonnull %0, ptr noundef nonnull %1, i32 noundef 8)
  br label %85

85:                                               ; preds = %84, %18
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = or i32 %86, 8
  store i32 %87, ptr %5, align 4, !tbaa !5
  tail call void @png_write_IEND(ptr noundef nonnull %0) #4
  br label %88

88:                                               ; preds = %2, %85
  ret void
}

declare void @png_benign_error(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @png_write_IEND(ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #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 = { noreturn nounwind }
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, !11, i64 300}
!6 = !{!"png_struct_def", !7, i64 0, !9, i64 200, !9, i64 208, !10, i64 216, !9, i64 224, !9, i64 232, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !9, i64 272, !9, i64 280, !9, i64 288, !7, i64 296, !7, i64 297, !11, i64 300, !11, i64 304, !11, i64 308, !11, i64 312, !12, i64 320, !9, i64 432, !11, i64 440, !11, i64 444, !11, i64 448, !11, i64 452, !11, i64 456, !11, i64 460, !11, i64 464, !11, i64 468, !11, i64 472, !11, i64 476, !11, i64 480, !11, i64 484, !11, i64 488, !11, i64 492, !11, i64 496, !11, i64 500, !11, i64 504, !11, i64 508, !11, i64 512, !11, i64 516, !10, i64 520, !11, i64 528, !11, i64 532, !11, i64 536, !9, i64 544, !9, i64 552, !9, i64 560, !9, i64 568, !10, i64 576, !11, i64 584, !11, i64 588, !9, i64 592, !13, i64 600, !11, i64 604, !13, i64 608, !7, i64 610, !7, i64 611, !7, i64 612, !7, i64 613, !7, i64 614, !7, i64 615, !7, i64 616, !7, i64 617, !7, i64 618, !7, i64 619, !7, i64 620, !7, i64 621, !7, i64 622, !7, i64 623, !7, i64 624, !13, i64 626, !7, i64 628, !11, i64 632, !14, i64 636, !14, i64 646, !9, i64 656, !11, i64 664, !11, i64 668, !11, i64 672, !11, i64 676, !9, i64 680, !9, i64 688, !9, i64 696, !9, i64 704, !9, i64 712, !9, i64 720, !15, i64 728, !15, i64 733, !9, i64 744, !14, i64 752, !9, i64 768, !9, i64 776, !9, i64 784, !9, i64 792, !9, i64 800, !9, i64 808, !9, i64 816, !9, i64 824, !9, i64 832, !11, i64 840, !11, i64 844, !10, i64 848, !10, i64 856, !10, i64 864, !10, i64 872, !11, i64 880, !11, i64 884, !9, i64 888, !9, i64 896, !11, i64 904, !7, i64 908, !11, i64 940, !9, i64 944, !9, i64 952, !11, i64 960, !11, i64 964, !9, i64 968, !7, i64 976, !7, i64 977, !13, i64 978, !13, i64 980, !11, i64 984, !7, i64 988, !9, i64 992, !9, i64 1000, !9, i64 1008, !9, i64 1016, !9, i64 1024, !9, i64 1032, !9, i64 1040, !7, i64 1048, !11, i64 1052, !11, i64 1056, !11, i64 1060, !10, i64 1064, !16, i64 1072, !10, i64 1104, !9, i64 1112, !10, i64 1120, !11, i64 1128, !11, i64 1132, !9, i64 1136, !7, i64 1144, !17, i64 1176}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!"z_stream_s", !9, i64 0, !11, i64 8, !10, i64 16, !9, i64 24, !11, i64 32, !10, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !11, i64 88, !10, i64 96, !10, i64 104}
!13 = !{!"short", !7, i64 0}
!14 = !{!"png_color_16_struct", !7, i64 0, !13, i64 2, !13, i64 4, !13, i64 6, !13, i64 8}
!15 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!16 = !{!"png_unknown_chunk_t", !7, i64 0, !9, i64 8, !10, i64 16, !7, i64 24}
!17 = !{!"png_colorspace", !11, i64 0, !18, i64 4, !19, i64 36, !13, i64 72, !13, i64 74}
!18 = !{!"png_xy", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!19 = !{!"png_XYZ", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!20 = !{!6, !11, i64 604}
!21 = !{!6, !13, i64 600}
!22 = !{!23, !11, i64 8}
!23 = !{!"png_info_def", !11, i64 0, !11, i64 4, !11, i64 8, !10, i64 16, !9, i64 24, !13, i64 32, !13, i64 34, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !17, i64 52, !9, i64 128, !9, i64 136, !11, i64 144, !11, i64 148, !11, i64 152, !9, i64 160, !24, i64 168, !15, i64 176, !9, i64 184, !14, i64 192, !14, i64 202, !11, i64 212, !11, i64 216, !7, i64 220, !11, i64 224, !11, i64 228, !7, i64 232, !11, i64 236, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !11, i64 272, !11, i64 276, !9, i64 280, !9, i64 288, !7, i64 296, !7, i64 297, !11, i64 300, !9, i64 304, !11, i64 312, !9, i64 320, !11, i64 328, !7, i64 332, !9, i64 336, !9, i64 344, !9, i64 352}
!24 = !{!"png_time_struct", !13, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!25 = !{!23, !11, i64 148}
!26 = !{!23, !9, i64 160}
!27 = !{!28, !11, i64 0}
!28 = !{!"png_text_struct", !11, i64 0, !9, i64 8, !9, i64 16, !10, i64 24, !10, i64 32, !9, i64 40, !9, i64 48}
!29 = !{!28, !9, i64 8}
!30 = !{!28, !9, i64 40}
!31 = !{!28, !9, i64 48}
!32 = !{!28, !9, i64 16}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!23, !9, i64 240}
!36 = !{!23, !11, i64 236}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass