; 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.7 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [7 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

declare void @cache_object_init(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @show_cache_table_html() #2 {
  %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
  %7 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  br label %8

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

11:                                               ; preds = %8
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %13 = load ptr, ptr %2, align 8, !tbaa !18
  %14 = load i64, ptr %3, align 8, !tbaa !5
  %15 = add i64 %14, 1
  store i64 %15, ptr %3, align 8, !tbaa !5
  call void @show_node_html(ptr noundef %13, i64 noundef %14)
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %17 = load ptr, ptr %2, align 8, !tbaa !18
  %18 = getelementptr inbounds %struct.cache_index_entry_list, ptr %17, i32 0, i32 6
  %19 = load ptr, ptr %18, align 8, !tbaa !19
  store ptr %19, ptr %2, align 8, !tbaa !18
  br label %8, !llvm.loop !23

20:                                               ; preds = %8
  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
}

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 = !{!"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.7 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [7 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

declare void @cache_object_init(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @show_node_html(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @show_cache_table_html() local_unnamed_addr #3 {
  %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
  %4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %.not4 = icmp eq ptr %3, null
  br i1 %.not4, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.06 = phi i64 [ %6, %.lr.ph ], [ 0, %0 ]
  %.035 = phi ptr [ %9, %.lr.ph ], [ %3, %0 ]
  %5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %6 = add i64 %.06, 1
  call void @show_node_html(ptr noundef nonnull %.035, i64 noundef %.06)
  %7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %8 = getelementptr inbounds i8, ptr %.035, 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 = %.lr.ph, %0
  call void @llvm.lifetime.end.p0(i64 136, ptr nonnull %1) #4
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 #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