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

; 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.A = external hidden unnamed_addr constant [4 x double], align 16
@__const.main.b = external hidden unnamed_addr constant [2 x double], align 16
@.str = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca [4 x double], align 16
  %7 = alloca [2 x double], align 16
  %8 = alloca [2 x double], align 16
  %9 = alloca [2 x double], align 16
  %10 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %6, ptr align 16 @__const.main.A, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %7, ptr align 16 @__const.main.b, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %11 = getelementptr inbounds [2 x double], ptr %8, i64 0, i64 0
  %12 = getelementptr inbounds [4 x double], ptr %6, i64 0, i64 0
  %13 = getelementptr inbounds [2 x double], ptr %7, i64 0, i64 0
  %14 = call i32 @vl_solve_linear_system_2(ptr noundef %11, ptr noundef %12, ptr noundef %13)
  %15 = getelementptr inbounds [4 x double], ptr %6, i64 0, i64 0
  %16 = load double, ptr %15, align 16, !tbaa !11
  %17 = getelementptr inbounds [2 x double], ptr %8, i64 0, i64 0
  %18 = load double, ptr %17, align 16, !tbaa !11
  %19 = getelementptr inbounds [4 x double], ptr %6, i64 0, i64 2
  %20 = load double, ptr %19, align 16, !tbaa !11
  %21 = getelementptr inbounds [2 x double], ptr %8, i64 0, i64 1
  %22 = load double, ptr %21, align 8, !tbaa !11
  %23 = fmul double %20, %22
  %24 = call double @llvm.fmuladd.f64(double %16, double %18, double %23)
  %25 = getelementptr inbounds [2 x double], ptr %9, i64 0, i64 0
  store double %24, ptr %25, align 16, !tbaa !11
  %26 = getelementptr inbounds [4 x double], ptr %6, i64 0, i64 1
  %27 = load double, ptr %26, align 8, !tbaa !11
  %28 = getelementptr inbounds [2 x double], ptr %8, i64 0, i64 0
  %29 = load double, ptr %28, align 16, !tbaa !11
  %30 = getelementptr inbounds [4 x double], ptr %6, i64 0, i64 3
  %31 = load double, ptr %30, align 8, !tbaa !11
  %32 = getelementptr inbounds [2 x double], ptr %8, i64 0, i64 1
  %33 = load double, ptr %32, align 8, !tbaa !11
  %34 = fmul double %31, %33
  %35 = call double @llvm.fmuladd.f64(double %27, double %29, double %34)
  %36 = getelementptr inbounds [2 x double], ptr %9, i64 0, i64 1
  store double %35, ptr %36, align 8, !tbaa !11
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %55, %2
  %38 = load i32, ptr %10, align 4, !tbaa !5
  %39 = icmp slt i32 %38, 2
  br i1 %39, label %40, label %58

40:                                               ; preds = %37
  %41 = call ptr @vl_get_printf_func()
  %42 = load i32, ptr %10, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  %44 = load i32, ptr %10, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [2 x double], ptr %9, i64 0, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !11
  %48 = load i32, ptr %10, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  %50 = load i32, ptr %10, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [2 x double], ptr %7, i64 0, i64 %51
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = call i32 (ptr, ...) %41(ptr noundef @.str, i32 noundef %43, double noundef %47, i32 noundef %49, double noundef %53)
  br label %55

55:                                               ; preds = %40
  %56 = load i32, ptr %10, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %10, align 4, !tbaa !5
  br label %37, !llvm.loop !13

58:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #5
  ret i32 0
}

; 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 i32 @vl_solve_linear_system_2(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

declare ptr @vl_get_printf_func() #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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.A = external hidden unnamed_addr constant [4 x double], align 16
@__const.main.b = external hidden unnamed_addr constant [2 x double], align 16
@.str = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca [4 x double], align 16
  %4 = alloca [2 x double], align 16
  %5 = alloca [2 x double], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %3, ptr noundef nonnull align 16 dereferenceable(32) @__const.main.A, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %4, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.b, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  %6 = call i32 @vl_solve_linear_system_2(ptr noundef nonnull %5, ptr noundef nonnull %3, ptr noundef nonnull %4) #5
  %7 = load double, ptr %3, align 16, !tbaa !5
  %8 = load double, ptr %5, align 16, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %3, i64 16
  %10 = load double, ptr %9, align 16, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %5, i64 8
  %12 = load double, ptr %11, align 8, !tbaa !5
  %13 = fmul double %10, %12
  %14 = call double @llvm.fmuladd.f64(double %7, double %8, double %13)
  %15 = getelementptr inbounds i8, ptr %3, i64 8
  %16 = load double, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %3, i64 24
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = fmul double %12, %18
  %20 = call double @llvm.fmuladd.f64(double %16, double %8, double %19)
  %21 = call ptr @vl_get_printf_func() #5
  %22 = load double, ptr %4, align 16, !tbaa !5
  %23 = call i32 (ptr, ...) %21(ptr noundef nonnull @.str, i32 noundef 1, double noundef %14, i32 noundef 1, double noundef %22) #5
  %24 = call ptr @vl_get_printf_func() #5
  %25 = getelementptr inbounds i8, ptr %4, i64 8
  %26 = load double, ptr %25, align 8, !tbaa !5
  %27 = call i32 (ptr, ...) %24(ptr noundef nonnull @.str, i32 noundef 2, double noundef %20, i32 noundef 2, double noundef %26) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  ret i32 0
}

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

; Function Attrs: mustprogress 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 i32 @vl_solve_linear_system_2(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

declare ptr @vl_get_printf_func() local_unnamed_addr #3

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass