; LLVM IR from corentinartaud/graphics :: ThirdParty/FreeImage-3170/Source/LibJXR/jxrgluelib (JXRGlue)

; 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._GUID = type { i32, i16, i16, [8 x i8] }
%struct.tagPKImageDecode = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i64, %struct._GUID, i32, i32, i32, float, float, i32, %struct.anon }
%struct.anon = type { %struct.tagWmpDEMisc, %struct.tagCWMImageInfo, %struct.tagCWMIStrCodecParam, ptr, %struct.tagCWMImageInfo, %struct.tagCWMIStrCodecParam, ptr, i32, i64, i64, i64, i64, i32, i64, i64, i64, i64, i64, i32, i32, i32, %struct.DESCRIPTIVEMETADATA }
%struct.tagWmpDEMisc = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.tagCWMImageInfo = type { i64, i64, i32, i32, i64, i64, i32, i8, i8, i64, i64, i64, i64, i32, i64, i64, i32, i8, i32 }
%struct.tagCWMIStrCodecParam = type { i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i64, i8, i32, i8, ptr, i64, i32, [4096 x i32], i32, [4096 x i32], i8, i8, i32, i32, i32, i32, i32, i32 }
%struct.DESCRIPTIVEMETADATA = type { %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT, %struct.DPKPROPVARIANT }
%struct.DPKPROPVARIANT = type { i32, %union.anon }
%union.anon = type { ptr }
%struct.WMPStream = type { %union.anon.1, i32, ptr, ptr, ptr, ptr, ptr, ptr }
%union.anon.1 = type { %struct.tagBuf }
%struct.tagBuf = type { ptr, i64, i64, i64 }

@GUID_PKPixelFormatDontCare = external dso_local constant %struct._GUID, align 4

; 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: 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) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @PKImageDecode_Initialize(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !9
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.tagPKImageDecode, ptr %7, i32 0, i32 11
  store ptr %6, ptr %8, align 8, !tbaa !11
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.tagPKImageDecode, ptr %9, i32 0, i32 14
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 4 @GUID_PKPixelFormatDontCare, i64 16, i1 false), !tbaa.struct !23
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.tagPKImageDecode, ptr %11, i32 0, i32 18
  store float 9.600000e+01, ptr %12, align 4, !tbaa !27
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.tagPKImageDecode, ptr %13, i32 0, i32 19
  store float 9.600000e+01, ptr %14, align 8, !tbaa !28
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.tagPKImageDecode, ptr %15, i32 0, i32 20
  store i32 1, ptr %16, align 4, !tbaa !29
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.tagPKImageDecode, ptr %17, i32 0, i32 11
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds %struct.WMPStream, ptr %19, i32 0, i32 7
  %21 = load ptr, ptr %20, align 8, !tbaa !30
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.tagPKImageDecode, ptr %22, i32 0, i32 11
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.tagPKImageDecode, ptr %25, i32 0, i32 13
  %27 = call i64 %21(ptr noundef %24, ptr noundef %26)
  store i64 %27, ptr %5, align 8, !tbaa !9
  %28 = icmp slt i64 %27, 0
  br i1 %28, label %29, label %31

29:                                               ; preds = %2
  %30 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %30, ptr %5, align 8, !tbaa !9
  br label %37

31:                                               ; preds = %2
  %32 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %32, ptr %5, align 8, !tbaa !9
  br label %33

33:                                               ; preds = %31
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.tagPKImageDecode, ptr %34, i32 0, i32 21
  %36 = getelementptr inbounds %struct.anon, ptr %35, i32 0, i32 0
  call void @llvm.memset.p0.i64(ptr align 8 %36, i8 0, i64 88, i1 false)
  br label %37

37:                                               ; preds = %33, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret i64 0
}

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

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 88}
!12 = !{!"tagPKImageDecode", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !13, i64 96, !10, i64 104, !14, i64 112, !13, i64 128, !13, i64 132, !13, i64 136, !16, i64 140, !16, i64 144, !13, i64 148, !17, i64 152}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_GUID", !13, i64 0, !15, i64 4, !15, i64 6, !7, i64 8}
!15 = !{!"short", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!"", !18, i64 0, !19, i64 88, !20, i64 208, !6, i64 33088, !19, i64 33096, !20, i64 33216, !6, i64 66096, !13, i64 66104, !10, i64 66112, !10, i64 66120, !10, i64 66128, !10, i64 66136, !13, i64 66144, !10, i64 66152, !10, i64 66160, !10, i64 66168, !10, i64 66176, !10, i64 66184, !13, i64 66192, !13, i64 66196, !13, i64 66200, !21, i64 66208}
!18 = !{!"tagWmpDEMisc", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !13, i64 76, !13, i64 80, !13, i64 84}
!19 = !{!"tagCWMImageInfo", !10, i64 0, !10, i64 8, !13, i64 16, !13, i64 20, !10, i64 24, !10, i64 32, !13, i64 40, !7, i64 44, !7, i64 45, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !13, i64 80, !10, i64 88, !10, i64 96, !13, i64 104, !7, i64 108, !13, i64 112}
!20 = !{!"tagCWMIStrCodecParam", !13, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !10, i64 32, !7, i64 40, !13, i64 44, !7, i64 48, !6, i64 56, !10, i64 64, !13, i64 72, !7, i64 76, !13, i64 16460, !7, i64 16464, !7, i64 32848, !7, i64 32849, !13, i64 32852, !13, i64 32856, !13, i64 32860, !13, i64 32864, !13, i64 32868, !13, i64 32872}
!21 = !{!"DESCRIPTIVEMETADATA", !22, i64 0, !22, i64 16, !22, i64 32, !22, i64 48, !22, i64 64, !22, i64 80, !22, i64 96, !22, i64 112, !22, i64 128, !22, i64 144, !22, i64 160, !22, i64 176, !22, i64 192, !22, i64 208}
!22 = !{!"DPKPROPVARIANT", !13, i64 0, !7, i64 8}
!23 = !{i64 0, i64 4, !24, i64 4, i64 2, !25, i64 6, i64 2, !25, i64 8, i64 8, !26}
!24 = !{!13, !13, i64 0}
!25 = !{!15, !15, i64 0}
!26 = !{!7, !7, i64 0}
!27 = !{!12, !16, i64 140}
!28 = !{!12, !16, i64 144}
!29 = !{!12, !13, i64 148}
!30 = !{!31, !6, i64 80}
!31 = !{!"WMPStream", !7, i64 0, !13, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}


; 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._GUID = type { i32, i16, i16, [8 x i8] }

@GUID_PKPixelFormatDontCare = external dso_local local_unnamed_addr constant %struct._GUID, align 4

; 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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
define dso_local noundef i64 @PKImageDecode_Initialize(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 88
  store ptr %1, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(16) @GUID_PKPixelFormatDontCare, i64 16, i1 false), !tbaa.struct !21
  %5 = getelementptr inbounds i8, ptr %0, i64 140
  store <2 x float> <float 9.600000e+01, float 9.600000e+01>, ptr %5, align 4, !tbaa !25
  %6 = getelementptr inbounds i8, ptr %0, i64 148
  store i32 1, ptr %6, align 4, !tbaa !26
  %7 = getelementptr inbounds i8, ptr %1, i64 80
  %8 = load ptr, ptr %7, align 8, !tbaa !27
  %9 = getelementptr inbounds i8, ptr %0, i64 104
  %10 = tail call i64 %8(ptr noundef %1, ptr noundef nonnull %9) #3
  %11 = icmp slt i64 %10, 0
  br i1 %11, label %14, label %12

12:                                               ; preds = %2
  %13 = getelementptr inbounds i8, ptr %0, i64 152
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(88) %13, i8 0, i64 88, i1 false)
  br label %14

14:                                               ; preds = %2, %12
  ret i64 0
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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, !7, i64 88}
!6 = !{!"tagPKImageDecode", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !10, i64 96, !11, i64 104, !12, i64 112, !10, i64 128, !10, i64 132, !10, i64 136, !14, i64 140, !14, i64 144, !10, i64 148, !15, i64 152}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"_GUID", !10, i64 0, !13, i64 4, !13, i64 6, !8, i64 8}
!13 = !{!"short", !8, i64 0}
!14 = !{!"float", !8, i64 0}
!15 = !{!"", !16, i64 0, !17, i64 88, !18, i64 208, !7, i64 33088, !17, i64 33096, !18, i64 33216, !7, i64 66096, !10, i64 66104, !11, i64 66112, !11, i64 66120, !11, i64 66128, !11, i64 66136, !10, i64 66144, !11, i64 66152, !11, i64 66160, !11, i64 66168, !11, i64 66176, !11, i64 66184, !10, i64 66192, !10, i64 66196, !10, i64 66200, !19, i64 66208}
!16 = !{!"tagWmpDEMisc", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84}
!17 = !{!"tagCWMImageInfo", !11, i64 0, !11, i64 8, !10, i64 16, !10, i64 20, !11, i64 24, !11, i64 32, !10, i64 40, !8, i64 44, !8, i64 45, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !10, i64 80, !11, i64 88, !11, i64 96, !10, i64 104, !8, i64 108, !10, i64 112}
!18 = !{!"tagCWMIStrCodecParam", !10, i64 0, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !8, i64 8, !8, i64 9, !8, i64 10, !8, i64 11, !8, i64 12, !8, i64 13, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !11, i64 32, !8, i64 40, !10, i64 44, !8, i64 48, !7, i64 56, !11, i64 64, !10, i64 72, !8, i64 76, !10, i64 16460, !8, i64 16464, !8, i64 32848, !8, i64 32849, !10, i64 32852, !10, i64 32856, !10, i64 32860, !10, i64 32864, !10, i64 32868, !10, i64 32872}
!19 = !{!"DESCRIPTIVEMETADATA", !20, i64 0, !20, i64 16, !20, i64 32, !20, i64 48, !20, i64 64, !20, i64 80, !20, i64 96, !20, i64 112, !20, i64 128, !20, i64 144, !20, i64 160, !20, i64 176, !20, i64 192, !20, i64 208}
!20 = !{!"DPKPROPVARIANT", !10, i64 0, !8, i64 8}
!21 = !{i64 0, i64 4, !22, i64 4, i64 2, !23, i64 6, i64 2, !23, i64 8, i64 8, !24}
!22 = !{!10, !10, i64 0}
!23 = !{!13, !13, i64 0}
!24 = !{!8, !8, i64 0}
!25 = !{!14, !14, i64 0}
!26 = !{!6, !10, i64 148}
!27 = !{!28, !7, i64 80}
!28 = !{!"WMPStream", !8, i64 0, !10, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass