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

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

; 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: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZL6myFreePv(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7XMLNode16detachFromParentEPNS_14XMLNodeDataTagE(ptr noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7XMLNode12emptyTheNodeEc(ptr noundef nonnull align 8 dereferenceable(8) %0, i8 noundef signext %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i8 %1, ptr %4, align 1, !tbaa !9
  %8 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %9 = getelementptr inbounds %struct.XMLNode, ptr %8, i32 0, i32 0
  %10 = load ptr, ptr %9, align 8, !tbaa !10
  store ptr %10, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %11, i32 0, i32 12
  %13 = load i32, ptr %12, align 8, !tbaa !12
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %18, label %15

15:                                               ; preds = %2
  %16 = load i8, ptr %4, align 1, !tbaa !9
  %17 = icmp ne i8 %16, 0
  br i1 %17, label %18, label %173

18:                                               ; preds = %15, %2
  %19 = getelementptr inbounds %struct.XMLNode, ptr %8, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !10
  %21 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %20, i32 0, i32 6
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %28

24:                                               ; preds = %18
  %25 = getelementptr inbounds %struct.XMLNode, ptr %8, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !10
  %27 = call noundef i32 @_ZN7XMLNode16detachFromParentEPNS_14XMLNodeDataTagE(ptr noundef %26)
  br label %28

28:                                               ; preds = %24, %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i32 0, ptr %6, align 4, !tbaa !16
  br label %29

29:                                               ; preds = %54, %28
  %30 = load i32, ptr %6, align 4, !tbaa !16
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %31, i32 0, i32 1
  %33 = load i32, ptr %32, align 8, !tbaa !17
  %34 = icmp slt i32 %30, %33
  br i1 %34, label %35, label %57

35:                                               ; preds = %29
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %36, i32 0, i32 7
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = load i32, ptr %6, align 4, !tbaa !16
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds %struct.XMLNode, ptr %38, i64 %40
  store ptr %41, ptr %7, align 8, !tbaa !5
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.XMLNode, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !10
  %45 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %44, i32 0, i32 6
  store ptr null, ptr %45, align 8, !tbaa !15
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.XMLNode, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !10
  %49 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %48, i32 0, i32 12
  %50 = load i32, ptr %49, align 8, !tbaa !12
  %51 = add nsw i32 %50, -1
  store i32 %51, ptr %49, align 8, !tbaa !12
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load i8, ptr %4, align 1, !tbaa !9
  call void @_ZN7XMLNode12emptyTheNodeEc(ptr noundef nonnull align 8 dereferenceable(8) %52, i8 noundef signext %53)
  br label %54

54:                                               ; preds = %35
  %55 = load i32, ptr %6, align 4, !tbaa !16
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %6, align 4, !tbaa !16
  br label %29, !llvm.loop !19

57:                                               ; preds = %29
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %58, i32 0, i32 7
  %60 = load ptr, ptr %59, align 8, !tbaa !18
  call void @_ZL6myFreePv(ptr noundef %60)
  store i32 0, ptr %6, align 4, !tbaa !16
  br label %61

61:                                               ; preds = %75, %57
  %62 = load i32, ptr %6, align 4, !tbaa !16
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %63, i32 0, i32 2
  %65 = load i32, ptr %64, align 4, !tbaa !21
  %66 = icmp slt i32 %62, %65
  br i1 %66, label %67, label %78

67:                                               ; preds = %61
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %68, i32 0, i32 8
  %70 = load ptr, ptr %69, align 8, !tbaa !22
  %71 = load i32, ptr %6, align 4, !tbaa !16
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds ptr, ptr %70, i64 %72
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  call void @free(ptr noundef %74) #4
  br label %75

75:                                               ; preds = %67
  %76 = load i32, ptr %6, align 4, !tbaa !16
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %6, align 4, !tbaa !16
  br label %61, !llvm.loop !23

78:                                               ; preds = %61
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %79, i32 0, i32 8
  %81 = load ptr, ptr %80, align 8, !tbaa !22
  call void @_ZL6myFreePv(ptr noundef %81)
  store i32 0, ptr %6, align 4, !tbaa !16
  br label %82

82:                                               ; preds = %97, %78
  %83 = load i32, ptr %6, align 4, !tbaa !16
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %84, i32 0, i32 3
  %86 = load i32, ptr %85, align 8, !tbaa !24
  %87 = icmp slt i32 %83, %86
  br i1 %87, label %88, label %100

88:                                               ; preds = %82
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %89, i32 0, i32 9
  %91 = load ptr, ptr %90, align 8, !tbaa !25
  %92 = load i32, ptr %6, align 4, !tbaa !16
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds %struct.XMLClear, ptr %91, i64 %93
  %95 = getelementptr inbounds %struct.XMLClear, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8, !tbaa !26
  call void @free(ptr noundef %96) #4
  br label %97

97:                                               ; preds = %88
  %98 = load i32, ptr %6, align 4, !tbaa !16
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %6, align 4, !tbaa !16
  br label %82, !llvm.loop !28

100:                                              ; preds = %82
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %101, i32 0, i32 9
  %103 = load ptr, ptr %102, align 8, !tbaa !25
  call void @_ZL6myFreePv(ptr noundef %103)
  store i32 0, ptr %6, align 4, !tbaa !16
  br label %104

104:                                              ; preds = %138, %100
  %105 = load i32, ptr %6, align 4, !tbaa !16
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %106, i32 0, i32 4
  %108 = load i32, ptr %107, align 4, !tbaa !29
  %109 = icmp slt i32 %105, %108
  br i1 %109, label %110, label %141

110:                                              ; preds = %104
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %111, i32 0, i32 10
  %113 = load ptr, ptr %112, align 8, !tbaa !30
  %114 = load i32, ptr %6, align 4, !tbaa !16
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds %struct.XMLAttribute, ptr %113, i64 %115
  %117 = getelementptr inbounds %struct.XMLAttribute, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8, !tbaa !31
  call void @free(ptr noundef %118) #4
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %119, i32 0, i32 10
  %121 = load ptr, ptr %120, align 8, !tbaa !30
  %122 = load i32, ptr %6, align 4, !tbaa !16
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds %struct.XMLAttribute, ptr %121, i64 %123
  %125 = getelementptr inbounds %struct.XMLAttribute, ptr %124, i32 0, i32 1
  %126 = load ptr, ptr %125, align 8, !tbaa !33
  %127 = icmp ne ptr %126, null
  br i1 %127, label %128, label %137

128:                                              ; preds = %110
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %129, i32 0, i32 10
  %131 = load ptr, ptr %130, align 8, !tbaa !30
  %132 = load i32, ptr %6, align 4, !tbaa !16
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds %struct.XMLAttribute, ptr %131, i64 %133
  %135 = getelementptr inbounds %struct.XMLAttribute, ptr %134, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !33
  call void @free(ptr noundef %136) #4
  br label %137

137:                                              ; preds = %128, %110
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %6, align 4, !tbaa !16
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %6, align 4, !tbaa !16
  br label %104, !llvm.loop !34

141:                                              ; preds = %104
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %142, i32 0, i32 10
  %144 = load ptr, ptr %143, align 8, !tbaa !30
  call void @_ZL6myFreePv(ptr noundef %144)
  %145 = load ptr, ptr %5, align 8, !tbaa !5
  %146 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %145, i32 0, i32 11
  %147 = load ptr, ptr %146, align 8, !tbaa !35
  call void @_ZL6myFreePv(ptr noundef %147)
  %148 = load ptr, ptr %5, align 8, !tbaa !5
  %149 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %148, i32 0, i32 0
  %150 = load ptr, ptr %149, align 8, !tbaa !36
  call void @_ZL6myFreePv(ptr noundef %150)
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %151, i32 0, i32 1
  store i32 0, ptr %152, align 8, !tbaa !17
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %153, i32 0, i32 2
  store i32 0, ptr %154, align 4, !tbaa !21
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  %156 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %155, i32 0, i32 3
  store i32 0, ptr %156, align 8, !tbaa !24
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %157, i32 0, i32 4
  store i32 0, ptr %158, align 4, !tbaa !29
  %159 = load ptr, ptr %5, align 8, !tbaa !5
  %160 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %159, i32 0, i32 7
  store ptr null, ptr %160, align 8, !tbaa !18
  %161 = load ptr, ptr %5, align 8, !tbaa !5
  %162 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %161, i32 0, i32 8
  store ptr null, ptr %162, align 8, !tbaa !22
  %163 = load ptr, ptr %5, align 8, !tbaa !5
  %164 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %163, i32 0, i32 9
  store ptr null, ptr %164, align 8, !tbaa !25
  %165 = load ptr, ptr %5, align 8, !tbaa !5
  %166 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %165, i32 0, i32 10
  store ptr null, ptr %166, align 8, !tbaa !30
  %167 = load ptr, ptr %5, align 8, !tbaa !5
  %168 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %167, i32 0, i32 11
  store ptr null, ptr %168, align 8, !tbaa !35
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %169, i32 0, i32 0
  store ptr null, ptr %170, align 8, !tbaa !36
  %171 = load ptr, ptr %5, align 8, !tbaa !5
  %172 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %171, i32 0, i32 6
  store ptr null, ptr %172, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %173

173:                                              ; preds = %141, %15
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = getelementptr inbounds %"struct.XMLNode::XMLNodeDataTag", ptr %174, i32 0, i32 12
  %176 = load i32, ptr %175, align 8, !tbaa !12
  %177 = icmp eq i32 %176, 0
  br i1 %177, label %178, label %181

178:                                              ; preds = %173
  %179 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %179) #4
  %180 = getelementptr inbounds %struct.XMLNode, ptr %8, i32 0, i32 0
  store ptr null, ptr %180, align 8, !tbaa !10
  br label %181

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

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 = { 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 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 }

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.XMLNode = type { ptr }
%struct.XMLClear = type { ptr, ptr, ptr }
%struct.XMLAttribute = type { ptr, ptr }

; 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: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZL6myFreePv(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7XMLNode16detachFromParentEPNS_14XMLNodeDataTagE(ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7XMLNode12emptyTheNodeEc(ptr nocapture noundef nonnull align 8 dereferenceable(8) %0, i8 noundef signext %1) local_unnamed_addr #2 align 2 {
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 80
  %5 = load i32, ptr %4, align 8, !tbaa !10
  %6 = icmp eq i32 %5, 0
  %7 = icmp ne i8 %1, 0
  %or.cond = or i1 %7, %6
  br i1 %or.cond, label %8, label %.thread

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %3, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %13, label %11

11:                                               ; preds = %8
  %12 = tail call noundef i32 @_ZN7XMLNode16detachFromParentEPNS_14XMLNodeDataTagE(ptr noundef nonnull %3)
  br label %13

13:                                               ; preds = %11, %8
  %14 = getelementptr inbounds i8, ptr %3, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !14
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %13
  %17 = getelementptr inbounds i8, ptr %3, i64 40
  br label %18

18:                                               ; preds = %.lr.ph, %18
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %18 ]
  %19 = load ptr, ptr %17, align 8, !tbaa !15
  %20 = getelementptr inbounds %struct.XMLNode, ptr %19, i64 %indvars.iv
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 32
  store ptr null, ptr %22, align 8, !tbaa !13
  %23 = getelementptr inbounds i8, ptr %21, i64 80
  %24 = load i32, ptr %23, align 8, !tbaa !10
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr %23, align 8, !tbaa !10
  tail call void @_ZN7XMLNode12emptyTheNodeEc(ptr noundef nonnull align 8 dereferenceable(8) %20, i8 noundef signext %1)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = load i32, ptr %14, align 8, !tbaa !14
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next, %27
  br i1 %28, label %18, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %18, %13
  %29 = getelementptr inbounds i8, ptr %3, i64 40
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  tail call void @_ZL6myFreePv(ptr noundef %30)
  %31 = getelementptr inbounds i8, ptr %3, i64 12
  %32 = load i32, ptr %31, align 4, !tbaa !18
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph58, label %._crit_edge59

.lr.ph58:                                         ; preds = %._crit_edge
  %34 = getelementptr inbounds i8, ptr %3, i64 48
  br label %35

35:                                               ; preds = %.lr.ph58, %35
  %indvars.iv69 = phi i64 [ 0, %.lr.ph58 ], [ %indvars.iv.next70, %35 ]
  %36 = load ptr, ptr %34, align 8, !tbaa !19
  %37 = getelementptr inbounds ptr, ptr %36, i64 %indvars.iv69
  %38 = load ptr, ptr %37, align 8, !tbaa !20
  tail call void @free(ptr noundef %38) #4
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %39 = load i32, ptr %31, align 4, !tbaa !18
  %40 = sext i32 %39 to i64
  %41 = icmp slt i64 %indvars.iv.next70, %40
  br i1 %41, label %35, label %._crit_edge59, !llvm.loop !21

._crit_edge59:                                    ; preds = %35, %._crit_edge
  %42 = getelementptr inbounds i8, ptr %3, i64 48
  %43 = load ptr, ptr %42, align 8, !tbaa !19
  tail call void @_ZL6myFreePv(ptr noundef %43)
  %44 = getelementptr inbounds i8, ptr %3, i64 16
  %45 = load i32, ptr %44, align 8, !tbaa !22
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph62, label %._crit_edge63

.lr.ph62:                                         ; preds = %._crit_edge59
  %47 = getelementptr inbounds i8, ptr %3, i64 56
  br label %48

48:                                               ; preds = %.lr.ph62, %48
  %indvars.iv72 = phi i64 [ 0, %.lr.ph62 ], [ %indvars.iv.next73, %48 ]
  %49 = load ptr, ptr %47, align 8, !tbaa !23
  %50 = getelementptr inbounds %struct.XMLClear, ptr %49, i64 %indvars.iv72
  %51 = load ptr, ptr %50, align 8, !tbaa !24
  tail call void @free(ptr noundef %51) #4
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %52 = load i32, ptr %44, align 8, !tbaa !22
  %53 = sext i32 %52 to i64
  %54 = icmp slt i64 %indvars.iv.next73, %53
  br i1 %54, label %48, label %._crit_edge63, !llvm.loop !26

._crit_edge63:                                    ; preds = %48, %._crit_edge59
  %55 = getelementptr inbounds i8, ptr %3, i64 56
  %56 = load ptr, ptr %55, align 8, !tbaa !23
  tail call void @_ZL6myFreePv(ptr noundef %56)
  %57 = getelementptr inbounds i8, ptr %3, i64 20
  %58 = load i32, ptr %57, align 4, !tbaa !27
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %.lr.ph66, label %._crit_edge67

.lr.ph66:                                         ; preds = %._crit_edge63
  %60 = getelementptr inbounds i8, ptr %3, i64 64
  br label %61

61:                                               ; preds = %.lr.ph66, %69
  %indvars.iv75 = phi i64 [ 0, %.lr.ph66 ], [ %indvars.iv.next76, %69 ]
  %62 = load ptr, ptr %60, align 8, !tbaa !28
  %63 = getelementptr inbounds %struct.XMLAttribute, ptr %62, i64 %indvars.iv75
  %64 = load ptr, ptr %63, align 8, !tbaa !29
  tail call void @free(ptr noundef %64) #4
  %65 = load ptr, ptr %60, align 8, !tbaa !28
  %66 = getelementptr inbounds %struct.XMLAttribute, ptr %65, i64 %indvars.iv75, i32 1
  %67 = load ptr, ptr %66, align 8, !tbaa !31
  %.not51 = icmp eq ptr %67, null
  br i1 %.not51, label %69, label %68

68:                                               ; preds = %61
  tail call void @free(ptr noundef nonnull %67) #4
  br label %69

69:                                               ; preds = %61, %68
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %70 = load i32, ptr %57, align 4, !tbaa !27
  %71 = sext i32 %70 to i64
  %72 = icmp slt i64 %indvars.iv.next76, %71
  br i1 %72, label %61, label %._crit_edge67, !llvm.loop !32

._crit_edge67:                                    ; preds = %69, %._crit_edge63
  %73 = getelementptr inbounds i8, ptr %3, i64 64
  %74 = load ptr, ptr %73, align 8, !tbaa !28
  tail call void @_ZL6myFreePv(ptr noundef %74)
  %75 = getelementptr inbounds i8, ptr %3, i64 72
  %76 = load ptr, ptr %75, align 8, !tbaa !33
  tail call void @_ZL6myFreePv(ptr noundef %76)
  %77 = load ptr, ptr %3, align 8, !tbaa !34
  tail call void @_ZL6myFreePv(ptr noundef %77)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %9, i8 0, i64 48, i1 false)
  %.pr = load i32, ptr %4, align 8, !tbaa !10
  %78 = icmp eq i32 %.pr, 0
  br i1 %78, label %79, label %.thread

79:                                               ; preds = %._crit_edge67
  tail call void @free(ptr noundef nonnull %3) #4
  store ptr null, ptr %0, align 8, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %2, %79, %._crit_edge67
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { 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 #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 0}
!6 = !{!"_ZTS7XMLNode", !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !12, i64 80}
!11 = !{!"_ZTSN7XMLNode14XMLNodeDataTagE", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !8, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !12, i64 80}
!12 = !{!"int", !8, i64 0}
!13 = !{!11, !7, i64 32}
!14 = !{!11, !12, i64 8}
!15 = !{!11, !7, i64 40}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!11, !12, i64 12}
!19 = !{!11, !7, i64 48}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !17}
!22 = !{!11, !12, i64 16}
!23 = !{!11, !7, i64 56}
!24 = !{!25, !7, i64 0}
!25 = !{!"_ZTS8XMLClear", !7, i64 0, !7, i64 8, !7, i64 16}
!26 = distinct !{!26, !17}
!27 = !{!11, !12, i64 20}
!28 = !{!11, !7, i64 64}
!29 = !{!30, !7, i64 0}
!30 = !{!"_ZTS12XMLAttribute", !7, i64 0, !7, i64 8}
!31 = !{!30, !7, i64 8}
!32 = distinct !{!32, !17}
!33 = !{!11, !7, i64 72}
!34 = !{!11, !7, i64 0}


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