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

; 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_____IAllocator__ = type { ptr, ptr, ptr, 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.string__ = type { ptr, i32 }
%struct.tag_____CodeBuilder__ = type { ptr, i32 }
%struct.tag_____StringBuilder__ = type { ptr, i32, i32 }
%struct.tag_____Map__string__string____ = type { %struct.tag_____Array__MapEntry__string__string______, i32, i32, i32 }
%struct.tag_____Array__MapEntry__string__string______ = type { ptr, i32 }
%struct.tag_____Compilation__ = type { ptr, ptr, i32, ptr, ptr, ptr, i32 }

@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
define dso_local void @CGenerator__createContext__(ptr dead_on_unwind noalias writable sret(%struct.tag_____GenerateContext__) align 8 %0, ptr noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.tag_____CodeBuilder__, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.tag_____StringBuilder__, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.tag_____Map__string__string____, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 152, i1 false)
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %0, i32 0, i32 0
  store ptr %10, ptr %11, align 8, !tbaa !9
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.tag_____Compilation__, ptr %12, i32 0, i32 0
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %15 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %0, i32 0, i32 1
  store ptr %14, ptr %15, align 8, !tbaa !15
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.tag_____Compilation__, ptr %16, i32 0, i32 1
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  %19 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %0, i32 0, i32 2
  store ptr %18, ptr %19, align 8, !tbaa !17
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.tag_____Compilation__, ptr %20, i32 0, i32 3
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  %23 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %0, i32 0, i32 3
  store ptr %22, ptr %23, align 8, !tbaa !19
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.tag_____Compilation__, ptr %24, i32 0, i32 4
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  %27 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %0, i32 0, i32 4
  store ptr %26, ptr %27, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %28 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____currentAllocator__)
  %29 = getelementptr inbounds %struct.tag_____IAllocator__, ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !22
  %31 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____currentAllocator__)
  %32 = getelementptr inbounds %struct.tag_____IAllocator__, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !24
  %34 = call ptr %30(ptr noundef %33, i64 noundef 16)
  store ptr %34, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #5
  call void @llvm.memset.p0.i64(ptr align 8 %5, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %35 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____currentAllocator__)
  %36 = getelementptr inbounds %struct.tag_____IAllocator__, ptr %35, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  %38 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____currentAllocator__)
  %39 = getelementptr inbounds %struct.tag_____IAllocator__, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !24
  %41 = call ptr %37(ptr noundef %40, i64 noundef 16)
  store ptr %41, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #5
  call void @llvm.memset.p0.i64(ptr align 8 %7, i8 0, i64 16, i1 false)
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %42, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !25
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.tag_____CodeBuilder__, ptr %5, i32 0, i32 0
  store ptr %43, ptr %44, align 8, !tbaa !27
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %45, ptr align 8 %5, i64 16, i1 false), !tbaa.struct !29
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %0, i32 0, i32 5
  store ptr %46, ptr %47, align 8, !tbaa !30
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %48 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____currentAllocator__)
  %49 = getelementptr inbounds %struct.tag_____IAllocator__, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !22
  %51 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____currentAllocator__)
  %52 = getelementptr inbounds %struct.tag_____IAllocator__, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !24
  %54 = call ptr %50(ptr noundef %53, i64 noundef 32)
  store ptr %54, ptr %8, align 8, !tbaa !5
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #5
  call void @Map__create__string__string____(ptr dead_on_unwind writable sret(%struct.tag_____Map__string__string____) align 8 %9)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %55, ptr align 8 %9, i64 32, i1 false), !tbaa.struct !31
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #5
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %0, i32 0, i32 15
  store ptr %56, ptr %57, align 8, !tbaa !32
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @Map__create__string__string____(ptr dead_on_unwind noalias writable sret(%struct.tag_____Map__string__string____) align 8) #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 0}
!10 = !{!"tag_____GenerateContext__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !12, i64 80, !11, i64 96, !12, i64 104, !11, i64 120, !6, i64 128, !6, i64 136, !7, i64 144}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !6, i64 0, !11, i64 8}
!13 = !{!14, !6, i64 0}
!14 = !{!"tag_____Compilation__", !6, i64 0, !6, i64 8, !11, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48}
!15 = !{!10, !6, i64 8}
!16 = !{!14, !6, i64 8}
!17 = !{!10, !6, i64 16}
!18 = !{!14, !6, i64 24}
!19 = !{!10, !6, i64 24}
!20 = !{!14, !6, i64 32}
!21 = !{!10, !6, i64 32}
!22 = !{!23, !6, i64 8}
!23 = !{!"tag_____IAllocator__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!24 = !{!23, !6, i64 0}
!25 = !{i64 0, i64 8, !5, i64 8, i64 4, !26, i64 12, i64 4, !26}
!26 = !{!11, !11, i64 0}
!27 = !{!28, !6, i64 0}
!28 = !{!"tag_____CodeBuilder__", !6, i64 0, !11, i64 8}
!29 = !{i64 0, i64 8, !5, i64 8, i64 4, !26}
!30 = !{!10, !6, i64 40}
!31 = !{i64 0, i64 8, !5, i64 8, i64 4, !26, i64 16, i64 4, !26, i64 20, i64 4, !26, i64 24, i64 4, !26}
!32 = !{!10, !6, i64 128}


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

@top_____currentAllocator__ = external dso_local thread_local local_unnamed_addr global %struct.tag_____IAllocator__, 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 speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

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

; Function Attrs: mustprogress 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
define dso_local void @CGenerator__createContext__(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.tag_____GenerateContext__) align 8 %0, ptr noundef %1) local_unnamed_addr #4 {
  %3 = alloca %struct.tag_____Map__string__string____, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(152) %4, i8 0, i64 104, i1 false)
  store ptr %1, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load <2 x ptr>, ptr %1, align 8, !tbaa !12
  store <2 x ptr> %6, ptr %5, align 8, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %1, i64 24
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = load <2 x ptr>, ptr %7, align 8, !tbaa !12
  store <2 x ptr> %9, ptr %8, align 8, !tbaa !12
  %10 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____currentAllocator__)
  %11 = getelementptr inbounds i8, ptr %10, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = load ptr, ptr %10, align 8, !tbaa !15
  %14 = tail call ptr %12(ptr noundef %13, i64 noundef 16) #5
  %15 = load ptr, ptr %11, align 8, !tbaa !13
  %16 = load ptr, ptr %10, align 8, !tbaa !15
  %17 = tail call ptr %15(ptr noundef %16, i64 noundef 16) #5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %17, i8 0, i64 16, i1 false)
  store ptr %17, ptr %14, align 8, !tbaa !12
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %14, i64 8
  store i64 0, ptr %.sroa.5.0..sroa_idx, align 8
  %18 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %14, ptr %18, align 8, !tbaa !16
  %19 = load ptr, ptr %11, align 8, !tbaa !13
  %20 = load ptr, ptr %10, align 8, !tbaa !15
  %21 = tail call ptr %19(ptr noundef %20, i64 noundef 32) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  call void @Map__create__string__string____(ptr dead_on_unwind nonnull writable sret(%struct.tag_____Map__string__string____) align 8 %3)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef nonnull align 8 dereferenceable(32) %3, i64 32, i1 false), !tbaa.struct !17
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  %22 = getelementptr inbounds i8, ptr %0, i64 128
  store ptr %21, ptr %22, align 8, !tbaa !19
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @Map__create__string__string____(ptr dead_on_unwind noalias writable sret(%struct.tag_____Map__string__string____) align 8) local_unnamed_addr #4

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


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