; LLVM IR from HiroIshida/tinyfk :: urdf_parser/tinyxml (tinyxmlparser)

; 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.TiXmlBase = type { ptr, %struct.TiXmlCursor, ptr }
%struct.TiXmlCursor = type { i32, i32 }
%class.TiXmlNode = type { %class.TiXmlBase, ptr, i32, ptr, ptr, %"class.std::__cxx11::basic_string", ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@.str.11 = external hidden unnamed_addr constant [1 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: 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 void @_ZN16TiXmlParsingData5StampEPKc13TiXmlEncoding(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef, i32 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #2 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNK16TiXmlParsingData6CursorEv(ptr noundef nonnull align 8 dereferenceable(20)) #1 align 2

; 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) #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN12TiXmlUnknown5ParseEPKcP16TiXmlParsingData13TiXmlEncoding(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) unnamed_addr #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  %12 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %13 = call noundef ptr @_ZN9TiXmlNode11GetDocumentEv(ptr noundef nonnull align 8 dereferenceable(104) %12)
  store ptr %13, ptr %10, align 8, !tbaa !5
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = load i32, ptr %9, align 4, !tbaa !9
  %16 = call noundef ptr @_ZN9TiXmlBase14SkipWhiteSpaceEPKc13TiXmlEncoding(ptr noundef %14, i32 noundef %15)
  store ptr %16, ptr %7, align 8, !tbaa !5
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %26

19:                                               ; preds = %4
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = load i32, ptr %9, align 4, !tbaa !9
  call void @_ZN16TiXmlParsingData5StampEPKc13TiXmlEncoding(ptr noundef nonnull align 8 dereferenceable(20) %20, ptr noundef %21, i32 noundef %22)
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK16TiXmlParsingData6CursorEv(ptr noundef nonnull align 8 dereferenceable(20) %23)
  %25 = getelementptr inbounds %class.TiXmlBase, ptr %12, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %25, ptr align 4 %24, i64 8, i1 false), !tbaa.struct !11
  br label %26

26:                                               ; preds = %19, %4
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %38

29:                                               ; preds = %26
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = load i8, ptr %30, align 1, !tbaa !14
  %32 = icmp ne i8 %31, 0
  br i1 %32, label %33, label %38

33:                                               ; preds = %29
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load i8, ptr %34, align 1, !tbaa !14
  %36 = sext i8 %35 to i32
  %37 = icmp ne i32 %36, 60
  br i1 %37, label %38, label %47

38:                                               ; preds = %33, %29, %26
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %46

41:                                               ; preds = %38
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = load i32, ptr %9, align 4, !tbaa !9
  call void @_ZN13TiXmlDocument8SetErrorEiPKcP16TiXmlParsingData13TiXmlEncoding(ptr noundef nonnull align 8 dereferenceable(157) %42, i32 noundef 9, ptr noundef %43, ptr noundef %44, i32 noundef %45)
  br label %46

46:                                               ; preds = %41, %38
  store ptr null, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %96

47:                                               ; preds = %33
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i32 1
  store ptr %49, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %class.TiXmlNode, ptr %12, i32 0, i32 5
  %51 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %50, ptr noundef @.str.11)
  br label %52

52:                                               ; preds = %66, %47
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %64

55:                                               ; preds = %52
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = load i8, ptr %56, align 1, !tbaa !14
  %58 = icmp ne i8 %57, 0
  br i1 %58, label %59, label %64

59:                                               ; preds = %55
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = load i8, ptr %60, align 1, !tbaa !14
  %62 = sext i8 %61 to i32
  %63 = icmp ne i32 %62, 62
  br label %64

64:                                               ; preds = %59, %55, %52
  %65 = phi i1 [ false, %55 ], [ false, %52 ], [ %63, %59 ]
  br i1 %65, label %66, label %73

66:                                               ; preds = %64
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = load i8, ptr %67, align 1, !tbaa !14
  %69 = getelementptr inbounds %class.TiXmlNode, ptr %12, i32 0, i32 5
  %70 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %69, i8 noundef signext %68)
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i32 1
  store ptr %72, ptr %7, align 8, !tbaa !5
  br label %52, !llvm.loop !15

73:                                               ; preds = %64
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %83, label %76

76:                                               ; preds = %73
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = icmp ne ptr %77, null
  br i1 %78, label %79, label %82

79:                                               ; preds = %76
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  %81 = load i32, ptr %9, align 4, !tbaa !9
  call void @_ZN13TiXmlDocument8SetErrorEiPKcP16TiXmlParsingData13TiXmlEncoding(ptr noundef nonnull align 8 dereferenceable(157) %80, i32 noundef 9, ptr noundef null, ptr noundef null, i32 noundef %81)
  br label %82

82:                                               ; preds = %79, %76
  br label %83

83:                                               ; preds = %82, %73
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %94

86:                                               ; preds = %83
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = load i8, ptr %87, align 1, !tbaa !14
  %89 = sext i8 %88 to i32
  %90 = icmp eq i32 %89, 62
  br i1 %90, label %91, label %94

91:                                               ; preds = %86
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds i8, ptr %92, i64 1
  store ptr %93, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %96

94:                                               ; preds = %86, %83
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %95, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %96

96:                                               ; preds = %94, %91, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %97 = load ptr, ptr %5, align 8
  ret ptr %97
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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: readwrite) }
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 = !{!10, !10, i64 0}
!10 = !{!"_ZTS13TiXmlEncoding", !7, i64 0}
!11 = !{i64 0, i64 4, !12, i64 4, i64 4, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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"

@.str.11 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN16TiXmlParsingData5StampEPKc13TiXmlEncoding(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef, i32 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNK16TiXmlParsingData6CursorEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN12TiXmlUnknown5ParseEPKcP16TiXmlParsingData13TiXmlEncoding(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) unnamed_addr #1 align 2 {
  %5 = tail call noundef ptr @_ZN9TiXmlNode11GetDocumentEv(ptr noundef nonnull align 8 dereferenceable(104) %0)
  %6 = tail call noundef ptr @_ZN9TiXmlBase14SkipWhiteSpaceEPKc13TiXmlEncoding(ptr noundef %1, i32 noundef %3)
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %11, label %7

7:                                                ; preds = %4
  tail call void @_ZN16TiXmlParsingData5StampEPKc13TiXmlEncoding(ptr noundef nonnull align 8 dereferenceable(20) %2, ptr noundef %6, i32 noundef %3)
  %8 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK16TiXmlParsingData6CursorEv(ptr noundef nonnull align 8 dereferenceable(20) %2)
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load i64, ptr %8, align 4
  store i64 %10, ptr %9, align 8
  br label %11

11:                                               ; preds = %7, %4
  %.not37 = icmp eq ptr %6, null
  br i1 %.not37, label %14, label %12

12:                                               ; preds = %11
  %13 = load i8, ptr %6, align 1, !tbaa !5
  %cond = icmp eq i8 %13, 60
  br i1 %cond, label %16, label %14

14:                                               ; preds = %12, %11
  %.not42 = icmp eq ptr %5, null
  br i1 %.not42, label %25, label %15

15:                                               ; preds = %14
  tail call void @_ZN13TiXmlDocument8SetErrorEiPKcP16TiXmlParsingData13TiXmlEncoding(ptr noundef nonnull align 8 dereferenceable(157) %5, i32 noundef 9, ptr noundef %6, ptr noundef %2, i32 noundef %3)
  br label %25

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %0, i64 56
  %18 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef nonnull @.str.11)
  br label %19

19:                                               ; preds = %21, %16
  %.pn = phi ptr [ %6, %16 ], [ %.031, %21 ]
  %.031 = getelementptr inbounds i8, ptr %.pn, i64 1
  %20 = load i8, ptr %.031, align 1, !tbaa !5
  switch i8 %20, label %21 [
    i8 0, label %.critedge
    i8 62, label %.critedge
  ]

21:                                               ; preds = %19
  %22 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %17, i8 noundef signext %20)
  br label %19, !llvm.loop !8

.critedge:                                        ; preds = %19, %19
  %23 = icmp eq i8 %20, 62
  %24 = getelementptr inbounds i8, ptr %.pn, i64 2
  %spec.select = select i1 %23, ptr %24, ptr %.031
  br label %25

25:                                               ; preds = %.critedge, %14, %15
  %.0 = phi ptr [ null, %15 ], [ null, %14 ], [ %spec.select, %.critedge ]
  ret ptr %.0
}

attributes #0 = { 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 #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" }

!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"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass