; LLVM IR from thepowersgang/mrustc :: src/ast/ast.ll (ZNK3AST10Visibility10is_visibleERKNS_12AbsolutePathE)

; 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.AST::Visibility" = type <{ %"class.std::shared_ptr", %"class.std::shared_ptr.114", i32, [4 x i8] }>
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::shared_ptr.114" = type { %"class.std::__shared_ptr.115" }
%"class.std::__shared_ptr.115" = type { ptr, %"class.std::__shared_count" }
%"struct.AST::AbsolutePath" = type { %class.RcString, %"class.std::vector.0" }
%class.RcString = type { ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<RcString, std::allocator<RcString>>::_Vector_impl" }
%"struct.std::_Vector_base<RcString, std::allocator<RcString>>::_Vector_impl" = type { %"struct.std::_Vector_base<RcString, std::allocator<RcString>>::_Vector_impl_data" }
%"struct.std::_Vector_base<RcString, std::allocator<RcString>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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 uwtable
define dso_local noundef zeroext i1 @_ZNK3AST10Visibility10is_visibleERKNS_12AbsolutePathE(ptr noundef nonnull align 8 dereferenceable(36) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) #1 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8
  %9 = getelementptr inbounds %"class.AST::Visibility", ptr %8, i32 0, i32 1
  %10 = call noundef zeroext i1 @_ZNKSt12__shared_ptrIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %9) #3
  br i1 %10, label %11, label %57

11:                                               ; preds = %2
  %12 = getelementptr inbounds %"class.AST::Visibility", ptr %8, i32 0, i32 1
  %13 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %12) #3
  %14 = getelementptr inbounds %"struct.AST::AbsolutePath", ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.AST::AbsolutePath", ptr %15, i32 0, i32 0
  %17 = call noundef zeroext i1 @_ZNK8RcStringneERKS_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %16)
  br i1 %17, label %18, label %19

18:                                               ; preds = %11
  store i1 false, ptr %3, align 1
  br label %58

19:                                               ; preds = %11
  %20 = getelementptr inbounds %"class.AST::Visibility", ptr %8, i32 0, i32 1
  %21 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %20) #3
  %22 = getelementptr inbounds %"struct.AST::AbsolutePath", ptr %21, i32 0, i32 1
  %23 = call noundef i64 @_ZNKSt6vectorI8RcStringSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #3
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.AST::AbsolutePath", ptr %24, i32 0, i32 1
  %26 = call noundef i64 @_ZNKSt6vectorI8RcStringSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #3
  %27 = icmp ugt i64 %23, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %19
  store i1 false, ptr %3, align 1
  br label %58

29:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %30

30:                                               ; preds = %51, %29
  %31 = load i64, ptr %6, align 8, !tbaa !9
  %32 = getelementptr inbounds %"class.AST::Visibility", ptr %8, i32 0, i32 1
  %33 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %32) #3
  %34 = getelementptr inbounds %"struct.AST::AbsolutePath", ptr %33, i32 0, i32 1
  %35 = call noundef i64 @_ZNKSt6vectorI8RcStringSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #3
  %36 = icmp ult i64 %31, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %30
  store i32 2, ptr %7, align 4
  br label %54

38:                                               ; preds = %30
  %39 = getelementptr inbounds %"class.AST::Visibility", ptr %8, i32 0, i32 1
  %40 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %39) #3
  %41 = getelementptr inbounds %"struct.AST::AbsolutePath", ptr %40, i32 0, i32 1
  %42 = load i64, ptr %6, align 8, !tbaa !9
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorI8RcStringSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %42) #3
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.AST::AbsolutePath", ptr %44, i32 0, i32 1
  %46 = load i64, ptr %6, align 8, !tbaa !9
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorI8RcStringSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef %46) #3
  %48 = call noundef zeroext i1 @_ZNK8RcStringneERKS_(ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef nonnull align 8 dereferenceable(8) %47)
  br i1 %48, label %49, label %50

49:                                               ; preds = %38
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %54

50:                                               ; preds = %38
  br label %51

51:                                               ; preds = %50
  %52 = load i64, ptr %6, align 8, !tbaa !9
  %53 = add i64 %52, 1
  store i64 %53, ptr %6, align 8, !tbaa !9
  br label %30, !llvm.loop !11

54:                                               ; preds = %49, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %55 = load i32, ptr %7, align 4
  switch i32 %55, label %60 [
    i32 2, label %56
    i32 1, label %58
  ]

56:                                               ; preds = %54
  store i1 true, ptr %3, align 1
  br label %58

57:                                               ; preds = %2
  store i1 true, ptr %3, align 1
  br label %58

58:                                               ; preds = %57, %56, %54, %28, %18
  %59 = load i1, ptr %3, align 1
  ret i1 %59

60:                                               ; preds = %54
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK8RcStringneERKS_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

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

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

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

attributes #0 = { nocallback nofree nosync 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" }
attributes #3 = { 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 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3AST10Visibility10is_visibleERKNS_12AbsolutePathE(ptr noundef nonnull align 8 dereferenceable(36) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = tail call noundef zeroext i1 @_ZNKSt12__shared_ptrIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #2
  br i1 %4, label %5, label %.loopexit

5:                                                ; preds = %2
  %6 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #2
  %7 = tail call noundef zeroext i1 @_ZNK8RcStringneERKS_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %1)
  br i1 %7, label %.loopexit, label %8

8:                                                ; preds = %5
  %9 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #2
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  %11 = tail call noundef i64 @_ZNKSt6vectorI8RcStringSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #2
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = tail call noundef i64 @_ZNKSt6vectorI8RcStringSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #2
  %14 = icmp ugt i64 %11, %13
  br i1 %14, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %8
  %15 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #2
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = tail call noundef i64 @_ZNKSt6vectorI8RcStringSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #2
  %18 = icmp eq i64 %17, 0
  br i1 %18, label %.loopexit, label %.lr.ph

19:                                               ; preds = %.lr.ph
  %20 = add nuw i64 %.0911, 1
  %21 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #2
  %22 = getelementptr inbounds i8, ptr %21, i64 8
  %23 = tail call noundef i64 @_ZNKSt6vectorI8RcStringSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #2
  %.not = icmp ult i64 %20, %23
  br i1 %.not, label %.lr.ph, label %.loopexit.loopexit, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader, %19
  %.0911 = phi i64 [ %20, %19 ], [ 0, %.preheader ]
  %24 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #2
  %25 = getelementptr inbounds i8, ptr %24, i64 8
  %26 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorI8RcStringSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %.0911) #2
  %27 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorI8RcStringSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %.0911) #2
  %28 = tail call noundef zeroext i1 @_ZNK8RcStringneERKS_(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(8) %27)
  br i1 %28, label %.loopexit.loopexit, label %19

.loopexit.loopexit:                               ; preds = %19, %.lr.ph
  %.1.ph = xor i1 %28, true
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.preheader, %2, %8, %5
  %.1 = phi i1 [ false, %5 ], [ false, %8 ], [ true, %2 ], [ true, %.preheader ], [ %.1.ph, %.loopexit.loopexit ]
  ret i1 %.1
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN3AST12AbsolutePathELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK8RcStringneERKS_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI8RcStringSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorI8RcStringSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 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 = { 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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