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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @vl_gmm_new(i32 noundef %0, i64 noundef %1, i64 noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = call i64 @vl_get_type_size(i32 noundef %10)
  store i64 %11, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %12 = call ptr @vl_calloc(i64 noundef 1, i64 noundef 128)
  store ptr %12, ptr %9, align 8, !tbaa !11
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = load ptr, ptr %9, align 8, !tbaa !11
  %15 = getelementptr inbounds %struct._VlGMM, ptr %14, i32 0, i32 0
  store i32 %13, ptr %15, align 8, !tbaa !13
  %16 = load i64, ptr %6, align 8, !tbaa !9
  %17 = load ptr, ptr %9, align 8, !tbaa !11
  %18 = getelementptr inbounds %struct._VlGMM, ptr %17, i32 0, i32 2
  store i64 %16, ptr %18, align 8, !tbaa !16
  %19 = load ptr, ptr %9, align 8, !tbaa !11
  %20 = getelementptr inbounds %struct._VlGMM, ptr %19, i32 0, i32 3
  store i64 0, ptr %20, align 8, !tbaa !17
  %21 = load i64, ptr %5, align 8, !tbaa !9
  %22 = load ptr, ptr %9, align 8, !tbaa !11
  %23 = getelementptr inbounds %struct._VlGMM, ptr %22, i32 0, i32 1
  store i64 %21, ptr %23, align 8, !tbaa !18
  %24 = load ptr, ptr %9, align 8, !tbaa !11
  %25 = getelementptr inbounds %struct._VlGMM, ptr %24, i32 0, i32 12
  store i32 1, ptr %25, align 8, !tbaa !19
  %26 = load ptr, ptr %9, align 8, !tbaa !11
  %27 = getelementptr inbounds %struct._VlGMM, ptr %26, i32 0, i32 6
  store i32 0, ptr %27, align 8, !tbaa !20
  %28 = load ptr, ptr %9, align 8, !tbaa !11
  %29 = getelementptr inbounds %struct._VlGMM, ptr %28, i32 0, i32 4
  store i64 50, ptr %29, align 8, !tbaa !21
  %30 = load ptr, ptr %9, align 8, !tbaa !11
  %31 = getelementptr inbounds %struct._VlGMM, ptr %30, i32 0, i32 5
  store i64 1, ptr %31, align 8, !tbaa !22
  %32 = load ptr, ptr %9, align 8, !tbaa !11
  %33 = getelementptr inbounds %struct._VlGMM, ptr %32, i32 0, i32 11
  store ptr null, ptr %33, align 8, !tbaa !23
  %34 = load ptr, ptr %9, align 8, !tbaa !11
  %35 = getelementptr inbounds %struct._VlGMM, ptr %34, i32 0, i32 9
  store ptr null, ptr %35, align 8, !tbaa !24
  %36 = load ptr, ptr %9, align 8, !tbaa !11
  %37 = getelementptr inbounds %struct._VlGMM, ptr %36, i32 0, i32 8
  store ptr null, ptr %37, align 8, !tbaa !25
  %38 = load ptr, ptr %9, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct._VlGMM, ptr %38, i32 0, i32 7
  store ptr null, ptr %39, align 8, !tbaa !26
  %40 = load ptr, ptr %9, align 8, !tbaa !11
  %41 = getelementptr inbounds %struct._VlGMM, ptr %40, i32 0, i32 10
  store ptr null, ptr %41, align 8, !tbaa !27
  %42 = load ptr, ptr %9, align 8, !tbaa !11
  %43 = getelementptr inbounds %struct._VlGMM, ptr %42, i32 0, i32 13
  store ptr null, ptr %43, align 8, !tbaa !28
  %44 = load ptr, ptr %9, align 8, !tbaa !11
  %45 = getelementptr inbounds %struct._VlGMM, ptr %44, i32 0, i32 15
  store i32 0, ptr %45, align 8, !tbaa !29
  %46 = load i64, ptr %6, align 8, !tbaa !9
  %47 = load i64, ptr %8, align 8, !tbaa !9
  %48 = call ptr @vl_calloc(i64 noundef %46, i64 noundef %47)
  %49 = load ptr, ptr %9, align 8, !tbaa !11
  %50 = getelementptr inbounds %struct._VlGMM, ptr %49, i32 0, i32 9
  store ptr %48, ptr %50, align 8, !tbaa !24
  %51 = load i64, ptr %6, align 8, !tbaa !9
  %52 = load i64, ptr %5, align 8, !tbaa !9
  %53 = mul i64 %51, %52
  %54 = load i64, ptr %8, align 8, !tbaa !9
  %55 = call ptr @vl_calloc(i64 noundef %53, i64 noundef %54)
  %56 = load ptr, ptr %9, align 8, !tbaa !11
  %57 = getelementptr inbounds %struct._VlGMM, ptr %56, i32 0, i32 7
  store ptr %55, ptr %57, align 8, !tbaa !26
  %58 = load i64, ptr %6, align 8, !tbaa !9
  %59 = load i64, ptr %5, align 8, !tbaa !9
  %60 = mul i64 %58, %59
  %61 = load i64, ptr %8, align 8, !tbaa !9
  %62 = call ptr @vl_calloc(i64 noundef %60, i64 noundef %61)
  %63 = load ptr, ptr %9, align 8, !tbaa !11
  %64 = getelementptr inbounds %struct._VlGMM, ptr %63, i32 0, i32 8
  store ptr %62, ptr %64, align 8, !tbaa !25
  %65 = load i64, ptr %5, align 8, !tbaa !9
  %66 = call ptr @vl_calloc(i64 noundef %65, i64 noundef 8)
  %67 = load ptr, ptr %9, align 8, !tbaa !11
  %68 = getelementptr inbounds %struct._VlGMM, ptr %67, i32 0, i32 11
  store ptr %66, ptr %68, align 8, !tbaa !23
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %69

69:                                               ; preds = %83, %3
  %70 = load i64, ptr %7, align 8, !tbaa !9
  %71 = load ptr, ptr %9, align 8, !tbaa !11
  %72 = getelementptr inbounds %struct._VlGMM, ptr %71, i32 0, i32 1
  %73 = load i64, ptr %72, align 8, !tbaa !18
  %74 = trunc i64 %73 to i32
  %75 = zext i32 %74 to i64
  %76 = icmp slt i64 %70, %75
  br i1 %76, label %77, label %86

77:                                               ; preds = %69
  %78 = load ptr, ptr %9, align 8, !tbaa !11
  %79 = getelementptr inbounds %struct._VlGMM, ptr %78, i32 0, i32 11
  %80 = load ptr, ptr %79, align 8, !tbaa !23
  %81 = load i64, ptr %7, align 8, !tbaa !9
  %82 = getelementptr inbounds double, ptr %80, i64 %81
  store double 1.000000e-04, ptr %82, align 8, !tbaa !30
  br label %83

83:                                               ; preds = %77
  %84 = load i64, ptr %7, align 8, !tbaa !9
  %85 = add nsw i64 %84, 1
  store i64 %85, ptr %7, align 8, !tbaa !9
  br label %69, !llvm.loop !31

86:                                               ; preds = %69
  %87 = load ptr, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret ptr %87
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @vl_get_type_size(i32 noundef) #2

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

; 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 = { inlinehint 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 = { "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 #4 = { 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 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_VlGMM", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !6, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !6, i64 96, !12, i64 104, !15, i64 112, !6, i64 120}
!15 = !{!"double", !7, i64 0}
!16 = !{!14, !10, i64 16}
!17 = !{!14, !10, i64 24}
!18 = !{!14, !10, i64 8}
!19 = !{!14, !6, i64 96}
!20 = !{!14, !6, i64 48}
!21 = !{!14, !10, i64 32}
!22 = !{!14, !10, i64 40}
!23 = !{!14, !12, i64 88}
!24 = !{!14, !12, i64 72}
!25 = !{!14, !12, i64 64}
!26 = !{!14, !12, i64 56}
!27 = !{!14, !12, i64 80}
!28 = !{!14, !12, i64 104}
!29 = !{!14, !6, i64 120}
!30 = !{!15, !15, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"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
define dso_local noundef ptr @vl_gmm_new(i32 noundef %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #0 {
  %4 = tail call i64 @vl_get_type_size(i32 noundef %0)
  %5 = tail call ptr @vl_calloc(i64 noundef 1, i64 noundef 128) #4
  store i32 %0, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 16
  store i64 %2, ptr %6, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %5, i64 24
  store i64 0, ptr %7, align 8, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %5, i64 8
  store i64 %1, ptr %8, align 8, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %5, i64 96
  store i32 1, ptr %9, align 8, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %5, i64 48
  store i32 0, ptr %10, align 8, !tbaa !17
  %11 = getelementptr inbounds i8, ptr %5, i64 32
  store i64 50, ptr %11, align 8, !tbaa !18
  %12 = getelementptr inbounds i8, ptr %5, i64 40
  store i64 1, ptr %12, align 8, !tbaa !19
  %13 = getelementptr inbounds i8, ptr %5, i64 88
  %14 = getelementptr inbounds i8, ptr %5, i64 72
  %15 = getelementptr inbounds i8, ptr %5, i64 64
  %16 = getelementptr inbounds i8, ptr %5, i64 56
  %17 = getelementptr inbounds i8, ptr %5, i64 104
  store ptr null, ptr %17, align 8, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %5, i64 120
  store i32 0, ptr %18, align 8, !tbaa !21
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %16, i8 0, i64 40, i1 false)
  %19 = tail call ptr @vl_calloc(i64 noundef %2, i64 noundef %4) #4
  store ptr %19, ptr %14, align 8, !tbaa !22
  %20 = mul i64 %2, %1
  %21 = tail call ptr @vl_calloc(i64 noundef %20, i64 noundef %4) #4
  store ptr %21, ptr %16, align 8, !tbaa !23
  %22 = tail call ptr @vl_calloc(i64 noundef %20, i64 noundef %4) #4
  store ptr %22, ptr %15, align 8, !tbaa !24
  %23 = tail call ptr @vl_calloc(i64 noundef %1, i64 noundef 8) #4
  store ptr %23, ptr %13, align 8, !tbaa !25
  %24 = load i64, ptr %8, align 8, !tbaa !15
  %25 = and i64 %24, 4294967295
  %.not = icmp eq i64 %25, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %3
  %min.iters.check = icmp ult i64 %25, 4
  br i1 %min.iters.check, label %.lr.ph.preheader38, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.mod.vf = and i64 %24, 3
  %n.vec = sub nsw i64 %25, %n.mod.vf
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %26 = getelementptr inbounds double, ptr %23, i64 %index
  %27 = getelementptr inbounds i8, ptr %26, i64 16
  store <2 x double> <double 1.000000e-04, double 1.000000e-04>, ptr %26, align 8, !tbaa !26
  store <2 x double> <double 1.000000e-04, double 1.000000e-04>, ptr %27, align 8, !tbaa !26
  %index.next = add nuw i64 %index, 4
  %28 = icmp eq i64 %index.next, %n.vec
  br i1 %28, label %middle.block, label %vector.body, !llvm.loop !27

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.mod.vf, 0
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader38

.lr.ph.preheader38:                               ; preds = %middle.block, %.lr.ph.preheader
  %.037.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader38, %.lr.ph
  %.037 = phi i64 [ %30, %.lr.ph ], [ %.037.ph, %.lr.ph.preheader38 ]
  %29 = getelementptr inbounds double, ptr %23, i64 %.037
  store double 1.000000e-04, ptr %29, align 8, !tbaa !26
  %30 = add nuw nsw i64 %.037, 1
  %exitcond.not = icmp eq i64 %30, %25
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !31

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %3
  ret ptr %5
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @vl_get_type_size(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { inlinehint 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 = !{!"_VlGMM", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !7, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !7, i64 96, !11, i64 104, !12, i64 112, !7, 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 = !{!"any pointer", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!6, !10, i64 16}
!14 = !{!6, !10, i64 24}
!15 = !{!6, !10, i64 8}
!16 = !{!6, !7, i64 96}
!17 = !{!6, !7, i64 48}
!18 = !{!6, !10, i64 32}
!19 = !{!6, !10, i64 40}
!20 = !{!6, !11, i64 104}
!21 = !{!6, !7, i64 120}
!22 = !{!6, !11, i64 72}
!23 = !{!6, !11, i64 56}
!24 = !{!6, !11, i64 64}
!25 = !{!6, !11, i64 88}
!26 = !{!12, !12, i64 0}
!27 = distinct !{!27, !28, !29, !30}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!"llvm.loop.isvectorized", i32 1}
!30 = !{!"llvm.loop.unroll.runtime.disable"}
!31 = distinct !{!31, !28, !30, !29}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass