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

; 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
@__PRETTY_FUNCTION__._ZN9TiXmlBase11StringEqualEPKcS1_b13TiXmlEncoding = external hidden unnamed_addr constant [84 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9TiXmlBase11StringEqualEPKcS1_b13TiXmlEncoding(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2, i32 noundef %3) #2 align 2 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %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
  %12 = zext i1 %2 to i8
  store i8 %12, ptr %8, align 1, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !11
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %4
  br label %18

16:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.6, i32 noundef 539, ptr noundef @__PRETTY_FUNCTION__._ZN9TiXmlBase11StringEqualEPKcS1_b13TiXmlEncoding) #4
  unreachable

17:                                               ; No predecessors!
  br label %18

18:                                               ; preds = %17, %15
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %18
  br label %24

22:                                               ; preds = %18
  call void @__assert_fail(ptr noundef @.str.13, ptr noundef @.str.6, i32 noundef 540, ptr noundef @__PRETTY_FUNCTION__._ZN9TiXmlBase11StringEqualEPKcS1_b13TiXmlEncoding) #4
  unreachable

23:                                               ; No predecessors!
  br label %24

24:                                               ; preds = %23, %21
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %31

27:                                               ; preds = %24
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = load i8, ptr %28, align 1, !tbaa !13
  %30 = icmp ne i8 %29, 0
  br i1 %30, label %32, label %31

31:                                               ; preds = %27, %24
  call void @__assert_fail(ptr noundef @.str.14, ptr noundef @.str.6, i32 noundef 543, ptr noundef @__PRETTY_FUNCTION__._ZN9TiXmlBase11StringEqualEPKcS1_b13TiXmlEncoding) #4
  unreachable

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %33, ptr %10, align 8, !tbaa !5
  %34 = load i8, ptr %8, align 1, !tbaa !9, !range !14, !noundef !15
  %35 = trunc i8 %34 to i1
  br i1 %35, label %36, label %71

36:                                               ; preds = %32
  br label %37

37:                                               ; preds = %59, %36
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = load i8, ptr %38, align 1, !tbaa !13
  %40 = icmp ne i8 %39, 0
  br i1 %40, label %41, label %57

41:                                               ; preds = %37
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load i8, ptr %42, align 1, !tbaa !13
  %44 = icmp ne i8 %43, 0
  br i1 %44, label %45, label %57

45:                                               ; preds = %41
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = load i8, ptr %46, align 1, !tbaa !13
  %48 = sext i8 %47 to i32
  %49 = load i32, ptr %9, align 4, !tbaa !11
  %50 = call noundef i32 @_ZN9TiXmlBase7ToLowerEi13TiXmlEncoding(i32 noundef %48, i32 noundef %49)
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = load i8, ptr %51, align 1, !tbaa !13
  %53 = sext i8 %52 to i32
  %54 = load i32, ptr %9, align 4, !tbaa !11
  %55 = call noundef i32 @_ZN9TiXmlBase7ToLowerEi13TiXmlEncoding(i32 noundef %53, i32 noundef %54)
  %56 = icmp eq i32 %50, %55
  br label %57

57:                                               ; preds = %45, %41, %37
  %58 = phi i1 [ false, %41 ], [ false, %37 ], [ %56, %45 ]
  br i1 %58, label %59, label %64

59:                                               ; preds = %57
  %60 = load ptr, ptr %10, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %60, i32 1
  store ptr %61, ptr %10, align 8, !tbaa !5
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i32 1
  store ptr %63, ptr %7, align 8, !tbaa !5
  br label %37, !llvm.loop !16

64:                                               ; preds = %57
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = load i8, ptr %65, align 1, !tbaa !13
  %67 = sext i8 %66 to i32
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %64
  store i1 true, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %103

70:                                               ; preds = %64
  br label %102

71:                                               ; preds = %32
  br label %72

72:                                               ; preds = %90, %71
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = load i8, ptr %73, align 1, !tbaa !13
  %75 = icmp ne i8 %74, 0
  br i1 %75, label %76, label %88

76:                                               ; preds = %72
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = load i8, ptr %77, align 1, !tbaa !13
  %79 = icmp ne i8 %78, 0
  br i1 %79, label %80, label %88

80:                                               ; preds = %76
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = load i8, ptr %81, align 1, !tbaa !13
  %83 = sext i8 %82 to i32
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = load i8, ptr %84, align 1, !tbaa !13
  %86 = sext i8 %85 to i32
  %87 = icmp eq i32 %83, %86
  br label %88

88:                                               ; preds = %80, %76, %72
  %89 = phi i1 [ false, %76 ], [ false, %72 ], [ %87, %80 ]
  br i1 %89, label %90, label %95

90:                                               ; preds = %88
  %91 = load ptr, ptr %10, align 8, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %91, i32 1
  store ptr %92, ptr %10, align 8, !tbaa !5
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = getelementptr inbounds i8, ptr %93, i32 1
  store ptr %94, ptr %7, align 8, !tbaa !5
  br label %72, !llvm.loop !18

95:                                               ; preds = %88
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = load i8, ptr %96, align 1, !tbaa !13
  %98 = sext i8 %97 to i32
  %99 = icmp eq i32 %98, 0
  br i1 %99, label %100, label %101

100:                                              ; preds = %95
  store i1 true, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %103

101:                                              ; preds = %95
  br label %102

102:                                              ; preds = %101, %70
  store i1 false, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %103

103:                                              ; preds = %102, %100, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %104 = load i1, ptr %5, align 1
  ret i1 %104
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN9TiXmlBase7ToLowerEi13TiXmlEncoding(i32 noundef, i32 noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS13TiXmlEncoding", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


; 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
@__PRETTY_FUNCTION__._ZN9TiXmlBase11StringEqualEPKcS1_b13TiXmlEncoding = external hidden unnamed_addr constant [84 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN9TiXmlBase11StringEqualEPKcS1_b13TiXmlEncoding(ptr noundef readonly %0, ptr noundef readonly %1, i1 noundef zeroext %2, i32 noundef %3) local_unnamed_addr #1 align 2 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %5, label %6

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

6:                                                ; preds = %4
  %.not32 = icmp eq ptr %1, null
  br i1 %.not32, label %7, label %8

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

8:                                                ; preds = %6
  %9 = load i8, ptr %0, align 1, !tbaa !5
  %.not33 = icmp eq i8 %9, 0
  br i1 %.not33, label %10, label %11

10:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.6, i32 noundef 543, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN9TiXmlBase11StringEqualEPKcS1_b13TiXmlEncoding) #3
  unreachable

11:                                               ; preds = %8
  br i1 %2, label %.preheader, label %.preheader41

.preheader:                                       ; preds = %11, %21
  %.047 = phi ptr [ %22, %21 ], [ %0, %11 ]
  %.02546 = phi ptr [ %23, %21 ], [ %1, %11 ]
  %12 = phi i8 [ %.pr, %21 ], [ %9, %11 ]
  %13 = load i8, ptr %.02546, align 1, !tbaa !5
  %.not37 = icmp eq i8 %13, 0
  br i1 %.not37, label %.critedge.thread, label %14

14:                                               ; preds = %.preheader
  %15 = sext i8 %12 to i32
  %16 = tail call noundef i32 @_ZN9TiXmlBase7ToLowerEi13TiXmlEncoding(i32 noundef %15, i32 noundef %3)
  %17 = load i8, ptr %.02546, align 1, !tbaa !5
  %18 = sext i8 %17 to i32
  %19 = tail call noundef i32 @_ZN9TiXmlBase7ToLowerEi13TiXmlEncoding(i32 noundef %18, i32 noundef %3)
  %20 = icmp eq i32 %16, %19
  br i1 %20, label %21, label %.critedge

21:                                               ; preds = %14
  %22 = getelementptr inbounds i8, ptr %.047, i64 1
  %23 = getelementptr inbounds i8, ptr %.02546, i64 1
  %.pr = load i8, ptr %22, align 1, !tbaa !5
  %.not36 = icmp eq i8 %.pr, 0
  br i1 %.not36, label %.critedge, label %.preheader, !llvm.loop !8

.critedge:                                        ; preds = %21, %14
  %.025.lcssa = phi ptr [ %23, %21 ], [ %.02546, %14 ]
  %.pr38 = load i8, ptr %.025.lcssa, align 1, !tbaa !5
  %24 = icmp eq i8 %.pr38, 0
  br i1 %24, label %.critedge.thread, label %33

.preheader41:                                     ; preds = %11, %28
  %.145 = phi ptr [ %29, %28 ], [ %0, %11 ]
  %.12644 = phi ptr [ %30, %28 ], [ %1, %11 ]
  %25 = phi i8 [ %.pr39, %28 ], [ %9, %11 ]
  %26 = load i8, ptr %.12644, align 1, !tbaa !5
  %27 = icmp eq i8 %25, %26
  br i1 %27, label %28, label %.critedge2

28:                                               ; preds = %.preheader41
  %29 = getelementptr inbounds i8, ptr %.145, i64 1
  %30 = getelementptr inbounds i8, ptr %.12644, i64 1
  %.pr39 = load i8, ptr %29, align 1, !tbaa !5
  %.not34 = icmp eq i8 %.pr39, 0
  br i1 %.not34, label %.critedge2thread-pre-split, label %.preheader41, !llvm.loop !10

.critedge2thread-pre-split:                       ; preds = %28
  %.pr40 = load i8, ptr %30, align 1, !tbaa !5
  br label %.critedge2

.critedge2:                                       ; preds = %.preheader41, %.critedge2thread-pre-split
  %31 = phi i8 [ %.pr40, %.critedge2thread-pre-split ], [ %26, %.preheader41 ]
  %32 = icmp eq i8 %31, 0
  br i1 %32, label %.critedge.thread, label %33

33:                                               ; preds = %.critedge2, %.critedge
  br label %.critedge.thread

.critedge.thread:                                 ; preds = %.preheader, %.critedge2, %.critedge, %33
  %.024 = phi i1 [ false, %33 ], [ true, %.critedge ], [ true, %.critedge2 ], [ true, %.preheader ]
  ret i1 %.024
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN9TiXmlBase7ToLowerEi13TiXmlEncoding(i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

attributes #0 = { 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 #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 = { 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 = { 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"}
!10 = distinct !{!10, !9}


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