; LLVM IR from ox-vgg/vise :: src/search_engine/relja_retrival/external/KMCode_relja/descriptor/MomentDescrip_dbc2237a (ZN16MomentDescriptor12computMomentEP12ImageContentfff)

; 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.ImageContent = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; 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: mustprogress uwtable
define dso_local noundef float @_ZN16MomentDescriptor12computMomentEP12ImageContentfff(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1, float noundef %2, float noundef %3, float noundef %4) #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store float %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !9
  store float %4, ptr %10, align 4, !tbaa !9
  %17 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = call noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80) %18)
  %20 = lshr i32 %19, 1
  store i32 %20, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %21 = load i32, ptr %11, align 4, !tbaa !11
  %22 = load i32, ptr %11, align 4, !tbaa !11
  %23 = mul nsw i32 %21, %22
  store i32 %23, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store float 0.000000e+00, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %24 = load i32, ptr %11, align 4, !tbaa !11
  %25 = sub nsw i32 0, %24
  store i32 %25, ptr %14, align 4, !tbaa !11
  br label %26

26:                                               ; preds = %84, %5
  %27 = load i32, ptr %14, align 4, !tbaa !11
  %28 = load i32, ptr %11, align 4, !tbaa !11
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %87

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %32 = load i32, ptr %11, align 4, !tbaa !11
  %33 = sub nsw i32 0, %32
  store i32 %33, ptr %16, align 4, !tbaa !11
  br label %34

34:                                               ; preds = %80, %31
  %35 = load i32, ptr %16, align 4, !tbaa !11
  %36 = load i32, ptr %11, align 4, !tbaa !11
  %37 = icmp sle i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %83

39:                                               ; preds = %34
  %40 = load i32, ptr %14, align 4, !tbaa !11
  %41 = load i32, ptr %14, align 4, !tbaa !11
  %42 = mul nsw i32 %40, %41
  %43 = load i32, ptr %16, align 4, !tbaa !11
  %44 = load i32, ptr %16, align 4, !tbaa !11
  %45 = mul nsw i32 %43, %44
  %46 = add nsw i32 %42, %45
  %47 = load i32, ptr %12, align 4, !tbaa !11
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %49, label %79

49:                                               ; preds = %39
  %50 = load i32, ptr %14, align 4, !tbaa !11
  %51 = load float, ptr %8, align 4, !tbaa !9
  %52 = call noundef double @_ZSt3powIifEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %50, float noundef %51)
  %53 = load i32, ptr %16, align 4, !tbaa !11
  %54 = load float, ptr %9, align 4, !tbaa !9
  %55 = call noundef double @_ZSt3powIifEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %53, float noundef %54)
  %56 = fmul double %52, %55
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = getelementptr inbounds %class.ImageContent, ptr %57, i32 0, i32 4
  %59 = load ptr, ptr %58, align 8, !tbaa !13
  %60 = load i32, ptr %11, align 4, !tbaa !11
  %61 = load i32, ptr %14, align 4, !tbaa !11
  %62 = add nsw i32 %60, %61
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds ptr, ptr %59, i64 %63
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  %66 = load i32, ptr %11, align 4, !tbaa !11
  %67 = load i32, ptr %16, align 4, !tbaa !11
  %68 = add nsw i32 %66, %67
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds float, ptr %65, i64 %69
  %71 = load float, ptr %70, align 4, !tbaa !9
  %72 = load float, ptr %10, align 4, !tbaa !9
  %73 = call noundef float @_ZSt3powff(float noundef %71, float noundef %72)
  %74 = fpext float %73 to double
  %75 = load float, ptr %13, align 4, !tbaa !9
  %76 = fpext float %75 to double
  %77 = call double @llvm.fmuladd.f64(double %56, double %74, double %76)
  %78 = fptrunc double %77 to float
  store float %78, ptr %13, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %49, %39
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %16, align 4, !tbaa !11
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %16, align 4, !tbaa !11
  br label %34, !llvm.loop !15

83:                                               ; preds = %38
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %14, align 4, !tbaa !11
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %14, align 4, !tbaa !11
  br label %26, !llvm.loop !17

87:                                               ; preds = %30
  %88 = load float, ptr %13, align 4, !tbaa !9
  store i32 1, ptr %15, align 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 4, ptr %11) #4
  ret float %88
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIifEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, float noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3powff(float noundef, float noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 16}
!14 = !{!"_ZTS12ImageContent", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !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 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; 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 uwtable
define dso_local noundef float @_ZN16MomentDescriptor12computMomentEP12ImageContentfff(ptr nocapture noundef nonnull readnone align 8 dereferenceable(116) %0, ptr noundef nonnull %1, float noundef %2, float noundef %3, float noundef %4) local_unnamed_addr #0 align 2 {
.preheader.lr.ph:
  %5 = tail call noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %6 = lshr i32 %5, 1
  %7 = mul nuw nsw i32 %6, %6
  %8 = sub nsw i32 0, %6
  %9 = getelementptr inbounds i8, ptr %1, i64 16
  %10 = sext i32 %8 to i64
  %11 = zext nneg i32 %6 to i64
  %12 = add nuw i32 %6, 1
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %indvars.iv41 = phi i64 [ %10, %.preheader.lr.ph ], [ %indvars.iv.next42, %._crit_edge ]
  %.02936 = phi float [ 0.000000e+00, %.preheader.lr.ph ], [ %.2, %._crit_edge ]
  %13 = mul nsw i64 %indvars.iv41, %indvars.iv41
  %14 = trunc nsw i64 %indvars.iv41 to i32
  br label %15

._crit_edge38:                                    ; preds = %._crit_edge
  ret float %.2

._crit_edge:                                      ; preds = %37
  %indvars.iv.next42 = add nsw i64 %indvars.iv41, 1
  %lftr.wideiv44 = trunc i64 %indvars.iv.next42 to i32
  %exitcond45.not = icmp eq i32 %12, %lftr.wideiv44
  br i1 %exitcond45.not, label %._crit_edge38, label %.preheader, !llvm.loop !5

15:                                               ; preds = %.preheader, %37
  %indvars.iv = phi i64 [ %10, %.preheader ], [ %indvars.iv.next, %37 ]
  %.133 = phi float [ %.02936, %.preheader ], [ %.2, %37 ]
  %16 = mul nsw i64 %indvars.iv, %indvars.iv
  %17 = add nuw nsw i64 %16, %13
  %18 = trunc nsw i64 %17 to i32
  %19 = icmp ugt i32 %7, %18
  br i1 %19, label %20, label %37

20:                                               ; preds = %15
  %21 = tail call noundef double @_ZSt3powIifEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %14, float noundef %2)
  %22 = trunc nsw i64 %indvars.iv to i32
  %23 = tail call noundef double @_ZSt3powIifEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %22, float noundef %3)
  %24 = fmul double %21, %23
  %25 = load ptr, ptr %9, align 8, !tbaa !7
  %26 = getelementptr ptr, ptr %25, i64 %indvars.iv41
  %27 = getelementptr ptr, ptr %26, i64 %11
  %28 = load ptr, ptr %27, align 8, !tbaa !13
  %29 = getelementptr float, ptr %28, i64 %indvars.iv
  %30 = getelementptr float, ptr %29, i64 %11
  %31 = load float, ptr %30, align 4, !tbaa !14
  %32 = tail call noundef float @_ZSt3powff(float noundef %31, float noundef %4)
  %33 = fpext float %32 to double
  %34 = fpext float %.133 to double
  %35 = tail call double @llvm.fmuladd.f64(double %24, double %33, double %34)
  %36 = fptrunc double %35 to float
  br label %37

37:                                               ; preds = %15, %20
  %.2 = phi float [ %36, %20 ], [ %.133, %15 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %12, %lftr.wideiv
  br i1 %exitcond.not, label %._crit_edge, label %15, !llvm.loop !16
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIifEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, float noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3powff(float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!8, !12, i64 16}
!8 = !{!"_ZTS12ImageContent", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !10, i64 0}
!16 = distinct !{!16, !6}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass