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

; 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.VlDsiftFilter_ = type { i32, i32, i32, i32, i32, i32, i32, i32, %struct.VlDsiftDescriptorGeometry_, i32, double, i32, i32, ptr, ptr, i32, i32, i32, ptr, ptr, ptr }
%struct.VlDsiftDescriptorGeometry_ = type { i32, i32, i32, i32, i32 }

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

declare ptr @vl_malloc(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: nounwind uwtable
declare dso_local void @_vl_dsift_update_buffers(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @vl_dsift_new(i32 noundef %0, i32 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %6 = call ptr @vl_malloc(i64 noundef 128)
  store ptr %6, ptr %5, align 8, !tbaa !9
  %7 = load i32, ptr %3, align 4, !tbaa !5
  %8 = load ptr, ptr %5, align 8, !tbaa !9
  %9 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %8, i32 0, i32 0
  store i32 %7, ptr %9, align 8, !tbaa !11
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !9
  %12 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %11, i32 0, i32 1
  store i32 %10, ptr %12, align 4, !tbaa !15
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %13, i32 0, i32 2
  store i32 5, ptr %14, align 8, !tbaa !16
  %15 = load ptr, ptr %5, align 8, !tbaa !9
  %16 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %15, i32 0, i32 3
  store i32 5, ptr %16, align 4, !tbaa !17
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %17, i32 0, i32 4
  store i32 0, ptr %18, align 8, !tbaa !18
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %19, i32 0, i32 5
  store i32 0, ptr %20, align 4, !tbaa !19
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = sub nsw i32 %21, 1
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %23, i32 0, i32 6
  store i32 %22, ptr %24, align 8, !tbaa !20
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = sub nsw i32 %25, 1
  %27 = load ptr, ptr %5, align 8, !tbaa !9
  %28 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %27, i32 0, i32 7
  store i32 %26, ptr %28, align 4, !tbaa !21
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %29, i32 0, i32 8
  %31 = getelementptr inbounds %struct.VlDsiftDescriptorGeometry_, ptr %30, i32 0, i32 1
  store i32 4, ptr %31, align 4, !tbaa !22
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %32, i32 0, i32 8
  %34 = getelementptr inbounds %struct.VlDsiftDescriptorGeometry_, ptr %33, i32 0, i32 2
  store i32 4, ptr %34, align 8, !tbaa !23
  %35 = load ptr, ptr %5, align 8, !tbaa !9
  %36 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %35, i32 0, i32 8
  %37 = getelementptr inbounds %struct.VlDsiftDescriptorGeometry_, ptr %36, i32 0, i32 0
  store i32 8, ptr %37, align 8, !tbaa !24
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %38, i32 0, i32 8
  %40 = getelementptr inbounds %struct.VlDsiftDescriptorGeometry_, ptr %39, i32 0, i32 3
  store i32 5, ptr %40, align 4, !tbaa !25
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %41, i32 0, i32 8
  %43 = getelementptr inbounds %struct.VlDsiftDescriptorGeometry_, ptr %42, i32 0, i32 4
  store i32 5, ptr %43, align 8, !tbaa !26
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %44, i32 0, i32 9
  store i32 0, ptr %45, align 4, !tbaa !27
  %46 = load ptr, ptr %5, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %46, i32 0, i32 10
  store double 2.000000e+00, ptr %47, align 8, !tbaa !28
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %48, i32 0, i32 0
  %50 = load i32, ptr %49, align 8, !tbaa !11
  %51 = sext i32 %50 to i64
  %52 = mul i64 4, %51
  %53 = load ptr, ptr %5, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %53, i32 0, i32 1
  %55 = load i32, ptr %54, align 4, !tbaa !15
  %56 = sext i32 %55 to i64
  %57 = mul i64 %52, %56
  %58 = call ptr @vl_malloc(i64 noundef %57)
  %59 = load ptr, ptr %5, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %59, i32 0, i32 19
  store ptr %58, ptr %60, align 8, !tbaa !29
  %61 = load ptr, ptr %5, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %61, i32 0, i32 0
  %63 = load i32, ptr %62, align 8, !tbaa !11
  %64 = sext i32 %63 to i64
  %65 = mul i64 4, %64
  %66 = load ptr, ptr %5, align 8, !tbaa !9
  %67 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 4, !tbaa !15
  %69 = sext i32 %68 to i64
  %70 = mul i64 %65, %69
  %71 = call ptr @vl_malloc(i64 noundef %70)
  %72 = load ptr, ptr %5, align 8, !tbaa !9
  %73 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %72, i32 0, i32 20
  store ptr %71, ptr %73, align 8, !tbaa !30
  %74 = load ptr, ptr %5, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %74, i32 0, i32 15
  store i32 0, ptr %75, align 8, !tbaa !31
  %76 = load ptr, ptr %5, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %76, i32 0, i32 16
  store i32 0, ptr %77, align 4, !tbaa !32
  %78 = load ptr, ptr %5, align 8, !tbaa !9
  %79 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %78, i32 0, i32 17
  store i32 0, ptr %79, align 8, !tbaa !33
  %80 = load ptr, ptr %5, align 8, !tbaa !9
  %81 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %80, i32 0, i32 12
  store i32 0, ptr %81, align 4, !tbaa !34
  %82 = load ptr, ptr %5, align 8, !tbaa !9
  %83 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %82, i32 0, i32 11
  store i32 0, ptr %83, align 8, !tbaa !35
  %84 = load ptr, ptr %5, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %84, i32 0, i32 18
  store ptr null, ptr %85, align 8, !tbaa !36
  %86 = load ptr, ptr %5, align 8, !tbaa !9
  %87 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %86, i32 0, i32 13
  store ptr null, ptr %87, align 8, !tbaa !37
  %88 = load ptr, ptr %5, align 8, !tbaa !9
  %89 = getelementptr inbounds %struct.VlDsiftFilter_, ptr %88, i32 0, i32 14
  store ptr null, ptr %89, align 8, !tbaa !38
  %90 = load ptr, ptr %5, align 8, !tbaa !9
  call void @_vl_dsift_update_buffers(ptr noundef %90)
  %91 = load ptr, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret ptr %91
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"VlDsiftFilter_", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !13, i64 32, !6, i64 52, !14, i64 56, !6, i64 64, !6, i64 68, !10, i64 72, !10, i64 80, !6, i64 88, !6, i64 92, !6, i64 96, !10, i64 104, !10, i64 112, !10, i64 120}
!13 = !{!"VlDsiftDescriptorGeometry_", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!14 = !{!"double", !7, i64 0}
!15 = !{!12, !6, i64 4}
!16 = !{!12, !6, i64 8}
!17 = !{!12, !6, i64 12}
!18 = !{!12, !6, i64 16}
!19 = !{!12, !6, i64 20}
!20 = !{!12, !6, i64 24}
!21 = !{!12, !6, i64 28}
!22 = !{!12, !6, i64 36}
!23 = !{!12, !6, i64 40}
!24 = !{!12, !6, i64 32}
!25 = !{!12, !6, i64 44}
!26 = !{!12, !6, i64 48}
!27 = !{!12, !6, i64 52}
!28 = !{!12, !14, i64 56}
!29 = !{!12, !10, i64 112}
!30 = !{!12, !10, i64 120}
!31 = !{!12, !6, i64 88}
!32 = !{!12, !6, i64 92}
!33 = !{!12, !6, i64 96}
!34 = !{!12, !6, i64 68}
!35 = !{!12, !6, i64 64}
!36 = !{!12, !10, i64 104}
!37 = !{!12, !10, i64 72}
!38 = !{!12, !10, i64 80}


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

declare ptr @vl_malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @_vl_dsift_update_buffers(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @vl_dsift_new(i32 noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = tail call ptr @vl_malloc(i64 noundef 128) #3
  store i32 %0, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 %1, ptr %4, align 4, !tbaa !13
  %5 = getelementptr inbounds i8, ptr %3, i64 8
  store <4 x i32> <i32 5, i32 5, i32 0, i32 0>, ptr %5, align 8, !tbaa !14
  %6 = add nsw i32 %0, -1
  %7 = getelementptr inbounds i8, ptr %3, i64 24
  store i32 %6, ptr %7, align 8, !tbaa !15
  %8 = add nsw i32 %1, -1
  %9 = getelementptr inbounds i8, ptr %3, i64 28
  store i32 %8, ptr %9, align 4, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %3, i64 32
  store <4 x i32> <i32 8, i32 4, i32 4, i32 5>, ptr %10, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %3, i64 48
  store i32 5, ptr %11, align 8, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %3, i64 52
  store i32 0, ptr %12, align 4, !tbaa !18
  %13 = getelementptr inbounds i8, ptr %3, i64 56
  store double 2.000000e+00, ptr %13, align 8, !tbaa !19
  %14 = sext i32 %0 to i64
  %15 = shl nsw i64 %14, 2
  %16 = sext i32 %1 to i64
  %17 = mul i64 %15, %16
  %18 = tail call ptr @vl_malloc(i64 noundef %17) #3
  %19 = getelementptr inbounds i8, ptr %3, i64 112
  store ptr %18, ptr %19, align 8, !tbaa !20
  %20 = load i32, ptr %3, align 8, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = shl nsw i64 %21, 2
  %23 = load i32, ptr %4, align 4, !tbaa !13
  %24 = sext i32 %23 to i64
  %25 = mul i64 %22, %24
  %26 = tail call ptr @vl_malloc(i64 noundef %25) #3
  %27 = getelementptr inbounds i8, ptr %3, i64 120
  store ptr %26, ptr %27, align 8, !tbaa !21
  %28 = getelementptr inbounds i8, ptr %3, i64 64
  %29 = getelementptr inbounds i8, ptr %3, i64 104
  store ptr null, ptr %29, align 8, !tbaa !22
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(36) %28, i8 0, i64 36, i1 false)
  tail call void @_vl_dsift_update_buffers(ptr noundef nonnull %3)
  ret ptr %3
}

; 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 = { "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 = { 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 = { 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, !7, i64 0}
!6 = !{!"VlDsiftFilter_", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !10, i64 32, !7, i64 52, !11, i64 56, !7, i64 64, !7, i64 68, !12, i64 72, !12, i64 80, !7, i64 88, !7, i64 92, !7, i64 96, !12, i64 104, !12, i64 112, !12, i64 120}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"VlDsiftDescriptorGeometry_", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16}
!11 = !{!"double", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !7, i64 4}
!14 = !{!7, !7, i64 0}
!15 = !{!6, !7, i64 24}
!16 = !{!6, !7, i64 28}
!17 = !{!6, !7, i64 48}
!18 = !{!6, !7, i64 52}
!19 = !{!6, !11, i64 56}
!20 = !{!6, !12, i64 112}
!21 = !{!6, !12, i64 120}
!22 = !{!6, !12, i64 104}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass