; LLVM IR from gem5/gem5 :: ext/mcpat/xmlParser.ll (ZN7XMLNode11maybeAddTxTEPvPKc)

; 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.ALLXMLClearTag = type { ptr, i32, ptr }
%struct.XML = type { ptr, ptr, i32, i32, i32, ptr, i32, ptr, i32, i32 }
%struct.XMLNode = type { ptr }
%"struct.XMLNode::XMLNodeDataTag" = type { ptr, i32, i32, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.XMLClear = type { ptr, ptr, ptr }

@_ZL14dropWhiteSpace = external hidden global i8, align 1
@_ZL28removeCommentsInMiddleOfText = external hidden global i8, align 1
@_ZL12XMLClearTags = external hidden global [5 x %struct.ALLXMLClearTag], align 16

; Function Attrs: nounwind
declare void @free(ptr noundef) #0

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL7xstrlenPKc(ptr noundef) #3

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z13fromXMLStringPKciP3XML(ptr noundef, i32 noundef, ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7XMLNode12addText_privEiPci(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, ptr noundef, i32 noundef) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef signext i8 @_ZN7XMLNode11maybeAddTxTEPvPKc(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %1, ptr noundef %2) #5 align 2 {
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %18, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.XML, ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  store ptr %21, ptr %9, align 8, !tbaa !5
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %25, label %24

24:                                               ; preds = %3
  store i8 0, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %290

25:                                               ; preds = %3
  %26 = load i8, ptr @_ZL14dropWhiteSpace, align 1, !tbaa !13
  %27 = icmp ne i8 %26, 0
  br i1 %27, label %28, label %59

28:                                               ; preds = %25
  br label %29

29:                                               ; preds = %55, %28
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = load i8, ptr %30, align 1, !tbaa !13
  %32 = sext i8 %31 to i32
  %33 = icmp eq i32 %32, 10
  br i1 %33, label %49, label %34

34:                                               ; preds = %29
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = load i8, ptr %35, align 1, !tbaa !13
  %37 = sext i8 %36 to i32
  %38 = icmp eq i32 %37, 32
  br i1 %38, label %49, label %39

39:                                               ; preds = %34
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = load i8, ptr %40, align 1, !tbaa !13
  %42 = sext i8 %41 to i32
  %43 = icmp eq i32 %42, 9
  br i1 %43, label %49, label %44

44:                                               ; preds = %39
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = load i8, ptr %45, align 1, !tbaa !13
  %47 = sext i8 %46 to i32
  %48 = icmp eq i32 %47, 13
  br i1 %48, label %49, label %53

49:                                               ; preds = %44, %39, %34, %29
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = icmp ne ptr %50, %51
  br label %53

53:                                               ; preds = %49, %44
  %54 = phi i1 [ false, %44 ], [ %52, %49 ]
  br i1 %54, label %55, label %58

55:                                               ; preds = %53
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %56, i32 1
  store ptr %57, ptr %9, align 8, !tbaa !5
  br label %29, !llvm.loop !14

58:                                               ; preds = %53
  br label %59

59:                                               ; preds = %58, %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = ptrtoint ptr %60 to i64
  %63 = ptrtoint ptr %61 to i64
  %64 = sub i64 %62, %63
  %65 = trunc i64 %64 to i32
  store i32 %65, ptr %11, align 4, !tbaa !16
  %66 = load i32, ptr %11, align 4, !tbaa !16
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %71, label %68

68:                                               ; preds = %59
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.XML, ptr %69, i32 0, i32 1
  store ptr null, ptr %70, align 8, !tbaa !9
  store i8 0, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %289

71:                                               ; preds = %59
  %72 = load i8, ptr @_ZL14dropWhiteSpace, align 1, !tbaa !13
  %73 = icmp ne i8 %72, 0
  br i1 %73, label %74, label %122

74:                                               ; preds = %71
  %75 = load i32, ptr %11, align 4, !tbaa !16
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr %11, align 4, !tbaa !16
  br label %77

77:                                               ; preds = %116, %74
  %78 = load i32, ptr %11, align 4, !tbaa !16
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %114

80:                                               ; preds = %77
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = load i32, ptr %11, align 4, !tbaa !16
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i8, ptr %81, i64 %83
  %85 = load i8, ptr %84, align 1, !tbaa !13
  %86 = sext i8 %85 to i32
  %87 = icmp eq i32 %86, 10
  br i1 %87, label %112, label %88

88:                                               ; preds = %80
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = load i32, ptr %11, align 4, !tbaa !16
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i8, ptr %89, i64 %91
  %93 = load i8, ptr %92, align 1, !tbaa !13
  %94 = sext i8 %93 to i32
  %95 = icmp eq i32 %94, 32
  br i1 %95, label %112, label %96

96:                                               ; preds = %88
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = load i32, ptr %11, align 4, !tbaa !16
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds i8, ptr %97, i64 %99
  %101 = load i8, ptr %100, align 1, !tbaa !13
  %102 = sext i8 %101 to i32
  %103 = icmp eq i32 %102, 9
  br i1 %103, label %112, label %104

104:                                              ; preds = %96
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = load i32, ptr %11, align 4, !tbaa !16
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds i8, ptr %105, i64 %107
  %109 = load i8, ptr %108, align 1, !tbaa !13
  %110 = sext i8 %109 to i32
  %111 = icmp eq i32 %110, 13
  br label %112

112:                                              ; preds = %104, %96, %88, %80
  %113 = phi i1 [ true, %96 ], [ true, %88 ], [ true, %80 ], [ %111, %104 ]
  br label %114

114:                                              ; preds = %112, %77
  %115 = phi i1 [ false, %77 ], [ %113, %112 ]
  br i1 %115, label %116, label %119

116:                                              ; preds = %114
  %117 = load i32, ptr %11, align 4, !tbaa !16
  %118 = add nsw i32 %117, -1
  store i32 %118, ptr %11, align 4, !tbaa !16
  br label %77, !llvm.loop !17

119:                                              ; preds = %114
  %120 = load i32, ptr %11, align 4, !tbaa !16
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %11, align 4, !tbaa !16
  br label %122

122:                                              ; preds = %119, %71
  %123 = load i32, ptr %11, align 4, !tbaa !16
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %128, label %125

125:                                              ; preds = %122
  %126 = load ptr, ptr %8, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.XML, ptr %126, i32 0, i32 1
  store ptr null, ptr %127, align 8, !tbaa !9
  store i8 0, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %289

128:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  %130 = load i32, ptr %11, align 4, !tbaa !16
  %131 = load ptr, ptr %8, align 8, !tbaa !5
  %132 = call noundef ptr @_Z13fromXMLStringPKciP3XML(ptr noundef %129, i32 noundef %130, ptr noundef %131)
  store ptr %132, ptr %12, align 8, !tbaa !5
  %133 = load ptr, ptr %12, align 8, !tbaa !5
  %134 = icmp ne ptr %133, null
  br i1 %134, label %136, label %135

135:                                              ; preds = %128
  store i8 1, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %288

136:                                              ; preds = %128
  %137 = load ptr, ptr %8, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.XML, ptr %137, i32 0, i32 1
  store ptr null, ptr %138, align 8, !tbaa !9
  %139 = load i8, ptr @_ZL28removeCommentsInMiddleOfText, align 1, !tbaa !13
  %140 = icmp ne i8 %139, 0
  br i1 %140, label %141, label %285

141:                                              ; preds = %136
  %142 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %143 = load ptr, ptr %142, align 8, !tbaa !18
  %144 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %143, i32 0, i32 2
  %145 = load i32, ptr %144, align 4, !tbaa !20
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %285

147:                                              ; preds = %141
  %148 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8, !tbaa !18
  %150 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %149, i32 0, i32 3
  %151 = load i32, ptr %150, align 8, !tbaa !22
  %152 = icmp ne i32 %151, 0
  br i1 %152, label %153, label %285

153:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %154 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %155 = load ptr, ptr %154, align 8, !tbaa !18
  %156 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %155, i32 0, i32 1
  %157 = load i32, ptr %156, align 8, !tbaa !23
  %158 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %159 = load ptr, ptr %158, align 8, !tbaa !18
  %160 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %159, i32 0, i32 2
  %161 = load i32, ptr %160, align 4, !tbaa !20
  %162 = add nsw i32 %157, %161
  %163 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %164 = load ptr, ptr %163, align 8, !tbaa !18
  %165 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %164, i32 0, i32 3
  %166 = load i32, ptr %165, align 8, !tbaa !22
  %167 = add nsw i32 %162, %166
  %168 = sub nsw i32 %167, 1
  store i32 %168, ptr %13, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %169 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %170 = load ptr, ptr %169, align 8, !tbaa !18
  %171 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %170, i32 0, i32 11
  %172 = load ptr, ptr %171, align 8, !tbaa !24
  store ptr %172, ptr %14, align 8, !tbaa !5
  %173 = load ptr, ptr %14, align 8, !tbaa !5
  %174 = load i32, ptr %13, align 4, !tbaa !16
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds i32, ptr %173, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !16
  %178 = and i32 %177, 3
  %179 = icmp eq i32 %178, 3
  br i1 %179, label %180, label %281

180:                                              ; preds = %153
  %181 = load ptr, ptr %14, align 8, !tbaa !5
  %182 = load i32, ptr %13, align 4, !tbaa !16
  %183 = sub nsw i32 %182, 1
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds i32, ptr %181, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !16
  %187 = and i32 %186, 3
  %188 = icmp eq i32 %187, 2
  br i1 %188, label %189, label %281

189:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %190 = load ptr, ptr %14, align 8, !tbaa !5
  %191 = load i32, ptr %13, align 4, !tbaa !16
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds i32, ptr %190, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !16
  %195 = ashr i32 %194, 2
  store i32 %195, ptr %15, align 4, !tbaa !16
  %196 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %197 = load ptr, ptr %196, align 8, !tbaa !18
  %198 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %197, i32 0, i32 9
  %199 = load ptr, ptr %198, align 8, !tbaa !25
  %200 = load i32, ptr %15, align 4, !tbaa !16
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds %struct.XMLClear, ptr %199, i64 %201
  %203 = getelementptr inbounds %struct.XMLClear, ptr %202, i32 0, i32 1
  %204 = load ptr, ptr %203, align 8, !tbaa !26
  %205 = load ptr, ptr getelementptr inbounds ([5 x %struct.ALLXMLClearTag], ptr @_ZL12XMLClearTags, i64 0, i64 2), align 16, !tbaa !28
  %206 = icmp eq ptr %204, %205
  br i1 %206, label %207, label %277

207:                                              ; preds = %189
  %208 = load i32, ptr %15, align 4, !tbaa !16
  call void @_ZN7XMLNode11deleteClearEi(ptr noundef nonnull align 8 dereferenceable(8) %17, i32 noundef %208)
  %209 = load ptr, ptr %14, align 8, !tbaa !5
  %210 = load i32, ptr %13, align 4, !tbaa !16
  %211 = sub nsw i32 %210, 1
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds i32, ptr %209, i64 %212
  %214 = load i32, ptr %213, align 4, !tbaa !16
  %215 = ashr i32 %214, 2
  store i32 %215, ptr %15, align 4, !tbaa !16
  %216 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %217 = load ptr, ptr %216, align 8, !tbaa !18
  %218 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %217, i32 0, i32 8
  %219 = load ptr, ptr %218, align 8, !tbaa !30
  %220 = load i32, ptr %15, align 4, !tbaa !16
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds ptr, ptr %219, i64 %221
  %223 = load ptr, ptr %222, align 8, !tbaa !5
  %224 = call noundef i32 @_ZL7xstrlenPKc(ptr noundef %223)
  store i32 %224, ptr %13, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %225 = load ptr, ptr %12, align 8, !tbaa !5
  %226 = call noundef i32 @_ZL7xstrlenPKc(ptr noundef %225)
  %227 = add nsw i32 %226, 1
  store i32 %227, ptr %16, align 4, !tbaa !16
  %228 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %229 = load ptr, ptr %228, align 8, !tbaa !18
  %230 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %229, i32 0, i32 8
  %231 = load ptr, ptr %230, align 8, !tbaa !30
  %232 = load i32, ptr %15, align 4, !tbaa !16
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds ptr, ptr %231, i64 %233
  %235 = load ptr, ptr %234, align 8, !tbaa !5
  %236 = load i32, ptr %13, align 4, !tbaa !16
  %237 = load i32, ptr %16, align 4, !tbaa !16
  %238 = add nsw i32 %236, %237
  %239 = sext i32 %238 to i64
  %240 = mul i64 %239, 1
  %241 = call ptr @realloc(ptr noundef %235, i64 noundef %240) #7
  %242 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %243 = load ptr, ptr %242, align 8, !tbaa !18
  %244 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %243, i32 0, i32 8
  %245 = load ptr, ptr %244, align 8, !tbaa !30
  %246 = load i32, ptr %15, align 4, !tbaa !16
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds ptr, ptr %245, i64 %247
  store ptr %241, ptr %248, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %250 = load ptr, ptr %249, align 8, !tbaa !18
  %251 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %250, i32 0, i32 8
  %252 = load ptr, ptr %251, align 8, !tbaa !30
  %253 = load i32, ptr %15, align 4, !tbaa !16
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds ptr, ptr %252, i64 %254
  %256 = load ptr, ptr %255, align 8, !tbaa !5
  %257 = icmp ne ptr %256, null
  br i1 %257, label %259, label %258

258:                                              ; preds = %207
  store i8 1, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %276

259:                                              ; preds = %207
  %260 = getelementptr inbounds %struct.XMLNode, ptr %17, i32 0, i32 0
  %261 = load ptr, ptr %260, align 8, !tbaa !18
  %262 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %261, i32 0, i32 8
  %263 = load ptr, ptr %262, align 8, !tbaa !30
  %264 = load i32, ptr %15, align 4, !tbaa !16
  %265 = sext i32 %264 to i64
  %266 = getelementptr inbounds ptr, ptr %263, i64 %265
  %267 = load ptr, ptr %266, align 8, !tbaa !5
  %268 = load i32, ptr %13, align 4, !tbaa !16
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds i8, ptr %267, i64 %269
  %271 = load ptr, ptr %12, align 8, !tbaa !5
  %272 = load i32, ptr %16, align 4, !tbaa !16
  %273 = sext i32 %272 to i64
  %274 = mul i64 %273, 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %270, ptr align 1 %271, i64 %274, i1 false)
  %275 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %275) #6
  store i8 0, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %276

276:                                              ; preds = %259, %258
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %278

277:                                              ; preds = %189
  store i32 0, ptr %10, align 4
  br label %278

278:                                              ; preds = %277, %276
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  %279 = load i32, ptr %10, align 4
  switch i32 %279, label %282 [
    i32 0, label %280
  ]

280:                                              ; preds = %278
  br label %281

281:                                              ; preds = %280, %180, %153
  store i32 0, ptr %10, align 4
  br label %282

282:                                              ; preds = %281, %278
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  %283 = load i32, ptr %10, align 4
  switch i32 %283, label %288 [
    i32 0, label %284
  ]

284:                                              ; preds = %282
  br label %285

285:                                              ; preds = %284, %147, %141, %136
  %286 = load ptr, ptr %12, align 8, !tbaa !5
  %287 = call noundef ptr @_ZN7XMLNode12addText_privEiPci(ptr noundef nonnull align 8 dereferenceable(8) %17, i32 noundef 50, ptr noundef %286, i32 noundef -1)
  store i8 0, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %288

288:                                              ; preds = %285, %282, %135
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %289

289:                                              ; preds = %288, %125, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %290

290:                                              ; preds = %289, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %291 = load i8, ptr %4, align 1
  ret i8 %291
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7XMLNode11deleteClearEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #5 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind allocsize(1) "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 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(1) }

!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, !6, i64 8}
!10 = !{!"_ZTS3XML", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !12, i64 24, !6, i64 32, !11, i64 40, !6, i64 48, !11, i64 56, !11, i64 60}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS8XMLError", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!11, !11, i64 0}
!17 = distinct !{!17, !15}
!18 = !{!19, !6, i64 0}
!19 = !{!"_ZTS7XMLNode", !6, i64 0}
!20 = !{!21, !11, i64 12}
!21 = !{!"_ZTSN7XMLNode14XMLNodeDataTagE", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !7, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !11, i64 80}
!22 = !{!21, !11, i64 16}
!23 = !{!21, !11, i64 8}
!24 = !{!21, !6, i64 72}
!25 = !{!21, !6, i64 56}
!26 = !{!27, !6, i64 8}
!27 = !{!"_ZTS8XMLClear", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!29, !6, i64 0}
!29 = !{!"_ZTS14ALLXMLClearTag", !6, i64 0, !11, i64 8, !6, i64 16}
!30 = !{!21, !6, i64 48}


; 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.ALLXMLClearTag = type { ptr, i32, ptr }
%struct.XMLClear = type { ptr, ptr, ptr }

@_ZL14dropWhiteSpace = external hidden local_unnamed_addr global i8, align 1
@_ZL28removeCommentsInMiddleOfText = external hidden local_unnamed_addr global i8, align 1
@_ZL12XMLClearTags = external hidden local_unnamed_addr global [5 x %struct.ALLXMLClearTag], align 16

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL7xstrlenPKc(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z13fromXMLStringPKciP3XML(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7XMLNode12addText_privEiPci(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef signext i8 @_ZN7XMLNode11maybeAddTxTEPvPKc(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #4 align 2 {
  %4 = ptrtoint ptr %2 to i64
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %.thread99, label %7

7:                                                ; preds = %3
  %8 = ptrtoint ptr %6 to i64
  %9 = load i8, ptr @_ZL14dropWhiteSpace, align 1, !tbaa !12
  %.not79 = icmp eq i8 %9, 0
  %10 = sub i64 %4, %8
  br i1 %.not79, label %.critedge.thread, label %.preheader102.preheader

.preheader102.preheader:                          ; preds = %7
  %scevgep = getelementptr i8, ptr %6, i64 %10
  br label %.preheader102

.preheader102:                                    ; preds = %.preheader102.preheader, %13
  %.064 = phi ptr [ %14, %13 ], [ %6, %.preheader102.preheader ]
  %11 = load i8, ptr %.064, align 1, !tbaa !12
  switch i8 %11, label %.critedge [
    i8 10, label %12
    i8 32, label %12
    i8 9, label %12
    i8 13, label %12
  ]

12:                                               ; preds = %.preheader102, %.preheader102, %.preheader102, %.preheader102
  %.not80 = icmp eq ptr %.064, %2
  br i1 %.not80, label %.critedge, label %13

13:                                               ; preds = %12
  %14 = getelementptr inbounds i8, ptr %.064, i64 1
  br label %.preheader102, !llvm.loop !13

.critedge:                                        ; preds = %.preheader102, %12
  %.064.lcssa = phi ptr [ %.064, %.preheader102 ], [ %scevgep, %12 ]
  %15 = ptrtoint ptr %.064.lcssa to i64
  %16 = sub i64 %4, %15
  %17 = trunc i64 %16 to i32
  %.not81 = icmp eq i32 %17, 0
  br i1 %.not81, label %19, label %.preheader

.critedge.thread:                                 ; preds = %7
  %18 = trunc i64 %10 to i32
  %.not8191 = icmp eq i32 %18, 0
  br i1 %.not8191, label %19, label %.critedge3

19:                                               ; preds = %.critedge.thread, %.critedge
  store ptr null, ptr %5, align 8, !tbaa !5
  br label %.thread99

.preheader:                                       ; preds = %.critedge
  %.069103 = add nsw i32 %17, -1
  %.not83104 = icmp eq i32 %.069103, 0
  br i1 %.not83104, label %.critedge3, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %20 = sext i32 %.069103 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.critedge5
  %indvars.iv = phi i64 [ %20, %.lr.ph.preheader ], [ %indvars.iv.next, %.critedge5 ]
  %.069.in105 = phi i32 [ %17, %.lr.ph.preheader ], [ %23, %.critedge5 ]
  %21 = getelementptr inbounds i8, ptr %.064.lcssa, i64 %indvars.iv
  %22 = load i8, ptr %21, align 1, !tbaa !12
  switch i8 %22, label %.critedge3 [
    i8 10, label %.critedge5
    i8 32, label %.critedge5
    i8 9, label %.critedge5
    i8 13, label %.critedge5
  ]

.critedge5:                                       ; preds = %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %.not83 = icmp eq i64 %indvars.iv.next, 0
  %23 = trunc nsw i64 %indvars.iv to i32
  br i1 %.not83, label %.critedge3, label %.lr.ph, !llvm.loop !15

.critedge3:                                       ; preds = %.critedge5, %.lr.ph, %.preheader, %.critedge.thread
  %.1659294 = phi ptr [ %6, %.critedge.thread ], [ %.064.lcssa, %.preheader ], [ %.064.lcssa, %.lr.ph ], [ %.064.lcssa, %.critedge5 ]
  %.170 = phi i32 [ %18, %.critedge.thread ], [ 1, %.preheader ], [ 1, %.critedge5 ], [ %.069.in105, %.lr.ph ]
  %24 = tail call noundef ptr @_Z13fromXMLStringPKciP3XML(ptr noundef nonnull %.1659294, i32 noundef %.170, ptr noundef %1)
  %.not84 = icmp eq ptr %24, null
  br i1 %.not84, label %.thread99, label %25

25:                                               ; preds = %.critedge3
  store ptr null, ptr %5, align 8, !tbaa !5
  %26 = load i8, ptr @_ZL28removeCommentsInMiddleOfText, align 1, !tbaa !12
  %.not85 = icmp eq i8 %26, 0
  br i1 %.not85, label %.thread95, label %27

27:                                               ; preds = %25
  %28 = load ptr, ptr %0, align 8, !tbaa !16
  %29 = getelementptr inbounds i8, ptr %28, i64 12
  %30 = load i32, ptr %29, align 4, !tbaa !18
  %.not86 = icmp eq i32 %30, 0
  br i1 %.not86, label %.thread95, label %31

31:                                               ; preds = %27
  %32 = getelementptr inbounds i8, ptr %28, i64 16
  %33 = load i32, ptr %32, align 8, !tbaa !20
  %.not87 = icmp eq i32 %33, 0
  br i1 %.not87, label %.thread95, label %34

34:                                               ; preds = %31
  %35 = getelementptr inbounds i8, ptr %28, i64 8
  %36 = load i32, ptr %35, align 8, !tbaa !21
  %37 = add i32 %33, %30
  %38 = add i32 %37, %36
  %39 = getelementptr inbounds i8, ptr %28, i64 72
  %40 = load ptr, ptr %39, align 8, !tbaa !22
  %41 = sext i32 %38 to i64
  %42 = getelementptr i32, ptr %40, i64 %41
  %43 = getelementptr i8, ptr %42, i64 -4
  %44 = load i32, ptr %43, align 4, !tbaa !23
  %45 = and i32 %44, 3
  %46 = icmp eq i32 %45, 3
  br i1 %46, label %47, label %.thread95

47:                                               ; preds = %34
  %48 = getelementptr i8, ptr %42, i64 -8
  %49 = load i32, ptr %48, align 4, !tbaa !23
  %50 = and i32 %49, 3
  %51 = icmp eq i32 %50, 2
  br i1 %51, label %52, label %.thread95

52:                                               ; preds = %47
  %53 = ashr i32 %44, 2
  %54 = getelementptr inbounds i8, ptr %28, i64 56
  %55 = load ptr, ptr %54, align 8, !tbaa !24
  %56 = sext i32 %53 to i64
  %57 = getelementptr inbounds %struct.XMLClear, ptr %55, i64 %56, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !25
  %59 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZL12XMLClearTags, i64 48), align 16, !tbaa !27
  %.not89 = icmp eq ptr %58, %59
  br i1 %.not89, label %60, label %.thread95

60:                                               ; preds = %52
  tail call void @_ZN7XMLNode11deleteClearEi(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef %53)
  %61 = load i32, ptr %48, align 4, !tbaa !23
  %62 = ashr i32 %61, 2
  %63 = load ptr, ptr %0, align 8, !tbaa !16
  %64 = getelementptr inbounds i8, ptr %63, i64 48
  %65 = load ptr, ptr %64, align 8, !tbaa !29
  %66 = sext i32 %62 to i64
  %67 = getelementptr inbounds ptr, ptr %65, i64 %66
  %68 = load ptr, ptr %67, align 8, !tbaa !30
  %69 = tail call noundef i32 @_ZL7xstrlenPKc(ptr noundef %68)
  %70 = tail call noundef i32 @_ZL7xstrlenPKc(ptr noundef nonnull %24)
  %71 = add nsw i32 %70, 1
  %72 = load ptr, ptr %0, align 8, !tbaa !16
  %73 = getelementptr inbounds i8, ptr %72, i64 48
  %74 = load ptr, ptr %73, align 8, !tbaa !29
  %75 = getelementptr inbounds ptr, ptr %74, i64 %66
  %76 = load ptr, ptr %75, align 8, !tbaa !30
  %77 = add nsw i32 %71, %69
  %78 = sext i32 %77 to i64
  %79 = tail call ptr @realloc(ptr noundef %76, i64 noundef %78) #5
  %80 = load ptr, ptr %0, align 8, !tbaa !16
  %81 = getelementptr inbounds i8, ptr %80, i64 48
  %82 = load ptr, ptr %81, align 8, !tbaa !29
  %83 = getelementptr inbounds ptr, ptr %82, i64 %66
  store ptr %79, ptr %83, align 8, !tbaa !30
  %84 = load ptr, ptr %0, align 8, !tbaa !16
  %85 = getelementptr inbounds i8, ptr %84, i64 48
  %86 = load ptr, ptr %85, align 8, !tbaa !29
  %87 = getelementptr inbounds ptr, ptr %86, i64 %66
  %88 = load ptr, ptr %87, align 8, !tbaa !30
  %.not88 = icmp eq ptr %88, null
  br i1 %.not88, label %.thread99, label %89

89:                                               ; preds = %60
  %90 = sext i32 %69 to i64
  %91 = getelementptr inbounds i8, ptr %88, i64 %90
  %92 = sext i32 %71 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %91, ptr nonnull align 1 %24, i64 %92, i1 false)
  tail call void @free(ptr noundef nonnull %24) #6
  br label %.thread99

.thread95:                                        ; preds = %34, %47, %52, %31, %27, %25
  %93 = tail call noundef ptr @_ZN7XMLNode12addText_privEiPci(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef 50, ptr noundef nonnull %24, i32 noundef -1)
  br label %.thread99

.thread99:                                        ; preds = %89, %60, %19, %.critedge3, %.thread95, %3
  %.6 = phi i8 [ 0, %3 ], [ 0, %19 ], [ 0, %.thread95 ], [ 1, %.critedge3 ], [ 1, %60 ], [ 0, %89 ]
  ret i8 %.6
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7XMLNode11deleteClearEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind allocsize(1) }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 8}
!6 = !{!"_ZTS3XML", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !11, i64 24, !7, i64 32, !10, i64 40, !7, i64 48, !10, i64 56, !10, i64 60}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTS8XMLError", !8, i64 0}
!12 = !{!8, !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !7, i64 0}
!17 = !{!"_ZTS7XMLNode", !7, i64 0}
!18 = !{!19, !10, i64 12}
!19 = !{!"_ZTSN7XMLNode14XMLNodeDataTagE", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !8, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !10, i64 80}
!20 = !{!19, !10, i64 16}
!21 = !{!19, !10, i64 8}
!22 = !{!19, !7, i64 72}
!23 = !{!10, !10, i64 0}
!24 = !{!19, !7, i64 56}
!25 = !{!26, !7, i64 8}
!26 = !{!"_ZTS8XMLClear", !7, i64 0, !7, i64 8, !7, i64 16}
!27 = !{!28, !7, i64 0}
!28 = !{!"_ZTS14ALLXMLClearTag", !7, i64 0, !10, i64 8, !7, i64 16}
!29 = !{!19, !7, i64 48}
!30 = !{!7, !7, i64 0}


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