; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_Tag (anyFlags__)

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

@Tag__null___ = external hidden global %struct.tag_____Tag__, 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 i32 @Tag__argsAnyFlags__(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @Tag__anyFlags__(ptr %0, ptr %1) #1 {
  %3 = alloca %struct.tag_____Tag__, align 8
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 0
  store ptr %0, ptr %6, align 8
  %7 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 1
  store ptr %1, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #2
  %8 = getelementptr inbounds %struct.tag_____Tag__, ptr %3, i32 0, i32 0
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = icmp ne ptr %9, null
  %11 = zext i1 %10 to i32
  %12 = trunc i32 %11 to i8
  store i8 %12, ptr %5, align 1, !tbaa !12
  %13 = load i8, ptr %5, align 1, !tbaa !12
  %14 = icmp ne i8 %13, 0
  br i1 %14, label %15, label %22

15:                                               ; preds = %2
  %16 = getelementptr inbounds %struct.tag_____Tag__, ptr %3, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = load ptr, ptr @Tag__null___, align 8, !tbaa !9
  %19 = icmp ne ptr %17, %18
  %20 = zext i1 %19 to i32
  %21 = trunc i32 %20 to i8
  store i8 %21, ptr %5, align 1, !tbaa !12
  br label %22

22:                                               ; preds = %15, %2
  %23 = load i8, ptr %5, align 1, !tbaa !12
  %24 = icmp ne i8 %23, 0
  br i1 %24, label %25, label %32

25:                                               ; preds = %22
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = getelementptr inbounds %struct.tag_____Tag__, ptr %3, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct.tag_____Namespace__, ptr %28, i32 0, i32 3
  %30 = load i32, ptr %29, align 4, !tbaa !13
  %31 = or i32 %26, %30
  store i32 %31, ptr %4, align 4, !tbaa !5
  br label %35

32:                                               ; preds = %22
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = or i32 %33, 1048576
  store i32 %34, ptr %4, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %32, %25
  %36 = getelementptr inbounds %struct.tag_____Tag__, ptr %3, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !16
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %45

39:                                               ; preds = %35
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = getelementptr inbounds %struct.tag_____Tag__, ptr %3, i32 0, i32 1
  %42 = load ptr, ptr %41, align 8, !tbaa !16
  %43 = call i32 @Tag__argsAnyFlags__(ptr noundef %42)
  %44 = or i32 %40, %43
  store i32 %44, ptr %4, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %39, %35
  %46 = load i32, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  ret i32 %46
}

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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"tag_____Tag__", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !6, i64 28}
!14 = !{!"tag_____Namespace__", !15, i64 0, !11, i64 16, !6, i64 24, !6, i64 28, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !6, i64 104}
!15 = !{!"", !11, i64 0, !6, i64 8}
!16 = !{!10, !11, 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.tag_____Tag__ = type { ptr, ptr }

@Tag__null___ = external hidden local_unnamed_addr global %struct.tag_____Tag__, align 8

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

; Function Attrs: nounwind uwtable
define dso_local i32 @Tag__anyFlags__(ptr readonly %0, ptr %1) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  %3 = load ptr, ptr @Tag__null___, align 8
  %.not13 = icmp eq ptr %3, %0
  %.0 = select i1 %.not, i1 true, i1 %.not13
  br i1 %.0, label %7, label %4

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 28
  %6 = load i32, ptr %5, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %2, %4
  %.09 = phi i32 [ %6, %4 ], [ 1048576, %2 ]
  %.not14 = icmp eq ptr %1, null
  br i1 %.not14, label %11, label %8

8:                                                ; preds = %7
  %9 = tail call i32 @Tag__argsAnyFlags__(ptr noundef nonnull %1)
  %10 = or i32 %9, %.09
  br label %11

11:                                               ; preds = %8, %7
  %.1 = phi i32 [ %10, %8 ], [ %.09, %7 ]
  ret i32 %.1
}

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}


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