; 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.tagPKPixelInfo = type { ptr, i64, i32, i32, i32, i64, i32, i32, i32, i32 }
%struct.tagPKFormatConverter = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct._GUID }
%struct.tagPKImageEncode = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, %struct._GUID, i32, i32, i32, float, float, i32, i32, i64, i64, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, %struct.DESCRIPTIVEMETADATA, i32, %struct.anon.0 }
%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.anon.0 = type { %struct.tagWmpDEMisc, %struct.tagCWMImageInfo, %struct.tagCWMIStrCodecParam, ptr, %struct.tagCWMImageInfo, %struct.tagCWMIStrCodecParam, ptr, i32, i64, i64, i64, i64, i32, i32, ptr }
%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.tagPKRect = type { i32, i32, i32, i32 }

@GUID_PKPixelFormat12bppYCC420 = external dso_local constant %struct._GUID, align 4
@GUID_PKPixelFormat16bppYCC422 = external dso_local constant %struct._GUID, align 4
@__const.PKImageEncode_WriteSource.enPFFrom = external hidden unnamed_addr constant %struct._GUID, align 4
@__const.PKImageEncode_WriteSource.enPFTo = external hidden unnamed_addr constant %struct._GUID, align 4

; Function Attrs: nounwind uwtable
declare dso_local i64 @PKAllocAligned(ptr noundef, i64 noundef, i64 noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @PKFreeAligned(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @PixelFormatLookup(ptr noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #2

; 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) #3

; Function Attrs: nounwind uwtable
define dso_local i64 @PKImageEncode_WriteSource(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca %struct._GUID, align 4
  %9 = alloca %struct._GUID, align 4
  %10 = alloca %struct.tagPKPixelInfo, align 8
  %11 = alloca %struct.tagPKPixelInfo, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 @__const.PKImageEncode_WriteSource.enPFFrom, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 @__const.PKImageEncode_WriteSource.enPFTo, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 56, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 56, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store ptr null, ptr %15, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.tagPKFormatConverter, ptr %16, i32 0, i32 3
  %18 = load ptr, ptr %17, align 8, !tbaa !13
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = call i64 %18(ptr noundef %19, ptr noundef %8)
  store i64 %20, ptr %7, align 8, !tbaa !9
  %21 = icmp slt i64 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %3
  %23 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %23, ptr %7, align 8, !tbaa !9
  br label %177

24:                                               ; preds = %3
  %25 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %25, ptr %7, align 8, !tbaa !9
  br label %26

26:                                               ; preds = %24
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.tagPKFormatConverter, ptr %27, i32 0, i32 2
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = call i64 %29(ptr noundef %30, ptr noundef %9)
  store i64 %31, ptr %7, align 8, !tbaa !9
  %32 = icmp slt i64 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %26
  %34 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %34, ptr %7, align 8, !tbaa !9
  br label %177

35:                                               ; preds = %26
  %36 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %36, ptr %7, align 8, !tbaa !9
  br label %37

37:                                               ; preds = %35
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.tagPKImageEncode, ptr %38, i32 0, i32 17
  %40 = call i32 @memcmp(ptr noundef %39, ptr noundef %9, i64 noundef 16) #5
  %41 = icmp ne i32 %40, 0
  %42 = xor i1 %41, true
  %43 = xor i1 %42, true
  %44 = zext i1 %43 to i64
  %45 = select i1 %43, i32 -106, i32 0
  %46 = sext i32 %45 to i64
  store i64 %46, ptr %7, align 8, !tbaa !9
  %47 = icmp slt i64 %46, 0
  br i1 %47, label %48, label %50

48:                                               ; preds = %37
  %49 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %49, ptr %7, align 8, !tbaa !9
  br label %177

50:                                               ; preds = %37
  %51 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %51, ptr %7, align 8, !tbaa !9
  br label %52

52:                                               ; preds = %50
  %53 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %10, i32 0, i32 0
  store ptr %8, ptr %53, align 8, !tbaa !18
  %54 = call i64 @PixelFormatLookup(ptr noundef %10, i8 noundef zeroext 0)
  %55 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %11, i32 0, i32 0
  store ptr %9, ptr %55, align 8, !tbaa !18
  %56 = call i64 @PixelFormatLookup(ptr noundef %11, i8 noundef zeroext 0)
  %57 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %10, i32 0, i32 3
  %58 = load i32, ptr %57, align 4, !tbaa !20
  %59 = icmp eq i32 0, %58
  br i1 %59, label %60, label %69

60:                                               ; preds = %52
  %61 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %10, i32 0, i32 4
  %62 = load i32, ptr %61, align 8, !tbaa !21
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.tagPKRect, ptr %63, i32 0, i32 2
  %65 = load i32, ptr %64, align 4, !tbaa !22
  %66 = mul i32 %62, %65
  %67 = add i32 %66, 7
  %68 = lshr i32 %67, 3
  br label %78

69:                                               ; preds = %52
  %70 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %10, i32 0, i32 4
  %71 = load i32, ptr %70, align 8, !tbaa !21
  %72 = add i32 %71, 7
  %73 = lshr i32 %72, 3
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.tagPKRect, ptr %74, i32 0, i32 2
  %76 = load i32, ptr %75, align 4, !tbaa !22
  %77 = mul i32 %73, %76
  br label %78

78:                                               ; preds = %69, %60
  %79 = phi i32 [ %68, %60 ], [ %77, %69 ]
  store i32 %79, ptr %13, align 4, !tbaa !11
  %80 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %10, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !18
  %82 = icmp eq ptr @GUID_PKPixelFormat12bppYCC420, %81
  br i1 %82, label %87, label %83

83:                                               ; preds = %78
  %84 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %10, i32 0, i32 0
  %85 = load ptr, ptr %84, align 8, !tbaa !18
  %86 = icmp eq ptr @GUID_PKPixelFormat16bppYCC422, %85
  br i1 %86, label %87, label %90

87:                                               ; preds = %83, %78
  %88 = load i32, ptr %13, align 4, !tbaa !11
  %89 = lshr i32 %88, 1
  store i32 %89, ptr %13, align 4, !tbaa !11
  br label %90

90:                                               ; preds = %87, %83
  %91 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %11, i32 0, i32 3
  %92 = load i32, ptr %91, align 4, !tbaa !20
  %93 = icmp eq i32 0, %92
  br i1 %93, label %94, label %103

94:                                               ; preds = %90
  %95 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %11, i32 0, i32 4
  %96 = load i32, ptr %95, align 8, !tbaa !21
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.tagPKImageEncode, ptr %97, i32 0, i32 18
  %99 = load i32, ptr %98, align 8, !tbaa !24
  %100 = mul i32 %96, %99
  %101 = add i32 %100, 7
  %102 = lshr i32 %101, 3
  br label %112

103:                                              ; preds = %90
  %104 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %11, i32 0, i32 4
  %105 = load i32, ptr %104, align 8, !tbaa !21
  %106 = add i32 %105, 7
  %107 = lshr i32 %106, 3
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.tagPKImageEncode, ptr %108, i32 0, i32 18
  %110 = load i32, ptr %109, align 8, !tbaa !24
  %111 = mul i32 %107, %110
  br label %112

112:                                              ; preds = %103, %94
  %113 = phi i32 [ %102, %94 ], [ %111, %103 ]
  store i32 %113, ptr %12, align 4, !tbaa !11
  %114 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %11, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !18
  %116 = icmp eq ptr @GUID_PKPixelFormat12bppYCC420, %115
  br i1 %116, label %121, label %117

117:                                              ; preds = %112
  %118 = getelementptr inbounds %struct.tagPKPixelInfo, ptr %11, i32 0, i32 0
  %119 = load ptr, ptr %118, align 8, !tbaa !18
  %120 = icmp eq ptr @GUID_PKPixelFormat16bppYCC422, %119
  br i1 %120, label %121, label %124

121:                                              ; preds = %117, %112
  %122 = load i32, ptr %12, align 4, !tbaa !11
  %123 = lshr i32 %122, 1
  store i32 %123, ptr %12, align 4, !tbaa !11
  br label %124

124:                                              ; preds = %121, %117
  %125 = load i32, ptr %13, align 4, !tbaa !11
  %126 = load i32, ptr %12, align 4, !tbaa !11
  %127 = icmp ugt i32 %125, %126
  br i1 %127, label %128, label %130

128:                                              ; preds = %124
  %129 = load i32, ptr %13, align 4, !tbaa !11
  br label %132

130:                                              ; preds = %124
  %131 = load i32, ptr %12, align 4, !tbaa !11
  br label %132

132:                                              ; preds = %130, %128
  %133 = phi i32 [ %129, %128 ], [ %131, %130 ]
  store i32 %133, ptr %14, align 4, !tbaa !11
  %134 = load i32, ptr %14, align 4, !tbaa !11
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.tagPKRect, ptr %135, i32 0, i32 3
  %137 = load i32, ptr %136, align 4, !tbaa !33
  %138 = mul i32 %134, %137
  %139 = zext i32 %138 to i64
  %140 = call i64 @PKAllocAligned(ptr noundef %15, i64 noundef %139, i64 noundef 128)
  store i64 %140, ptr %7, align 8, !tbaa !9
  %141 = icmp slt i64 %140, 0
  br i1 %141, label %142, label %144

142:                                              ; preds = %132
  %143 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %143, ptr %7, align 8, !tbaa !9
  br label %177

144:                                              ; preds = %132
  %145 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %145, ptr %7, align 8, !tbaa !9
  br label %146

146:                                              ; preds = %144
  %147 = load ptr, ptr %5, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.tagPKFormatConverter, ptr %147, i32 0, i32 6
  %149 = load ptr, ptr %148, align 8, !tbaa !34
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = load ptr, ptr %6, align 8, !tbaa !5
  %152 = load ptr, ptr %15, align 8, !tbaa !5
  %153 = load i32, ptr %14, align 4, !tbaa !11
  %154 = call i64 %149(ptr noundef %150, ptr noundef %151, ptr noundef %152, i32 noundef %153)
  store i64 %154, ptr %7, align 8, !tbaa !9
  %155 = icmp slt i64 %154, 0
  br i1 %155, label %156, label %158

156:                                              ; preds = %146
  %157 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %157, ptr %7, align 8, !tbaa !9
  br label %177

158:                                              ; preds = %146
  %159 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %159, ptr %7, align 8, !tbaa !9
  br label %160

160:                                              ; preds = %158
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.tagPKImageEncode, ptr %161, i32 0, i32 7
  %163 = load ptr, ptr %162, align 8, !tbaa !35
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  %165 = load ptr, ptr %6, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.tagPKRect, ptr %165, i32 0, i32 3
  %167 = load i32, ptr %166, align 4, !tbaa !33
  %168 = load ptr, ptr %15, align 8, !tbaa !5
  %169 = load i32, ptr %14, align 4, !tbaa !11
  %170 = call i64 %163(ptr noundef %164, i32 noundef %167, ptr noundef %168, i32 noundef %169)
  store i64 %170, ptr %7, align 8, !tbaa !9
  %171 = icmp slt i64 %170, 0
  br i1 %171, label %172, label %174

172:                                              ; preds = %160
  %173 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %173, ptr %7, align 8, !tbaa !9
  br label %177

174:                                              ; preds = %160
  %175 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %175, ptr %7, align 8, !tbaa !9
  br label %176

176:                                              ; preds = %174
  br label %177

177:                                              ; preds = %176, %172, %156, %142, %48, %33, %22
  %178 = call i64 @PKFreeAligned(ptr noundef %15)
  %179 = load i64, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret i64 %179
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 24}
!14 = !{!"tagPKFormatConverter", !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, !15, i64 80}
!15 = !{!"_GUID", !12, i64 0, !16, i64 4, !16, i64 6, !7, i64 8}
!16 = !{!"short", !7, i64 0}
!17 = !{!14, !6, i64 16}
!18 = !{!19, !6, i64 0}
!19 = !{!"tagPKPixelInfo", !6, i64 0, !10, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !10, i64 32, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52}
!20 = !{!19, !12, i64 20}
!21 = !{!19, !12, i64 24}
!22 = !{!23, !12, i64 8}
!23 = !{!"tagPKRect", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!24 = !{!25, !12, i64 152}
!25 = !{!"tagPKImageEncode", !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, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !10, i64 128, !15, i64 136, !12, i64 152, !12, i64 156, !12, i64 160, !26, i64 164, !26, i64 168, !12, i64 172, !12, i64 176, !10, i64 184, !10, i64 192, !6, i64 200, !12, i64 208, !6, i64 216, !12, i64 224, !6, i64 232, !12, i64 240, !6, i64 248, !12, i64 256, !6, i64 264, !12, i64 272, !6, i64 280, !12, i64 288, !27, i64 296, !12, i64 520, !29, i64 528}
!26 = !{!"float", !7, i64 0}
!27 = !{!"DESCRIPTIVEMETADATA", !28, i64 0, !28, i64 16, !28, i64 32, !28, i64 48, !28, i64 64, !28, i64 80, !28, i64 96, !28, i64 112, !28, i64 128, !28, i64 144, !28, i64 160, !28, i64 176, !28, i64 192, !28, i64 208}
!28 = !{!"DPKPROPVARIANT", !12, i64 0, !7, i64 8}
!29 = !{!"", !30, i64 0, !31, i64 88, !32, i64 208, !6, i64 33088, !31, i64 33096, !32, i64 33216, !6, i64 66096, !12, i64 66104, !10, i64 66112, !10, i64 66120, !10, i64 66128, !10, i64 66136, !12, i64 66144, !12, i64 66148, !6, i64 66152}
!30 = !{!"tagWmpDEMisc", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84}
!31 = !{!"tagCWMImageInfo", !10, i64 0, !10, i64 8, !12, i64 16, !12, i64 20, !10, i64 24, !10, i64 32, !12, i64 40, !7, i64 44, !7, i64 45, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !12, i64 80, !10, i64 88, !10, i64 96, !12, i64 104, !7, i64 108, !12, i64 112}
!32 = !{!"tagCWMIStrCodecParam", !12, 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, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !10, i64 32, !7, i64 40, !12, i64 44, !7, i64 48, !6, i64 56, !10, i64 64, !12, i64 72, !7, i64 76, !12, i64 16460, !7, i64 16464, !7, i64 32848, !7, i64 32849, !12, i64 32852, !12, i64 32856, !12, i64 32860, !12, i64 32864, !12, i64 32868, !12, i64 32872}
!33 = !{!23, !12, i64 12}
!34 = !{!14, !6, i64 48}
!35 = !{!25, !6, i64 56}


; 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] }
%struct.tagPKPixelInfo = type { ptr, i64, i32, i32, i32, i64, i32, i32, i32, i32 }

@GUID_PKPixelFormat12bppYCC420 = external dso_local constant %struct._GUID, align 4
@GUID_PKPixelFormat16bppYCC422 = external dso_local constant %struct._GUID, align 4
@__const.PKImageEncode_WriteSource.enPFFrom = external hidden unnamed_addr constant %struct._GUID, align 4
@__const.PKImageEncode_WriteSource.enPFTo = external hidden unnamed_addr constant %struct._GUID, align 4

; Function Attrs: nounwind uwtable
declare dso_local i64 @PKAllocAligned(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @PKFreeAligned(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @PixelFormatLookup(ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

; 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) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @PKImageEncode_WriteSource(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca %struct._GUID, align 4
  %5 = alloca %struct._GUID, align 4
  %6 = alloca %struct.tagPKPixelInfo, align 8
  %7 = alloca %struct.tagPKPixelInfo, align 8
  %8 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(16) @__const.PKImageEncode_WriteSource.enPFFrom, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(16) @__const.PKImageEncode_WriteSource.enPFTo, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  store ptr null, ptr %8, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %1, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = call i64 %10(ptr noundef %1, ptr noundef nonnull %4) #5
  %12 = icmp slt i64 %11, 0
  br i1 %12, label %88, label %13

13:                                               ; preds = %3
  %14 = getelementptr inbounds i8, ptr %1, i64 16
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = call i64 %15(ptr noundef nonnull %1, ptr noundef nonnull %5) #5
  %17 = icmp slt i64 %16, 0
  br i1 %17, label %88, label %18

18:                                               ; preds = %13
  %19 = getelementptr inbounds i8, ptr %0, i64 136
  %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(16) %19, ptr noundef nonnull dereferenceable(16) %5, i64 16)
  %.not = icmp eq i32 %bcmp, 0
  br i1 %.not, label %20, label %88

20:                                               ; preds = %18
  store ptr %4, ptr %6, align 8, !tbaa !15
  %21 = call i64 @PixelFormatLookup(ptr noundef nonnull %6, i8 noundef zeroext 0)
  store ptr %5, ptr %7, align 8, !tbaa !15
  %22 = call i64 @PixelFormatLookup(ptr noundef nonnull %7, i8 noundef zeroext 0)
  %23 = getelementptr inbounds i8, ptr %6, i64 20
  %24 = load i32, ptr %23, align 4, !tbaa !18
  %25 = icmp eq i32 %24, 0
  %26 = getelementptr inbounds i8, ptr %6, i64 24
  %27 = load i32, ptr %26, align 8, !tbaa !19
  br i1 %25, label %28, label %34

28:                                               ; preds = %20
  %29 = getelementptr inbounds i8, ptr %2, i64 8
  %30 = load i32, ptr %29, align 4, !tbaa !20
  %31 = mul i32 %30, %27
  %32 = add i32 %31, 7
  %33 = lshr i32 %32, 3
  br label %40

34:                                               ; preds = %20
  %35 = add i32 %27, 7
  %36 = lshr i32 %35, 3
  %37 = getelementptr inbounds i8, ptr %2, i64 8
  %38 = load i32, ptr %37, align 4, !tbaa !20
  %39 = mul i32 %36, %38
  br label %40

40:                                               ; preds = %34, %28
  %41 = phi i32 [ %33, %28 ], [ %39, %34 ]
  %42 = load ptr, ptr %6, align 8
  %43 = icmp eq ptr %42, @GUID_PKPixelFormat12bppYCC420
  %44 = icmp eq ptr %42, @GUID_PKPixelFormat16bppYCC422
  %or.cond = or i1 %43, %44
  %45 = zext i1 %or.cond to i32
  %spec.select = lshr i32 %41, %45
  %46 = getelementptr inbounds i8, ptr %7, i64 20
  %47 = load i32, ptr %46, align 4, !tbaa !18
  %48 = icmp eq i32 %47, 0
  %49 = getelementptr inbounds i8, ptr %7, i64 24
  %50 = load i32, ptr %49, align 8, !tbaa !19
  br i1 %48, label %51, label %57

51:                                               ; preds = %40
  %52 = getelementptr inbounds i8, ptr %0, i64 152
  %53 = load i32, ptr %52, align 8, !tbaa !22
  %54 = mul i32 %53, %50
  %55 = add i32 %54, 7
  %56 = lshr i32 %55, 3
  br label %63

57:                                               ; preds = %40
  %58 = add i32 %50, 7
  %59 = lshr i32 %58, 3
  %60 = getelementptr inbounds i8, ptr %0, i64 152
  %61 = load i32, ptr %60, align 8, !tbaa !22
  %62 = mul i32 %59, %61
  br label %63

63:                                               ; preds = %57, %51
  %64 = phi i32 [ %56, %51 ], [ %62, %57 ]
  %65 = load ptr, ptr %7, align 8
  %66 = icmp eq ptr %65, @GUID_PKPixelFormat12bppYCC420
  %67 = icmp eq ptr %65, @GUID_PKPixelFormat16bppYCC422
  %or.cond5 = or i1 %66, %67
  %68 = zext i1 %or.cond5 to i32
  %spec.select49 = lshr i32 %64, %68
  %69 = call i32 @llvm.umax.i32(i32 %spec.select, i32 %spec.select49)
  %70 = getelementptr inbounds i8, ptr %2, i64 12
  %71 = load i32, ptr %70, align 4, !tbaa !31
  %72 = mul i32 %69, %71
  %73 = zext i32 %72 to i64
  %74 = call i64 @PKAllocAligned(ptr noundef nonnull %8, i64 noundef %73, i64 noundef 128)
  %75 = icmp slt i64 %74, 0
  br i1 %75, label %88, label %76

76:                                               ; preds = %63
  %77 = getelementptr inbounds i8, ptr %1, i64 48
  %78 = load ptr, ptr %77, align 8, !tbaa !32
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = call i64 %78(ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %79, i32 noundef %69) #5
  %81 = icmp slt i64 %80, 0
  br i1 %81, label %88, label %82

82:                                               ; preds = %76
  %83 = getelementptr inbounds i8, ptr %0, i64 56
  %84 = load ptr, ptr %83, align 8, !tbaa !33
  %85 = load i32, ptr %70, align 4, !tbaa !31
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = call i64 %84(ptr noundef nonnull %0, i32 noundef %85, ptr noundef %86, i32 noundef %69) #5
  br label %88

88:                                               ; preds = %82, %76, %63, %18, %13, %3
  %.043 = phi i64 [ %11, %3 ], [ %16, %13 ], [ -106, %18 ], [ %74, %63 ], [ %80, %76 ], [ %87, %82 ]
  %89 = call i64 @PKFreeAligned(ptr noundef nonnull %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  ret i64 %.043
}

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #4

attributes #0 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind willreturn memory(argmem: read) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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/C++ TBAA"}
!9 = !{!10, !6, i64 24}
!10 = !{!"tagPKFormatConverter", !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, !11, i64 80}
!11 = !{!"_GUID", !12, i64 0, !13, i64 4, !13, i64 6, !7, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!16, !6, i64 0}
!16 = !{!"tagPKPixelInfo", !6, i64 0, !17, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !17, i64 32, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52}
!17 = !{!"long", !7, i64 0}
!18 = !{!16, !12, i64 20}
!19 = !{!16, !12, i64 24}
!20 = !{!21, !12, i64 8}
!21 = !{!"tagPKRect", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!22 = !{!23, !12, i64 152}
!23 = !{!"tagPKImageEncode", !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, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !17, i64 128, !11, i64 136, !12, i64 152, !12, i64 156, !12, i64 160, !24, i64 164, !24, i64 168, !12, i64 172, !12, i64 176, !17, i64 184, !17, i64 192, !6, i64 200, !12, i64 208, !6, i64 216, !12, i64 224, !6, i64 232, !12, i64 240, !6, i64 248, !12, i64 256, !6, i64 264, !12, i64 272, !6, i64 280, !12, i64 288, !25, i64 296, !12, i64 520, !27, i64 528}
!24 = !{!"float", !7, i64 0}
!25 = !{!"DESCRIPTIVEMETADATA", !26, i64 0, !26, i64 16, !26, i64 32, !26, i64 48, !26, i64 64, !26, i64 80, !26, i64 96, !26, i64 112, !26, i64 128, !26, i64 144, !26, i64 160, !26, i64 176, !26, i64 192, !26, i64 208}
!26 = !{!"DPKPROPVARIANT", !12, i64 0, !7, i64 8}
!27 = !{!"", !28, i64 0, !29, i64 88, !30, i64 208, !6, i64 33088, !29, i64 33096, !30, i64 33216, !6, i64 66096, !12, i64 66104, !17, i64 66112, !17, i64 66120, !17, i64 66128, !17, i64 66136, !12, i64 66144, !12, i64 66148, !6, i64 66152}
!28 = !{!"tagWmpDEMisc", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84}
!29 = !{!"tagCWMImageInfo", !17, i64 0, !17, i64 8, !12, i64 16, !12, i64 20, !17, i64 24, !17, i64 32, !12, i64 40, !7, i64 44, !7, i64 45, !17, i64 48, !17, i64 56, !17, i64 64, !17, i64 72, !12, i64 80, !17, i64 88, !17, i64 96, !12, i64 104, !7, i64 108, !12, i64 112}
!30 = !{!"tagCWMIStrCodecParam", !12, 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, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !17, i64 32, !7, i64 40, !12, i64 44, !7, i64 48, !6, i64 56, !17, i64 64, !12, i64 72, !7, i64 76, !12, i64 16460, !7, i64 16464, !7, i64 32848, !7, i64 32849, !12, i64 32852, !12, i64 32856, !12, i64 32860, !12, i64 32864, !12, i64 32868, !12, i64 32872}
!31 = !{!21, !12, i64 12}
!32 = !{!10, !6, i64 48}
!33 = !{!23, !6, i64 56}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass