; LLVM IR from QiaoLiuHit/LSOTB-TIR :: vlfeat-0.9.19/src (test_liop)

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

@__const.main.mat = external hidden unnamed_addr constant [121 x float], align 16

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca [121 x float], align 16
  %6 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i64 121, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 484, ptr %5) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %5, ptr align 16 @__const.main.mat, i64 484, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %7 = load i64, ptr %4, align 8, !tbaa !5
  %8 = mul i64 4, %7
  %9 = call ptr @vl_malloc(i64 noundef %8)
  store ptr %9, ptr %6, align 8, !tbaa !9
  store i32 0, ptr %2, align 4, !tbaa !11
  br label %10

10:                                               ; preds = %24, %0
  %11 = load i32, ptr %2, align 4, !tbaa !11
  %12 = load i64, ptr %4, align 8, !tbaa !5
  %13 = trunc i64 %12 to i32
  %14 = icmp slt i32 %11, %13
  br i1 %14, label %15, label %27

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !11
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [121 x float], ptr %5, i64 0, i64 %17
  %19 = load float, ptr %18, align 4, !tbaa !13
  %20 = load ptr, ptr %6, align 8, !tbaa !9
  %21 = load i32, ptr %2, align 4, !tbaa !11
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds float, ptr %20, i64 %22
  store float %19, ptr %23, align 4, !tbaa !13
  br label %24

24:                                               ; preds = %15
  %25 = load i32, ptr %2, align 4, !tbaa !11
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %2, align 4, !tbaa !11
  br label %10, !llvm.loop !15

27:                                               ; preds = %10
  %28 = call ptr @vl_liopdesc_new(i32 noundef 4, i32 noundef 6, float noundef 2.000000e+00, i64 noundef 11)
  store ptr %28, ptr %3, align 8, !tbaa !9
  %29 = load ptr, ptr %3, align 8, !tbaa !9
  call void @vl_liopdesc_delete(ptr noundef %29)
  %30 = load ptr, ptr %6, align 8, !tbaa !9
  call void @vl_free(ptr noundef %30)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 484, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %31 = load i32, ptr %1, align 4
  ret i32 %31
}

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

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

declare ptr @vl_malloc(i64 noundef) #3

declare ptr @vl_liopdesc_new(i32 noundef, i32 noundef, float noundef, i64 noundef) #3

declare void @vl_liopdesc_delete(ptr noundef) #3

declare void @vl_free(ptr 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long long", !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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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"

@__const.main.mat = external hidden unnamed_addr constant [121 x float], align 16

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
vector.memcheck:
  %0 = tail call ptr @vl_malloc(i64 noundef 484) #2
  %1 = ptrtoint ptr %0 to i64
  %2 = sub i64 %1, ptrtoint (ptr @__const.main.mat to i64)
  %diff.check = icmp ugt i64 %2, 31
  br i1 %diff.check, label %vector.body, label %scalar.ph.prol.preheader

vector.body:                                      ; preds = %vector.memcheck
  %wide.load = load <4 x float>, ptr @__const.main.mat, align 16, !tbaa !5
  %wide.load11 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 16), align 16, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  store <4 x float> %wide.load, ptr %0, align 4, !tbaa !5
  store <4 x float> %wide.load11, ptr %3, align 4, !tbaa !5
  %wide.load.1 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 32), align 16, !tbaa !5
  %wide.load11.1 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 48), align 16, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  store <4 x float> %wide.load.1, ptr %4, align 4, !tbaa !5
  store <4 x float> %wide.load11.1, ptr %5, align 4, !tbaa !5
  %wide.load.2 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 64), align 16, !tbaa !5
  %wide.load11.2 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 80), align 16, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 64
  %7 = getelementptr inbounds i8, ptr %0, i64 80
  store <4 x float> %wide.load.2, ptr %6, align 4, !tbaa !5
  store <4 x float> %wide.load11.2, ptr %7, align 4, !tbaa !5
  %wide.load.3 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 96), align 16, !tbaa !5
  %wide.load11.3 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 112), align 16, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 96
  %9 = getelementptr inbounds i8, ptr %0, i64 112
  store <4 x float> %wide.load.3, ptr %8, align 4, !tbaa !5
  store <4 x float> %wide.load11.3, ptr %9, align 4, !tbaa !5
  %wide.load.4 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 128), align 16, !tbaa !5
  %wide.load11.4 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 144), align 16, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 128
  %11 = getelementptr inbounds i8, ptr %0, i64 144
  store <4 x float> %wide.load.4, ptr %10, align 4, !tbaa !5
  store <4 x float> %wide.load11.4, ptr %11, align 4, !tbaa !5
  %wide.load.5 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 160), align 16, !tbaa !5
  %wide.load11.5 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 176), align 16, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 160
  %13 = getelementptr inbounds i8, ptr %0, i64 176
  store <4 x float> %wide.load.5, ptr %12, align 4, !tbaa !5
  store <4 x float> %wide.load11.5, ptr %13, align 4, !tbaa !5
  %wide.load.6 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 192), align 16, !tbaa !5
  %wide.load11.6 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 208), align 16, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 192
  %15 = getelementptr inbounds i8, ptr %0, i64 208
  store <4 x float> %wide.load.6, ptr %14, align 4, !tbaa !5
  store <4 x float> %wide.load11.6, ptr %15, align 4, !tbaa !5
  %wide.load.7 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 224), align 16, !tbaa !5
  %wide.load11.7 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 240), align 16, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %0, i64 224
  %17 = getelementptr inbounds i8, ptr %0, i64 240
  store <4 x float> %wide.load.7, ptr %16, align 4, !tbaa !5
  store <4 x float> %wide.load11.7, ptr %17, align 4, !tbaa !5
  %wide.load.8 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 256), align 16, !tbaa !5
  %wide.load11.8 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 272), align 16, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %0, i64 256
  %19 = getelementptr inbounds i8, ptr %0, i64 272
  store <4 x float> %wide.load.8, ptr %18, align 4, !tbaa !5
  store <4 x float> %wide.load11.8, ptr %19, align 4, !tbaa !5
  %wide.load.9 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 288), align 16, !tbaa !5
  %wide.load11.9 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 304), align 16, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 288
  %21 = getelementptr inbounds i8, ptr %0, i64 304
  store <4 x float> %wide.load.9, ptr %20, align 4, !tbaa !5
  store <4 x float> %wide.load11.9, ptr %21, align 4, !tbaa !5
  %wide.load.10 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 320), align 16, !tbaa !5
  %wide.load11.10 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 336), align 16, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %0, i64 320
  %23 = getelementptr inbounds i8, ptr %0, i64 336
  store <4 x float> %wide.load.10, ptr %22, align 4, !tbaa !5
  store <4 x float> %wide.load11.10, ptr %23, align 4, !tbaa !5
  %wide.load.11 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 352), align 16, !tbaa !5
  %wide.load11.11 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 368), align 16, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %0, i64 352
  %25 = getelementptr inbounds i8, ptr %0, i64 368
  store <4 x float> %wide.load.11, ptr %24, align 4, !tbaa !5
  store <4 x float> %wide.load11.11, ptr %25, align 4, !tbaa !5
  %wide.load.12 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 384), align 16, !tbaa !5
  %wide.load11.12 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 400), align 16, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %0, i64 384
  %27 = getelementptr inbounds i8, ptr %0, i64 400
  store <4 x float> %wide.load.12, ptr %26, align 4, !tbaa !5
  store <4 x float> %wide.load11.12, ptr %27, align 4, !tbaa !5
  %wide.load.13 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 416), align 16, !tbaa !5
  %wide.load11.13 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 432), align 16, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %0, i64 416
  %29 = getelementptr inbounds i8, ptr %0, i64 432
  store <4 x float> %wide.load.13, ptr %28, align 4, !tbaa !5
  store <4 x float> %wide.load11.13, ptr %29, align 4, !tbaa !5
  %wide.load.14 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 448), align 16, !tbaa !5
  %wide.load11.14 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @__const.main.mat, i64 464), align 16, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %0, i64 448
  %31 = getelementptr inbounds i8, ptr %0, i64 464
  store <4 x float> %wide.load.14, ptr %30, align 4, !tbaa !5
  store <4 x float> %wide.load11.14, ptr %31, align 4, !tbaa !5
  br label %scalar.ph.prol.preheader

scalar.ph.prol.preheader:                         ; preds = %vector.memcheck, %vector.body
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 120, %vector.body ]
  br label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.prol, %scalar.ph.prol.preheader
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %scalar.ph.prol ], [ %indvars.iv.ph, %scalar.ph.prol.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.prol.preheader ]
  %32 = getelementptr inbounds [121 x float], ptr @__const.main.mat, i64 0, i64 %indvars.iv.prol
  %33 = load float, ptr %32, align 4, !tbaa !5
  %34 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.prol
  store float %33, ptr %34, align 4, !tbaa !5
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter, 0
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !9

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol
  br i1 %diff.check, label %.loopexit, label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %scalar.ph ], [ %indvars.iv.next.prol, %scalar.ph.prol.loopexit ]
  %35 = getelementptr inbounds [121 x float], ptr @__const.main.mat, i64 0, i64 %indvars.iv
  %36 = load float, ptr %35, align 4, !tbaa !5
  %37 = getelementptr inbounds float, ptr %0, i64 %indvars.iv
  store float %36, ptr %37, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %38 = getelementptr inbounds [121 x float], ptr @__const.main.mat, i64 0, i64 %indvars.iv.next
  %39 = load float, ptr %38, align 4, !tbaa !5
  %40 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next
  store float %39, ptr %40, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %41 = getelementptr inbounds [121 x float], ptr @__const.main.mat, i64 0, i64 %indvars.iv.next.1
  %42 = load float, ptr %41, align 4, !tbaa !5
  %43 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next.1
  store float %42, ptr %43, align 4, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %44 = getelementptr inbounds [121 x float], ptr @__const.main.mat, i64 0, i64 %indvars.iv.next.2
  %45 = load float, ptr %44, align 4, !tbaa !5
  %46 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next.2
  store float %45, ptr %46, align 4, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 121
  br i1 %exitcond.not.3, label %.loopexit, label %scalar.ph, !llvm.loop !11

.loopexit:                                        ; preds = %scalar.ph, %scalar.ph.prol.loopexit
  %47 = tail call ptr @vl_liopdesc_new(i32 noundef 4, i32 noundef 6, float noundef 2.000000e+00, i64 noundef 11) #2
  tail call void @vl_liopdesc_delete(ptr noundef %47) #2
  tail call void @vl_free(ptr noundef nonnull %0) #2
  ret i32 0
}

declare ptr @vl_malloc(i64 noundef) local_unnamed_addr #1

declare ptr @vl_liopdesc_new(i32 noundef, i32 noundef, float noundef, i64 noundef) local_unnamed_addr #1

declare void @vl_liopdesc_delete(ptr noundef) local_unnamed_addr #1

declare void @vl_free(ptr noundef) local_unnamed_addr #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 = { "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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass