; LLVM IR from ETH3D/dataset-pipeline :: thirdparty/tinyxml2/tinyxml2.ll (ZN8tinyxml210XMLElement9ParseDeepEPcPNS_7StrPairE)

; 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::XMLElement" = type { %"class.tinyxml2::XMLNode", i32, ptr }
%"class.tinyxml2::XMLNode" = type { ptr, ptr, ptr, %"class.tinyxml2::StrPair", ptr, ptr, ptr, ptr, ptr }
%"class.tinyxml2::StrPair" = type { i32, ptr, ptr }

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN8tinyxml27XMLUtil14SkipWhiteSpaceEPc(ptr noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN8tinyxml27XMLNode9ParseDeepEPcPNS_7StrPairE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef, ptr noundef) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN8tinyxml210XMLElement15ParseAttributesEPc(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN8tinyxml210XMLElement9ParseDeepEPcPNS_7StrPairE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  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
  %8 = load ptr, ptr %5, align 8
  %9 = load ptr, ptr %6, align 8, !tbaa !5
  %10 = call noundef ptr @_ZN8tinyxml27XMLUtil14SkipWhiteSpaceEPc(ptr noundef %9)
  store ptr %10, ptr %6, align 8, !tbaa !5
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = load i8, ptr %11, align 1, !tbaa !9
  %13 = sext i8 %12 to i32
  %14 = icmp eq i32 %13, 47
  br i1 %14, label %15, label %19

15:                                               ; preds = %3
  %16 = getelementptr inbounds %"class.tinyxml2::XMLElement", ptr %8, i32 0, i32 1
  store i32 2, ptr %16, align 8, !tbaa !10
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i32 1
  store ptr %18, ptr %6, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %15, %3
  %20 = getelementptr inbounds %"class.tinyxml2::XMLNode", ptr %8, i32 0, i32 3
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = call noundef ptr @_ZN8tinyxml27StrPair9ParseNameEPc(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef %21)
  store ptr %22, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.tinyxml2::XMLNode", ptr %8, i32 0, i32 3
  %24 = call noundef zeroext i1 @_ZNK8tinyxml27StrPair5EmptyEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  br i1 %24, label %25, label %26

25:                                               ; preds = %19
  store ptr null, ptr %4, align 8
  br label %46

26:                                               ; preds = %19
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = call noundef ptr @_ZN8tinyxml210XMLElement15ParseAttributesEPc(ptr noundef nonnull align 8 dereferenceable(104) %8, ptr noundef %27)
  store ptr %28, ptr %6, align 8, !tbaa !5
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %39

31:                                               ; preds = %26
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = load i8, ptr %32, align 1, !tbaa !9
  %34 = icmp ne i8 %33, 0
  br i1 %34, label %35, label %39

35:                                               ; preds = %31
  %36 = getelementptr inbounds %"class.tinyxml2::XMLElement", ptr %8, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !10
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %41

39:                                               ; preds = %35, %31, %26
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %40, ptr %4, align 8
  br label %46

41:                                               ; preds = %35
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = call noundef ptr @_ZN8tinyxml27XMLNode9ParseDeepEPcPNS_7StrPairE(ptr noundef nonnull align 8 dereferenceable(88) %8, ptr noundef %42, ptr noundef %43)
  store ptr %44, ptr %6, align 8, !tbaa !5
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %45, ptr %4, align 8
  br label %46

46:                                               ; preds = %41, %39, %25
  %47 = load ptr, ptr %4, align 8
  ret ptr %47
}

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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !14, i64 88}
!11 = !{!"_ZTSN8tinyxml210XMLElementE", !12, i64 0, !14, i64 88, !6, i64 96}
!12 = !{!"_ZTSN8tinyxml27XMLNodeE", !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!13 = !{!"_ZTSN8tinyxml27StrPairE", !14, i64 0, !6, i64 8, !6, i64 16}
!14 = !{!"int", !7, 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"

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN8tinyxml27XMLNode9ParseDeepEPcPNS_7StrPairE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef, ptr noundef) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN8tinyxml210XMLElement9ParseDeepEPcPNS_7StrPairE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #0 align 2 {
  %4 = tail call noundef ptr @_ZN8tinyxml27XMLUtil14SkipWhiteSpaceEPc(ptr noundef %1)
  %5 = load i8, ptr %4, align 1, !tbaa !5
  %6 = icmp eq i8 %5, 47
  br i1 %6, label %7, label %10

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 2, ptr %8, align 8, !tbaa !8
  %9 = getelementptr inbounds i8, ptr %4, i64 1
  br label %10

10:                                               ; preds = %7, %3
  %.013 = phi ptr [ %9, %7 ], [ %4, %3 ]
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = tail call noundef ptr @_ZN8tinyxml27StrPair9ParseNameEPc(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull %.013)
  %13 = tail call noundef zeroext i1 @_ZNK8tinyxml27StrPair5EmptyEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
  br i1 %13, label %22, label %14

14:                                               ; preds = %10
  %15 = tail call noundef ptr @_ZN8tinyxml210XMLElement15ParseAttributesEPc(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %12)
  %.not = icmp eq ptr %15, null
  br i1 %.not, label %22, label %16

16:                                               ; preds = %14
  %17 = load i8, ptr %15, align 1, !tbaa !5
  %.not15 = icmp ne i8 %17, 0
  %18 = getelementptr inbounds i8, ptr %0, i64 88
  %19 = load i32, ptr %18, align 8
  %.not16 = icmp eq i32 %19, 0
  %or.cond = select i1 %.not15, i1 %.not16, i1 false
  br i1 %or.cond, label %20, label %22

20:                                               ; preds = %16
  %21 = tail call noundef ptr @_ZN8tinyxml27XMLNode9ParseDeepEPcPNS_7StrPairE(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull %15, ptr noundef %2)
  br label %22

22:                                               ; preds = %14, %16, %10, %20
  %.0 = phi ptr [ %21, %20 ], [ null, %10 ], [ %15, %16 ], [ null, %14 ]
  ret ptr %.0
}

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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !13, i64 88}
!9 = !{!"_ZTSN8tinyxml210XMLElementE", !10, i64 0, !13, i64 88, !11, i64 96}
!10 = !{!"_ZTSN8tinyxml27XMLNodeE", !11, i64 8, !11, i64 16, !12, i64 24, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80}
!11 = !{!"any pointer", !6, i64 0}
!12 = !{!"_ZTSN8tinyxml27StrPairE", !13, i64 0, !11, i64 8, !11, i64 16}
!13 = !{!"int", !6, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass