; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src/ap.ll (ZN11alglib_impl16ae_swap_matricesEPNS_9ae_matrixES1_)

; 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.alglib_impl::ae_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon = type { ptr }

@.str.14 = external hidden unnamed_addr constant [70 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 uwtable
declare dso_local void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11alglib_impl10ae_db_swapEPNS_12ae_dyn_blockES1_(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl16ae_swap_matricesEPNS_9ae_matrixES1_(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %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 ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %10, i32 0, i32 4
  %12 = load i8, ptr %11, align 8, !tbaa !9, !range !14, !noundef !15
  %13 = trunc i8 %12 to i1
  %14 = xor i1 %13, true
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %14, ptr noundef @.str.14, ptr noundef null)
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %15, i32 0, i32 4
  %17 = load i8, ptr %16, align 8, !tbaa !9, !range !14, !noundef !15
  %18 = trunc i8 %17 to i1
  %19 = xor i1 %18, true
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %19, ptr noundef @.str.14, ptr noundef null)
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %20, i32 0, i32 5
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %22, i32 0, i32 5
  call void @_ZN11alglib_impl10ae_db_swapEPNS_12ae_dyn_blockES1_(ptr noundef %21, ptr noundef %23)
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %24, i32 0, i32 0
  %26 = load i64, ptr %25, align 8, !tbaa !16
  store i64 %26, ptr %5, align 8, !tbaa !17
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %27, i32 0, i32 1
  %29 = load i64, ptr %28, align 8, !tbaa !18
  store i64 %29, ptr %6, align 8, !tbaa !17
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %30, i32 0, i32 2
  %32 = load i64, ptr %31, align 8, !tbaa !19
  store i64 %32, ptr %7, align 8, !tbaa !17
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %33, i32 0, i32 3
  %35 = load i64, ptr %34, align 8, !tbaa !20
  store i64 %35, ptr %8, align 8, !tbaa !17
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %36, i32 0, i32 6
  %38 = load ptr, ptr %37, align 8, !tbaa !21
  store ptr %38, ptr %9, align 8, !tbaa !5
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %39, i32 0, i32 0
  %41 = load i64, ptr %40, align 8, !tbaa !16
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %42, i32 0, i32 0
  store i64 %41, ptr %43, align 8, !tbaa !16
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %44, i32 0, i32 1
  %46 = load i64, ptr %45, align 8, !tbaa !18
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %47, i32 0, i32 1
  store i64 %46, ptr %48, align 8, !tbaa !18
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %49, i32 0, i32 2
  %51 = load i64, ptr %50, align 8, !tbaa !19
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %52, i32 0, i32 2
  store i64 %51, ptr %53, align 8, !tbaa !19
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %54, i32 0, i32 3
  %56 = load i64, ptr %55, align 8, !tbaa !20
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %57, i32 0, i32 3
  store i64 %56, ptr %58, align 8, !tbaa !20
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %59, i32 0, i32 6
  %61 = load ptr, ptr %60, align 8, !tbaa !21
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %62, i32 0, i32 6
  store ptr %61, ptr %63, align 8, !tbaa !21
  %64 = load i64, ptr %5, align 8, !tbaa !17
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %65, i32 0, i32 0
  store i64 %64, ptr %66, align 8, !tbaa !16
  %67 = load i64, ptr %6, align 8, !tbaa !17
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %68, i32 0, i32 1
  store i64 %67, ptr %69, align 8, !tbaa !18
  %70 = load i64, ptr %7, align 8, !tbaa !17
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %71, i32 0, i32 2
  store i64 %70, ptr %72, align 8, !tbaa !19
  %73 = load i64, ptr %8, align 8, !tbaa !17
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %74, i32 0, i32 3
  store i64 %73, ptr %75, align 8, !tbaa !20
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %77, i32 0, i32 6
  store ptr %76, ptr %78, align 8, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 32}
!10 = !{!"_ZTSN11alglib_impl9ae_matrixE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !13, i64 40, !7, i64 72}
!11 = !{!"long", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!10, !11, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!10, !11, i64 8}
!19 = !{!10, !11, i64 16}
!20 = !{!10, !11, i64 24}
!21 = !{!7, !7, i64 0}


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

@.str.14 = external hidden unnamed_addr constant [70 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11alglib_impl10ae_db_swapEPNS_12ae_dyn_blockES1_(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl16ae_swap_matricesEPNS_9ae_matrixES1_(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = load i8, ptr %3, align 8, !tbaa !5, !range !13, !noundef !14
  %5 = trunc nuw i8 %4 to i1
  %6 = xor i1 %5, true
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %6, ptr noundef nonnull @.str.14, ptr noundef null)
  %7 = getelementptr inbounds i8, ptr %1, i64 32
  %8 = load i8, ptr %7, align 8, !tbaa !5, !range !13, !noundef !14
  %9 = trunc nuw i8 %8 to i1
  %10 = xor i1 %9, true
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %10, ptr noundef nonnull @.str.14, ptr noundef null)
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = getelementptr inbounds i8, ptr %1, i64 40
  tail call void @_ZN11alglib_impl10ae_db_swapEPNS_12ae_dyn_blockES1_(ptr noundef nonnull %11, ptr noundef nonnull %12)
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = getelementptr inbounds i8, ptr %0, i64 72
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = load <2 x i64>, ptr %1, align 8, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %1, i64 16
  %18 = getelementptr inbounds i8, ptr %1, i64 72
  %19 = load <2 x i64>, ptr %0, align 8, !tbaa !16
  store <2 x i64> %16, ptr %0, align 8, !tbaa !16
  %20 = load <2 x i64>, ptr %17, align 8, !tbaa !16
  %21 = load <2 x i64>, ptr %13, align 8, !tbaa !16
  store <2 x i64> %20, ptr %13, align 8, !tbaa !16
  %22 = load ptr, ptr %18, align 8, !tbaa !15
  store ptr %22, ptr %14, align 8, !tbaa !15
  store <2 x i64> %19, ptr %1, align 8, !tbaa !16
  store <2 x i64> %21, ptr %17, align 8, !tbaa !16
  store ptr %15, ptr %18, align 8, !tbaa !15
  ret void
}

attributes #0 = { 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 #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" }

!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, !10, i64 32}
!6 = !{!"_ZTSN11alglib_impl9ae_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 40, !8, i64 72}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!8, !8, i64 0}
!16 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass