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

; 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.tag_____ForIndexStatement__ = type { ptr, ptr, ptr, %struct.Node__, ptr, %struct.Node__, ptr, ptr }
%struct.Node__ = type { i32, ptr }
%struct.tag_____List__Ptr__Token______ = 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: nounwind uwtable
declare dso_local void @RangeFinder__checkToken__(ptr noundef, ptr noundef) #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @RangeFinder__checkForIndexStatement__(ptr noundef %0, ptr noundef %1) #1 {
  %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
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %9, i32 0, i32 0
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  call void @RangeFinder__checkToken__(ptr noundef %8, ptr noundef %11)
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %12, i32 0, i32 1
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %21

16:                                               ; preds = %2
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %18, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !13
  call void @RangeFinder__checkExpressionStatement__(ptr noundef %17, ptr noundef %20)
  br label %21

21:                                               ; preds = %16, %2
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %23, i32 0, i32 2
  %25 = load ptr, ptr %24, align 8, !tbaa !14
  call void @RangeFinder__checkToken__(ptr noundef %22, ptr noundef %25)
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %26, i32 0, i32 3
  %28 = getelementptr inbounds %struct.Node__, ptr %27, i32 0, i32 1
  %29 = load ptr, ptr %28, align 8, !tbaa !15
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %39

31:                                               ; preds = %21
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %33, i32 0, i32 3
  %35 = getelementptr inbounds { i32, ptr }, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 8
  %37 = getelementptr inbounds { i32, ptr }, ptr %34, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8
  call void @RangeFinder__checkAny__(ptr noundef %32, i32 %36, ptr %38)
  br label %39

39:                                               ; preds = %31, %21
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %41, i32 0, i32 4
  %43 = load ptr, ptr %42, align 8, !tbaa !16
  call void @RangeFinder__checkToken__(ptr noundef %40, ptr noundef %43)
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %44, i32 0, i32 5
  %46 = getelementptr inbounds %struct.Node__, ptr %45, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !17
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %57

49:                                               ; preds = %39
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %51, i32 0, i32 5
  %53 = getelementptr inbounds { i32, ptr }, ptr %52, i32 0, i32 0
  %54 = load i32, ptr %53, align 8
  %55 = getelementptr inbounds { i32, ptr }, ptr %52, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8
  call void @RangeFinder__checkAny__(ptr noundef %50, i32 %54, ptr %56)
  br label %57

57:                                               ; preds = %49, %39
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %58, i32 0, i32 6
  %60 = load ptr, ptr %59, align 8, !tbaa !18
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %85

62:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %63, i32 0, i32 6
  %65 = load ptr, ptr %64, align 8, !tbaa !18
  store ptr %65, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 0, ptr %6, align 4, !tbaa !19
  br label %66

66:                                               ; preds = %72, %62
  %67 = load i32, ptr %6, align 4, !tbaa !19
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.tag_____List__Ptr__Token______, ptr %68, i32 0, i32 1
  %70 = load i32, ptr %69, align 8, !tbaa !20
  %71 = icmp slt i32 %67, %70
  br i1 %71, label %72, label %84

72:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.tag_____List__Ptr__Token______, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !22
  %76 = load i32, ptr %6, align 4, !tbaa !19
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds ptr, ptr %75, i64 %77
  %79 = load ptr, ptr %78, align 8, !tbaa !5
  store ptr %79, ptr %7, align 8, !tbaa !5
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  call void @RangeFinder__checkToken__(ptr noundef %80, ptr noundef %81)
  %82 = load i32, ptr %6, align 4, !tbaa !19
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %6, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  br label %66, !llvm.loop !23

84:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  br label %85

85:                                               ; preds = %84, %57
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %86, i32 0, i32 7
  %88 = load ptr, ptr %87, align 8, !tbaa !25
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %95

90:                                               ; preds = %85
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.tag_____ForIndexStatement__, ptr %92, i32 0, i32 7
  %94 = load ptr, ptr %93, align 8, !tbaa !25
  call void @RangeFinder__checkBlockStatement__(ptr noundef %91, ptr noundef %94)
  br label %95

95:                                               ; preds = %90, %85
  ret void
}

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


; 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: 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__checkBlockStatement__(ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

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

7:                                                ; preds = %6, %2
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !13
  tail call void @RangeFinder__checkToken__(ptr noundef %0, ptr noundef %9)
  %10 = getelementptr inbounds i8, ptr %1, i64 32
  %11 = load ptr, ptr %10, align 8
  %.not31 = icmp eq ptr %11, null
  br i1 %.not31, label %15, label %12

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %1, i64 24
  %14 = load i32, ptr %13, align 8
  tail call void @RangeFinder__checkAny__(ptr noundef %0, i32 %14, ptr nonnull %11)
  br label %15

15:                                               ; preds = %12, %7
  %16 = getelementptr inbounds i8, ptr %1, i64 40
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  tail call void @RangeFinder__checkToken__(ptr noundef %0, ptr noundef %17)
  %18 = getelementptr inbounds i8, ptr %1, i64 56
  %19 = load ptr, ptr %18, align 8
  %.not32 = icmp eq ptr %19, null
  br i1 %.not32, label %23, label %20

20:                                               ; preds = %15
  %21 = getelementptr inbounds i8, ptr %1, i64 48
  %22 = load i32, ptr %21, align 8
  tail call void @RangeFinder__checkAny__(ptr noundef %0, i32 %22, ptr nonnull %19)
  br label %23

23:                                               ; preds = %20, %15
  %24 = getelementptr inbounds i8, ptr %1, i64 64
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  %.not33 = icmp eq ptr %25, null
  br i1 %.not33, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %23
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %27 = load i32, ptr %26, align 8, !tbaa !16
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader ]
  %29 = load ptr, ptr %25, align 8, !tbaa !18
  %30 = getelementptr inbounds ptr, ptr %29, i64 %indvars.iv
  %31 = load ptr, ptr %30, align 8, !tbaa !19
  tail call void @RangeFinder__checkToken__(ptr noundef %0, ptr noundef %31)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i32, ptr %26, align 8, !tbaa !16
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next, %33
  br i1 %34, label %.lr.ph, label %.loopexit, !llvm.loop !20

.loopexit:                                        ; preds = %.lr.ph, %.preheader, %23
  %35 = getelementptr inbounds i8, ptr %1, i64 72
  %36 = load ptr, ptr %35, align 8, !tbaa !22
  %.not34 = icmp eq ptr %36, null
  br i1 %.not34, label %38, label %37

37:                                               ; preds = %.loopexit
  tail call void @RangeFinder__checkBlockStatement__(ptr noundef %0, ptr noundef nonnull %36)
  br label %38

38:                                               ; preds = %37, %.loopexit
  ret void
}

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


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