; LLVM IR from simbody/simbody :: SimTKcommon/src (Xml)

; 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.SimTK::String" = type { %"class.std::__cxx11::basic_string" }
%"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.SimTK::Xml::node_iterator" = type <{ %"class.SimTK::Xml::Node", i32, [4 x i8] }>
%"class.SimTK::Xml::Node" = type { ptr }
%"class.SimTK::Xml::Document::Impl" = type { %"class.SimTK::TiXmlDocument", %"class.SimTK::Xml::Element" }
%"class.SimTK::TiXmlDocument" = type { %"class.SimTK::TiXmlNode", i8, i32, %"class.SimTK::String", i32, %"struct.SimTK::TiXmlCursor", i8, %"class.SimTK::String" }
%"class.SimTK::TiXmlNode" = type { %"class.SimTK::TiXmlBase", ptr, i32, ptr, ptr, %"class.SimTK::String", ptr, ptr }
%"class.SimTK::TiXmlBase" = type { ptr, %"struct.SimTK::TiXmlCursor", ptr }
%"struct.SimTK::TiXmlCursor" = type { i32, i32 }
%"class.SimTK::Xml::Element" = type { %"class.SimTK::Xml::Node" }

@.str.10 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [36 x i8], align 1
@_ZTIN5SimTK9Exception10ErrorCheckE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.14 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [53 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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5SimTK3Xml8Document23insertTopLevelNodeAfterERKNS0_13node_iteratorENS0_4NodeE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.SimTK::String", align 8
  %11 = alloca i1, align 1
  %12 = alloca %"class.SimTK::Xml::node_iterator", align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store ptr @.str.11, ptr %7, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %3
  %16 = call noundef zeroext i1 @_ZNK5SimTK3Xml4Node7isValidEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  br i1 %16, label %25, label %17

17:                                               ; preds = %15
  %18 = call ptr @__cxa_allocate_exception(i64 112) #4
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void (ptr, ptr, i32, ptr, ptr, ptr, ...) @_ZN5SimTK9Exception10ErrorCheckC2EPKciS3_S3_S3_z(ptr noundef nonnull align 8 dereferenceable(112) %18, ptr noundef @.str.10, i32 noundef 344, ptr noundef @.str.12, ptr noundef %19, ptr noundef @.str.13)
          to label %20 unwind label %21

20:                                               ; preds = %17
  call void @__cxa_throw(ptr %18, ptr @_ZTIN5SimTK9Exception10ErrorCheckE, ptr @_ZN5SimTK9Exception4BaseD2Ev) #5
  unreachable

21:                                               ; preds = %17
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %8, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %9, align 4
  call void @__cxa_free_exception(ptr %18) #4
  br label %104

25:                                               ; preds = %15
  br label %26

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  %29 = call noundef zeroext i1 @_ZNK5SimTK3Xml4Node8isOrphanEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  br i1 %29, label %38, label %30

30:                                               ; preds = %28
  %31 = call ptr @__cxa_allocate_exception(i64 112) #4
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void (ptr, ptr, i32, ptr, ptr, ptr, ...) @_ZN5SimTK9Exception10ErrorCheckC2EPKciS3_S3_S3_z(ptr noundef nonnull align 8 dereferenceable(112) %31, ptr noundef @.str.10, i32 noundef 346, ptr noundef @.str.14, ptr noundef %32, ptr noundef @.str.15)
          to label %33 unwind label %34

33:                                               ; preds = %30
  call void @__cxa_throw(ptr %31, ptr @_ZTIN5SimTK9Exception10ErrorCheckE, ptr @_ZN5SimTK9Exception4BaseD2Ev) #5
  unreachable

34:                                               ; preds = %30
  %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
  call void @__cxa_free_exception(ptr %31) #4
  br label %104

38:                                               ; preds = %28
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  %42 = call noundef zeroext i1 @_ZN5SimTK3Xml7Comment3isAERKNS0_4NodeE(ptr noundef nonnull align 8 dereferenceable(8) %2)
  br i1 %42, label %63, label %43

43:                                               ; preds = %41
  %44 = call noundef zeroext i1 @_ZN5SimTK3Xml7Unknown3isAERKNS0_4NodeE(ptr noundef nonnull align 8 dereferenceable(8) %2)
  br i1 %44, label %63, label %45

45:                                               ; preds = %43
  store i1 true, ptr %11, align 1
  %46 = call ptr @__cxa_allocate_exception(i64 112) #4
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #4
  invoke void @_ZNK5SimTK3Xml4Node19getNodeTypeAsStringEv(ptr dead_on_unwind writable sret(%"class.SimTK::String") align 8 %10, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %48 unwind label %51

48:                                               ; preds = %45
  %49 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %10) #4
  invoke void (ptr, ptr, i32, ptr, ptr, ptr, ...) @_ZN5SimTK9Exception10ErrorCheckC2EPKciS3_S3_S3_z(ptr noundef nonnull align 8 dereferenceable(112) %46, ptr noundef @.str.10, i32 noundef 350, ptr noundef @.str.16, ptr noundef %47, ptr noundef @.str.17, ptr noundef %49)
          to label %50 unwind label %55

50:                                               ; preds = %48
  store i1 false, ptr %11, align 1
  invoke void @__cxa_throw(ptr %46, ptr @_ZTIN5SimTK9Exception10ErrorCheckE, ptr @_ZN5SimTK9Exception4BaseD2Ev) #5
          to label %110 unwind label %55

51:                                               ; preds = %45
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %8, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %9, align 4
  br label %59

55:                                               ; preds = %50, %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
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #4
  br label %59

59:                                               ; preds = %55, %51
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #4
  %60 = load i1, ptr %11, align 1
  br i1 %60, label %61, label %62

61:                                               ; preds = %59
  call void @__cxa_free_exception(ptr %46) #4
  br label %62

62:                                               ; preds = %61, %59
  br label %104

63:                                               ; preds = %43, %41
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #4
  call void @_ZNK5SimTK3Xml8Document8node_endEv(ptr dead_on_unwind writable sret(%"class.SimTK::Xml::node_iterator") align 8 %12, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %67 = invoke noundef zeroext i1 @_ZNK5SimTK3Xml13node_iteratoreqERKS1_(ptr noundef nonnull align 8 dereferenceable(12) %66, ptr noundef nonnull align 8 dereferenceable(12) %12)
          to label %68 unwind label %74

68:                                               ; preds = %65
  call void @_ZN5SimTK3Xml13node_iteratorD2Ev(ptr noundef nonnull align 8 dereferenceable(12) %12) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #4
  br i1 %67, label %69, label %78

69:                                               ; preds = %68
  %70 = call noundef nonnull align 8 dereferenceable(200) ptr @_ZN5SimTK3Xml8Document7updImplEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
  %71 = getelementptr inbounds %"class.SimTK::Xml::Document::Impl", ptr %70, i32 0, i32 0
  %72 = call noundef ptr @_ZN5SimTK3Xml4Node12updTiNodePtrEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %73 = call noundef ptr @_ZN5SimTK9TiXmlNode12LinkEndChildEPS0_(ptr noundef nonnull align 8 dereferenceable(104) %71, ptr noundef %72)
  store i32 1, ptr %13, align 4
  br label %101

74:                                               ; preds = %65
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %8, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %9, align 4
  call void @_ZN5SimTK3Xml13node_iteratorD2Ev(ptr noundef nonnull align 8 dereferenceable(12) %12) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #4
  br label %104

78:                                               ; preds = %68
  br label %79

79:                                               ; preds = %78
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = call noundef ptr @_ZNK5SimTK3Xml13node_iteratorptEv(ptr noundef nonnull align 8 dereferenceable(12) %80)
  %82 = call noundef zeroext i1 @_ZNK5SimTK3Xml4Node14isTopLevelNodeEv(ptr noundef nonnull align 8 dereferenceable(8) %81)
  br i1 %82, label %91, label %83

83:                                               ; preds = %79
  %84 = call ptr @__cxa_allocate_exception(i64 112) #4
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void (ptr, ptr, i32, ptr, ptr, ptr, ...) @_ZN5SimTK9Exception10ErrorCheckC2EPKciS3_S3_S3_z(ptr noundef nonnull align 8 dereferenceable(112) %84, ptr noundef @.str.10, i32 noundef 360, ptr noundef @.str.18, ptr noundef %85, ptr noundef @.str.19)
          to label %86 unwind label %87

86:                                               ; preds = %83
  call void @__cxa_throw(ptr %84, ptr @_ZTIN5SimTK9Exception10ErrorCheckE, ptr @_ZN5SimTK9Exception4BaseD2Ev) #5
  unreachable

87:                                               ; preds = %83
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %8, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %9, align 4
  call void @__cxa_free_exception(ptr %84) #4
  br label %104

91:                                               ; preds = %79
  br label %92

92:                                               ; preds = %91
  br label %93

93:                                               ; preds = %92
  %94 = call noundef nonnull align 8 dereferenceable(200) ptr @_ZN5SimTK3Xml8Document7updImplEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
  %95 = getelementptr inbounds %"class.SimTK::Xml::Document::Impl", ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = call noundef ptr @_ZNK5SimTK3Xml13node_iteratorptEv(ptr noundef nonnull align 8 dereferenceable(12) %96)
  %98 = call noundef ptr @_ZN5SimTK3Xml4Node12updTiNodePtrEv(ptr noundef nonnull align 8 dereferenceable(8) %97)
  %99 = call noundef ptr @_ZN5SimTK3Xml4Node12updTiNodePtrEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %100 = call noundef ptr @_ZN5SimTK9TiXmlNode14LinkAfterChildEPS0_S1_(ptr noundef nonnull align 8 dereferenceable(104) %95, ptr noundef %98, ptr noundef %99)
  store i32 0, ptr %13, align 4
  br label %101

101:                                              ; preds = %93, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %102 = load i32, ptr %13, align 4
  switch i32 %102, label %110 [
    i32 0, label %103
    i32 1, label %103
  ]

103:                                              ; preds = %101, %101
  ret void

104:                                              ; preds = %87, %74, %62, %34, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %105

105:                                              ; preds = %104
  %106 = load ptr, ptr %8, align 8
  %107 = load i32, ptr %9, align 4
  %108 = insertvalue { ptr, i32 } poison, ptr %106, 0
  %109 = insertvalue { ptr, i32 } %108, i32 %107, 1
  resume { ptr, i32 } %109

110:                                              ; preds = %101, %50
  unreachable
}

declare ptr @__cxa_allocate_exception(i64)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5SimTK9Exception10ErrorCheckC2EPKciS3_S3_S3_z(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ...) unnamed_addr #2 align 2

declare void @__cxa_free_exception(ptr)

declare void @__cxa_throw(ptr, ptr, ptr)

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK5SimTK3Xml4Node19getNodeTypeAsStringEv(ptr dead_on_unwind noalias writable sret(%"class.SimTK::String") align 8, ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK5SimTK3Xml13node_iteratoreqERKS1_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(12)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK5SimTK3Xml8Document8node_endEv(ptr dead_on_unwind noalias writable sret(%"class.SimTK::Xml::node_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

declare noundef ptr @_ZN5SimTK9TiXmlNode12LinkEndChildEPS0_(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef) #3

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

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

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

declare noundef ptr @_ZN5SimTK9TiXmlNode14LinkAfterChildEPS0_S1_(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef, ptr noundef) #3

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { "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 }
attributes #5 = { 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"}


; 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.SimTK::String" = type { %"class.std::__cxx11::basic_string" }
%"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.SimTK::Xml::node_iterator" = type <{ %"class.SimTK::Xml::Node", i32, [4 x i8] }>
%"class.SimTK::Xml::Node" = type { ptr }

@.str.10 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [36 x i8], align 1
@_ZTIN5SimTK9Exception10ErrorCheckE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.14 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [53 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5SimTK3Xml8Document23insertTopLevelNodeAfterERKNS0_13node_iteratorENS0_4NodeE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.SimTK::String", align 8
  %5 = alloca %"class.SimTK::Xml::node_iterator", align 8
  %6 = tail call noundef zeroext i1 @_ZNK5SimTK3Xml4Node7isValidEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  br i1 %6, label %12, label %7

7:                                                ; preds = %3
  %8 = tail call ptr @__cxa_allocate_exception(i64 112) #4
  invoke void (ptr, ptr, i32, ptr, ptr, ptr, ...) @_ZN5SimTK9Exception10ErrorCheckC2EPKciS3_S3_S3_z(ptr noundef nonnull align 8 dereferenceable(112) %8, ptr noundef nonnull @.str.10, i32 noundef 344, ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.13)
          to label %9 unwind label %10

9:                                                ; preds = %7
  tail call void @__cxa_throw(ptr nonnull %8, ptr nonnull @_ZTIN5SimTK9Exception10ErrorCheckE, ptr nonnull @_ZN5SimTK9Exception4BaseD2Ev) #5
  unreachable

10:                                               ; preds = %7
  %11 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %8) #4
  br label %57

12:                                               ; preds = %3
  %13 = tail call noundef zeroext i1 @_ZNK5SimTK3Xml4Node8isOrphanEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  br i1 %13, label %19, label %14

14:                                               ; preds = %12
  %15 = tail call ptr @__cxa_allocate_exception(i64 112) #4
  invoke void (ptr, ptr, i32, ptr, ptr, ptr, ...) @_ZN5SimTK9Exception10ErrorCheckC2EPKciS3_S3_S3_z(ptr noundef nonnull align 8 dereferenceable(112) %15, ptr noundef nonnull @.str.10, i32 noundef 346, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.15)
          to label %16 unwind label %17

16:                                               ; preds = %14
  tail call void @__cxa_throw(ptr nonnull %15, ptr nonnull @_ZTIN5SimTK9Exception10ErrorCheckE, ptr nonnull @_ZN5SimTK9Exception4BaseD2Ev) #5
  unreachable

17:                                               ; preds = %14
  %18 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %15) #4
  br label %57

19:                                               ; preds = %12
  %20 = tail call noundef zeroext i1 @_ZN5SimTK3Xml7Comment3isAERKNS0_4NodeE(ptr noundef nonnull align 8 dereferenceable(8) %2)
  br i1 %20, label %33, label %21

21:                                               ; preds = %19
  %22 = tail call noundef zeroext i1 @_ZN5SimTK3Xml7Unknown3isAERKNS0_4NodeE(ptr noundef nonnull align 8 dereferenceable(8) %2)
  br i1 %22, label %33, label %23

23:                                               ; preds = %21
  %24 = tail call ptr @__cxa_allocate_exception(i64 112) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  invoke void @_ZNK5SimTK3Xml4Node19getNodeTypeAsStringEv(ptr dead_on_unwind nonnull writable sret(%"class.SimTK::String") align 8 %4, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %25 unwind label %.thread

25:                                               ; preds = %23
  %26 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  invoke void (ptr, ptr, i32, ptr, ptr, ptr, ...) @_ZN5SimTK9Exception10ErrorCheckC2EPKciS3_S3_S3_z(ptr noundef nonnull align 8 dereferenceable(112) %24, ptr noundef nonnull @.str.10, i32 noundef 350, ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.17, ptr noundef %26)
          to label %28 unwind label %.thread20

.thread20:                                        ; preds = %25
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  br label %32

28:                                               ; preds = %25
  invoke void @__cxa_throw(ptr nonnull %24, ptr nonnull @_ZTIN5SimTK9Exception10ErrorCheckE, ptr nonnull @_ZN5SimTK9Exception4BaseD2Ev) #5
          to label %58 unwind label %30

.thread:                                          ; preds = %23
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  br label %32

30:                                               ; preds = %28
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  br label %57

32:                                               ; preds = %.thread20, %.thread
  %.pn19 = phi { ptr, i32 } [ %29, %.thread ], [ %27, %.thread20 ]
  call void @__cxa_free_exception(ptr %24) #4
  br label %57

33:                                               ; preds = %21, %19
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  call void @_ZNK5SimTK3Xml8Document8node_endEv(ptr dead_on_unwind nonnull writable sret(%"class.SimTK::Xml::node_iterator") align 8 %5, ptr noundef nonnull align 8 dereferenceable(8) %0)
  %34 = invoke noundef zeroext i1 @_ZNK5SimTK3Xml13node_iteratoreqERKS1_(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull align 8 dereferenceable(12) %5)
          to label %35 unwind label %40

35:                                               ; preds = %33
  call void @_ZN5SimTK3Xml13node_iteratorD2Ev(ptr noundef nonnull align 8 dereferenceable(12) %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  br i1 %34, label %36, label %42

36:                                               ; preds = %35
  %37 = call noundef nonnull align 8 dereferenceable(200) ptr @_ZN5SimTK3Xml8Document7updImplEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %38 = call noundef ptr @_ZN5SimTK3Xml4Node12updTiNodePtrEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %39 = call noundef ptr @_ZN5SimTK9TiXmlNode12LinkEndChildEPS0_(ptr noundef nonnull align 8 dereferenceable(104) %37, ptr noundef %38)
  br label %56

40:                                               ; preds = %33
  %41 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5SimTK3Xml13node_iteratorD2Ev(ptr noundef nonnull align 8 dereferenceable(12) %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  br label %57

42:                                               ; preds = %35
  %43 = call noundef ptr @_ZNK5SimTK3Xml13node_iteratorptEv(ptr noundef nonnull align 8 dereferenceable(12) %1)
  %44 = call noundef zeroext i1 @_ZNK5SimTK3Xml4Node14isTopLevelNodeEv(ptr noundef nonnull align 8 dereferenceable(8) %43)
  br i1 %44, label %50, label %45

45:                                               ; preds = %42
  %46 = call ptr @__cxa_allocate_exception(i64 112) #4
  invoke void (ptr, ptr, i32, ptr, ptr, ptr, ...) @_ZN5SimTK9Exception10ErrorCheckC2EPKciS3_S3_S3_z(ptr noundef nonnull align 8 dereferenceable(112) %46, ptr noundef nonnull @.str.10, i32 noundef 360, ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.19)
          to label %47 unwind label %48

47:                                               ; preds = %45
  call void @__cxa_throw(ptr nonnull %46, ptr nonnull @_ZTIN5SimTK9Exception10ErrorCheckE, ptr nonnull @_ZN5SimTK9Exception4BaseD2Ev) #5
  unreachable

48:                                               ; preds = %45
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %46) #4
  br label %57

50:                                               ; preds = %42
  %51 = call noundef nonnull align 8 dereferenceable(200) ptr @_ZN5SimTK3Xml8Document7updImplEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %52 = call noundef ptr @_ZNK5SimTK3Xml13node_iteratorptEv(ptr noundef nonnull align 8 dereferenceable(12) %1)
  %53 = call noundef ptr @_ZN5SimTK3Xml4Node12updTiNodePtrEv(ptr noundef nonnull align 8 dereferenceable(8) %52)
  %54 = call noundef ptr @_ZN5SimTK3Xml4Node12updTiNodePtrEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %55 = call noundef ptr @_ZN5SimTK9TiXmlNode14LinkAfterChildEPS0_S1_(ptr noundef nonnull align 8 dereferenceable(104) %51, ptr noundef %53, ptr noundef %54)
  br label %56

56:                                               ; preds = %50, %36
  ret void

57:                                               ; preds = %30, %32, %48, %40, %17, %10
  %.pn15 = phi { ptr, i32 } [ %49, %48 ], [ %41, %40 ], [ %.pn19, %32 ], [ %31, %30 ], [ %18, %17 ], [ %11, %10 ]
  resume { ptr, i32 } %.pn15

58:                                               ; preds = %28
  unreachable
}

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5SimTK9Exception10ErrorCheckC2EPKciS3_S3_S3_z(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ...) unnamed_addr #2 align 2

declare void @__cxa_free_exception(ptr) local_unnamed_addr

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK5SimTK3Xml4Node19getNodeTypeAsStringEv(ptr dead_on_unwind noalias writable sret(%"class.SimTK::String") align 8, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK5SimTK3Xml13node_iteratoreqERKS1_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK5SimTK3Xml8Document8node_endEv(ptr dead_on_unwind noalias writable sret(%"class.SimTK::Xml::node_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

declare noundef ptr @_ZN5SimTK9TiXmlNode12LinkEndChildEPS0_(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef) local_unnamed_addr #3

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

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

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

declare noundef ptr @_ZN5SimTK9TiXmlNode14LinkAfterChildEPS0_S1_(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { "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 }
attributes #5 = { 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)"}


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