; LLVM IR from QiaoLiuHit/LSOTB-TIR :: vlfeat-0.9.19/vl (covdet)

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

%struct._VlFrameOrientedEllipse = type { float, float, float, float, float, float }
%struct._VlCovDetFeature = type { %struct._VlFrameOrientedEllipse, float, float, float, float }
%struct._VlCovDet = type { ptr, ptr, i32, double, double, double, i64, i64, double, i64, ptr, i64, i64, ptr, i64, i32, [4 x %struct._VlCovDetFeatureOrientation], [4 x %struct._VlCovDetFeatureLaplacianScale], i32, [1681 x float], [1681 x float], [1681 x float], [1681 x float], [1089 x float], [10890 x float], [5 x i64] }
%struct._VlCovDetFeatureOrientation = type { double, double }
%struct._VlCovDetFeatureLaplacianScale = type { double, double }

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @vl_covdet_extract_affine_shape_for_frame(ptr noundef, ptr noundef, ptr noundef byval(%struct._VlFrameOrientedEllipse) align 8) #2

; Function Attrs: nounwind uwtable
define dso_local void @vl_covdet_extract_affine_shape(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct._VlFrameOrientedEllipse, align 4
  %9 = alloca %struct._VlFrameOrientedEllipse, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store i64 0, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = call i64 @vl_covdet_get_num_features(ptr noundef %10)
  store i64 %11, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = call ptr @vl_covdet_get_features(ptr noundef %12)
  store ptr %13, ptr %6, align 8, !tbaa !5
  store i64 0, ptr %3, align 8, !tbaa !9
  br label %14

14:                                               ; preds = %43, %1
  %15 = load i64, ptr %3, align 8, !tbaa !9
  %16 = load i64, ptr %5, align 8, !tbaa !9
  %17 = trunc i64 %16 to i32
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %15, %18
  br i1 %19, label %20, label %46

20:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #3
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load i64, ptr %3, align 8, !tbaa !9
  %24 = getelementptr inbounds %struct._VlCovDetFeature, ptr %22, i64 %23
  %25 = getelementptr inbounds %struct._VlCovDetFeature, ptr %24, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 4 %25, i64 24, i1 false), !tbaa.struct !11
  %26 = call i32 @vl_covdet_extract_affine_shape_for_frame(ptr noundef %21, ptr noundef %8, ptr noundef byval(%struct._VlFrameOrientedEllipse) align 8 %9)
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #3
  store i32 %26, ptr %7, align 4, !tbaa !14
  %27 = load i32, ptr %7, align 4, !tbaa !14
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %42

29:                                               ; preds = %20
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load i64, ptr %4, align 8, !tbaa !9
  %32 = getelementptr inbounds %struct._VlCovDetFeature, ptr %30, i64 %31
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = load i64, ptr %3, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct._VlCovDetFeature, ptr %33, i64 %34
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %35, i64 40, i1 false), !tbaa.struct !16
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load i64, ptr %4, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct._VlCovDetFeature, ptr %36, i64 %37
  %39 = getelementptr inbounds %struct._VlCovDetFeature, ptr %38, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %8, i64 24, i1 false), !tbaa.struct !11
  %40 = load i64, ptr %4, align 8, !tbaa !9
  %41 = add nsw i64 %40, 1
  store i64 %41, ptr %4, align 8, !tbaa !9
  br label %42

42:                                               ; preds = %29, %20
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %43

43:                                               ; preds = %42
  %44 = load i64, ptr %3, align 8, !tbaa !9
  %45 = add nsw i64 %44, 1
  store i64 %45, ptr %3, align 8, !tbaa !9
  br label %14, !llvm.loop !17

46:                                               ; preds = %14
  %47 = load i64, ptr %4, align 8, !tbaa !9
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._VlCovDet, ptr %48, i32 0, i32 11
  store i64 %47, ptr %49, align 8, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local i64 @vl_covdet_get_num_features(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @vl_covdet_get_features(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 4, !12, i64 12, i64 4, !12, i64 16, i64 4, !12, i64 20, i64 4, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 4, !12, i64 12, i64 4, !12, i64 16, i64 4, !12, i64 20, i64 4, !12, i64 24, i64 4, !12, i64 28, i64 4, !12, i64 32, i64 4, !12, i64 36, i64 4, !12}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !10, i64 88}
!20 = !{!"_VlCovDet", !6, i64 0, !6, i64 8, !15, i64 16, !21, i64 24, !21, i64 32, !21, i64 40, !10, i64 48, !10, i64 56, !21, i64 64, !10, i64 72, !6, i64 80, !10, i64 88, !10, i64 96, !6, i64 104, !10, i64 112, !15, i64 120, !7, i64 128, !7, i64 192, !15, i64 256, !7, i64 260, !7, i64 6984, !7, i64 13708, !7, i64 20432, !7, i64 27156, !7, i64 31512, !7, i64 75072}
!21 = !{!"double", !7, 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"

%struct._VlFrameOrientedEllipse = type { float, float, float, float, float, float }
%struct._VlCovDetFeature = type { %struct._VlFrameOrientedEllipse, float, float, float, float }

; 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 nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @vl_covdet_extract_affine_shape_for_frame(ptr noundef, ptr noundef, ptr noundef byval(%struct._VlFrameOrientedEllipse) align 8) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @vl_covdet_extract_affine_shape(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca %struct._VlFrameOrientedEllipse, align 4
  %3 = alloca %struct._VlFrameOrientedEllipse, align 8
  %4 = tail call i64 @vl_covdet_get_num_features(ptr noundef %0)
  %5 = tail call ptr @vl_covdet_get_features(ptr noundef %0)
  %sext = shl i64 %4, 32
  %6 = ashr exact i64 %sext, 32
  %7 = icmp sgt i64 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1, %14
  %.019 = phi i64 [ %15, %14 ], [ 0, %1 ]
  %.01718 = phi i64 [ %.1, %14 ], [ 0, %1 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #3
  %8 = getelementptr inbounds %struct._VlCovDetFeature, ptr %5, i64 %.019
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 4 dereferenceable(24) %8, i64 24, i1 false), !tbaa.struct !5
  %9 = call i32 @vl_covdet_extract_affine_shape_for_frame(ptr noundef %0, ptr noundef nonnull %2, ptr noundef nonnull byval(%struct._VlFrameOrientedEllipse) align 8 %3)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #3
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %11, label %14

11:                                               ; preds = %.lr.ph
  %12 = getelementptr inbounds %struct._VlCovDetFeature, ptr %5, i64 %.01718
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(40) %12, ptr noundef nonnull align 4 dereferenceable(40) %8, i64 40, i1 false), !tbaa.struct !10
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %12, ptr noundef nonnull align 4 dereferenceable(24) %2, i64 24, i1 false), !tbaa.struct !5
  %13 = add nsw i64 %.01718, 1
  br label %14

14:                                               ; preds = %11, %.lr.ph
  %.1 = phi i64 [ %13, %11 ], [ %.01718, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #3
  %15 = add nuw nsw i64 %.019, 1
  %exitcond.not = icmp eq i64 %15, %6
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %14, %1
  %.017.lcssa = phi i64 [ 0, %1 ], [ %.1, %14 ]
  %16 = getelementptr inbounds i8, ptr %0, i64 88
  store i64 %.017.lcssa, ptr %16, align 8, !tbaa !13
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local i64 @vl_covdet_get_num_features(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @vl_covdet_get_features(ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6, i64 12, i64 4, !6, i64 16, i64 4, !6, i64 20, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6, i64 12, i64 4, !6, i64 16, i64 4, !6, i64 20, i64 4, !6, i64 24, i64 4, !6, i64 28, i64 4, !6, i64 32, i64 4, !6, i64 36, i64 4, !6}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !18, i64 88}
!14 = !{!"_VlCovDet", !15, i64 0, !15, i64 8, !16, i64 16, !17, i64 24, !17, i64 32, !17, i64 40, !18, i64 48, !18, i64 56, !17, i64 64, !18, i64 72, !15, i64 80, !18, i64 88, !18, i64 96, !15, i64 104, !18, i64 112, !16, i64 120, !8, i64 128, !8, i64 192, !16, i64 256, !8, i64 260, !8, i64 6984, !8, i64 13708, !8, i64 20432, !8, i64 27156, !8, i64 31512, !8, i64 75072}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"int", !8, i64 0}
!17 = !{!"double", !8, i64 0}
!18 = !{!"long long", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass