; LLVM IR from DanEngelbrecht/longtail :: cmd/lib/minifb/ext/minifb/src (MiniFB_internal)

; 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.SWindowData = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, float, float, float, float, ptr, i32, i32, i32, i32, i32, float, float, [8 x i8], [512 x i8], i32, i8, i8, i8 }

; Function Attrs: nounwind uwtable
define dso_local void @resize_dst(ptr noundef %0, i32 noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %7 = load i32, ptr %5, align 4, !tbaa !9
  %8 = uitofp i32 %7 to float
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.SWindowData, ptr %9, i32 0, i32 16
  %11 = load float, ptr %10, align 8, !tbaa !11
  %12 = fmul float %8, %11
  %13 = fptoui float %12 to i32
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.SWindowData, ptr %14, i32 0, i32 12
  store i32 %13, ptr %15, align 8, !tbaa !15
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = uitofp i32 %16 to float
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.SWindowData, ptr %18, i32 0, i32 17
  %20 = load float, ptr %19, align 4, !tbaa !16
  %21 = fmul float %17, %20
  %22 = fptoui float %21 to i32
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.SWindowData, ptr %23, i32 0, i32 13
  store i32 %22, ptr %24, align 4, !tbaa !17
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = uitofp i32 %25 to float
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.SWindowData, ptr %27, i32 0, i32 18
  %29 = load float, ptr %28, align 8, !tbaa !18
  %30 = fmul float %26, %29
  %31 = fptoui float %30 to i32
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.SWindowData, ptr %32, i32 0, i32 14
  store i32 %31, ptr %33, align 8, !tbaa !19
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = uitofp i32 %34 to float
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.SWindowData, ptr %36, i32 0, i32 19
  %38 = load float, ptr %37, align 4, !tbaa !20
  %39 = fmul float %35, %38
  %40 = fptoui float %39 to i32
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.SWindowData, ptr %41, i32 0, i32 15
  store i32 %40, ptr %42, align 4, !tbaa !21
  ret void
}

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" }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 104}
!12 = !{!"", !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, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !13, i64 104, !13, i64 108, !13, i64 112, !13, i64 116, !6, i64 120, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !13, i64 148, !13, i64 152, !7, i64 156, !7, i64 164, !10, i64 676, !14, i64 680, !14, i64 681, !14, i64 682}
!13 = !{!"float", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!12, !10, i64 88}
!16 = !{!12, !13, i64 108}
!17 = !{!12, !10, i64 92}
!18 = !{!12, !13, i64 112}
!19 = !{!12, !10, i64 96}
!20 = !{!12, !13, i64 116}
!21 = !{!12, !10, i64 100}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @resize_dst(ptr nocapture noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = insertelement <2 x i32> poison, i32 %1, i64 0
  %5 = insertelement <2 x i32> %4, i32 %2, i64 1
  %6 = uitofp <2 x i32> %5 to <2 x float>
  %7 = shufflevector <2 x float> %6, <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
  %8 = getelementptr inbounds i8, ptr %0, i64 104
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  %10 = load <4 x float>, ptr %8, align 8, !tbaa !5
  %11 = fmul <4 x float> %10, %7
  %12 = fptoui <4 x float> %11 to <4 x i32>
  store <4 x i32> %12, ptr %9, align 8, !tbaa !9
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass