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

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

@.str.8 = external hidden unnamed_addr constant [69 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_impl15ae_swap_vectorsEPNS_9ae_vectorES1_(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 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
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %8, i32 0, i32 2
  %10 = load i8, ptr %9, align 8, !tbaa !9, !range !14, !noundef !15
  %11 = trunc i8 %10 to i1
  %12 = xor i1 %11, true
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %12, ptr noundef @.str.8, ptr noundef null)
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %13, i32 0, i32 2
  %15 = load i8, ptr %14, align 8, !tbaa !9, !range !14, !noundef !15
  %16 = trunc i8 %15 to i1
  %17 = xor i1 %16, true
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %17, ptr noundef @.str.8, ptr noundef null)
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %18, i32 0, i32 3
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %20, i32 0, i32 3
  call void @_ZN11alglib_impl10ae_db_swapEPNS_12ae_dyn_blockES1_(ptr noundef %19, ptr noundef %21)
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %22, i32 0, i32 0
  %24 = load i64, ptr %23, align 8, !tbaa !16
  store i64 %24, ptr %5, align 8, !tbaa !17
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %25, i32 0, i32 1
  %27 = load i64, ptr %26, align 8, !tbaa !18
  store i64 %27, ptr %6, align 8, !tbaa !17
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %28, i32 0, i32 4
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  store ptr %30, ptr %7, align 8, !tbaa !5
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %31, i32 0, i32 0
  %33 = load i64, ptr %32, align 8, !tbaa !16
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %34, i32 0, i32 0
  store i64 %33, ptr %35, align 8, !tbaa !16
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %36, i32 0, i32 1
  %38 = load i64, ptr %37, align 8, !tbaa !18
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %39, i32 0, i32 1
  store i64 %38, ptr %40, align 8, !tbaa !18
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %41, i32 0, i32 4
  %43 = load ptr, ptr %42, align 8, !tbaa !19
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %44, i32 0, i32 4
  store ptr %43, ptr %45, align 8, !tbaa !19
  %46 = load i64, ptr %5, align 8, !tbaa !17
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %47, i32 0, i32 0
  store i64 %46, ptr %48, align 8, !tbaa !16
  %49 = load i64, ptr %6, align 8, !tbaa !17
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %50, i32 0, i32 1
  store i64 %49, ptr %51, align 8, !tbaa !18
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %53, i32 0, i32 4
  store ptr %52, ptr %54, align 8, !tbaa !19
  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 16}
!10 = !{!"_ZTSN11alglib_impl9ae_vectorE", !11, i64 0, !11, i64 8, !12, i64 16, !13, i64 24, !7, i64 56}
!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 = !{!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.8 = external hidden unnamed_addr constant [69 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_impl15ae_swap_vectorsEPNS_9ae_vectorES1_(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %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.8, ptr noundef null)
  %7 = getelementptr inbounds i8, ptr %1, i64 16
  %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.8, ptr noundef null)
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = getelementptr inbounds i8, ptr %1, i64 24
  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 56
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %15 = load <2 x i64>, ptr %1, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %1, i64 56
  %17 = load <2 x i64>, ptr %0, align 8, !tbaa !16
  store <2 x i64> %15, ptr %0, align 8, !tbaa !16
  %18 = load ptr, ptr %16, align 8, !tbaa !15
  store ptr %18, ptr %13, align 8, !tbaa !15
  store <2 x i64> %17, ptr %1, align 8, !tbaa !16
  store ptr %14, ptr %16, 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 16}
!6 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 24, !8, i64 56}
!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