; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_TypeChecker (assign__)

; 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.Node__ = type { i32, 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 zeroext i8 @Tag__equals__(ptr, ptr, ptr, ptr) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @TypeChecker__assign__(ptr noundef %0, ptr %1, ptr %2, i32 %3, ptr %4, ptr noundef byval(%struct.tag_____Tag__) align 8 %5) #1 {
  %7 = alloca i8, align 1
  %8 = alloca %struct.tag_____Tag__, align 8
  %9 = alloca %struct.Node__, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  store ptr %1, ptr %14, align 8
  %15 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  store ptr %2, ptr %15, align 8
  %16 = getelementptr inbounds { i32, ptr }, ptr %9, i32 0, i32 0
  store i32 %3, ptr %16, align 8
  %17 = getelementptr inbounds { i32, ptr }, ptr %9, i32 0, i32 1
  store ptr %4, ptr %17, align 8
  store ptr %0, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #2
  %18 = getelementptr inbounds %struct.tag_____Tag__, ptr %8, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = icmp eq ptr %19, null
  %21 = zext i1 %20 to i32
  %22 = trunc i32 %21 to i8
  store i8 %22, ptr %11, align 1, !tbaa !11
  %23 = load i8, ptr %11, align 1, !tbaa !11
  %24 = icmp ne i8 %23, 0
  br i1 %24, label %31, label %25

25:                                               ; preds = %6
  %26 = getelementptr inbounds %struct.tag_____Tag__, ptr %5, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = icmp eq ptr %27, null
  %29 = zext i1 %28 to i32
  %30 = trunc i32 %29 to i8
  store i8 %30, ptr %11, align 1, !tbaa !11
  br label %31

31:                                               ; preds = %25, %6
  %32 = load i8, ptr %11, align 1, !tbaa !11
  %33 = icmp ne i8 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  store i8 1, ptr %7, align 1
  store i32 1, ptr %12, align 4
  br label %84

35:                                               ; preds = %31
  %36 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8
  %38 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  %39 = load ptr, ptr %38, align 8
  %40 = getelementptr inbounds { ptr, ptr }, ptr %5, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8
  %42 = getelementptr inbounds { ptr, ptr }, ptr %5, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8
  %44 = call zeroext i8 @Tag__equals__(ptr %37, ptr %39, ptr %41, ptr %43)
  %45 = icmp ne i8 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %35
  store i8 1, ptr %7, align 1
  store i32 1, ptr %12, align 4
  br label %84

47:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #2
  %48 = getelementptr inbounds %struct.tag_____Tag__, ptr %8, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !9
  %50 = load ptr, ptr @Tag__null___, align 8, !tbaa !9
  %51 = icmp eq ptr %49, %50
  %52 = zext i1 %51 to i32
  %53 = trunc i32 %52 to i8
  store i8 %53, ptr %13, align 1, !tbaa !11
  %54 = load i8, ptr %13, align 1, !tbaa !11
  %55 = icmp ne i8 %54, 0
  br i1 %55, label %56, label %65

56:                                               ; preds = %47
  %57 = getelementptr inbounds %struct.tag_____Tag__, ptr %5, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct.tag_____Namespace__, ptr %58, i32 0, i32 3
  %60 = load i32, ptr %59, align 4, !tbaa !12
  %61 = and i32 %60, 204992
  %62 = icmp ne i32 %61, 0
  %63 = zext i1 %62 to i32
  %64 = trunc i32 %63 to i8
  store i8 %64, ptr %13, align 1, !tbaa !11
  br label %65

65:                                               ; preds = %56, %47
  %66 = load i8, ptr %13, align 1, !tbaa !11
  %67 = icmp ne i8 %66, 0
  br i1 %67, label %68, label %69

68:                                               ; preds = %65
  store i8 1, ptr %7, align 1
  store i32 1, ptr %12, align 4
  br label %83

69:                                               ; preds = %65
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8
  %73 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8
  %75 = getelementptr inbounds { i32, ptr }, ptr %9, i32 0, i32 0
  %76 = load i32, ptr %75, align 8
  %77 = getelementptr inbounds { i32, ptr }, ptr %9, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8
  %79 = call zeroext i8 @TypeChecker__canCoerce__(ptr noundef %70, ptr %72, ptr %74, i32 %76, ptr %78, ptr noundef byval(%struct.tag_____Tag__) align 8 %5)
  %80 = icmp ne i8 %79, 0
  br i1 %80, label %81, label %82

81:                                               ; preds = %69
  store i8 1, ptr %7, align 1
  store i32 1, ptr %12, align 4
  br label %83

82:                                               ; preds = %69
  store i8 0, ptr %7, align 1
  store i32 1, ptr %12, align 4
  br label %83

83:                                               ; preds = %82, %81, %68
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #2
  br label %84

84:                                               ; preds = %83, %46, %34
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #2
  %85 = load i8, ptr %7, align 1
  ret i8 %85
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TypeChecker__canCoerce__(ptr noundef, ptr, ptr, i32, ptr, ptr noundef byval(%struct.tag_____Tag__) align 8) #1

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 = !{!"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 = !{!7, !7, i64 0}
!12 = !{!13, !15, i64 28}
!13 = !{!"tag_____Namespace__", !14, i64 0, !6, i64 16, !15, i64 24, !15, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !15, i64 104}
!14 = !{!"", !6, i64 0, !15, i64 8}
!15 = !{!"int", !7, i64 0}


; 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 zeroext i8 @Tag__equals__(ptr, ptr, ptr, ptr) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 2) i8 @TypeChecker__assign__(ptr noundef %0, ptr %1, ptr %2, i32 %3, ptr %4, ptr noundef byval(%struct.tag_____Tag__) align 8 %5) local_unnamed_addr #0 {
  %7 = icmp ne ptr %1, null
  %8 = load ptr, ptr %5, align 8
  %9 = icmp ne ptr %8, null
  %.010 = select i1 %7, i1 %9, i1 false
  br i1 %.010, label %10, label %22

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %5, i64 8
  %12 = load ptr, ptr %11, align 8
  %13 = tail call zeroext i8 @Tag__equals__(ptr nonnull %1, ptr %2, ptr nonnull %8, ptr %12)
  %.not = icmp eq i8 %13, 0
  br i1 %.not, label %14, label %22

14:                                               ; preds = %10
  %15 = load ptr, ptr @Tag__null___, align 8, !tbaa !5
  %16 = icmp eq ptr %15, %1
  br i1 %16, label %17, label %.critedge

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %8, i64 28
  %19 = load i32, ptr %18, align 4, !tbaa !10
  %20 = and i32 %19, 204992
  %.not15 = icmp eq i32 %20, 0
  br i1 %.not15, label %.critedge, label %22

.critedge:                                        ; preds = %14, %17
  %21 = tail call zeroext i8 @TypeChecker__canCoerce__(ptr noundef %0, ptr nonnull %1, ptr %2, i32 %3, ptr %4, ptr noundef nonnull byval(%struct.tag_____Tag__) align 8 %5)
  %.not16 = icmp ne i8 %21, 0
  %. = zext i1 %.not16 to i8
  br label %22

22:                                               ; preds = %17, %.critedge, %10, %6
  %.1 = phi i8 [ 1, %6 ], [ 1, %10 ], [ 1, %17 ], [ %., %.critedge ]
  ret i8 %.1
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TypeChecker__canCoerce__(ptr noundef, ptr, ptr, i32, ptr, ptr noundef byval(%struct.tag_____Tag__) align 8) local_unnamed_addr #0

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


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