; 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.8688 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8689 = external hidden unnamed_addr constant [77 x i8], align 1
@__PRETTY_FUNCTION__._ZN4tagd6domain13process_icannERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm = external hidden unnamed_addr constant [68 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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4tagd6domain13process_icannERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm(ptr noundef nonnull align 8 dereferenceable(44) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %2) #0 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, 0
  br i1 %11, label %12, label %13

12:                                               ; preds = %3
  br label %15

13:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.8688, ptr noundef @.str.8689, i32 noundef 14, ptr noundef @__PRETTY_FUNCTION__._ZN4tagd6domain13process_icannERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

14:                                               ; No predecessors!
  br label %15

15:                                               ; preds = %14, %12
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = call noundef i32 @_ZN4tagd6domain17lookup_next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef %17)
  %19 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  store i32 %18, ptr %19, align 8, !tbaa !9
  %20 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  %21 = load i32, ptr %20, align 8, !tbaa !9
  switch i32 %21, label %75 [
    i32 7, label %22
    i32 0, label %24
    i32 2, label %39
    i32 5, label %57
  ]

22:                                               ; preds = %15
  %23 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  store i32 1, ptr %23, align 8, !tbaa !9
  br label %76

24:                                               ; preds = %15
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = load i64, ptr %25, align 8, !tbaa !16
  %27 = trunc i64 %26 to i32
  %28 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 0
  store i32 %27, ptr %28, align 8, !tbaa !17
  %29 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !17
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %35

32:                                               ; preds = %24
  %33 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  %34 = load i32, ptr %33, align 8, !tbaa !9
  store i32 %34, ptr %4, align 4
  br label %88

35:                                               ; preds = %24
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = call noundef i32 @_ZN4tagd6domain13process_icannERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm(ptr noundef nonnull align 8 dereferenceable(44) %8, ptr noundef nonnull align 8 dereferenceable(32) %36, ptr noundef %37)
  store i32 %38, ptr %4, align 4
  br label %88

39:                                               ; preds = %15
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = load i64, ptr %40, align 8, !tbaa !16
  %42 = trunc i64 %41 to i32
  %43 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 0
  store i32 %42, ptr %43, align 8, !tbaa !17
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load i64, ptr %44, align 8, !tbaa !16
  %46 = icmp eq i64 %45, 0
  br i1 %46, label %47, label %50

47:                                               ; preds = %39
  %48 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  %49 = load i32, ptr %48, align 8, !tbaa !9
  store i32 %49, ptr %4, align 4
  br label %88

50:                                               ; preds = %39
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load i64, ptr %52, align 8, !tbaa !16
  %54 = call noundef i64 @_ZN4tagd6domain10next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %51, i64 noundef %53)
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  store i64 %54, ptr %55, align 8, !tbaa !16
  %56 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  store i32 3, ptr %56, align 8, !tbaa !9
  br label %76

57:                                               ; preds = %15
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = load i64, ptr %58, align 8, !tbaa !16
  %60 = trunc i64 %59 to i32
  %61 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 0
  store i32 %60, ptr %61, align 8, !tbaa !17
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = load i64, ptr %62, align 8, !tbaa !16
  %64 = icmp eq i64 %63, 0
  br i1 %64, label %65, label %68

65:                                               ; preds = %57
  %66 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  %67 = load i32, ptr %66, align 8, !tbaa !9
  store i32 %67, ptr %4, align 4
  br label %88

68:                                               ; preds = %57
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load i64, ptr %70, align 8, !tbaa !16
  %72 = call noundef i64 @_ZN4tagd6domain10next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %69, i64 noundef %71)
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  store i64 %72, ptr %73, align 8, !tbaa !16
  %74 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  store i32 6, ptr %74, align 8, !tbaa !9
  br label %76

75:                                               ; preds = %15
  call void @__assert_fail(ptr noundef @.str.8690, ptr noundef @.str.8689, i32 noundef 46, ptr noundef @__PRETTY_FUNCTION__._ZN4tagd6domain13process_icannERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

76:                                               ; preds = %68, %50, %22
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = load i64, ptr %77, align 8, !tbaa !16
  %79 = trunc i64 %78 to i32
  %80 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 1
  store i32 %79, ptr %80, align 4, !tbaa !18
  %81 = call noundef zeroext i1 @_ZNK4tagd6domain14is_registrableEv(ptr noundef nonnull align 8 dereferenceable(44) %8)
  br i1 %81, label %82, label %83

82:                                               ; preds = %76
  br label %85

83:                                               ; preds = %76
  call void @__assert_fail(ptr noundef @.str.8691, ptr noundef @.str.8689, i32 noundef 53, ptr noundef @__PRETTY_FUNCTION__._ZN4tagd6domain13process_icannERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

84:                                               ; No predecessors!
  br label %85

85:                                               ; preds = %84, %82
  %86 = getelementptr inbounds %"class.tagd::domain", ptr %8, i32 0, i32 3
  %87 = load i32, ptr %86, align 8, !tbaa !9
  store i32 %87, ptr %4, align 4
  br label %88

88:                                               ; preds = %85, %65, %47, %35, %32
  %89 = load i32, ptr %4, align 4
  ret i32 %89
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4tagd6domain17lookup_next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #0 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

attributes #0 = { 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 #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 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.8688 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8689 = external hidden unnamed_addr constant [77 x i8], align 1
@__PRETTY_FUNCTION__._ZN4tagd6domain13process_icannERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm = external hidden unnamed_addr constant [68 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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4tagd6domain13process_icannERKNSt7__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 #0 align 2 {
tailrecurse:
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %.pre = load i32, ptr %3, align 8, !tbaa !5
  %4 = icmp eq i32 %.pre, 0
  br i1 %4, label %.critedge, label %5

5:                                                ; preds = %tailrecurse
  tail call void @__assert_fail(ptr noundef nonnull @.str.8688, ptr noundef nonnull @.str.8689, i32 noundef 14, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4tagd6domain13process_icannERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

.critedge:                                        ; preds = %tailrecurse, %8
  %6 = tail call noundef i32 @_ZN4tagd6domain17lookup_next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %2)
  store i32 %6, ptr %3, align 8, !tbaa !5
  switch i32 %6, label %24 [
    i32 7, label %7
    i32 0, label %8
    i32 2, label %12
    i32 5, label %18
  ]

7:                                                ; preds = %.critedge
  store i32 1, ptr %3, align 8, !tbaa !5
  %.pre26 = load i64, ptr %2, align 8, !tbaa !15
  br label %25

8:                                                ; preds = %.critedge
  %9 = load i64, ptr %2, align 8, !tbaa !15
  %10 = trunc i64 %9 to i32
  store i32 %10, ptr %0, align 8, !tbaa !16
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %.loopexit, label %.critedge

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

16:                                               ; preds = %12
  %17 = tail call noundef i64 @_ZN4tagd6domain10next_labelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %13)
  store i64 %17, ptr %2, align 8, !tbaa !15
  store i32 3, ptr %3, align 8, !tbaa !5
  br label %25

18:                                               ; preds = %.critedge
  %19 = load i64, ptr %2, align 8, !tbaa !15
  %20 = trunc i64 %19 to i32
  store i32 %20, ptr %0, align 8, !tbaa !16
  %21 = icmp eq i64 %19, 0
  br i1 %21, label %.loopexit, label %22

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

24:                                               ; preds = %.critedge
  tail call void @__assert_fail(ptr noundef nonnull @.str.8690, ptr noundef nonnull @.str.8689, i32 noundef 46, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4tagd6domain13process_icannERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

25:                                               ; preds = %22, %16, %7
  %26 = phi i64 [ %23, %22 ], [ %17, %16 ], [ %.pre26, %7 ]
  %27 = trunc i64 %26 to i32
  %28 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %27, ptr %28, align 4, !tbaa !17
  %29 = tail call noundef zeroext i1 @_ZNK4tagd6domain14is_registrableEv(ptr noundef nonnull align 8 dereferenceable(44) %0)
  br i1 %29, label %31, label %30

30:                                               ; preds = %25
  tail call void @__assert_fail(ptr noundef nonnull @.str.8691, ptr noundef nonnull @.str.8689, i32 noundef 53, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4tagd6domain13process_icannERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPm) #3
  unreachable

31:                                               ; preds = %25
  %32 = load i32, ptr %3, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %8, %18, %12, %31
  %.0 = phi i32 [ %32, %31 ], [ 2, %12 ], [ 5, %18 ], [ 0, %8 ]
  ret i32 %.0
}

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

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

attributes #0 = { 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 #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 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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass