; LLVM IR from facebookresearch/habitat-sim :: src/deps/tinyxml2 (tinyxml2)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.tinyxml2::XMLPrinter" = type { %"class.tinyxml2::XMLVisitor", i8, %"class.tinyxml2::DynArray.7", i8, ptr, i32, i32, i8, i8, [64 x i8], [64 x i8], [6 x i8], %"class.tinyxml2::DynArray.8" }
%"class.tinyxml2::XMLVisitor" = type { ptr }
%"class.tinyxml2::DynArray.7" = type { ptr, [10 x ptr], i32, i32 }
%"class.tinyxml2::DynArray.8" = type <{ ptr, [20 x i8], i32, i32, [4 x i8] }>

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8tinyxml210XMLPrinter11OpenElementEPKcb(ptr noundef nonnull align 8 dereferenceable(312), ptr noundef, i1 noundef zeroext) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8tinyxml210XMLPrinter13PushAttributeEPKcS2_(ptr noundef nonnull align 8 dereferenceable(312), ptr noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8tinyxml210XMLPrinter10VisitEnterERKNS_10XMLElementEPKNS_12XMLAttributeE(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr noundef nonnull align 8 dereferenceable(120) %1, ptr noundef %2) unnamed_addr #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store ptr null, ptr %7, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = call noundef ptr @_ZNK8tinyxml27XMLNode6ParentEv(ptr noundef nonnull align 8 dereferenceable(104) %10)
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %20

13:                                               ; preds = %3
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = call noundef ptr @_ZNK8tinyxml27XMLNode6ParentEv(ptr noundef nonnull align 8 dereferenceable(104) %14)
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds ptr, ptr %16, i64 6
  %18 = load ptr, ptr %17, align 8
  %19 = call noundef ptr %18(ptr noundef nonnull align 8 dereferenceable(104) %15)
  store ptr %19, ptr %7, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %13, %3
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %29

23:                                               ; preds = %20
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = load ptr, ptr %9, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 11
  %27 = load ptr, ptr %26, align 8
  %28 = call noundef zeroext i1 %27(ptr noundef nonnull align 8 dereferenceable(312) %9, ptr noundef nonnull align 8 dereferenceable(120) %24)
  br label %33

29:                                               ; preds = %20
  %30 = getelementptr inbounds %"class.tinyxml2::XMLPrinter", ptr %9, i32 0, i32 8
  %31 = load i8, ptr %30, align 1, !tbaa !11, !range !18, !noundef !19
  %32 = trunc i8 %31 to i1
  br label %33

33:                                               ; preds = %29, %23
  %34 = phi i1 [ %28, %23 ], [ %32, %29 ]
  %35 = zext i1 %34 to i8
  store i8 %35, ptr %8, align 1, !tbaa !20
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = call noundef ptr @_ZNK8tinyxml210XMLElement4NameEv(ptr noundef nonnull align 8 dereferenceable(120) %36)
  %38 = load i8, ptr %8, align 1, !tbaa !20, !range !18, !noundef !19
  %39 = trunc i8 %38 to i1
  call void @_ZN8tinyxml210XMLPrinter11OpenElementEPKcb(ptr noundef nonnull align 8 dereferenceable(312) %9, ptr noundef %37, i1 noundef zeroext %39)
  br label %40

40:                                               ; preds = %43, %33
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %50

43:                                               ; preds = %40
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call noundef ptr @_ZNK8tinyxml212XMLAttribute4NameEv(ptr noundef nonnull align 8 dereferenceable(80) %44)
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = call noundef ptr @_ZNK8tinyxml212XMLAttribute5ValueEv(ptr noundef nonnull align 8 dereferenceable(80) %46)
  call void @_ZN8tinyxml210XMLPrinter13PushAttributeEPKcS2_(ptr noundef nonnull align 8 dereferenceable(312) %9, ptr noundef %45, ptr noundef %47)
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = call noundef ptr @_ZNK8tinyxml212XMLAttribute4NextEv(ptr noundef nonnull align 8 dereferenceable(80) %48)
  store ptr %49, ptr %6, align 8, !tbaa !5
  br label %40, !llvm.loop !21

50:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret i1 true
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK8tinyxml27XMLNode6ParentEv(ptr noundef nonnull align 8 dereferenceable(104)) #2 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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !14, i64 137}
!12 = !{!"_ZTSN8tinyxml210XMLPrinterE", !13, i64 0, !14, i64 8, !15, i64 16, !14, i64 112, !6, i64 120, !16, i64 128, !16, i64 132, !14, i64 136, !14, i64 137, !7, i64 138, !7, i64 202, !17, i64 272}
!13 = !{!"_ZTSN8tinyxml210XMLVisitorE"}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSN8tinyxml28DynArrayIPKcLi10EEE", !6, i64 0, !7, i64 8, !16, i64 88, !16, i64 92}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSN8tinyxml28DynArrayIcLi20EEE", !6, i64 0, !7, i64 8, !16, i64 28, !16, i64 32}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!14, !14, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK8tinyxml210XMLElement4NameEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK8tinyxml212XMLAttribute4NameEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK8tinyxml212XMLAttribute5ValueEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8tinyxml210XMLPrinter11OpenElementEPKcb(ptr noundef nonnull align 8 dereferenceable(312), ptr noundef, i1 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8tinyxml210XMLPrinter13PushAttributeEPKcS2_(ptr noundef nonnull align 8 dereferenceable(312), ptr noundef, ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8tinyxml210XMLPrinter10VisitEnterERKNS_10XMLElementEPKNS_12XMLAttributeE(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr noundef nonnull align 8 dereferenceable(120) %1, ptr noundef %2) unnamed_addr #0 align 2 {
  %4 = tail call noundef ptr @_ZNK8tinyxml27XMLNode6ParentEv(ptr noundef nonnull align 8 dereferenceable(104) %1)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %.thread, label %5

5:                                                ; preds = %3
  %6 = tail call noundef ptr @_ZNK8tinyxml27XMLNode6ParentEv(ptr noundef nonnull align 8 dereferenceable(104) %1)
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 48
  %9 = load ptr, ptr %8, align 8
  %10 = tail call noundef ptr %9(ptr noundef nonnull align 8 dereferenceable(104) %6)
  %.not11 = icmp eq ptr %10, null
  br i1 %.not11, label %.thread, label %11

11:                                               ; preds = %5
  %12 = load ptr, ptr %0, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 88
  %14 = load ptr, ptr %13, align 8
  %15 = tail call noundef zeroext i1 %14(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr noundef nonnull align 8 dereferenceable(120) %10)
  br label %19

.thread:                                          ; preds = %3, %5
  %16 = getelementptr inbounds i8, ptr %0, i64 137
  %17 = load i8, ptr %16, align 1, !tbaa !8, !range !17, !noundef !18
  %18 = trunc nuw i8 %17 to i1
  br label %19

19:                                               ; preds = %.thread, %11
  %20 = phi i1 [ %15, %11 ], [ %18, %.thread ]
  %21 = tail call noundef ptr @_ZNK8tinyxml210XMLElement4NameEv(ptr noundef nonnull align 8 dereferenceable(120) %1)
  tail call void @_ZN8tinyxml210XMLPrinter11OpenElementEPKcb(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr noundef %21, i1 noundef zeroext %20)
  %.not1215 = icmp eq ptr %2, null
  br i1 %.not1215, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %19, %.lr.ph
  %.016 = phi ptr [ %24, %.lr.ph ], [ %2, %19 ]
  %22 = tail call noundef ptr @_ZNK8tinyxml212XMLAttribute4NameEv(ptr noundef nonnull align 8 dereferenceable(80) %.016)
  %23 = tail call noundef ptr @_ZNK8tinyxml212XMLAttribute5ValueEv(ptr noundef nonnull align 8 dereferenceable(80) %.016)
  tail call void @_ZN8tinyxml210XMLPrinter13PushAttributeEPKcS2_(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr noundef %22, ptr noundef %23)
  %24 = tail call noundef ptr @_ZNK8tinyxml212XMLAttribute4NextEv(ptr noundef nonnull align 8 dereferenceable(80) %.016)
  %.not12 = icmp eq ptr %24, null
  br i1 %.not12, label %._crit_edge, label %.lr.ph, !llvm.loop !19

._crit_edge:                                      ; preds = %.lr.ph, %19
  ret i1 true
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK8tinyxml27XMLNode6ParentEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #1 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 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" }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !11, i64 137}
!9 = !{!"_ZTSN8tinyxml210XMLPrinterE", !10, i64 0, !11, i64 8, !13, i64 16, !11, i64 112, !14, i64 120, !15, i64 128, !15, i64 132, !11, i64 136, !11, i64 137, !12, i64 138, !12, i64 202, !16, i64 272}
!10 = !{!"_ZTSN8tinyxml210XMLVisitorE"}
!11 = !{!"bool", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"_ZTSN8tinyxml28DynArrayIPKcLi10EEE", !14, i64 0, !12, i64 8, !15, i64 88, !15, i64 92}
!14 = !{!"any pointer", !12, i64 0}
!15 = !{!"int", !12, i64 0}
!16 = !{!"_ZTSN8tinyxml28DynArrayIcLi20EEE", !14, i64 0, !12, i64 8, !15, i64 28, !15, i64 32}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass