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

; 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_____StringBuilder__ = type { ptr, i32, i32 }
%struct.tag_____Tag__ = type { ptr, ptr }
%struct.tag_____ReturnStatement__ = type { ptr, %struct.Node__ }
%struct.Node__ = type { i32, ptr }
%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_____FunctionDef__ = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.Node__, ptr, ptr, ptr, ptr, i32, ptr, %struct.string__, %struct.string__, %struct.tag_____Tag__, i32, ptr, ptr, ptr, ptr, %struct.string__ }

@mu_____string532 = external dso_local global %struct.string__, align 8
@mu_____string324 = external dso_local global %struct.string__, align 8
@mu_____string531 = 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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 void @StringBuilder__write__(ptr noundef, ptr, i32) #3

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @CGenerator__genReturnStatement__(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.tag_____StringBuilder__, align 8
  %6 = alloca %struct.tag_____StringBuilder__, align 8
  %7 = alloca %struct.tag_____Tag__, align 8
  %8 = alloca %struct.string__, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.tag_____ReturnStatement__, ptr %9, i32 0, i32 1
  %11 = getelementptr inbounds %struct.Node__, ptr %10, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %20

14:                                               ; preds = %2
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %15, i32 0, i32 5
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  %18 = load ptr, ptr @mu_____string532, align 8
  %19 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string532, i32 0, i32 1), align 8
  call void @CodeBuilder__writeLine__(ptr noundef %17, ptr %18, i32 %19)
  br label %69

20:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #4
  call void @llvm.memset.p0.i64(ptr align 8 %5, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %5, i64 16, i1 false), !tbaa.struct !16
  %21 = load ptr, ptr @mu_____string531, align 8
  %22 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string531, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %6, ptr %21, i32 %22)
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %23, i32 0, i32 9
  %25 = load ptr, ptr %24, align 8, !tbaa !18
  %26 = getelementptr inbounds %struct.tag_____FunctionDef__, ptr %25, i32 0, i32 16
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %27, i32 0, i32 9
  %29 = load ptr, ptr %28, align 8, !tbaa !18
  %30 = getelementptr inbounds %struct.tag_____FunctionDef__, ptr %29, i32 0, i32 13
  %31 = load ptr, ptr %30, align 8, !tbaa !19
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %32, i32 0, i32 8
  %34 = load ptr, ptr %33, align 8, !tbaa !22
  %35 = getelementptr inbounds { ptr, ptr }, ptr %26, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8
  %37 = getelementptr inbounds { ptr, ptr }, ptr %26, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8
  %39 = call { ptr, ptr } @TypeChecker__closeTag__(ptr %36, ptr %38, ptr noundef %31, ptr noundef %34)
  %40 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 0
  %41 = extractvalue { ptr, ptr } %39, 0
  store ptr %41, ptr %40, align 8
  %42 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 1
  %43 = extractvalue { ptr, ptr } %39, 1
  store ptr %43, ptr %42, align 8
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.tag_____ReturnStatement__, ptr %45, i32 0, i32 1
  %47 = getelementptr inbounds { i32, ptr }, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 8
  %49 = getelementptr inbounds { i32, ptr }, ptr %46, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8
  %51 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8
  %53 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8
  call void @CGenerator__genConverted__(ptr noundef %44, i32 %48, ptr %50, ptr noundef %6, ptr %52, ptr %54)
  %55 = load ptr, ptr @mu_____string324, align 8
  %56 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string324, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %6, ptr %55, i32 %56)
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %57, i32 0, i32 5
  %59 = load ptr, ptr %58, align 8, !tbaa !13
  %60 = call { ptr, i32 } @StringBuilder__toString__(ptr noundef %6)
  %61 = getelementptr inbounds { ptr, i32 }, ptr %8, i32 0, i32 0
  %62 = extractvalue { ptr, i32 } %60, 0
  store ptr %62, ptr %61, align 8
  %63 = getelementptr inbounds { ptr, i32 }, ptr %8, i32 0, i32 1
  %64 = extractvalue { ptr, i32 } %60, 1
  store i32 %64, ptr %63, align 8
  %65 = getelementptr inbounds { ptr, i32 }, ptr %8, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8
  %67 = getelementptr inbounds { ptr, i32 }, ptr %8, i32 0, i32 1
  %68 = load i32, ptr %67, align 8
  call void @CodeBuilder__writeLine__(ptr noundef %59, ptr %66, i32 %68)
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #4
  br label %69

69:                                               ; preds = %20, %14
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !6, i64 16}
!10 = !{!"tag_____ReturnStatement__", !6, i64 0, !11, i64 8}
!11 = !{!"", !12, i64 0, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 40}
!14 = !{!"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, !15, i64 80, !12, i64 96, !15, i64 104, !12, i64 120, !6, i64 128, !6, i64 136, !7, i64 144}
!15 = !{!"", !6, i64 0, !12, i64 8}
!16 = !{i64 0, i64 8, !5, i64 8, i64 4, !17, i64 12, i64 4, !17}
!17 = !{!12, !12, i64 0}
!18 = !{!14, !6, i64 64}
!19 = !{!20, !6, i64 112}
!20 = !{!"tag_____FunctionDef__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !12, i64 104, !6, i64 112, !15, i64 120, !15, i64 136, !21, i64 152, !12, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !15, i64 208}
!21 = !{!"tag_____Tag__", !6, i64 0, !6, i64 8}
!22 = !{!14, !6, i64 56}


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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 void @CGenerator__genConverted__(ptr noundef, i32, ptr, ptr noundef, ptr, ptr) 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 { ptr, ptr } @TypeChecker__closeTag__(ptr, ptr, ptr noundef, ptr noundef) local_unnamed_addr #2

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

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = load ptr, ptr %8, align 8, !tbaa !12
  %10 = load ptr, ptr @mu_____string532, align 8
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string532, i64 8), align 8
  tail call void @CodeBuilder__writeLine__(ptr noundef %9, ptr %10, i32 %11)
  br label %38

12:                                               ; preds = %2
  %13 = getelementptr inbounds i8, ptr %1, i64 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #3
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, i8 0, i64 16, i1 false)
  %14 = load ptr, ptr @mu_____string531, align 8
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string531, i64 8), align 8
  call void @StringBuilder__write__(ptr noundef nonnull %3, ptr %14, i32 %15)
  %16 = getelementptr inbounds i8, ptr %0, i64 64
  %17 = load ptr, ptr %16, align 8, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %17, i64 152
  %19 = getelementptr inbounds i8, ptr %17, i64 112
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  %21 = getelementptr inbounds i8, ptr %0, i64 56
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  %23 = load ptr, ptr %18, align 8
  %24 = getelementptr inbounds i8, ptr %17, i64 160
  %25 = load ptr, ptr %24, align 8
  %26 = call { ptr, ptr } @TypeChecker__closeTag__(ptr %23, ptr %25, ptr noundef %20, ptr noundef %22)
  %27 = extractvalue { ptr, ptr } %26, 0
  %28 = extractvalue { ptr, ptr } %26, 1
  %29 = load i32, ptr %13, align 8
  %30 = load ptr, ptr %4, align 8
  call void @CGenerator__genConverted__(ptr noundef %0, i32 %29, ptr %30, ptr noundef nonnull %3, ptr %27, ptr %28)
  %31 = load ptr, ptr @mu_____string324, align 8
  %32 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string324, i64 8), align 8
  call void @StringBuilder__write__(ptr noundef nonnull %3, ptr %31, i32 %32)
  %33 = getelementptr inbounds i8, ptr %0, i64 40
  %34 = load ptr, ptr %33, align 8, !tbaa !12
  %35 = call { ptr, i32 } @StringBuilder__toString__(ptr noundef nonnull %3)
  %36 = extractvalue { ptr, i32 } %35, 0
  %37 = extractvalue { ptr, i32 } %35, 1
  call void @CodeBuilder__writeLine__(ptr noundef %34, ptr %36, i32 %37)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  br label %38

38:                                               ; preds = %12, %7
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 16}
!6 = !{!"tag_____ReturnStatement__", !7, i64 0, !10, i64 8}
!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 = !{!13, !7, i64 40}
!13 = !{!"tag_____GenerateContext__", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !11, i64 48, !11, i64 52, !7, i64 56, !7, i64 64, !7, i64 72, !14, i64 80, !11, i64 96, !14, i64 104, !11, i64 120, !7, i64 128, !7, i64 136, !8, i64 144}
!14 = !{!"", !7, i64 0, !11, i64 8}
!15 = !{!13, !7, i64 64}
!16 = !{!17, !7, i64 112}
!17 = !{!"tag_____FunctionDef__", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !11, i64 104, !7, i64 112, !14, i64 120, !14, i64 136, !18, i64 152, !11, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !14, i64 208}
!18 = !{!"tag_____Tag__", !7, i64 0, !7, i64 8}
!19 = !{!13, !7, i64 56}


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