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

; 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 }
%class.SiftMatchGPU = type <{ ptr, i32, i32, ptr, i32, [4 x i8] }>

@_ZN11GlobalParam10_texTargetE = external global i32, align 4

; 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 @_ZNSt6vectorIfSaIfEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIfSaIfEE6resizeEmRKf(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

declare void @_ZN10GLTexImage7BindTexEv(ptr noundef nonnull align 8 dereferenceable(36)) #3

declare void @glTexSubImage2D(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #3

declare void @_ZN10GLTexImage9UnbindTexEv() #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11SiftMatchGL14SetDescriptorsEiiPKfi(ptr noundef nonnull align 8 dereferenceable(464) %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) unnamed_addr #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !9
  %20 = load ptr, ptr %6, align 8
  %21 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 29
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %5
  br label %180

25:                                               ; preds = %5
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = icmp sgt i32 %26, 1
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %28, %25
  %30 = load i32, ptr %7, align 4, !tbaa !9
  %31 = icmp slt i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %29
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %32, %29
  %34 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 24
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [2 x i32], ptr %34, i64 0, i64 %36
  store i32 0, ptr %37, align 4, !tbaa !9
  %38 = load i32, ptr %10, align 4, !tbaa !9
  %39 = icmp ne i32 %38, -1
  br i1 %39, label %40, label %49

40:                                               ; preds = %33
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 23
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [2 x i32], ptr %42, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = icmp eq i32 %41, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %40
  br label %180

49:                                               ; preds = %40, %33
  %50 = load i32, ptr %10, align 4, !tbaa !9
  %51 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 23
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [2 x i32], ptr %51, i64 0, i64 %53
  store i32 %50, ptr %54, align 4, !tbaa !9
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = getelementptr inbounds %class.SiftMatchGPU, ptr %20, i32 0, i32 4
  %57 = load i32, ptr %56, align 8, !tbaa !19
  %58 = icmp sgt i32 %55, %57
  br i1 %58, label %59, label %62

59:                                               ; preds = %49
  %60 = getelementptr inbounds %class.SiftMatchGPU, ptr %20, i32 0, i32 4
  %61 = load i32, ptr %60, align 8, !tbaa !19
  store i32 %61, ptr %8, align 4, !tbaa !9
  br label %62

62:                                               ; preds = %59, %49
  %63 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 30
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = mul nsw i32 %64, 128
  %66 = sdiv i32 %65, 4
  %67 = sext i32 %66 to i64
  call void @_ZNSt6vectorIfSaIfEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %63, i64 noundef %67)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %68 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 30
  %69 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %68, i64 noundef 0) #4
  store ptr %69, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %91, %62
  %71 = load i32, ptr %12, align 4, !tbaa !9
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = mul nsw i32 128, %72
  %74 = icmp slt i32 %71, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %94

76:                                               ; preds = %70
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = load i32, ptr %12, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds float, ptr %77, i64 %79
  %81 = load float, ptr %80, align 4, !tbaa !20
  %82 = fmul float 5.120000e+02, %81
  %83 = fpext float %82 to double
  %84 = fadd double %83, 5.000000e-01
  %85 = fptosi double %84 to i32
  %86 = trunc i32 %85 to i8
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = load i32, ptr %12, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds i8, ptr %87, i64 %89
  store i8 %86, ptr %90, align 1, !tbaa !22
  br label %91

91:                                               ; preds = %76
  %92 = load i32, ptr %12, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %12, align 4, !tbaa !9
  br label %70, !llvm.loop !23

94:                                               ; preds = %75
  %95 = load i32, ptr %8, align 4, !tbaa !9
  %96 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 22
  %97 = load i32, ptr %7, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [2 x i32], ptr %96, i64 0, i64 %98
  store i32 %95, ptr %99, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %100 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 27
  %101 = load i32, ptr %100, align 8, !tbaa !25
  %102 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 28
  %103 = load i32, ptr %102, align 4, !tbaa !26
  %104 = mul nsw i32 %101, %103
  store i32 %104, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %105 = load i32, ptr %8, align 4, !tbaa !9
  %106 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 27
  %107 = load i32, ptr %106, align 8, !tbaa !25
  %108 = add nsw i32 %105, %107
  %109 = sub nsw i32 %108, 1
  %110 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 27
  %111 = load i32, ptr %110, align 8, !tbaa !25
  %112 = sdiv i32 %109, %111
  store i32 %112, ptr %14, align 4, !tbaa !9
  %113 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 30
  %114 = load i32, ptr %13, align 4, !tbaa !9
  %115 = load i32, ptr %14, align 4, !tbaa !9
  %116 = mul nsw i32 %114, %115
  %117 = mul nsw i32 %116, 4
  %118 = sext i32 %117 to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store float 0.000000e+00, ptr %15, align 4, !tbaa !20
  call void @_ZNSt6vectorIfSaIfEE6resizeEmRKf(ptr noundef nonnull align 8 dereferenceable(24) %113, i64 noundef %118, ptr noundef nonnull align 4 dereferenceable(4) %15)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %119 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 3
  %120 = load i32, ptr %7, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [2 x %class.GLTexImage], ptr %119, i64 0, i64 %121
  %123 = load i32, ptr %13, align 4, !tbaa !9
  %124 = load i32, ptr %14, align 4, !tbaa !9
  %125 = load ptr, ptr %122, align 8, !tbaa !27
  %126 = getelementptr inbounds ptr, ptr %125, i64 5
  %127 = load ptr, ptr %126, align 8
  call void %127(ptr noundef nonnull align 8 dereferenceable(36) %122, i32 noundef %123, i32 noundef %124)
  %128 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 3
  %129 = load i32, ptr %7, align 4, !tbaa !9
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [2 x %class.GLTexImage], ptr %128, i64 0, i64 %130
  call void @_ZN10GLTexImage7BindTexEv(ptr noundef nonnull align 8 dereferenceable(36) %131)
  %132 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 26
  %133 = load i32, ptr %132, align 4, !tbaa !29
  %134 = icmp eq i32 %133, 1
  br i1 %134, label %135, label %141

135:                                              ; preds = %94
  %136 = load i32, ptr @_ZN11GlobalParam10_texTargetE, align 4, !tbaa !9
  %137 = load i32, ptr %13, align 4, !tbaa !9
  %138 = load i32, ptr %14, align 4, !tbaa !9
  %139 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 30
  %140 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %139, i64 noundef 0) #4
  call void @glTexSubImage2D(i32 noundef %136, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %137, i32 noundef %138, i32 noundef 6408, i32 noundef 5121, ptr noundef %140)
  br label %175

141:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %142

142:                                              ; preds = %171, %141
  %143 = load i32, ptr %16, align 4, !tbaa !9
  %144 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 26
  %145 = load i32, ptr %144, align 4, !tbaa !29
  %146 = icmp slt i32 %143, %145
  br i1 %146, label %148, label %147

147:                                              ; preds = %142
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %174

148:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %149 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 25
  %150 = load i32, ptr %149, align 8, !tbaa !30
  %151 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 28
  %152 = load i32, ptr %151, align 4, !tbaa !26
  %153 = mul nsw i32 %150, %152
  store i32 %153, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %154 = load i32, ptr %16, align 4, !tbaa !9
  %155 = load i32, ptr %17, align 4, !tbaa !9
  %156 = mul nsw i32 %154, %155
  store i32 %156, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %157 = load i32, ptr %16, align 4, !tbaa !9
  %158 = load i32, ptr %17, align 4, !tbaa !9
  %159 = mul nsw i32 %157, %158
  %160 = load i32, ptr %14, align 4, !tbaa !9
  %161 = mul nsw i32 %159, %160
  %162 = mul nsw i32 %161, 4
  store i32 %162, ptr %19, align 4, !tbaa !9
  %163 = load i32, ptr @_ZN11GlobalParam10_texTargetE, align 4, !tbaa !9
  %164 = load i32, ptr %18, align 4, !tbaa !9
  %165 = load i32, ptr %17, align 4, !tbaa !9
  %166 = load i32, ptr %14, align 4, !tbaa !9
  %167 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 30
  %168 = load i32, ptr %19, align 4, !tbaa !9
  %169 = sext i32 %168 to i64
  %170 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %167, i64 noundef %169) #4
  call void @glTexSubImage2D(i32 noundef %163, i32 noundef 0, i32 noundef %164, i32 noundef 0, i32 noundef %165, i32 noundef %166, i32 noundef 6408, i32 noundef 5121, ptr noundef %170)
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %171

171:                                              ; preds = %148
  %172 = load i32, ptr %16, align 4, !tbaa !9
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %16, align 4, !tbaa !9
  br label %142, !llvm.loop !31

174:                                              ; preds = %147
  br label %175

175:                                              ; preds = %174, %135
  %176 = getelementptr inbounds %class.SiftMatchGL, ptr %20, i32 0, i32 3
  %177 = load i32, ptr %7, align 4, !tbaa !9
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [2 x %class.GLTexImage], ptr %176, i64 0, i64 %178
  call void @_ZN10GLTexImage9UnbindTexEv()
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %180

180:                                              ; preds = %175, %48, %24
  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 = { 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 = { "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, !10, i64 432}
!12 = !{!"_ZTS11SiftMatchGL", !13, i64 0, !7, i64 32, !7, i64 112, !14, i64 192, !7, i64 232, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !10, i64 344, !10, i64 348, !10, i64 352, !10, i64 356, !10, i64 360, !10, i64 364, !10, i64 368, !10, i64 372, !10, i64 376, !10, i64 380, !10, i64 384, !10, i64 388, !7, i64 392, !7, i64 400, !7, i64 408, !10, i64 416, !10, i64 420, !10, i64 424, !10, i64 428, !10, i64 432, !15, i64 440}
!13 = !{!"_ZTS12SiftMatchGPU", !10, i64 8, !10, i64 12, !6, i64 16, !10, i64 24}
!14 = !{!"_ZTS10GLTexImage", !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, 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", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!13, !10, i64 24}
!20 = !{!21, !21, i64 0}
!21 = !{!"float", !7, i64 0}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!12, !10, i64 424}
!26 = !{!12, !10, i64 428}
!27 = !{!28, !28, i64 0}
!28 = !{!"vtable pointer", !8, i64 0}
!29 = !{!12, !10, i64 420}
!30 = !{!12, !10, i64 416}
!31 = distinct !{!31, !24}


; 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.GLTexImage = type <{ ptr, i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>

@_ZN11GlobalParam10_texTargetE = external local_unnamed_addr global i32, align 4

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

; 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 void @_ZNSt6vectorIfSaIfEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIfSaIfEE6resizeEmRKf(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

declare void @_ZN10GLTexImage7BindTexEv(ptr noundef nonnull align 8 dereferenceable(36)) local_unnamed_addr #3

declare void @glTexSubImage2D(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare void @_ZN10GLTexImage9UnbindTexEv() local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11SiftMatchGL14SetDescriptorsEiiPKfi(ptr noundef nonnull align 8 dereferenceable(464) %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3, i32 noundef %4) unnamed_addr #1 align 2 {
  %6 = alloca float, align 4
  %7 = getelementptr inbounds i8, ptr %0, i64 432
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %104, label %10

10:                                               ; preds = %5
  %11 = icmp sgt i32 %1, 0
  %12 = getelementptr inbounds i8, ptr %0, i64 408
  %13 = zext i1 %11 to i64
  %14 = getelementptr inbounds [2 x i32], ptr %12, i64 0, i64 %13
  store i32 0, ptr %14, align 4, !tbaa !17
  %.not = icmp eq i32 %4, -1
  br i1 %.not, label %20, label %15

15:                                               ; preds = %10
  %16 = getelementptr inbounds i8, ptr %0, i64 400
  %17 = getelementptr inbounds [2 x i32], ptr %16, i64 0, i64 %13
  %18 = load i32, ptr %17, align 4, !tbaa !17
  %19 = icmp eq i32 %18, %4
  br i1 %19, label %104, label %20

20:                                               ; preds = %15, %10
  %21 = getelementptr inbounds i8, ptr %0, i64 400
  %22 = getelementptr inbounds [2 x i32], ptr %21, i64 0, i64 %13
  store i32 %4, ptr %22, align 4, !tbaa !17
  %23 = getelementptr inbounds i8, ptr %0, i64 24
  %24 = load i32, ptr %23, align 8, !tbaa !18
  %spec.select = tail call i32 @llvm.smin.i32(i32 %24, i32 %2)
  %25 = getelementptr inbounds i8, ptr %0, i64 440
  %26 = shl nsw i32 %spec.select, 5
  %27 = sext i32 %26 to i64
  tail call void @_ZNSt6vectorIfSaIfEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %27)
  %28 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef 0) #5
  %29 = icmp sgt i32 %spec.select, 0
  br i1 %29, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %20
  %30 = shl i32 %spec.select, 7
  %smax = tail call i32 @llvm.smax.i32(i32 %30, i32 1)
  %wide.trip.count = zext nneg i32 %smax to i64
  %min.iters.check = icmp slt i32 %30, 4
  br i1 %min.iters.check, label %.lr.ph.preheader51, label %vector.memcheck

.lr.ph.preheader51:                               ; preds = %middle.block, %vector.memcheck, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader51
  %31 = getelementptr inbounds float, ptr %3, i64 %indvars.iv.ph
  %32 = load float, ptr %31, align 4, !tbaa !19
  %33 = fmul float %32, 5.120000e+02
  %34 = fpext float %33 to double
  %35 = fadd double %34, 5.000000e-01
  %36 = fptosi double %35 to i32
  %37 = trunc i32 %36 to i8
  %38 = getelementptr inbounds i8, ptr %28, i64 %indvars.iv.ph
  store i8 %37, ptr %38, align 4, !tbaa !21
  %indvars.iv.next.prol = or disjoint i64 %indvars.iv.ph, 1
  br label %.lr.ph.prol.loopexit

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader51
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %.lr.ph.preheader51 ], [ %indvars.iv.next.prol, %.lr.ph.prol ]
  %39 = add nsw i64 %wide.trip.count, -1
  %40 = icmp eq i64 %indvars.iv.ph, %39
  br i1 %40, label %._crit_edge, label %.lr.ph

vector.memcheck:                                  ; preds = %.lr.ph.preheader
  %scevgep = getelementptr i8, ptr %28, i64 %wide.trip.count
  %41 = shl nuw nsw i64 %wide.trip.count, 2
  %scevgep50 = getelementptr i8, ptr %3, i64 %41
  %bound0 = icmp ult ptr %28, %scevgep50
  %bound1 = icmp ugt ptr %scevgep, %3
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.lr.ph.preheader51, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %wide.trip.count, 2147483520
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %42 = getelementptr inbounds float, ptr %3, i64 %index
  %wide.load = load <4 x float>, ptr %42, align 4, !tbaa !19, !alias.scope !22
  %43 = fmul <4 x float> %wide.load, <float 5.120000e+02, float 5.120000e+02, float 5.120000e+02, float 5.120000e+02>
  %44 = fpext <4 x float> %43 to <4 x double>
  %45 = fadd <4 x double> %44, <double 5.000000e-01, double 5.000000e-01, double 5.000000e-01, double 5.000000e-01>
  %46 = fptosi <4 x double> %45 to <4 x i32>
  %47 = trunc <4 x i32> %46 to <4 x i8>
  %48 = getelementptr inbounds i8, ptr %28, i64 %index
  store <4 x i8> %47, ptr %48, align 4, !tbaa !21, !alias.scope !25, !noalias !22
  %index.next = add nuw i64 %index, 4
  %49 = icmp eq i64 %index.next, %n.vec
  br i1 %49, label %middle.block, label %vector.body, !llvm.loop !27

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader51

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %20
  %50 = getelementptr inbounds i8, ptr %0, i64 392
  %51 = getelementptr inbounds [2 x i32], ptr %50, i64 0, i64 %13
  store i32 %spec.select, ptr %51, align 4, !tbaa !17
  %52 = getelementptr inbounds i8, ptr %0, i64 424
  %53 = load i32, ptr %52, align 8, !tbaa !31
  %54 = getelementptr inbounds i8, ptr %0, i64 428
  %55 = load i32, ptr %54, align 4, !tbaa !32
  %56 = mul nsw i32 %55, %53
  %57 = add i32 %spec.select, -1
  %58 = add i32 %57, %53
  %59 = sdiv i32 %58, %53
  %60 = shl i32 %59, 2
  %61 = mul i32 %60, %56
  %62 = sext i32 %61 to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  store float 0.000000e+00, ptr %6, align 4, !tbaa !19
  call void @_ZNSt6vectorIfSaIfEE6resizeEmRKf(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %62, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  %63 = getelementptr inbounds i8, ptr %0, i64 112
  %64 = getelementptr inbounds [2 x %class.GLTexImage], ptr %63, i64 0, i64 %13
  %65 = load ptr, ptr %64, align 8, !tbaa !33
  %66 = getelementptr inbounds i8, ptr %65, i64 40
  %67 = load ptr, ptr %66, align 8
  call void %67(ptr noundef nonnull align 8 dereferenceable(36) %64, i32 noundef %56, i32 noundef %59)
  call void @_ZN10GLTexImage7BindTexEv(ptr noundef nonnull align 8 dereferenceable(36) %64)
  %68 = getelementptr inbounds i8, ptr %0, i64 420
  %69 = load i32, ptr %68, align 4, !tbaa !35
  %70 = icmp eq i32 %69, 1
  br i1 %70, label %89, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %71 = icmp sgt i32 %69, 0
  br i1 %71, label %.lr.ph48, label %.loopexit

.lr.ph48:                                         ; preds = %.preheader
  %72 = getelementptr inbounds i8, ptr %0, i64 416
  br label %92

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.lr.ph ], [ %indvars.iv.unr, %.lr.ph.prol.loopexit ]
  %73 = getelementptr inbounds float, ptr %3, i64 %indvars.iv
  %74 = load float, ptr %73, align 4, !tbaa !19
  %75 = fmul float %74, 5.120000e+02
  %76 = fpext float %75 to double
  %77 = fadd double %76, 5.000000e-01
  %78 = fptosi double %77 to i32
  %79 = trunc i32 %78 to i8
  %80 = getelementptr inbounds i8, ptr %28, i64 %indvars.iv
  store i8 %79, ptr %80, align 1, !tbaa !21
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %81 = getelementptr inbounds float, ptr %3, i64 %indvars.iv.next
  %82 = load float, ptr %81, align 4, !tbaa !19
  %83 = fmul float %82, 5.120000e+02
  %84 = fpext float %83 to double
  %85 = fadd double %84, 5.000000e-01
  %86 = fptosi double %85 to i32
  %87 = trunc i32 %86 to i8
  %88 = getelementptr inbounds i8, ptr %28, i64 %indvars.iv.next
  store i8 %87, ptr %88, align 1, !tbaa !21
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
  br i1 %exitcond.not.1, label %._crit_edge, label %.lr.ph, !llvm.loop !36

89:                                               ; preds = %._crit_edge
  %90 = load i32, ptr @_ZN11GlobalParam10_texTargetE, align 4, !tbaa !17
  %91 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef 0) #5
  call void @glTexSubImage2D(i32 noundef %90, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %56, i32 noundef %59, i32 noundef 6408, i32 noundef 5121, ptr noundef nonnull %91)
  br label %.loopexit

92:                                               ; preds = %.lr.ph48, %92
  %.04247 = phi i32 [ 0, %.lr.ph48 ], [ %101, %92 ]
  %93 = load i32, ptr %72, align 8, !tbaa !37
  %94 = load i32, ptr %54, align 4, !tbaa !32
  %95 = mul nsw i32 %94, %93
  %96 = mul nsw i32 %95, %.04247
  %97 = mul i32 %60, %96
  %98 = load i32, ptr @_ZN11GlobalParam10_texTargetE, align 4, !tbaa !17
  %99 = sext i32 %97 to i64
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %99) #5
  call void @glTexSubImage2D(i32 noundef %98, i32 noundef 0, i32 noundef %96, i32 noundef 0, i32 noundef %95, i32 noundef %59, i32 noundef 6408, i32 noundef 5121, ptr noundef nonnull %100)
  %101 = add nuw nsw i32 %.04247, 1
  %102 = load i32, ptr %68, align 4, !tbaa !35
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %92, label %.loopexit, !llvm.loop !38

.loopexit:                                        ; preds = %92, %.preheader, %89
  call void @_ZN10GLTexImage9UnbindTexEv()
  br label %104

104:                                              ; preds = %15, %5, %.loopexit
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

attributes #0 = { mustprogress 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 = { 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 = { "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 nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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, !8, i64 432}
!6 = !{!"_ZTS11SiftMatchGL", !7, i64 0, !9, i64 32, !9, i64 112, !12, i64 192, !9, i64 232, !11, i64 312, !11, i64 320, !11, i64 328, !11, i64 336, !8, i64 344, !8, i64 348, !8, i64 352, !8, i64 356, !8, i64 360, !8, i64 364, !8, i64 368, !8, i64 372, !8, i64 376, !8, i64 380, !8, i64 384, !8, i64 388, !9, i64 392, !9, i64 400, !9, i64 408, !8, i64 416, !8, i64 420, !8, i64 424, !8, i64 428, !8, i64 432, !13, i64 440}
!7 = !{!"_ZTS12SiftMatchGPU", !8, i64 8, !8, i64 12, !11, i64 16, !8, i64 24}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTS10GLTexImage", !8, i64 8, !8, i64 12, !8, i64 16, !8, i64 20, !8, i64 24, !8, i64 28, !8, i64 32}
!13 = !{!"_ZTSSt6vectorIfSaIfEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!17 = !{!8, !8, i64 0}
!18 = !{!7, !8, i64 24}
!19 = !{!20, !20, i64 0}
!20 = !{!"float", !9, i64 0}
!21 = !{!9, !9, i64 0}
!22 = !{!23}
!23 = distinct !{!23, !24}
!24 = distinct !{!24, !"LVerDomain"}
!25 = !{!26}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !28, !29, !30}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!"llvm.loop.isvectorized", i32 1}
!30 = !{!"llvm.loop.unroll.runtime.disable"}
!31 = !{!6, !8, i64 424}
!32 = !{!6, !8, i64 428}
!33 = !{!34, !34, i64 0}
!34 = !{!"vtable pointer", !10, i64 0}
!35 = !{!6, !8, i64 420}
!36 = distinct !{!36, !28, !29}
!37 = !{!6, !8, i64 416}
!38 = distinct !{!38, !28}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass