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

; 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: nounwind uwtable
declare dso_local i32 @vl_covdet_extract_patch_helper(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, double noundef, double noundef, ptr noundef, ptr noundef, double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @vl_covdet_extract_patch_for_frame(ptr noundef %0, ptr noundef %1, i64 noundef %2, double noundef %3, double noundef %4, ptr noundef byval(%struct._VlFrameOrientedEllipse) align 8 %5) #1 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca [4 x double], align 16
  %13 = alloca [2 x double], align 16
  %14 = alloca [4 x double], align 16
  %15 = alloca [4 x double], align 16
  %16 = alloca [4 x double], align 16
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !9
  store double %3, ptr %10, align 8, !tbaa !11
  store double %4, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #3
  %17 = getelementptr inbounds %struct._VlFrameOrientedEllipse, ptr %5, i32 0, i32 2
  %18 = load float, ptr %17, align 8, !tbaa !13
  %19 = fpext float %18 to double
  store double %19, ptr %12, align 8, !tbaa !11
  %20 = getelementptr inbounds double, ptr %12, i64 1
  %21 = getelementptr inbounds %struct._VlFrameOrientedEllipse, ptr %5, i32 0, i32 4
  %22 = load float, ptr %21, align 8, !tbaa !16
  %23 = fpext float %22 to double
  store double %23, ptr %20, align 8, !tbaa !11
  %24 = getelementptr inbounds double, ptr %12, i64 2
  %25 = getelementptr inbounds %struct._VlFrameOrientedEllipse, ptr %5, i32 0, i32 3
  %26 = load float, ptr %25, align 4, !tbaa !17
  %27 = fpext float %26 to double
  store double %27, ptr %24, align 8, !tbaa !11
  %28 = getelementptr inbounds double, ptr %12, i64 3
  %29 = getelementptr inbounds %struct._VlFrameOrientedEllipse, ptr %5, i32 0, i32 5
  %30 = load float, ptr %29, align 4, !tbaa !18
  %31 = fpext float %30 to double
  store double %31, ptr %28, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #3
  %32 = getelementptr inbounds %struct._VlFrameOrientedEllipse, ptr %5, i32 0, i32 0
  %33 = load float, ptr %32, align 8, !tbaa !19
  %34 = fpext float %33 to double
  store double %34, ptr %13, align 8, !tbaa !11
  %35 = getelementptr inbounds double, ptr %13, i64 1
  %36 = getelementptr inbounds %struct._VlFrameOrientedEllipse, ptr %5, i32 0, i32 1
  %37 = load float, ptr %36, align 4, !tbaa !20
  %38 = fpext float %37 to double
  store double %38, ptr %35, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #3
  %39 = getelementptr inbounds [4 x double], ptr %14, i64 0, i64 0
  %40 = getelementptr inbounds [4 x double], ptr %15, i64 0, i64 0
  %41 = getelementptr inbounds [4 x double], ptr %16, i64 0, i64 0
  %42 = getelementptr inbounds [4 x double], ptr %12, i64 0, i64 0
  call void @vl_svd2(ptr noundef %39, ptr noundef %40, ptr noundef %41, ptr noundef %42)
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = load i64, ptr %9, align 8, !tbaa !9
  %46 = load double, ptr %10, align 8, !tbaa !11
  %47 = load double, ptr %11, align 8, !tbaa !11
  %48 = getelementptr inbounds [4 x double], ptr %12, i64 0, i64 0
  %49 = getelementptr inbounds [2 x double], ptr %13, i64 0, i64 0
  %50 = getelementptr inbounds [4 x double], ptr %14, i64 0, i64 0
  %51 = load double, ptr %50, align 16, !tbaa !11
  %52 = getelementptr inbounds [4 x double], ptr %14, i64 0, i64 3
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = call i32 @vl_covdet_extract_patch_helper(ptr noundef %43, ptr noundef null, ptr noundef null, ptr noundef %44, i64 noundef %45, double noundef %46, double noundef %47, ptr noundef %48, ptr noundef %49, double noundef %51, double noundef %53)
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #3
  ret i32 %54
}

declare void @vl_svd2(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !15, i64 8}
!14 = !{!"_VlFrameOrientedEllipse", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20}
!15 = !{!"float", !7, i64 0}
!16 = !{!14, !15, i64 16}
!17 = !{!14, !15, i64 12}
!18 = !{!14, !15, i64 20}
!19 = !{!14, !15, i64 0}
!20 = !{!14, !15, i64 4}


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

; 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: nounwind uwtable
declare dso_local i32 @vl_covdet_extract_patch_helper(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, double noundef, double noundef, ptr noundef, ptr noundef, double noundef, double noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @vl_covdet_extract_patch_for_frame(ptr noundef %0, ptr noundef %1, i64 noundef %2, double noundef %3, double noundef %4, ptr nocapture noundef readonly byval(%struct._VlFrameOrientedEllipse) align 8 %5) local_unnamed_addr #1 {
  %7 = alloca [4 x double], align 16
  %8 = alloca [2 x double], align 16
  %9 = alloca [4 x double], align 16
  %10 = alloca [4 x double], align 16
  %11 = alloca [4 x double], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #3
  %12 = getelementptr inbounds i8, ptr %5, i64 8
  %13 = load <4 x float>, ptr %12, align 8
  %14 = shufflevector <4 x float> %13, <4 x float> poison, <2 x i32> <i32 0, i32 poison>
  %15 = getelementptr inbounds i8, ptr %5, i64 16
  %16 = load float, ptr %15, align 8, !tbaa !5
  %17 = insertelement <2 x float> %14, float %16, i64 1
  %18 = fpext <2 x float> %17 to <2 x double>
  store <2 x double> %18, ptr %7, align 16, !tbaa !10
  %19 = getelementptr inbounds i8, ptr %7, i64 16
  %20 = load <4 x float>, ptr %5, align 8
  %21 = shufflevector <4 x float> %20, <4 x float> poison, <2 x i32> <i32 3, i32 poison>
  %22 = getelementptr inbounds i8, ptr %5, i64 20
  %23 = load float, ptr %22, align 4, !tbaa !12
  %24 = insertelement <2 x float> %21, float %23, i64 1
  %25 = fpext <2 x float> %24 to <2 x double>
  store <2 x double> %25, ptr %19, align 16, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #3
  %26 = load <2 x float>, ptr %5, align 8, !tbaa !13
  %27 = fpext <2 x float> %26 to <2 x double>
  store <2 x double> %27, ptr %8, align 16, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #3
  call void @vl_svd2(ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %7) #3
  %28 = load double, ptr %9, align 16, !tbaa !10
  %29 = getelementptr inbounds i8, ptr %9, i64 24
  %30 = load double, ptr %29, align 8, !tbaa !10
  %31 = call i32 @vl_covdet_extract_patch_helper(ptr noundef %0, ptr noundef null, ptr noundef null, ptr noundef %1, i64 noundef %2, double noundef %3, double noundef %4, ptr noundef nonnull %7, ptr noundef nonnull %8, double noundef %28, double noundef %30)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #3
  ret i32 %31
}

declare void @vl_svd2(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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, !7, i64 16}
!6 = !{!"_VlFrameOrientedEllipse", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !7, i64 20}
!13 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,VectorCombinePass