; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_Parser (checkTabSizeDirective__)

; 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.string__ = type { ptr, i32 }
%struct.tag_____Maybe__long____ = type { i64, i8 }
%struct.tag_____ParserState__ = type { %struct.string__, i32, ptr, ptr, i32, i32, i32, i32, i32, ptr, %struct.tag_____IntRange__, i32, i32, ptr, i32, ptr, ptr, ptr }
%struct.tag_____IntRange__ = type { i32, i32 }

@mu_____string287 = external dso_local global %struct.string__, align 8
@top_____abandonFn__ = external dso_local thread_local global ptr, align 8

; 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 speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

; 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) #2

; Function Attrs: nounwind uwtable
declare dso_local { ptr, i32 } @string__slice__(ptr, i32, i32 noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @string__startsWith__(ptr, i32, ptr, i32) #3

; Function Attrs: nounwind uwtable
declare dso_local i64 @Maybe__unwrap__long____(i64, i8) #3

; Function Attrs: nounwind uwtable
declare dso_local { i64, i8 } @long__tryParse__(ptr, i32) #3

; Function Attrs: nounwind uwtable
define dso_local void @Parser__checkTabSizeDirective__(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.string__, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  %12 = alloca %struct.tag_____Maybe__long____, align 8
  %13 = alloca %struct.string__, align 8
  %14 = alloca i8, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 @mu_____string287, i64 16, i1 false), !tbaa.struct !9
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.tag_____ParserState__, ptr %15, i32 0, i32 0
  %17 = getelementptr inbounds { ptr, i32 }, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8
  %19 = getelementptr inbounds { ptr, i32 }, ptr %16, i32 0, i32 1
  %20 = load i32, ptr %19, align 8
  %21 = getelementptr inbounds { ptr, i32 }, ptr %3, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8
  %23 = getelementptr inbounds { ptr, i32 }, ptr %3, i32 0, i32 1
  %24 = load i32, ptr %23, align 8
  %25 = call zeroext i8 @string__startsWith__(ptr %18, i32 %20, ptr %22, i32 %24)
  %26 = icmp ne i8 %25, 0
  br i1 %26, label %28, label %27

27:                                               ; preds = %1
  store i32 1, ptr %4, align 4
  br label %131

28:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %29 = getelementptr inbounds %struct.string__, ptr %3, i32 0, i32 1
  %30 = load i32, ptr %29, align 8, !tbaa !12
  store i32 %30, ptr %5, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %31 = load i32, ptr %5, align 4, !tbaa !10
  store i32 %31, ptr %6, align 4, !tbaa !10
  br label %32

32:                                               ; preds = %61, %28
  br label %33

33:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.tag_____ParserState__, ptr %34, i32 0, i32 0
  store ptr %35, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %36 = load i32, ptr %6, align 4, !tbaa !10
  store i32 %36, ptr %8, align 4, !tbaa !10
  %37 = load i32, ptr %8, align 4, !tbaa !10
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.string__, ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !12
  %41 = icmp ult i32 %37, %40
  br i1 %41, label %45, label %42

42:                                               ; preds = %33
  %43 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  call void %44(i32 noundef -3)
  br label %45

45:                                               ; preds = %42, %33
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.string__, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !14
  %49 = load i32, ptr %8, align 4, !tbaa !10
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %48, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !15
  %53 = call zeroext i8 @Parser__isDigit__(i8 noundef signext %52)
  %54 = icmp ne i8 %53, 0
  br i1 %54, label %56, label %55

55:                                               ; preds = %45
  store i32 3, ptr %4, align 4
  br label %59

56:                                               ; preds = %45
  %57 = load i32, ptr %6, align 4, !tbaa !10
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %6, align 4, !tbaa !10
  store i32 0, ptr %4, align 4
  br label %59

59:                                               ; preds = %56, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %60 = load i32, ptr %4, align 4
  switch i32 %60, label %134 [
    i32 0, label %61
    i32 3, label %62
  ]

61:                                               ; preds = %59
  br label %32

62:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %63 = load i32, ptr %6, align 4, !tbaa !10
  %64 = load i32, ptr %5, align 4, !tbaa !10
  %65 = sub nsw i32 %63, %64
  store i32 %65, ptr %9, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  %66 = load i32, ptr %9, align 4, !tbaa !10
  %67 = icmp eq i32 %66, 1
  %68 = zext i1 %67 to i32
  %69 = trunc i32 %68 to i8
  store i8 %69, ptr %10, align 1, !tbaa !15
  %70 = load i8, ptr %10, align 1, !tbaa !15
  %71 = icmp ne i8 %70, 0
  br i1 %71, label %77, label %72

72:                                               ; preds = %62
  %73 = load i32, ptr %9, align 4, !tbaa !10
  %74 = icmp eq i32 %73, 2
  %75 = zext i1 %74 to i32
  %76 = trunc i32 %75 to i8
  store i8 %76, ptr %10, align 1, !tbaa !15
  br label %77

77:                                               ; preds = %72, %62
  %78 = load i8, ptr %10, align 1, !tbaa !15
  %79 = icmp ne i8 %78, 0
  br i1 %79, label %80, label %130

80:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.tag_____ParserState__, ptr %81, i32 0, i32 0
  %83 = load i32, ptr %5, align 4, !tbaa !10
  %84 = load i32, ptr %6, align 4, !tbaa !10
  %85 = getelementptr inbounds { ptr, i32 }, ptr %82, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8
  %87 = getelementptr inbounds { ptr, i32 }, ptr %82, i32 0, i32 1
  %88 = load i32, ptr %87, align 8
  %89 = call { ptr, i32 } @string__slice__(ptr %86, i32 %88, i32 noundef %83, i32 noundef %84)
  %90 = getelementptr inbounds { ptr, i32 }, ptr %13, i32 0, i32 0
  %91 = extractvalue { ptr, i32 } %89, 0
  store ptr %91, ptr %90, align 8
  %92 = getelementptr inbounds { ptr, i32 }, ptr %13, i32 0, i32 1
  %93 = extractvalue { ptr, i32 } %89, 1
  store i32 %93, ptr %92, align 8
  %94 = getelementptr inbounds { ptr, i32 }, ptr %13, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8
  %96 = getelementptr inbounds { ptr, i32 }, ptr %13, i32 0, i32 1
  %97 = load i32, ptr %96, align 8
  %98 = call { i64, i8 } @long__tryParse__(ptr %95, i32 %97)
  %99 = getelementptr inbounds { i64, i8 }, ptr %12, i32 0, i32 0
  %100 = extractvalue { i64, i8 } %98, 0
  store i64 %100, ptr %99, align 8
  %101 = getelementptr inbounds { i64, i8 }, ptr %12, i32 0, i32 1
  %102 = extractvalue { i64, i8 } %98, 1
  store i8 %102, ptr %101, align 8
  %103 = getelementptr inbounds { i64, i8 }, ptr %12, i32 0, i32 0
  %104 = load i64, ptr %103, align 8
  %105 = getelementptr inbounds { i64, i8 }, ptr %12, i32 0, i32 1
  %106 = load i8, ptr %105, align 8
  %107 = call i64 @Maybe__unwrap__long____(i64 %104, i8 %106)
  %108 = trunc i64 %107 to i32
  store i32 %108, ptr %11, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #4
  %109 = load i32, ptr %11, align 4, !tbaa !10
  %110 = icmp sle i32 1, %109
  %111 = zext i1 %110 to i32
  %112 = trunc i32 %111 to i8
  store i8 %112, ptr %14, align 1, !tbaa !15
  %113 = load i8, ptr %14, align 1, !tbaa !15
  %114 = icmp ne i8 %113, 0
  br i1 %114, label %115, label %120

115:                                              ; preds = %80
  %116 = load i32, ptr %11, align 4, !tbaa !10
  %117 = icmp sle i32 %116, 16
  %118 = zext i1 %117 to i32
  %119 = trunc i32 %118 to i8
  store i8 %119, ptr %14, align 1, !tbaa !15
  br label %120

120:                                              ; preds = %115, %80
  %121 = load i8, ptr %14, align 1, !tbaa !15
  %122 = icmp ne i8 %121, 0
  br i1 %122, label %123, label %129

123:                                              ; preds = %120
  %124 = load i32, ptr %11, align 4, !tbaa !10
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.tag_____ParserState__, ptr %125, i32 0, i32 6
  store i32 %124, ptr %126, align 8, !tbaa !16
  %127 = load ptr, ptr %2, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.tag_____ParserState__, ptr %127, i32 0, i32 7
  store i32 3, ptr %128, align 4, !tbaa !19
  br label %129

129:                                              ; preds = %123, %120
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %130

130:                                              ; preds = %129, %77
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  store i32 0, ptr %4, align 4
  br label %131

131:                                              ; preds = %130, %27
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #4
  %132 = load i32, ptr %4, align 4
  switch i32 %132, label %134 [
    i32 0, label %133
    i32 1, label %133
  ]

133:                                              ; preds = %131, %131
  ret void

134:                                              ; preds = %131, %59
  unreachable
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Parser__isDigit__(i8 noundef signext) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 = !{i64 0, i64 8, !5, i64 8, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"", !6, i64 0, !11, i64 8}
!14 = !{!13, !6, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !11, i64 48}
!17 = !{!"tag_____ParserState__", !13, i64 0, !11, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !6, i64 64, !18, i64 72, !11, i64 80, !11, i64 84, !6, i64 88, !11, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!18 = !{!"tag_____IntRange__", !11, i64 0, !11, i64 4}
!19 = !{!17, !11, i64 52}


; 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.string__ = type { ptr, i32 }

@mu_____string287 = external dso_local local_unnamed_addr global %struct.string__, align 8
@top_____abandonFn__ = external dso_local thread_local local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

; Function Attrs: nounwind uwtable
declare dso_local { ptr, i32 } @string__slice__(ptr, i32, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @string__startsWith__(ptr, i32, ptr, i32) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @Maybe__unwrap__long____(i64, i8) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local { i64, i8 } @long__tryParse__(ptr, i32) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @Parser__checkTabSizeDirective__(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %.sroa.022.0.copyload = load ptr, ptr @mu_____string287, align 8, !tbaa !5
  %.sroa.4.0.copyload = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string287, i64 8), align 8, !tbaa !9
  %2 = load ptr, ptr %0, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load i32, ptr %3, align 8
  %5 = tail call zeroext i8 @string__startsWith__(ptr %2, i32 %4, ptr %.sroa.022.0.copyload, i32 %.sroa.4.0.copyload)
  %.not = icmp eq i8 %5, 0
  br i1 %.not, label %36, label %.preheader

.preheader:                                       ; preds = %1
  %6 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  br label %7

7:                                                ; preds = %.preheader, %12
  %.030 = phi i32 [ %18, %12 ], [ %.sroa.4.0.copyload, %.preheader ]
  %8 = load i32, ptr %3, align 8, !tbaa !11
  %9 = icmp ult i32 %.030, %8
  br i1 %9, label %12, label %10

10:                                               ; preds = %7
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  tail call void %11(i32 noundef -3) #2
  br label %12

12:                                               ; preds = %10, %7
  %13 = load ptr, ptr %0, align 8, !tbaa !13
  %14 = zext i32 %.030 to i64
  %15 = getelementptr inbounds i8, ptr %13, i64 %14
  %16 = load i8, ptr %15, align 1, !tbaa !14
  %17 = tail call zeroext i8 @Parser__isDigit__(i8 noundef signext %16)
  %.not34 = icmp eq i8 %17, 0
  %18 = add nsw i32 %.030, 1
  br i1 %.not34, label %19, label %7

19:                                               ; preds = %12
  %reass.sub = sub i32 %.030, %.sroa.4.0.copyload
  %20 = add i32 %reass.sub, -3
  %spec.select = icmp ult i32 %20, -2
  br i1 %spec.select, label %36, label %21

21:                                               ; preds = %19
  %22 = load ptr, ptr %0, align 8
  %23 = load i32, ptr %3, align 8
  %24 = tail call { ptr, i32 } @string__slice__(ptr %22, i32 %23, i32 noundef %.sroa.4.0.copyload, i32 noundef %.030)
  %25 = extractvalue { ptr, i32 } %24, 0
  %26 = extractvalue { ptr, i32 } %24, 1
  %27 = tail call { i64, i8 } @long__tryParse__(ptr %25, i32 %26)
  %28 = extractvalue { i64, i8 } %27, 0
  %29 = extractvalue { i64, i8 } %27, 1
  %30 = tail call i64 @Maybe__unwrap__long____(i64 %28, i8 %29)
  %31 = trunc i64 %30 to i32
  %32 = add i32 %31, -17
  %spec.select37 = icmp ult i32 %32, -16
  br i1 %spec.select37, label %36, label %33

33:                                               ; preds = %21
  %34 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %31, ptr %34, align 8, !tbaa !15
  %35 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 3, ptr %35, align 4, !tbaa !18
  br label %36

36:                                               ; preds = %19, %33, %21, %1
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Parser__isDigit__(i8 noundef signext) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"", !6, i64 0, !10, i64 8}
!13 = !{!12, !6, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !10, i64 48}
!16 = !{!"tag_____ParserState__", !12, i64 0, !10, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !6, i64 64, !17, i64 72, !10, i64 80, !10, i64 84, !6, i64 88, !10, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!17 = !{!"tag_____IntRange__", !10, i64 0, !10, i64 4}
!18 = !{!16, !10, i64 52}


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