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

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

@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 i64 @IntRange__cons__(i32 noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @Parser__readNumberSuffix__(ptr noundef) #3

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

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

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

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

28:                                               ; preds = %4
  %29 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  call void %30(i32 noundef -3)
  br label %31

31:                                               ; preds = %28, %4
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #4
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.string__, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !16
  %35 = load i32, ptr %10, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds i8, ptr %34, i64 %36
  %38 = load i8, ptr %37, align 1, !tbaa !17
  store i8 %38, ptr %11, align 1, !tbaa !17
  br label %39

39:                                               ; preds = %65, %31
  br label %40

40:                                               ; preds = %39
  %41 = load i8, ptr %11, align 1, !tbaa !17
  %42 = call zeroext i8 @Parser__isDigit__(i8 noundef signext %41)
  %43 = icmp ne i8 %42, 0
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  br label %73

45:                                               ; preds = %40
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.tag_____ParserState__, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !11
  %49 = add nsw i32 %48, 1
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.tag_____ParserState__, ptr %50, i32 0, i32 1
  store i32 %49, ptr %51, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.tag_____ParserState__, ptr %52, i32 0, i32 0
  store ptr %53, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.tag_____ParserState__, ptr %54, i32 0, i32 1
  %56 = load i32, ptr %55, align 8, !tbaa !11
  store i32 %56, ptr %13, align 4, !tbaa !9
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.string__, ptr %58, i32 0, i32 1
  %60 = load i32, ptr %59, align 8, !tbaa !15
  %61 = icmp ult i32 %57, %60
  br i1 %61, label %65, label %62

62:                                               ; preds = %45
  %63 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  call void %64(i32 noundef -3)
  br label %65

65:                                               ; preds = %62, %45
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.string__, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !16
  %69 = load i32, ptr %13, align 4, !tbaa !9
  %70 = zext i32 %69 to i64
  %71 = getelementptr inbounds i8, ptr %68, i64 %70
  %72 = load i8, ptr %71, align 1, !tbaa !17
  store i8 %72, ptr %11, align 1, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %39

73:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #4
  %74 = load i8, ptr %11, align 1, !tbaa !17
  %75 = sext i8 %74 to i32
  %76 = icmp eq i32 %75, 46
  %77 = zext i1 %76 to i32
  %78 = trunc i32 %77 to i8
  store i8 %78, ptr %14, align 1, !tbaa !17
  %79 = load i8, ptr %14, align 1, !tbaa !17
  %80 = icmp ne i8 %79, 0
  br i1 %80, label %87, label %81

81:                                               ; preds = %73
  %82 = load i8, ptr %11, align 1, !tbaa !17
  %83 = sext i8 %82 to i32
  %84 = icmp eq i32 %83, 101
  %85 = zext i1 %84 to i32
  %86 = trunc i32 %85 to i8
  store i8 %86, ptr %14, align 1, !tbaa !17
  br label %87

87:                                               ; preds = %81, %73
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #4
  %88 = load i8, ptr %14, align 1, !tbaa !17
  store i8 %88, ptr %15, align 1, !tbaa !17
  %89 = load i8, ptr %15, align 1, !tbaa !17
  %90 = icmp ne i8 %89, 0
  br i1 %90, label %97, label %91

91:                                               ; preds = %87
  %92 = load i8, ptr %11, align 1, !tbaa !17
  %93 = sext i8 %92 to i32
  %94 = icmp eq i32 %93, 69
  %95 = zext i1 %94 to i32
  %96 = trunc i32 %95 to i8
  store i8 %96, ptr %15, align 1, !tbaa !17
  br label %97

97:                                               ; preds = %91, %87
  %98 = load i8, ptr %15, align 1, !tbaa !17
  %99 = icmp ne i8 %98, 0
  br i1 %99, label %100, label %108

100:                                              ; preds = %97
  %101 = load i32, ptr %7, align 4, !tbaa !9
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.tag_____ParserState__, ptr %102, i32 0, i32 1
  store i32 %101, ptr %103, align 8, !tbaa !11
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = load i32, ptr %6, align 4, !tbaa !9
  %106 = load i32, ptr %7, align 4, !tbaa !9
  %107 = load i32, ptr %8, align 4, !tbaa !9
  call void @Parser__finishFloatNumber__(ptr noundef %104, i32 noundef %105, i32 noundef %106, i32 noundef %107)
  store i32 1, ptr %16, align 4
  br label %123

108:                                              ; preds = %97
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.tag_____ParserState__, ptr %109, i32 0, i32 10
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %111 = load i32, ptr %7, align 4, !tbaa !9
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.tag_____ParserState__, ptr %112, i32 0, i32 1
  %114 = load i32, ptr %113, align 8, !tbaa !11
  %115 = call i64 @IntRange__cons__(i32 noundef %111, i32 noundef %114)
  store i64 %115, ptr %17, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %110, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.tag_____ParserState__, ptr %116, i32 0, i32 11
  store i32 1, ptr %117, align 8, !tbaa !19
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  call void @Parser__readNumberSuffix__(ptr noundef %118)
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = load i32, ptr %6, align 4, !tbaa !9
  %121 = load i32, ptr %7, align 4, !tbaa !9
  %122 = load i32, ptr %8, align 4, !tbaa !9
  call void @Parser__finishToken__(ptr noundef %119, i32 noundef %120, i32 noundef %121, i32 noundef %122, i32 noundef 1)
  store i32 0, ptr %16, align 4
  br label %123

123:                                              ; preds = %108, %100
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %124 = load i32, ptr %16, align 4
  switch i32 %124, label %126 [
    i32 0, label %125
    i32 1, label %125
  ]

125:                                              ; preds = %123, %123
  ret void

126:                                              ; preds = %123
  unreachable
}

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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 16}
!12 = !{!"tag_____ParserState__", !13, 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, !14, i64 72, !10, i64 80, !10, i64 84, !6, i64 88, !10, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!13 = !{!"", !6, i64 0, !10, i64 8}
!14 = !{!"tag_____IntRange__", !10, i64 0, !10, i64 4}
!15 = !{!13, !10, i64 8}
!16 = !{!13, !6, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{i64 0, i64 4, !9, i64 4, i64 4, !9}
!19 = !{!12, !10, i64 80}


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

@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 i64 @IntRange__cons__(i32 noundef, i32 noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @Parser__finishNumber__(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !13
  %9 = icmp ult i32 %6, %8
  br i1 %9, label %13, label %10

10:                                               ; preds = %4
  %11 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  tail call void %12(i32 noundef -3) #2
  br label %13

13:                                               ; preds = %10, %4
  %14 = load ptr, ptr %0, align 8, !tbaa !15
  %15 = zext i32 %6 to i64
  %16 = getelementptr inbounds i8, ptr %14, i64 %15
  %.041 = load i8, ptr %16, align 1, !tbaa !16
  %17 = tail call zeroext i8 @Parser__isDigit__(i8 noundef signext %.041)
  %.not42 = icmp eq i8 %17, 0
  br i1 %.not42, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %13
  %18 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  br label %19

19:                                               ; preds = %.lr.ph, %26
  %20 = load i32, ptr %5, align 8, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %5, align 8, !tbaa !5
  %22 = load i32, ptr %7, align 8, !tbaa !13
  %23 = icmp ult i32 %21, %22
  br i1 %23, label %26, label %24

24:                                               ; preds = %19
  %25 = load ptr, ptr %18, align 8, !tbaa !14
  tail call void %25(i32 noundef -3) #2
  br label %26

26:                                               ; preds = %24, %19
  %27 = load ptr, ptr %0, align 8, !tbaa !15
  %28 = zext i32 %21 to i64
  %29 = getelementptr inbounds i8, ptr %27, i64 %28
  %.0 = load i8, ptr %29, align 1, !tbaa !16
  %30 = tail call zeroext i8 @Parser__isDigit__(i8 noundef signext %.0)
  %.not = icmp eq i8 %30, 0
  br i1 %.not, label %._crit_edge, label %19

._crit_edge:                                      ; preds = %26, %13
  %.0.lcssa = phi i8 [ %.041, %13 ], [ %.0, %26 ]
  switch i8 %.0.lcssa, label %31 [
    i8 101, label %.critedge
    i8 69, label %.critedge
    i8 46, label %.critedge
  ]

.critedge:                                        ; preds = %._crit_edge, %._crit_edge, %._crit_edge
  store i32 %2, ptr %5, align 8, !tbaa !5
  tail call void @Parser__finishFloatNumber__(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %2, i32 noundef %3)
  br label %36

31:                                               ; preds = %._crit_edge
  %32 = getelementptr inbounds i8, ptr %0, i64 72
  %33 = load i32, ptr %5, align 8, !tbaa !5
  %34 = tail call i64 @IntRange__cons__(i32 noundef %2, i32 noundef %33)
  store i64 %34, ptr %32, align 8
  %35 = getelementptr inbounds i8, ptr %0, i64 80
  store i32 1, ptr %35, align 8, !tbaa !17
  tail call void @Parser__readNumberSuffix__(ptr noundef nonnull %0)
  tail call void @Parser__finishToken__(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef 1)
  br label %36

36:                                               ; preds = %31, %.critedge
  ret void
}

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, !11, i64 16}
!6 = !{!"tag_____ParserState__", !7, i64 0, !11, i64 16, !8, i64 24, !8, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !8, i64 64, !12, i64 72, !11, i64 80, !11, i64 84, !8, i64 88, !11, i64 96, !8, i64 104, !8, i64 112, !8, i64 120}
!7 = !{!"", !8, i64 0, !11, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"tag_____IntRange__", !11, i64 0, !11, i64 4}
!13 = !{!7, !11, i64 8}
!14 = !{!8, !8, i64 0}
!15 = !{!7, !8, i64 0}
!16 = !{!9, !9, i64 0}
!17 = !{!6, !11, i64 80}


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