; 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: nounwind
declare void @free(ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z24LodePNG_InfoColor_getBppPK17LodePNG_InfoColor(ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z23LodePNG_InfoColor_equalPK17LodePNG_InfoColorS1_(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z22LodePNG_InfoColor_copyP17LodePNG_InfoColorPKS_(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z15LodePNG_convertPhPKhP17LodePNG_InfoColorS3_jj(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z22LodePNG_Decoder_decodeP15LodePNG_DecoderPPhPmPKhm(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  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 ptr %3, ptr %9, align 8, !tbaa !5
  store i64 %4, ptr %10, align 8, !tbaa !9
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %13, align 8, !tbaa !5
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  store i64 0, ptr %14, align 8, !tbaa !9
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = load ptr, ptr %9, align 8, !tbaa !5
  %19 = load i64, ptr %10, align 8, !tbaa !9
  call void @_ZL13decodeGenericP15LodePNG_DecoderPPhPmPKhm(ptr noundef %15, ptr noundef %16, ptr noundef %17, ptr noundef %18, i64 noundef %19)
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %20, i32 0, i32 3
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %5
  br label %145

25:                                               ; preds = %5
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %struct.LodePNG_DecodeSettings, ptr %27, i32 0, i32 2
  %29 = load i32, ptr %28, align 8, !tbaa !23
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %40

31:                                               ; preds = %25
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %32, i32 0, i32 1
  %34 = getelementptr inbounds %struct.LodePNG_InfoRaw, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %35, i32 0, i32 2
  %37 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %36, i32 0, i32 5
  %38 = call noundef i32 @_Z23LodePNG_InfoColor_equalPK17LodePNG_InfoColorS1_(ptr noundef %34, ptr noundef %37)
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %63

40:                                               ; preds = %31, %25
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds %struct.LodePNG_DecodeSettings, ptr %42, i32 0, i32 2
  %44 = load i32, ptr %43, align 8, !tbaa !23
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %62, label %46

46:                                               ; preds = %40
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %47, i32 0, i32 1
  %49 = getelementptr inbounds %struct.LodePNG_InfoRaw, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %50, i32 0, i32 2
  %52 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %51, i32 0, i32 5
  %53 = call noundef i32 @_Z22LodePNG_InfoColor_copyP17LodePNG_InfoColorPKS_(ptr noundef %49, ptr noundef %52)
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %54, i32 0, i32 3
  store i32 %53, ptr %55, align 8, !tbaa !11
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %56, i32 0, i32 3
  %58 = load i32, ptr %57, align 8, !tbaa !11
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %61

60:                                               ; preds = %46
  br label %145

61:                                               ; preds = %46
  br label %62

62:                                               ; preds = %61, %40
  br label %145

63:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  store ptr %65, ptr %11, align 8, !tbaa !5
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %66, i32 0, i32 1
  %68 = getelementptr inbounds %struct.LodePNG_InfoRaw, ptr %67, i32 0, i32 0
  %69 = getelementptr inbounds %struct.LodePNG_InfoColor, ptr %68, i32 0, i32 0
  %70 = load i32, ptr %69, align 8, !tbaa !24
  %71 = icmp eq i32 %70, 2
  br i1 %71, label %89, label %72

72:                                               ; preds = %63
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %73, i32 0, i32 1
  %75 = getelementptr inbounds %struct.LodePNG_InfoRaw, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds %struct.LodePNG_InfoColor, ptr %75, i32 0, i32 0
  %77 = load i32, ptr %76, align 8, !tbaa !24
  %78 = icmp eq i32 %77, 6
  br i1 %78, label %89, label %79

79:                                               ; preds = %72
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %80, i32 0, i32 1
  %82 = getelementptr inbounds %struct.LodePNG_InfoRaw, ptr %81, i32 0, i32 0
  %83 = getelementptr inbounds %struct.LodePNG_InfoColor, ptr %82, i32 0, i32 1
  %84 = load i32, ptr %83, align 4, !tbaa !25
  %85 = icmp eq i32 %84, 8
  br i1 %85, label %89, label %86

86:                                               ; preds = %79
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %87, i32 0, i32 3
  store i32 56, ptr %88, align 8, !tbaa !11
  store i32 1, ptr %12, align 4
  br label %142

89:                                               ; preds = %79, %72, %63
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %90, i32 0, i32 2
  %92 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %91, i32 0, i32 0
  %93 = load i32, ptr %92, align 8, !tbaa !26
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %94, i32 0, i32 2
  %96 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %95, i32 0, i32 1
  %97 = load i32, ptr %96, align 4, !tbaa !27
  %98 = mul i32 %93, %97
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %99, i32 0, i32 1
  %101 = getelementptr inbounds %struct.LodePNG_InfoRaw, ptr %100, i32 0, i32 0
  %102 = call noundef i32 @_Z24LodePNG_InfoColor_getBppPK17LodePNG_InfoColor(ptr noundef %101)
  %103 = mul i32 %98, %102
  %104 = add i32 %103, 7
  %105 = udiv i32 %104, 8
  %106 = zext i32 %105 to i64
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  store i64 %106, ptr %107, align 8, !tbaa !9
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = load i64, ptr %108, align 8, !tbaa !9
  %110 = call noalias ptr @malloc(i64 noundef %109) #6
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %110, ptr %111, align 8, !tbaa !5
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = load ptr, ptr %112, align 8, !tbaa !5
  %114 = icmp ne ptr %113, null
  br i1 %114, label %119, label %115

115:                                              ; preds = %89
  %116 = load ptr, ptr %6, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %116, i32 0, i32 3
  store i32 9947, ptr %117, align 8, !tbaa !11
  %118 = load ptr, ptr %8, align 8, !tbaa !5
  store i64 0, ptr %118, align 8, !tbaa !9
  br label %140

119:                                              ; preds = %89
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  %121 = load ptr, ptr %120, align 8, !tbaa !5
  %122 = load ptr, ptr %11, align 8, !tbaa !5
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %123, i32 0, i32 1
  %125 = getelementptr inbounds %struct.LodePNG_InfoRaw, ptr %124, i32 0, i32 0
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %126, i32 0, i32 2
  %128 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %127, i32 0, i32 5
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %129, i32 0, i32 2
  %131 = getelementptr inbounds %struct.LodePNG_InfoPng, ptr %130, i32 0, i32 0
  %132 = load i32, ptr %131, align 8, !tbaa !26
  %133 = load ptr, ptr %6, 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 1
  %136 = load i32, ptr %135, align 4, !tbaa !27
  %137 = call noundef i32 @_Z15LodePNG_convertPhPKhP17LodePNG_InfoColorS3_jj(ptr noundef %121, ptr noundef %122, ptr noundef %125, ptr noundef %128, i32 noundef %132, i32 noundef %136)
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.LodePNG_Decoder, ptr %138, i32 0, i32 3
  store i32 %137, ptr %139, align 8, !tbaa !11
  br label %140

140:                                              ; preds = %119, %115
  %141 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %141) #5
  store i32 0, ptr %12, align 4
  br label %142

142:                                              ; preds = %140, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  %143 = load i32, ptr %12, align 4
  switch i32 %143, label %146 [
    i32 0, label %144
    i32 1, label %145
  ]

144:                                              ; preds = %142
  br label %145

145:                                              ; preds = %144, %142, %62, %60, %24
  ret void

146:                                              ; preds = %142
  unreachable
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "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 = { 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 #4 = { nounwind allocsize(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 allocsize(0) }

!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 = !{!12, !15, i64 8}
!24 = !{!12, !15, i64 24}
!25 = !{!12, !15, i64 28}
!26 = !{!12, !15, i64 64}
!27 = !{!12, !15, i64 68}


; 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 willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z23LodePNG_InfoColor_equalPK17LodePNG_InfoColorS1_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z22LodePNG_Decoder_decodeP15LodePNG_DecoderPPhPmPKhm(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4) local_unnamed_addr #1 {
  store ptr null, ptr %1, align 8, !tbaa !5
  store i64 0, ptr %2, align 8, !tbaa !9
  tail call void @_ZL13decodeGenericP15LodePNG_DecoderPPhPmPKhm(ptr noundef %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %3, i64 noundef %4)
  %6 = getelementptr inbounds i8, ptr %0, i64 288
  %7 = load i32, ptr %6, align 8, !tbaa !11
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %45

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load i32, ptr %9, align 8, !tbaa !23
  %.not37 = icmp eq i32 %10, 0
  br i1 %.not37, label %.thread, label %11

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = getelementptr inbounds i8, ptr %0, i64 64
  %14 = getelementptr inbounds i8, ptr %0, i64 88
  %15 = tail call noundef i32 @_Z23LodePNG_InfoColor_equalPK17LodePNG_InfoColorS1_(ptr noundef nonnull %12, ptr noundef nonnull %14)
  %.not38 = icmp eq i32 %15, 0
  br i1 %.not38, label %20, label %16

16:                                               ; preds = %11
  %.pr = load i32, ptr %9, align 8, !tbaa !23
  %.not40 = icmp eq i32 %.pr, 0
  br i1 %.not40, label %.thread, label %45

.thread:                                          ; preds = %8, %16
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  %18 = getelementptr inbounds i8, ptr %0, i64 88
  %19 = tail call noundef i32 @_Z22LodePNG_InfoColor_copyP17LodePNG_InfoColorPKS_(ptr noundef nonnull %17, ptr noundef nonnull %18)
  store i32 %19, ptr %6, align 8, !tbaa !11
  br label %45

20:                                               ; preds = %11
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = load i32, ptr %12, align 8, !tbaa !24
  switch i32 %22, label %23 [
    i32 2, label %28
    i32 6, label %28
  ]

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %0, i64 28
  %25 = load i32, ptr %24, align 4, !tbaa !25
  %26 = icmp eq i32 %25, 8
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  store i32 56, ptr %6, align 8, !tbaa !11
  br label %45

28:                                               ; preds = %20, %20, %23
  %29 = load i32, ptr %13, align 8, !tbaa !26
  %30 = getelementptr inbounds i8, ptr %0, i64 68
  %31 = load i32, ptr %30, align 4, !tbaa !27
  %32 = mul i32 %31, %29
  %33 = tail call noundef i32 @_Z24LodePNG_InfoColor_getBppPK17LodePNG_InfoColor(ptr noundef nonnull %12)
  %34 = mul i32 %32, %33
  %35 = add i32 %34, 7
  %36 = lshr i32 %35, 3
  %37 = zext nneg i32 %36 to i64
  store i64 %37, ptr %2, align 8, !tbaa !9
  %38 = tail call noalias ptr @malloc(i64 noundef %37) #4
  store ptr %38, ptr %1, align 8, !tbaa !5
  %.not39 = icmp eq ptr %38, null
  br i1 %.not39, label %39, label %40

39:                                               ; preds = %28
  store i64 0, ptr %2, align 8, !tbaa !9
  br label %44

40:                                               ; preds = %28
  %41 = load i32, ptr %13, align 8, !tbaa !26
  %42 = load i32, ptr %30, align 4, !tbaa !27
  %43 = tail call noundef i32 @_Z15LodePNG_convertPhPKhP17LodePNG_InfoColorS3_jj(ptr noundef nonnull %38, ptr noundef %21, ptr noundef nonnull %12, ptr noundef nonnull %14, i32 noundef %41, i32 noundef %42)
  br label %44

44:                                               ; preds = %40, %39
  %.sink = phi i32 [ 9947, %39 ], [ %43, %40 ]
  store i32 %.sink, ptr %6, align 8
  tail call void @free(ptr noundef %21) #5
  br label %45

45:                                               ; preds = %27, %44, %.thread, %16, %5
  ret void
}

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

attributes #0 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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" }
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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 allocsize(0) }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ 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 = !{!12, !15, i64 8}
!24 = !{!12, !15, i64 24}
!25 = !{!12, !15, i64 28}
!26 = !{!12, !15, i64 64}
!27 = !{!12, !15, i64 68}


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