; LLVM IR from hlzz/libvot :: src/vocab_tree (vot_pipeline)

; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.vot::SiftData" = type { i32, i32, i32, i32, i32, ptr, ptr }
%class.anon = type { ptr }
%"class.vot::VocabTree" = type { i32, i32, i32, i64, i64, i64, i32, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.17 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [15 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; 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 noundef zeroext i1 @_ZN3vot8SiftData12ReadSiftFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3vot8SiftData15ReadOpenmvgDescIhLm128EEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vot8SiftDataC2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vot8SiftDataD2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vot18MultiQueryDatabaseEPNS_9VocabTreeEPSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEimmPfPmP8_IO_FILEPSt5mutex(ptr noundef %0, ptr noundef %1, i32 noundef %2, i64 noundef %3, i64 noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8) #3 personality ptr @__gxx_personality_v0 {
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  %22 = alloca %"class.vot::SiftData", align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca %class.anon, align 8
  %26 = alloca i64, align 8
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store i32 %2, ptr %12, align 4, !tbaa !9
  store i64 %3, ptr %13, align 8, !tbaa !11
  store i64 %4, ptr %14, align 8, !tbaa !11
  store ptr %5, ptr %15, align 8, !tbaa !5
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  store ptr %8, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.vot::VocabTree", ptr %27, i32 0, i32 3
  %29 = load i64, ptr %28, align 8, !tbaa !13
  store i64 %29, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %30 = load i64, ptr %13, align 8, !tbaa !11
  store i64 %30, ptr %20, align 8, !tbaa !11
  br label %31

31:                                               ; preds = %115, %9
  %32 = load i64, ptr %20, align 8, !tbaa !11
  %33 = load i64, ptr %13, align 8, !tbaa !11
  %34 = load i64, ptr %14, align 8, !tbaa !11
  %35 = add i64 %33, %34
  %36 = icmp ult i64 %32, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %31
  %39 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZNSt5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %39)
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.19)
  %41 = load i64, ptr %20, align 8, !tbaa !11
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %40, i64 noundef %41)
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %42, ptr noundef @.str.17)
  %44 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZNSt5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) %44)
  %45 = load ptr, ptr %15, align 8, !tbaa !5
  %46 = load i64, ptr %19, align 8, !tbaa !11
  %47 = mul i64 4, %46
  call void @llvm.memset.p0.i64(ptr align 4 %45, i8 0, i64 %47, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr %22) #8
  call void @_ZN3vot8SiftDataC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %22)
  %48 = load i32, ptr %12, align 4, !tbaa !9
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %60

50:                                               ; preds = %38
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = load i64, ptr %20, align 8, !tbaa !11
  %53 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef %52) #8
  %54 = invoke noundef zeroext i1 @_ZN3vot8SiftData12ReadSiftFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(40) %22, ptr noundef nonnull align 8 dereferenceable(32) %53)
          to label %55 unwind label %56

55:                                               ; preds = %50
  br label %73

56:                                               ; preds = %112, %85, %77, %73, %69, %63, %50
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %23, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %24, align 4
  call void @_ZN3vot8SiftDataD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %22) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %119

60:                                               ; preds = %38
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = icmp eq i32 %61, 1
  br i1 %62, label %63, label %69

63:                                               ; preds = %60
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = load i64, ptr %20, align 8, !tbaa !11
  %66 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef %65) #8
  %67 = invoke noundef zeroext i1 @_ZN3vot8SiftData15ReadOpenmvgDescIhLm128EEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(40) %22, ptr noundef nonnull align 8 dereferenceable(32) %66)
          to label %68 unwind label %56

68:                                               ; preds = %63
  br label %72

69:                                               ; preds = %60
  %70 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.20)
          to label %71 unwind label %56

71:                                               ; preds = %69
  call void @exit(i32 noundef -1) #9
  unreachable

72:                                               ; preds = %68
  br label %73

73:                                               ; preds = %72, %55
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = load ptr, ptr %15, align 8, !tbaa !5
  %76 = invoke noundef zeroext i1 @_ZN3vot9VocabTree5QueryERNS_8SiftDataEPf(ptr noundef nonnull align 8 dereferenceable(56) %74, ptr noundef nonnull align 8 dereferenceable(40) %22, ptr noundef %75)
          to label %77 unwind label %56

77:                                               ; preds = %73
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = load ptr, ptr %16, align 8, !tbaa !5
  %80 = load i64, ptr %19, align 8, !tbaa !11
  %81 = getelementptr inbounds i64, ptr %79, i64 %80
  %82 = getelementptr inbounds %class.anon, ptr %25, i32 0, i32 0
  store ptr %15, ptr %82, align 8, !tbaa !5
  %83 = getelementptr inbounds %class.anon, ptr %25, i32 0, i32 0
  %84 = load ptr, ptr %83, align 8
  invoke void @"_ZSt4sortIPmZN3vot18MultiQueryDatabaseEPNS1_9VocabTreeEPSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EEimmPfS0_P8_IO_FILEPSt5mutexE3$_0EvT_SK_T0_"(ptr noundef %78, ptr noundef %81, ptr %84)
          to label %85 unwind label %56

85:                                               ; preds = %77
  %86 = load ptr, ptr %18, align 8, !tbaa !5
  invoke void @_ZNSt5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %86)
          to label %87 unwind label %56

87:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  store i64 0, ptr %26, align 8, !tbaa !11
  br label %88

88:                                               ; preds = %109, %87
  %89 = load i64, ptr %26, align 8, !tbaa !11
  %90 = load i64, ptr %19, align 8, !tbaa !11
  %91 = icmp ult i64 %89, %90
  br i1 %91, label %93, label %92

92:                                               ; preds = %88
  store i32 5, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  br label %112

93:                                               ; preds = %88
  %94 = load ptr, ptr %17, align 8, !tbaa !5
  %95 = load i64, ptr %20, align 8, !tbaa !11
  %96 = load ptr, ptr %16, align 8, !tbaa !5
  %97 = load i64, ptr %26, align 8, !tbaa !11
  %98 = getelementptr inbounds i64, ptr %96, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !11
  %100 = load ptr, ptr %15, align 8, !tbaa !5
  %101 = load ptr, ptr %16, align 8, !tbaa !5
  %102 = load i64, ptr %26, align 8, !tbaa !11
  %103 = getelementptr inbounds i64, ptr %101, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !11
  %105 = getelementptr inbounds float, ptr %100, i64 %104
  %106 = load float, ptr %105, align 4, !tbaa !16
  %107 = fpext float %106 to double
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %94, ptr noundef @.str.21, i64 noundef %95, i64 noundef %99, double noundef %107) #8
  br label %109

109:                                              ; preds = %93
  %110 = load i64, ptr %26, align 8, !tbaa !11
  %111 = add i64 %110, 1
  store i64 %111, ptr %26, align 8, !tbaa !11
  br label %88, !llvm.loop !18

112:                                              ; preds = %92
  %113 = load ptr, ptr %18, align 8, !tbaa !5
  invoke void @_ZNSt5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) %113)
          to label %114 unwind label %56

114:                                              ; preds = %112
  call void @_ZN3vot8SiftDataD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %22) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %22) #8
  br label %115

115:                                              ; preds = %114
  %116 = load i64, ptr %20, align 8, !tbaa !11
  %117 = add i64 %116, 1
  store i64 %117, ptr %20, align 8, !tbaa !11
  br label %31, !llvm.loop !20

118:                                              ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  ret void

119:                                              ; preds = %56
  %120 = load ptr, ptr %23, align 8
  %121 = load i32, ptr %24, align 4
  %122 = insertvalue { ptr, i32 } poison, ptr %120, 0
  %123 = insertvalue { ptr, i32 } %122, i32 %121, 1
  resume { ptr, i32 } %123
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40)) #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

declare noundef zeroext i1 @_ZN3vot9VocabTree5QueryERNS_8SiftDataEPf(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) #6

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPmZN3vot18MultiQueryDatabaseEPNS1_9VocabTreeEPSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EEimmPfS0_P8_IO_FILEPSt5mutexE3$_0EvT_SK_T0_"(ptr noundef, ptr noundef, ptr) #1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #7

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { noreturn nounwind "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 #6 = { "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 #7 = { nounwind "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 #8 = { nounwind }
attributes #9 = { noreturn 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 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 16}
!14 = !{!"_ZTSN3vot9VocabTreeE", !10, i64 0, !10, i64 4, !10, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !15, i64 40, !6, i64 48}
!15 = !{!"_ZTSN3vot12DistanceTypeE", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.vot::SiftData" = type { i32, i32, i32, i32, i32, ptr, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.17 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [15 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress 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 noundef zeroext i1 @_ZN3vot8SiftData12ReadSiftFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3vot8SiftData15ReadOpenmvgDescIhLm128EEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vot8SiftDataC2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vot8SiftDataD2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vot18MultiQueryDatabaseEPNS_9VocabTreeEPSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEimmPfPmP8_IO_FILEPSt5mutex(ptr noundef %0, ptr noundef %1, i32 noundef %2, i64 noundef %3, i64 noundef %4, ptr noundef %5, ptr noundef %6, ptr nocapture noundef %7, ptr noundef %8) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %10 = alloca ptr, align 8
  %11 = alloca %"class.vot::SiftData", align 8
  store ptr %5, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = load i64, ptr %12, align 8, !tbaa !9
  %.fr39 = freeze i64 %13
  %14 = add i64 %4, %3
  %15 = icmp ugt i64 %14, %3
  br i1 %15, label %.lr.ph37, label %._crit_edge38

.lr.ph37:                                         ; preds = %9
  %16 = shl i64 %.fr39, 2
  %17 = getelementptr inbounds i64, ptr %6, i64 %.fr39
  %.not = icmp eq i64 %.fr39, 0
  br i1 %.not, label %.lr.ph37.split, label %.lr.ph37.split.us

.lr.ph37.split.us:                                ; preds = %.lr.ph37, %33
  %.03235.us = phi i64 [ %34, %33 ], [ %3, %.lr.ph37 ]
  call void @_ZNSt5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %8)
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.19)
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %18, i64 noundef %.03235.us)
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull @.str.17)
  call void @_ZNSt5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) %8)
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %21, i8 0, i64 %16, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %11) #8
  call void @_ZN3vot8SiftDataC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11)
  switch i32 %2, label %.split.us [
    i32 0, label %25
    i32 1, label %22
  ]

22:                                               ; preds = %.lr.ph37.split.us
  %23 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.03235.us) #8
  %24 = invoke noundef zeroext i1 @_ZN3vot8SiftData15ReadOpenmvgDescIhLm128EEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(40) %11, ptr noundef nonnull align 8 dereferenceable(32) %23)
          to label %28 unwind label %.loopexit.split.us

25:                                               ; preds = %.lr.ph37.split.us
  %26 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.03235.us) #8
  %27 = invoke noundef zeroext i1 @_ZN3vot8SiftData12ReadSiftFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(40) %11, ptr noundef nonnull align 8 dereferenceable(32) %26)
          to label %28 unwind label %.loopexit.split.us

28:                                               ; preds = %25, %22
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = invoke noundef zeroext i1 @_ZN3vot9VocabTree5QueryERNS_8SiftDataEPf(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 8 dereferenceable(40) %11, ptr noundef %29)
          to label %31 unwind label %.loopexit.split.us

31:                                               ; preds = %28
  invoke void @"_ZSt4sortIPmZN3vot18MultiQueryDatabaseEPNS1_9VocabTreeEPSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EEimmPfS0_P8_IO_FILEPSt5mutexE3$_0EvT_SK_T0_"(ptr noundef %6, ptr noundef nonnull %17, ptr nonnull %10)
          to label %32 unwind label %.loopexit.split.us

32:                                               ; preds = %31
  invoke void @_ZNSt5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %8)
          to label %.preheader.us unwind label %.loopexit.split.us

33:                                               ; preds = %._crit_edge.us
  call void @_ZN3vot8SiftDataD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %11) #8
  %34 = add nuw i64 %.03235.us, 1
  %exitcond42.not = icmp eq i64 %34, %14
  br i1 %exitcond42.not, label %._crit_edge38, label %.lr.ph37.split.us, !llvm.loop !14

.preheader.us:                                    ; preds = %32, %.preheader.us
  %.034.us = phi i64 [ %42, %.preheader.us ], [ 0, %32 ]
  %35 = getelementptr inbounds i64, ptr %6, i64 %.034.us
  %36 = load i64, ptr %35, align 8, !tbaa !16
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = getelementptr inbounds float, ptr %37, i64 %36
  %39 = load float, ptr %38, align 4, !tbaa !17
  %40 = fpext float %39 to double
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str.21, i64 noundef %.03235.us, i64 noundef %36, double noundef %40) #8
  %42 = add nuw i64 %.034.us, 1
  %exitcond.not = icmp eq i64 %42, %.fr39
  br i1 %exitcond.not, label %._crit_edge.us, label %.preheader.us, !llvm.loop !19

._crit_edge.us:                                   ; preds = %.preheader.us
  invoke void @_ZNSt5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) %8)
          to label %33 unwind label %.loopexit.split.us

.loopexit.split.us:                               ; preds = %._crit_edge.us, %32, %31, %28, %25, %22
  %lpad.loopexit.us = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

._crit_edge38:                                    ; preds = %33, %60, %9
  ret void

.lr.ph37.split:                                   ; preds = %.lr.ph37, %60
  %.03235 = phi i64 [ %61, %60 ], [ %3, %.lr.ph37 ]
  call void @_ZNSt5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %8)
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.19)
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %43, i64 noundef %.03235)
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %44, ptr noundef nonnull @.str.17)
  call void @_ZNSt5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) %8)
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %46, i8 0, i64 %16, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %11) #8
  call void @_ZN3vot8SiftDataC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11)
  switch i32 %2, label %.split.us [
    i32 0, label %47
    i32 1, label %50
  ]

47:                                               ; preds = %.lr.ph37.split
  %48 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.03235) #8
  %49 = invoke noundef zeroext i1 @_ZN3vot8SiftData12ReadSiftFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(40) %11, ptr noundef nonnull align 8 dereferenceable(32) %48)
          to label %55 unwind label %.loopexit.split

.loopexit.split:                                  ; preds = %47, %50, %55, %58, %59, %.preheader
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

.loopexit.split-lp:                               ; preds = %.split.us
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.split, %.loopexit.split.us, %.loopexit.split-lp
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit.split-lp, %.loopexit.split-lp ], [ %lpad.loopexit, %.loopexit.split ], [ %lpad.loopexit.us, %.loopexit.split.us ]
  call void @_ZN3vot8SiftDataD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %11) #8
  resume { ptr, i32 } %lpad.phi

50:                                               ; preds = %.lr.ph37.split
  %51 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.03235) #8
  %52 = invoke noundef zeroext i1 @_ZN3vot8SiftData15ReadOpenmvgDescIhLm128EEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(40) %11, ptr noundef nonnull align 8 dereferenceable(32) %51)
          to label %55 unwind label %.loopexit.split

.split.us:                                        ; preds = %.lr.ph37.split.us, %.lr.ph37.split
  %53 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.20)
          to label %54 unwind label %.loopexit.split-lp

54:                                               ; preds = %.split.us
  call void @exit(i32 noundef -1) #9
  unreachable

55:                                               ; preds = %50, %47
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = invoke noundef zeroext i1 @_ZN3vot9VocabTree5QueryERNS_8SiftDataEPf(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 8 dereferenceable(40) %11, ptr noundef %56)
          to label %58 unwind label %.loopexit.split

58:                                               ; preds = %55
  invoke void @"_ZSt4sortIPmZN3vot18MultiQueryDatabaseEPNS1_9VocabTreeEPSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EEimmPfS0_P8_IO_FILEPSt5mutexE3$_0EvT_SK_T0_"(ptr noundef %6, ptr noundef %17, ptr nonnull %10)
          to label %59 unwind label %.loopexit.split

59:                                               ; preds = %58
  invoke void @_ZNSt5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %8)
          to label %.preheader unwind label %.loopexit.split

.preheader:                                       ; preds = %59
  invoke void @_ZNSt5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) %8)
          to label %60 unwind label %.loopexit.split

60:                                               ; preds = %.preheader
  call void @_ZN3vot8SiftDataD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %11) #8
  %61 = add nuw i64 %.03235, 1
  %exitcond43.not = icmp eq i64 %61, %14
  br i1 %exitcond43.not, label %._crit_edge38, label %.lr.ph37.split, !llvm.loop !14
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5

declare noundef zeroext i1 @_ZN3vot9VocabTree5QueryERNS_8SiftDataEPf(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPmZN3vot18MultiQueryDatabaseEPNS1_9VocabTreeEPSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EEimmPfS0_P8_IO_FILEPSt5mutexE3$_0EvT_SK_T0_"(ptr noundef, ptr noundef, ptr) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { noreturn nounwind "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 #6 = { "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 #7 = { nofree nounwind "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 #8 = { nounwind }
attributes #9 = { noreturn 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, !12, i64 16}
!10 = !{!"_ZTSN3vot9VocabTreeE", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !13, i64 40, !6, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTSN3vot12DistanceTypeE", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = distinct !{!19, !15}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass