; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_TypeCheckerFirstPass (checkField__)

; 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.Node__ = type { i32, ptr }
%struct.tag_____FieldDef__ = type { ptr, ptr, %struct.Node__, ptr, %struct.tag_____Tag__ }
%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 }
%struct.tag_____Token__ = type { i32, %struct.string__, %struct.tag_____IntRange__, %struct.tag_____IntRange__, i32 }
%struct.tag_____IntRange__ = type { i32, i32 }

; 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 void @TypeCheckerFirstPass__duplicateMember__(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Map__tryAdd__string__Node____(ptr noundef, ptr, i32, i32, ptr) #1

; Function Attrs: nounwind uwtable
define dso_local void @TypeCheckerFirstPass__checkField__(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.Node__, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %6, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.tag_____FieldDef__, ptr %9, i32 0, i32 3
  store ptr %8, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #2
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.Node__, ptr %7, i32 0, i32 1
  store ptr %11, ptr %12, align 8, !tbaa !14
  %13 = getelementptr inbounds %struct.Node__, ptr %7, i32 0, i32 1
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  %15 = icmp ne ptr %14, null
  %16 = zext i1 %15 to i64
  %17 = select i1 %15, i32 36, i32 0
  %18 = getelementptr inbounds %struct.Node__, ptr %7, i32 0, i32 0
  store i32 %17, ptr %18, align 8, !tbaa !15
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.tag_____Namespace__, ptr %19, i32 0, i32 4
  %21 = load ptr, ptr %20, align 8, !tbaa !16
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.tag_____FieldDef__, ptr %22, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %25 = getelementptr inbounds %struct.tag_____Token__, ptr %24, i32 0, i32 1
  %26 = getelementptr inbounds { ptr, i32 }, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8
  %28 = getelementptr inbounds { ptr, i32 }, ptr %25, i32 0, i32 1
  %29 = load i32, ptr %28, align 8
  %30 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 0
  %31 = load i32, ptr %30, align 8
  %32 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8
  %34 = call zeroext i8 @Map__tryAdd__string__Node____(ptr noundef %21, ptr %27, i32 %29, i32 %31, ptr %33)
  %35 = icmp ne i8 %34, 0
  br i1 %35, label %41, label %36

36:                                               ; preds = %3
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.tag_____FieldDef__, ptr %38, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  call void @TypeCheckerFirstPass__duplicateMember__(ptr noundef %37, ptr noundef %40)
  br label %41

41:                                               ; preds = %36, %3
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.tag_____Namespace__, ptr %42, i32 0, i32 7
  %44 = load ptr, ptr %43, align 8, !tbaa !20
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  call void @List__add__Ptr__FieldDef______(ptr noundef %44, ptr noundef %45)
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #2
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @List__add__Ptr__FieldDef______(ptr noundef, ptr noundef) #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 32}
!10 = !{!"tag_____FieldDef__", !6, i64 0, !6, i64 8, !11, i64 16, !6, i64 32, !13, i64 40}
!11 = !{!"", !12, i64 0, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"tag_____Tag__", !6, i64 0, !6, i64 8}
!14 = !{!11, !6, i64 8}
!15 = !{!11, !12, i64 0}
!16 = !{!17, !6, i64 32}
!17 = !{!"tag_____Namespace__", !18, i64 0, !6, i64 16, !12, i64 24, !12, 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, !12, i64 104}
!18 = !{!"", !6, i64 0, !12, i64 8}
!19 = !{!10, !6, i64 8}
!20 = !{!17, !6, i64 56}


; 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"

; Function Attrs: nounwind uwtable
declare dso_local void @TypeCheckerFirstPass__duplicateMember__(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Map__tryAdd__string__Node____(ptr noundef, ptr, i32, i32, ptr) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @TypeCheckerFirstPass__checkField__(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %2, i64 32
  store ptr %1, ptr %4, align 8, !tbaa !5
  %.not = icmp eq ptr %2, null
  %5 = select i1 %.not, i32 0, i32 36
  %6 = getelementptr inbounds i8, ptr %1, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  %11 = load ptr, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr %9, i64 16
  %13 = load i32, ptr %12, align 8
  %14 = tail call zeroext i8 @Map__tryAdd__string__Node____(ptr noundef %7, ptr %11, i32 %13, i32 %5, ptr %2)
  %.not11 = icmp eq i8 %14, 0
  br i1 %.not11, label %15, label %17

15:                                               ; preds = %3
  %16 = load ptr, ptr %8, align 8, !tbaa !16
  tail call void @TypeCheckerFirstPass__duplicateMember__(ptr noundef %0, ptr noundef %16)
  br label %17

17:                                               ; preds = %15, %3
  %18 = getelementptr inbounds i8, ptr %1, i64 56
  %19 = load ptr, ptr %18, align 8, !tbaa !17
  tail call void @List__add__Ptr__FieldDef______(ptr noundef %19, ptr noundef nonnull %2)
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @List__add__Ptr__FieldDef______(ptr noundef, ptr noundef) 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 32}
!6 = !{!"tag_____FieldDef__", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 32, !12, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !7, i64 8}
!11 = !{!"int", !8, i64 0}
!12 = !{!"tag_____Tag__", !7, i64 0, !7, i64 8}
!13 = !{!14, !7, i64 32}
!14 = !{!"tag_____Namespace__", !15, i64 0, !7, i64 16, !11, i64 24, !11, 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, !11, i64 104}
!15 = !{!"", !7, i64 0, !11, i64 8}
!16 = !{!6, !7, i64 8}
!17 = !{!14, !7, i64 56}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass