; LLVM IR from JayXon/Leanify :: lib/zopflipng/lodepng/lodepng.ll (Z21lodepng_inspect_chunkP12LodePNGStatemPKhm)

; 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.LodePNGState = type { %struct.LodePNGDecoderSettings, %struct.LodePNGEncoderSettings, %struct.LodePNGColorMode, %struct.LodePNGInfo, i32 }
%struct.LodePNGDecoderSettings = type { %struct.LodePNGDecompressSettings, i32, i32, i32, i32, i32, i32, i64, i64 }
%struct.LodePNGDecompressSettings = type { i32, i32, i64, ptr, ptr, ptr }
%struct.LodePNGEncoderSettings = type { %struct.LodePNGCompressSettings, i32, i32, i32, ptr, i32, i32, i32 }
%struct.LodePNGCompressSettings = type { i32, i32, i32, i32, i32, i32, ptr, ptr, ptr }
%struct.LodePNGColorMode = type { i32, i32, ptr, i64, i32, i32, i32, i32 }
%struct.LodePNGInfo = type { i32, i32, i32, %struct.LodePNGColorMode, i32, i32, i32, i32, i64, ptr, ptr, i64, ptr, ptr, ptr, ptr, i32, %struct.LodePNGTime, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, i32, [3 x ptr], [3 x i64] }
%struct.LodePNGTime = type { i32, i32, i32, i32, i32, i32 }

@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z20lodepng_chunk_lengthPKh(ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_Z24lodepng_chunk_data_constPKh(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z23lodepng_chunk_check_crcPKh(ptr noundef) #1

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

23:                                               ; preds = %4
  store i32 30, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %215

24:                                               ; preds = %4
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = call noundef i32 @_Z20lodepng_chunk_lengthPKh(ptr noundef %25)
  store i32 %26, ptr %11, align 4, !tbaa !11
  %27 = load i32, ptr %11, align 4, !tbaa !11
  %28 = icmp ugt i32 %27, 2147483647
  br i1 %28, label %29, label %30

29:                                               ; preds = %24
  store i32 63, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %215

30:                                               ; preds = %24
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = call noundef ptr @_Z24lodepng_chunk_data_constPKh(ptr noundef %31)
  store ptr %32, ptr %12, align 8, !tbaa !5
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  %34 = load i32, ptr %11, align 4, !tbaa !11
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %33, i64 %35
  %37 = getelementptr inbounds i8, ptr %36, i64 4
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = load i64, ptr %9, align 8, !tbaa !9
  %40 = getelementptr inbounds i8, ptr %38, i64 %39
  %41 = icmp ugt ptr %37, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %30
  store i32 30, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %215

43:                                               ; preds = %30
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %44, ptr noundef @.str.3)
  %46 = icmp ne i8 %45, 0
  br i1 %46, label %47, label %55

47:                                               ; preds = %43
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.LodePNGState, ptr %48, i32 0, i32 3
  %50 = getelementptr inbounds %struct.LodePNGInfo, ptr %49, i32 0, i32 3
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  %52 = load i32, ptr %11, align 4, !tbaa !11
  %53 = zext i32 %52 to i64
  %54 = call noundef i32 @_ZL14readChunk_PLTEP16LodePNGColorModePKhm(ptr noundef %50, ptr noundef %51, i64 noundef %53)
  store i32 %54, ptr %14, align 4, !tbaa !11
  br label %195

55:                                               ; preds = %43
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %56, ptr noundef @.str.4)
  %58 = icmp ne i8 %57, 0
  br i1 %58, label %59, label %67

59:                                               ; preds = %55
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.LodePNGState, ptr %60, i32 0, i32 3
  %62 = getelementptr inbounds %struct.LodePNGInfo, ptr %61, i32 0, i32 3
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  %64 = load i32, ptr %11, align 4, !tbaa !11
  %65 = zext i32 %64 to i64
  %66 = call noundef i32 @_ZL14readChunk_tRNSP16LodePNGColorModePKhm(ptr noundef %62, ptr noundef %63, i64 noundef %65)
  store i32 %66, ptr %14, align 4, !tbaa !11
  br label %194

67:                                               ; preds = %55
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %68, ptr noundef @.str.5)
  %70 = icmp ne i8 %69, 0
  br i1 %70, label %71, label %78

71:                                               ; preds = %67
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.LodePNGState, ptr %72, i32 0, i32 3
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = load i32, ptr %11, align 4, !tbaa !11
  %76 = zext i32 %75 to i64
  %77 = call noundef i32 @_ZL14readChunk_bKGDP11LodePNGInfoPKhm(ptr noundef %73, ptr noundef %74, i64 noundef %76)
  store i32 %77, ptr %14, align 4, !tbaa !11
  br label %193

78:                                               ; preds = %67
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %79, ptr noundef @.str.6)
  %81 = icmp ne i8 %80, 0
  br i1 %81, label %82, label %89

82:                                               ; preds = %78
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.LodePNGState, ptr %83, i32 0, i32 3
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = load i32, ptr %11, align 4, !tbaa !11
  %87 = zext i32 %86 to i64
  %88 = call noundef i32 @_ZL14readChunk_tEXtP11LodePNGInfoPKhm(ptr noundef %84, ptr noundef %85, i64 noundef %87)
  store i32 %88, ptr %14, align 4, !tbaa !11
  br label %192

89:                                               ; preds = %78
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %90, ptr noundef @.str.7)
  %92 = icmp ne i8 %91, 0
  br i1 %92, label %93, label %102

93:                                               ; preds = %89
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.LodePNGState, ptr %94, i32 0, i32 3
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.LodePNGState, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %12, align 8, !tbaa !5
  %99 = load i32, ptr %11, align 4, !tbaa !11
  %100 = zext i32 %99 to i64
  %101 = call noundef i32 @_ZL14readChunk_zTXtP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef %95, ptr noundef %97, ptr noundef %98, i64 noundef %100)
  store i32 %101, ptr %14, align 4, !tbaa !11
  br label %191

102:                                              ; preds = %89
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %103, ptr noundef @.str.8)
  %105 = icmp ne i8 %104, 0
  br i1 %105, label %106, label %115

106:                                              ; preds = %102
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.LodePNGState, ptr %107, i32 0, i32 3
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.LodePNGState, ptr %109, i32 0, i32 0
  %111 = load ptr, ptr %12, align 8, !tbaa !5
  %112 = load i32, ptr %11, align 4, !tbaa !11
  %113 = zext i32 %112 to i64
  %114 = call noundef i32 @_ZL14readChunk_iTXtP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef %108, ptr noundef %110, ptr noundef %111, i64 noundef %113)
  store i32 %114, ptr %14, align 4, !tbaa !11
  br label %190

115:                                              ; preds = %102
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %116, ptr noundef @.str.9)
  %118 = icmp ne i8 %117, 0
  br i1 %118, label %119, label %126

119:                                              ; preds = %115
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.LodePNGState, ptr %120, i32 0, i32 3
  %122 = load ptr, ptr %12, align 8, !tbaa !5
  %123 = load i32, ptr %11, align 4, !tbaa !11
  %124 = zext i32 %123 to i64
  %125 = call noundef i32 @_ZL14readChunk_tIMEP11LodePNGInfoPKhm(ptr noundef %121, ptr noundef %122, i64 noundef %124)
  store i32 %125, ptr %14, align 4, !tbaa !11
  br label %189

126:                                              ; preds = %115
  %127 = load ptr, ptr %10, align 8, !tbaa !5
  %128 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %127, ptr noundef @.str.10)
  %129 = icmp ne i8 %128, 0
  br i1 %129, label %130, label %137

130:                                              ; preds = %126
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.LodePNGState, ptr %131, i32 0, i32 3
  %133 = load ptr, ptr %12, align 8, !tbaa !5
  %134 = load i32, ptr %11, align 4, !tbaa !11
  %135 = zext i32 %134 to i64
  %136 = call noundef i32 @_ZL14readChunk_pHYsP11LodePNGInfoPKhm(ptr noundef %132, ptr noundef %133, i64 noundef %135)
  store i32 %136, ptr %14, align 4, !tbaa !11
  br label %188

137:                                              ; preds = %126
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %138, ptr noundef @.str.11)
  %140 = icmp ne i8 %139, 0
  br i1 %140, label %141, label %148

141:                                              ; preds = %137
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.LodePNGState, ptr %142, i32 0, i32 3
  %144 = load ptr, ptr %12, align 8, !tbaa !5
  %145 = load i32, ptr %11, align 4, !tbaa !11
  %146 = zext i32 %145 to i64
  %147 = call noundef i32 @_ZL14readChunk_gAMAP11LodePNGInfoPKhm(ptr noundef %143, ptr noundef %144, i64 noundef %146)
  store i32 %147, ptr %14, align 4, !tbaa !11
  br label %187

148:                                              ; preds = %137
  %149 = load ptr, ptr %10, align 8, !tbaa !5
  %150 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %149, ptr noundef @.str.12)
  %151 = icmp ne i8 %150, 0
  br i1 %151, label %152, label %159

152:                                              ; preds = %148
  %153 = load ptr, ptr %6, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.LodePNGState, ptr %153, i32 0, i32 3
  %155 = load ptr, ptr %12, align 8, !tbaa !5
  %156 = load i32, ptr %11, align 4, !tbaa !11
  %157 = zext i32 %156 to i64
  %158 = call noundef i32 @_ZL14readChunk_cHRMP11LodePNGInfoPKhm(ptr noundef %154, ptr noundef %155, i64 noundef %157)
  store i32 %158, ptr %14, align 4, !tbaa !11
  br label %186

159:                                              ; preds = %148
  %160 = load ptr, ptr %10, align 8, !tbaa !5
  %161 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %160, ptr noundef @.str.13)
  %162 = icmp ne i8 %161, 0
  br i1 %162, label %163, label %170

163:                                              ; preds = %159
  %164 = load ptr, ptr %6, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.LodePNGState, ptr %164, i32 0, i32 3
  %166 = load ptr, ptr %12, align 8, !tbaa !5
  %167 = load i32, ptr %11, align 4, !tbaa !11
  %168 = zext i32 %167 to i64
  %169 = call noundef i32 @_ZL14readChunk_sRGBP11LodePNGInfoPKhm(ptr noundef %165, ptr noundef %166, i64 noundef %168)
  store i32 %169, ptr %14, align 4, !tbaa !11
  br label %185

170:                                              ; preds = %159
  %171 = load ptr, ptr %10, align 8, !tbaa !5
  %172 = call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %171, ptr noundef @.str.14)
  %173 = icmp ne i8 %172, 0
  br i1 %173, label %174, label %183

174:                                              ; preds = %170
  %175 = load ptr, ptr %6, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.LodePNGState, ptr %175, i32 0, i32 3
  %177 = load ptr, ptr %6, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.LodePNGState, ptr %177, i32 0, i32 0
  %179 = load ptr, ptr %12, align 8, !tbaa !5
  %180 = load i32, ptr %11, align 4, !tbaa !11
  %181 = zext i32 %180 to i64
  %182 = call noundef i32 @_ZL14readChunk_iCCPP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef %176, ptr noundef %178, ptr noundef %179, i64 noundef %181)
  store i32 %182, ptr %14, align 4, !tbaa !11
  br label %184

183:                                              ; preds = %170
  store i32 1, ptr %13, align 4, !tbaa !11
  br label %184

184:                                              ; preds = %183, %174
  br label %185

185:                                              ; preds = %184, %163
  br label %186

186:                                              ; preds = %185, %152
  br label %187

187:                                              ; preds = %186, %141
  br label %188

188:                                              ; preds = %187, %130
  br label %189

189:                                              ; preds = %188, %119
  br label %190

190:                                              ; preds = %189, %106
  br label %191

191:                                              ; preds = %190, %93
  br label %192

192:                                              ; preds = %191, %82
  br label %193

193:                                              ; preds = %192, %71
  br label %194

194:                                              ; preds = %193, %59
  br label %195

195:                                              ; preds = %194, %47
  %196 = load i32, ptr %14, align 4, !tbaa !11
  %197 = icmp ne i32 %196, 0
  br i1 %197, label %213, label %198

198:                                              ; preds = %195
  %199 = load i32, ptr %13, align 4, !tbaa !11
  %200 = icmp ne i32 %199, 0
  br i1 %200, label %213, label %201

201:                                              ; preds = %198
  %202 = load ptr, ptr %6, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.LodePNGState, ptr %202, i32 0, i32 0
  %204 = getelementptr inbounds %struct.LodePNGDecoderSettings, ptr %203, i32 0, i32 1
  %205 = load i32, ptr %204, align 8, !tbaa !13
  %206 = icmp ne i32 %205, 0
  br i1 %206, label %213, label %207

207:                                              ; preds = %201
  %208 = load ptr, ptr %10, align 8, !tbaa !5
  %209 = call noundef i32 @_Z23lodepng_chunk_check_crcPKh(ptr noundef %208)
  %210 = icmp ne i32 %209, 0
  br i1 %210, label %211, label %212

211:                                              ; preds = %207
  store i32 57, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %215

212:                                              ; preds = %207
  br label %213

213:                                              ; preds = %212, %201, %198, %195
  %214 = load i32, ptr %14, align 4, !tbaa !11
  store i32 %214, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %215

215:                                              ; preds = %213, %211, %42, %29, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %216 = load i32, ptr %5, align 4
  ret i32 %216
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_PLTEP16LodePNGColorModePKhm(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_tRNSP16LodePNGColorModePKhm(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_bKGDP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14readChunk_tEXtP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14readChunk_zTXtP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14readChunk_iTXtP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_tIMEP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_pHYsP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_gAMAP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_cHRMP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_sRGBP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14readChunk_iCCPP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 40}
!14 = !{!"_ZTS12LodePNGState", !15, i64 0, !17, i64 80, !20, i64 168, !22, i64 208, !12, i64 520}
!15 = !{!"_ZTS22LodePNGDecoderSettings", !16, i64 0, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !10, i64 64, !10, i64 72}
!16 = !{!"_ZTS25LodePNGDecompressSettings", !12, i64 0, !12, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!17 = !{!"_ZTS22LodePNGEncoderSettings", !18, i64 0, !12, i64 48, !12, i64 52, !19, i64 56, !6, i64 64, !12, i64 72, !12, i64 76, !12, i64 80}
!18 = !{!"_ZTS23LodePNGCompressSettings", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !6, i64 24, !6, i64 32, !6, i64 40}
!19 = !{!"_ZTS21LodePNGFilterStrategy", !7, i64 0}
!20 = !{!"_ZTS16LodePNGColorMode", !21, i64 0, !12, i64 4, !6, i64 8, !10, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36}
!21 = !{!"_ZTS16LodePNGColorType", !7, i64 0}
!22 = !{!"_ZTS11LodePNGInfo", !12, i64 0, !12, i64 4, !12, i64 8, !20, i64 16, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !10, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !12, i64 136, !23, i64 140, !12, i64 164, !12, i64 168, !12, i64 172, !12, i64 176, !12, i64 180, !12, i64 184, !12, i64 188, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !12, i64 224, !12, i64 228, !12, i64 232, !6, i64 240, !6, i64 248, !12, i64 256, !7, i64 264, !7, i64 288}
!23 = !{!"_ZTS11LodePNGTime", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}


; 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.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z20lodepng_chunk_lengthPKh(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_Z24lodepng_chunk_data_constPKh(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z23lodepng_chunk_check_crcPKh(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z21lodepng_inspect_chunkP12LodePNGStatemPKhm(ptr noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %2, i64 %1
  %6 = add i64 %1, 4
  %7 = icmp ugt i64 %6, %3
  br i1 %7, label %.thread, label %8

8:                                                ; preds = %4
  %9 = tail call noundef i32 @_Z20lodepng_chunk_lengthPKh(ptr noundef %5)
  %10 = icmp slt i32 %9, 0
  br i1 %10, label %.thread, label %11

11:                                               ; preds = %8
  %12 = tail call noundef ptr @_Z24lodepng_chunk_data_constPKh(ptr noundef %5)
  %13 = zext nneg i32 %9 to i64
  %14 = getelementptr inbounds i8, ptr %12, i64 %13
  %15 = getelementptr inbounds i8, ptr %14, i64 4
  %16 = getelementptr inbounds i8, ptr %2, i64 %3
  %17 = icmp ugt ptr %15, %16
  br i1 %17, label %.thread, label %18

18:                                               ; preds = %11
  %19 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.3)
  %.not = icmp eq i8 %19, 0
  br i1 %.not, label %23, label %20

20:                                               ; preds = %18
  %21 = getelementptr inbounds i8, ptr %0, i64 224
  %22 = tail call noundef i32 @_ZL14readChunk_PLTEP16LodePNGColorModePKhm(ptr noundef nonnull %21, ptr noundef %12, i64 noundef %13)
  br label %78

23:                                               ; preds = %18
  %24 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.4)
  %.not72 = icmp eq i8 %24, 0
  br i1 %.not72, label %28, label %25

25:                                               ; preds = %23
  %26 = getelementptr inbounds i8, ptr %0, i64 224
  %27 = tail call noundef i32 @_ZL14readChunk_tRNSP16LodePNGColorModePKhm(ptr noundef nonnull %26, ptr noundef %12, i64 noundef %13)
  br label %78

28:                                               ; preds = %23
  %29 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.5)
  %.not73 = icmp eq i8 %29, 0
  br i1 %.not73, label %33, label %30

30:                                               ; preds = %28
  %31 = getelementptr inbounds i8, ptr %0, i64 208
  %32 = tail call noundef i32 @_ZL14readChunk_bKGDP11LodePNGInfoPKhm(ptr noundef nonnull %31, ptr noundef %12, i64 noundef %13)
  br label %78

33:                                               ; preds = %28
  %34 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.6)
  %.not74 = icmp eq i8 %34, 0
  br i1 %.not74, label %38, label %35

35:                                               ; preds = %33
  %36 = getelementptr inbounds i8, ptr %0, i64 208
  %37 = tail call noundef i32 @_ZL14readChunk_tEXtP11LodePNGInfoPKhm(ptr noundef nonnull %36, ptr noundef %12, i64 noundef %13)
  br label %78

38:                                               ; preds = %33
  %39 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.7)
  %.not75 = icmp eq i8 %39, 0
  br i1 %.not75, label %43, label %40

40:                                               ; preds = %38
  %41 = getelementptr inbounds i8, ptr %0, i64 208
  %42 = tail call noundef i32 @_ZL14readChunk_zTXtP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef nonnull %41, ptr noundef %0, ptr noundef %12, i64 noundef %13)
  br label %78

43:                                               ; preds = %38
  %44 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.8)
  %.not76 = icmp eq i8 %44, 0
  br i1 %.not76, label %48, label %45

45:                                               ; preds = %43
  %46 = getelementptr inbounds i8, ptr %0, i64 208
  %47 = tail call noundef i32 @_ZL14readChunk_iTXtP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef nonnull %46, ptr noundef %0, ptr noundef %12, i64 noundef %13)
  br label %78

48:                                               ; preds = %43
  %49 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.9)
  %.not77 = icmp eq i8 %49, 0
  br i1 %.not77, label %53, label %50

50:                                               ; preds = %48
  %51 = getelementptr inbounds i8, ptr %0, i64 208
  %52 = tail call noundef i32 @_ZL14readChunk_tIMEP11LodePNGInfoPKhm(ptr noundef nonnull %51, ptr noundef %12, i64 noundef %13)
  br label %78

53:                                               ; preds = %48
  %54 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.10)
  %.not78 = icmp eq i8 %54, 0
  br i1 %.not78, label %58, label %55

55:                                               ; preds = %53
  %56 = getelementptr inbounds i8, ptr %0, i64 208
  %57 = tail call noundef i32 @_ZL14readChunk_pHYsP11LodePNGInfoPKhm(ptr noundef nonnull %56, ptr noundef %12, i64 noundef %13)
  br label %78

58:                                               ; preds = %53
  %59 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.11)
  %.not79 = icmp eq i8 %59, 0
  br i1 %.not79, label %63, label %60

60:                                               ; preds = %58
  %61 = getelementptr inbounds i8, ptr %0, i64 208
  %62 = tail call noundef i32 @_ZL14readChunk_gAMAP11LodePNGInfoPKhm(ptr noundef nonnull %61, ptr noundef %12, i64 noundef %13)
  br label %78

63:                                               ; preds = %58
  %64 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.12)
  %.not80 = icmp eq i8 %64, 0
  br i1 %.not80, label %68, label %65

65:                                               ; preds = %63
  %66 = getelementptr inbounds i8, ptr %0, i64 208
  %67 = tail call noundef i32 @_ZL14readChunk_cHRMP11LodePNGInfoPKhm(ptr noundef nonnull %66, ptr noundef %12, i64 noundef %13)
  br label %78

68:                                               ; preds = %63
  %69 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.13)
  %.not81 = icmp eq i8 %69, 0
  br i1 %.not81, label %73, label %70

70:                                               ; preds = %68
  %71 = getelementptr inbounds i8, ptr %0, i64 208
  %72 = tail call noundef i32 @_ZL14readChunk_sRGBP11LodePNGInfoPKhm(ptr noundef nonnull %71, ptr noundef %12, i64 noundef %13)
  br label %78

73:                                               ; preds = %68
  %74 = tail call noundef zeroext i8 @_Z25lodepng_chunk_type_equalsPKhPKc(ptr noundef %5, ptr noundef nonnull @.str.14)
  %.not82 = icmp eq i8 %74, 0
  br i1 %.not82, label %.thread, label %75

75:                                               ; preds = %73
  %76 = getelementptr inbounds i8, ptr %0, i64 208
  %77 = tail call noundef i32 @_ZL14readChunk_iCCPP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef nonnull %76, ptr noundef %0, ptr noundef %12, i64 noundef %13)
  br label %78

78:                                               ; preds = %25, %35, %45, %55, %65, %75, %70, %60, %50, %40, %30, %20
  %.0 = phi i32 [ %22, %20 ], [ %27, %25 ], [ %32, %30 ], [ %37, %35 ], [ %42, %40 ], [ %47, %45 ], [ %52, %50 ], [ %57, %55 ], [ %62, %60 ], [ %67, %65 ], [ %72, %70 ], [ %77, %75 ]
  %.not88 = icmp eq i32 %.0, 0
  br i1 %.not88, label %79, label %.thread

79:                                               ; preds = %78
  %80 = getelementptr inbounds i8, ptr %0, i64 40
  %81 = load i32, ptr %80, align 8, !tbaa !5
  %.not83 = icmp eq i32 %81, 0
  br i1 %.not83, label %82, label %.thread

82:                                               ; preds = %79
  %83 = tail call noundef i32 @_Z23lodepng_chunk_check_crcPKh(ptr noundef %5)
  %.not84 = icmp eq i32 %83, 0
  %spec.select = select i1 %.not84, i32 0, i32 57
  br label %.thread

.thread:                                          ; preds = %82, %73, %78, %79, %11, %8, %4
  %.069 = phi i32 [ 30, %4 ], [ 63, %8 ], [ 30, %11 ], [ 0, %79 ], [ %.0, %78 ], [ 0, %73 ], [ %spec.select, %82 ]
  ret i32 %.069
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_PLTEP16LodePNGColorModePKhm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_tRNSP16LodePNGColorModePKhm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_bKGDP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14readChunk_tEXtP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14readChunk_zTXtP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14readChunk_iTXtP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_tIMEP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_pHYsP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_gAMAP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_cHRMP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL14readChunk_sRGBP11LodePNGInfoPKhm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14readChunk_iCCPP11LodePNGInfoPK22LodePNGDecoderSettingsPKhm(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

attributes #0 = { mustprogress 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 = { mustprogress 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" }

!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, !9, i64 40}
!6 = !{!"_ZTS12LodePNGState", !7, i64 0, !14, i64 80, !17, i64 168, !19, i64 208, !9, i64 520}
!7 = !{!"_ZTS22LodePNGDecoderSettings", !8, i64 0, !9, i64 40, !9, i64 44, !9, i64 48, !9, i64 52, !9, i64 56, !9, i64 60, !12, i64 64, !12, i64 72}
!8 = !{!"_ZTS25LodePNGDecompressSettings", !9, i64 0, !9, i64 4, !12, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"long", !10, i64 0}
!13 = !{!"any pointer", !10, i64 0}
!14 = !{!"_ZTS22LodePNGEncoderSettings", !15, i64 0, !9, i64 48, !9, i64 52, !16, i64 56, !13, i64 64, !9, i64 72, !9, i64 76, !9, i64 80}
!15 = !{!"_ZTS23LodePNGCompressSettings", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20, !13, i64 24, !13, i64 32, !13, i64 40}
!16 = !{!"_ZTS21LodePNGFilterStrategy", !10, i64 0}
!17 = !{!"_ZTS16LodePNGColorMode", !18, i64 0, !9, i64 4, !13, i64 8, !12, i64 16, !9, i64 24, !9, i64 28, !9, i64 32, !9, i64 36}
!18 = !{!"_ZTS16LodePNGColorType", !10, i64 0}
!19 = !{!"_ZTS11LodePNGInfo", !9, i64 0, !9, i64 4, !9, i64 8, !17, i64 16, !9, i64 56, !9, i64 60, !9, i64 64, !9, i64 68, !12, i64 72, !13, i64 80, !13, i64 88, !12, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !13, i64 128, !9, i64 136, !20, i64 140, !9, i64 164, !9, i64 168, !9, i64 172, !9, i64 176, !9, i64 180, !9, i64 184, !9, i64 188, !9, i64 192, !9, i64 196, !9, i64 200, !9, i64 204, !9, i64 208, !9, i64 212, !9, i64 216, !9, i64 220, !9, i64 224, !9, i64 228, !9, i64 232, !13, i64 240, !13, i64 248, !9, i64 256, !10, i64 264, !10, i64 288}
!20 = !{!"_ZTS11LodePNGTime", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass