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

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

@mu_____string333 = external dso_local global %struct.string__, align 8
@mu_____string308 = 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 void @List__add__Error____(ptr noundef, ptr noundef byval(%struct.tag_____Error__) align 8) #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @Parser__parseCloseBrace__(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.tag_____Error__, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.tag_____ParserState__, ptr %6, i32 0, i32 3
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %struct.tag_____Token__, ptr %8, i32 0, i32 0
  %10 = load i32, ptr %9, align 8, !tbaa !14
  %11 = icmp eq i32 %10, 8
  br i1 %11, label %12, label %43

12:                                               ; preds = %1
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.tag_____ParserState__, ptr %13, i32 0, i32 3
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = getelementptr inbounds %struct.tag_____Token__, ptr %15, i32 0, i32 4
  %17 = load i32, ptr %16, align 8, !tbaa !16
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.tag_____ParserState__, ptr %18, i32 0, i32 5
  %20 = load i32, ptr %19, align 4, !tbaa !17
  %21 = icmp eq i32 %17, %20
  br i1 %21, label %22, label %28

22:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.tag_____ParserState__, ptr %23, i32 0, i32 3
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  store ptr %25, ptr %4, align 8, !tbaa !5
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  call void @Parser__readToken__(ptr noundef %26)
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %27, ptr %2, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  br label %53

28:                                               ; preds = %12
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.tag_____ParserState__, ptr %29, i32 0, i32 9
  %31 = load ptr, ptr %30, align 8, !tbaa !18
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.tag_____ParserState__, ptr %32, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !19
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.tag_____ParserState__, ptr %35, i32 0, i32 3
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.tag_____Token__, ptr %37, i32 0, i32 2
  %39 = getelementptr inbounds %struct.tag_____IntRange__, ptr %38, i32 0, i32 0
  %40 = load i32, ptr %39, align 8, !tbaa !20
  %41 = load ptr, ptr @mu_____string333, align 8
  %42 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string333, i32 0, i32 1), align 8
  call void @Error__atIndex__(ptr dead_on_unwind writable sret(%struct.tag_____Error__) align 8 %5, ptr noundef %34, i32 noundef %40, ptr %41, i32 %42)
  call void @List__add__Error____(ptr noundef %31, ptr noundef byval(%struct.tag_____Error__) align 8 %5)
  store ptr null, ptr %2, align 8
  br label %53

43:                                               ; preds = %1
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.tag_____ParserState__, ptr %45, i32 0, i32 3
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  %48 = getelementptr inbounds %struct.tag_____Token__, ptr %47, i32 0, i32 2
  %49 = getelementptr inbounds %struct.tag_____IntRange__, ptr %48, i32 0, i32 0
  %50 = load i32, ptr %49, align 8, !tbaa !20
  %51 = load ptr, ptr @mu_____string308, align 8
  %52 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string308, i32 0, i32 1), align 8
  call void @Parser__expectedAt__(ptr noundef %44, i32 noundef %50, ptr %51, i32 %52)
  store ptr null, ptr %2, align 8
  br label %53

53:                                               ; preds = %43, %28, %22
  %54 = load ptr, ptr %2, align 8
  ret ptr %54
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @Parser__expectedAt__(ptr noundef, i32 noundef, ptr, i32) #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_____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 0}
!15 = !{!"tag_____Token__", !12, i64 0, !11, i64 8, !13, i64 24, !13, i64 32, !12, i64 40}
!16 = !{!15, !12, i64 40}
!17 = !{!10, !12, i64 44}
!18 = !{!10, !6, i64 64}
!19 = !{!10, !6, i64 24}
!20 = !{!15, !12, 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 }
%struct.tag_____Error__ = type { ptr, %struct.tag_____IntRange__, %struct.string__ }
%struct.tag_____IntRange__ = type { i32, i32 }

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

; Function Attrs: nounwind uwtable
declare dso_local void @List__add__Error____(ptr noundef, ptr noundef byval(%struct.tag_____Error__) align 8) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @Parser__parseCloseBrace__(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.tag_____Error__, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = load i32, ptr %4, align 8, !tbaa !13
  %6 = icmp eq i32 %5, 8
  br i1 %6, label %7, label %23

7:                                                ; preds = %1
  %8 = getelementptr inbounds i8, ptr %4, i64 40
  %9 = load i32, ptr %8, align 8, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %0, i64 44
  %11 = load i32, ptr %10, align 4, !tbaa !16
  %12 = icmp eq i32 %9, %11
  br i1 %12, label %13, label %14

13:                                               ; preds = %7
  tail call void @Parser__readToken__(ptr noundef nonnull %0)
  br label %28

14:                                               ; preds = %7
  %15 = getelementptr inbounds i8, ptr %0, i64 64
  %16 = load ptr, ptr %15, align 8, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  %18 = load ptr, ptr %17, align 8, !tbaa !18
  %19 = getelementptr inbounds i8, ptr %4, i64 24
  %20 = load i32, ptr %19, align 8, !tbaa !19
  %21 = load ptr, ptr @mu_____string333, align 8
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string333, i64 8), align 8
  call void @Error__atIndex__(ptr dead_on_unwind nonnull writable sret(%struct.tag_____Error__) align 8 %2, ptr noundef %18, i32 noundef %20, ptr %21, i32 %22)
  call void @List__add__Error____(ptr noundef %16, ptr noundef nonnull byval(%struct.tag_____Error__) align 8 %2)
  br label %28

23:                                               ; preds = %1
  %24 = getelementptr inbounds i8, ptr %4, i64 24
  %25 = load i32, ptr %24, align 8, !tbaa !19
  %26 = load ptr, ptr @mu_____string308, align 8
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string308, i64 8), align 8
  tail call void @Parser__expectedAt__(ptr noundef nonnull %0, i32 noundef %25, ptr %26, i32 %27)
  br label %28

28:                                               ; preds = %23, %14, %13
  %.0 = phi ptr [ %4, %13 ], [ null, %14 ], [ null, %23 ]
  ret ptr %.0
}

; Function Attrs: nounwind uwtable
declare dso_local void @Error__atIndex__(ptr dead_on_unwind noalias writable sret(%struct.tag_____Error__) align 8, ptr noundef, i32 noundef, ptr, i32) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @Parser__expectedAt__(ptr noundef, i32 noundef, ptr, i32) 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 0}
!14 = !{!"tag_____Token__", !11, i64 0, !7, i64 8, !12, i64 24, !12, i64 32, !11, i64 40}
!15 = !{!14, !11, i64 40}
!16 = !{!6, !11, i64 44}
!17 = !{!6, !8, i64 64}
!18 = !{!6, !8, i64 24}
!19 = !{!14, !11, i64 24}


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