; LLVM IR from yangfengzzz/Arche-webgpu :: vox.geometry (fdm_linear_system2)

; 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.vox::Size2" = type { i64, i64 }
%class.anon.11 = type { ptr, ptr, ptr, ptr }

@_ZTISt16invalid_argument = external constant ptr
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3vox5Size2neERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt16invalid_argumentD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox8FdmBlas23mvmERKNS_5ArrayINS_13FdmMatrixRow2ELm2EEERKNS1_IdLm2EEEPS6_(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef %2) #5 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"struct.vox::Size2", align 8
  %8 = alloca %"struct.vox::Size2", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.vox::Size2", align 8
  %12 = alloca %class.anon.11, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call { i64, i64 } @_ZNK3vox5ArrayINS_13FdmMatrixRow2ELm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %13)
  %15 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 0
  %16 = extractvalue { i64, i64 } %14, 0
  store i64 %16, ptr %15, align 8
  %17 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 1
  %18 = extractvalue { i64, i64 } %14, 1
  store i64 %18, ptr %17, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = call { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
  %21 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %22 = extractvalue { i64, i64 } %20, 0
  store i64 %22, ptr %21, align 8
  %23 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %24 = extractvalue { i64, i64 } %20, 1
  store i64 %24, ptr %23, align 8
  %25 = call noundef zeroext i1 @_ZNK3vox5Size2neERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %8)
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  br i1 %25, label %26, label %33

26:                                               ; preds = %3
  %27 = call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef @.str.3)
          to label %28 unwind label %29

28:                                               ; preds = %26
  call void @__cxa_throw(ptr %27, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #7
  unreachable

29:                                               ; preds = %26
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %9, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %10, align 4
  call void @__cxa_free_exception(ptr %27) #6
  br label %56

33:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #6
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = call { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %34)
  %36 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 0
  %37 = extractvalue { i64, i64 } %35, 0
  store i64 %37, ptr %36, align 8
  %38 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 1
  %39 = extractvalue { i64, i64 } %35, 1
  store i64 %39, ptr %38, align 8
  %40 = call noundef zeroext i1 @_ZNK3vox5Size2neERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %11)
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #6
  br i1 %40, label %41, label %48

41:                                               ; preds = %33
  %42 = call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef @.str.2)
          to label %43 unwind label %44

43:                                               ; preds = %41
  call void @__cxa_throw(ptr %42, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #7
  unreachable

44:                                               ; preds = %41
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %9, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %10, align 4
  call void @__cxa_free_exception(ptr %42) #6
  br label %56

48:                                               ; preds = %33
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %class.anon.11, ptr %12, i32 0, i32 0
  store ptr %6, ptr %50, align 8, !tbaa !5
  %51 = getelementptr inbounds %class.anon.11, ptr %12, i32 0, i32 1
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %52, ptr %51, align 8, !tbaa !5
  %53 = getelementptr inbounds %class.anon.11, ptr %12, i32 0, i32 2
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %54, ptr %53, align 8, !tbaa !5
  %55 = getelementptr inbounds %class.anon.11, ptr %12, i32 0, i32 3
  store ptr %7, ptr %55, align 8, !tbaa !5
  call void @"_ZNK3vox5ArrayINS_13FdmMatrixRow2ELm2EE20parallelForEachIndexIZNS_8FdmBlas23mvmERKS2_RKNS0_IdLm2EEEPS7_E3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %49, ptr noundef byval(%class.anon.11) align 8 %12)
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  ret void

56:                                               ; preds = %44, %29
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %9, align 8
  %59 = load i32, ptr %10, align 4
  %60 = insertvalue { ptr, i32 } poison, ptr %58, 0
  %61 = insertvalue { ptr, i32 } %60, i32 %59, 1
  resume { ptr, i32 } %61
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i64 } @_ZNK3vox5ArrayINS_13FdmMatrixRow2ELm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNK3vox5ArrayINS_13FdmMatrixRow2ELm2EE20parallelForEachIndexIZNS_8FdmBlas23mvmERKS2_RKNS0_IdLm2EEEPS7_E3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef byval(%class.anon.11) align 8) #5 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { inlinehint mustprogress 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 "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 = { mustprogress 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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

%"struct.vox::Size2" = type { i64, i64 }
%class.anon.11 = type { ptr, ptr, ptr, ptr }

@_ZTISt16invalid_argument = external constant ptr
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3vox5Size2neERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt16invalid_argumentD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox8FdmBlas23mvmERKNS_5ArrayINS_13FdmMatrixRow2ELm2EEERKNS1_IdLm2EEEPS6_(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef %2) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.vox::Size2", align 8
  %6 = alloca %"struct.vox::Size2", align 8
  %7 = alloca %"struct.vox::Size2", align 8
  %8 = alloca %class.anon.11, align 8
  store ptr %2, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  %9 = tail call { i64, i64 } @_ZNK3vox5ArrayINS_13FdmMatrixRow2ELm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  %10 = extractvalue { i64, i64 } %9, 0
  store i64 %10, ptr %5, align 8
  %11 = getelementptr inbounds i8, ptr %5, i64 8
  %12 = extractvalue { i64, i64 } %9, 1
  store i64 %12, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  %13 = tail call { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  %14 = extractvalue { i64, i64 } %13, 0
  store i64 %14, ptr %6, align 8
  %15 = getelementptr inbounds i8, ptr %6, i64 8
  %16 = extractvalue { i64, i64 } %13, 1
  store i64 %16, ptr %15, align 8
  %17 = call noundef zeroext i1 @_ZNK3vox5Size2neERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  br i1 %17, label %18, label %23

18:                                               ; preds = %3
  %19 = call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull @.str.3)
          to label %20 unwind label %21

20:                                               ; preds = %18
  call void @__cxa_throw(ptr nonnull %19, ptr nonnull @_ZTISt16invalid_argument, ptr nonnull @_ZNSt16invalid_argumentD1Ev) #7
  unreachable

21:                                               ; preds = %18
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %38

23:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  %24 = call { i64, i64 } @_ZNK3vox5ArrayIdLm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %2)
  %25 = extractvalue { i64, i64 } %24, 0
  store i64 %25, ptr %7, align 8
  %26 = getelementptr inbounds i8, ptr %7, i64 8
  %27 = extractvalue { i64, i64 } %24, 1
  store i64 %27, ptr %26, align 8
  %28 = call noundef zeroext i1 @_ZNK3vox5Size2neERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  br i1 %28, label %29, label %34

29:                                               ; preds = %23
  %30 = call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull @.str.2)
          to label %31 unwind label %32

31:                                               ; preds = %29
  call void @__cxa_throw(ptr nonnull %30, ptr nonnull @_ZTISt16invalid_argument, ptr nonnull @_ZNSt16invalid_argumentD1Ev) #7
  unreachable

32:                                               ; preds = %29
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %38

34:                                               ; preds = %23
  store ptr %4, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %8, i64 8
  store ptr %0, ptr %35, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %8, i64 16
  store ptr %1, ptr %36, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %8, i64 24
  store ptr %5, ptr %37, align 8, !tbaa !5
  call void @"_ZNK3vox5ArrayINS_13FdmMatrixRow2ELm2EE20parallelForEachIndexIZNS_8FdmBlas23mvmERKS2_RKNS0_IdLm2EEEPS7_E3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull byval(%class.anon.11) align 8 %8)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  ret void

38:                                               ; preds = %32, %21
  %.sink = phi ptr [ %30, %32 ], [ %19, %21 ]
  %.pn = phi { ptr, i32 } [ %33, %32 ], [ %22, %21 ]
  call void @__cxa_free_exception(ptr %.sink) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i64 } @_ZNK3vox5ArrayINS_13FdmMatrixRow2ELm2EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNK3vox5ArrayINS_13FdmMatrixRow2ELm2EE20parallelForEachIndexIZNS_8FdmBlas23mvmERKS2_RKNS0_IdLm2EEEPS7_E3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef byval(%class.anon.11) align 8) local_unnamed_addr #5 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { inlinehint mustprogress 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 "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 = { mustprogress 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass