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

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

@_ZL4LXXY = external hidden global <{ [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], <{ [27 x double], [14 x double] }>, [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double] }>, align 16

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_Z4XYYfP12ImageContent(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca float, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store float 0.000000e+00, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !11
  br label %7

7:                                                ; preds = %44, %1
  %8 = load i32, ptr %4, align 4, !tbaa !11
  %9 = icmp slt i32 %8, 41
  br i1 %9, label %11, label %10

10:                                               ; preds = %7
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %47

11:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %12

12:                                               ; preds = %40, %11
  %13 = load i32, ptr %6, align 4, !tbaa !11
  %14 = icmp slt i32 %13, 41
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %43

16:                                               ; preds = %12
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %class.ImageContent, ptr %17, i32 0, i32 4
  %19 = load ptr, ptr %18, align 8, !tbaa !13
  %20 = load i32, ptr %4, align 4, !tbaa !11
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds ptr, ptr %19, i64 %21
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %24 = load i32, ptr %6, align 4, !tbaa !11
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds float, ptr %23, i64 %25
  %27 = load float, ptr %26, align 4, !tbaa !9
  %28 = fpext float %27 to double
  %29 = load i32, ptr %6, align 4, !tbaa !11
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [41 x [41 x double]], ptr @_ZL4LXXY, i64 0, i64 %30
  %32 = load i32, ptr %4, align 4, !tbaa !11
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [41 x double], ptr %31, i64 0, i64 %33
  %35 = load double, ptr %34, align 8, !tbaa !15
  %36 = load float, ptr %3, align 4, !tbaa !9
  %37 = fpext float %36 to double
  %38 = call double @llvm.fmuladd.f64(double %28, double %35, double %37)
  %39 = fptrunc double %38 to float
  store float %39, ptr %3, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %16
  %41 = load i32, ptr %6, align 4, !tbaa !11
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %6, align 4, !tbaa !11
  br label %12, !llvm.loop !17

43:                                               ; preds = %15
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %4, align 4, !tbaa !11
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %4, align 4, !tbaa !11
  br label %7, !llvm.loop !19

47:                                               ; preds = %10
  %48 = load float, ptr %3, align 4, !tbaa !9
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret float %48
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 = { 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 = !{!16, !16, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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

@_ZL4LXXY = external hidden local_unnamed_addr global <{ [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], <{ [27 x double], [14 x double] }>, [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double], [41 x double] }>, align 16

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local noundef float @_Z4XYYfP12ImageContent(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %1, %7
  %indvars.iv17 = phi i64 [ 0, %1 ], [ %indvars.iv.next18, %7 ]
  %.01114 = phi float [ 0.000000e+00, %1 ], [ %16, %7 ]
  %4 = getelementptr inbounds ptr, ptr %3, i64 %indvars.iv17
  %5 = load ptr, ptr %4, align 8, !tbaa !11
  br label %8

6:                                                ; preds = %7
  ret float %16

7:                                                ; preds = %8
  %indvars.iv.next18 = add nuw nsw i64 %indvars.iv17, 1
  %exitcond20.not = icmp eq i64 %indvars.iv.next18, 41
  br i1 %exitcond20.not, label %6, label %.preheader, !llvm.loop !12

8:                                                ; preds = %17, %.preheader
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next.1, %17 ]
  %.112 = phi float [ %.01114, %.preheader ], [ %25, %17 ]
  %9 = getelementptr inbounds float, ptr %5, i64 %indvars.iv
  %10 = load float, ptr %9, align 4, !tbaa !14
  %11 = fpext float %10 to double
  %12 = getelementptr inbounds [41 x [41 x double]], ptr @_ZL4LXXY, i64 0, i64 %indvars.iv, i64 %indvars.iv17
  %13 = load double, ptr %12, align 8, !tbaa !16
  %14 = fpext float %.112 to double
  %15 = tail call double @llvm.fmuladd.f64(double %11, double %13, double %14)
  %16 = fptrunc double %15 to float
  %exitcond.not = icmp eq i64 %indvars.iv, 40
  br i1 %exitcond.not, label %7, label %17, !llvm.loop !18

17:                                               ; preds = %8
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %18 = getelementptr inbounds float, ptr %5, i64 %indvars.iv.next
  %19 = load float, ptr %18, align 4, !tbaa !14
  %20 = fpext float %19 to double
  %21 = getelementptr inbounds [41 x [41 x double]], ptr @_ZL4LXXY, i64 0, i64 %indvars.iv.next, i64 %indvars.iv17
  %22 = load double, ptr %21, align 8, !tbaa !16
  %23 = fpext float %16 to double
  %24 = tail call double @llvm.fmuladd.f64(double %20, double %22, double %23)
  %25 = fptrunc double %24 to float
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  br label %8
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) 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, !10, i64 16}
!6 = !{!"_ZTS12ImageContent", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !8, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !8, i64 0}
!18 = distinct !{!18, !13}


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