; 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.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [109 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [12 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
@.str.20 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [5 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

; 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(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
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store ptr null, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %5, ptr %3, align 8, !tbaa !5
  %6 = load i32, ptr @count_modified, align 4, !tbaa !9
  %7 = icmp ne i32 %6, 0
  br i1 %7, label %16, label %8

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

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

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

16:                                               ; preds = %11, %8, %1
  %17 = load i32, ptr @count_modified, align 4, !tbaa !9
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %22, label %19

19:                                               ; preds = %16
  %20 = load i32, ptr @count_deleted, align 4, !tbaa !9
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %55

22:                                               ; preds = %19, %16
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  br label %24

24:                                               ; preds = %49, %22
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %53

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

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

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

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

53:                                               ; preds = %24
  %54 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %55

55:                                               ; preds = %53, %19
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %56, ptr %3, align 8, !tbaa !5
  %57 = load i32, ptr @count_new, align 4, !tbaa !9
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %80

59:                                               ; preds = %55
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  br label %61

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

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

69:                                               ; preds = %64
  %70 = call i32 (ptr, ...) @printf(ptr noundef @.str.21)
  %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.22, ptr noundef %73)
  br label %75

75:                                               ; preds = %69, %64
  %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 %61, !llvm.loop !17

79:                                               ; preds = %61
  br label %80

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

84:                                               ; preds = %80
  br label %85

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

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

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

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

103:                                              ; preds = %85
  br label %104

104:                                              ; preds = %103, %80
  %105 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %4, align 4
  br label %106

106:                                              ; preds = %104, %14
  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.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [109 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [12 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
@.str.20 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [5 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

; 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(ptr noundef readonly %0) local_unnamed_addr #1 {
  %2 = load i32, ptr @count_modified, align 4, !tbaa !5
  %3 = icmp ne i32 %2, 0
  %4 = load i32, ptr @count_new, align 4
  %5 = icmp ne i32 %4, 0
  %or.cond = select i1 %3, i1 true, i1 %5
  %6 = load i32, ptr @count_deleted, align 4
  %7 = icmp ne i32 %6, 0
  %or.cond3 = select i1 %or.cond, i1 true, i1 %7
  br i1 %or.cond3, label %8, label %.loopexit

8:                                                ; preds = %1
  %or.cond5 = select i1 %3, i1 true, i1 %7
  br i1 %or.cond5, label %9, label %24

9:                                                ; preds = %8
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  %.not30 = icmp eq ptr %0, null
  br i1 %.not30, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %9, %20
  %.031 = phi ptr [ %22, %20 ], [ %0, %9 ]
  %11 = getelementptr inbounds i8, ptr %.031, i64 8
  %12 = load i32, ptr %11, align 8, !tbaa !9
  switch i32 %12, label %20 [
    i32 256, label %13
    i32 2048, label %13
  ]

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

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

._crit_edge:                                      ; preds = %20, %9
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %.pre = load i32, ptr @count_new, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %8, %._crit_edge
  %25 = phi i32 [ %4, %8 ], [ %.pre, %._crit_edge ]
  %.not27 = icmp eq i32 %25, 0
  br i1 %.not27, label %.loopexit29, label %26

26:                                               ; preds = %24
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  %.not2832 = icmp eq ptr %0, null
  br i1 %.not2832, label %.loopexit, label %.lr.ph35

.lr.ph35:                                         ; preds = %26, %35
  %.133 = phi ptr [ %37, %35 ], [ %0, %26 ]
  %28 = getelementptr inbounds i8, ptr %.133, i64 8
  %29 = load i32, ptr %28, align 8, !tbaa !9
  %30 = icmp eq i32 %29, 512
  br i1 %30, label %31, label %35

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

35:                                               ; preds = %31, %.lr.ph35
  %36 = getelementptr inbounds i8, ptr %.133, i64 16
  %37 = load ptr, ptr %36, align 8, !tbaa !13
  %.not28 = icmp eq ptr %37, null
  br i1 %.not28, label %.loopexit29, label %.lr.ph35, !llvm.loop !16

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

.preheader:                                       ; preds = %.loopexit29, %48
  %.2 = phi ptr [ %50, %48 ], [ %0, %.loopexit29 ]
  %41 = getelementptr inbounds i8, ptr %.2, i64 8
  %42 = load i32, ptr %41, align 8, !tbaa !9
  %43 = icmp eq i32 %42, 1
  br i1 %43, label %44, label %48

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

48:                                               ; preds = %44, %.preheader
  %49 = getelementptr inbounds i8, ptr %.2, i64 16
  %50 = load ptr, ptr %49, align 8, !tbaa !13
  %.old6.not = icmp eq ptr %50, null
  br i1 %.old6.not, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %48, %.loopexit29, %26, %1
  %.str.3.sink = phi ptr [ @.str.15, %1 ], [ @.str.3, %26 ], [ @.str.3, %.loopexit29 ], [ @.str.3, %48 ]
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
  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