; LLVM IR from jspd-group/pegit :: src (status)

; 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.status_options = type { i8, i8, i8 }
%struct.node = type { ptr, i32, ptr }

@count_new = external dso_local global i32, align 4
@count_modified = external dso_local global i32, align 4
@count_deleted = external dso_local global i32, align 4
@.str.15 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [8 x i8], align 1
@status_opts = external dso_local global %struct.status_options, align 1
@.str.23 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [6 x i8], align 1

; 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

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local void @print_status_html(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = call i32 (ptr, ...) @printf(ptr noundef @.str.25)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store ptr null, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %6, ptr %3, align 8, !tbaa !5
  %7 = call i32 (ptr, ...) @printf(ptr noundef @.str.26)
  %8 = load i32, ptr @count_modified, align 4, !tbaa !9
  %9 = icmp ne i32 %8, 0
  br i1 %9, label %18, label %10

10:                                               ; preds = %1
  %11 = load i32, ptr @count_new, align 4, !tbaa !9
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %18, label %13

13:                                               ; preds = %10
  %14 = load i32, ptr @count_deleted, align 4, !tbaa !9
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %18, label %16

16:                                               ; preds = %13
  %17 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  store i32 1, ptr %4, align 4
  br label %106

18:                                               ; preds = %13, %10, %1
  %19 = load i32, ptr @count_modified, align 4, !tbaa !9
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %24, label %21

21:                                               ; preds = %18
  %22 = load i32, ptr @count_deleted, align 4, !tbaa !9
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %56

24:                                               ; preds = %21, %18
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.27)
  br label %26

26:                                               ; preds = %50, %24
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %54

29:                                               ; preds = %26
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.node, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 8, !tbaa !11
  %33 = icmp eq i32 %32, 256
  br i1 %33, label %39, label %34

34:                                               ; preds = %29
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.node, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !11
  %38 = icmp eq i32 %37, 2048
  br i1 %38, label %39, label %50

39:                                               ; preds = %34, %29
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.node, ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 8, !tbaa !11
  %43 = icmp eq i32 %42, 256
  %44 = zext i1 %43 to i64
  %45 = select i1 %43, ptr @.str.18, ptr @.str.19
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.node, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !13
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.28, ptr noundef %45, ptr noundef %48)
  br label %50

50:                                               ; preds = %39, %34
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.node, ptr %51, i32 0, i32 2
  %53 = load ptr, ptr %52, align 8, !tbaa !14
  store ptr %53, ptr %3, align 8, !tbaa !5
  br label %26, !llvm.loop !15

54:                                               ; preds = %26
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.29)
  br label %56

56:                                               ; preds = %54, %21
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %57, ptr %3, align 8, !tbaa !5
  %58 = load i32, ptr @count_new, align 4, !tbaa !9
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %81

60:                                               ; preds = %56
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.30)
  br label %62

62:                                               ; preds = %75, %60
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %79

65:                                               ; preds = %62
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.node, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 8, !tbaa !11
  %69 = icmp eq i32 %68, 512
  br i1 %69, label %70, label %75

70:                                               ; preds = %65
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.node, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !13
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.31, ptr noundef %73)
  br label %75

75:                                               ; preds = %70, %65
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.node, ptr %76, i32 0, i32 2
  %78 = load ptr, ptr %77, align 8, !tbaa !14
  store ptr %78, ptr %3, align 8, !tbaa !5
  br label %62, !llvm.loop !17

79:                                               ; preds = %62
  %80 = call i32 (ptr, ...) @printf(ptr noundef @.str.32)
  br label %81

81:                                               ; preds = %79, %56
  %82 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %82, ptr %3, align 8, !tbaa !5
  %83 = load i8, ptr getelementptr inbounds (%struct.status_options, ptr @status_opts, i32 0, i32 2), align 1, !tbaa !18, !range !21, !noundef !22
  %84 = trunc i8 %83 to i1
  br i1 %84, label %85, label %105

85:                                               ; preds = %81
  br label %86

86:                                               ; preds = %100, %85
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = icmp ne ptr %87, null
  br i1 %88, label %89, label %104

89:                                               ; preds = %86
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.node, ptr %90, i32 0, i32 1
  %92 = load i32, ptr %91, align 8, !tbaa !11
  %93 = icmp eq i32 %92, 4
  br i1 %93, label %94, label %100

94:                                               ; preds = %89
  %95 = call i32 (ptr, ...) @printf(ptr noundef @.str.23)
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.node, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !13
  %99 = call i32 (ptr, ...) @printf(ptr noundef @.str.24, ptr noundef %98)
  br label %100

100:                                              ; preds = %94, %89
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.node, ptr %101, i32 0, i32 2
  %103 = load ptr, ptr %102, align 8, !tbaa !14
  store ptr %103, ptr %3, align 8, !tbaa !5
  br label %86, !llvm.loop !23

104:                                              ; preds = %86
  br label %105

105:                                              ; preds = %104, %81
  store i32 0, ptr %4, align 4
  br label %106

106:                                              ; preds = %105, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  %107 = load i32, ptr %4, align 4
  switch i32 %107, label %109 [
    i32 0, label %108
    i32 1, label %108
  ]

108:                                              ; preds = %106, %106
  ret void

109:                                              ; preds = %106
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"node", !6, i64 0, !10, i64 8, !6, i64 16}
!13 = !{!12, !6, i64 0}
!14 = !{!12, !6, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!19, !20, i64 2}
!19 = !{!"status_options", !20, i64 0, !20, i64 1, !20, i64 2}
!20 = !{!"_Bool", !7, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = distinct !{!23, !16}


; 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.status_options = type { i8, i8, i8 }

@count_new = external dso_local local_unnamed_addr global i32, align 4
@count_modified = external dso_local local_unnamed_addr global i32, align 4
@count_deleted = external dso_local local_unnamed_addr global i32, align 4
@.str.15 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [8 x i8], align 1
@status_opts = external dso_local local_unnamed_addr global %struct.status_options, align 1
@.str.23 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nofree nounwind uwtable
define dso_local void @print_status_html(ptr noundef readonly %0) local_unnamed_addr #1 {
  %2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25)
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26)
  %4 = load i32, ptr @count_modified, align 4, !tbaa !5
  %5 = icmp ne i32 %4, 0
  %6 = load i32, ptr @count_new, align 4
  %7 = icmp ne i32 %6, 0
  %or.cond = select i1 %5, i1 true, i1 %7
  %8 = load i32, ptr @count_deleted, align 4
  %9 = icmp ne i32 %8, 0
  %or.cond3 = select i1 %or.cond, i1 true, i1 %9
  br i1 %or.cond3, label %12, label %10

10:                                               ; preds = %1
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  br label %.loopexit

12:                                               ; preds = %1
  %or.cond5 = select i1 %5, i1 true, i1 %9
  br i1 %or.cond5, label %13, label %26

13:                                               ; preds = %12
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.27)
  %.not29 = icmp eq ptr %0, null
  br i1 %.not29, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %13, %22
  %.030 = phi ptr [ %24, %22 ], [ %0, %13 ]
  %15 = getelementptr inbounds i8, ptr %.030, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !9
  switch i32 %16, label %22 [
    i32 256, label %17
    i32 2048, label %17
  ]

17:                                               ; preds = %.lr.ph, %.lr.ph
  %18 = icmp eq i32 %16, 256
  %19 = select i1 %18, ptr @.str.18, ptr @.str.19
  %20 = load ptr, ptr %.030, align 8, !tbaa !12
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.28, ptr noundef nonnull %19, ptr noundef %20)
  br label %22

22:                                               ; preds = %.lr.ph, %17
  %23 = getelementptr inbounds i8, ptr %.030, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %.not = icmp eq ptr %24, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !14

._crit_edge:                                      ; preds = %22, %13
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.29)
  %.pre = load i32, ptr @count_new, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %12, %._crit_edge
  %27 = phi i32 [ %6, %12 ], [ %.pre, %._crit_edge ]
  %.not27 = icmp eq i32 %27, 0
  br i1 %.not27, label %40, label %28

28:                                               ; preds = %26
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.30)
  %.not2831 = icmp eq ptr %0, null
  br i1 %.not2831, label %._crit_edge35, label %.lr.ph34

.lr.ph34:                                         ; preds = %28, %36
  %.132 = phi ptr [ %38, %36 ], [ %0, %28 ]
  %30 = getelementptr inbounds i8, ptr %.132, i64 8
  %31 = load i32, ptr %30, align 8, !tbaa !9
  %32 = icmp eq i32 %31, 512
  br i1 %32, label %33, label %36

33:                                               ; preds = %.lr.ph34
  %34 = load ptr, ptr %.132, align 8, !tbaa !12
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.31, ptr noundef %34)
  br label %36

36:                                               ; preds = %33, %.lr.ph34
  %37 = getelementptr inbounds i8, ptr %.132, i64 16
  %38 = load ptr, ptr %37, align 8, !tbaa !13
  %.not28 = icmp eq ptr %38, null
  br i1 %.not28, label %._crit_edge35, label %.lr.ph34, !llvm.loop !16

._crit_edge35:                                    ; preds = %36, %28
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.32)
  br label %40

40:                                               ; preds = %._crit_edge35, %26
  %41 = load i8, ptr getelementptr inbounds (i8, ptr @status_opts, i64 2), align 1, !tbaa !17, !range !20, !noundef !21
  %42 = trunc nuw i8 %41 to i1
  %43 = icmp ne ptr %0, null
  %or.cond7 = and i1 %43, %42
  br i1 %or.cond7, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %40, %51
  %.2 = phi ptr [ %53, %51 ], [ %0, %40 ]
  %44 = getelementptr inbounds i8, ptr %.2, i64 8
  %45 = load i32, ptr %44, align 8, !tbaa !9
  %46 = icmp eq i32 %45, 4
  br i1 %46, label %47, label %51

47:                                               ; preds = %.preheader
  %48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.23)
  %49 = load ptr, ptr %.2, align 8, !tbaa !12
  %50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24, ptr noundef %49)
  br label %51

51:                                               ; preds = %47, %.preheader
  %52 = getelementptr inbounds i8, ptr %.2, i64 16
  %53 = load ptr, ptr %52, align 8, !tbaa !13
  %.old6.not = icmp eq ptr %53, null
  br i1 %.old6.not, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %51, %40, %10
  ret void
}

attributes #0 = { nofree nounwind "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 #1 = { nofree 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"node", !11, i64 0, !6, i64 8, !11, i64 16}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!10, !11, i64 16}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !19, i64 2}
!18 = !{!"status_options", !19, i64 0, !19, i64 1, !19, i64 2}
!19 = !{!"_Bool", !7, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}


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