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

@.str.6 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [1 x i8], align 1
@__PRETTY_FUNCTION__._ZN9TiXmlBase8ReadNameEPKcPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE13TiXmlEncoding = external hidden unnamed_addr constant [83 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 noundef i32 @_ZN9TiXmlBase7IsAlphaEh13TiXmlEncoding(i8 noundef zeroext, i32 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN9TiXmlBase10IsAlphaNumEh13TiXmlEncoding(i8 noundef zeroext, i32 noundef) #1 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN9TiXmlBase8ReadNameEPKcPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE13TiXmlEncoding(ptr noundef %0, ptr noundef %1, i32 noundef %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  %9 = load ptr, ptr %6, align 8, !tbaa !5
  %10 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef @.str.11)
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %3
  br label %16

14:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.6, i32 noundef 407, ptr noundef @__PRETTY_FUNCTION__._ZN9TiXmlBase8ReadNameEPKcPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE13TiXmlEncoding) #4
  unreachable

15:                                               ; No predecessors!
  br label %16

16:                                               ; preds = %15, %13
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %94

19:                                               ; preds = %16
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load i8, ptr %20, align 1, !tbaa !11
  %22 = icmp ne i8 %21, 0
  br i1 %22, label %23, label %94

23:                                               ; preds = %19
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = load i8, ptr %24, align 1, !tbaa !11
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = call noundef i32 @_ZN9TiXmlBase7IsAlphaEh13TiXmlEncoding(i8 noundef zeroext %25, i32 noundef %26)
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %34, label %29

29:                                               ; preds = %23
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load i8, ptr %30, align 1, !tbaa !11
  %32 = sext i8 %31 to i32
  %33 = icmp eq i32 %32, 95
  br i1 %33, label %34, label %94

34:                                               ; preds = %29, %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %35, ptr %8, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %73, %34
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %71

39:                                               ; preds = %36
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = load i8, ptr %40, align 1, !tbaa !11
  %42 = icmp ne i8 %41, 0
  br i1 %42, label %43, label %71

43:                                               ; preds = %39
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load i8, ptr %44, align 1, !tbaa !11
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = call noundef i32 @_ZN9TiXmlBase10IsAlphaNumEh13TiXmlEncoding(i8 noundef zeroext %45, i32 noundef %46)
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %69, label %49

49:                                               ; preds = %43
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i8, ptr %50, align 1, !tbaa !11
  %52 = sext i8 %51 to i32
  %53 = icmp eq i32 %52, 95
  br i1 %53, label %69, label %54

54:                                               ; preds = %49
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = sext i8 %56 to i32
  %58 = icmp eq i32 %57, 45
  br i1 %58, label %69, label %59

59:                                               ; preds = %54
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = sext i8 %61 to i32
  %63 = icmp eq i32 %62, 46
  br i1 %63, label %69, label %64

64:                                               ; preds = %59
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = load i8, ptr %65, align 1, !tbaa !11
  %67 = sext i8 %66 to i32
  %68 = icmp eq i32 %67, 58
  br label %69

69:                                               ; preds = %64, %59, %54, %49, %43
  %70 = phi i1 [ true, %59 ], [ true, %54 ], [ true, %49 ], [ true, %43 ], [ %68, %64 ]
  br label %71

71:                                               ; preds = %69, %39, %36
  %72 = phi i1 [ false, %39 ], [ false, %36 ], [ %70, %69 ]
  br i1 %72, label %73, label %76

73:                                               ; preds = %71
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds i8, ptr %74, i32 1
  store ptr %75, ptr %5, align 8, !tbaa !5
  br label %36, !llvm.loop !12

76:                                               ; preds = %71
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = ptrtoint ptr %77 to i64
  %80 = ptrtoint ptr %78 to i64
  %81 = sub i64 %79, %80
  %82 = icmp sgt i64 %81, 0
  br i1 %82, label %83, label %92

83:                                               ; preds = %76
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = ptrtoint ptr %86 to i64
  %89 = ptrtoint ptr %87 to i64
  %90 = sub i64 %88, %89
  %91 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %84, ptr noundef %85, i64 noundef %90)
  br label %92

92:                                               ; preds = %83, %76
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %93, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %95

94:                                               ; preds = %29, %19, %16
  store ptr null, ptr %4, align 8
  br label %95

95:                                               ; preds = %94, %92
  %96 = load ptr, ptr %4, align 8
  ret ptr %96
}

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

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

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 = { noreturn 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 #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 = { noreturn nounwind }
attributes #5 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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.6 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [1 x i8], align 1
@__PRETTY_FUNCTION__._ZN9TiXmlBase8ReadNameEPKcPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE13TiXmlEncoding = external hidden unnamed_addr constant [83 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN9TiXmlBase7IsAlphaEh13TiXmlEncoding(i8 noundef zeroext, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN9TiXmlBase10IsAlphaNumEh13TiXmlEncoding(i8 noundef zeroext, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN9TiXmlBase8ReadNameEPKcPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE13TiXmlEncoding(ptr noundef %0, ptr noundef nonnull %1, i32 noundef %2) local_unnamed_addr #2 align 2 {
  %4 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.11)
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.6, i32 noundef 407, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN9TiXmlBase8ReadNameEPKcPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE13TiXmlEncoding) #3
  unreachable

6:                                                ; preds = %3
  %7 = load i8, ptr %0, align 1, !tbaa !5
  %.not32 = icmp eq i8 %7, 0
  br i1 %.not32, label %25, label %8

8:                                                ; preds = %6
  %9 = tail call noundef i32 @_ZN9TiXmlBase7IsAlphaEh13TiXmlEncoding(i8 noundef zeroext %7, i32 noundef %2)
  %.not33 = icmp eq i32 %9, 0
  %.pre = load i8, ptr %0, align 1, !tbaa !5
  br i1 %.not33, label %10, label %12

10:                                               ; preds = %8
  %11 = icmp eq i8 %.pre, 95
  br i1 %11, label %.lr.ph.preheader, label %25

12:                                               ; preds = %8
  %.not3436 = icmp eq i8 %.pre, 0
  br i1 %.not3436, label %.critedge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %10, %12
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.critedge2
  %13 = phi i8 [ %18, %.critedge2 ], [ %.pre, %.lr.ph.preheader ]
  %.02637 = phi ptr [ %17, %.critedge2 ], [ %0, %.lr.ph.preheader ]
  %14 = tail call noundef i32 @_ZN9TiXmlBase10IsAlphaNumEh13TiXmlEncoding(i8 noundef zeroext %13, i32 noundef %2)
  %.not35 = icmp eq i32 %14, 0
  br i1 %.not35, label %15, label %.critedge2

15:                                               ; preds = %.lr.ph
  %16 = load i8, ptr %.02637, align 1, !tbaa !5
  switch i8 %16, label %.critedge [
    i8 95, label %.critedge2
    i8 45, label %.critedge2
    i8 46, label %.critedge2
    i8 58, label %.critedge2
  ]

.critedge2:                                       ; preds = %15, %15, %15, %15, %.lr.ph
  %17 = getelementptr inbounds i8, ptr %.02637, i64 1
  %18 = load i8, ptr %17, align 1, !tbaa !5
  %.not34 = icmp eq i8 %18, 0
  br i1 %.not34, label %.critedge, label %.lr.ph, !llvm.loop !8

.critedge:                                        ; preds = %.critedge2, %15, %12
  %.026.lcssa = phi ptr [ %0, %12 ], [ %.02637, %15 ], [ %17, %.critedge2 ]
  %19 = ptrtoint ptr %.026.lcssa to i64
  %20 = ptrtoint ptr %0 to i64
  %21 = sub i64 %19, %20
  %22 = icmp sgt i64 %21, 0
  br i1 %22, label %23, label %25

23:                                               ; preds = %.critedge
  %24 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull %0, i64 noundef %21)
  br label %25

25:                                               ; preds = %6, %10, %.critedge, %23
  %.0 = phi ptr [ %.026.lcssa, %23 ], [ %.026.lcssa, %.critedge ], [ null, %10 ], [ null, %6 ]
  ret ptr %.0
}

; 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 #2 align 2

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

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 = { noreturn 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 #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 = { noreturn 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 = !{!"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,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass