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

; 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_____Error__ = type { ptr, %struct.tag_____IntRange__, %struct.string__ }
%struct.tag_____IntRange__ = type { i32, i32 }
%struct.Node__ = type { i32, ptr }
%struct.tag_____TypeCheckerContext__ = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i8 }
%struct.tag_____Namespace__ = type { %struct.string__, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }

@mu_____string285 = external dso_local global %struct.string__, align 8
@mu_____string284 = 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: nounwind uwtable
declare dso_local void @List__add__Error____(ptr noundef, ptr noundef byval(%struct.tag_____Error__) align 8) #2

; Function Attrs: nounwind uwtable
declare dso_local void @Error__at__(ptr dead_on_unwind noalias writable sret(%struct.tag_____Error__) align 8, ptr noundef, i64, ptr, i32) #2

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

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

26:                                               ; preds = %1
  %27 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !18
  %29 = icmp eq i32 %28, 34
  %30 = xor i1 %29, true
  %31 = zext i1 %30 to i32
  %32 = trunc i32 %31 to i8
  store i8 %32, ptr %4, align 1, !tbaa !17
  br label %33

33:                                               ; preds = %26, %1
  %34 = load i8, ptr %4, align 1, !tbaa !17
  %35 = icmp ne i8 %34, 0
  br i1 %35, label %36, label %43

36:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.memset.p0.i64(ptr align 4 %5, i8 0, i64 8, i1 false)
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.tag_____TypeCheckerContext__, ptr %37, i32 0, i32 2
  %39 = load ptr, ptr %38, align 8, !tbaa !19
  %40 = load i64, ptr %5, align 4
  %41 = load ptr, ptr @mu_____string285, align 8
  %42 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string285, i32 0, i32 1), align 8
  call void @Error__at__(ptr dead_on_unwind writable sret(%struct.tag_____Error__) align 8 %6, ptr noundef null, i64 %40, ptr %41, i32 %42)
  call void @List__add__Error____(ptr noundef %39, ptr noundef byval(%struct.tag_____Error__) align 8 %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %43

43:                                               ; preds = %36, %33
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 24}
!10 = !{!"tag_____TypeCheckerContext__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !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, !6, i64 104, !6, i64 112, !11, i64 120, !11, i64 124, !6, i64 128, !11, i64 136, !7, i64 140}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 32}
!13 = !{!"tag_____Namespace__", !14, i64 0, !6, i64 16, !11, i64 24, !11, 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, !11, i64 104}
!14 = !{!"", !6, i64 0, !11, i64 8}
!15 = !{!16, !6, i64 8}
!16 = !{!"", !11, i64 0, !6, i64 8}
!17 = !{!7, !7, i64 0}
!18 = !{!16, !11, i64 0}
!19 = !{!10, !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"

%struct.string__ = type { ptr, i32 }
%struct.tag_____Error__ = type { ptr, %struct.tag_____IntRange__, %struct.string__ }
%struct.tag_____IntRange__ = type { i32, i32 }

@mu_____string285 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string284 = external dso_local local_unnamed_addr global %struct.string__, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @List__add__Error____(ptr noundef, ptr noundef byval(%struct.tag_____Error__) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @Error__at__(ptr dead_on_unwind noalias writable sret(%struct.tag_____Error__) align 8, ptr noundef, i64, ptr, i32) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local { i32, ptr } @Map__getOrDefault__string__Node____(ptr noundef, ptr, i32) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @TypeChecker__checkHasEntryPoint__(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = alloca %struct.tag_____Error__, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 32
  %6 = load ptr, ptr %5, align 8, !tbaa !11
  %7 = load ptr, ptr @mu_____string284, align 8
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string284, i64 8), align 8
  %9 = tail call { i32, ptr } @Map__getOrDefault__string__Node____(ptr noundef %6, ptr %7, i32 %8)
  %10 = extractvalue { i32, ptr } %9, 1
  %11 = icmp ne ptr %10, null
  %12 = extractvalue { i32, ptr } %9, 0
  %.not = icmp eq i32 %12, 34
  %.0 = select i1 %11, i1 %.not, i1 false
  br i1 %.0, label %18, label %13

13:                                               ; preds = %1
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = load ptr, ptr @mu_____string285, align 8
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string285, i64 8), align 8
  call void @Error__at__(ptr dead_on_unwind nonnull writable sret(%struct.tag_____Error__) align 8 %2, ptr noundef null, i64 0, ptr %16, i32 %17)
  call void @List__add__Error____(ptr noundef %15, ptr noundef nonnull byval(%struct.tag_____Error__) align 8 %2)
  br label %18

18:                                               ; preds = %13, %1
  ret void
}

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 24}
!6 = !{!"tag_____TypeCheckerContext__", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !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, !7, i64 104, !7, i64 112, !10, i64 120, !10, i64 124, !7, i64 128, !10, i64 136, !8, i64 140}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !7, i64 32}
!12 = !{!"tag_____Namespace__", !13, i64 0, !7, i64 16, !10, i64 24, !10, 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, !10, i64 104}
!13 = !{!"", !7, i64 0, !10, i64 8}
!14 = !{!6, !7, i64 16}


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