; LLVM IR from tfhe/spqlios-arithmetic :: test/testlib/fft64_layouts.ll (ZNK21fft64_vmp_pmat_layout8get_zextEmm)

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

%class.reim_fft64vec = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.reim4_elem = type { [8 x double] }
%class.fft64_vmp_pmat_layout = type { i64, i64, i64, ptr }

; 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

declare i32 @__gxx_personality_v0(...)

declare void @_ZN13reim_fft64vecC1EmPKd(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef) unnamed_addr #1

declare void @_ZN13reim_fft64vec4zeroEm(ptr dead_on_unwind writable sret(%class.reim_fft64vec) align 8, i64 noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN13reim_fft64vecD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK21fft64_vmp_pmat_layout3getEmmm(ptr dead_on_unwind noalias writable sret(%class.reim4_elem) align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef, i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK21fft64_vmp_pmat_layout8get_zextEmm(ptr dead_on_unwind noalias writable sret(%class.reim_fft64vec) align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %2, i64 noundef %3) #3 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i1, align 1
  %11 = alloca i64, align 8
  %12 = alloca %class.reim4_elem, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store i64 %3, ptr %8, align 8, !tbaa !9
  %15 = load ptr, ptr %6, align 8
  %16 = load i64, ptr %7, align 8, !tbaa !9
  %17 = getelementptr inbounds %class.fft64_vmp_pmat_layout, ptr %15, i32 0, i32 1
  %18 = load i64, ptr %17, align 8, !tbaa !11
  %19 = icmp uge i64 %16, %18
  br i1 %19, label %25, label %20

20:                                               ; preds = %4
  %21 = load i64, ptr %8, align 8, !tbaa !9
  %22 = getelementptr inbounds %class.fft64_vmp_pmat_layout, ptr %15, i32 0, i32 2
  %23 = load i64, ptr %22, align 8, !tbaa !13
  %24 = icmp uge i64 %21, %23
  br i1 %24, label %25, label %28

25:                                               ; preds = %20, %4
  %26 = getelementptr inbounds %class.fft64_vmp_pmat_layout, ptr %15, i32 0, i32 0
  %27 = load i64, ptr %26, align 8, !tbaa !14
  call void @_ZN13reim_fft64vec4zeroEm(ptr dead_on_unwind writable sret(%class.reim_fft64vec) align 8 %0, i64 noundef %27)
  br label %76

28:                                               ; preds = %20
  %29 = getelementptr inbounds %class.fft64_vmp_pmat_layout, ptr %15, i32 0, i32 0
  %30 = load i64, ptr %29, align 8, !tbaa !14
  %31 = icmp ult i64 %30, 8
  br i1 %31, label %32, label %48

32:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %33 = getelementptr inbounds %class.fft64_vmp_pmat_layout, ptr %15, i32 0, i32 3
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  %35 = load i64, ptr %7, align 8, !tbaa !9
  %36 = load i64, ptr %8, align 8, !tbaa !9
  %37 = getelementptr inbounds %class.fft64_vmp_pmat_layout, ptr %15, i32 0, i32 1
  %38 = load i64, ptr %37, align 8, !tbaa !11
  %39 = mul i64 %36, %38
  %40 = add i64 %35, %39
  %41 = getelementptr inbounds %class.fft64_vmp_pmat_layout, ptr %15, i32 0, i32 0
  %42 = load i64, ptr %41, align 8, !tbaa !14
  %43 = mul i64 %40, %42
  %44 = getelementptr inbounds double, ptr %34, i64 %43
  store ptr %44, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %class.fft64_vmp_pmat_layout, ptr %15, i32 0, i32 0
  %46 = load i64, ptr %45, align 8, !tbaa !14
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN13reim_fft64vecC1EmPKd(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %46, ptr noundef %47)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %76

48:                                               ; preds = %28
  store i1 false, ptr %10, align 1
  %49 = getelementptr inbounds %class.fft64_vmp_pmat_layout, ptr %15, i32 0, i32 0
  %50 = load i64, ptr %49, align 8, !tbaa !14
  call void @_ZN13reim_fft64vecC1Em(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %50)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %51

51:                                               ; preds = %65, %48
  %52 = load i64, ptr %11, align 8, !tbaa !9
  %53 = getelementptr inbounds %class.fft64_vmp_pmat_layout, ptr %15, i32 0, i32 0
  %54 = load i64, ptr %53, align 8, !tbaa !14
  %55 = udiv i64 %54, 8
  %56 = icmp ult i64 %52, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %72

58:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 64, ptr %12) #4
  %59 = load i64, ptr %7, align 8, !tbaa !9
  %60 = load i64, ptr %8, align 8, !tbaa !9
  %61 = load i64, ptr %11, align 8, !tbaa !9
  invoke void @_ZNK21fft64_vmp_pmat_layout3getEmmm(ptr dead_on_unwind writable sret(%class.reim4_elem) align 8 %12, ptr noundef nonnull align 8 dereferenceable(32) %15, i64 noundef %59, i64 noundef %60, i64 noundef %61)
          to label %62 unwind label %68

62:                                               ; preds = %58
  %63 = load i64, ptr %11, align 8, !tbaa !9
  invoke void @_ZN13reim_fft64vec7set_blkEmRK10reim4_elem(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %63, ptr noundef nonnull align 8 dereferenceable(64) %12)
          to label %64 unwind label %68

64:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 64, ptr %12) #4
  br label %65

65:                                               ; preds = %64
  %66 = load i64, ptr %11, align 8, !tbaa !9
  %67 = add i64 %66, 1
  store i64 %67, ptr %11, align 8, !tbaa !9
  br label %51, !llvm.loop !16

68:                                               ; preds = %62, %58
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %13, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 64, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @_ZN13reim_fft64vecD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %77

72:                                               ; preds = %57
  store i1 true, ptr %10, align 1
  %73 = load i1, ptr %10, align 1
  br i1 %73, label %75, label %74

74:                                               ; preds = %72
  call void @_ZN13reim_fft64vecD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %75

75:                                               ; preds = %74, %72
  br label %76

76:                                               ; preds = %75, %32, %25
  ret void

77:                                               ; preds = %68
  %78 = load ptr, ptr %13, align 8
  %79 = load i32, ptr %14, align 4
  %80 = insertvalue { ptr, i32 } poison, ptr %78, 0
  %81 = insertvalue { ptr, i32 } %80, i32 %79, 1
  resume { ptr, i32 } %81
}

declare void @_ZN13reim_fft64vecC1Em(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) unnamed_addr #1

declare void @_ZN13reim_fft64vec7set_blkEmRK10reim4_elem(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(64)) #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 = { inlinehint 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 = { 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 #4 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTS21fft64_vmp_pmat_layout", !10, i64 0, !10, i64 8, !10, i64 16, !6, i64 24}
!13 = !{!12, !10, i64 16}
!14 = !{!12, !10, i64 0}
!15 = !{!12, !6, i64 24}
!16 = distinct !{!16, !17}
!17 = !{!"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"

%class.reim_fft64vec = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.reim4_elem = type { [8 x double] }

; 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

declare i32 @__gxx_personality_v0(...)

declare void @_ZN13reim_fft64vecC1EmPKd(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef) unnamed_addr #1

declare void @_ZN13reim_fft64vec4zeroEm(ptr dead_on_unwind writable sret(%class.reim_fft64vec) align 8, i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN13reim_fft64vecD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK21fft64_vmp_pmat_layout3getEmmm(ptr dead_on_unwind noalias writable sret(%class.reim4_elem) align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK21fft64_vmp_pmat_layout8get_zextEmm(ptr dead_on_unwind noalias writable sret(%class.reim_fft64vec) align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %2, i64 noundef %3) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %class.reim4_elem, align 8
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %.not = icmp ugt i64 %7, %2
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = load i64, ptr %8, align 8
  %.not18 = icmp ugt i64 %9, %3
  %or.cond = select i1 %.not, i1 %.not18, i1 false
  %10 = load i64, ptr %1, align 8, !tbaa !11
  br i1 %or.cond, label %12, label %11

11:                                               ; preds = %4
  tail call void @_ZN13reim_fft64vec4zeroEm(ptr dead_on_unwind writable sret(%class.reim_fft64vec) align 8 %0, i64 noundef %10)
  br label %.loopexit

12:                                               ; preds = %4
  %13 = icmp ult i64 %10, 8
  br i1 %13, label %14, label %21

14:                                               ; preds = %12
  %15 = getelementptr inbounds i8, ptr %1, i64 24
  %16 = load ptr, ptr %15, align 8, !tbaa !12
  %17 = mul i64 %7, %3
  %18 = add i64 %17, %2
  %19 = mul i64 %10, %18
  %20 = getelementptr inbounds double, ptr %16, i64 %19
  tail call void @_ZN13reim_fft64vecC1EmPKd(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %10, ptr noundef %20)
  br label %.loopexit

21:                                               ; preds = %12
  tail call void @_ZN13reim_fft64vecC1Em(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %10)
  %22 = load i64, ptr %1, align 8, !tbaa !11
  %.not21 = icmp ult i64 %22, 8
  br i1 %.not21, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %21, %24
  %.020 = phi i64 [ %25, %24 ], [ 0, %21 ]
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #4
  invoke void @_ZNK21fft64_vmp_pmat_layout3getEmmm(ptr dead_on_unwind nonnull writable sret(%class.reim4_elem) align 8 %5, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %2, i64 noundef %3, i64 noundef %.020)
          to label %23 unwind label %29

23:                                               ; preds = %.lr.ph
  invoke void @_ZN13reim_fft64vec7set_blkEmRK10reim4_elem(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.020, ptr noundef nonnull align 8 dereferenceable(64) %5)
          to label %24 unwind label %29

24:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #4
  %25 = add nuw nsw i64 %.020, 1
  %26 = load i64, ptr %1, align 8, !tbaa !11
  %27 = lshr i64 %26, 3
  %28 = icmp ult i64 %25, %27
  br i1 %28, label %.lr.ph, label %.loopexit, !llvm.loop !13

29:                                               ; preds = %23, %.lr.ph
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #4
  call void @_ZN13reim_fft64vecD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  resume { ptr, i32 } %30

.loopexit:                                        ; preds = %24, %21, %14, %11
  ret void
}

declare void @_ZN13reim_fft64vecC1Em(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) unnamed_addr #1

declare void @_ZN13reim_fft64vec7set_blkEmRK10reim4_elem(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { inlinehint 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 = { 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 #4 = { 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, !7, i64 8}
!6 = !{!"_ZTS21fft64_vmp_pmat_layout", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !10, i64 24}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass