; LLVM IR from thuhcsi/Crystal.TTVS :: TinyXML/tinyxml.ll (ZN9TiXmlBase9PutStringERK11TiXmlStringPS0_)

; 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.TiXmlBase::Entity" = type { ptr, i32, i8 }

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

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

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

8:                                                ; preds = %156, %2
  %9 = load i32, ptr %5, align 4, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = call noundef i64 @_ZNK11TiXmlString6lengthEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %12 = trunc i64 %11 to i32
  %13 = icmp slt i32 %9, %12
  br i1 %13, label %14, label %157

14:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #6
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK11TiXmlStringixEj(ptr noundef nonnull align 8 dereferenceable(24) %15, i32 noundef %16)
  %18 = load i8, ptr %17, align 1, !tbaa !11
  store i8 %18, ptr %6, align 1, !tbaa !11
  %19 = load i8, ptr %6, align 1, !tbaa !11
  %20 = zext i8 %19 to i32
  %21 = icmp eq i32 %20, 38
  br i1 %21, label %22, label %71

22:                                               ; preds = %14
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = call noundef i64 @_ZNK11TiXmlString6lengthEv(ptr noundef nonnull align 8 dereferenceable(24) %24)
  %26 = trunc i64 %25 to i32
  %27 = sub nsw i32 %26, 2
  %28 = icmp slt i32 %23, %27
  br i1 %28, label %29, label %71

29:                                               ; preds = %22
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = add nsw i32 %31, 1
  %33 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK11TiXmlStringixEj(ptr noundef nonnull align 8 dereferenceable(24) %30, i32 noundef %32)
  %34 = load i8, ptr %33, align 1, !tbaa !11
  %35 = sext i8 %34 to i32
  %36 = icmp eq i32 %35, 35
  br i1 %36, label %37, label %71

37:                                               ; preds = %29
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = load i32, ptr %5, align 4, !tbaa !9
  %40 = add nsw i32 %39, 2
  %41 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK11TiXmlStringixEj(ptr noundef nonnull align 8 dereferenceable(24) %38, i32 noundef %40)
  %42 = load i8, ptr %41, align 1, !tbaa !11
  %43 = sext i8 %42 to i32
  %44 = icmp eq i32 %43, 120
  br i1 %44, label %45, label %71

45:                                               ; preds = %37
  br label %46

46:                                               ; preds = %69, %45
  %47 = load i32, ptr %5, align 4, !tbaa !9
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = call noundef i64 @_ZNK11TiXmlString6lengthEv(ptr noundef nonnull align 8 dereferenceable(24) %48)
  %50 = trunc i64 %49 to i32
  %51 = sub nsw i32 %50, 1
  %52 = icmp slt i32 %47, %51
  br i1 %52, label %53, label %70

53:                                               ; preds = %46
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = call noundef ptr @_ZNK11TiXmlString5c_strEv(ptr noundef nonnull align 8 dereferenceable(24) %55)
  %57 = load i32, ptr %5, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %56, i64 %58
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %54, ptr noundef %59, i64 noundef 1)
  %60 = load i32, ptr %5, align 4, !tbaa !9
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %5, align 4, !tbaa !9
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = load i32, ptr %5, align 4, !tbaa !9
  %64 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK11TiXmlStringixEj(ptr noundef nonnull align 8 dereferenceable(24) %62, i32 noundef %63)
  %65 = load i8, ptr %64, align 1, !tbaa !11
  %66 = sext i8 %65 to i32
  %67 = icmp eq i32 %66, 59
  br i1 %67, label %68, label %69

68:                                               ; preds = %53
  br label %70

69:                                               ; preds = %53
  br label %46, !llvm.loop !12

70:                                               ; preds = %68, %46
  br label %156

71:                                               ; preds = %37, %29, %22, %14
  %72 = load i8, ptr %6, align 1, !tbaa !11
  %73 = zext i8 %72 to i32
  %74 = icmp eq i32 %73, 38
  br i1 %74, label %75, label %82

75:                                               ; preds = %71
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = load ptr, ptr @_ZN9TiXmlBase6entityE, align 16, !tbaa !14
  %78 = load i32, ptr getelementptr inbounds (%"struct.TiXmlBase::Entity", ptr @_ZN9TiXmlBase6entityE, i32 0, i32 1), align 8, !tbaa !16
  %79 = zext i32 %78 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %76, ptr noundef %77, i64 noundef %79)
  %80 = load i32, ptr %5, align 4, !tbaa !9
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %5, align 4, !tbaa !9
  br label %155

82:                                               ; preds = %71
  %83 = load i8, ptr %6, align 1, !tbaa !11
  %84 = zext i8 %83 to i32
  %85 = icmp eq i32 %84, 60
  br i1 %85, label %86, label %93

86:                                               ; preds = %82
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = load ptr, ptr getelementptr inbounds ([5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 1), align 16, !tbaa !14
  %89 = load i32, ptr getelementptr inbounds (%"struct.TiXmlBase::Entity", ptr getelementptr inbounds ([5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 1), i32 0, i32 1), align 8, !tbaa !16
  %90 = zext i32 %89 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %87, ptr noundef %88, i64 noundef %90)
  %91 = load i32, ptr %5, align 4, !tbaa !9
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %5, align 4, !tbaa !9
  br label %154

93:                                               ; preds = %82
  %94 = load i8, ptr %6, align 1, !tbaa !11
  %95 = zext i8 %94 to i32
  %96 = icmp eq i32 %95, 62
  br i1 %96, label %97, label %104

97:                                               ; preds = %93
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = load ptr, ptr getelementptr inbounds ([5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 2), align 16, !tbaa !14
  %100 = load i32, ptr getelementptr inbounds (%"struct.TiXmlBase::Entity", ptr getelementptr inbounds ([5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 2), i32 0, i32 1), align 8, !tbaa !16
  %101 = zext i32 %100 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %98, ptr noundef %99, i64 noundef %101)
  %102 = load i32, ptr %5, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %5, align 4, !tbaa !9
  br label %153

104:                                              ; preds = %93
  %105 = load i8, ptr %6, align 1, !tbaa !11
  %106 = zext i8 %105 to i32
  %107 = icmp eq i32 %106, 34
  br i1 %107, label %108, label %115

108:                                              ; preds = %104
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = load ptr, ptr getelementptr inbounds ([5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 3), align 16, !tbaa !14
  %111 = load i32, ptr getelementptr inbounds (%"struct.TiXmlBase::Entity", ptr getelementptr inbounds ([5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 3), i32 0, i32 1), align 8, !tbaa !16
  %112 = zext i32 %111 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %109, ptr noundef %110, i64 noundef %112)
  %113 = load i32, ptr %5, align 4, !tbaa !9
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %5, align 4, !tbaa !9
  br label %152

115:                                              ; preds = %104
  %116 = load i8, ptr %6, align 1, !tbaa !11
  %117 = zext i8 %116 to i32
  %118 = icmp eq i32 %117, 39
  br i1 %118, label %119, label %126

119:                                              ; preds = %115
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = load ptr, ptr getelementptr inbounds ([5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 4), align 16, !tbaa !14
  %122 = load i32, ptr getelementptr inbounds (%"struct.TiXmlBase::Entity", ptr getelementptr inbounds ([5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 4), i32 0, i32 1), align 8, !tbaa !16
  %123 = zext i32 %122 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %120, ptr noundef %121, i64 noundef %123)
  %124 = load i32, ptr %5, align 4, !tbaa !9
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %5, align 4, !tbaa !9
  br label %151

126:                                              ; preds = %115
  %127 = load i8, ptr %6, align 1, !tbaa !11
  %128 = zext i8 %127 to i32
  %129 = icmp slt i32 %128, 32
  br i1 %129, label %130, label %144

130:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #6
  %131 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %132 = load i8, ptr %6, align 1, !tbaa !11
  %133 = zext i8 %132 to i32
  %134 = and i32 %133, 255
  %135 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %131, ptr noundef @.str, i32 noundef %134) #6
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %138 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %139 = call i64 @strlen(ptr noundef %138) #7
  %140 = trunc i64 %139 to i32
  %141 = sext i32 %140 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %136, ptr noundef %137, i64 noundef %141)
  %142 = load i32, ptr %5, align 4, !tbaa !9
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #6
  br label %150

144:                                              ; preds = %126
  %145 = load i8, ptr %6, align 1, !tbaa !11
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN11TiXmlStringpLEc(ptr noundef nonnull align 8 dereferenceable(24) %146, i8 noundef signext %145)
  %148 = load i32, ptr %5, align 4, !tbaa !9
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %5, align 4, !tbaa !9
  br label %150

150:                                              ; preds = %144, %130
  br label %151

151:                                              ; preds = %150, %119
  br label %152

152:                                              ; preds = %151, %108
  br label %153

153:                                              ; preds = %152, %97
  br label %154

154:                                              ; preds = %153, %86
  br label %155

155:                                              ; preds = %154, %75
  br label %156

156:                                              ; preds = %155, %70
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  br label %8, !llvm.loop !17

157:                                              ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  ret void
}

; 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 i64 @_ZNK11TiXmlString6lengthEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

declare void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i64 noundef) #3

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN11TiXmlStringpLEc(ptr noundef nonnull align 8 dereferenceable(24), i8 noundef signext) #1 align 2

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 = { "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 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTSN9TiXmlBase6EntityE", !6, i64 0, !10, i64 8, !7, i64 12}
!16 = !{!15, !10, i64 8}
!17 = distinct !{!17, !13}


; 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.TiXmlBase::Entity" = type { ptr, i32, i8 }

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

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

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

.lr.ph:                                           ; preds = %2, %.loopexit
  %.041 = phi i32 [ %.2, %.loopexit ], [ 0, %2 ]
  %7 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK11TiXmlStringixEj(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %.041)
  %8 = load i8, ptr %7, align 1, !tbaa !5
  %9 = zext i8 %8 to i32
  switch i8 %8, label %59 [
    i8 38, label %10
    i8 60, label %39
    i8 62, label %44
    i8 34, label %49
    i8 39, label %54
  ]

10:                                               ; preds = %.lr.ph
  %11 = call noundef i64 @_ZNK11TiXmlString6lengthEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %12 = trunc i64 %11 to i32
  %13 = add nsw i32 %12, -2
  %14 = icmp slt i32 %.041, %13
  %15 = add nsw i32 %.041, 1
  br i1 %14, label %16, label %._crit_edge43

16:                                               ; preds = %10
  %17 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK11TiXmlStringixEj(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %15)
  %18 = load i8, ptr %17, align 1, !tbaa !5
  %19 = icmp eq i8 %18, 35
  br i1 %19, label %20, label %._crit_edge43

20:                                               ; preds = %16
  %21 = add nsw i32 %.041, 2
  %22 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK11TiXmlStringixEj(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %21)
  %23 = load i8, ptr %22, align 1, !tbaa !5
  %24 = icmp eq i8 %23, 120
  br i1 %24, label %.preheader.preheader, label %._crit_edge43

.preheader.preheader:                             ; preds = %20
  %25 = sext i32 %.041 to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %30
  %indvars.iv = phi i64 [ %25, %.preheader.preheader ], [ %indvars.iv.next, %30 ]
  %26 = call noundef i64 @_ZNK11TiXmlString6lengthEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %27 = shl i64 %26, 32
  %sext44 = add i64 %27, -4294967296
  %28 = ashr exact i64 %sext44, 32
  %29 = icmp slt i64 %indvars.iv, %28
  br i1 %29, label %30, label %.loopexit.loopexit.split.loop.exit45

30:                                               ; preds = %.preheader
  %31 = call noundef ptr @_ZNK11TiXmlString5c_strEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %32 = getelementptr inbounds i8, ptr %31, i64 %indvars.iv
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef %32, i64 noundef 1)
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %indvars = trunc i64 %indvars.iv.next to i32
  %33 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK11TiXmlStringixEj(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %indvars)
  %34 = load i8, ptr %33, align 1, !tbaa !5
  %35 = icmp eq i8 %34, 59
  br i1 %35, label %.loopexit, label %.preheader, !llvm.loop !8

._crit_edge43:                                    ; preds = %10, %16, %20
  %36 = load ptr, ptr @_ZN9TiXmlBase6entityE, align 16, !tbaa !10
  %37 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 8), align 8, !tbaa !14
  %38 = zext i32 %37 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef %36, i64 noundef %38)
  br label %.loopexit

39:                                               ; preds = %.lr.ph
  %40 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 16), align 16, !tbaa !10
  %41 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 24), align 8, !tbaa !14
  %42 = zext i32 %41 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef %40, i64 noundef %42)
  %43 = add nsw i32 %.041, 1
  br label %.loopexit

44:                                               ; preds = %.lr.ph
  %45 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 32), align 16, !tbaa !10
  %46 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 40), align 8, !tbaa !14
  %47 = zext i32 %46 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef %45, i64 noundef %47)
  %48 = add nsw i32 %.041, 1
  br label %.loopexit

49:                                               ; preds = %.lr.ph
  %50 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 48), align 16, !tbaa !10
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 56), align 8, !tbaa !14
  %52 = zext i32 %51 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef %50, i64 noundef %52)
  %53 = add nsw i32 %.041, 1
  br label %.loopexit

54:                                               ; preds = %.lr.ph
  %55 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 64), align 16, !tbaa !10
  %56 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 72), align 8, !tbaa !14
  %57 = zext i32 %56 to i64
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef %55, i64 noundef %57)
  %58 = add nsw i32 %.041, 1
  br label %.loopexit

59:                                               ; preds = %.lr.ph
  %60 = icmp ult i8 %8, 32
  br i1 %60, label %61, label %66

61:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  %62 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9) #6
  %63 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %3) #7
  %sext = shl i64 %63, 32
  %64 = ashr exact i64 %sext, 32
  call void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull %3, i64 noundef %64)
  %65 = add nsw i32 %.041, 1
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  br label %.loopexit

66:                                               ; preds = %59
  %67 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN11TiXmlStringpLEc(ptr noundef nonnull align 8 dereferenceable(24) %1, i8 noundef signext %8)
  %68 = add nsw i32 %.041, 1
  br label %.loopexit

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

.loopexit:                                        ; preds = %30, %.loopexit.loopexit.split.loop.exit45, %._crit_edge43, %44, %54, %66, %61, %49, %39
  %.2 = phi i32 [ %15, %._crit_edge43 ], [ %43, %39 ], [ %48, %44 ], [ %53, %49 ], [ %58, %54 ], [ %65, %61 ], [ %68, %66 ], [ %69, %.loopexit.loopexit.split.loop.exit45 ], [ %indvars, %30 ]
  %70 = call noundef i64 @_ZNK11TiXmlString6lengthEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %71 = trunc i64 %70 to i32
  %72 = icmp slt i32 %.2, %71
  br i1 %72, label %.lr.ph, label %._crit_edge, !llvm.loop !15

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

; 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 i64 @_ZNK11TiXmlString6lengthEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

declare void @_ZN11TiXmlString6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, 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 uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN11TiXmlStringpLEc(ptr noundef nonnull align 8 dereferenceable(24), i8 noundef signext) local_unnamed_addr #1 align 2

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 = { "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 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !12, i64 0}
!11 = !{!"_ZTSN9TiXmlBase6EntityE", !12, i64 0, !13, i64 8, !6, i64 12}
!12 = !{!"any pointer", !6, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = !{!11, !13, i64 8}
!15 = distinct !{!15, !9}


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