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

; 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_____Tag__ = type { 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_____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 }

@top_____abandonFn__ = external dso_local thread_local global ptr, align 8

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #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
define dso_local { ptr, ptr } @CGenerator__getUnsignedTag__(ptr noundef %0, ptr %1, ptr %2) #3 {
  %4 = alloca %struct.tag_____Tag__, align 8
  %5 = alloca %struct.tag_____Tag__, align 8
  %6 = alloca ptr, align 8
  %7 = getelementptr inbounds { ptr, ptr }, ptr %5, i32 0, i32 0
  store ptr %1, ptr %7, align 8
  %8 = getelementptr inbounds { ptr, ptr }, ptr %5, i32 0, i32 1
  store ptr %2, ptr %8, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.tag_____Tag__, ptr %5, i32 0, i32 0
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %11, i32 0, i32 4
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %13, i32 0, i32 7
  %15 = getelementptr inbounds %struct.tag_____Tag__, ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !15
  %17 = icmp eq ptr %10, %16
  br i1 %17, label %18, label %23

18:                                               ; preds = %3
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %19, i32 0, i32 4
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %21, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %22, i64 16, i1 false), !tbaa.struct !17
  br label %90

23:                                               ; preds = %3
  %24 = getelementptr inbounds %struct.tag_____Tag__, ptr %5, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %26, i32 0, i32 4
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %28, i32 0, i32 10
  %30 = getelementptr inbounds %struct.tag_____Tag__, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !18
  %32 = icmp eq ptr %25, %31
  br i1 %32, label %33, label %38

33:                                               ; preds = %23
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %34, i32 0, i32 4
  %36 = load ptr, ptr %35, align 8, !tbaa !11
  %37 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %36, i32 0, i32 11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %37, i64 16, i1 false), !tbaa.struct !17
  br label %90

38:                                               ; preds = %23
  %39 = getelementptr inbounds %struct.tag_____Tag__, ptr %5, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %41, i32 0, i32 4
  %43 = load ptr, ptr %42, align 8, !tbaa !11
  %44 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %43, i32 0, i32 5
  %45 = getelementptr inbounds %struct.tag_____Tag__, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !19
  %47 = icmp eq ptr %40, %46
  br i1 %47, label %48, label %53

48:                                               ; preds = %38
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %49, i32 0, i32 4
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %51, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %52, i64 16, i1 false), !tbaa.struct !17
  br label %90

53:                                               ; preds = %38
  %54 = getelementptr inbounds %struct.tag_____Tag__, ptr %5, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %56, i32 0, i32 4
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  %59 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %58, i32 0, i32 3
  %60 = getelementptr inbounds %struct.tag_____Tag__, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !20
  %62 = icmp eq ptr %55, %61
  br i1 %62, label %63, label %68

63:                                               ; preds = %53
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %64, i32 0, i32 4
  %66 = load ptr, ptr %65, align 8, !tbaa !11
  %67 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %66, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %67, i64 16, i1 false), !tbaa.struct !17
  br label %90

68:                                               ; preds = %53
  %69 = getelementptr inbounds %struct.tag_____Tag__, ptr %5, i32 0, i32 0
  %70 = load ptr, ptr %69, align 8, !tbaa !9
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %71, i32 0, i32 4
  %73 = load ptr, ptr %72, align 8, !tbaa !11
  %74 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %73, i32 0, i32 1
  %75 = getelementptr inbounds %struct.tag_____Tag__, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !21
  %77 = icmp eq ptr %70, %76
  br i1 %77, label %78, label %83

78:                                               ; preds = %68
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %79, i32 0, i32 4
  %81 = load ptr, ptr %80, align 8, !tbaa !11
  %82 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %81, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %82, i64 16, i1 false), !tbaa.struct !17
  br label %90

83:                                               ; preds = %68
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86
  %88 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %89 = load ptr, ptr %88, align 8, !tbaa !5
  call void %89(i32 noundef -1)
  call void @llvm.memset.p0.i64(ptr align 8 %4, i8 0, i64 16, i1 false)
  br label %90

90:                                               ; preds = %87, %78, %63, %48, %33, %18
  %91 = load { ptr, ptr }, ptr %4, align 8
  ret { ptr, ptr } %91
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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" }

!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_____Tag__", !6, i64 0, !6, i64 8}
!11 = !{!12, !6, i64 32}
!12 = !{!"tag_____GenerateContext__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !13, i64 48, !13, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !14, i64 80, !13, i64 96, !14, i64 104, !13, i64 120, !6, i64 128, !6, i64 136, !7, i64 144}
!13 = !{!"int", !7, i64 0}
!14 = !{!"", !6, i64 0, !13, i64 8}
!15 = !{!16, !6, i64 112}
!16 = !{!"tag_____CommonTags__", !10, i64 0, !10, i64 16, !10, i64 32, !10, i64 48, !10, i64 64, !10, i64 80, !10, i64 96, !10, i64 112, !10, i64 128, !10, i64 144, !10, i64 160, !10, i64 176, !10, i64 192, !10, i64 208, !10, i64 224, !10, i64 240, !10, i64 256, !10, i64 272, !10, 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}
!17 = !{i64 0, i64 8, !5, i64 8, i64 8, !5}
!18 = !{!16, !6, i64 160}
!19 = !{!16, !6, i64 80}
!20 = !{!16, !6, i64 48}
!21 = !{!16, !6, i64 16}


; 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
define dso_local { ptr, ptr } @CGenerator__getUnsignedTag__(ptr nocapture noundef readonly %0, ptr readnone %1, ptr nocapture readnone %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 112
  %7 = load ptr, ptr %6, align 8, !tbaa !12
  %8 = icmp eq ptr %7, %1
  br i1 %8, label %9, label %12

9:                                                ; preds = %3
  %10 = getelementptr inbounds i8, ptr %5, i64 128
  %11 = load <2 x ptr>, ptr %10, align 8, !tbaa !15
  br label %43

12:                                               ; preds = %3
  %13 = getelementptr inbounds i8, ptr %5, i64 160
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  %15 = icmp eq ptr %14, %1
  br i1 %15, label %16, label %19

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %5, i64 176
  %18 = load <2 x ptr>, ptr %17, align 8, !tbaa !15
  br label %43

19:                                               ; preds = %12
  %20 = getelementptr inbounds i8, ptr %5, i64 80
  %21 = load ptr, ptr %20, align 8, !tbaa !17
  %22 = icmp eq ptr %21, %1
  br i1 %22, label %23, label %26

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %5, i64 96
  %25 = load <2 x ptr>, ptr %24, align 8, !tbaa !15
  br label %43

26:                                               ; preds = %19
  %27 = getelementptr inbounds i8, ptr %5, i64 48
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  %29 = icmp eq ptr %28, %1
  br i1 %29, label %30, label %33

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %5, i64 64
  %32 = load <2 x ptr>, ptr %31, align 8, !tbaa !15
  br label %43

33:                                               ; preds = %26
  %34 = getelementptr inbounds i8, ptr %5, i64 16
  %35 = load ptr, ptr %34, align 8, !tbaa !19
  %36 = icmp eq ptr %35, %1
  br i1 %36, label %37, label %40

37:                                               ; preds = %33
  %38 = getelementptr inbounds i8, ptr %5, i64 32
  %39 = load <2 x ptr>, ptr %38, align 8, !tbaa !15
  br label %43

40:                                               ; preds = %33
  %41 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %42 = load ptr, ptr %41, align 8, !tbaa !15
  tail call void %42(i32 noundef -1) #2
  br label %43

43:                                               ; preds = %40, %37, %30, %23, %16, %9
  %44 = phi <2 x ptr> [ %11, %9 ], [ %18, %16 ], [ %25, %23 ], [ %32, %30 ], [ %39, %37 ], [ zeroinitializer, %40 ]
  %45 = extractelement <2 x ptr> %44, i64 0
  %.fca.0.insert = insertvalue { ptr, ptr } poison, ptr %45, 0
  %46 = extractelement <2 x ptr> %44, i64 1
  %.fca.1.insert = insertvalue { ptr, ptr } %.fca.0.insert, ptr %46, 1
  ret { ptr, ptr } %.fca.1.insert
}

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, !7, i64 32}
!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 = !{!13, !7, i64 112}
!13 = !{!"tag_____CommonTags__", !14, i64 0, !14, i64 16, !14, i64 32, !14, i64 48, !14, i64 64, !14, i64 80, !14, i64 96, !14, i64 112, !14, i64 128, !14, i64 144, !14, i64 160, !14, i64 176, !14, i64 192, !14, i64 208, !14, i64 224, !14, i64 240, !14, i64 256, !14, i64 272, !14, i64 288, !7, i64 304, !7, i64 312, !7, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !7, i64 352, !7, i64 360, !7, i64 368, !7, i64 376}
!14 = !{!"tag_____Tag__", !7, i64 0, !7, i64 8}
!15 = !{!7, !7, i64 0}
!16 = !{!13, !7, i64 160}
!17 = !{!13, !7, i64 80}
!18 = !{!13, !7, i64 48}
!19 = !{!13, !7, i64 16}


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