; LLVM IR from musetronstar/tagd :: tagd/src/domain (domain)

; 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.tagd::domain" = type <{ i32, i32, %"class.std::__cxx11::basic_string", i32, [4 x i8] }>
%"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.8689 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.8690 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8691 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8692 = external hidden unnamed_addr constant [26 x i8], align 1
@__PRETTY_FUNCTION__._ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm = external hidden unnamed_addr constant [71 x i8], align 1
@.str.8693 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm(ptr noundef nonnull align 8 dereferenceable(44) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %2) #1 align 2 {
  %4 = alloca i32, align 4
  %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 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  %10 = load i32, ptr %9, align 8, !tbaa !9
  %11 = icmp eq i32 %10, 2
  br i1 %11, label %12, label %13

12:                                               ; preds = %3
  br label %15

13:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.8692, ptr noundef @.str.8689, i32 noundef 59, ptr noundef @__PRETTY_FUNCTION__._ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

14:                                               ; No predecessors!
  br label %15

15:                                               ; preds = %14, %12
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = load i64, ptr %16, align 8, !tbaa !16
  %18 = icmp ugt i64 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %15
  br label %22

20:                                               ; preds = %15
  call void @__assert_fail(ptr noundef @.str.8693, ptr noundef @.str.8689, i32 noundef 60, ptr noundef @__PRETTY_FUNCTION__._ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

21:                                               ; No predecessors!
  br label %22

22:                                               ; preds = %21, %19
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = call noundef i32 @_ZN4tagd6domain17lookup_next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm(ptr noundef nonnull align 8 dereferenceable(32) %23, ptr noundef %24)
  %26 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  store i32 %25, ptr %26, align 8, !tbaa !9
  %27 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  %28 = load i32, ptr %27, align 8, !tbaa !9
  switch i32 %28, label %48 [
    i32 7, label %29
    i32 4, label %49
  ]

29:                                               ; preds = %22
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = load i64, ptr %30, align 8, !tbaa !16
  %32 = trunc i64 %31 to i32
  %33 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 0
  store i32 %32, ptr %33, align 8, !tbaa !17
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load i64, ptr %34, align 8, !tbaa !16
  %36 = icmp eq i64 %35, 0
  br i1 %36, label %37, label %41

37:                                               ; preds = %29
  %38 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  store i32 2, ptr %38, align 8, !tbaa !9
  %39 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  %40 = load i32, ptr %39, align 8, !tbaa !9
  store i32 %40, ptr %4, align 4
  br label %61

41:                                               ; preds = %29
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = load i64, ptr %43, align 8, !tbaa !16
  %45 = call noundef i64 @_ZN4tagd6domain10next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %42, i64 noundef %44)
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  store i64 %45, ptr %46, align 8, !tbaa !16
  %47 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  store i32 3, ptr %47, align 8, !tbaa !9
  br label %49

48:                                               ; preds = %22
  call void @__assert_fail(ptr noundef @.str.8690, ptr noundef @.str.8689, i32 noundef 81, ptr noundef @__PRETTY_FUNCTION__._ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

49:                                               ; preds = %41, %22
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load i64, ptr %50, align 8, !tbaa !16
  %52 = trunc i64 %51 to i32
  %53 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 1
  store i32 %52, ptr %53, align 4, !tbaa !18
  %54 = call noundef zeroext i1 @_ZNK4tagd6domain14is_registrableEv(ptr noundef nonnull align 8 dereferenceable(44) %8)
  br i1 %54, label %55, label %56

55:                                               ; preds = %49
  br label %58

56:                                               ; preds = %49
  call void @__assert_fail(ptr noundef @.str.8691, ptr noundef @.str.8689, i32 noundef 87, ptr noundef @__PRETTY_FUNCTION__._ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

57:                                               ; No predecessors!
  br label %58

58:                                               ; preds = %57, %55
  %59 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  %60 = load i32, ptr %59, align 8, !tbaa !9
  store i32 %60, ptr %4, align 4
  br label %61

61:                                               ; preds = %58, %37
  %62 = load i32, ptr %4, align 4
  ret i32 %62
}

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 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" }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !15, i64 40}
!10 = !{!"_ZTSN4tagd6domainE", !11, i64 0, !11, i64 4, !12, i64 8, !15, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTS8tld_code", !7, i64 0}
!16 = !{!14, !14, i64 0}
!17 = !{!10, !11, i64 0}
!18 = !{!10, !11, i64 4}


; 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.8689 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.8690 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8691 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8692 = external hidden unnamed_addr constant [26 x i8], align 1
@__PRETTY_FUNCTION__._ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm = external hidden unnamed_addr constant [71 x i8], align 1
@.str.8693 = external hidden unnamed_addr constant [12 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 uwtable
declare dso_local noundef i32 @_ZN4tagd6domain17lookup_next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm(ptr noundef nonnull align 8 dereferenceable(44) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %2) local_unnamed_addr #1 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = icmp eq i32 %5, 2
  br i1 %6, label %8, label %7

7:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.8692, ptr noundef nonnull @.str.8689, i32 noundef 59, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

8:                                                ; preds = %3
  %9 = load i64, ptr %2, align 8, !tbaa !15
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %10, label %11

10:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.8693, ptr noundef nonnull @.str.8689, i32 noundef 60, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

11:                                               ; preds = %8
  %12 = tail call noundef i32 @_ZN4tagd6domain17lookup_next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull %2)
  store i32 %12, ptr %4, align 8, !tbaa !5
  switch i32 %12, label %20 [
    i32 7, label %13
    i32 4, label %._crit_edge
  ]

._crit_edge:                                      ; preds = %11
  %.pre = load i64, ptr %2, align 8, !tbaa !15
  br label %21

13:                                               ; preds = %11
  %14 = load i64, ptr %2, align 8, !tbaa !15
  %15 = trunc i64 %14 to i32
  store i32 %15, ptr %0, align 8, !tbaa !16
  %16 = icmp eq i64 %14, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %13
  store i32 2, ptr %4, align 8, !tbaa !5
  br label %29

18:                                               ; preds = %13
  %19 = tail call noundef i64 @_ZN4tagd6domain10next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %14)
  store i64 %19, ptr %2, align 8, !tbaa !15
  store i32 3, ptr %4, align 8, !tbaa !5
  br label %21

20:                                               ; preds = %11
  tail call void @__assert_fail(ptr noundef nonnull @.str.8690, ptr noundef nonnull @.str.8689, i32 noundef 81, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

21:                                               ; preds = %._crit_edge, %18
  %22 = phi i64 [ %.pre, %._crit_edge ], [ %19, %18 ]
  %23 = trunc i64 %22 to i32
  %24 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %23, ptr %24, align 4, !tbaa !17
  %25 = tail call noundef zeroext i1 @_ZNK4tagd6domain14is_registrableEv(ptr noundef nonnull align 8 dereferenceable(44) %0)
  br i1 %25, label %27, label %26

26:                                               ; preds = %21
  tail call void @__assert_fail(ptr noundef nonnull @.str.8691, ptr noundef nonnull @.str.8689, i32 noundef 87, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4tagd6domain16process_wildcardERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

27:                                               ; preds = %21
  %28 = load i32, ptr %4, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %27, %17
  %.0 = phi i32 [ %28, %27 ], [ 2, %17 ]
  ret i32 %.0
}

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 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" }
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, !14, i64 40}
!6 = !{!"_ZTSN4tagd6domainE", !7, i64 0, !7, i64 4, !10, i64 8, !14, i64 40}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !11, i64 0, !13, i64 8, !8, i64 16}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!"_ZTS8tld_code", !8, i64 0}
!15 = !{!13, !13, i64 0}
!16 = !{!6, !7, i64 0}
!17 = !{!6, !7, i64 4}


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