; LLVM IR from facebookresearch/habitat-sim :: src/deps/basis-universal/encoder (basisu_ssim)

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

%"class.basisu::vec" = type { [4 x float] }

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu6imagef9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu6imagef10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu3vecILj4EfEC2Effff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16), i32 noundef) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN6basisu6imagefclEjj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN6basisu3vecILj4EfE3setEffff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu6imagef6resizeERKS0_jRKNS_3vecILj4EfEE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZNK6basisu6imagefclEjj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6basisu9mul_imageERKNS_6imagefERS0_RKNS_3vecILj4EfEE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 4 dereferenceable(16) %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.basisu::vec", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = 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
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  call void @_ZN6basisu3vecILj4EfEC2Effff(ptr noundef nonnull align 4 dereferenceable(16) %7, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 1.000000e+00)
  %14 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu6imagef6resizeERKS0_jRKNS_3vecILj4EfEE(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef -1, ptr noundef nonnull align 4 dereferenceable(16) %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %62, %3
  %16 = load i32, ptr %8, align 4, !tbaa !9
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call noundef i32 @_ZNK6basisu6imagef10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %17)
  %19 = icmp slt i32 %16, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %15
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %65

21:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %58, %21
  %23 = load i32, ptr %10, align 4, !tbaa !9
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call noundef i32 @_ZNK6basisu6imagef9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %24)
  %26 = icmp ult i32 %23, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %22
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %61

28:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = load i32, ptr %10, align 4, !tbaa !9
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK6basisu6imagefclEjj(ptr noundef nonnull align 8 dereferenceable(32) %29, i32 noundef %30, i32 noundef %31)
  store ptr %32, ptr %11, align 8, !tbaa !5
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = load i32, ptr %8, align 4, !tbaa !9
  %36 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN6basisu6imagefclEjj(ptr noundef nonnull align 8 dereferenceable(32) %33, i32 noundef %34, i32 noundef %35)
  %37 = load ptr, ptr %11, align 8, !tbaa !5
  %38 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %37, i32 noundef 0)
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %39, i32 noundef 0)
  %41 = fmul float %38, %40
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  %43 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %42, i32 noundef 1)
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %44, i32 noundef 1)
  %46 = fmul float %43, %45
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %47, i32 noundef 2)
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %49, i32 noundef 2)
  %51 = fmul float %48, %50
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %52, i32 noundef 3)
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %54, i32 noundef 3)
  %56 = fmul float %53, %55
  %57 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN6basisu3vecILj4EfE3setEffff(ptr noundef nonnull align 4 dereferenceable(16) %36, float noundef %41, float noundef %46, float noundef %51, float noundef %56)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %58

58:                                               ; preds = %28
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = add i32 %59, 1
  store i32 %60, ptr %10, align 4, !tbaa !9
  br label %22, !llvm.loop !11

61:                                               ; preds = %27
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %8, align 4, !tbaa !9
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %8, align 4, !tbaa !9
  br label %15, !llvm.loop !13

65:                                               ; preds = %20
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { inlinehint 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 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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

%"class.basisu::vec" = type { [4 x float] }

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu6imagef9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu6imagef10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu3vecILj4EfEC2Effff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN6basisu6imagefclEjj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN6basisu3vecILj4EfE3setEffff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu6imagef6resizeERKS0_jRKNS_3vecILj4EfEE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZNK6basisu6imagefclEjj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6basisu9mul_imageERKNS_6imagefERS0_RKNS_3vecILj4EfEE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 4 dereferenceable(16) %2) local_unnamed_addr #3 {
  %4 = alloca %"class.basisu::vec", align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  call void @_ZN6basisu3vecILj4EfEC2Effff(ptr noundef nonnull align 4 dereferenceable(16) %4, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 1.000000e+00)
  %5 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu6imagef6resizeERKS0_jRKNS_3vecILj4EfEE(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef -1, ptr noundef nonnull align 4 dereferenceable(16) %4)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  %6 = call noundef i32 @_ZNK6basisu6imagef10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.preheader, label %._crit_edge24

.preheader:                                       ; preds = %3, %._crit_edge
  %.023 = phi i32 [ %9, %._crit_edge ], [ 0, %3 ]
  %8 = call noundef i32 @_ZNK6basisu6imagef9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge24:                                    ; preds = %._crit_edge, %3
  ret void

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %9 = add nuw nsw i32 %.023, 1
  %10 = call noundef i32 @_ZNK6basisu6imagef10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %11 = icmp slt i32 %9, %10
  br i1 %11, label %.preheader, label %._crit_edge24, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.02122 = phi i32 [ %27, %.lr.ph ], [ 0, %.preheader ]
  %12 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK6basisu6imagefclEjj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %.02122, i32 noundef %.023)
  %13 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN6basisu6imagefclEjj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %.02122, i32 noundef %.023)
  %14 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %12, i32 noundef 0)
  %15 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %2, i32 noundef 0)
  %16 = fmul float %14, %15
  %17 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %12, i32 noundef 1)
  %18 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %2, i32 noundef 1)
  %19 = fmul float %17, %18
  %20 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %12, i32 noundef 2)
  %21 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %2, i32 noundef 2)
  %22 = fmul float %20, %21
  %23 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %12, i32 noundef 3)
  %24 = call noundef float @_ZNK6basisu3vecILj4EfEixEj(ptr noundef nonnull align 4 dereferenceable(16) %2, i32 noundef 3)
  %25 = fmul float %23, %24
  %26 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN6basisu3vecILj4EfE3setEffff(ptr noundef nonnull align 4 dereferenceable(16) %13, float noundef %16, float noundef %19, float noundef %22, float noundef %25)
  %27 = add nuw i32 %.02122, 1
  %28 = call noundef i32 @_ZNK6basisu6imagef9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %29 = icmp ult i32 %27, %28
  br i1 %29, label %.lr.ph, label %._crit_edge, !llvm.loop !7
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { inlinehint 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 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass