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

; 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._VlKMeans = type { i32, i64, i64, i64, i64, i32, i32, i32, i64, double, i64, i32, ptr, ptr, double, ptr, ptr }

; Function Attrs: nounwind uwtable
declare dso_local void @vl_kmeans_reset(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local ptr @vl_kmeans_new(i32 noundef %0, i32 noundef %1) #0 {
  %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_calloc(i64 noundef 1, i64 noundef 128)
  store ptr %6, ptr %5, align 8, !tbaa !9
  %7 = load ptr, ptr %5, align 8, !tbaa !9
  %8 = getelementptr inbounds %struct._VlKMeans, ptr %7, i32 0, i32 6
  store i32 0, ptr %8, align 4, !tbaa !11
  %9 = load i32, ptr %4, align 4, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !9
  %11 = getelementptr inbounds %struct._VlKMeans, ptr %10, i32 0, i32 7
  store i32 %9, ptr %11, align 8, !tbaa !15
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct._VlKMeans, ptr %13, i32 0, i32 0
  store i32 %12, ptr %14, align 8, !tbaa !16
  %15 = load ptr, ptr %5, align 8, !tbaa !9
  %16 = getelementptr inbounds %struct._VlKMeans, ptr %15, i32 0, i32 11
  store i32 0, ptr %16, align 8, !tbaa !17
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds %struct._VlKMeans, ptr %17, i32 0, i32 8
  store i64 100, ptr %18, align 8, !tbaa !18
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = getelementptr inbounds %struct._VlKMeans, ptr %19, i32 0, i32 9
  store double 1.000000e-04, ptr %20, align 8, !tbaa !19
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  %22 = getelementptr inbounds %struct._VlKMeans, ptr %21, i32 0, i32 10
  store i64 1, ptr %22, align 8, !tbaa !20
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = getelementptr inbounds %struct._VlKMeans, ptr %23, i32 0, i32 12
  store ptr null, ptr %24, align 8, !tbaa !21
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = getelementptr inbounds %struct._VlKMeans, ptr %25, i32 0, i32 13
  store ptr null, ptr %26, align 8, !tbaa !22
  %27 = load ptr, ptr %5, align 8, !tbaa !9
  %28 = getelementptr inbounds %struct._VlKMeans, ptr %27, i32 0, i32 3
  store i64 3, ptr %28, align 8, !tbaa !23
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = getelementptr inbounds %struct._VlKMeans, ptr %29, i32 0, i32 4
  store i64 100, ptr %30, align 8, !tbaa !24
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  call void @vl_kmeans_reset(ptr noundef %31)
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret ptr %32
}

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

declare ptr @vl_calloc(i64 noundef, i64 noundef) #2

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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 44}
!12 = !{!"_VlKMeans", !6, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !6, i64 40, !6, i64 44, !6, i64 48, !13, i64 56, !14, i64 64, !13, i64 72, !6, i64 80, !10, i64 88, !10, i64 96, !14, i64 104, !10, i64 112, !10, i64 120}
!13 = !{!"long long", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!12, !6, i64 48}
!16 = !{!12, !6, i64 0}
!17 = !{!12, !6, i64 80}
!18 = !{!12, !13, i64 56}
!19 = !{!12, !14, i64 64}
!20 = !{!12, !13, i64 72}
!21 = !{!12, !10, i64 88}
!22 = !{!12, !10, i64 96}
!23 = !{!12, !13, i64 24}
!24 = !{!12, !13, i64 32}


; 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_kmeans_reset(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @vl_kmeans_new(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = tail call ptr @vl_calloc(i64 noundef 1, i64 noundef 128) #3
  %4 = getelementptr inbounds i8, ptr %3, i64 44
  store i32 0, ptr %4, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %3, i64 48
  store i32 %1, ptr %5, align 8, !tbaa !13
  store i32 %0, ptr %3, align 8, !tbaa !14
  %6 = getelementptr inbounds i8, ptr %3, i64 80
  store i32 0, ptr %6, align 8, !tbaa !15
  %7 = getelementptr inbounds i8, ptr %3, i64 56
  store i64 100, ptr %7, align 8, !tbaa !16
  %8 = getelementptr inbounds i8, ptr %3, i64 64
  store double 1.000000e-04, ptr %8, align 8, !tbaa !17
  %9 = getelementptr inbounds i8, ptr %3, i64 72
  store i64 1, ptr %9, align 8, !tbaa !18
  %10 = getelementptr inbounds i8, ptr %3, i64 88
  %11 = getelementptr inbounds i8, ptr %3, i64 24
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %10, i8 0, i64 16, i1 false)
  store i64 3, ptr %11, align 8, !tbaa !19
  %12 = getelementptr inbounds i8, ptr %3, i64 32
  store i64 100, ptr %12, align 8, !tbaa !20
  tail call void @vl_kmeans_reset(ptr noundef nonnull %3)
  ret ptr %3
}

declare ptr @vl_calloc(i64 noundef, i64 noundef) local_unnamed_addr #1

; 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 = { 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 = { "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 44}
!6 = !{!"_VlKMeans", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !7, i64 44, !7, i64 48, !10, i64 56, !11, i64 64, !10, i64 72, !7, i64 80, !12, i64 88, !12, i64 96, !11, 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 = !{!"long long", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !7, i64 48}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !7, i64 80}
!16 = !{!6, !10, i64 56}
!17 = !{!6, !11, i64 64}
!18 = !{!6, !10, i64 72}
!19 = !{!6, !10, i64 24}
!20 = !{!6, !10, i64 32}


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