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

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

@mu_____string175 = external dso_local global %struct.string__, align 8
@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 zeroext i8 @string__equals__(ptr, i32, ptr, i32) #3

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Parser__isAssignOp__(ptr, i32) #3

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

; Function Attrs: nounwind uwtable
declare dso_local void @TypeChecker__checkDeclareStatement__(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @TypeChecker__checkAssignStatement__(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @TypeChecker__checkExpressionStatement__(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.Node__, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.tag_____Tag__, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.tag_____ExpressionStatement__, ptr %9, i32 0, i32 0
  %11 = getelementptr inbounds %struct.Node__, ptr %10, i32 0, i32 0
  %12 = load i32, ptr %11, align 8, !tbaa !9
  %13 = icmp eq i32 %12, 12
  br i1 %13, label %14, label %60

14:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #4
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.tag_____ExpressionStatement__, ptr %15, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %16, i64 16, i1 false), !tbaa.struct !13
  %17 = getelementptr inbounds %struct.Node__, ptr %5, i32 0, i32 0
  %18 = load i32, ptr %17, align 8, !tbaa !15
  %19 = icmp eq i32 %18, 12
  br i1 %19, label %23, label %20

20:                                               ; preds = %14
  %21 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  call void %22(i32 noundef -4)
  br label %23

23:                                               ; preds = %20, %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %24 = getelementptr inbounds %struct.Node__, ptr %5, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  store ptr %25, ptr %6, align 8, !tbaa !5
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.tag_____BinaryOperatorExpression__, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  %29 = getelementptr inbounds %struct.tag_____Token__, ptr %28, i32 0, i32 1
  %30 = getelementptr inbounds { ptr, i32 }, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8
  %32 = getelementptr inbounds { ptr, i32 }, ptr %29, i32 0, i32 1
  %33 = load i32, ptr %32, align 8
  %34 = load ptr, ptr @mu_____string175, align 8
  %35 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string175, i32 0, i32 1), align 8
  %36 = call zeroext i8 @string__equals__(ptr %31, i32 %33, ptr %34, i32 %35)
  %37 = icmp ne i8 %36, 0
  br i1 %37, label %38, label %41

38:                                               ; preds = %23
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  call void @TypeChecker__checkDeclareStatement__(ptr noundef %39, ptr noundef %40)
  store i32 1, ptr %7, align 4
  br label %57

41:                                               ; preds = %23
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.tag_____BinaryOperatorExpression__, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !17
  %45 = getelementptr inbounds %struct.tag_____Token__, ptr %44, i32 0, i32 1
  %46 = getelementptr inbounds { ptr, i32 }, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8
  %48 = getelementptr inbounds { ptr, i32 }, ptr %45, i32 0, i32 1
  %49 = load i32, ptr %48, align 8
  %50 = call zeroext i8 @Parser__isAssignOp__(ptr %47, i32 %49)
  %51 = icmp ne i8 %50, 0
  br i1 %51, label %52, label %55

52:                                               ; preds = %41
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  call void @TypeChecker__checkAssignStatement__(ptr noundef %53, ptr noundef %54)
  store i32 1, ptr %7, align 4
  br label %57

55:                                               ; preds = %41
  br label %56

56:                                               ; preds = %55
  store i32 0, ptr %7, align 4
  br label %57

57:                                               ; preds = %56, %52, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #4
  %58 = load i32, ptr %7, align 4
  switch i32 %58, label %74 [
    i32 0, label %59
    i32 1, label %73
  ]

59:                                               ; preds = %57
  br label %60

60:                                               ; preds = %59, %2
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.tag_____ExpressionStatement__, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds { i32, ptr }, ptr %63, i32 0, i32 0
  %65 = load i32, ptr %64, align 8
  %66 = getelementptr inbounds { i32, ptr }, ptr %63, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8
  %68 = call { ptr, ptr } @TypeChecker__checkExpression__(ptr noundef %61, i32 %65, ptr %67)
  %69 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  %70 = extractvalue { ptr, ptr } %68, 0
  store ptr %70, ptr %69, align 8
  %71 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  %72 = extractvalue { ptr, ptr } %68, 1
  store ptr %72, ptr %71, align 8
  br label %73

73:                                               ; preds = %60, %57
  ret void

74:                                               ; preds = %57
  unreachable
}

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, !12, i64 0}
!10 = !{!"tag_____ExpressionStatement__", !11, i64 0}
!11 = !{!"", !12, i64 0, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{i64 0, i64 4, !14, i64 8, i64 8, !5}
!14 = !{!12, !12, i64 0}
!15 = !{!11, !12, i64 0}
!16 = !{!11, !6, i64 8}
!17 = !{!18, !6, i64 0}
!18 = !{!"tag_____BinaryOperatorExpression__", !6, i64 0, !11, i64 8, !11, i64 24}


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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @TypeChecker__checkExpressionStatement__(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = load i32, ptr %1, align 8
  %4 = icmp eq i32 %3, 12
  br i1 %4, label %5, label %23

5:                                                ; preds = %2
  %.sroa.45.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  %.sroa.45.0.copyload = load ptr, ptr %.sroa.45.0..sroa_idx, align 8, !tbaa !5
  %6 = load ptr, ptr %.sroa.45.0.copyload, align 8, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %6, i64 8
  %8 = load ptr, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr %6, i64 16
  %10 = load i32, ptr %9, align 8
  %11 = load ptr, ptr @mu_____string175, align 8
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string175, i64 8), align 8
  %13 = tail call zeroext i8 @string__equals__(ptr %8, i32 %10, ptr %11, i32 %12)
  %.not = icmp eq i8 %13, 0
  br i1 %.not, label %15, label %14

14:                                               ; preds = %5
  tail call void @TypeChecker__checkDeclareStatement__(ptr noundef %0, ptr noundef nonnull %.sroa.45.0.copyload)
  br label %.thread

15:                                               ; preds = %5
  %16 = load ptr, ptr %.sroa.45.0.copyload, align 8, !tbaa !9
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  %18 = load ptr, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr %16, i64 16
  %20 = load i32, ptr %19, align 8
  %21 = tail call zeroext i8 @Parser__isAssignOp__(ptr %18, i32 %20)
  %.not12 = icmp eq i8 %21, 0
  br i1 %.not12, label %._crit_edge, label %22

._crit_edge:                                      ; preds = %15
  %.pre = load i32, ptr %1, align 8
  br label %23

22:                                               ; preds = %15
  tail call void @TypeChecker__checkAssignStatement__(ptr noundef %0, ptr noundef nonnull %.sroa.45.0.copyload)
  br label %.thread

23:                                               ; preds = %._crit_edge, %2
  %24 = phi i32 [ %.pre, %._crit_edge ], [ %3, %2 ]
  %25 = getelementptr inbounds i8, ptr %1, i64 8
  %26 = load ptr, ptr %25, align 8
  %27 = tail call { ptr, ptr } @TypeChecker__checkExpression__(ptr noundef %0, i32 %24, ptr %26)
  br label %.thread

.thread:                                          ; preds = %22, %14, %23
  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, !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_____BinaryOperatorExpression__", !6, i64 0, !11, i64 8, !11, i64 24}
!11 = !{!"", !12, i64 0, !6, i64 8}
!12 = !{!"int", !7, i64 0}


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