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

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

; 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
define dso_local noundef i32 @_ZN12SiftMatchGPU18GetGuidedSiftMatchEiPA2_jPfS2_ffffi(ptr noundef nonnull align 8 dereferenceable(28) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, float noundef %5, float noundef %6, float noundef %7, float noundef %8, i32 noundef %9) unnamed_addr #1 align 2 {
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca i32, align 4
  %22 = alloca [9 x float], align 16
  %23 = alloca float, align 4
  store ptr %0, ptr %12, align 8, !tbaa !5
  store i32 %1, ptr %13, align 4, !tbaa !9
  store ptr %2, ptr %14, align 8, !tbaa !5
  store ptr %3, ptr %15, align 8, !tbaa !5
  store ptr %4, ptr %16, align 8, !tbaa !5
  store float %5, ptr %17, align 4, !tbaa !11
  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 i32 %9, ptr %21, align 4, !tbaa !9
  %24 = load ptr, ptr %12, align 8
  %25 = load ptr, ptr %15, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %42

27:                                               ; preds = %10
  %28 = load ptr, ptr %16, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %42

30:                                               ; preds = %27
  %31 = getelementptr inbounds %class.SiftMatchGPU, ptr %24, i32 0, i32 3
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  %33 = load i32, ptr %13, align 4, !tbaa !9
  %34 = load ptr, ptr %14, align 8, !tbaa !5
  %35 = load float, ptr %17, align 4, !tbaa !11
  %36 = load float, ptr %18, align 4, !tbaa !11
  %37 = load i32, ptr %21, align 4, !tbaa !9
  %38 = load ptr, ptr %32, align 8, !tbaa !15
  %39 = getelementptr inbounds ptr, ptr %38, i64 12
  %40 = load ptr, ptr %39, align 8
  %41 = call noundef i32 %40(ptr noundef nonnull align 8 dereferenceable(28) %32, i32 noundef %33, ptr noundef %34, float noundef %35, float noundef %36, i32 noundef %37)
  store i32 %41, ptr %11, align 4
  br label %89

42:                                               ; preds = %27, %10
  call void @llvm.lifetime.start.p0(i64 36, ptr %22) #3
  call void @llvm.memset.p0.i64(ptr align 16 %22, i8 0, i64 36, i1 false)
  %43 = getelementptr inbounds [9 x float], ptr %22, i32 0, i32 0
  store float 1.000000e+00, ptr %43, align 16
  %44 = getelementptr inbounds [9 x float], ptr %22, i32 0, i32 4
  store float 1.000000e+00, ptr %44, align 16
  %45 = getelementptr inbounds [9 x float], ptr %22, i32 0, i32 8
  store float 1.000000e+00, ptr %45, align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  store float 0x4415AF1D80000000, ptr %23, align 4, !tbaa !11
  %46 = getelementptr inbounds %class.SiftMatchGPU, ptr %24, i32 0, i32 3
  %47 = load ptr, ptr %46, align 8, !tbaa !13
  %48 = load i32, ptr %13, align 4, !tbaa !9
  %49 = load ptr, ptr %14, align 8, !tbaa !5
  %50 = load ptr, ptr %15, align 8, !tbaa !5
  %51 = icmp ne ptr %50, null
  br i1 %51, label %52, label %54

52:                                               ; preds = %42
  %53 = load ptr, ptr %15, align 8, !tbaa !5
  br label %56

54:                                               ; preds = %42
  %55 = getelementptr inbounds [9 x float], ptr %22, i64 0, i64 0
  br label %56

56:                                               ; preds = %54, %52
  %57 = phi ptr [ %53, %52 ], [ %55, %54 ]
  %58 = load ptr, ptr %16, align 8, !tbaa !5
  %59 = icmp ne ptr %58, null
  br i1 %59, label %60, label %62

60:                                               ; preds = %56
  %61 = load ptr, ptr %16, align 8, !tbaa !5
  br label %64

62:                                               ; preds = %56
  %63 = getelementptr inbounds [9 x float], ptr %22, i64 0, i64 0
  br label %64

64:                                               ; preds = %62, %60
  %65 = phi ptr [ %61, %60 ], [ %63, %62 ]
  %66 = load float, ptr %17, align 4, !tbaa !11
  %67 = load float, ptr %18, align 4, !tbaa !11
  %68 = load ptr, ptr %15, align 8, !tbaa !5
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %72

70:                                               ; preds = %64
  %71 = load float, ptr %19, align 4, !tbaa !11
  br label %74

72:                                               ; preds = %64
  %73 = load float, ptr %23, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %72, %70
  %75 = phi float [ %71, %70 ], [ %73, %72 ]
  %76 = load ptr, ptr %16, align 8, !tbaa !5
  %77 = icmp ne ptr %76, null
  br i1 %77, label %78, label %80

78:                                               ; preds = %74
  %79 = load float, ptr %20, align 4, !tbaa !11
  br label %82

80:                                               ; preds = %74
  %81 = load float, ptr %23, align 4, !tbaa !11
  br label %82

82:                                               ; preds = %80, %78
  %83 = phi float [ %79, %78 ], [ %81, %80 ]
  %84 = load i32, ptr %21, align 4, !tbaa !9
  %85 = load ptr, ptr %47, align 8, !tbaa !15
  %86 = getelementptr inbounds ptr, ptr %85, i64 14
  %87 = load ptr, ptr %86, align 8
  %88 = call noundef i32 %87(ptr noundef nonnull align 8 dereferenceable(28) %47, i32 noundef %48, ptr noundef %49, ptr noundef %57, ptr noundef %65, float noundef %66, float noundef %67, float noundef %75, float noundef %83, i32 noundef %84)
  store i32 %88, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 36, ptr %22) #3
  br label %89

89:                                               ; preds = %82, %30
  %90 = load i32, ptr %11, align 4
  ret i32 %90
}

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !6, i64 16}
!14 = !{!"_ZTS12SiftMatchGPU", !10, i64 8, !10, i64 12, !6, i64 16, !10, i64 24}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: mustprogress 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
define dso_local noundef i32 @_ZN12SiftMatchGPU18GetGuidedSiftMatchEiPA2_jPfS2_ffffi(ptr nocapture noundef nonnull readonly align 8 dereferenceable(28) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, float noundef %5, float noundef %6, float noundef %7, float noundef %8, i32 noundef %9) unnamed_addr #1 align 2 {
  %11 = alloca [9 x float], align 16
  %12 = icmp eq ptr %3, null
  %13 = icmp eq ptr %4, null
  %or.cond = and i1 %12, %13
  br i1 %or.cond, label %14, label %21

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  %18 = getelementptr inbounds i8, ptr %17, i64 96
  %19 = load ptr, ptr %18, align 8
  %20 = tail call noundef i32 %19(ptr noundef nonnull align 8 dereferenceable(28) %16, i32 noundef %1, ptr noundef %2, float noundef %5, float noundef %6, i32 noundef %9)
  br label %34

21:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %11) #3
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %11, i8 0, i64 32, i1 false)
  store float 1.000000e+00, ptr %11, align 16
  %22 = getelementptr inbounds i8, ptr %11, i64 16
  store float 1.000000e+00, ptr %22, align 16
  %23 = getelementptr inbounds i8, ptr %11, i64 32
  store float 1.000000e+00, ptr %23, align 16
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = select i1 %12, ptr %11, ptr %3
  %27 = select i1 %13, ptr %11, ptr %4
  %28 = select i1 %12, float 0x4415AF1D80000000, float %7
  %29 = select i1 %13, float 0x4415AF1D80000000, float %8
  %30 = load ptr, ptr %25, align 8, !tbaa !11
  %31 = getelementptr inbounds i8, ptr %30, i64 112
  %32 = load ptr, ptr %31, align 8
  %33 = call noundef i32 %32(ptr noundef nonnull align 8 dereferenceable(28) %25, i32 noundef %1, ptr noundef %2, ptr noundef nonnull %26, ptr noundef nonnull %27, float noundef %5, float noundef %6, float noundef %28, float noundef %29, i32 noundef %9)
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %11) #3
  br label %34

34:                                               ; preds = %21, %14
  %.0 = phi i32 [ %20, %14 ], [ %33, %21 ]
  ret i32 %.0
}

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

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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 16}
!6 = !{!"_ZTS12SiftMatchGPU", !7, i64 8, !7, i64 12, !10, i64 16, !7, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !9, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass