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

; 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.cache_object = type { %struct.cache, %struct.cache_index }
%struct.cache = type { i32, %struct.strbuf, ptr, i8 }
%struct.strbuf = type { i64, i64, ptr }
%struct.cache_index = type { i64, %struct.author, ptr, i8, ptr, ptr }
%struct.author = type { %struct.strbuf, %struct.strbuf }
%struct.cache_index_entry_list = type { i64, i64, %struct.strbuf, %struct.stat, i32, [20 x i16], ptr }
%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@.str.2 = external hidden unnamed_addr constant [32 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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @show_cache_table() #1 {
  %1 = alloca %struct.cache_object, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 136, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store i64 0, ptr %3, align 8, !tbaa !5
  call void @cache_object_init(ptr noundef %1)
  %4 = getelementptr inbounds %struct.cache_object, ptr %1, i32 0, i32 1
  %5 = getelementptr inbounds %struct.cache_index, ptr %4, i32 0, i32 4
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  store ptr %6, ptr %2, align 8, !tbaa !18
  br label %7

7:                                                ; preds = %15, %0
  %8 = load ptr, ptr %2, align 8, !tbaa !18
  %9 = icmp ne ptr %8, null
  br i1 %9, label %10, label %22

10:                                               ; preds = %7
  %11 = load i64, ptr %3, align 8, !tbaa !5
  %12 = icmp ne i64 %11, 0
  br i1 %12, label %15, label %13

13:                                               ; preds = %10
  %14 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %15

15:                                               ; preds = %13, %10
  %16 = load ptr, ptr %2, align 8, !tbaa !18
  %17 = load i64, ptr %3, align 8, !tbaa !5
  %18 = add i64 %17, 1
  store i64 %18, ptr %3, align 8, !tbaa !5
  call void @show_node(ptr noundef %16, i64 noundef %17)
  %19 = load ptr, ptr %2, align 8, !tbaa !18
  %20 = getelementptr inbounds %struct.cache_index_entry_list, ptr %19, i32 0, i32 6
  %21 = load ptr, ptr %20, align 8, !tbaa !19
  store ptr %21, ptr %2, align 8, !tbaa !18
  br label %7, !llvm.loop !23

22:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 136, ptr %1) #3
  ret void
}

declare void @cache_object_init(ptr noundef) #2

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 = { "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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !14, i64 120}
!10 = !{!"cache_object", !11, i64 0, !16, i64 48}
!11 = !{!"cache", !12, i64 0, !13, i64 8, !14, i64 32, !15, i64 40}
!12 = !{!"int", !7, i64 0}
!13 = !{!"strbuf", !6, i64 0, !6, i64 8, !14, i64 16}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!"cache_index", !6, i64 0, !17, i64 8, !14, i64 56, !15, i64 64, !14, i64 72, !14, i64 80}
!17 = !{!"author", !13, i64 0, !13, i64 24}
!18 = !{!14, !14, i64 0}
!19 = !{!20, !14, i64 232}
!20 = !{!"cache_index_entry_list", !6, i64 0, !6, i64 8, !13, i64 16, !21, i64 40, !12, i64 184, !7, i64 188, !14, i64 232}
!21 = !{!"stat", !6, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !22, i64 72, !22, i64 88, !22, i64 104, !7, i64 120}
!22 = !{!"timespec", !6, i64 0, !6, i64 8}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; 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.cache_object = type { %struct.cache, %struct.cache_index }
%struct.cache = type { i32, %struct.strbuf, ptr, i8 }
%struct.strbuf = type { i64, i64, ptr }
%struct.cache_index = type { i64, %struct.author, ptr, i8, ptr, ptr }
%struct.author = type { %struct.strbuf, %struct.strbuf }

@.str.2 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress 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 @show_node(ptr noundef, i64 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @show_cache_table() local_unnamed_addr #1 {
  %1 = alloca %struct.cache_object, align 8
  call void @llvm.lifetime.start.p0(i64 136, ptr nonnull %1) #4
  call void @cache_object_init(ptr noundef nonnull %1) #4
  %2 = getelementptr inbounds i8, ptr %1, i64 120
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not6 = icmp eq ptr %3, null
  br i1 %.not6, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %6
  %.08 = phi i64 [ %7, %6 ], [ 0, %0 ]
  %.047 = phi ptr [ %9, %6 ], [ %3, %0 ]
  %.not5 = icmp eq i64 %.08, 0
  br i1 %.not5, label %4, label %6

4:                                                ; preds = %.lr.ph
  %5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %6

6:                                                ; preds = %4, %.lr.ph
  %7 = add i64 %.08, 1
  call void @show_node(ptr noundef nonnull %.047, i64 noundef %.08)
  %8 = getelementptr inbounds i8, ptr %.047, i64 232
  %9 = load ptr, ptr %8, align 8, !tbaa !17
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !21

._crit_edge:                                      ; preds = %6, %0
  call void @llvm.lifetime.end.p0(i64 136, ptr nonnull %1) #4
  ret void
}

declare void @cache_object_init(ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress 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 = { 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 #3 = { "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 #4 = { 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, !13, i64 120}
!6 = !{!"cache_object", !7, i64 0, !15, i64 48}
!7 = !{!"cache", !8, i64 0, !11, i64 8, !13, i64 32, !14, i64 40}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"strbuf", !12, i64 0, !12, i64 8, !13, i64 16}
!12 = !{!"long", !9, i64 0}
!13 = !{!"any pointer", !9, i64 0}
!14 = !{!"_Bool", !9, i64 0}
!15 = !{!"cache_index", !12, i64 0, !16, i64 8, !13, i64 56, !14, i64 64, !13, i64 72, !13, i64 80}
!16 = !{!"author", !11, i64 0, !11, i64 24}
!17 = !{!18, !13, i64 232}
!18 = !{!"cache_index_entry_list", !12, i64 0, !12, i64 8, !11, i64 16, !19, i64 40, !8, i64 184, !9, i64 188, !13, i64 232}
!19 = !{!"stat", !12, i64 0, !12, i64 8, !12, i64 16, !8, i64 24, !8, i64 28, !8, i64 32, !8, i64 36, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !20, i64 72, !20, i64 88, !20, i64 104, !9, i64 120}
!20 = !{!"timespec", !12, i64 0, !12, i64 8}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass