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

; 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._VlScaleSpace = type { %struct._VlScaleSpaceGeometry, ptr }
%struct._VlScaleSpaceGeometry = type { i64, i64, i64, i64, i64, i64, i64, 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: nounwind uwtable
declare dso_local void @_vl_scalespace_fill_octave(ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @vl_scalespace_put_image(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct._VlScaleSpace, ptr %8, i32 0, i32 0
  %10 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %9, i32 0, i32 2
  %11 = load i64, ptr %10, align 8, !tbaa !9
  call void @_vl_scalespace_start_octave_from_image(ptr noundef %6, ptr noundef %7, i64 noundef %11)
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._VlScaleSpace, ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %14, i32 0, i32 2
  %16 = load i64, ptr %15, align 8, !tbaa !9
  call void @_vl_scalespace_fill_octave(ptr noundef %12, i64 noundef %16)
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._VlScaleSpace, ptr %17, i32 0, i32 0
  %19 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %18, i32 0, i32 2
  %20 = load i64, ptr %19, align 8, !tbaa !9
  %21 = add nsw i64 %20, 1
  store i64 %21, ptr %5, align 8, !tbaa !14
  br label %22

22:                                               ; preds = %34, %2
  %23 = load i64, ptr %5, align 8, !tbaa !14
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._VlScaleSpace, ptr %24, i32 0, i32 0
  %26 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %25, i32 0, i32 3
  %27 = load i64, ptr %26, align 8, !tbaa !15
  %28 = icmp sle i64 %23, %27
  br i1 %28, label %29, label %37

29:                                               ; preds = %22
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = load i64, ptr %5, align 8, !tbaa !14
  call void @_vl_scalespace_start_octave_from_previous_octave(ptr noundef %30, i64 noundef %31)
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load i64, ptr %5, align 8, !tbaa !14
  call void @_vl_scalespace_fill_octave(ptr noundef %32, i64 noundef %33)
  br label %34

34:                                               ; preds = %29
  %35 = load i64, ptr %5, align 8, !tbaa !14
  %36 = add nsw i64 %35, 1
  store i64 %36, ptr %5, align 8, !tbaa !14
  br label %22, !llvm.loop !16

37:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret void
}

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

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

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 = { 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, !12, i64 16}
!10 = !{!"_VlScaleSpace", !11, i64 0, !6, i64 72}
!11 = !{!"_VlScaleSpaceGeometry", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !13, i64 56, !13, i64 64}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !12, i64 0}
!15 = !{!10, !12, i64 24}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; 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: nounwind uwtable
declare dso_local void @_vl_scalespace_fill_octave(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @vl_scalespace_put_image(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load i64, ptr %3, align 8, !tbaa !5
  tail call void @_vl_scalespace_start_octave_from_image(ptr noundef %0, ptr noundef %1, i64 noundef %4)
  %5 = load i64, ptr %3, align 8, !tbaa !5
  tail call void @_vl_scalespace_fill_octave(ptr noundef %0, i64 noundef %5)
  %6 = load i64, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load i64, ptr %7, align 8, !tbaa !13
  %.not.not12 = icmp slt i64 %6, %8
  br i1 %.not.not12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.0.in13 = phi i64 [ %.0, %.lr.ph ], [ %6, %2 ]
  %.0 = add nsw i64 %.0.in13, 1
  tail call void @_vl_scalespace_start_octave_from_previous_octave(ptr noundef nonnull %0, i64 noundef %.0)
  tail call void @_vl_scalespace_fill_octave(ptr noundef nonnull %0, i64 noundef %.0)
  %9 = load i64, ptr %7, align 8, !tbaa !13
  %.not.not = icmp slt i64 %.0, %9
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph, %2
  ret void
}

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

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

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

!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 16}
!6 = !{!"_VlScaleSpace", !7, i64 0, !12, i64 72}
!7 = !{!"_VlScaleSpaceGeometry", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !11, i64 56, !11, i64 64}
!8 = !{!"long long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"double", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!6, !8, i64 24}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass