; LLVM IR from simbody/simbody :: SimTKcommon/src/tinyxml.ll (ZN5SimTK9TiXmlBase12EncodeStringERKNS_6StringEPS1_b)

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

%"struct.SimTK::TiXmlBase::Entity" = type { ptr, i32, i8 }

@_ZN5SimTK9TiXmlBase18condenseWhiteSpaceE = external dso_local global i8, align 1
@_ZN5SimTK9TiXmlBase6entityE = external global [5 x %"struct.SimTK::TiXmlBase::Entity"], align 16
@.str.17 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5SimTK9TiXmlBase12EncodeStringERKNS_6StringEPS1_b(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %1, i1 noundef zeroext %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca [32 x i8], align 16
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %10 = zext i1 %2 to i8
  store i8 %10, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %11

11:                                               ; preds = %172, %3
  %12 = load i32, ptr %7, align 4, !tbaa !11
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call noundef i32 @_ZNK5SimTK6String6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
  %15 = icmp slt i32 %12, %14
  br i1 %15, label %16, label %173

16:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #6
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = load i32, ptr %7, align 4, !tbaa !11
  %19 = call noundef signext i8 @_ZNK5SimTK6StringixEi(ptr noundef nonnull align 8 dereferenceable(32) %17, i32 noundef %18)
  store i8 %19, ptr %8, align 1, !tbaa !13
  %20 = load i8, ptr %8, align 1, !tbaa !13
  %21 = zext i8 %20 to i32
  %22 = icmp eq i32 %21, 38
  br i1 %22, label %23, label %68

23:                                               ; preds = %16
  %24 = load i32, ptr %7, align 4, !tbaa !11
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = call noundef i32 @_ZNK5SimTK6String6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %25)
  %27 = sub nsw i32 %26, 2
  %28 = icmp slt i32 %24, %27
  br i1 %28, label %29, label %68

29:                                               ; preds = %23
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = load i32, ptr %7, align 4, !tbaa !11
  %32 = add nsw i32 %31, 1
  %33 = call noundef signext i8 @_ZNK5SimTK6StringixEi(ptr noundef nonnull align 8 dereferenceable(32) %30, i32 noundef %32)
  %34 = sext i8 %33 to i32
  %35 = icmp eq i32 %34, 35
  br i1 %35, label %36, label %68

36:                                               ; preds = %29
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = load i32, ptr %7, align 4, !tbaa !11
  %39 = add nsw i32 %38, 2
  %40 = call noundef signext i8 @_ZNK5SimTK6StringixEi(ptr noundef nonnull align 8 dereferenceable(32) %37, i32 noundef %39)
  %41 = sext i8 %40 to i32
  %42 = icmp eq i32 %41, 120
  br i1 %42, label %43, label %68

43:                                               ; preds = %36
  br label %44

44:                                               ; preds = %66, %43
  %45 = load i32, ptr %7, align 4, !tbaa !11
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = call noundef i32 @_ZNK5SimTK6String6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %46)
  %48 = sub nsw i32 %47, 1
  %49 = icmp slt i32 %45, %48
  br i1 %49, label %50, label %67

50:                                               ; preds = %44
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %52) #6
  %54 = load i32, ptr %7, align 4, !tbaa !11
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i8, ptr %53, i64 %55
  %57 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %51, ptr noundef %56, i64 noundef 1)
  %58 = load i32, ptr %7, align 4, !tbaa !11
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %7, align 4, !tbaa !11
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = load i32, ptr %7, align 4, !tbaa !11
  %62 = call noundef signext i8 @_ZNK5SimTK6StringixEi(ptr noundef nonnull align 8 dereferenceable(32) %60, i32 noundef %61)
  %63 = sext i8 %62 to i32
  %64 = icmp eq i32 %63, 59
  br i1 %64, label %65, label %66

65:                                               ; preds = %50
  br label %67

66:                                               ; preds = %50
  br label %44, !llvm.loop !14

67:                                               ; preds = %65, %44
  br label %172

68:                                               ; preds = %36, %29, %23, %16
  %69 = load i8, ptr %8, align 1, !tbaa !13
  %70 = zext i8 %69 to i32
  %71 = icmp eq i32 %70, 38
  br i1 %71, label %72, label %80

72:                                               ; preds = %68
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = load ptr, ptr @_ZN5SimTK9TiXmlBase6entityE, align 16, !tbaa !16
  %75 = load i32, ptr getelementptr inbounds (%"struct.SimTK::TiXmlBase::Entity", ptr @_ZN5SimTK9TiXmlBase6entityE, i32 0, i32 1), align 8, !tbaa !18
  %76 = zext i32 %75 to i64
  %77 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %73, ptr noundef %74, i64 noundef %76)
  %78 = load i32, ptr %7, align 4, !tbaa !11
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %7, align 4, !tbaa !11
  br label %171

80:                                               ; preds = %68
  %81 = load i8, ptr %8, align 1, !tbaa !13
  %82 = zext i8 %81 to i32
  %83 = icmp eq i32 %82, 60
  br i1 %83, label %84, label %92

84:                                               ; preds = %80
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = load ptr, ptr getelementptr inbounds ([5 x %"struct.SimTK::TiXmlBase::Entity"], ptr @_ZN5SimTK9TiXmlBase6entityE, i64 0, i64 1), align 16, !tbaa !16
  %87 = load i32, ptr getelementptr inbounds (%"struct.SimTK::TiXmlBase::Entity", ptr getelementptr inbounds ([5 x %"struct.SimTK::TiXmlBase::Entity"], ptr @_ZN5SimTK9TiXmlBase6entityE, i64 0, i64 1), i32 0, i32 1), align 8, !tbaa !18
  %88 = zext i32 %87 to i64
  %89 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %85, ptr noundef %86, i64 noundef %88)
  %90 = load i32, ptr %7, align 4, !tbaa !11
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %7, align 4, !tbaa !11
  br label %170

92:                                               ; preds = %80
  %93 = load i8, ptr %8, align 1, !tbaa !13
  %94 = zext i8 %93 to i32
  %95 = icmp eq i32 %94, 62
  br i1 %95, label %96, label %104

96:                                               ; preds = %92
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = load ptr, ptr getelementptr inbounds ([5 x %"struct.SimTK::TiXmlBase::Entity"], ptr @_ZN5SimTK9TiXmlBase6entityE, i64 0, i64 2), align 16, !tbaa !16
  %99 = load i32, ptr getelementptr inbounds (%"struct.SimTK::TiXmlBase::Entity", ptr getelementptr inbounds ([5 x %"struct.SimTK::TiXmlBase::Entity"], ptr @_ZN5SimTK9TiXmlBase6entityE, i64 0, i64 2), i32 0, i32 1), align 8, !tbaa !18
  %100 = zext i32 %99 to i64
  %101 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %97, ptr noundef %98, i64 noundef %100)
  %102 = load i32, ptr %7, align 4, !tbaa !11
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %7, align 4, !tbaa !11
  br label %169

104:                                              ; preds = %92
  %105 = load i8, ptr %8, align 1, !tbaa !13
  %106 = zext i8 %105 to i32
  %107 = icmp eq i32 %106, 34
  br i1 %107, label %108, label %119

108:                                              ; preds = %104
  %109 = load i8, ptr %6, align 1, !tbaa !9, !range !19, !noundef !20
  %110 = trunc i8 %109 to i1
  br i1 %110, label %119, label %111

111:                                              ; preds = %108
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = load ptr, ptr getelementptr inbounds ([5 x %"struct.SimTK::TiXmlBase::Entity"], ptr @_ZN5SimTK9TiXmlBase6entityE, i64 0, i64 3), align 16, !tbaa !16
  %114 = load i32, ptr getelementptr inbounds (%"struct.SimTK::TiXmlBase::Entity", ptr getelementptr inbounds ([5 x %"struct.SimTK::TiXmlBase::Entity"], ptr @_ZN5SimTK9TiXmlBase6entityE, i64 0, i64 3), i32 0, i32 1), align 8, !tbaa !18
  %115 = zext i32 %114 to i64
  %116 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %112, ptr noundef %113, i64 noundef %115)
  %117 = load i32, ptr %7, align 4, !tbaa !11
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %7, align 4, !tbaa !11
  br label %168

119:                                              ; preds = %108, %104
  %120 = load i8, ptr %8, align 1, !tbaa !13
  %121 = zext i8 %120 to i32
  %122 = icmp eq i32 %121, 39
  br i1 %122, label %123, label %134

123:                                              ; preds = %119
  %124 = load i8, ptr %6, align 1, !tbaa !9, !range !19, !noundef !20
  %125 = trunc i8 %124 to i1
  br i1 %125, label %134, label %126

126:                                              ; preds = %123
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = load ptr, ptr getelementptr inbounds ([5 x %"struct.SimTK::TiXmlBase::Entity"], ptr @_ZN5SimTK9TiXmlBase6entityE, i64 0, i64 4), align 16, !tbaa !16
  %129 = load i32, ptr getelementptr inbounds (%"struct.SimTK::TiXmlBase::Entity", ptr getelementptr inbounds ([5 x %"struct.SimTK::TiXmlBase::Entity"], ptr @_ZN5SimTK9TiXmlBase6entityE, i64 0, i64 4), i32 0, i32 1), align 8, !tbaa !18
  %130 = zext i32 %129 to i64
  %131 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %127, ptr noundef %128, i64 noundef %130)
  %132 = load i32, ptr %7, align 4, !tbaa !11
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %7, align 4, !tbaa !11
  br label %167

134:                                              ; preds = %123, %119
  %135 = load i8, ptr %8, align 1, !tbaa !13
  %136 = zext i8 %135 to i32
  %137 = icmp slt i32 %136, 32
  br i1 %137, label %138, label %160

138:                                              ; preds = %134
  %139 = load i8, ptr @_ZN5SimTK9TiXmlBase18condenseWhiteSpaceE, align 1, !tbaa !9, !range !19, !noundef !20
  %140 = trunc i8 %139 to i1
  br i1 %140, label %145, label %141

141:                                              ; preds = %138
  %142 = load i8, ptr %8, align 1, !tbaa !13
  %143 = zext i8 %142 to i32
  %144 = call noundef zeroext i1 @_ZN5SimTK9TiXmlBase12IsWhiteSpaceEi(i32 noundef %143)
  br i1 %144, label %160, label %145

145:                                              ; preds = %141, %138
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #6
  %146 = getelementptr inbounds [32 x i8], ptr %9, i64 0, i64 0
  %147 = load i8, ptr %8, align 1, !tbaa !13
  %148 = zext i8 %147 to i32
  %149 = and i32 %148, 255
  %150 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %146, i64 noundef 32, ptr noundef @.str.17, i32 noundef %149) #6
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds [32 x i8], ptr %9, i64 0, i64 0
  %153 = getelementptr inbounds [32 x i8], ptr %9, i64 0, i64 0
  %154 = call i64 @strlen(ptr noundef %153) #7
  %155 = trunc i64 %154 to i32
  %156 = sext i32 %155 to i64
  %157 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %151, ptr noundef %152, i64 noundef %156)
  %158 = load i32, ptr %7, align 4, !tbaa !11
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #6
  br label %166

160:                                              ; preds = %141, %134
  %161 = load i8, ptr %8, align 1, !tbaa !13
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %162, i8 noundef signext %161)
  %164 = load i32, ptr %7, align 4, !tbaa !11
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %7, align 4, !tbaa !11
  br label %166

166:                                              ; preds = %160, %145
  br label %167

167:                                              ; preds = %166, %126
  br label %168

168:                                              ; preds = %167, %111
  br label %169

169:                                              ; preds = %168, %96
  br label %170

170:                                              ; preds = %169, %84
  br label %171

171:                                              ; preds = %170, %72
  br label %172

172:                                              ; preds = %171, %67
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #6
  br label %11, !llvm.loop !21

173:                                              ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret void
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZNK5SimTK6StringixEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i64 noundef) #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5SimTK9TiXmlBase12IsWhiteSpaceEi(i32 noundef) #3 align 2

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #4

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #0 align 2

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

!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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !6, i64 0}
!17 = !{!"_ZTSN5SimTK9TiXmlBase6EntityE", !6, i64 0, !12, i64 8, !7, i64 12}
!18 = !{!17, !12, i64 8}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !15}


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

%"struct.SimTK::TiXmlBase::Entity" = type { ptr, i32, i8 }

@_ZN5SimTK9TiXmlBase18condenseWhiteSpaceE = external dso_local local_unnamed_addr global i8, align 1
@_ZN5SimTK9TiXmlBase6entityE = external local_unnamed_addr global [5 x %"struct.SimTK::TiXmlBase::Entity"], align 16
@.str.17 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5SimTK9TiXmlBase12EncodeStringERKNS_6StringEPS1_b(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %1, i1 noundef zeroext %2) local_unnamed_addr #0 align 2 {
  %4 = alloca [32 x i8], align 16
  %5 = tail call noundef i32 @_ZNK5SimTK6String6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3, %.loopexit
  %.044 = phi i32 [ %.2, %.loopexit ], [ 0, %3 ]
  %7 = call noundef signext i8 @_ZNK5SimTK6StringixEi(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %.044)
  %8 = zext i8 %7 to i32
  switch i8 %7, label %62 [
    i8 38, label %9
    i8 60, label %36
    i8 62, label %42
    i8 34, label %48
    i8 39, label %55
  ]

9:                                                ; preds = %.lr.ph
  %10 = call noundef i32 @_ZNK5SimTK6String6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %11 = add nsw i32 %10, -2
  %12 = icmp slt i32 %.044, %11
  %13 = add nsw i32 %.044, 1
  br i1 %12, label %14, label %._crit_edge46

14:                                               ; preds = %9
  %15 = call noundef signext i8 @_ZNK5SimTK6StringixEi(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %13)
  %16 = icmp eq i8 %15, 35
  br i1 %16, label %17, label %._crit_edge46

17:                                               ; preds = %14
  %18 = add nsw i32 %.044, 2
  %19 = call noundef signext i8 @_ZNK5SimTK6StringixEi(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %18)
  %20 = icmp eq i8 %19, 120
  br i1 %20, label %.preheader.preheader, label %._crit_edge46

.preheader.preheader:                             ; preds = %17
  %21 = sext i32 %.044 to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %26
  %indvars.iv = phi i64 [ %21, %.preheader.preheader ], [ %indvars.iv.next, %26 ]
  %22 = call noundef i32 @_ZNK5SimTK6String6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %23 = add nsw i32 %22, -1
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv, %24
  br i1 %25, label %26, label %.loopexit.loopexit.split.loop.exit47

26:                                               ; preds = %.preheader
  %27 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  %28 = getelementptr inbounds i8, ptr %27, i64 %indvars.iv
  %29 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %28, i64 noundef 1)
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %indvars = trunc i64 %indvars.iv.next to i32
  %30 = call noundef signext i8 @_ZNK5SimTK6StringixEi(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %indvars)
  %31 = icmp eq i8 %30, 59
  br i1 %31, label %.loopexit, label %.preheader, !llvm.loop !5

._crit_edge46:                                    ; preds = %9, %14, %17
  %32 = load ptr, ptr @_ZN5SimTK9TiXmlBase6entityE, align 16, !tbaa !7
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN5SimTK9TiXmlBase6entityE, i64 8), align 8, !tbaa !13
  %34 = zext i32 %33 to i64
  %35 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %32, i64 noundef %34)
  br label %.loopexit

36:                                               ; preds = %.lr.ph
  %37 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN5SimTK9TiXmlBase6entityE, i64 16), align 16, !tbaa !7
  %38 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN5SimTK9TiXmlBase6entityE, i64 24), align 8, !tbaa !13
  %39 = zext i32 %38 to i64
  %40 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %37, i64 noundef %39)
  %41 = add nsw i32 %.044, 1
  br label %.loopexit

42:                                               ; preds = %.lr.ph
  %43 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN5SimTK9TiXmlBase6entityE, i64 32), align 16, !tbaa !7
  %44 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN5SimTK9TiXmlBase6entityE, i64 40), align 8, !tbaa !13
  %45 = zext i32 %44 to i64
  %46 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %43, i64 noundef %45)
  %47 = add nsw i32 %.044, 1
  br label %.loopexit

48:                                               ; preds = %.lr.ph
  br i1 %2, label %.thread, label %49

49:                                               ; preds = %48
  %50 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN5SimTK9TiXmlBase6entityE, i64 48), align 16, !tbaa !7
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN5SimTK9TiXmlBase6entityE, i64 56), align 8, !tbaa !13
  %52 = zext i32 %51 to i64
  %53 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %50, i64 noundef %52)
  %54 = add nsw i32 %.044, 1
  br label %.loopexit

55:                                               ; preds = %.lr.ph
  br i1 %2, label %.thread, label %56

56:                                               ; preds = %55
  %57 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN5SimTK9TiXmlBase6entityE, i64 64), align 16, !tbaa !7
  %58 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN5SimTK9TiXmlBase6entityE, i64 72), align 8, !tbaa !13
  %59 = zext i32 %58 to i64
  %60 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %57, i64 noundef %59)
  %61 = add nsw i32 %.044, 1
  br label %.loopexit

62:                                               ; preds = %.lr.ph
  %63 = icmp ult i8 %7, 32
  br i1 %63, label %64, label %.thread

64:                                               ; preds = %62
  %65 = load i8, ptr @_ZN5SimTK9TiXmlBase18condenseWhiteSpaceE, align 1, !tbaa !14, !range !16, !noundef !17
  %66 = trunc nuw i8 %65 to i1
  br i1 %66, label %69, label %67

67:                                               ; preds = %64
  %68 = call noundef zeroext i1 @_ZN5SimTK9TiXmlBase12IsWhiteSpaceEi(i32 noundef %8)
  br i1 %68, label %.thread, label %69

69:                                               ; preds = %67, %64
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #6
  %70 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %4, i64 noundef 32, ptr noundef nonnull @.str.17, i32 noundef %8) #6
  %71 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %4) #7
  %sext = shl i64 %71, 32
  %72 = ashr exact i64 %sext, 32
  %73 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull %4, i64 noundef %72)
  %74 = add nsw i32 %.044, 1
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  br label %.loopexit

.thread:                                          ; preds = %55, %48, %67, %62
  %75 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %1, i8 noundef signext %7)
  %76 = add nsw i32 %.044, 1
  br label %.loopexit

.loopexit.loopexit.split.loop.exit47:             ; preds = %.preheader
  %77 = trunc nsw i64 %indvars.iv to i32
  br label %.loopexit

.loopexit:                                        ; preds = %26, %.loopexit.loopexit.split.loop.exit47, %._crit_edge46, %42, %56, %.thread, %69, %49, %36
  %.2 = phi i32 [ %13, %._crit_edge46 ], [ %41, %36 ], [ %47, %42 ], [ %74, %69 ], [ %76, %.thread ], [ %61, %56 ], [ %54, %49 ], [ %77, %.loopexit.loopexit.split.loop.exit47 ], [ %indvars, %26 ]
  %78 = call noundef i32 @_ZNK5SimTK6String6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %79 = icmp slt i32 %.2, %78
  br i1 %79, label %.lr.ph, label %._crit_edge, !llvm.loop !18

._crit_edge:                                      ; preds = %.loopexit, %3
  ret void
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZNK5SimTK6StringixEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i64 noundef) local_unnamed_addr #0 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 #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5SimTK9TiXmlBase12IsWhiteSpaceEi(i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #0 align 2

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

!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 = !{!8, !9, i64 0}
!8 = !{!"_ZTSN5SimTK9TiXmlBase6EntityE", !9, i64 0, !12, i64 8, !10, i64 12}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!8, !12, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !10, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !6}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass