; LLVM IR from ronan-kerviche/glip-lib :: GLIP-Lib/src/Core/Exception.ll (ZN4Glip9Exception6appendERKS0_)

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

declare i32 @__gxx_personality_v0(...)

; 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 @_ZN4Glip9Exception21updateCompleteMessageEv(ptr noundef nonnull align 8 dereferenceable(152)) #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Glip9Exception6appendERKS0_(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef nonnull align 8 dereferenceable(152) %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.Glip::Exception", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 152, ptr %5) #3
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4Glip9ExceptionC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(152) %5, ptr noundef nonnull align 8 dereferenceable(152) %10)
  call void @_ZN4Glip9Exception17cleanSubExceptionEv(ptr noundef nonnull align 8 dereferenceable(152) %5)
  %11 = getelementptr inbounds %"class.Glip::Exception", ptr %9, i32 0, i32 8
  invoke void @_ZNSt6vectorIN4Glip9ExceptionESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(152) %5)
          to label %12 unwind label %26

12:                                               ; preds = %2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %"class.Glip::Exception", ptr %13, i32 0, i32 8
  %15 = call noundef zeroext i1 @_ZNKSt6vectorIN4Glip9ExceptionESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #3
  br i1 %15, label %51, label %16

16:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.Glip::Exception", ptr %17, i32 0, i32 8
  %19 = call noundef i64 @_ZNKSt6vectorIN4Glip9ExceptionESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #3
  %20 = sub i64 %19, 1
  %21 = trunc i64 %20 to i32
  store i32 %21, ptr %8, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %38, %16
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = icmp ugt i32 %23, 0
  br i1 %24, label %30, label %25

25:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %45

26:                                               ; preds = %51, %45, %2
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %6, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %7, align 4
  br label %53

30:                                               ; preds = %22
  %31 = getelementptr inbounds %"class.Glip::Exception", ptr %9, i32 0, i32 8
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.Glip::Exception", ptr %32, i32 0, i32 8
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = zext i32 %34 to i64
  %36 = call noundef nonnull align 8 dereferenceable(152) ptr @_ZNKSt6vectorIN4Glip9ExceptionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %35) #3
  invoke void @_ZNSt6vectorIN4Glip9ExceptionESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %31, ptr noundef nonnull align 8 dereferenceable(152) %36)
          to label %37 unwind label %41

37:                                               ; preds = %30
  br label %38

38:                                               ; preds = %37
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = add i32 %39, 1
  store i32 %40, ptr %8, align 4, !tbaa !9
  br label %22, !llvm.loop !11

41:                                               ; preds = %30
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %6, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %53

45:                                               ; preds = %25
  %46 = getelementptr inbounds %"class.Glip::Exception", ptr %9, i32 0, i32 8
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.Glip::Exception", ptr %47, i32 0, i32 8
  %49 = call noundef nonnull align 8 dereferenceable(152) ptr @_ZNKSt6vectorIN4Glip9ExceptionESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %48) #3
  invoke void @_ZNSt6vectorIN4Glip9ExceptionESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %46, ptr noundef nonnull align 8 dereferenceable(152) %49)
          to label %50 unwind label %26

50:                                               ; preds = %45
  br label %51

51:                                               ; preds = %50, %12
  invoke void @_ZN4Glip9Exception21updateCompleteMessageEv(ptr noundef nonnull align 8 dereferenceable(152) %9)
          to label %52 unwind label %26

52:                                               ; preds = %51
  call void @_ZN4Glip9ExceptionD1Ev(ptr noundef nonnull align 8 dereferenceable(152) %5) #3
  call void @llvm.lifetime.end.p0(i64 152, ptr %5) #3
  ret void

53:                                               ; preds = %41, %26
  call void @_ZN4Glip9ExceptionD1Ev(ptr noundef nonnull align 8 dereferenceable(152) %5) #3
  call void @llvm.lifetime.end.p0(i64 152, ptr %5) #3
  br label %54

54:                                               ; preds = %53
  %55 = load ptr, ptr %6, align 8
  %56 = load i32, ptr %7, align 4
  %57 = insertvalue { ptr, i32 } poison, ptr %55, 0
  %58 = insertvalue { ptr, i32 } %57, i32 %56, 1
  resume { ptr, i32 } %58
}

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

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

declare void @_ZN4Glip9ExceptionC1ERKS0_(ptr, ptr)

declare void @_ZN4Glip9ExceptionD1Ev(ptr)

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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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.Glip::Exception" = type { %"class.std::exception", i32, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, %"class.std::__cxx11::basic_string", i8, i8, %"class.std::vector" }
%"class.std::exception" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Glip::Exception, std::allocator<Glip::Exception>>::_Vector_impl" }
%"struct.std::_Vector_base<Glip::Exception, std::allocator<Glip::Exception>>::_Vector_impl" = type { %"struct.std::_Vector_base<Glip::Exception, std::allocator<Glip::Exception>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Glip::Exception, std::allocator<Glip::Exception>>::_Vector_impl_data" = type { ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
declare dso_local void @_ZN4Glip9Exception21updateCompleteMessageEv(ptr noundef nonnull align 8 dereferenceable(152)) local_unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Glip9Exception6appendERKS0_(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef nonnull align 8 dereferenceable(152) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.Glip::Exception", align 8
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %3) #3
  call void @_ZN4Glip9ExceptionC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(152) %3, ptr noundef nonnull align 8 dereferenceable(152) %1)
  call void @_ZN4Glip9Exception17cleanSubExceptionEv(ptr noundef nonnull align 8 dereferenceable(152) %3)
  %4 = getelementptr inbounds i8, ptr %0, i64 128
  invoke void @_ZNSt6vectorIN4Glip9ExceptionESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(152) %3)
          to label %5 unwind label %14

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 128
  %7 = call noundef zeroext i1 @_ZNKSt6vectorIN4Glip9ExceptionESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  br i1 %7, label %21, label %8

8:                                                ; preds = %5
  %9 = call noundef i64 @_ZNKSt6vectorIN4Glip9ExceptionESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  %10 = trunc i64 %9 to i32
  %11 = add i32 %10, -1
  %.not13 = icmp eq i32 %11, 0
  br i1 %.not13, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %8
  %12 = zext i32 %11 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %17, %8
  %13 = call noundef nonnull align 8 dereferenceable(152) ptr @_ZNKSt6vectorIN4Glip9ExceptionESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  invoke void @_ZNSt6vectorIN4Glip9ExceptionESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(152) %13)
          to label %21 unwind label %14

14:                                               ; preds = %21, %._crit_edge, %2
  %15 = landingpad { ptr, i32 }
          cleanup
  br label %23

.lr.ph:                                           ; preds = %.lr.ph.preheader, %17
  %indvars.iv = phi i64 [ %12, %.lr.ph.preheader ], [ %indvars.iv.next, %17 ]
  %16 = call noundef nonnull align 8 dereferenceable(152) ptr @_ZNKSt6vectorIN4Glip9ExceptionESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv) #3
  invoke void @_ZNSt6vectorIN4Glip9ExceptionESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(152) %16)
          to label %17 unwind label %19

17:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = and i64 %indvars.iv.next, 4294967295
  %.not = icmp eq i64 %18, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

19:                                               ; preds = %.lr.ph
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %23

21:                                               ; preds = %._crit_edge, %5
  invoke void @_ZN4Glip9Exception21updateCompleteMessageEv(ptr noundef nonnull align 8 dereferenceable(152) %0)
          to label %22 unwind label %14

22:                                               ; preds = %21
  call void @_ZN4Glip9ExceptionD1Ev(ptr noundef nonnull align 8 dereferenceable(152) %3) #3
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %3) #3
  ret void

23:                                               ; preds = %19, %14
  %.pn = phi { ptr, i32 } [ %15, %14 ], [ %20, %19 ]
  call void @_ZN4Glip9ExceptionD1Ev(ptr noundef nonnull align 8 dereferenceable(152) %3) #3
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %3) #3
  resume { ptr, i32 } %.pn
}

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

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

declare void @_ZN4Glip9ExceptionC1ERKS0_(ptr, ptr) local_unnamed_addr

declare void @_ZN4Glip9ExceptionD1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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