; LLVM IR from quantumlib/Stim :: src/stim/gates/gates.ll (ZNK4stim4Gate7unitaryEv)

; 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.7 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.7 = type { i64, [8 x i8] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<std::complex<float>>, std::allocator<std::vector<std::complex<float>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<std::complex<float>>, std::allocator<std::vector<std::complex<float>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<std::complex<float>>, std::allocator<std::vector<std::complex<float>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<std::complex<float>>, std::allocator<std::vector<std::complex<float>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"struct.stim::Gate" = type { %"class.std::basic_string_view", i8, i8, i8, i16, %"class.std::basic_string_view", %"class.std::basic_string_view", %"class.stim::FixedCapVector", %"class.stim::FixedCapVector.4", ptr }
%"class.std::basic_string_view" = type { i64, ptr }
%"class.stim::FixedCapVector" = type { %"struct.std::array.1", i64 }
%"struct.std::array.1" = type { [4 x %"class.stim::FixedCapVector.2"] }
%"class.stim::FixedCapVector.2" = type { %"struct.std::array.3", i64 }
%"struct.std::array.3" = type { [4 x %"class.std::complex"] }
%"class.std::complex" = type { { float, float } }
%"class.stim::FixedCapVector.4" = type { %"struct.std::array.5", i64 }
%"struct.std::array.5" = type { [10 x ptr] }

@_ZTISt12out_of_range = external constant ptr
@.str.10 = external hidden unnamed_addr constant [37 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

declare ptr @__cxa_allocate_exception(i64)

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr)

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

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(168)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ISt17basic_string_viewIcS2_EvEERKT_RKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

declare void @_ZNSt12out_of_rangeC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(168), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNK4stim14FixedCapVectorISt7complexIfELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4stim4Gate7unitaryEv(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(320) %1) #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator", align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i1, align 1
  %11 = alloca i1, align 1
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8
  %17 = getelementptr inbounds %"struct.stim::Gate", ptr %16, i32 0, i32 7
  %18 = call noundef i64 @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(168) %17)
  %19 = icmp ne i64 %18, 2
  br i1 %19, label %20, label %47

20:                                               ; preds = %2
  %21 = getelementptr inbounds %"struct.stim::Gate", ptr %16, i32 0, i32 7
  %22 = call noundef i64 @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(168) %21)
  %23 = icmp ne i64 %22, 4
  br i1 %23, label %24, label %47

24:                                               ; preds = %20
  store i1 true, ptr %10, align 1
  %25 = call ptr @__cxa_allocate_exception(i64 16) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #6
  %26 = getelementptr inbounds %"struct.stim::Gate", ptr %16, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ISt17basic_string_viewIcS2_EvEERKT_RKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %27 unwind label %30

27:                                               ; preds = %24
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %5, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef @.str.10)
          to label %28 unwind label %34

28:                                               ; preds = %27
  invoke void @_ZNSt12out_of_rangeC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %29 unwind label %38

29:                                               ; preds = %28
  store i1 false, ptr %10, align 1
  invoke void @__cxa_throw(ptr %25, ptr @_ZTISt12out_of_range, ptr @_ZNSt12out_of_rangeD1Ev) #7
          to label %106 unwind label %38

30:                                               ; preds = %24
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %8, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %9, align 4
  br label %43

34:                                               ; preds = %27
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %8, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %9, align 4
  br label %42

38:                                               ; preds = %29, %28
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %8, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %9, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  br label %42

42:                                               ; preds = %38, %34
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  br label %43

43:                                               ; preds = %42, %30
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #6
  %44 = load i1, ptr %10, align 1
  br i1 %44, label %45, label %46

45:                                               ; preds = %43
  call void @__cxa_free_exception(ptr %25) #6
  br label %46

46:                                               ; preds = %45, %43
  br label %101

47:                                               ; preds = %20, %2
  store i1 false, ptr %11, align 1
  call void @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 0, ptr %12, align 8, !tbaa !9
  br label %48

48:                                               ; preds = %92, %47
  %49 = load i64, ptr %12, align 8, !tbaa !9
  %50 = getelementptr inbounds %"struct.stim::Gate", ptr %16, i32 0, i32 7
  %51 = invoke noundef i64 @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(168) %50)
          to label %52 unwind label %55

52:                                               ; preds = %48
  %53 = icmp ult i64 %49, %51
  br i1 %53, label %59, label %54

54:                                               ; preds = %52
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %97

55:                                               ; preds = %48
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %8, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %9, align 4
  br label %96

59:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %60 = getelementptr inbounds %"struct.stim::Gate", ptr %16, i32 0, i32 7
  %61 = load i64, ptr %12, align 8, !tbaa !9
  %62 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(168) %60, i64 noundef %61)
          to label %63 unwind label %73

63:                                               ; preds = %59
  store ptr %62, ptr %14, align 8, !tbaa !5
  %64 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EE12emplace_backIJEEERS3_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0)
          to label %65 unwind label %73

65:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %66

66:                                               ; preds = %88, %65
  %67 = load i64, ptr %15, align 8, !tbaa !9
  %68 = load ptr, ptr %14, align 8, !tbaa !5
  %69 = invoke noundef i64 @_ZNK4stim14FixedCapVectorISt7complexIfELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %68)
          to label %70 unwind label %77

70:                                               ; preds = %66
  %71 = icmp ult i64 %67, %69
  br i1 %71, label %81, label %72

72:                                               ; preds = %70
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %91

73:                                               ; preds = %63, %59
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %8, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %9, align 4
  br label %95

77:                                               ; preds = %86, %81, %66
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %8, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %95

81:                                               ; preds = %70
  %82 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = load i64, ptr %15, align 8, !tbaa !9
  %85 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNK4stim14FixedCapVectorISt7complexIfELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %83, i64 noundef %84)
          to label %86 unwind label %77

86:                                               ; preds = %81
  invoke void @_ZNSt6vectorISt7complexIfESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %82, ptr noundef nonnull align 4 dereferenceable(8) %85)
          to label %87 unwind label %77

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  %89 = load i64, ptr %15, align 8, !tbaa !9
  %90 = add i64 %89, 1
  store i64 %90, ptr %15, align 8, !tbaa !9
  br label %66, !llvm.loop !11

91:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %92

92:                                               ; preds = %91
  %93 = load i64, ptr %12, align 8, !tbaa !9
  %94 = add i64 %93, 1
  store i64 %94, ptr %12, align 8, !tbaa !9
  br label %48, !llvm.loop !13

95:                                               ; preds = %77, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %96

96:                                               ; preds = %95, %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br label %101

97:                                               ; preds = %54
  store i1 true, ptr %11, align 1
  store i32 1, ptr %13, align 4
  %98 = load i1, ptr %11, align 1
  br i1 %98, label %100, label %99

99:                                               ; preds = %97
  call void @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br label %100

100:                                              ; preds = %99, %97
  ret void

101:                                              ; preds = %96, %46
  %102 = load ptr, ptr %8, align 8
  %103 = load i32, ptr %9, align 4
  %104 = insertvalue { ptr, i32 } poison, ptr %102, 0
  %105 = insertvalue { ptr, i32 } %104, i32 %103, 1
  resume { ptr, i32 } %105

106:                                              ; preds = %29
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EE12emplace_backIJEEERS3_DpOT_(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4stim14FixedCapVectorISt7complexIfELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt7complexIfESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { 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 #5 = { "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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.7 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.7 = type { i64, [8 x i8] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<std::complex<float>>, std::allocator<std::vector<std::complex<float>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<std::complex<float>>, std::allocator<std::vector<std::complex<float>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<std::complex<float>>, std::allocator<std::vector<std::complex<float>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<std::complex<float>>, std::allocator<std::vector<std::complex<float>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }

@_ZTISt12out_of_range = external constant ptr
@.str.10 = external hidden unnamed_addr constant [37 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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr) local_unnamed_addr

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(168)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ISt17basic_string_viewIcS2_EvEERKT_RKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

declare void @_ZNSt12out_of_rangeC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4stim4Gate7unitaryEv(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(320) %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator", align 1
  %6 = getelementptr inbounds i8, ptr %1, i64 56
  %7 = tail call noundef i64 @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(168) %6)
  %.not = icmp eq i64 %7, 2
  br i1 %.not, label %22, label %8

8:                                                ; preds = %2
  %9 = tail call noundef i64 @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(168) %6)
  %.not21 = icmp eq i64 %9, 4
  br i1 %.not21, label %22, label %10

10:                                               ; preds = %8
  %11 = tail call ptr @__cxa_allocate_exception(i64 16) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ISt17basic_string_viewIcS2_EvEERKT_RKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %12 unwind label %.thread

12:                                               ; preds = %10
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %3, ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull @.str.10)
          to label %13 unwind label %16

13:                                               ; preds = %12
  invoke void @_ZNSt12out_of_rangeC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %14 unwind label %18

14:                                               ; preds = %13
  invoke void @__cxa_throw(ptr nonnull %11, ptr nonnull @_ZTISt12out_of_range, ptr nonnull @_ZNSt12out_of_rangeD1Ev) #7
          to label %42 unwind label %18

.thread:                                          ; preds = %10
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  br label %21

16:                                               ; preds = %12
  %17 = landingpad { ptr, i32 }
          cleanup
  br label %20

18:                                               ; preds = %14, %13
  %.014 = phi i1 [ false, %14 ], [ true, %13 ]
  %19 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  br label %20

20:                                               ; preds = %16, %18
  %.pn23 = phi { ptr, i32 } [ %19, %18 ], [ %17, %16 ]
  %.115 = phi i1 [ %.014, %18 ], [ true, %16 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  br i1 %.115, label %21, label %41

21:                                               ; preds = %.thread, %20
  %.pn23.pn29 = phi { ptr, i32 } [ %15, %.thread ], [ %.pn23, %20 ]
  call void @__cxa_free_exception(ptr %11) #6
  br label %41

22:                                               ; preds = %8, %2
  tail call void @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %23 = tail call noundef i64 @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(168) %6)
  %.not35 = icmp eq i64 %23, 0
  br i1 %.not35, label %._crit_edge34, label %.lr.ph33

.lr.ph33:                                         ; preds = %22, %._crit_edge
  %.01331 = phi i64 [ %27, %._crit_edge ], [ 0, %22 ]
  %24 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(168) %6, i64 noundef %.01331)
  %25 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EE12emplace_backIJEEERS3_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0)
          to label %.preheader unwind label %30

.preheader:                                       ; preds = %.lr.ph33
  %26 = tail call noundef i64 @_ZNK4stim14FixedCapVectorISt7complexIfELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %24)
  %.not36 = icmp eq i64 %26, 0
  br i1 %.not36, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %36, %.preheader
  %27 = add nuw i64 %.01331, 1
  %28 = tail call noundef i64 @_ZNK4stim14FixedCapVectorINS0_ISt7complexIfELm4EEELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(168) %6)
  %29 = icmp ult i64 %27, %28
  br i1 %29, label %.lr.ph33, label %._crit_edge34, !llvm.loop !5

30:                                               ; preds = %.lr.ph33
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %40

32:                                               ; preds = %.lr.ph
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %40

.lr.ph:                                           ; preds = %.preheader, %36
  %.030 = phi i64 [ %37, %36 ], [ 0, %.preheader ]
  %34 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %35 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK4stim14FixedCapVectorISt7complexIfELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %24, i64 noundef %.030)
  invoke void @_ZNSt6vectorISt7complexIfESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 4 dereferenceable(8) %35)
          to label %36 unwind label %32

36:                                               ; preds = %.lr.ph
  %37 = add nuw i64 %.030, 1
  %38 = tail call noundef i64 @_ZNK4stim14FixedCapVectorISt7complexIfELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %24)
  %39 = icmp ult i64 %37, %38
  br i1 %39, label %.lr.ph, label %._crit_edge, !llvm.loop !7

40:                                               ; preds = %32, %30
  %.pn = phi { ptr, i32 } [ %33, %32 ], [ %31, %30 ]
  tail call void @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br label %41

._crit_edge34:                                    ; preds = %._crit_edge, %22
  ret void

41:                                               ; preds = %20, %21, %40
  %.pn23.pn.pn = phi { ptr, i32 } [ %.pn23.pn29, %21 ], [ %.pn23, %20 ], [ %.pn, %40 ]
  resume { ptr, i32 } %.pn23.pn.pn

42:                                               ; preds = %14
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EE12emplace_backIJEEERS3_DpOT_(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4stim14FixedCapVectorISt7complexIfELm4EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ISt7complexIfESaIS1_EESaIS3_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt7complexIfESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { 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 #5 = { "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


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