; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_CGenerator (genNumberExpression__)

; 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_____IntRange__ = type { i32, i32 }
%struct.tag_____NumberExpression__ = type { ptr, %struct.tag_____IntRange__, i32, %struct.tag_____Tag__, i64 }
%struct.tag_____Tag__ = type { ptr, ptr }
%struct.tag_____Namespace__ = type { %struct.string__, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.tag_____Token__ = type { i32, %struct.string__, %struct.tag_____IntRange__, %struct.tag_____IntRange__, i32 }
%struct.tag_____GenerateContext__ = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, %struct.string__, i32, %struct.string__, i32, ptr, ptr, i8 }
%struct.tag_____CommonTags__ = type { %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@mu_____string431 = external dso_local global %struct.string__, 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @IntRange__cons__(i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @CGenerator__genNumberExpression__(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.tag_____IntRange__, align 4
  %8 = alloca %struct.string__, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.tag_____NumberExpression__, ptr %9, i32 0, i32 3
  %11 = getelementptr inbounds %struct.tag_____Tag__, ptr %10, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = getelementptr inbounds %struct.tag_____Namespace__, ptr %12, i32 0, i32 3
  %14 = load i32, ptr %13, align 4, !tbaa !15
  %15 = and i32 %14, 1
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %29

17:                                               ; preds = %3
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.tag_____NumberExpression__, ptr %19, i32 0, i32 3
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.tag_____NumberExpression__, ptr %21, i32 0, i32 4
  %23 = load i64, ptr %22, align 8, !tbaa !18
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds { ptr, ptr }, ptr %20, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8
  %27 = getelementptr inbounds { ptr, ptr }, ptr %20, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8
  call void @CGenerator__genOpaqueValue__(ptr noundef %18, ptr %26, ptr %28, i64 noundef %23, ptr noundef %24)
  br label %91

29:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.tag_____NumberExpression__, ptr %30, i32 0, i32 1
  %32 = getelementptr inbounds %struct.tag_____IntRange__, ptr %31, i32 0, i32 0
  %33 = load i32, ptr %32, align 8, !tbaa !19
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.tag_____NumberExpression__, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !20
  %37 = getelementptr inbounds %struct.tag_____Token__, ptr %36, i32 0, i32 2
  %38 = getelementptr inbounds %struct.tag_____IntRange__, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !21
  %40 = sub nsw i32 %33, %39
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.tag_____NumberExpression__, ptr %41, i32 0, i32 1
  %43 = getelementptr inbounds %struct.tag_____IntRange__, ptr %42, i32 0, i32 1
  %44 = load i32, ptr %43, align 4, !tbaa !23
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.tag_____NumberExpression__, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !20
  %48 = getelementptr inbounds %struct.tag_____Token__, ptr %47, i32 0, i32 2
  %49 = getelementptr inbounds %struct.tag_____IntRange__, ptr %48, i32 0, i32 0
  %50 = load i32, ptr %49, align 8, !tbaa !21
  %51 = sub nsw i32 %44, %50
  %52 = call i64 @IntRange__cons__(i32 noundef %40, i32 noundef %51)
  store i64 %52, ptr %7, align 4
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.tag_____NumberExpression__, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !20
  %57 = getelementptr inbounds %struct.tag_____Token__, ptr %56, i32 0, i32 1
  %58 = getelementptr inbounds %struct.tag_____IntRange__, ptr %7, i32 0, i32 0
  %59 = load i32, ptr %58, align 4, !tbaa !24
  %60 = getelementptr inbounds %struct.tag_____IntRange__, ptr %7, i32 0, i32 1
  %61 = load i32, ptr %60, align 4, !tbaa !25
  %62 = getelementptr inbounds { ptr, i32 }, ptr %57, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8
  %64 = getelementptr inbounds { ptr, i32 }, ptr %57, i32 0, i32 1
  %65 = load i32, ptr %64, align 8
  %66 = call { ptr, i32 } @string__slice__(ptr %63, i32 %65, i32 noundef %59, i32 noundef %61)
  %67 = getelementptr inbounds { ptr, i32 }, ptr %8, i32 0, i32 0
  %68 = extractvalue { ptr, i32 } %66, 0
  store ptr %68, ptr %67, align 8
  %69 = getelementptr inbounds { ptr, i32 }, ptr %8, i32 0, i32 1
  %70 = extractvalue { ptr, i32 } %66, 1
  store i32 %70, ptr %69, align 8
  %71 = getelementptr inbounds { ptr, i32 }, ptr %8, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8
  %73 = getelementptr inbounds { ptr, i32 }, ptr %8, i32 0, i32 1
  %74 = load i32, ptr %73, align 8
  call void @StringBuilder__write__(ptr noundef %53, ptr %72, i32 %74)
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.tag_____NumberExpression__, ptr %75, i32 0, i32 3
  %77 = getelementptr inbounds %struct.tag_____Tag__, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !9
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %79, i32 0, i32 4
  %81 = load ptr, ptr %80, align 8, !tbaa !26
  %82 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %81, i32 0, i32 12
  %83 = getelementptr inbounds %struct.tag_____Tag__, ptr %82, i32 0, i32 0
  %84 = load ptr, ptr %83, align 8, !tbaa !28
  %85 = icmp eq ptr %78, %84
  br i1 %85, label %86, label %90

86:                                               ; preds = %29
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = load ptr, ptr @mu_____string431, align 8
  %89 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string431, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %87, ptr %88, i32 %89)
  br label %90

90:                                               ; preds = %86, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  br label %91

91:                                               ; preds = %90, %17
  ret void
}

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

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

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 24}
!10 = !{!"tag_____NumberExpression__", !6, i64 0, !11, i64 8, !12, i64 16, !13, i64 24, !14, i64 40}
!11 = !{!"tag_____IntRange__", !12, i64 0, !12, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!"tag_____Tag__", !6, i64 0, !6, i64 8}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !12, i64 28}
!16 = !{!"tag_____Namespace__", !17, i64 0, !6, i64 16, !12, i64 24, !12, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !12, i64 104}
!17 = !{!"", !6, i64 0, !12, i64 8}
!18 = !{!10, !14, i64 40}
!19 = !{!10, !12, i64 8}
!20 = !{!10, !6, i64 0}
!21 = !{!22, !12, i64 24}
!22 = !{!"tag_____Token__", !12, i64 0, !17, i64 8, !11, i64 24, !11, i64 32, !12, i64 40}
!23 = !{!10, !12, i64 12}
!24 = !{!11, !12, i64 0}
!25 = !{!11, !12, i64 4}
!26 = !{!27, !6, i64 32}
!27 = !{!"tag_____GenerateContext__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !12, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !17, i64 80, !12, i64 96, !17, i64 104, !12, i64 120, !6, i64 128, !6, i64 136, !7, i64 144}
!28 = !{!29, !6, i64 192}
!29 = !{!"tag_____CommonTags__", !13, i64 0, !13, i64 16, !13, i64 32, !13, i64 48, !13, i64 64, !13, i64 80, !13, i64 96, !13, i64 112, !13, i64 128, !13, i64 144, !13, i64 160, !13, i64 176, !13, i64 192, !13, i64 208, !13, i64 224, !13, i64 240, !13, i64 256, !13, i64 272, !13, i64 288, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376}


; 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_____string431 = external dso_local local_unnamed_addr global %struct.string__, align 8

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @IntRange__cons__(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @CGenerator__genNumberExpression__(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %1, i64 24
  %5 = load ptr, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr %5, i64 28
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = and i32 %7, 1
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %14, label %9

9:                                                ; preds = %3
  %10 = getelementptr inbounds i8, ptr %1, i64 40
  %11 = load i64, ptr %10, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %1, i64 32
  %13 = load ptr, ptr %12, align 8
  tail call void @CGenerator__genOpaqueValue__(ptr noundef %0, ptr nonnull %5, ptr %13, i64 noundef %11, ptr noundef %2)
  br label %42

14:                                               ; preds = %3
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !17
  %17 = load ptr, ptr %1, align 8, !tbaa !18
  %18 = getelementptr inbounds i8, ptr %17, i64 24
  %19 = load i32, ptr %18, align 8, !tbaa !19
  %20 = sub nsw i32 %16, %19
  %21 = getelementptr inbounds i8, ptr %1, i64 12
  %22 = load i32, ptr %21, align 4, !tbaa !21
  %23 = sub nsw i32 %22, %19
  %24 = tail call i64 @IntRange__cons__(i32 noundef %20, i32 noundef %23)
  %.sroa.01.0.extract.trunc = trunc i64 %24 to i32
  %.sroa.4.0.extract.shift = lshr i64 %24, 32
  %.sroa.4.0.extract.trunc = trunc nuw i64 %.sroa.4.0.extract.shift to i32
  %25 = load ptr, ptr %1, align 8, !tbaa !18
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %27 = load ptr, ptr %26, align 8
  %28 = getelementptr inbounds i8, ptr %25, i64 16
  %29 = load i32, ptr %28, align 8
  %30 = tail call { ptr, i32 } @string__slice__(ptr %27, i32 %29, i32 noundef %.sroa.01.0.extract.trunc, i32 noundef %.sroa.4.0.extract.trunc)
  %31 = extractvalue { ptr, i32 } %30, 0
  %32 = extractvalue { ptr, i32 } %30, 1
  tail call void @StringBuilder__write__(ptr noundef %2, ptr %31, i32 %32)
  %33 = load ptr, ptr %4, align 8, !tbaa !22
  %34 = getelementptr inbounds i8, ptr %0, i64 32
  %35 = load ptr, ptr %34, align 8, !tbaa !23
  %36 = getelementptr inbounds i8, ptr %35, i64 192
  %37 = load ptr, ptr %36, align 8, !tbaa !25
  %38 = icmp eq ptr %33, %37
  br i1 %38, label %39, label %42

39:                                               ; preds = %14
  %40 = load ptr, ptr @mu_____string431, align 8
  %41 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string431, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %2, ptr %40, i32 %41)
  br label %42

42:                                               ; preds = %14, %39, %9
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @CGenerator__genOpaqueValue__(ptr noundef, ptr, ptr, i64 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, !11, i64 28}
!6 = !{!"tag_____Namespace__", !7, i64 0, !8, i64 16, !11, i64 24, !11, i64 28, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !11, i64 104}
!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 = !{!13, !16, i64 40}
!13 = !{!"tag_____NumberExpression__", !8, i64 0, !14, i64 8, !11, i64 16, !15, i64 24, !16, i64 40}
!14 = !{!"tag_____IntRange__", !11, i64 0, !11, i64 4}
!15 = !{!"tag_____Tag__", !8, i64 0, !8, i64 8}
!16 = !{!"long", !9, i64 0}
!17 = !{!13, !11, i64 8}
!18 = !{!13, !8, i64 0}
!19 = !{!20, !11, i64 24}
!20 = !{!"tag_____Token__", !11, i64 0, !7, i64 8, !14, i64 24, !14, i64 32, !11, i64 40}
!21 = !{!13, !11, i64 12}
!22 = !{!13, !8, i64 24}
!23 = !{!24, !8, i64 32}
!24 = !{!"tag_____GenerateContext__", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !11, i64 48, !11, i64 52, !8, i64 56, !8, i64 64, !8, i64 72, !7, i64 80, !11, i64 96, !7, i64 104, !11, i64 120, !8, i64 128, !8, i64 136, !9, i64 144}
!25 = !{!26, !8, i64 192}
!26 = !{!"tag_____CommonTags__", !15, i64 0, !15, i64 16, !15, i64 32, !15, i64 48, !15, i64 64, !15, i64 80, !15, i64 96, !15, i64 112, !15, i64 128, !15, i64 144, !15, i64 160, !15, i64 176, !15, i64 192, !15, i64 208, !15, i64 224, !15, i64 240, !15, i64 256, !15, i64 272, !15, i64 288, !8, i64 304, !8, i64 312, !8, i64 320, !8, i64 328, !8, i64 336, !8, i64 344, !8, i64 352, !8, i64 360, !8, i64 368, !8, i64 376}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass