; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_Parser (tryParseInlineStatement__)

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

@mu_____string317 = 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: nounwind uwtable
declare dso_local zeroext i8 @string__equals__(ptr, i32, ptr, i32) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @Parser__parseBlockStatement__(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local { i32, ptr } @Parser__tryParseInlineStatement__(ptr noundef %0, i8 noundef zeroext %1) #1 {
  %3 = alloca %struct.Node__, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i8 %1, ptr %5, align 1, !tbaa !9
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.tag_____ParserState__, ptr %8, i32 0, i32 3
  %10 = load ptr, ptr %9, align 8, !tbaa !10
  %11 = getelementptr inbounds %struct.tag_____Token__, ptr %10, i32 0, i32 4
  %12 = load i32, ptr %11, align 8, !tbaa !15
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.tag_____ParserState__, ptr %13, i32 0, i32 5
  %15 = load i32, ptr %14, align 4, !tbaa !17
  %16 = icmp sle i32 %12, %15
  br i1 %16, label %17, label %20

17:                                               ; preds = %2
  %18 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  store ptr null, ptr %18, align 8, !tbaa !18
  %19 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 0
  store i32 0, ptr %19, align 8, !tbaa !20
  br label %86

20:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #2
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.tag_____ParserState__, ptr %21, i32 0, i32 3
  %23 = load ptr, ptr %22, align 8, !tbaa !10
  %24 = getelementptr inbounds %struct.tag_____Token__, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 8, !tbaa !21
  %26 = icmp eq i32 %25, 0
  %27 = zext i1 %26 to i32
  %28 = trunc i32 %27 to i8
  store i8 %28, ptr %6, align 1, !tbaa !9
  %29 = load i8, ptr %6, align 1, !tbaa !9
  %30 = icmp ne i8 %29, 0
  br i1 %30, label %31, label %43

31:                                               ; preds = %20
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.tag_____ParserState__, ptr %32, i32 0, i32 3
  %34 = load ptr, ptr %33, align 8, !tbaa !10
  %35 = getelementptr inbounds %struct.tag_____Token__, ptr %34, i32 0, i32 1
  %36 = getelementptr inbounds { ptr, i32 }, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8
  %38 = getelementptr inbounds { ptr, i32 }, ptr %35, i32 0, i32 1
  %39 = load i32, ptr %38, align 8
  %40 = load ptr, ptr @mu_____string317, align 8
  %41 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string317, i32 0, i32 1), align 8
  %42 = call zeroext i8 @string__equals__(ptr %37, i32 %39, ptr %40, i32 %41)
  store i8 %42, ptr %6, align 1, !tbaa !9
  br label %43

43:                                               ; preds = %31, %20
  %44 = load i8, ptr %6, align 1, !tbaa !9
  %45 = icmp ne i8 %44, 0
  br i1 %45, label %46, label %57

46:                                               ; preds = %43
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = load i8, ptr %5, align 1, !tbaa !9
  %49 = call ptr @Parser__parseReturnStatement__(ptr noundef %47, i8 noundef zeroext %48)
  %50 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  store ptr %49, ptr %50, align 8, !tbaa !18
  %51 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !18
  %53 = icmp ne ptr %52, null
  %54 = zext i1 %53 to i64
  %55 = select i1 %53, i32 7, i32 0
  %56 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 0
  store i32 %55, ptr %56, align 8, !tbaa !20
  store i32 1, ptr %7, align 4
  br label %85

57:                                               ; preds = %43
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.tag_____ParserState__, ptr %58, i32 0, i32 3
  %60 = load ptr, ptr %59, align 8, !tbaa !10
  %61 = getelementptr inbounds %struct.tag_____Token__, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %61, align 8, !tbaa !21
  %63 = icmp eq i32 %62, 7
  br i1 %63, label %64, label %74

64:                                               ; preds = %57
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = call ptr @Parser__parseBlockStatement__(ptr noundef %65)
  %67 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  store ptr %66, ptr %67, align 8, !tbaa !18
  %68 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  %69 = load ptr, ptr %68, align 8, !tbaa !18
  %70 = icmp ne ptr %69, null
  %71 = zext i1 %70 to i64
  %72 = select i1 %70, i32 5, i32 0
  %73 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 0
  store i32 %72, ptr %73, align 8, !tbaa !20
  store i32 1, ptr %7, align 4
  br label %85

74:                                               ; preds = %57
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = load i8, ptr %5, align 1, !tbaa !9
  %77 = call ptr @Parser__tryParseExpressionStatement__(ptr noundef %75, i8 noundef zeroext %76)
  %78 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  store ptr %77, ptr %78, align 8, !tbaa !18
  %79 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  %80 = load ptr, ptr %79, align 8, !tbaa !18
  %81 = icmp ne ptr %80, null
  %82 = zext i1 %81 to i64
  %83 = select i1 %81, i32 6, i32 0
  %84 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 0
  store i32 %83, ptr %84, align 8, !tbaa !20
  store i32 1, ptr %7, align 4
  br label %85

85:                                               ; preds = %74, %64, %46
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #2
  br label %86

86:                                               ; preds = %85, %17
  %87 = load { i32, ptr }, ptr %3, align 8
  ret { i32, ptr } %87
}

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @Parser__tryParseExpressionStatement__(ptr noundef, i8 noundef zeroext) #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 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 32}
!11 = !{!"tag_____ParserState__", !12, i64 0, !13, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !6, i64 64, !14, i64 72, !13, i64 80, !13, i64 84, !6, i64 88, !13, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!12 = !{!"", !6, i64 0, !13, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!"tag_____IntRange__", !13, i64 0, !13, i64 4}
!15 = !{!16, !13, i64 40}
!16 = !{!"tag_____Token__", !13, i64 0, !12, i64 8, !14, i64 24, !14, i64 32, !13, i64 40}
!17 = !{!11, !13, i64 44}
!18 = !{!19, !6, i64 8}
!19 = !{!"", !13, i64 0, !6, i64 8}
!20 = !{!19, !13, i64 0}
!21 = !{!16, !13, 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.string__ = type { ptr, i32 }

@mu_____string317 = 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 ptr @Parser__parseBlockStatement__(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local { i32, ptr } @Parser__tryParseInlineStatement__(ptr noundef %0, i8 noundef zeroext %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 40
  %6 = load i32, ptr %5, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 44
  %8 = load i32, ptr %7, align 4, !tbaa !15
  %.not = icmp sgt i32 %6, %8
  br i1 %.not, label %9, label %32

9:                                                ; preds = %2
  %10 = load i32, ptr %4, align 8, !tbaa !16
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %12, label %.critedge

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %4, i64 8
  %14 = load ptr, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr %4, i64 16
  %16 = load i32, ptr %15, align 8
  %17 = load ptr, ptr @mu_____string317, align 8
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string317, i64 8), align 8
  %19 = tail call zeroext i8 @string__equals__(ptr %14, i32 %16, ptr %17, i32 %18)
  %20 = icmp eq i8 %19, 0
  br i1 %20, label %..critedge_crit_edge, label %21

..critedge_crit_edge:                             ; preds = %12
  %.pre = load ptr, ptr %3, align 8, !tbaa !5
  %.pre18 = load i32, ptr %.pre, align 8, !tbaa !16
  br label %.critedge

21:                                               ; preds = %12
  %22 = tail call ptr @Parser__parseReturnStatement__(ptr noundef nonnull %0, i8 noundef zeroext %1)
  %.not17 = icmp eq ptr %22, null
  %23 = select i1 %.not17, i32 0, i32 7
  br label %32

.critedge:                                        ; preds = %..critedge_crit_edge, %9
  %24 = phi i32 [ %.pre18, %..critedge_crit_edge ], [ %10, %9 ]
  %25 = icmp eq i32 %24, 7
  br i1 %25, label %26, label %29

26:                                               ; preds = %.critedge
  %27 = tail call ptr @Parser__parseBlockStatement__(ptr noundef nonnull %0)
  %.not16 = icmp eq ptr %27, null
  %28 = select i1 %.not16, i32 0, i32 5
  br label %32

29:                                               ; preds = %.critedge
  %30 = tail call ptr @Parser__tryParseExpressionStatement__(ptr noundef nonnull %0, i8 noundef zeroext %1)
  %.not15 = icmp eq ptr %30, null
  %31 = select i1 %.not15, i32 0, i32 6
  br label %32

32:                                               ; preds = %21, %26, %29, %2
  %.sroa.0.1 = phi i32 [ 0, %2 ], [ %23, %21 ], [ %28, %26 ], [ %31, %29 ]
  %.sroa.5.1 = phi ptr [ null, %2 ], [ %22, %21 ], [ %27, %26 ], [ %30, %29 ]
  %.fca.0.insert = insertvalue { i32, ptr } poison, i32 %.sroa.0.1, 0
  %.fca.1.insert = insertvalue { i32, ptr } %.fca.0.insert, ptr %.sroa.5.1, 1
  ret { i32, ptr } %.fca.1.insert
}

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @Parser__tryParseExpressionStatement__(ptr noundef, i8 noundef zeroext) 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, !8, i64 32}
!6 = !{!"tag_____ParserState__", !7, i64 0, !11, i64 16, !8, i64 24, !8, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !8, i64 64, !12, i64 72, !11, i64 80, !11, i64 84, !8, i64 88, !11, i64 96, !8, i64 104, !8, i64 112, !8, i64 120}
!7 = !{!"", !8, i64 0, !11, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"tag_____IntRange__", !11, i64 0, !11, i64 4}
!13 = !{!14, !11, i64 40}
!14 = !{!"tag_____Token__", !11, i64 0, !7, i64 8, !12, i64 24, !12, i64 32, !11, i64 40}
!15 = !{!6, !11, i64 44}
!16 = !{!14, !11, i64 0}


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