; LLVM IR from openxrlab/xrsfm :: 3rdparty/SiftGPU/SiftMatch.ll (ZN11SiftMatchGLD2Ev)

; 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.SiftMatchGL = type { %class.SiftMatchGPU.base, [4 x i8], [2 x %class.GLTexImage], [2 x %class.GLTexImage], %class.GLTexImage, [2 x %class.GLTexImage], ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [2 x i32], [2 x i32], [2 x i32], i32, i32, i32, i32, i32, %"class.std::vector" }
%class.SiftMatchGPU.base = type <{ ptr, i32, i32, ptr, i32 }>
%class.GLTexImage = type <{ ptr, i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZTV11SiftMatchGL = external dso_local unnamed_addr constant { [17 x ptr] }, align 8

; Function Attrs: nounwind
declare void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN11SiftMatchGLD2Ev(ptr noundef nonnull align 8 dereferenceable(464) %0) unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 120) ({ [17 x ptr] }, ptr @_ZTV11SiftMatchGL, i32 0, i32 0, i32 2), ptr %3, align 8, !tbaa !9
  %4 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 6
  %5 = load ptr, ptr %4, align 8, !tbaa !11
  %6 = icmp ne ptr %5, null
  br i1 %6, label %7, label %16

7:                                                ; preds = %1
  %8 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 6
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = icmp eq ptr %9, null
  br i1 %10, label %15, label %11

11:                                               ; preds = %7
  %12 = load ptr, ptr %9, align 8, !tbaa !9
  %13 = getelementptr inbounds ptr, ptr %12, i64 3
  %14 = load ptr, ptr %13, align 8
  call void %14(ptr noundef nonnull align 8 dereferenceable(8) %9) #2
  br label %15

15:                                               ; preds = %11, %7
  br label %16

16:                                               ; preds = %15, %1
  %17 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 7
  %18 = load ptr, ptr %17, align 8, !tbaa !20
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %29

20:                                               ; preds = %16
  %21 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 7
  %22 = load ptr, ptr %21, align 8, !tbaa !20
  %23 = icmp eq ptr %22, null
  br i1 %23, label %28, label %24

24:                                               ; preds = %20
  %25 = load ptr, ptr %22, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 3
  %27 = load ptr, ptr %26, align 8
  call void %27(ptr noundef nonnull align 8 dereferenceable(8) %22) #2
  br label %28

28:                                               ; preds = %24, %20
  br label %29

29:                                               ; preds = %28, %16
  %30 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 8
  %31 = load ptr, ptr %30, align 8, !tbaa !21
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %42

33:                                               ; preds = %29
  %34 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 8
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  %36 = icmp eq ptr %35, null
  br i1 %36, label %41, label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr %35, align 8, !tbaa !9
  %39 = getelementptr inbounds ptr, ptr %38, i64 3
  %40 = load ptr, ptr %39, align 8
  call void %40(ptr noundef nonnull align 8 dereferenceable(8) %35) #2
  br label %41

41:                                               ; preds = %37, %33
  br label %42

42:                                               ; preds = %41, %29
  %43 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 9
  %44 = load ptr, ptr %43, align 8, !tbaa !22
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %55

46:                                               ; preds = %42
  %47 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 9
  %48 = load ptr, ptr %47, align 8, !tbaa !22
  %49 = icmp eq ptr %48, null
  br i1 %49, label %54, label %50

50:                                               ; preds = %46
  %51 = load ptr, ptr %48, align 8, !tbaa !9
  %52 = getelementptr inbounds ptr, ptr %51, i64 3
  %53 = load ptr, ptr %52, align 8
  call void %53(ptr noundef nonnull align 8 dereferenceable(8) %48) #2
  br label %54

54:                                               ; preds = %50, %46
  br label %55

55:                                               ; preds = %54, %42
  %56 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 30
  call void @_ZNSt6vectorIfSaIfEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %56) #2
  %57 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 5
  %58 = getelementptr inbounds [2 x %class.GLTexImage], ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds %class.GLTexImage, ptr %58, i64 2
  br label %60

60:                                               ; preds = %60, %55
  %61 = phi ptr [ %59, %55 ], [ %62, %60 ]
  %62 = getelementptr inbounds %class.GLTexImage, ptr %61, i64 -1
  call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %62) #2
  %63 = icmp eq ptr %62, %58
  br i1 %63, label %64, label %60

64:                                               ; preds = %60
  %65 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 4
  call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %65) #2
  %66 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 3
  %67 = getelementptr inbounds [2 x %class.GLTexImage], ptr %66, i32 0, i32 0
  %68 = getelementptr inbounds %class.GLTexImage, ptr %67, i64 2
  br label %69

69:                                               ; preds = %69, %64
  %70 = phi ptr [ %68, %64 ], [ %71, %69 ]
  %71 = getelementptr inbounds %class.GLTexImage, ptr %70, i64 -1
  call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %71) #2
  %72 = icmp eq ptr %71, %67
  br i1 %72, label %73, label %69

73:                                               ; preds = %69
  %74 = getelementptr inbounds %class.SiftMatchGL, ptr %3, i32 0, i32 2
  %75 = getelementptr inbounds [2 x %class.GLTexImage], ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds %class.GLTexImage, ptr %75, i64 2
  br label %77

77:                                               ; preds = %77, %73
  %78 = phi ptr [ %76, %73 ], [ %79, %77 ]
  %79 = getelementptr inbounds %class.GLTexImage, ptr %78, i64 -1
  call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %79) #2
  %80 = icmp eq ptr %79, %75
  br i1 %80, label %81, label %77

81:                                               ; preds = %77
  call void @_ZN12SiftMatchGPUD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %3) #2
  ret void
}

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

attributes #0 = { 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 #1 = { 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 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 312}
!12 = !{!"_ZTS11SiftMatchGL", !13, i64 0, !7, i64 32, !7, i64 112, !15, i64 192, !7, i64 232, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !14, i64 344, !14, i64 348, !14, i64 352, !14, i64 356, !14, i64 360, !14, i64 364, !14, i64 368, !14, i64 372, !14, i64 376, !14, i64 380, !14, i64 384, !14, i64 388, !7, i64 392, !7, i64 400, !7, i64 408, !14, i64 416, !14, i64 420, !14, i64 424, !14, i64 428, !14, i64 432, !16, i64 440}
!13 = !{!"_ZTS12SiftMatchGPU", !14, i64 8, !14, i64 12, !6, i64 16, !14, i64 24}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTS10GLTexImage", !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !14, i64 32}
!16 = !{!"_ZTSSt6vectorIfSaIfEE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!12, !6, i64 320}
!21 = !{!12, !6, i64 328}
!22 = !{!12, !6, i64 336}


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

@_ZTV11SiftMatchGL = external dso_local unnamed_addr constant { [17 x ptr] }, align 8

; Function Attrs: nounwind
declare void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN11SiftMatchGLD2Ev(ptr noundef nonnull align 8 dereferenceable(464) %0) unnamed_addr #1 align 2 {
  store ptr getelementptr inbounds inrange(-16, 120) (i8, ptr @_ZTV11SiftMatchGL, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 312
  %3 = load ptr, ptr %2, align 8, !tbaa !8
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %8, label %4

4:                                                ; preds = %1
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 24
  %7 = load ptr, ptr %6, align 8
  tail call void %7(ptr noundef nonnull align 8 dereferenceable(8) %3) #2
  br label %8

8:                                                ; preds = %4, %1
  %9 = getelementptr inbounds i8, ptr %0, i64 320
  %10 = load ptr, ptr %9, align 8, !tbaa !19
  %.not4 = icmp eq ptr %10, null
  br i1 %.not4, label %15, label %11

11:                                               ; preds = %8
  %12 = load ptr, ptr %10, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 24
  %14 = load ptr, ptr %13, align 8
  tail call void %14(ptr noundef nonnull align 8 dereferenceable(8) %10) #2
  br label %15

15:                                               ; preds = %11, %8
  %16 = getelementptr inbounds i8, ptr %0, i64 328
  %17 = load ptr, ptr %16, align 8, !tbaa !20
  %.not5 = icmp eq ptr %17, null
  br i1 %.not5, label %22, label %18

18:                                               ; preds = %15
  %19 = load ptr, ptr %17, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 24
  %21 = load ptr, ptr %20, align 8
  tail call void %21(ptr noundef nonnull align 8 dereferenceable(8) %17) #2
  br label %22

22:                                               ; preds = %18, %15
  %23 = getelementptr inbounds i8, ptr %0, i64 336
  %24 = load ptr, ptr %23, align 8, !tbaa !21
  %.not6 = icmp eq ptr %24, null
  br i1 %.not6, label %.preheader.preheader, label %25

25:                                               ; preds = %22
  %26 = load ptr, ptr %24, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 24
  %28 = load ptr, ptr %27, align 8
  tail call void %28(ptr noundef nonnull align 8 dereferenceable(8) %24) #2
  br label %.preheader.preheader

.preheader.preheader:                             ; preds = %25, %22
  %29 = getelementptr inbounds i8, ptr %0, i64 440
  tail call void @_ZNSt6vectorIfSaIfEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %29) #2
  %.ptr7 = getelementptr inbounds i8, ptr %0, i64 272
  tail call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %.ptr7) #2
  %.ptr7.1 = getelementptr inbounds i8, ptr %0, i64 232
  tail call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %.ptr7.1) #2
  %30 = getelementptr inbounds i8, ptr %0, i64 192
  tail call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %30) #2
  %.ptr11 = getelementptr inbounds i8, ptr %0, i64 152
  tail call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %.ptr11) #2
  %.ptr11.1 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %.ptr11.1) #2
  %.ptr15 = getelementptr inbounds i8, ptr %0, i64 72
  tail call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %.ptr15) #2
  %.ptr15.1 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @_ZN10GLTexImageD1Ev(ptr noundef nonnull align 8 dereferenceable(36) %.ptr15.1) #2
  tail call void @_ZN12SiftMatchGPUD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %0) #2
  ret void
}

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

attributes #0 = { 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 #1 = { 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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !13, i64 312}
!9 = !{!"_ZTS11SiftMatchGL", !10, i64 0, !12, i64 32, !12, i64 112, !14, i64 192, !12, i64 232, !13, i64 312, !13, i64 320, !13, i64 328, !13, i64 336, !11, i64 344, !11, i64 348, !11, i64 352, !11, i64 356, !11, i64 360, !11, i64 364, !11, i64 368, !11, i64 372, !11, i64 376, !11, i64 380, !11, i64 384, !11, i64 388, !12, i64 392, !12, i64 400, !12, i64 408, !11, i64 416, !11, i64 420, !11, i64 424, !11, i64 428, !11, i64 432, !15, i64 440}
!10 = !{!"_ZTS12SiftMatchGPU", !11, i64 8, !11, i64 12, !13, i64 16, !11, i64 24}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"any pointer", !12, i64 0}
!14 = !{!"_ZTS10GLTexImage", !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!15 = !{!"_ZTSSt6vectorIfSaIfEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !13, i64 0, !13, i64 8, !13, i64 16}
!19 = !{!9, !13, i64 320}
!20 = !{!9, !13, i64 328}
!21 = !{!9, !13, i64 336}


; Effective O3 passes: EarlyCSEPass,GVNPass,IPSCCPPass,InstCombinePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass