; LLVM IR from simbody/simbody :: Simbody/Visualizer/simbody-visualizer (lodepng)

; 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.LodePNG_Decoder = type { %struct.LodePNG_DecodeSettings, %struct.LodePNG_InfoRaw, %struct.LodePNG_InfoPng, i32 }
%struct.LodePNG_DecodeSettings = type { %struct.LodeZlib_DecompressSettings, i32, i32, i32, i32 }
%struct.LodeZlib_DecompressSettings = type { i32 }
%struct.LodePNG_InfoRaw = type { %struct.LodePNG_InfoColor }
%struct.LodePNG_InfoColor = type { i32, i32, ptr, i64, i32, i32, i32, i32 }
%struct.LodePNG_InfoPng = type { i32, i32, i32, i32, i32, %struct.LodePNG_InfoColor, i32, i32, i32, i32, %struct.LodePNG_Text, %struct.LodePNG_IText, i8, %struct.LodePNG_Time, i32, i32, i32, i8, %struct.LodePNG_UnknownChunks }
%struct.LodePNG_Text = type { i64, ptr, ptr }
%struct.LodePNG_IText = type { i64, ptr, ptr, ptr, ptr }
%struct.LodePNG_Time = type { i32, i8, i8, i8, i8, i8 }
%struct.LodePNG_UnknownChunks = type { [3 x ptr], [3 x i64] }

; 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 nounwind uwtable
declare hidden noundef i32 @_ZL20LodePNG_read32bitIntPKh(ptr noundef) #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z23LodePNG_InfoPng_cleanupP15LodePNG_InfoPng(ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z23LodePNG_Decoder_inspectP15LodePNG_DecoderPKhm(ptr noundef %0, ptr noundef %1, i64 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %10 = load i64, ptr %6, align 8, !tbaa !9
  %11 = icmp eq i64 %10, 0
  br i1 %11, label %15, label %12

12:                                               ; preds = %3
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %18

15:                                               ; preds = %12, %3
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %16, i32 0, i32 3
  store i32 48, ptr %17, align 8, !tbaa !11
  br label %221

18:                                               ; preds = %12
  %19 = load i64, ptr %6, align 8, !tbaa !9
  %20 = icmp ult i64 %19, 29
  br i1 %20, label %21, label %24

21:                                               ; preds = %18
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %22, i32 0, i32 3
  store i32 27, ptr %23, align 8, !tbaa !11
  br label %221

24:                                               ; preds = %18
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %25, i32 0, i32 2
  call void @_Z23LodePNG_InfoPng_cleanupP15LodePNG_InfoPng(ptr noundef %26)
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %27, i32 0, i32 2
  call void @_Z20LodePNG_InfoPng_initP15LodePNG_InfoPng(ptr noundef %28)
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %29, i32 0, i32 3
  store i32 0, ptr %30, align 8, !tbaa !11
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 0
  %33 = load i8, ptr %32, align 1, !tbaa !23
  %34 = zext i8 %33 to i32
  %35 = icmp ne i32 %34, 137
  br i1 %35, label %78, label %36

36:                                               ; preds = %24
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %37, i64 1
  %39 = load i8, ptr %38, align 1, !tbaa !23
  %40 = zext i8 %39 to i32
  %41 = icmp ne i32 %40, 80
  br i1 %41, label %78, label %42

42:                                               ; preds = %36
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 2
  %45 = load i8, ptr %44, align 1, !tbaa !23
  %46 = zext i8 %45 to i32
  %47 = icmp ne i32 %46, 78
  br i1 %47, label %78, label %48

48:                                               ; preds = %42
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %49, i64 3
  %51 = load i8, ptr %50, align 1, !tbaa !23
  %52 = zext i8 %51 to i32
  %53 = icmp ne i32 %52, 71
  br i1 %53, label %78, label %54

54:                                               ; preds = %48
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i64 4
  %57 = load i8, ptr %56, align 1, !tbaa !23
  %58 = zext i8 %57 to i32
  %59 = icmp ne i32 %58, 13
  br i1 %59, label %78, label %60

60:                                               ; preds = %54
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %61, i64 5
  %63 = load i8, ptr %62, align 1, !tbaa !23
  %64 = zext i8 %63 to i32
  %65 = icmp ne i32 %64, 10
  br i1 %65, label %78, label %66

66:                                               ; preds = %60
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 6
  %69 = load i8, ptr %68, align 1, !tbaa !23
  %70 = zext i8 %69 to i32
  %71 = icmp ne i32 %70, 26
  br i1 %71, label %78, label %72

72:                                               ; preds = %66
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %73, i64 7
  %75 = load i8, ptr %74, align 1, !tbaa !23
  %76 = zext i8 %75 to i32
  %77 = icmp ne i32 %76, 10
  br i1 %77, label %78, label %81

78:                                               ; preds = %72, %66, %60, %54, %48, %42, %36, %24
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %79, i32 0, i32 3
  store i32 28, ptr %80, align 8, !tbaa !11
  br label %221

81:                                               ; preds = %72
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds i8, ptr %82, i64 12
  %84 = load i8, ptr %83, align 1, !tbaa !23
  %85 = zext i8 %84 to i32
  %86 = icmp ne i32 %85, 73
  br i1 %86, label %105, label %87

87:                                               ; preds = %81
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %88, i64 13
  %90 = load i8, ptr %89, align 1, !tbaa !23
  %91 = zext i8 %90 to i32
  %92 = icmp ne i32 %91, 72
  br i1 %92, label %105, label %93

93:                                               ; preds = %87
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds i8, ptr %94, i64 14
  %96 = load i8, ptr %95, align 1, !tbaa !23
  %97 = zext i8 %96 to i32
  %98 = icmp ne i32 %97, 68
  br i1 %98, label %105, label %99

99:                                               ; preds = %93
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds i8, ptr %100, i64 15
  %102 = load i8, ptr %101, align 1, !tbaa !23
  %103 = zext i8 %102 to i32
  %104 = icmp ne i32 %103, 82
  br i1 %104, label %105, label %108

105:                                              ; preds = %99, %93, %87, %81
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %106, i32 0, i32 3
  store i32 29, ptr %107, align 8, !tbaa !11
  br label %221

108:                                              ; preds = %99
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds i8, ptr %109, i64 16
  %111 = call noundef i32 @_ZL20LodePNG_read32bitIntPKh(ptr noundef %110)
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %112, i32 0, i32 2
  %114 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %113, i32 0, i32 0
  store i32 %111, ptr %114, align 8, !tbaa !24
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds i8, ptr %115, i64 20
  %117 = call noundef i32 @_ZL20LodePNG_read32bitIntPKh(ptr noundef %116)
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %118, i32 0, i32 2
  %120 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %119, i32 0, i32 1
  store i32 %117, ptr %120, align 4, !tbaa !25
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds i8, ptr %121, i64 24
  %123 = load i8, ptr %122, align 1, !tbaa !23
  %124 = zext i8 %123 to i32
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %125, i32 0, i32 2
  %127 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %126, i32 0, i32 5
  %128 = getelementptr inbounds %struct.LodePNG_InfoColor, ptr %127, i32 0, i32 1
  store i32 %124, ptr %128, align 4, !tbaa !26
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = getelementptr inbounds i8, ptr %129, i64 25
  %131 = load i8, ptr %130, align 1, !tbaa !23
  %132 = zext i8 %131 to i32
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %133, i32 0, i32 2
  %135 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %134, i32 0, i32 5
  %136 = getelementptr inbounds %struct.LodePNG_InfoColor, ptr %135, i32 0, i32 0
  store i32 %132, ptr %136, align 8, !tbaa !27
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = getelementptr inbounds i8, ptr %137, i64 26
  %139 = load i8, ptr %138, align 1, !tbaa !23
  %140 = zext i8 %139 to i32
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %141, i32 0, i32 2
  %143 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %142, i32 0, i32 2
  store i32 %140, ptr %143, align 8, !tbaa !28
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds i8, ptr %144, i64 27
  %146 = load i8, ptr %145, align 1, !tbaa !23
  %147 = zext i8 %146 to i32
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %148, i32 0, i32 2
  %150 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %149, i32 0, i32 3
  store i32 %147, ptr %150, align 4, !tbaa !29
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds i8, ptr %151, i64 28
  %153 = load i8, ptr %152, align 1, !tbaa !23
  %154 = zext i8 %153 to i32
  %155 = load ptr, ptr %4, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %155, i32 0, i32 2
  %157 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %156, i32 0, i32 4
  store i32 %154, ptr %157, align 8, !tbaa !30
  %158 = load ptr, ptr %4, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %158, i32 0, i32 0
  %160 = getelementptr inbounds %struct.LodePNG_DecodeSettings, ptr %159, i32 0, i32 1
  %161 = load i32, ptr %160, align 4, !tbaa !31
  %162 = icmp ne i32 %161, 0
  br i1 %162, label %180, label %163

163:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = getelementptr inbounds i8, ptr %164, i64 29
  %166 = call noundef i32 @_ZL20LodePNG_read32bitIntPKh(ptr noundef %165)
  store i32 %166, ptr %7, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %167 = load ptr, ptr %5, align 8, !tbaa !5
  %168 = getelementptr inbounds i8, ptr %167, i64 12
  %169 = call noundef i32 @_ZL9Crc32_crcPKhm(ptr noundef %168, i64 noundef 17)
  store i32 %169, ptr %8, align 4, !tbaa !32
  %170 = load i32, ptr %7, align 4, !tbaa !32
  %171 = load i32, ptr %8, align 4, !tbaa !32
  %172 = icmp ne i32 %170, %171
  br i1 %172, label %173, label %176

173:                                              ; preds = %163
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %174, i32 0, i32 3
  store i32 57, ptr %175, align 8, !tbaa !11
  store i32 1, ptr %9, align 4
  br label %177

176:                                              ; preds = %163
  store i32 0, ptr %9, align 4
  br label %177

177:                                              ; preds = %176, %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  %178 = load i32, ptr %9, align 4
  switch i32 %178, label %222 [
    i32 0, label %179
    i32 1, label %221
  ]

179:                                              ; preds = %177
  br label %180

180:                                              ; preds = %179, %108
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %181, i32 0, i32 2
  %183 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %182, i32 0, i32 2
  %184 = load i32, ptr %183, align 8, !tbaa !28
  %185 = icmp ne i32 %184, 0
  br i1 %185, label %186, label %189

186:                                              ; preds = %180
  %187 = load ptr, ptr %4, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %187, i32 0, i32 3
  store i32 32, ptr %188, align 8, !tbaa !11
  br label %221

189:                                              ; preds = %180
  %190 = load ptr, ptr %4, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %190, i32 0, i32 2
  %192 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %191, i32 0, i32 3
  %193 = load i32, ptr %192, align 4, !tbaa !29
  %194 = icmp ne i32 %193, 0
  br i1 %194, label %195, label %198

195:                                              ; preds = %189
  %196 = load ptr, ptr %4, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %196, i32 0, i32 3
  store i32 33, ptr %197, align 8, !tbaa !11
  br label %221

198:                                              ; preds = %189
  %199 = load ptr, ptr %4, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %199, i32 0, i32 2
  %201 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %200, i32 0, i32 4
  %202 = load i32, ptr %201, align 8, !tbaa !30
  %203 = icmp ugt i32 %202, 1
  br i1 %203, label %204, label %207

204:                                              ; preds = %198
  %205 = load ptr, ptr %4, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %205, i32 0, i32 3
  store i32 34, ptr %206, align 8, !tbaa !11
  br label %221

207:                                              ; preds = %198
  %208 = load ptr, ptr %4, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %208, i32 0, i32 2
  %210 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %209, i32 0, i32 5
  %211 = getelementptr inbounds %struct.LodePNG_InfoColor, ptr %210, i32 0, i32 0
  %212 = load i32, ptr %211, align 8, !tbaa !27
  %213 = load ptr, ptr %4, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %213, i32 0, i32 2
  %215 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %214, i32 0, i32 5
  %216 = getelementptr inbounds %struct.LodePNG_InfoColor, ptr %215, i32 0, i32 1
  %217 = load i32, ptr %216, align 4, !tbaa !26
  %218 = call noundef i32 @_ZL18checkColorValidityjj(i32 noundef %212, i32 noundef %217)
  %219 = load ptr, ptr %4, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %219, i32 0, i32 3
  store i32 %218, ptr %220, align 8, !tbaa !11
  br label %221

221:                                              ; preds = %207, %204, %195, %186, %177, %105, %78, %21, %15
  ret void

222:                                              ; preds = %177
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL18checkColorValidityjj(i32 noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { 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 #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, !15, i64 288}
!12 = !{!"_ZTS15LodePNG_Decoder", !13, i64 0, !16, i64 24, !18, i64 64, !15, i64 288}
!13 = !{!"_ZTS22LodePNG_DecodeSettings", !14, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16}
!14 = !{!"_ZTS27LodeZlib_DecompressSettings", !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTS15LodePNG_InfoRaw", !17, i64 0}
!17 = !{!"_ZTS17LodePNG_InfoColor", !15, i64 0, !15, i64 4, !6, i64 8, !10, i64 16, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36}
!18 = !{!"_ZTS15LodePNG_InfoPng", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !17, i64 24, !15, i64 64, !15, i64 68, !15, i64 72, !15, i64 76, !19, i64 80, !20, i64 104, !7, i64 144, !21, i64 148, !15, i64 160, !15, i64 164, !15, i64 168, !7, i64 172, !22, i64 176}
!19 = !{!"_ZTS12LodePNG_Text", !10, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"_ZTS13LodePNG_IText", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!21 = !{!"_ZTS12LodePNG_Time", !15, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8}
!22 = !{!"_ZTS21LodePNG_UnknownChunks", !7, i64 0, !7, i64 24}
!23 = !{!7, !7, i64 0}
!24 = !{!12, !15, i64 64}
!25 = !{!12, !15, i64 68}
!26 = !{!12, !15, i64 92}
!27 = !{!12, !15, i64 88}
!28 = !{!12, !15, i64 72}
!29 = !{!12, !15, i64 76}
!30 = !{!12, !15, i64 80}
!31 = !{!12, !15, i64 4}
!32 = !{!15, !15, i64 0}


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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL20LodePNG_read32bitIntPKh(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z20LodePNG_InfoPng_initP15LodePNG_InfoPng(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z23LodePNG_Decoder_inspectP15LodePNG_DecoderPKhm(ptr noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #1 {
  %4 = icmp eq i64 %2, 0
  %5 = icmp eq ptr %1, null
  %or.cond = or i1 %5, %4
  br i1 %or.cond, label %6, label %8

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 288
  store i32 48, ptr %7, align 8, !tbaa !5
  br label %97

8:                                                ; preds = %3
  %9 = icmp ult i64 %2, 29
  br i1 %9, label %10, label %12

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %0, i64 288
  store i32 27, ptr %11, align 8, !tbaa !5
  br label %97

12:                                               ; preds = %8
  %13 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @_Z23LodePNG_InfoPng_cleanupP15LodePNG_InfoPng(ptr noundef nonnull %13)
  tail call void @_Z20LodePNG_InfoPng_initP15LodePNG_InfoPng(ptr noundef nonnull %13)
  %14 = getelementptr inbounds i8, ptr %0, i64 288
  store i32 0, ptr %14, align 8, !tbaa !5
  %15 = load i8, ptr %1, align 1, !tbaa !21
  %.not = icmp eq i8 %15, -119
  br i1 %.not, label %16, label %37

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %1, i64 1
  %18 = load i8, ptr %17, align 1, !tbaa !21
  %.not54 = icmp eq i8 %18, 80
  br i1 %.not54, label %19, label %37

19:                                               ; preds = %16
  %20 = getelementptr inbounds i8, ptr %1, i64 2
  %21 = load i8, ptr %20, align 1, !tbaa !21
  %.not55 = icmp eq i8 %21, 78
  br i1 %.not55, label %22, label %37

22:                                               ; preds = %19
  %23 = getelementptr inbounds i8, ptr %1, i64 3
  %24 = load i8, ptr %23, align 1, !tbaa !21
  %.not56 = icmp eq i8 %24, 71
  br i1 %.not56, label %25, label %37

25:                                               ; preds = %22
  %26 = getelementptr inbounds i8, ptr %1, i64 4
  %27 = load i8, ptr %26, align 1, !tbaa !21
  %.not57 = icmp eq i8 %27, 13
  br i1 %.not57, label %28, label %37

28:                                               ; preds = %25
  %29 = getelementptr inbounds i8, ptr %1, i64 5
  %30 = load i8, ptr %29, align 1, !tbaa !21
  %.not58 = icmp eq i8 %30, 10
  br i1 %.not58, label %31, label %37

31:                                               ; preds = %28
  %32 = getelementptr inbounds i8, ptr %1, i64 6
  %33 = load i8, ptr %32, align 1, !tbaa !21
  %.not59 = icmp eq i8 %33, 26
  br i1 %.not59, label %34, label %37

34:                                               ; preds = %31
  %35 = getelementptr inbounds i8, ptr %1, i64 7
  %36 = load i8, ptr %35, align 1, !tbaa !21
  %.not60 = icmp eq i8 %36, 10
  br i1 %.not60, label %38, label %37

37:                                               ; preds = %34, %31, %28, %25, %22, %19, %16, %12
  store i32 28, ptr %14, align 8, !tbaa !5
  br label %97

38:                                               ; preds = %34
  %39 = getelementptr inbounds i8, ptr %1, i64 12
  %40 = load i8, ptr %39, align 1, !tbaa !21
  %.not61 = icmp eq i8 %40, 73
  br i1 %.not61, label %41, label %50

41:                                               ; preds = %38
  %42 = getelementptr inbounds i8, ptr %1, i64 13
  %43 = load i8, ptr %42, align 1, !tbaa !21
  %.not62 = icmp eq i8 %43, 72
  br i1 %.not62, label %44, label %50

44:                                               ; preds = %41
  %45 = getelementptr inbounds i8, ptr %1, i64 14
  %46 = load i8, ptr %45, align 1, !tbaa !21
  %.not63 = icmp eq i8 %46, 68
  br i1 %.not63, label %47, label %50

47:                                               ; preds = %44
  %48 = getelementptr inbounds i8, ptr %1, i64 15
  %49 = load i8, ptr %48, align 1, !tbaa !21
  %.not64 = icmp eq i8 %49, 82
  br i1 %.not64, label %51, label %50

50:                                               ; preds = %47, %44, %41, %38
  store i32 29, ptr %14, align 8, !tbaa !5
  br label %97

51:                                               ; preds = %47
  %52 = getelementptr inbounds i8, ptr %1, i64 16
  %53 = tail call noundef i32 @_ZL20LodePNG_read32bitIntPKh(ptr noundef nonnull %52)
  store i32 %53, ptr %13, align 8, !tbaa !22
  %54 = getelementptr inbounds i8, ptr %1, i64 20
  %55 = tail call noundef i32 @_ZL20LodePNG_read32bitIntPKh(ptr noundef nonnull %54)
  %56 = getelementptr inbounds i8, ptr %0, i64 68
  store i32 %55, ptr %56, align 4, !tbaa !23
  %57 = getelementptr inbounds i8, ptr %1, i64 24
  %58 = load i8, ptr %57, align 1, !tbaa !21
  %59 = zext i8 %58 to i32
  %60 = getelementptr inbounds i8, ptr %0, i64 88
  %61 = getelementptr inbounds i8, ptr %0, i64 92
  store i32 %59, ptr %61, align 4, !tbaa !24
  %62 = getelementptr inbounds i8, ptr %1, i64 25
  %63 = load i8, ptr %62, align 1, !tbaa !21
  %64 = zext i8 %63 to i32
  store i32 %64, ptr %60, align 8, !tbaa !25
  %65 = getelementptr inbounds i8, ptr %1, i64 26
  %66 = load i8, ptr %65, align 1, !tbaa !21
  %67 = zext i8 %66 to i32
  %68 = getelementptr inbounds i8, ptr %0, i64 72
  store i32 %67, ptr %68, align 8, !tbaa !26
  %69 = getelementptr inbounds i8, ptr %1, i64 27
  %70 = load i8, ptr %69, align 1, !tbaa !21
  %71 = zext i8 %70 to i32
  %72 = getelementptr inbounds i8, ptr %0, i64 76
  store i32 %71, ptr %72, align 4, !tbaa !27
  %73 = getelementptr inbounds i8, ptr %1, i64 28
  %74 = load i8, ptr %73, align 1, !tbaa !21
  %75 = zext i8 %74 to i32
  %76 = getelementptr inbounds i8, ptr %0, i64 80
  store i32 %75, ptr %76, align 8, !tbaa !28
  %77 = getelementptr inbounds i8, ptr %0, i64 4
  %78 = load i32, ptr %77, align 4, !tbaa !29
  %.not65 = icmp eq i32 %78, 0
  br i1 %.not65, label %79, label %.thread

79:                                               ; preds = %51
  %80 = getelementptr inbounds i8, ptr %1, i64 29
  %81 = tail call noundef i32 @_ZL20LodePNG_read32bitIntPKh(ptr noundef nonnull %80)
  %82 = tail call noundef i32 @_ZL9Crc32_crcPKhm(ptr noundef nonnull %39, i64 noundef 17)
  %.not66.not = icmp eq i32 %81, %82
  br i1 %.not66.not, label %..thread_crit_edge, label %83

..thread_crit_edge:                               ; preds = %79
  %.pre = load i32, ptr %68, align 8, !tbaa !26
  br label %.thread

83:                                               ; preds = %79
  store i32 57, ptr %14, align 8, !tbaa !5
  br label %97

.thread:                                          ; preds = %..thread_crit_edge, %51
  %84 = phi i32 [ %.pre, %..thread_crit_edge ], [ %67, %51 ]
  %.not67 = icmp eq i32 %84, 0
  br i1 %.not67, label %86, label %85

85:                                               ; preds = %.thread
  store i32 32, ptr %14, align 8, !tbaa !5
  br label %97

86:                                               ; preds = %.thread
  %87 = load i32, ptr %72, align 4, !tbaa !27
  %.not68 = icmp eq i32 %87, 0
  br i1 %.not68, label %89, label %88

88:                                               ; preds = %86
  store i32 33, ptr %14, align 8, !tbaa !5
  br label %97

89:                                               ; preds = %86
  %90 = load i32, ptr %76, align 8, !tbaa !28
  %91 = icmp ugt i32 %90, 1
  br i1 %91, label %92, label %93

92:                                               ; preds = %89
  store i32 34, ptr %14, align 8, !tbaa !5
  br label %97

93:                                               ; preds = %89
  %94 = load i32, ptr %60, align 8, !tbaa !25
  %95 = load i32, ptr %61, align 4, !tbaa !24
  %96 = tail call noundef i32 @_ZL18checkColorValidityjj(i32 noundef %94, i32 noundef %95)
  store i32 %96, ptr %14, align 8, !tbaa !5
  br label %97

97:                                               ; preds = %83, %93, %92, %88, %85, %50, %37, %10, %6
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL18checkColorValidityjj(i32 noundef, i32 noundef) local_unnamed_addr #0

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

!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 288}
!6 = !{!"_ZTS15LodePNG_Decoder", !7, i64 0, !12, i64 24, !16, i64 64, !9, i64 288}
!7 = !{!"_ZTS22LodePNG_DecodeSettings", !8, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16}
!8 = !{!"_ZTS27LodeZlib_DecompressSettings", !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTS15LodePNG_InfoRaw", !13, i64 0}
!13 = !{!"_ZTS17LodePNG_InfoColor", !9, i64 0, !9, i64 4, !14, i64 8, !15, i64 16, !9, i64 24, !9, i64 28, !9, i64 32, !9, i64 36}
!14 = !{!"any pointer", !10, i64 0}
!15 = !{!"long", !10, i64 0}
!16 = !{!"_ZTS15LodePNG_InfoPng", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16, !13, i64 24, !9, i64 64, !9, i64 68, !9, i64 72, !9, i64 76, !17, i64 80, !18, i64 104, !10, i64 144, !19, i64 148, !9, i64 160, !9, i64 164, !9, i64 168, !10, i64 172, !20, i64 176}
!17 = !{!"_ZTS12LodePNG_Text", !15, i64 0, !14, i64 8, !14, i64 16}
!18 = !{!"_ZTS13LodePNG_IText", !15, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32}
!19 = !{!"_ZTS12LodePNG_Time", !9, i64 0, !10, i64 4, !10, i64 5, !10, i64 6, !10, i64 7, !10, i64 8}
!20 = !{!"_ZTS21LodePNG_UnknownChunks", !10, i64 0, !10, i64 24}
!21 = !{!10, !10, i64 0}
!22 = !{!6, !9, i64 64}
!23 = !{!6, !9, i64 68}
!24 = !{!6, !9, i64 92}
!25 = !{!6, !9, i64 88}
!26 = !{!6, !9, i64 72}
!27 = !{!6, !9, i64 76}
!28 = !{!6, !9, i64 80}
!29 = !{!6, !9, i64 4}


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