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

; 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_____NodeInfo__ = type { %struct.tag_____Tag__, %struct.Node__ }
%struct.tag_____Tag__ = type { ptr, ptr }
%struct.Node__ = type { i32, ptr }
%struct.tag_____CallExpression__ = type { %struct.Node__, ptr, ptr, ptr, ptr, ptr }
%struct.tag_____TypeArgsExpression__ = type { %struct.Node__, ptr, ptr, ptr, ptr }
%struct.tag_____FunctionDef__ = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.Node__, ptr, ptr, ptr, ptr, i32, ptr, %struct.string__, %struct.string__, %struct.tag_____Tag__, i32, ptr, ptr, ptr, ptr, %struct.string__ }
%struct.string__ = type { ptr, i32 }

@top_____abandonFn__ = external dso_local thread_local global ptr, 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 speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

; 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local void @CGenerator__nodeInfo__(ptr dead_on_unwind noalias writable sret(%struct.tag_____NodeInfo__) align 8, ptr noundef, i32, ptr) #3

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @CGenerator__isLvalueApprox__(ptr noundef %0, i32 %1, ptr %2) #3 {
  %4 = alloca i8, align 1
  %5 = alloca %struct.Node__, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.Node__, align 8
  %9 = alloca %struct.Node__, align 8
  %10 = alloca %struct.tag_____NodeInfo__, align 8
  %11 = alloca %struct.Node__, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = getelementptr inbounds { i32, ptr }, ptr %5, i32 0, i32 0
  store i32 %1, ptr %14, align 8
  %15 = getelementptr inbounds { i32, ptr }, ptr %5, i32 0, i32 1
  store ptr %2, ptr %15, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.Node__, ptr %5, i32 0, i32 0
  %17 = load i32, ptr %16, align 8, !tbaa !9
  switch i32 %17, label %69 [
    i32 14, label %18
    i32 0, label %70
  ]

18:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %19 = getelementptr inbounds %struct.Node__, ptr %5, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !12
  store ptr %20, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.tag_____CallExpression__, ptr %21, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %22, i64 16, i1 false), !tbaa.struct !13
  %23 = getelementptr inbounds %struct.Node__, ptr %8, i32 0, i32 0
  %24 = load i32, ptr %23, align 8, !tbaa !9
  %25 = icmp eq i32 %24, 4
  br i1 %25, label %26, label %37

26:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %8, i64 16, i1 false), !tbaa.struct !13
  %27 = getelementptr inbounds %struct.Node__, ptr %9, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !9
  %29 = icmp eq i32 %28, 4
  br i1 %29, label %33, label %30

30:                                               ; preds = %26
  %31 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  call void %32(i32 noundef -4)
  br label %33

33:                                               ; preds = %30, %26
  %34 = getelementptr inbounds %struct.Node__, ptr %9, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !12
  %36 = getelementptr inbounds %struct.tag_____TypeArgsExpression__, ptr %35, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %36, i64 16, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  br label %37

37:                                               ; preds = %33, %18
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #4
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds { i32, ptr }, ptr %8, i32 0, i32 0
  %40 = load i32, ptr %39, align 8
  %41 = getelementptr inbounds { i32, ptr }, ptr %8, i32 0, i32 1
  %42 = load ptr, ptr %41, align 8
  call void @CGenerator__nodeInfo__(ptr dead_on_unwind writable sret(%struct.tag_____NodeInfo__) align 8 %10, ptr noundef %38, i32 %40, ptr %42)
  %43 = getelementptr inbounds %struct.tag_____NodeInfo__, ptr %10, i32 0, i32 1
  %44 = getelementptr inbounds %struct.Node__, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !15
  %46 = icmp eq i32 %45, 34
  br i1 %46, label %47, label %67

47:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #4
  %48 = getelementptr inbounds %struct.tag_____NodeInfo__, ptr %10, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %48, i64 16, i1 false), !tbaa.struct !13
  %49 = getelementptr inbounds %struct.Node__, ptr %11, i32 0, i32 0
  %50 = load i32, ptr %49, align 8, !tbaa !9
  %51 = icmp eq i32 %50, 34
  br i1 %51, label %55, label %52

52:                                               ; preds = %47
  %53 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  call void %54(i32 noundef -4)
  br label %55

55:                                               ; preds = %52, %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %56 = getelementptr inbounds %struct.Node__, ptr %11, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !12
  store ptr %57, ptr %12, align 8, !tbaa !5
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.tag_____FunctionDef__, ptr %58, i32 0, i32 17
  %60 = load i32, ptr %59, align 8, !tbaa !18
  %61 = icmp eq i32 %60, 16
  br i1 %61, label %62, label %63

62:                                               ; preds = %55
  store i8 1, ptr %4, align 1
  store i32 1, ptr %13, align 4
  br label %64

63:                                               ; preds = %55
  store i32 0, ptr %13, align 4
  br label %64

64:                                               ; preds = %63, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #4
  %65 = load i32, ptr %13, align 4
  switch i32 %65, label %68 [
    i32 0, label %66
  ]

66:                                               ; preds = %64
  br label %67

67:                                               ; preds = %66, %37
  store i8 0, ptr %4, align 1
  store i32 1, ptr %13, align 4
  br label %68

68:                                               ; preds = %67, %64
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %73

69:                                               ; preds = %3
  store i8 1, ptr %4, align 1
  br label %73

70:                                               ; preds = %3
  %71 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  call void %72(i32 noundef -5)
  store i8 0, ptr %4, align 1
  br label %73

73:                                               ; preds = %70, %69, %68
  %74 = load i8, ptr %4, align 1
  ret i8 %74
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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" }
attributes #4 = { 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, !11, i64 0}
!10 = !{!"", !11, i64 0, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{i64 0, i64 4, !14, i64 8, i64 8, !5}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !11, i64 16}
!16 = !{!"tag_____NodeInfo__", !17, i64 0, !10, i64 16}
!17 = !{!"tag_____Tag__", !6, i64 0, !6, i64 8}
!18 = !{!19, !11, i64 168}
!19 = !{!"tag_____FunctionDef__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !10, i64 56, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !11, i64 104, !6, i64 112, !20, i64 120, !20, i64 136, !17, i64 152, !11, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !20, i64 208}
!20 = !{!"", !6, i64 0, !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_____NodeInfo__ = type { %struct.tag_____Tag__, %struct.Node__ }
%struct.tag_____Tag__ = type { ptr, ptr }
%struct.Node__ = type { i32, ptr }

@top_____abandonFn__ = external dso_local thread_local local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

; Function Attrs: mustprogress 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 @CGenerator__nodeInfo__(ptr dead_on_unwind noalias writable sret(%struct.tag_____NodeInfo__) align 8, ptr noundef, i32, ptr) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 2) i8 @CGenerator__isLvalueApprox__(ptr noundef %0, i32 %1, ptr nocapture readonly %2) local_unnamed_addr #2 {
  %4 = alloca %struct.tag_____NodeInfo__, align 8
  switch i32 %1, label %20 [
    i32 14, label %5
    i32 0, label %17
  ]

5:                                                ; preds = %3
  %.sroa.05.0.copyload = load i32, ptr %2, align 8, !tbaa !5
  %.sroa.8.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.8.0.copyload = load ptr, ptr %.sroa.8.0..sroa_idx, align 8, !tbaa !9
  %6 = icmp eq i32 %.sroa.05.0.copyload, 4
  br i1 %6, label %7, label %8

7:                                                ; preds = %5
  %.sroa.05.0.copyload7 = load i32, ptr %.sroa.8.0.copyload, align 8, !tbaa !5
  %.sroa.8.0..sroa_idx10 = getelementptr inbounds i8, ptr %.sroa.8.0.copyload, i64 8
  %.sroa.8.0.copyload11 = load ptr, ptr %.sroa.8.0..sroa_idx10, align 8, !tbaa !9
  br label %8

8:                                                ; preds = %7, %5
  %.sroa.05.0 = phi i32 [ %.sroa.05.0.copyload7, %7 ], [ %.sroa.05.0.copyload, %5 ]
  %.sroa.8.0 = phi ptr [ %.sroa.8.0.copyload11, %7 ], [ %.sroa.8.0.copyload, %5 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #3
  call void @CGenerator__nodeInfo__(ptr dead_on_unwind nonnull writable sret(%struct.tag_____NodeInfo__) align 8 %4, ptr noundef %0, i32 %.sroa.05.0, ptr %.sroa.8.0)
  %9 = getelementptr inbounds i8, ptr %4, i64 16
  %10 = load i32, ptr %9, align 8, !tbaa !5
  %11 = icmp eq i32 %10, 34
  br i1 %11, label %12, label %15

12:                                               ; preds = %8
  %.sroa.41.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 24
  %.sroa.41.0.copyload = load ptr, ptr %.sroa.41.0..sroa_idx, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %.sroa.41.0.copyload, i64 168
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %.not = icmp eq i32 %14, 16
  br i1 %.not, label %16, label %15

15:                                               ; preds = %12, %8
  br label %16

16:                                               ; preds = %12, %15
  %.1 = phi i8 [ 0, %15 ], [ 1, %12 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #3
  br label %20

17:                                               ; preds = %3
  %18 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  tail call void %19(i32 noundef -5) #3
  br label %20

20:                                               ; preds = %3, %17, %16
  %.2 = phi i8 [ 0, %17 ], [ %.1, %16 ], [ 1, %3 ]
  ret i8 %.2
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 168}
!12 = !{!"tag_____FunctionDef__", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !13, i64 56, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !6, i64 104, !10, i64 112, !14, i64 120, !14, i64 136, !15, i64 152, !6, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !14, i64 208}
!13 = !{!"", !6, i64 0, !10, i64 8}
!14 = !{!"", !10, i64 0, !6, i64 8}
!15 = !{!"tag_____Tag__", !10, i64 0, !10, i64 8}


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