; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_RangeFinder (checkNamespaceDef__)

; 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"

%struct.Node__ = type { i32, ptr }
%struct.tag_____NamespaceDef__ = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr }
%struct.tag_____List__Ptr__Token______ = type { ptr, i32, i32 }
%struct.tag_____List__Node____ = type { ptr, i32, i32 }

; 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: 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) #1

; Function Attrs: nounwind uwtable
declare dso_local void @RangeFinder__checkToken__(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @RangeFinder__checkAny__(ptr noundef, i32, ptr) #2

; Function Attrs: nounwind uwtable
declare dso_local void @RangeFinder__checkTypeParams__(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @RangeFinder__checkNamespaceDef__(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.Node__, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.tag_____NamespaceDef__, ptr %12, i32 0, i32 1
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  call void @RangeFinder__checkToken__(ptr noundef %11, ptr noundef %14)
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.tag_____NamespaceDef__, ptr %15, i32 0, i32 2
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %24

19:                                               ; preds = %2
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.tag_____NamespaceDef__, ptr %21, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !12
  call void @RangeFinder__checkTypeParams__(ptr noundef %20, ptr noundef %23)
  br label %24

24:                                               ; preds = %19, %2
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.tag_____NamespaceDef__, ptr %25, i32 0, i32 4
  %27 = load ptr, ptr %26, align 8, !tbaa !13
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %34

29:                                               ; preds = %24
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.tag_____NamespaceDef__, ptr %31, i32 0, i32 4
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  call void @RangeFinder__checkAttributes__(ptr noundef %30, ptr noundef %33)
  br label %34

34:                                               ; preds = %29, %24
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.tag_____NamespaceDef__, ptr %35, i32 0, i32 5
  %37 = load ptr, ptr %36, align 8, !tbaa !14
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %62

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.tag_____NamespaceDef__, ptr %40, i32 0, i32 5
  %42 = load ptr, ptr %41, align 8, !tbaa !14
  store ptr %42, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !15
  br label %43

43:                                               ; preds = %49, %39
  %44 = load i32, ptr %6, align 4, !tbaa !15
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.tag_____List__Ptr__Token______, ptr %45, i32 0, i32 1
  %47 = load i32, ptr %46, align 8, !tbaa !16
  %48 = icmp slt i32 %44, %47
  br i1 %48, label %49, label %61

49:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.tag_____List__Ptr__Token______, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !18
  %53 = load i32, ptr %6, align 4, !tbaa !15
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds ptr, ptr %52, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  store ptr %56, ptr %7, align 8, !tbaa !5
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  call void @RangeFinder__checkToken__(ptr noundef %57, ptr noundef %58)
  %59 = load i32, ptr %6, align 4, !tbaa !15
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %6, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %43, !llvm.loop !19

61:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %62

62:                                               ; preds = %61, %34
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.tag_____NamespaceDef__, ptr %64, i32 0, i32 6
  %66 = load ptr, ptr %65, align 8, !tbaa !21
  call void @RangeFinder__checkToken__(ptr noundef %63, ptr noundef %66)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.tag_____NamespaceDef__, ptr %67, i32 0, i32 7
  %69 = load ptr, ptr %68, align 8, !tbaa !22
  store ptr %69, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !15
  br label %70

70:                                               ; preds = %76, %62
  %71 = load i32, ptr %9, align 4, !tbaa !15
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.tag_____List__Node____, ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 8, !tbaa !23
  %75 = icmp slt i32 %71, %74
  br i1 %75, label %76, label %90

76:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #3
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.tag_____List__Node____, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !25
  %80 = load i32, ptr %9, align 4, !tbaa !15
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds %struct.Node__, ptr %79, i64 %81
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %82, i64 16, i1 false), !tbaa.struct !26
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds { i32, ptr }, ptr %10, i32 0, i32 0
  %85 = load i32, ptr %84, align 8
  %86 = getelementptr inbounds { i32, ptr }, ptr %10, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8
  call void @RangeFinder__checkAny__(ptr noundef %83, i32 %85, ptr %87)
  %88 = load i32, ptr %9, align 4, !tbaa !15
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %9, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #3
  br label %70, !llvm.loop !27

90:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.tag_____NamespaceDef__, ptr %92, i32 0, i32 8
  %94 = load ptr, ptr %93, align 8, !tbaa !28
  call void @RangeFinder__checkToken__(ptr noundef %91, ptr noundef %94)
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @RangeFinder__checkAttributes__(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"tag_____NamespaceDef__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72, !6, i64 80}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 16}
!13 = !{!10, !6, i64 32}
!14 = !{!10, !6, i64 40}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !11, i64 8}
!17 = !{!"tag_____List__Ptr__Token______", !6, i64 0, !11, i64 8, !11, i64 12}
!18 = !{!17, !6, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!10, !6, i64 48}
!22 = !{!10, !6, i64 56}
!23 = !{!24, !11, i64 8}
!24 = !{!"tag_____List__Node____", !6, i64 0, !11, i64 8, !11, i64 12}
!25 = !{!24, !6, i64 0}
!26 = !{i64 0, i64 4, !15, i64 8, i64 8, !5}
!27 = distinct !{!27, !20}
!28 = !{!10, !6, i64 64}


; 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"

%struct.Node__ = type { i32, ptr }

; Function Attrs: nounwind uwtable
declare dso_local void @RangeFinder__checkToken__(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @RangeFinder__checkAny__(ptr noundef, i32, ptr) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @RangeFinder__checkTypeParams__(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @RangeFinder__checkNamespaceDef__(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  tail call void @RangeFinder__checkToken__(ptr noundef %0, ptr noundef %4)
  %5 = getelementptr inbounds i8, ptr %1, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !11
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %8, label %7

7:                                                ; preds = %2
  tail call void @RangeFinder__checkTypeParams__(ptr noundef %0, ptr noundef nonnull %6)
  br label %8

8:                                                ; preds = %7, %2
  %9 = getelementptr inbounds i8, ptr %1, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %.not32 = icmp eq ptr %10, null
  br i1 %.not32, label %12, label %11

11:                                               ; preds = %8
  tail call void @RangeFinder__checkAttributes__(ptr noundef %0, ptr noundef nonnull %10)
  br label %12

12:                                               ; preds = %11, %8
  %13 = getelementptr inbounds i8, ptr %1, i64 40
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %.not33 = icmp eq ptr %14, null
  br i1 %.not33, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %12
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !14
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader ]
  %18 = load ptr, ptr %14, align 8, !tbaa !16
  %19 = getelementptr inbounds ptr, ptr %18, i64 %indvars.iv
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  tail call void @RangeFinder__checkToken__(ptr noundef %0, ptr noundef %20)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = load i32, ptr %15, align 8, !tbaa !14
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %indvars.iv.next, %22
  br i1 %23, label %.lr.ph, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %.lr.ph, %.preheader, %12
  %24 = getelementptr inbounds i8, ptr %1, i64 48
  %25 = load ptr, ptr %24, align 8, !tbaa !20
  tail call void @RangeFinder__checkToken__(ptr noundef %0, ptr noundef %25)
  %26 = getelementptr inbounds i8, ptr %1, i64 56
  %27 = load ptr, ptr %26, align 8, !tbaa !21
  %28 = getelementptr inbounds i8, ptr %27, i64 8
  %29 = load i32, ptr %28, align 8, !tbaa !22
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph36, label %._crit_edge

.lr.ph36:                                         ; preds = %.loopexit, %.lr.ph36
  %indvars.iv38 = phi i64 [ %indvars.iv.next39, %.lr.ph36 ], [ 0, %.loopexit ]
  %31 = load ptr, ptr %27, align 8, !tbaa !24
  %32 = getelementptr inbounds %struct.Node__, ptr %31, i64 %indvars.iv38
  %.sroa.0.0.copyload = load i32, ptr %32, align 8, !tbaa !25
  %.sroa.41.0..sroa_idx = getelementptr inbounds i8, ptr %32, i64 8
  %.sroa.41.0.copyload = load ptr, ptr %.sroa.41.0..sroa_idx, align 8, !tbaa !17
  tail call void @RangeFinder__checkAny__(ptr noundef %0, i32 %.sroa.0.0.copyload, ptr %.sroa.41.0.copyload)
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %33 = load i32, ptr %28, align 8, !tbaa !22
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next39, %34
  br i1 %35, label %.lr.ph36, label %._crit_edge, !llvm.loop !26

._crit_edge:                                      ; preds = %.lr.ph36, %.loopexit
  %36 = getelementptr inbounds i8, ptr %1, i64 64
  %37 = load ptr, ptr %36, align 8, !tbaa !27
  tail call void @RangeFinder__checkToken__(ptr noundef %0, ptr noundef %37)
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @RangeFinder__checkAttributes__(ptr noundef, ptr noundef) local_unnamed_addr #0

attributes #0 = { 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, !7, i64 8}
!6 = !{!"tag_____NamespaceDef__", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !10, i64 72, !7, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 32}
!13 = !{!6, !7, i64 40}
!14 = !{!15, !10, i64 8}
!15 = !{!"tag_____List__Ptr__Token______", !7, i64 0, !10, i64 8, !10, i64 12}
!16 = !{!15, !7, i64 0}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!6, !7, i64 48}
!21 = !{!6, !7, i64 56}
!22 = !{!23, !10, i64 8}
!23 = !{!"tag_____List__Node____", !7, i64 0, !10, i64 8, !10, i64 12}
!24 = !{!23, !7, i64 0}
!25 = !{!10, !10, i64 0}
!26 = distinct !{!26, !19}
!27 = !{!6, !7, i64 64}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass