; LLVM IR from rdguez-mariano/fast_imas_IPOL :: io_png/libs/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_struct = type { i64, i64, i64, i64, ptr, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, [8 x i8], float, i8, i32, i32, ptr, %struct.png_time_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, %struct.png_color_16_struct, i64, i64, i8, i64, i64, i8, ptr, float, float, float, float, float, float, float, float, ptr, i64, i64, ptr, ptr, i8, i8, i64, ptr, i64, ptr, ptr, i64, i8, ptr, i64, i8, double, double, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
%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 }
%struct.png_text_struct = type { i32, ptr, ptr, i64 }

@.str.25 = external hidden unnamed_addr constant [26 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

declare void @png_warning(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 ptr @png_malloc_warn(ptr noundef, i64 noundef) #2

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

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

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

21:                                               ; preds = %4
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %27, label %24

24:                                               ; preds = %21
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %28

27:                                               ; preds = %24, %21, %4
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %267

28:                                               ; preds = %24
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.png_info_struct, ptr %29, i32 0, i32 18
  %31 = load i32, ptr %30, align 4, !tbaa !11
  %32 = load i32, ptr %9, align 4, !tbaa !9
  %33 = add nsw i32 %31, %32
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.png_info_struct, ptr %34, i32 0, i32 19
  %36 = load i32, ptr %35, align 8, !tbaa !20
  %37 = icmp sgt i32 %33, %36
  br i1 %37, label %38, label %114

38:                                               ; preds = %28
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.png_info_struct, ptr %39, i32 0, i32 20
  %41 = load ptr, ptr %40, align 8, !tbaa !21
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %87

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.png_info_struct, ptr %44, i32 0, i32 19
  %46 = load i32, ptr %45, align 8, !tbaa !20
  store i32 %46, ptr %13, align 4, !tbaa !9
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.png_info_struct, ptr %47, i32 0, i32 18
  %49 = load i32, ptr %48, align 4, !tbaa !11
  %50 = load i32, ptr %9, align 4, !tbaa !9
  %51 = add nsw i32 %49, %50
  %52 = add nsw i32 %51, 8
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.png_info_struct, ptr %53, i32 0, i32 19
  store i32 %52, ptr %54, align 8, !tbaa !20
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.png_info_struct, ptr %55, i32 0, i32 20
  %57 = load ptr, ptr %56, align 8, !tbaa !21
  store ptr %57, ptr %12, align 8, !tbaa !5
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.png_info_struct, ptr %59, i32 0, i32 19
  %61 = load i32, ptr %60, align 8, !tbaa !20
  %62 = sext i32 %61 to i64
  %63 = mul i64 %62, 32
  %64 = call ptr @png_malloc_warn(ptr noundef %58, i64 noundef %63)
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.png_info_struct, ptr %65, i32 0, i32 20
  store ptr %64, ptr %66, align 8, !tbaa !21
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.png_info_struct, ptr %67, i32 0, i32 20
  %69 = load ptr, ptr %68, align 8, !tbaa !21
  %70 = icmp eq ptr %69, null
  br i1 %70, label %71, label %74

71:                                               ; preds = %43
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  call void @png_free(ptr noundef %72, ptr noundef %73)
  store i32 1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %84

74:                                               ; preds = %43
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.png_info_struct, ptr %75, i32 0, i32 20
  %77 = load ptr, ptr %76, align 8, !tbaa !21
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = load i32, ptr %13, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = mul i64 %80, 32
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %77, ptr align 8 %78, i64 %81, i1 false)
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = load ptr, ptr %12, align 8, !tbaa !5
  call void @png_free(ptr noundef %82, ptr noundef %83)
  store i32 0, ptr %11, align 4
  br label %84

84:                                               ; preds = %74, %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %85 = load i32, ptr %11, align 4
  switch i32 %85, label %267 [
    i32 0, label %86
  ]

86:                                               ; preds = %84
  br label %113

87:                                               ; preds = %38
  %88 = load i32, ptr %9, align 4, !tbaa !9
  %89 = add nsw i32 %88, 8
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.png_info_struct, ptr %90, i32 0, i32 19
  store i32 %89, ptr %91, align 8, !tbaa !20
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.png_info_struct, ptr %92, i32 0, i32 18
  store i32 0, ptr %93, align 4, !tbaa !11
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.png_info_struct, ptr %95, i32 0, i32 19
  %97 = load i32, ptr %96, align 8, !tbaa !20
  %98 = sext i32 %97 to i64
  %99 = mul i64 %98, 32
  %100 = call ptr @png_malloc_warn(ptr noundef %94, i64 noundef %99)
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.png_info_struct, ptr %101, i32 0, i32 20
  store ptr %100, ptr %102, align 8, !tbaa !21
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.png_info_struct, ptr %103, i32 0, i32 20
  %105 = load ptr, ptr %104, align 8, !tbaa !21
  %106 = icmp eq ptr %105, null
  br i1 %106, label %107, label %108

107:                                              ; preds = %87
  store i32 1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %267

108:                                              ; preds = %87
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.png_info_struct, ptr %109, i32 0, i32 48
  %111 = load i64, ptr %110, align 8, !tbaa !22
  %112 = or i64 %111, 16384
  store i64 %112, ptr %110, align 8, !tbaa !22
  br label %113

113:                                              ; preds = %108, %86
  br label %114

114:                                              ; preds = %113, %28
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %115

115:                                              ; preds = %263, %114
  %116 = load i32, ptr %10, align 4, !tbaa !9
  %117 = load i32, ptr %9, align 4, !tbaa !9
  %118 = icmp slt i32 %116, %117
  br i1 %118, label %119, label %266

119:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.png_info_struct, ptr %120, i32 0, i32 20
  %122 = load ptr, ptr %121, align 8, !tbaa !21
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.png_info_struct, ptr %123, i32 0, i32 18
  %125 = load i32, ptr %124, align 4, !tbaa !11
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds %struct.png_text_struct, ptr %122, i64 %126
  store ptr %127, ptr %18, align 8, !tbaa !5
  %128 = load ptr, ptr %8, align 8, !tbaa !5
  %129 = load i32, ptr %10, align 4, !tbaa !9
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds %struct.png_text_struct, ptr %128, i64 %130
  %132 = getelementptr inbounds %struct.png_text_struct, ptr %131, i32 0, i32 1
  %133 = load ptr, ptr %132, align 8, !tbaa !23
  %134 = icmp eq ptr %133, null
  br i1 %134, label %135, label %136

135:                                              ; preds = %119
  store i32 4, ptr %11, align 4
  br label %260

136:                                              ; preds = %119
  %137 = load ptr, ptr %8, align 8, !tbaa !5
  %138 = load i32, ptr %10, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds %struct.png_text_struct, ptr %137, i64 %139
  %141 = getelementptr inbounds %struct.png_text_struct, ptr %140, i32 0, i32 1
  %142 = load ptr, ptr %141, align 8, !tbaa !23
  %143 = call i64 @strlen(ptr noundef %142) #6
  store i64 %143, ptr %15, align 8, !tbaa !25
  %144 = load ptr, ptr %8, align 8, !tbaa !5
  %145 = load i32, ptr %10, align 4, !tbaa !9
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds %struct.png_text_struct, ptr %144, i64 %146
  %148 = getelementptr inbounds %struct.png_text_struct, ptr %147, i32 0, i32 0
  %149 = load i32, ptr %148, align 8, !tbaa !26
  %150 = icmp sle i32 %149, 0
  br i1 %150, label %151, label %152

151:                                              ; preds = %136
  store i64 0, ptr %16, align 8, !tbaa !25
  store i64 0, ptr %17, align 8, !tbaa !25
  br label %154

152:                                              ; preds = %136
  %153 = load ptr, ptr %6, align 8, !tbaa !5
  call void @png_warning(ptr noundef %153, ptr noundef @.str.25)
  store i32 4, ptr %11, align 4
  br label %260

154:                                              ; preds = %151
  %155 = load ptr, ptr %8, align 8, !tbaa !5
  %156 = load i32, ptr %10, align 4, !tbaa !9
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds %struct.png_text_struct, ptr %155, i64 %157
  %159 = getelementptr inbounds %struct.png_text_struct, ptr %158, i32 0, i32 2
  %160 = load ptr, ptr %159, align 8, !tbaa !27
  %161 = icmp eq ptr %160, null
  br i1 %161, label %173, label %162

162:                                              ; preds = %154
  %163 = load ptr, ptr %8, align 8, !tbaa !5
  %164 = load i32, ptr %10, align 4, !tbaa !9
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds %struct.png_text_struct, ptr %163, i64 %165
  %167 = getelementptr inbounds %struct.png_text_struct, ptr %166, i32 0, i32 2
  %168 = load ptr, ptr %167, align 8, !tbaa !27
  %169 = getelementptr inbounds i8, ptr %168, i64 0
  %170 = load i8, ptr %169, align 1, !tbaa !28
  %171 = sext i8 %170 to i32
  %172 = icmp eq i32 %171, 0
  br i1 %172, label %173, label %176

173:                                              ; preds = %162, %154
  store i64 0, ptr %14, align 8, !tbaa !25
  %174 = load ptr, ptr %18, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.png_text_struct, ptr %174, i32 0, i32 0
  store i32 -1, ptr %175, align 8, !tbaa !26
  br label %192

176:                                              ; preds = %162
  %177 = load ptr, ptr %8, align 8, !tbaa !5
  %178 = load i32, ptr %10, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds %struct.png_text_struct, ptr %177, i64 %179
  %181 = getelementptr inbounds %struct.png_text_struct, ptr %180, i32 0, i32 2
  %182 = load ptr, ptr %181, align 8, !tbaa !27
  %183 = call i64 @strlen(ptr noundef %182) #6
  store i64 %183, ptr %14, align 8, !tbaa !25
  %184 = load ptr, ptr %8, align 8, !tbaa !5
  %185 = load i32, ptr %10, align 4, !tbaa !9
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds %struct.png_text_struct, ptr %184, i64 %186
  %188 = getelementptr inbounds %struct.png_text_struct, ptr %187, i32 0, i32 0
  %189 = load i32, ptr %188, align 8, !tbaa !26
  %190 = load ptr, ptr %18, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.png_text_struct, ptr %190, i32 0, i32 0
  store i32 %189, ptr %191, align 8, !tbaa !26
  br label %192

192:                                              ; preds = %176, %173
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = load i64, ptr %15, align 8, !tbaa !25
  %195 = load i64, ptr %14, align 8, !tbaa !25
  %196 = add i64 %194, %195
  %197 = load i64, ptr %16, align 8, !tbaa !25
  %198 = add i64 %196, %197
  %199 = load i64, ptr %17, align 8, !tbaa !25
  %200 = add i64 %198, %199
  %201 = add i64 %200, 4
  %202 = call ptr @png_malloc_warn(ptr noundef %193, i64 noundef %201)
  %203 = load ptr, ptr %18, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.png_text_struct, ptr %203, i32 0, i32 1
  store ptr %202, ptr %204, align 8, !tbaa !23
  %205 = load ptr, ptr %18, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.png_text_struct, ptr %205, i32 0, i32 1
  %207 = load ptr, ptr %206, align 8, !tbaa !23
  %208 = icmp eq ptr %207, null
  br i1 %208, label %209, label %210

209:                                              ; preds = %192
  store i32 1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %260

210:                                              ; preds = %192
  %211 = load ptr, ptr %18, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.png_text_struct, ptr %211, i32 0, i32 1
  %213 = load ptr, ptr %212, align 8, !tbaa !23
  %214 = load ptr, ptr %8, align 8, !tbaa !5
  %215 = load i32, ptr %10, align 4, !tbaa !9
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds %struct.png_text_struct, ptr %214, i64 %216
  %218 = getelementptr inbounds %struct.png_text_struct, ptr %217, i32 0, i32 1
  %219 = load ptr, ptr %218, align 8, !tbaa !23
  %220 = load i64, ptr %15, align 8, !tbaa !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %213, ptr align 1 %219, i64 %220, i1 false)
  %221 = load ptr, ptr %18, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.png_text_struct, ptr %221, i32 0, i32 1
  %223 = load ptr, ptr %222, align 8, !tbaa !23
  %224 = load i64, ptr %15, align 8, !tbaa !25
  %225 = getelementptr inbounds i8, ptr %223, i64 %224
  store i8 0, ptr %225, align 1, !tbaa !28
  %226 = load ptr, ptr %18, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.png_text_struct, ptr %226, i32 0, i32 1
  %228 = load ptr, ptr %227, align 8, !tbaa !23
  %229 = load i64, ptr %15, align 8, !tbaa !25
  %230 = getelementptr inbounds i8, ptr %228, i64 %229
  %231 = getelementptr inbounds i8, ptr %230, i64 1
  %232 = load ptr, ptr %18, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.png_text_struct, ptr %232, i32 0, i32 2
  store ptr %231, ptr %233, align 8, !tbaa !27
  %234 = load i64, ptr %14, align 8, !tbaa !25
  %235 = icmp ne i64 %234, 0
  br i1 %235, label %236, label %247

236:                                              ; preds = %210
  %237 = load ptr, ptr %18, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.png_text_struct, ptr %237, i32 0, i32 2
  %239 = load ptr, ptr %238, align 8, !tbaa !27
  %240 = load ptr, ptr %8, align 8, !tbaa !5
  %241 = load i32, ptr %10, align 4, !tbaa !9
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds %struct.png_text_struct, ptr %240, i64 %242
  %244 = getelementptr inbounds %struct.png_text_struct, ptr %243, i32 0, i32 2
  %245 = load ptr, ptr %244, align 8, !tbaa !27
  %246 = load i64, ptr %14, align 8, !tbaa !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %239, ptr align 1 %245, i64 %246, i1 false)
  br label %247

247:                                              ; preds = %236, %210
  %248 = load ptr, ptr %18, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.png_text_struct, ptr %248, i32 0, i32 2
  %250 = load ptr, ptr %249, align 8, !tbaa !27
  %251 = load i64, ptr %14, align 8, !tbaa !25
  %252 = getelementptr inbounds i8, ptr %250, i64 %251
  store i8 0, ptr %252, align 1, !tbaa !28
  %253 = load i64, ptr %14, align 8, !tbaa !25
  %254 = load ptr, ptr %18, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.png_text_struct, ptr %254, i32 0, i32 3
  store i64 %253, ptr %255, align 8, !tbaa !29
  %256 = load ptr, ptr %7, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.png_info_struct, ptr %256, i32 0, i32 18
  %258 = load i32, ptr %257, align 4, !tbaa !11
  %259 = add nsw i32 %258, 1
  store i32 %259, ptr %257, align 4, !tbaa !11
  store i32 0, ptr %11, align 4
  br label %260

260:                                              ; preds = %247, %209, %152, %135
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %261 = load i32, ptr %11, align 4
  switch i32 %261, label %267 [
    i32 0, label %262
    i32 4, label %263
  ]

262:                                              ; preds = %260
  br label %263

263:                                              ; preds = %262, %260
  %264 = load i32, ptr %10, align 4, !tbaa !9
  %265 = add nsw i32 %264, 1
  store i32 %265, ptr %10, align 4, !tbaa !9
  br label %115, !llvm.loop !30

266:                                              ; preds = %115
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %267

267:                                              ; preds = %266, %260, %107, %84, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %268 = load i32, ptr %5, align 4
  ret i32 %268
}

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 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 68}
!12 = !{!"png_info_struct", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !6, i64 32, !14, i64 40, !14, i64 42, !7, i64 44, !7, i64 45, !7, i64 46, !7, i64 47, !7, i64 48, !7, i64 49, !7, i64 50, !7, i64 51, !7, i64 52, !15, i64 60, !7, i64 64, !10, i64 68, !10, i64 72, !6, i64 80, !16, i64 88, !17, i64 96, !6, i64 104, !18, i64 112, !18, i64 122, !13, i64 136, !13, i64 144, !7, i64 152, !13, i64 160, !13, i64 168, !7, i64 176, !6, i64 184, !15, i64 192, !15, i64 196, !15, i64 200, !15, i64 204, !15, i64 208, !15, i64 212, !15, i64 216, !15, i64 220, !6, i64 224, !13, i64 232, !13, i64 240, !6, i64 248, !6, i64 256, !7, i64 264, !7, i64 265, !13, i64 272, !6, i64 280, !13, i64 288, !6, i64 296, !6, i64 304, !13, i64 312, !7, i64 320, !6, i64 328, !13, i64 336, !7, i64 344, !19, i64 352, !19, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !13, i64 392, !13, i64 400, !13, i64 408, !13, i64 416, !13, i64 424, !13, i64 432, !13, i64 440, !13, i64 448, !13, i64 456}
!13 = !{!"long", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!"png_time_struct", !14, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!17 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!18 = !{!"png_color_16_struct", !7, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!19 = !{!"double", !7, i64 0}
!20 = !{!12, !10, i64 72}
!21 = !{!12, !6, i64 80}
!22 = !{!12, !13, i64 272}
!23 = !{!24, !6, i64 8}
!24 = !{!"png_text_struct", !10, i64 0, !6, i64 8, !6, i64 16, !13, i64 24}
!25 = !{!13, !13, i64 0}
!26 = !{!24, !10, i64 0}
!27 = !{!24, !6, i64 16}
!28 = !{!7, !7, i64 0}
!29 = !{!24, !13, i64 24}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


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

%struct.png_text_struct = type { i32, ptr, ptr, i64 }

@.str.25 = external hidden unnamed_addr constant [26 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 void @png_warning(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @png_set_text_2(ptr noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3) local_unnamed_addr #3 {
  %5 = icmp eq ptr %0, null
  %6 = icmp eq ptr %1, null
  %or.cond = or i1 %5, %6
  %7 = icmp eq i32 %3, 0
  %or.cond3 = or i1 %or.cond, %7
  br i1 %or.cond3, label %.loopexit, label %8

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %1, i64 68
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = add nsw i32 %10, %3
  %12 = getelementptr inbounds i8, ptr %1, i64 72
  %13 = load i32, ptr %12, align 8, !tbaa !18
  %14 = icmp sgt i32 %11, %13
  br i1 %14, label %15, label %36

15:                                               ; preds = %8
  %16 = getelementptr inbounds i8, ptr %1, i64 80
  %17 = load ptr, ptr %16, align 8, !tbaa !19
  %.not = icmp eq ptr %17, null
  br i1 %.not, label %26, label %18

18:                                               ; preds = %15
  %19 = add nsw i32 %11, 8
  store i32 %19, ptr %12, align 8, !tbaa !18
  %20 = sext i32 %19 to i64
  %21 = shl nsw i64 %20, 5
  %22 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %21) #4
  store ptr %22, ptr %16, align 8, !tbaa !19
  %.not97 = icmp eq ptr %22, null
  br i1 %.not97, label %.thread, label %23

.thread:                                          ; preds = %18
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %17) #4
  br label %.loopexit

23:                                               ; preds = %18
  %24 = sext i32 %13 to i64
  %25 = shl nsw i64 %24, 5
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %22, ptr nonnull align 8 %17, i64 %25, i1 false)
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %17) #4
  br label %36

26:                                               ; preds = %15
  %27 = add nsw i32 %3, 8
  store i32 %27, ptr %12, align 8, !tbaa !18
  store i32 0, ptr %9, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = shl nsw i64 %28, 5
  %30 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %29) #4
  store ptr %30, ptr %16, align 8, !tbaa !19
  %31 = icmp eq ptr %30, null
  br i1 %31, label %.loopexit, label %32

32:                                               ; preds = %26
  %33 = getelementptr inbounds i8, ptr %1, i64 272
  %34 = load i64, ptr %33, align 8, !tbaa !20
  %35 = or i64 %34, 16384
  store i64 %35, ptr %33, align 8, !tbaa !20
  br label %36

36:                                               ; preds = %23, %32, %8
  %37 = icmp sgt i32 %3, 0
  br i1 %37, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %36
  %38 = getelementptr inbounds i8, ptr %1, i64 80
  %wide.trip.count = zext nneg i32 %3 to i64
  br label %39

39:                                               ; preds = %.lr.ph, %84
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %84 ]
  %40 = load ptr, ptr %38, align 8, !tbaa !19
  %41 = load i32, ptr %9, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds %struct.png_text_struct, ptr %40, i64 %42
  %44 = getelementptr inbounds %struct.png_text_struct, ptr %2, i64 %indvars.iv
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  %46 = load ptr, ptr %45, align 8, !tbaa !21
  %47 = icmp eq ptr %46, null
  br i1 %47, label %84, label %48

48:                                               ; preds = %39
  %49 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %46) #5
  %50 = load i32, ptr %44, align 8, !tbaa !23
  %51 = icmp slt i32 %50, 1
  br i1 %51, label %52, label %56

52:                                               ; preds = %48
  %53 = getelementptr inbounds i8, ptr %44, i64 16
  %54 = load ptr, ptr %53, align 8, !tbaa !24
  %55 = icmp eq ptr %54, null
  br i1 %55, label %62, label %57

56:                                               ; preds = %48
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.25) #4
  br label %84

57:                                               ; preds = %52
  %58 = load i8, ptr %54, align 1, !tbaa !25
  %59 = icmp eq i8 %58, 0
  br i1 %59, label %62, label %60

60:                                               ; preds = %57
  %61 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %54) #5
  br label %62

62:                                               ; preds = %52, %57, %60
  %storemerge = phi i32 [ %50, %60 ], [ -1, %57 ], [ -1, %52 ]
  %.087 = phi i64 [ %61, %60 ], [ 0, %57 ], [ 0, %52 ]
  store i32 %storemerge, ptr %43, align 8, !tbaa !23
  %63 = add i64 %49, 4
  %64 = add i64 %63, %.087
  %65 = tail call ptr @png_malloc_warn(ptr noundef %0, i64 noundef %64) #4
  %66 = getelementptr inbounds i8, ptr %43, i64 8
  store ptr %65, ptr %66, align 8, !tbaa !21
  %67 = icmp eq ptr %65, null
  br i1 %67, label %.loopexit, label %68

68:                                               ; preds = %62
  %69 = load ptr, ptr %45, align 8, !tbaa !21
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %65, ptr align 1 %69, i64 %49, i1 false)
  %70 = load ptr, ptr %66, align 8, !tbaa !21
  %71 = getelementptr inbounds i8, ptr %70, i64 %49
  store i8 0, ptr %71, align 1, !tbaa !25
  %72 = load ptr, ptr %66, align 8, !tbaa !21
  %73 = getelementptr inbounds i8, ptr %72, i64 %49
  %74 = getelementptr inbounds i8, ptr %73, i64 1
  %75 = getelementptr inbounds i8, ptr %43, i64 16
  store ptr %74, ptr %75, align 8, !tbaa !24
  %.not98 = icmp eq i64 %.087, 0
  br i1 %.not98, label %78, label %76

76:                                               ; preds = %68
  %77 = load ptr, ptr %53, align 8, !tbaa !24
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %74, ptr align 1 %77, i64 %.087, i1 false)
  %.pre = load ptr, ptr %75, align 8, !tbaa !24
  br label %78

78:                                               ; preds = %76, %68
  %79 = phi ptr [ %.pre, %76 ], [ %74, %68 ]
  %80 = getelementptr inbounds i8, ptr %79, i64 %.087
  store i8 0, ptr %80, align 1, !tbaa !25
  %81 = getelementptr inbounds i8, ptr %43, i64 24
  store i64 %.087, ptr %81, align 8, !tbaa !26
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %9, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %78, %56, %39
  %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 %.loopexit, label %39, !llvm.loop !27

.loopexit:                                        ; preds = %84, %62, %36, %.thread, %26, %4
  %.4 = phi i32 [ 0, %4 ], [ 1, %26 ], [ 1, %.thread ], [ 0, %36 ], [ 0, %84 ], [ 1, %62 ]
  ret i32 %.4
}

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 = { 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 #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 }
attributes #5 = { nounwind willreturn memory(read) }

!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, !13, i64 68}
!6 = !{!"png_info_struct", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 40, !11, i64 42, !8, i64 44, !8, i64 45, !8, i64 46, !8, i64 47, !8, i64 48, !8, i64 49, !8, i64 50, !8, i64 51, !8, i64 52, !12, i64 60, !8, i64 64, !13, i64 68, !13, i64 72, !10, i64 80, !14, i64 88, !15, i64 96, !10, i64 104, !16, i64 112, !16, i64 122, !7, i64 136, !7, i64 144, !8, i64 152, !7, i64 160, !7, i64 168, !8, i64 176, !10, i64 184, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !10, i64 224, !7, i64 232, !7, i64 240, !10, i64 248, !10, i64 256, !8, i64 264, !8, i64 265, !7, i64 272, !10, i64 280, !7, i64 288, !10, i64 296, !10, i64 304, !7, i64 312, !8, i64 320, !10, i64 328, !7, i64 336, !8, i64 344, !17, i64 352, !17, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !7, i64 392, !7, i64 400, !7, i64 408, !7, i64 416, !7, i64 424, !7, i64 432, !7, i64 440, !7, i64 448, !7, i64 456}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!"float", !8, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!"png_time_struct", !11, i64 0, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !8, i64 6}
!15 = !{!"png_color_8_struct", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4}
!16 = !{!"png_color_16_struct", !8, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !11, i64 8}
!17 = !{!"double", !8, i64 0}
!18 = !{!6, !13, i64 72}
!19 = !{!6, !10, i64 80}
!20 = !{!6, !7, i64 272}
!21 = !{!22, !10, i64 8}
!22 = !{!"png_text_struct", !13, i64 0, !10, i64 8, !10, i64 16, !7, i64 24}
!23 = !{!22, !13, i64 0}
!24 = !{!22, !10, i64 16}
!25 = !{!8, !8, i64 0}
!26 = !{!22, !7, i64 24}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


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