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

; 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_____IAllocator__ = type { ptr, ptr, ptr, ptr }
%struct.Node__ = type { i32, ptr }
%struct.tag_____Tag__ = type { ptr, ptr }
%struct.tag_____StringBuilder__ = type { ptr, i32, 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 }

@mu_____string248 = external dso_local global %struct.string__, align 8
@mu_____string433 = external dso_local global %struct.string__, align 8
@mu_____string303 = external dso_local global %struct.string__, align 8
@mu_____string324 = external dso_local global %struct.string__, align 8
@mu_____string421 = external dso_local global %struct.string__, align 8
@mu_____string422 = external dso_local global %struct.string__, align 8
@top_____currentAllocator__ = external dso_local thread_local global %struct.tag_____IAllocator__, 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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @CGenerator__genLvalueRefExpression__(ptr noundef %0, i32 %1, ptr %2, ptr %3, ptr %4, ptr noundef %5) #4 {
  %7 = alloca %struct.Node__, align 8
  %8 = alloca %struct.tag_____Tag__, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %struct.tag_____StringBuilder__, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %struct.string__, align 8
  %15 = alloca %struct.string__, align 8
  %16 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 0
  store i32 %1, ptr %16, align 8
  %17 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 1
  store ptr %2, ptr %17, align 8
  %18 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  store ptr %3, ptr %18, align 8
  %19 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  store ptr %4, ptr %19, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %5, ptr %10, align 8, !tbaa !5
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 0
  %22 = load i32, ptr %21, align 8
  %23 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8
  %25 = call zeroext i8 @CGenerator__isLvalueApprox__(ptr noundef %20, i32 %22, ptr %24)
  %26 = icmp ne i8 %25, 0
  br i1 %26, label %27, label %40

27:                                               ; preds = %6
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = load ptr, ptr @mu_____string433, align 8
  %30 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string433, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %28, ptr %29, i32 %30)
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 0
  %34 = load i32, ptr %33, align 8
  %35 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 1
  %36 = load ptr, ptr %35, align 8
  call void @CGenerator__genExpression__(ptr noundef %31, i32 %34, ptr %36, ptr noundef %32)
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = load ptr, ptr @mu_____string303, align 8
  %39 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string303, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %37, ptr %38, i32 %39)
  br label %102

40:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %41 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____currentAllocator__)
  %42 = getelementptr inbounds %struct.tag_____IAllocator__, ptr %41, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %44 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____currentAllocator__)
  %45 = getelementptr inbounds %struct.tag_____IAllocator__, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = call ptr %43(ptr noundef %46, i64 noundef 16)
  store ptr %47, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #5
  call void @llvm.memset.p0.i64(ptr align 8 %12, i8 0, i64 16, i1 false)
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %48, ptr align 8 %12, i64 16, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %49, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #5
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = call { ptr, i32 } @CGenerator__newLocal__(ptr noundef %50)
  %52 = getelementptr inbounds { ptr, i32 }, ptr %14, i32 0, i32 0
  %53 = extractvalue { ptr, i32 } %51, 0
  store ptr %53, ptr %52, align 8
  %54 = getelementptr inbounds { ptr, i32 }, ptr %14, i32 0, i32 1
  %55 = extractvalue { ptr, i32 } %51, 1
  store i32 %55, ptr %54, align 8
  %56 = load ptr, ptr %13, align 8, !tbaa !5
  %57 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8
  %59 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8
  call void @CGenerator__writeTag__(ptr noundef %56, ptr %58, ptr %60)
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = load ptr, ptr @mu_____string421, align 8
  %63 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string421, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %61, ptr %62, i32 %63)
  %64 = load ptr, ptr %13, align 8, !tbaa !5
  %65 = getelementptr inbounds { ptr, i32 }, ptr %14, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8
  %67 = getelementptr inbounds { ptr, i32 }, ptr %14, i32 0, i32 1
  %68 = load i32, ptr %67, align 8
  call void @StringBuilder__write__(ptr noundef %64, ptr %66, i32 %68)
  %69 = load ptr, ptr %13, align 8, !tbaa !5
  %70 = load ptr, ptr @mu_____string422, align 8
  %71 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string422, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %69, ptr %70, i32 %71)
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = load ptr, ptr %13, align 8, !tbaa !5
  %74 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 0
  %75 = load i32, ptr %74, align 8
  %76 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8
  call void @CGenerator__genExpression__(ptr noundef %72, i32 %75, ptr %77, ptr noundef %73)
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = load ptr, ptr @mu_____string324, align 8
  %80 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string324, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %78, ptr %79, i32 %80)
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %81, i32 0, i32 5
  %83 = load ptr, ptr %82, align 8, !tbaa !15
  %84 = load ptr, ptr %13, align 8, !tbaa !5
  %85 = call { ptr, i32 } @StringBuilder__toString__(ptr noundef %84)
  %86 = getelementptr inbounds { ptr, i32 }, ptr %15, i32 0, i32 0
  %87 = extractvalue { ptr, i32 } %85, 0
  store ptr %87, ptr %86, align 8
  %88 = getelementptr inbounds { ptr, i32 }, ptr %15, i32 0, i32 1
  %89 = extractvalue { ptr, i32 } %85, 1
  store i32 %89, ptr %88, align 8
  %90 = getelementptr inbounds { ptr, i32 }, ptr %15, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8
  %92 = getelementptr inbounds { ptr, i32 }, ptr %15, i32 0, i32 1
  %93 = load i32, ptr %92, align 8
  call void @CodeBuilder__writeLine__(ptr noundef %83, ptr %91, i32 %93)
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = load ptr, ptr @mu_____string248, align 8
  %96 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string248, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %94, ptr %95, i32 %96)
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = getelementptr inbounds { ptr, i32 }, ptr %14, i32 0, i32 0
  %99 = load ptr, ptr %98, align 8
  %100 = getelementptr inbounds { ptr, i32 }, ptr %14, i32 0, i32 1
  %101 = load i32, ptr %100, align 8
  call void @StringBuilder__write__(ptr noundef %97, ptr %99, i32 %101)
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %102

102:                                              ; preds = %40, %27
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @CGenerator__isLvalueApprox__(ptr noundef, i32, ptr) #4

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: write) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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_____IAllocator__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!10, !6, i64 0}
!12 = !{i64 0, i64 8, !5, i64 8, i64 4, !13, i64 12, i64 4, !13}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 40}
!16 = !{!"tag_____GenerateContext__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !14, i64 48, !14, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !17, i64 80, !14, i64 96, !17, i64 104, !14, i64 120, !6, i64 128, !6, i64 136, !7, i64 144}
!17 = !{!"", !6, i64 0, !14, i64 8}


; 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 }
%struct.tag_____IAllocator__ = type { ptr, ptr, ptr, ptr }

@mu_____string248 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string433 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string303 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string324 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string421 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string422 = external dso_local local_unnamed_addr global %struct.string__, align 8
@top_____currentAllocator__ = external dso_local thread_local local_unnamed_addr global %struct.tag_____IAllocator__, 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @CGenerator__genLvalueRefExpression__(ptr noundef %0, i32 %1, ptr %2, ptr %3, ptr %4, ptr noundef %5) local_unnamed_addr #2 {
  %7 = tail call zeroext i8 @CGenerator__isLvalueApprox__(ptr noundef %0, i32 %1, ptr %2)
  %.not = icmp eq i8 %7, 0
  br i1 %.not, label %13, label %8

8:                                                ; preds = %6
  %9 = load ptr, ptr @mu_____string433, align 8
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string433, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %5, ptr %9, i32 %10)
  tail call void @CGenerator__genExpression__(ptr noundef %0, i32 %1, ptr %2, ptr noundef %5)
  %11 = load ptr, ptr @mu_____string303, align 8
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string303, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %5, ptr %11, i32 %12)
  br label %35

13:                                               ; preds = %6
  %14 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____currentAllocator__)
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = load ptr, ptr %14, align 8, !tbaa !10
  %18 = tail call ptr %16(ptr noundef %17, i64 noundef 16) #3
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %18, i8 0, i64 16, i1 false)
  %19 = tail call { ptr, i32 } @CGenerator__newLocal__(ptr noundef %0)
  %20 = extractvalue { ptr, i32 } %19, 0
  %21 = extractvalue { ptr, i32 } %19, 1
  tail call void @CGenerator__writeTag__(ptr noundef %18, ptr %3, ptr %4)
  %22 = load ptr, ptr @mu_____string421, align 8
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string421, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %18, ptr %22, i32 %23)
  tail call void @StringBuilder__write__(ptr noundef %18, ptr %20, i32 %21)
  %24 = load ptr, ptr @mu_____string422, align 8
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string422, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %18, ptr %24, i32 %25)
  tail call void @CGenerator__genExpression__(ptr noundef %0, i32 %1, ptr %2, ptr noundef %18)
  %26 = load ptr, ptr @mu_____string324, align 8
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string324, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %18, ptr %26, i32 %27)
  %28 = getelementptr inbounds i8, ptr %0, i64 40
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  %30 = tail call { ptr, i32 } @StringBuilder__toString__(ptr noundef %18)
  %31 = extractvalue { ptr, i32 } %30, 0
  %32 = extractvalue { ptr, i32 } %30, 1
  tail call void @CodeBuilder__writeLine__(ptr noundef %29, ptr %31, i32 %32)
  %33 = load ptr, ptr @mu_____string248, align 8
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string248, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %5, ptr %33, i32 %34)
  tail call void @StringBuilder__write__(ptr noundef %5, ptr %20, i32 %21)
  br label %35

35:                                               ; preds = %13, %8
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @CGenerator__isLvalueApprox__(ptr noundef, i32, ptr) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 8}
!6 = !{!"tag_____IAllocator__", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!12, !7, i64 40}
!12 = !{!"tag_____GenerateContext__", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !13, i64 48, !13, i64 52, !7, i64 56, !7, i64 64, !7, i64 72, !14, i64 80, !13, i64 96, !14, i64 104, !13, i64 120, !7, i64 128, !7, i64 136, !8, i64 144}
!13 = !{!"int", !8, i64 0}
!14 = !{!"", !7, i64 0, !13, i64 8}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass