; LLVM IR from stan-dev/math :: lib/boost_1.84.0/libs/serialization/src (xml_archive_exception)

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

@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [113 x i8], align 1
@__PRETTY_FUNCTION__._ZN5boost7archive21xml_archive_exceptionC2ENS1_14exception_codeEPKcS4_ = external hidden unnamed_addr constant [105 x i8], align 1
@_ZTVN5boost7archive21xml_archive_exceptionE = external dso_local unnamed_addr constant { [9 x ptr], [8 x ptr] }, align 8
@_ZTTN5boost7archive21xml_archive_exceptionE = external dso_local unnamed_addr constant [5 x ptr], align 8

declare noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140), i32 noundef, ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5boost7archive21xml_archive_exceptionC1ENS1_14exception_codeEPKcS4_(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8
  call void @_ZNSt9exceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %13 = getelementptr inbounds i8, ptr %12, i64 8
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN5boost7archive17archive_exceptionC2ENS1_14exception_codeEPKcS4_(ptr noundef nonnull align 8 dereferenceable(140) %13, ptr noundef getelementptr inbounds ([5 x ptr], ptr @_ZTTN5boost7archive21xml_archive_exceptionE, i64 0, i64 3), i32 noundef 1, ptr noundef %14, ptr noundef %15) #6
  store ptr getelementptr inbounds inrange(-48, 24) ({ [9 x ptr], [8 x ptr] }, ptr @_ZTVN5boost7archive21xml_archive_exceptionE, i32 0, i32 0, i32 6), ptr %12, align 8, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %12, i64 8
  store ptr getelementptr inbounds inrange(-40, 24) ({ [9 x ptr], [8 x ptr] }, ptr @_ZTVN5boost7archive21xml_archive_exceptionE, i32 0, i32 1, i32 5), ptr %16, align 8, !tbaa !11
  store ptr getelementptr inbounds inrange(-48, 24) ({ [9 x ptr], [8 x ptr] }, ptr @_ZTVN5boost7archive21xml_archive_exceptionE, i32 0, i32 0, i32 6), ptr %12, align 8, !tbaa !11
  %17 = load i32, ptr %6, align 4, !tbaa !9
  switch i32 %17, label %66 [
    i32 0, label %18
    i32 1, label %29
    i32 2, label %59
  ]

18:                                               ; preds = %4
  %19 = load ptr, ptr %12, align 8, !tbaa !11
  %20 = getelementptr i8, ptr %19, i64 -40
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr %12, i64 %21
  %23 = invoke noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140) %22, i32 noundef 0, ptr noundef @.str)
          to label %24 unwind label %25

24:                                               ; preds = %18
  br label %67

25:                                               ; preds = %59, %18
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %9, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %10, align 4
  br label %68

29:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %30 = load ptr, ptr %12, align 8, !tbaa !11
  %31 = getelementptr i8, ptr %30, i64 -40
  %32 = load i64, ptr %31, align 8
  %33 = getelementptr inbounds i8, ptr %12, i64 %32
  %34 = invoke noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140) %33, i32 noundef 0, ptr noundef @.str.1)
          to label %35 unwind label %54

35:                                               ; preds = %29
  store i32 %34, ptr %11, align 4, !tbaa !13
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = icmp ne ptr null, %36
  br i1 %37, label %38, label %58

38:                                               ; preds = %35
  %39 = load ptr, ptr %12, align 8, !tbaa !11
  %40 = getelementptr i8, ptr %39, i64 -40
  %41 = load i64, ptr %40, align 8
  %42 = getelementptr inbounds i8, ptr %12, i64 %41
  %43 = load i32, ptr %11, align 4, !tbaa !13
  %44 = invoke noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140) %42, i32 noundef %43, ptr noundef @.str.2)
          to label %45 unwind label %54

45:                                               ; preds = %38
  store i32 %44, ptr %11, align 4, !tbaa !13
  %46 = load ptr, ptr %12, align 8, !tbaa !11
  %47 = getelementptr i8, ptr %46, i64 -40
  %48 = load i64, ptr %47, align 8
  %49 = getelementptr inbounds i8, ptr %12, i64 %48
  %50 = load i32, ptr %11, align 4, !tbaa !13
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = invoke noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140) %49, i32 noundef %50, ptr noundef %51)
          to label %53 unwind label %54

53:                                               ; preds = %45
  br label %58

54:                                               ; preds = %45, %38, %29
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %9, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %68

58:                                               ; preds = %53, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %67

59:                                               ; preds = %4
  %60 = load ptr, ptr %12, align 8, !tbaa !11
  %61 = getelementptr i8, ptr %60, i64 -40
  %62 = load i64, ptr %61, align 8
  %63 = getelementptr inbounds i8, ptr %12, i64 %62
  %64 = invoke noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140) %63, i32 noundef 0, ptr noundef @.str.3)
          to label %65 unwind label %25

65:                                               ; preds = %59
  br label %67

66:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.5, i32 noundef 53, ptr noundef @__PRETTY_FUNCTION__._ZN5boost7archive21xml_archive_exceptionC2ENS1_14exception_codeEPKcS4_) #7
  unreachable

67:                                               ; preds = %65, %58, %24
  ret void

68:                                               ; preds = %54, %25
  %69 = getelementptr inbounds i8, ptr %12, i64 8
  call void @_ZN5boost7archive17archive_exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(140) %69, ptr noundef getelementptr inbounds ([5 x ptr], ptr @_ZTTN5boost7archive21xml_archive_exceptionE, i64 0, i64 3)) #6
  call void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  br label %70

70:                                               ; preds = %68
  %71 = load ptr, ptr %9, align 8
  %72 = load i32, ptr %10, align 4
  %73 = insertvalue { ptr, i32 } poison, ptr %71, 0
  %74 = insertvalue { ptr, i32 } %73, i32 %72, 1
  resume { ptr, i32 } %74
}

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

; Function Attrs: nounwind
declare void @_ZN5boost7archive17archive_exceptionC2ENS1_14exception_codeEPKcS4_(ptr noundef nonnull align 8 dereferenceable(140), ptr noundef, i32 noundef, ptr noundef, ptr noundef) unnamed_addr #5

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN5boost7archive17archive_exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(140), ptr noundef) unnamed_addr #5

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5

attributes #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noreturn 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 #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 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn 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 = !{!"_ZTSN5boost7archive21xml_archive_exception14exception_codeE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !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 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [113 x i8], align 1
@__PRETTY_FUNCTION__._ZN5boost7archive21xml_archive_exceptionC2ENS1_14exception_codeEPKcS4_ = external hidden unnamed_addr constant [105 x i8], align 1
@_ZTVN5boost7archive21xml_archive_exceptionE = external dso_local unnamed_addr constant { [9 x ptr], [8 x ptr] }, align 8
@_ZTTN5boost7archive21xml_archive_exceptionE = external dso_local unnamed_addr constant [5 x ptr], align 8

declare noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140), i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5boost7archive21xml_archive_exceptionC1ENS1_14exception_codeEPKcS4_(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZNSt9exceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZN5boost7archive17archive_exceptionC2ENS1_14exception_codeEPKcS4_(ptr noundef nonnull align 8 dereferenceable(140) %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZTTN5boost7archive21xml_archive_exceptionE, i64 24), i32 noundef 1, ptr noundef %2, ptr noundef %3) #5
  store ptr getelementptr inbounds inrange(-40, 24) (i8, ptr @_ZTVN5boost7archive21xml_archive_exceptionE, i64 112), ptr %5, align 8, !tbaa !5
  store ptr getelementptr inbounds inrange(-48, 24) (i8, ptr @_ZTVN5boost7archive21xml_archive_exceptionE, i64 48), ptr %0, align 8, !tbaa !5
  switch i32 %1, label %32 [
    i32 0, label %.invoke
    i32 1, label %8
    i32 2, label %27
  ]

6:                                                ; preds = %.invoke
  %7 = landingpad { ptr, i32 }
          cleanup
  br label %34

8:                                                ; preds = %4
  %9 = load i64, ptr getelementptr inbounds inrange(-8, 64) (i8, ptr @_ZTVN5boost7archive21xml_archive_exceptionE, i64 8), align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 %9
  %11 = invoke noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140) %10, i32 noundef 0, ptr noundef nonnull @.str.1)
          to label %12 unwind label %25

12:                                               ; preds = %8
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %33, label %13

13:                                               ; preds = %12
  %14 = load ptr, ptr %0, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -40
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr %0, i64 %16
  %18 = invoke noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140) %17, i32 noundef %11, ptr noundef nonnull @.str.2)
          to label %19 unwind label %25

19:                                               ; preds = %13
  %20 = load ptr, ptr %0, align 8, !tbaa !5
  %21 = getelementptr i8, ptr %20, i64 -40
  %22 = load i64, ptr %21, align 8
  %23 = getelementptr inbounds i8, ptr %0, i64 %22
  %24 = invoke noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140) %23, i32 noundef %18, ptr noundef nonnull %2)
          to label %33 unwind label %25

25:                                               ; preds = %19, %13, %8
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %34

27:                                               ; preds = %4
  br label %.invoke

.invoke:                                          ; preds = %4, %27
  %28 = phi ptr [ @.str.3, %27 ], [ @.str, %4 ]
  %29 = load i64, ptr getelementptr inbounds inrange(-8, 64) (i8, ptr @_ZTVN5boost7archive21xml_archive_exceptionE, i64 8), align 8
  %30 = getelementptr inbounds i8, ptr %0, i64 %29
  %31 = invoke noundef i32 @_ZN5boost7archive17archive_exception6appendEjPKc(ptr noundef nonnull align 8 dereferenceable(140) %30, i32 noundef 0, ptr noundef nonnull %28)
          to label %33 unwind label %6

32:                                               ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, i32 noundef 53, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN5boost7archive21xml_archive_exceptionC2ENS1_14exception_codeEPKcS4_) #6
  unreachable

33:                                               ; preds = %.invoke, %12, %19
  ret void

34:                                               ; preds = %25, %6
  %.pn = phi { ptr, i32 } [ %7, %6 ], [ %26, %25 ]
  tail call void @_ZN5boost7archive17archive_exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(140) %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZTTN5boost7archive21xml_archive_exceptionE, i64 24)) #5
  tail call void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #5
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: nounwind
declare void @_ZN5boost7archive17archive_exceptionC2ENS1_14exception_codeEPKcS4_(ptr noundef nonnull align 8 dereferenceable(140), ptr noundef, i32 noundef, ptr noundef, ptr noundef) unnamed_addr #4

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN5boost7archive17archive_exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(140), ptr noundef) unnamed_addr #4

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4

attributes #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 = { noreturn 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 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 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass