; LLVM IR from EntityFX/anybench :: src/benchmarks/generic/scimark2 (kernel)

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

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

declare ptr @new_Stopwatch() #1

declare void @Stopwatch_start(ptr noundef) #1

declare void @Stopwatch_stop(ptr noundef) #1

declare double @Stopwatch_read(ptr noundef) #1

declare void @Stopwatch_delete(ptr noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

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

declare ptr @RandomMatrix(i32 noundef, i32 noundef, ptr noundef) #1

declare void @Array2D_double_delete(i32 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local double @kernel_measureLU(i32 noundef %0, double noundef %1, ptr noundef %2) #4 {
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store ptr null, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store ptr null, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store ptr null, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %14 = call ptr @new_Stopwatch()
  store ptr %14, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store double 0.000000e+00, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 1, ptr %13, align 4, !tbaa !5
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = load ptr, ptr %6, align 8, !tbaa !11
  %18 = call ptr @RandomMatrix(i32 noundef %15, i32 noundef %16, ptr noundef %17)
  store ptr %18, ptr %7, align 8, !tbaa !11
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %3
  call void @exit(i32 noundef 1) #7
  unreachable

21:                                               ; preds = %3
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = call ptr @new_Array2D_double(i32 noundef %22, i32 noundef %23)
  store ptr %24, ptr %8, align 8, !tbaa !11
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %21
  call void @exit(i32 noundef 1) #7
  unreachable

27:                                               ; preds = %21
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = mul i64 %29, 4
  %31 = call noalias ptr @malloc(i64 noundef %30) #8
  store ptr %31, ptr %9, align 8, !tbaa !11
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %34

33:                                               ; preds = %27
  call void @exit(i32 noundef 1) #7
  unreachable

34:                                               ; preds = %27
  br label %35

35:                                               ; preds = %62, %34
  br label %36

36:                                               ; preds = %35
  %37 = load ptr, ptr %10, align 8, !tbaa !11
  call void @Stopwatch_start(ptr noundef %37)
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %52, %36
  %39 = load i32, ptr %12, align 4, !tbaa !5
  %40 = load i32, ptr %13, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %42, label %55

42:                                               ; preds = %38
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = load ptr, ptr %8, align 8, !tbaa !11
  %46 = load ptr, ptr %7, align 8, !tbaa !11
  call void @Array2D_double_copy(i32 noundef %43, i32 noundef %44, ptr noundef %45, ptr noundef %46)
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = load ptr, ptr %8, align 8, !tbaa !11
  %50 = load ptr, ptr %9, align 8, !tbaa !11
  %51 = call i32 @LU_factor(i32 noundef %47, i32 noundef %48, ptr noundef %49, ptr noundef %50)
  br label %52

52:                                               ; preds = %42
  %53 = load i32, ptr %12, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %12, align 4, !tbaa !5
  br label %38, !llvm.loop !13

55:                                               ; preds = %38
  %56 = load ptr, ptr %10, align 8, !tbaa !11
  call void @Stopwatch_stop(ptr noundef %56)
  %57 = load ptr, ptr %10, align 8, !tbaa !11
  %58 = call double @Stopwatch_read(ptr noundef %57)
  %59 = load double, ptr %5, align 8, !tbaa !9
  %60 = fcmp oge double %58, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %55
  br label %65

62:                                               ; preds = %55
  %63 = load i32, ptr %13, align 4, !tbaa !5
  %64 = mul nsw i32 %63, 2
  store i32 %64, ptr %13, align 4, !tbaa !5
  br label %35

65:                                               ; preds = %61
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = call double @LU_num_flops(i32 noundef %66)
  %68 = load i32, ptr %13, align 4, !tbaa !5
  %69 = sitofp i32 %68 to double
  %70 = fmul double %67, %69
  %71 = load ptr, ptr %10, align 8, !tbaa !11
  %72 = call double @Stopwatch_read(ptr noundef %71)
  %73 = fdiv double %70, %72
  %74 = fmul double %73, 0x3EB0C6F7A0B5ED8D
  store double %74, ptr %11, align 8, !tbaa !9
  %75 = load ptr, ptr %10, align 8, !tbaa !11
  call void @Stopwatch_delete(ptr noundef %75)
  %76 = load ptr, ptr %9, align 8, !tbaa !11
  call void @free(ptr noundef %76) #6
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = load ptr, ptr %8, align 8, !tbaa !11
  call void @Array2D_double_delete(i32 noundef %77, i32 noundef %78, ptr noundef %79)
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = load ptr, ptr %7, align 8, !tbaa !11
  call void @Array2D_double_delete(i32 noundef %80, i32 noundef %81, ptr noundef %82)
  %83 = load double, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  ret double %83
}

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

declare ptr @new_Array2D_double(i32 noundef, i32 noundef) #1

declare void @Array2D_double_copy(i32 noundef, i32 noundef, ptr noundef, ptr noundef) #1

declare i32 @LU_factor(i32 noundef, i32 noundef, ptr noundef, ptr noundef) #1

declare double @LU_num_flops(i32 noundef) #1

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 "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 allocsize(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 #4 = { 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 #5 = { noreturn nounwind "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 #6 = { nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind allocsize(0) }

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !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"

declare ptr @new_Stopwatch() local_unnamed_addr #0

declare void @Stopwatch_start(ptr noundef) local_unnamed_addr #0

declare void @Stopwatch_stop(ptr noundef) local_unnamed_addr #0

declare double @Stopwatch_read(ptr noundef) local_unnamed_addr #0

declare void @Stopwatch_delete(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

declare ptr @RandomMatrix(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare void @Array2D_double_delete(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local double @kernel_measureLU(i32 noundef %0, double noundef %1, ptr noundef %2) local_unnamed_addr #3 {
  %4 = tail call ptr @new_Stopwatch() #6
  %5 = tail call ptr @RandomMatrix(i32 noundef %0, i32 noundef %0, ptr noundef %2) #6
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %8

7:                                                ; preds = %3
  tail call void @exit(i32 noundef 1) #7
  unreachable

8:                                                ; preds = %3
  %9 = tail call ptr @new_Array2D_double(i32 noundef %0, i32 noundef %0) #6
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %8
  tail call void @exit(i32 noundef 1) #7
  unreachable

12:                                               ; preds = %8
  %13 = sext i32 %0 to i64
  %14 = shl nsw i64 %13, 2
  %15 = tail call noalias ptr @malloc(i64 noundef %14) #8
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %.preheader

17:                                               ; preds = %12
  tail call void @exit(i32 noundef 1) #7
  unreachable

.preheader:                                       ; preds = %12, %21
  %.0 = phi i32 [ %24, %21 ], [ 1, %12 ]
  tail call void @Stopwatch_start(ptr noundef %4) #6
  %umax = tail call i32 @llvm.umax.i32(i32 %.0, i32 1)
  br label %18

18:                                               ; preds = %.preheader, %18
  %.03336 = phi i32 [ 0, %.preheader ], [ %20, %18 ]
  tail call void @Array2D_double_copy(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %9, ptr noundef nonnull %5) #6
  %19 = tail call i32 @LU_factor(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %9, ptr noundef nonnull %15) #6
  %20 = add nuw i32 %.03336, 1
  %exitcond.not = icmp eq i32 %20, %umax
  br i1 %exitcond.not, label %21, label %18, !llvm.loop !5

21:                                               ; preds = %18
  tail call void @Stopwatch_stop(ptr noundef %4) #6
  %22 = tail call double @Stopwatch_read(ptr noundef %4) #6
  %23 = fcmp ult double %22, %1
  %24 = shl nsw i32 %.0, 1
  br i1 %23, label %.preheader, label %25

25:                                               ; preds = %21
  %26 = tail call double @LU_num_flops(i32 noundef %0) #6
  %27 = sitofp i32 %.0 to double
  %28 = fmul double %26, %27
  %29 = tail call double @Stopwatch_read(ptr noundef %4) #6
  %30 = fdiv double %28, %29
  %31 = fmul double %30, 0x3EB0C6F7A0B5ED8D
  tail call void @Stopwatch_delete(ptr noundef %4) #6
  tail call void @free(ptr noundef %15) #6
  tail call void @Array2D_double_delete(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %9) #6
  tail call void @Array2D_double_delete(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %5) #6
  ret double %31
}

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4

declare ptr @new_Array2D_double(i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @Array2D_double_copy(i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @LU_factor(i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare double @LU_num_flops(i32 noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #5

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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 #4 = { noreturn nounwind "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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind allocsize(0) }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass