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

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

; 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
declare dso_local void @_ZN15ESiftDescriptor9AddSampleEPfP12ImageContentS2_iiffffi(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, float noundef, float noundef, float noundef, float noundef, i32 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN15ESiftDescriptor9KeySampleEPfP12ImageContentS2_i(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !9
  %19 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = call noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80) %20)
  %22 = lshr i32 %21, 1
  store i32 %22, ptr %13, align 4, !tbaa !9
  %23 = load i32, ptr %10, align 4, !tbaa !9
  %24 = add nsw i32 %23, 1
  %25 = sitofp i32 %24 to double
  %26 = load i32, ptr %13, align 4, !tbaa !9
  %27 = sitofp i32 %26 to double
  %28 = fmul double 2.000000e+00, %27
  %29 = fdiv double %25, %28
  %30 = fptrunc double %29 to float
  store float %30, ptr %14, align 4, !tbaa !11
  %31 = load i32, ptr %13, align 4, !tbaa !9
  %32 = sub nsw i32 0, %31
  store i32 %32, ptr %11, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %106, %5
  %34 = load i32, ptr %11, align 4, !tbaa !9
  %35 = load i32, ptr %13, align 4, !tbaa !9
  %36 = icmp sle i32 %34, %35
  br i1 %36, label %37, label %109

37:                                               ; preds = %33
  %38 = load i32, ptr %13, align 4, !tbaa !9
  %39 = sub nsw i32 0, %38
  store i32 %39, ptr %12, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %102, %37
  %41 = load i32, ptr %12, align 4, !tbaa !9
  %42 = load i32, ptr %13, align 4, !tbaa !9
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %44, label %105

44:                                               ; preds = %40
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = sitofp i32 %45 to float
  %47 = load float, ptr %14, align 4, !tbaa !11
  %48 = fmul float %46, %47
  store float %48, ptr %15, align 4, !tbaa !11
  %49 = load i32, ptr %12, align 4, !tbaa !9
  %50 = sitofp i32 %49 to float
  %51 = load float, ptr %14, align 4, !tbaa !11
  %52 = fmul float %50, %51
  store float %52, ptr %16, align 4, !tbaa !11
  %53 = load float, ptr %15, align 4, !tbaa !11
  %54 = fpext float %53 to double
  %55 = load i32, ptr %10, align 4, !tbaa !9
  %56 = sub nsw i32 %55, 1
  %57 = sitofp i32 %56 to double
  %58 = fdiv double %57, 2.000000e+00
  %59 = fadd double %54, %58
  %60 = fptrunc double %59 to float
  store float %60, ptr %17, align 4, !tbaa !11
  %61 = load float, ptr %16, align 4, !tbaa !11
  %62 = fpext float %61 to double
  %63 = load i32, ptr %10, align 4, !tbaa !9
  %64 = sub nsw i32 %63, 1
  %65 = sitofp i32 %64 to double
  %66 = fdiv double %65, 2.000000e+00
  %67 = fadd double %62, %66
  %68 = fptrunc double %67 to float
  store float %68, ptr %18, align 4, !tbaa !11
  %69 = load float, ptr %17, align 4, !tbaa !11
  %70 = fpext float %69 to double
  %71 = fcmp ogt double %70, -1.000000e+00
  br i1 %71, label %72, label %101

72:                                               ; preds = %44
  %73 = load float, ptr %17, align 4, !tbaa !11
  %74 = load i32, ptr %10, align 4, !tbaa !9
  %75 = sitofp i32 %74 to float
  %76 = fcmp olt float %73, %75
  br i1 %76, label %77, label %101

77:                                               ; preds = %72
  %78 = load float, ptr %18, align 4, !tbaa !11
  %79 = fpext float %78 to double
  %80 = fcmp ogt double %79, -1.000000e+00
  br i1 %80, label %81, label %101

81:                                               ; preds = %77
  %82 = load float, ptr %18, align 4, !tbaa !11
  %83 = load i32, ptr %10, align 4, !tbaa !9
  %84 = sitofp i32 %83 to float
  %85 = fcmp olt float %82, %84
  br i1 %85, label %86, label %101

86:                                               ; preds = %81
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = load i32, ptr %13, align 4, !tbaa !9
  %91 = load i32, ptr %11, align 4, !tbaa !9
  %92 = add nsw i32 %90, %91
  %93 = load i32, ptr %13, align 4, !tbaa !9
  %94 = load i32, ptr %12, align 4, !tbaa !9
  %95 = add nsw i32 %93, %94
  %96 = load float, ptr %15, align 4, !tbaa !11
  %97 = load float, ptr %16, align 4, !tbaa !11
  %98 = load float, ptr %17, align 4, !tbaa !11
  %99 = load float, ptr %18, align 4, !tbaa !11
  %100 = load i32, ptr %10, align 4, !tbaa !9
  call void @_ZN15ESiftDescriptor9AddSampleEPfP12ImageContentS2_iiffffi(ptr noundef nonnull align 8 dereferenceable(116) %19, ptr noundef %87, ptr noundef %88, ptr noundef %89, i32 noundef %92, i32 noundef %95, float noundef %96, float noundef %97, float noundef %98, float noundef %99, i32 noundef %100)
  br label %101

101:                                              ; preds = %86, %81, %77, %72, %44
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %12, align 4, !tbaa !9
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %12, align 4, !tbaa !9
  br label %40, !llvm.loop !13

105:                                              ; preds = %40
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %11, align 4, !tbaa !9
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %11, align 4, !tbaa !9
  br label %33, !llvm.loop !15

109:                                              ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  ret void
}

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 = { 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 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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 uwtable
declare dso_local void @_ZN15ESiftDescriptor9AddSampleEPfP12ImageContentS2_iiffffi(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, float noundef, float noundef, float noundef, float noundef, i32 noundef) local_unnamed_addr #0 align 2

; 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: mustprogress uwtable
define dso_local void @_ZN15ESiftDescriptor9KeySampleEPfP12ImageContentS2_i(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1, ptr noundef nonnull %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #0 align 2 {
.preheader.lr.ph:
  %5 = tail call noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %6 = lshr i32 %5, 1
  %7 = add nsw i32 %4, 1
  %8 = sitofp i32 %7 to double
  %9 = and i32 %5, -2
  %10 = uitofp i32 %9 to double
  %11 = fdiv double %8, %10
  %12 = fptrunc double %11 to float
  %13 = sub nsw i32 0, %6
  %14 = add nsw i32 %4, -1
  %15 = sitofp i32 %14 to double
  %16 = fmul double %15, 5.000000e-01
  %17 = sitofp i32 %4 to float
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %.047 = phi i32 [ %13, %.preheader.lr.ph ], [ %38, %._crit_edge ]
  %18 = sitofp i32 %.047 to float
  %19 = fmul float %12, %18
  %20 = fpext float %19 to double
  %21 = fadd double %16, %20
  %.fr = freeze double %21
  %22 = fptrunc double %.fr to float
  %23 = fcmp ogt float %22, -1.000000e+00
  %24 = add nsw i32 %.047, %6
  %25 = fcmp olt float %22, %17
  %or.cond = and i1 %23, %25
  br i1 %or.cond, label %.lr.ph.split.us.split, label %._crit_edge

.lr.ph.split.us.split:                            ; preds = %.preheader, %36
  %.03745.us = phi i32 [ %37, %36 ], [ %13, %.preheader ]
  %26 = sitofp i32 %.03745.us to float
  %27 = fmul float %12, %26
  %28 = fpext float %27 to double
  %29 = fadd double %16, %28
  %30 = fptrunc double %29 to float
  %31 = fcmp ogt float %30, -1.000000e+00
  %32 = fcmp olt float %30, %17
  %33 = and i1 %31, %32
  br i1 %33, label %34, label %36

34:                                               ; preds = %.lr.ph.split.us.split
  %35 = add nsw i32 %.03745.us, %6
  tail call void @_ZN15ESiftDescriptor9AddSampleEPfP12ImageContentS2_iiffffi(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1, ptr noundef nonnull %2, ptr noundef %3, i32 noundef %24, i32 noundef %35, float noundef %19, float noundef %27, float noundef %22, float noundef %30, i32 noundef %4)
  br label %36

36:                                               ; preds = %34, %.lr.ph.split.us.split
  %37 = add i32 %.03745.us, 1
  %exitcond.not = icmp eq i32 %.03745.us, %6
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph.split.us.split, !llvm.loop !5

._crit_edge:                                      ; preds = %36, %.preheader
  %38 = add i32 %.047, 1
  %exitcond52.not = icmp eq i32 %.047, %6
  br i1 %exitcond52.not, label %._crit_edge48, label %.preheader, !llvm.loop !7

._crit_edge48:                                    ; preds = %._crit_edge
  ret void
}

attributes #0 = { 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 #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" }

!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: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass