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

; 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_____ParserState__ = type { %struct.string__, i32, ptr, ptr, i32, i32, i32, i32, i32, ptr, %struct.tag_____IntRange__, i32, i32, ptr, i32, ptr, ptr, ptr }
%struct.string__ = type { ptr, i32 }
%struct.tag_____IntRange__ = type { i32, i32 }
%struct.tag_____Token__ = type { i32, %struct.string__, %struct.tag_____IntRange__, %struct.tag_____IntRange__, 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 ptr @Parser__parseTypeArgsExpressionTail__(ptr noundef, i32, ptr) #1

; Function Attrs: nounwind uwtable
define dso_local { i32, ptr } @Parser__parseTypeTail__(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca %struct.Node__, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca %struct.Node__, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #2
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.tag_____ParserState__, ptr %9, i32 0, i32 3
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = getelementptr inbounds %struct.tag_____Token__, ptr %11, i32 0, i32 4
  %13 = load i32, ptr %12, align 8, !tbaa !14
  %14 = icmp eq i32 %13, 2147483647
  %15 = zext i1 %14 to i32
  %16 = trunc i32 %15 to i8
  store i8 %16, ptr %6, align 1, !tbaa !16
  %17 = load i8, ptr %6, align 1, !tbaa !16
  %18 = icmp ne i8 %17, 0
  br i1 %18, label %19, label %28

19:                                               ; preds = %2
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.tag_____ParserState__, ptr %20, i32 0, i32 3
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = getelementptr inbounds %struct.tag_____Token__, ptr %22, i32 0, i32 0
  %24 = load i32, ptr %23, align 8, !tbaa !17
  %25 = icmp eq i32 %24, 11
  %26 = zext i1 %25 to i32
  %27 = trunc i32 %26 to i8
  store i8 %27, ptr %6, align 1, !tbaa !16
  br label %28

28:                                               ; preds = %19, %2
  %29 = load i8, ptr %6, align 1, !tbaa !16
  %30 = icmp ne i8 %29, 0
  br i1 %30, label %31, label %53

31:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #2
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.Node__, ptr %7, i32 0, i32 1
  store ptr %32, ptr %33, align 8, !tbaa !18
  %34 = getelementptr inbounds %struct.Node__, ptr %7, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !18
  %36 = icmp ne ptr %35, null
  %37 = zext i1 %36 to i64
  %38 = select i1 %36, i32 21, i32 0
  %39 = getelementptr inbounds %struct.Node__, ptr %7, i32 0, i32 0
  store i32 %38, ptr %39, align 8, !tbaa !20
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 0
  %42 = load i32, ptr %41, align 8
  %43 = getelementptr inbounds { i32, ptr }, ptr %7, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8
  %45 = call ptr @Parser__parseTypeArgsExpressionTail__(ptr noundef %40, i32 %42, ptr %44)
  %46 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  store ptr %45, ptr %46, align 8, !tbaa !18
  %47 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  %48 = load ptr, ptr %47, align 8, !tbaa !18
  %49 = icmp ne ptr %48, null
  %50 = zext i1 %49 to i64
  %51 = select i1 %49, i32 4, i32 0
  %52 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 0
  store i32 %51, ptr %52, align 8, !tbaa !20
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #2
  br label %62

53:                                               ; preds = %28
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  store ptr %54, ptr %55, align 8, !tbaa !18
  %56 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !18
  %58 = icmp ne ptr %57, null
  %59 = zext i1 %58 to i64
  %60 = select i1 %58, i32 21, i32 0
  %61 = getelementptr inbounds %struct.Node__, ptr %3, i32 0, i32 0
  store i32 %60, ptr %61, align 8, !tbaa !20
  store i32 1, ptr %8, align 4
  br label %62

62:                                               ; preds = %53, %31
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #2
  %63 = load { i32, ptr }, ptr %3, align 8
  ret { i32, ptr } %63
}

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_____ParserState__", !11, i64 0, !12, i64 16, !6, i64 24, !6, i64 32, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !6, i64 64, !13, i64 72, !12, i64 80, !12, i64 84, !6, i64 88, !12, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!11 = !{!"", !6, i64 0, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"tag_____IntRange__", !12, i64 0, !12, i64 4}
!14 = !{!15, !12, i64 40}
!15 = !{!"tag_____Token__", !12, i64 0, !11, i64 8, !13, i64 24, !13, i64 32, !12, i64 40}
!16 = !{!7, !7, i64 0}
!17 = !{!15, !12, i64 0}
!18 = !{!19, !6, i64 8}
!19 = !{!"", !12, i64 0, !6, i64 8}
!20 = !{!19, !12, 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"

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

; Function Attrs: nounwind uwtable
define dso_local { i32, ptr } @Parser__parseTypeTail__(ptr noundef %0, ptr noundef %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 = icmp eq i32 %6, 2147483647
  br i1 %7, label %8, label %.critedge

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

10:                                               ; preds = %8
  %.not11 = icmp eq ptr %1, null
  %11 = select i1 %.not11, i32 0, i32 21
  %12 = tail call ptr @Parser__parseTypeArgsExpressionTail__(ptr noundef nonnull %0, i32 %11, ptr %1)
  br label %.critedge

.critedge:                                        ; preds = %8, %2, %10
  %.sink14 = phi ptr [ %12, %10 ], [ %1, %2 ], [ %1, %8 ]
  %.sink = phi i32 [ 4, %10 ], [ 21, %2 ], [ 21, %8 ]
  %.not = icmp eq ptr %.sink14, null
  %13 = select i1 %.not, i32 0, i32 %.sink
  %.fca.0.insert = insertvalue { i32, ptr } poison, i32 %13, 0
  %.fca.1.insert = insertvalue { i32, ptr } %.fca.0.insert, ptr %.sink14, 1
  ret { i32, ptr } %.fca.1.insert
}

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 = !{!14, !11, i64 0}


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