; LLVM IR from vczh/herodb :: Kernel/Source/Vlpp.ll (ZN2vl14regex_internal8AreEqualEPNS0_10TransitionES2_)

; 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.vl::regex_internal::CharRange" = type { i32, i32 }
%"class.vl::regex_internal::Transition" = type { ptr, ptr, %"class.vl::regex_internal::CharRange", i32, i64, i64 }

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl14regex_internal8AreEqualEPNS0_10TransitionES2_(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.vl::regex_internal::CharRange", align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %7, i32 0, i32 3
  %9 = load i32, ptr %8, align 8, !tbaa !9
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %10, i32 0, i32 3
  %12 = load i32, ptr %11, align 8, !tbaa !9
  %13 = icmp ne i32 %9, %12
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %53

15:                                               ; preds = %2
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %16, i32 0, i32 3
  %18 = load i32, ptr %17, align 8, !tbaa !9
  switch i32 %18, label %52 [
    i32 0, label %19
    i32 5, label %26
    i32 6, label %34
  ]

19:                                               ; preds = %15
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %20, i32 0, i32 2
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %22, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 8 %23, i64 8, i1 false), !tbaa.struct !15
  %24 = load i64, ptr %6, align 4
  %25 = call noundef zeroext i1 @_ZNK2vl14regex_internal9CharRangeeqES1_(ptr noundef nonnull align 4 dereferenceable(8) %21, i64 %24)
  store i1 %25, ptr %3, align 1
  br label %53

26:                                               ; preds = %15
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %27, i32 0, i32 4
  %29 = load i64, ptr %28, align 8, !tbaa !17
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %30, i32 0, i32 4
  %32 = load i64, ptr %31, align 8, !tbaa !17
  %33 = icmp eq i64 %29, %32
  store i1 %33, ptr %3, align 1
  br label %53

34:                                               ; preds = %15
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %35, i32 0, i32 4
  %37 = load i64, ptr %36, align 8, !tbaa !17
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %38, i32 0, i32 4
  %40 = load i64, ptr %39, align 8, !tbaa !17
  %41 = icmp eq i64 %37, %40
  br i1 %41, label %42, label %50

42:                                               ; preds = %34
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %43, i32 0, i32 5
  %45 = load i64, ptr %44, align 8, !tbaa !18
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %"class.vl::regex_internal::Transition", ptr %46, i32 0, i32 5
  %48 = load i64, ptr %47, align 8, !tbaa !18
  %49 = icmp eq i64 %45, %48
  br label %50

50:                                               ; preds = %42, %34
  %51 = phi i1 [ false, %34 ], [ %49, %42 ]
  store i1 %51, ptr %3, align 1
  br label %53

52:                                               ; preds = %15
  store i1 true, ptr %3, align 1
  br label %53

53:                                               ; preds = %52, %50, %26, %19, %14
  %54 = load i1, ptr %3, align 1
  ret i1 %54
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK2vl14regex_internal9CharRangeeqES1_(ptr noundef nonnull align 4 dereferenceable(8), i64) #2 align 2

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

!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, !13, i64 24}
!10 = !{!"_ZTSN2vl14regex_internal10TransitionE", !6, i64 0, !6, i64 8, !11, i64 16, !13, i64 24, !14, i64 32, !14, i64 40}
!11 = !{!"_ZTSN2vl14regex_internal9CharRangeE", !12, i64 0, !12, i64 4}
!12 = !{!"wchar_t", !7, i64 0}
!13 = !{!"_ZTSN2vl14regex_internal10Transition4TypeE", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{i64 0, i64 4, !16, i64 4, i64 4, !16}
!16 = !{!12, !12, i64 0}
!17 = !{!10, !14, i64 32}
!18 = !{!10, !14, i64 40}


; 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 nounwind uwtable
define dso_local noundef zeroext i1 @_ZN2vl14regex_internal8AreEqualEPNS0_10TransitionES2_(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 24
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %.not = icmp eq i32 %4, %6
  br i1 %.not, label %7, label %30

7:                                                ; preds = %2
  switch i32 %4, label %30 [
    i32 0, label %8
    i32 5, label %12
    i32 6, label %18
  ]

8:                                                ; preds = %7
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = getelementptr inbounds i8, ptr %1, i64 16
  %.sroa.0.0.copyload = load i64, ptr %10, align 8
  %11 = tail call noundef zeroext i1 @_ZNK2vl14regex_internal9CharRangeeqES1_(ptr noundef nonnull align 4 dereferenceable(8) %9, i64 %.sroa.0.0.copyload)
  br label %30

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  %14 = load i64, ptr %13, align 8, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %1, i64 32
  %16 = load i64, ptr %15, align 8, !tbaa !14
  %17 = icmp eq i64 %14, %16
  br label %30

18:                                               ; preds = %7
  %19 = getelementptr inbounds i8, ptr %0, i64 32
  %20 = load i64, ptr %19, align 8, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %1, i64 32
  %22 = load i64, ptr %21, align 8, !tbaa !14
  %23 = icmp eq i64 %20, %22
  br i1 %23, label %24, label %30

24:                                               ; preds = %18
  %25 = getelementptr inbounds i8, ptr %0, i64 40
  %26 = load i64, ptr %25, align 8, !tbaa !15
  %27 = getelementptr inbounds i8, ptr %1, i64 40
  %28 = load i64, ptr %27, align 8, !tbaa !15
  %29 = icmp eq i64 %26, %28
  br label %30

30:                                               ; preds = %7, %18, %24, %2, %12, %8
  %.0 = phi i1 [ %17, %12 ], [ %11, %8 ], [ false, %2 ], [ false, %18 ], [ %29, %24 ], [ true, %7 ]
  ret i1 %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK2vl14regex_internal9CharRangeeqES1_(ptr noundef nonnull align 4 dereferenceable(8), i64) local_unnamed_addr #0 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" }

!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, !12, i64 24}
!6 = !{!"_ZTSN2vl14regex_internal10TransitionE", !7, i64 0, !7, i64 8, !10, i64 16, !12, i64 24, !13, i64 32, !13, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN2vl14regex_internal9CharRangeE", !11, i64 0, !11, i64 4}
!11 = !{!"wchar_t", !8, i64 0}
!12 = !{!"_ZTSN2vl14regex_internal10Transition4TypeE", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!6, !13, i64 32}
!15 = !{!6, !13, i64 40}


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