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

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

@patch_mask = external global ptr, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15ESiftDescriptor12PlaceInIndexEPfffffi(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, float noundef, float noundef, float noundef, float noundef, i32 noundef) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN15ESiftDescriptor9AddSampleEPfP12ImageContentS2_iiffffi(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5, float noundef %6, float noundef %7, float noundef %8, float noundef %9, i32 noundef %10) #2 align 2 {
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca i32, align 4
  %23 = alloca float, align 4
  %24 = alloca float, align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %12, align 8, !tbaa !5
  store ptr %1, ptr %13, align 8, !tbaa !5
  store ptr %2, ptr %14, align 8, !tbaa !5
  store ptr %3, ptr %15, align 8, !tbaa !5
  store i32 %4, ptr %16, align 4, !tbaa !9
  store i32 %5, ptr %17, align 4, !tbaa !9
  store float %6, ptr %18, align 4, !tbaa !11
  store float %7, ptr %19, align 4, !tbaa !11
  store float %8, ptr %20, align 4, !tbaa !11
  store float %9, ptr %21, align 4, !tbaa !11
  store i32 %10, ptr %22, align 4, !tbaa !9
  %26 = load ptr, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  %27 = load i32, ptr %16, align 4, !tbaa !9
  %28 = icmp slt i32 %27, 0
  br i1 %28, label %42, label %29

29:                                               ; preds = %11
  %30 = load i32, ptr %16, align 4, !tbaa !9
  %31 = load ptr, ptr %14, align 8, !tbaa !5
  %32 = call noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80) %31)
  %33 = icmp uge i32 %30, %32
  br i1 %33, label %42, label %34

34:                                               ; preds = %29
  %35 = load i32, ptr %17, align 4, !tbaa !9
  %36 = icmp slt i32 %35, 0
  br i1 %36, label %42, label %37

37:                                               ; preds = %34
  %38 = load i32, ptr %17, align 4, !tbaa !9
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = call noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80) %39)
  %41 = icmp uge i32 %38, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %37, %34, %29, %11
  store i32 1, ptr %25, align 4
  br label %102

43:                                               ; preds = %37
  %44 = load ptr, ptr @patch_mask, align 8, !tbaa !5
  %45 = getelementptr inbounds %class.ImageContent, ptr %44, i32 0, i32 4
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  %47 = load i32, ptr %16, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds ptr, ptr %46, i64 %48
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  %51 = load i32, ptr %17, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds float, ptr %50, i64 %52
  %54 = load float, ptr %53, align 4, !tbaa !11
  %55 = load ptr, ptr %14, align 8, !tbaa !5
  %56 = getelementptr inbounds %class.ImageContent, ptr %55, i32 0, i32 4
  %57 = load ptr, ptr %56, align 8, !tbaa !13
  %58 = load i32, ptr %16, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds ptr, ptr %57, i64 %59
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  %62 = load i32, ptr %17, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds float, ptr %61, i64 %63
  %65 = load float, ptr %64, align 4, !tbaa !11
  %66 = fmul float %54, %65
  store float %66, ptr %23, align 4, !tbaa !11
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = getelementptr inbounds %class.ImageContent, ptr %67, i32 0, i32 4
  %69 = load ptr, ptr %68, align 8, !tbaa !13
  %70 = load i32, ptr %16, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds ptr, ptr %69, i64 %71
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = load i32, ptr %17, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds float, ptr %73, i64 %75
  %77 = load float, ptr %76, align 4, !tbaa !11
  store float %77, ptr %24, align 4, !tbaa !11
  %78 = load float, ptr %24, align 4, !tbaa !11
  %79 = fpext float %78 to double
  %80 = fcmp ogt double %79, 0x401921FB544486E0
  br i1 %80, label %81, label %86

81:                                               ; preds = %43
  %82 = load float, ptr %24, align 4, !tbaa !11
  %83 = fpext float %82 to double
  %84 = fsub double %83, 0x401921FB544486E0
  %85 = fptrunc double %84 to float
  store float %85, ptr %24, align 4, !tbaa !11
  br label %86

86:                                               ; preds = %81, %43
  %87 = load float, ptr %24, align 4, !tbaa !11
  %88 = fpext float %87 to double
  %89 = fcmp olt double %88, 0.000000e+00
  br i1 %89, label %90, label %95

90:                                               ; preds = %86
  %91 = load float, ptr %24, align 4, !tbaa !11
  %92 = fpext float %91 to double
  %93 = fadd double %92, 0x401921FB544486E0
  %94 = fptrunc double %93 to float
  store float %94, ptr %24, align 4, !tbaa !11
  br label %95

95:                                               ; preds = %90, %86
  %96 = load ptr, ptr %13, align 8, !tbaa !5
  %97 = load float, ptr %23, align 4, !tbaa !11
  %98 = load float, ptr %24, align 4, !tbaa !11
  %99 = load float, ptr %20, align 4, !tbaa !11
  %100 = load float, ptr %21, align 4, !tbaa !11
  %101 = load i32, ptr %22, align 4, !tbaa !9
  call void @_ZN15ESiftDescriptor12PlaceInIndexEPfffffi(ptr noundef nonnull align 8 dereferenceable(116) %26, ptr noundef %96, float noundef %97, float noundef %98, float noundef %99, float noundef %100, i32 noundef %101)
  store i32 0, ptr %25, align 4
  br label %102

102:                                              ; preds = %95, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  %103 = load i32, ptr %25, align 4
  switch i32 %103, label %105 [
    i32 0, label %104
    i32 1, label %104
  ]

104:                                              ; preds = %102, %102
  ret void

105:                                              ; preds = %102
  unreachable
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #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 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !6, i64 16}
!14 = !{!"_ZTS12ImageContent", !10, i64 0, !10, i64 4, !10, i64 8, !10, 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}


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

@patch_mask = external local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15ESiftDescriptor12PlaceInIndexEPfffffi(ptr noundef nonnull align 8 dereferenceable(116), ptr noundef, float noundef, float noundef, float noundef, float noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN15ESiftDescriptor9AddSampleEPfP12ImageContentS2_iiffffi(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3, i32 noundef %4, i32 noundef %5, float noundef %6, float noundef %7, float noundef %8, float noundef %9, i32 noundef %10) local_unnamed_addr #0 align 2 {
  %12 = icmp slt i32 %4, 0
  br i1 %12, label %50, label %13

13:                                               ; preds = %11
  %14 = tail call noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %15 = icmp ule i32 %14, %4
  %16 = icmp slt i32 %5, 0
  %or.cond = or i1 %16, %15
  br i1 %or.cond, label %50, label %17

17:                                               ; preds = %13
  %18 = tail call noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %.not = icmp ugt i32 %18, %5
  br i1 %.not, label %19, label %50

19:                                               ; preds = %17
  %20 = load ptr, ptr @patch_mask, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = zext nneg i32 %4 to i64
  %24 = getelementptr inbounds ptr, ptr %22, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = zext nneg i32 %5 to i64
  %27 = getelementptr inbounds float, ptr %25, i64 %26
  %28 = load float, ptr %27, align 4, !tbaa !12
  %29 = getelementptr inbounds i8, ptr %2, i64 16
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds ptr, ptr %30, i64 %23
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = getelementptr inbounds float, ptr %32, i64 %26
  %34 = load float, ptr %33, align 4, !tbaa !12
  %35 = fmul float %28, %34
  %36 = getelementptr inbounds i8, ptr %3, i64 16
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds ptr, ptr %37, i64 %23
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  %40 = getelementptr inbounds float, ptr %39, i64 %26
  %41 = load float, ptr %40, align 4, !tbaa !12
  %42 = fpext float %41 to double
  %43 = fcmp ogt double %42, 0x401921FB544486E0
  %44 = fadd double %42, 0xC01921FB544486E0
  %45 = fptrunc double %44 to float
  %.0 = select i1 %43, float %45, float %41
  %46 = fcmp olt float %.0, 0.000000e+00
  %47 = fpext float %.0 to double
  %48 = fadd double %47, 0x401921FB544486E0
  %49 = fptrunc double %48 to float
  %.1 = select i1 %46, float %49, float %.0
  tail call void @_ZN15ESiftDescriptor12PlaceInIndexEPfffffi(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef %1, float noundef %35, float noundef %.1, float noundef %8, float noundef %9, i32 noundef %10)
  br label %50

50:                                               ; preds = %11, %13, %17, %19
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #1 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

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

!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, !6, i64 16}
!10 = !{!"_ZTS12ImageContent", !11, i64 0, !11, i64 4, !11, i64 8, !11, 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}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass