; 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._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 }
%struct._VlCovDetFeature = type { %struct._VlFrameOrientedEllipse, float, float, float, float }
%struct._VlFrameOrientedEllipse = type { float, float, float, float, float, float }

@.str.1 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@__PRETTY_FUNCTION__.vl_covdet_append_feature = external hidden unnamed_addr constant [66 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [8 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare hidden i32 @_vl_resize_buffer(ptr noundef, ptr noundef, i64 noundef) #1

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @vl_covdet_append_feature(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  br label %13

12:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.1, i32 noundef 1651, ptr noundef @__PRETTY_FUNCTION__.vl_covdet_append_feature) #5
  unreachable

13:                                               ; preds = %11
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %17

16:                                               ; preds = %13
  br label %18

17:                                               ; preds = %13
  call void @__assert_fail(ptr noundef @.str.13, ptr noundef @.str.1, i32 noundef 1652, ptr noundef @__PRETTY_FUNCTION__.vl_covdet_append_feature) #5
  unreachable

18:                                               ; preds = %16
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._VlCovDet, ptr %19, i32 0, i32 11
  %21 = load i64, ptr %20, align 8, !tbaa !9
  %22 = add i64 %21, 1
  store i64 %22, ptr %20, align 8, !tbaa !9
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._VlCovDet, ptr %23, i32 0, i32 11
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = mul i64 %25, 40
  store i64 %26, ptr %6, align 8, !tbaa !14
  %27 = load i64, ptr %6, align 8, !tbaa !14
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._VlCovDet, ptr %28, i32 0, i32 12
  %30 = load i64, ptr %29, align 8, !tbaa !15
  %31 = icmp ugt i64 %27, %30
  br i1 %31, label %32, label %55

32:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._VlCovDet, ptr %33, i32 0, i32 10
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._VlCovDet, ptr %35, i32 0, i32 12
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._VlCovDet, ptr %37, i32 0, i32 11
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = add i64 %39, 1000
  %41 = mul i64 %40, 40
  %42 = call i32 @_vl_resize_buffer(ptr noundef %34, ptr noundef %36, i64 noundef %41)
  store i32 %42, ptr %7, align 4, !tbaa !16
  %43 = load i32, ptr %7, align 4, !tbaa !16
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %51

45:                                               ; preds = %32
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._VlCovDet, ptr %46, i32 0, i32 11
  %48 = load i64, ptr %47, align 8, !tbaa !9
  %49 = add i64 %48, -1
  store i64 %49, ptr %47, align 8, !tbaa !9
  %50 = load i32, ptr %7, align 4, !tbaa !16
  store i32 %50, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %52

51:                                               ; preds = %32
  store i32 0, ptr %8, align 4
  br label %52

52:                                               ; preds = %51, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %53 = load i32, ptr %8, align 4
  switch i32 %53, label %65 [
    i32 0, label %54
  ]

54:                                               ; preds = %52
  br label %55

55:                                               ; preds = %54, %18
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._VlCovDet, ptr %56, i32 0, i32 10
  %58 = load ptr, ptr %57, align 8, !tbaa !17
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._VlCovDet, ptr %59, i32 0, i32 11
  %61 = load i64, ptr %60, align 8, !tbaa !9
  %62 = sub i64 %61, 1
  %63 = getelementptr inbounds %struct._VlCovDetFeature, ptr %58, i64 %62
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %63, ptr align 4 %64, i64 40, i1 false), !tbaa.struct !18
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %65

65:                                               ; preds = %55, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %66 = load i32, ptr %3, align 4
  ret i32 %66
}

; 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) #3

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 = { noreturn 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind }
attributes #5 = { noreturn 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, !13, i64 88}
!10 = !{!"_VlCovDet", !6, i64 0, !6, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !13, i64 48, !13, i64 56, !12, i64 64, !13, i64 72, !6, i64 80, !13, i64 88, !13, i64 96, !6, i64 104, !13, i64 112, !11, i64 120, !7, i64 128, !7, i64 192, !11, i64 256, !7, i64 260, !7, i64 6984, !7, i64 13708, !7, i64 20432, !7, i64 27156, !7, i64 31512, !7, i64 75072}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!10, !13, i64 96}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !6, i64 80}
!18 = !{i64 0, i64 4, !19, i64 4, i64 4, !19, i64 8, i64 4, !19, i64 12, i64 4, !19, i64 16, i64 4, !19, i64 20, i64 4, !19, i64 24, i64 4, !19, i64 28, i64 4, !19, i64 32, i64 4, !19, i64 36, i64 4, !19}
!19 = !{!20, !20, i64 0}
!20 = !{!"float", !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._VlCovDetFeature = type { %struct._VlFrameOrientedEllipse, float, float, float, float }
%struct._VlFrameOrientedEllipse = type { float, float, float, float, float, float }

@.str.1 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@__PRETTY_FUNCTION__.vl_covdet_append_feature = external hidden unnamed_addr constant [66 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
declare hidden i32 @_vl_resize_buffer(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @vl_covdet_append_feature(ptr noundef %0, ptr noundef readonly %1) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %3, label %4

3:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.1, i32 noundef 1651, ptr noundef nonnull @__PRETTY_FUNCTION__.vl_covdet_append_feature) #3
  unreachable

4:                                                ; preds = %2
  %.not19 = icmp eq ptr %1, null
  br i1 %.not19, label %5, label %6

5:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, i32 noundef 1652, ptr noundef nonnull @__PRETTY_FUNCTION__.vl_covdet_append_feature) #3
  unreachable

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 88
  %8 = load i64, ptr %7, align 8, !tbaa !5
  %9 = add i64 %8, 1
  store i64 %9, ptr %7, align 8, !tbaa !5
  %10 = mul i64 %9, 40
  %11 = getelementptr inbounds i8, ptr %0, i64 96
  %12 = load i64, ptr %11, align 8, !tbaa !13
  %13 = icmp ugt i64 %10, %12
  br i1 %13, label %14, label %.critedge

14:                                               ; preds = %6
  %15 = getelementptr inbounds i8, ptr %0, i64 80
  %16 = mul i64 %8, 40
  %17 = add i64 %16, 40040
  %18 = tail call i32 @_vl_resize_buffer(ptr noundef nonnull %15, ptr noundef nonnull %11, i64 noundef %17)
  %.not20 = icmp eq i32 %18, 0
  %.pre = load i64, ptr %7, align 8, !tbaa !5
  br i1 %.not20, label %.critedge, label %19

19:                                               ; preds = %14
  %20 = add i64 %.pre, -1
  store i64 %20, ptr %7, align 8, !tbaa !5
  br label %26

.critedge:                                        ; preds = %14, %6
  %21 = phi i64 [ %.pre, %14 ], [ %9, %6 ]
  %22 = getelementptr inbounds i8, ptr %0, i64 80
  %23 = load ptr, ptr %22, align 8, !tbaa !14
  %24 = getelementptr %struct._VlCovDetFeature, ptr %23, i64 %21
  %25 = getelementptr i8, ptr %24, i64 -40
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(40) %25, ptr noundef nonnull align 4 dereferenceable(40) %1, i64 40, i1 false), !tbaa.struct !15
  br label %26

26:                                               ; preds = %19, %.critedge
  %.1 = phi i32 [ 0, %.critedge ], [ %18, %19 ]
  ret i32 %.1
}

; 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) #2

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


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