; LLVM IR from pmwkaa/monotone :: monotone/engine/engine (engine_recover)

; 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.Engine = type { %struct.Mutex, %struct.CondVar, %struct.Mapping, %struct.Pipeline, %struct.StorageMgr, ptr, ptr, ptr }
%struct.Mutex = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.CondVar = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct.Mapping = type { %struct.Rbtree, i32 }
%struct.Rbtree = type { ptr }
%struct.Pipeline = type { %struct.List, i32, ptr }
%struct.List = type { ptr, ptr }
%struct.StorageMgr = type { %struct.List, i32, ptr }
%struct.Storage = type { %struct.List, i32, i32, i64, i64, ptr, ptr, %struct.List }
%struct.Part = type { %struct.Id, i32, i64, i64, i8, ptr, %struct.Memtable, %struct.Memtable, %struct.File, %struct.Index, %struct.Buf, ptr, ptr, ptr, %struct.List }
%struct.Id = type { i64, i64 }
%struct.Memtable = type { ptr, %struct.Rbtree, i32, i32, i32, i64, i64, i64, %struct.List, i32, %struct.Heap }
%struct.Heap = type { ptr, ptr, i32, ptr }
%struct.File = type { i32, i64, %struct.Str, %struct.List }
%struct.Str = type { ptr, ptr, i8 }
%struct.Index = type <{ i32, i32, i32, i32, %struct.Id, i32, i32, i64, i64, i64, i64, i32, i64, i64, i64, i32, i64, i8, i8, [4 x i32] }>
%struct.Buf = type { ptr, ptr, ptr }
%struct.Ref = type { ptr, %struct.Lockage, %struct.Slice }
%struct.Lockage = type { [2 x %struct.Lock], ptr, ptr }
%struct.Lock = type { i64, i32, i32 }
%struct.Slice = type { i64, i64, %struct.RbtreeNode }
%struct.RbtreeNode = type { ptr, ptr, ptr, i8 }

; Function Attrs: nounwind uwtable
define dso_local void @engine_recover(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.Engine, ptr %14, i32 0, i32 4
  store ptr %15, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.StorageMgr, ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds %struct.List, ptr %17, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %19, ptr %4, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %31, %1
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.StorageMgr, ptr %22, i32 0, i32 0
  %24 = icmp ne ptr %21, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %35

26:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i64 -56
  store ptr %28, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  call void @engine_recover_storage(ptr noundef %29, ptr noundef %30)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %31

31:                                               ; preds = %26
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.List, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !13
  store ptr %34, ptr %4, align 8, !tbaa !5
  br label %20, !llvm.loop !14

35:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.StorageMgr, ptr %36, i32 0, i32 0
  %38 = getelementptr inbounds %struct.List, ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  store ptr %39, ptr %6, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %51, %35
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.StorageMgr, ptr %42, i32 0, i32 0
  %44 = icmp ne ptr %41, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %55

46:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 -56
  store ptr %48, ptr %7, align 8, !tbaa !5
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  call void @engine_recover_validate(ptr noundef %49, ptr noundef %50)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %51

51:                                               ; preds = %46
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.List, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !13
  store ptr %54, ptr %6, align 8, !tbaa !5
  br label %40, !llvm.loop !16

55:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.StorageMgr, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.List, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  store ptr %59, ptr %8, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %139, %55
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.StorageMgr, ptr %62, i32 0, i32 0
  %64 = icmp ne ptr %61, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %60
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %143

66:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 -56
  store ptr %68, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.Storage, ptr %69, i32 0, i32 0
  %71 = getelementptr inbounds %struct.List, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !17
  store ptr %72, ptr %11, align 8, !tbaa !5
  br label %73

73:                                               ; preds = %134, %66
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.Storage, ptr %75, i32 0, i32 0
  %77 = icmp ne ptr %74, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %73
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %138

79:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = getelementptr inbounds i8, ptr %80, i64 -520
  store ptr %81, ptr %12, align 8, !tbaa !5
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = call zeroext i1 @part_has(ptr noundef %82, i32 noundef 1)
  br i1 %83, label %84, label %86

84:                                               ; preds = %79
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  call void @part_open(ptr noundef %85, i32 noundef 1, i1 noundef zeroext true)
  br label %93

86:                                               ; preds = %79
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = call zeroext i1 @part_has(ptr noundef %87, i32 noundef 8)
  br i1 %88, label %89, label %91

89:                                               ; preds = %86
  %90 = load ptr, ptr %12, align 8, !tbaa !5
  call void @part_open(ptr noundef %90, i32 noundef 8, i1 noundef zeroext true)
  br label %92

91:                                               ; preds = %86
  call void @abort() #7
  unreachable

92:                                               ; preds = %89
  br label %93

93:                                               ; preds = %92, %84
  %94 = load ptr, ptr %12, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.Part, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.Part, ptr %96, i32 0, i32 9
  %98 = getelementptr inbounds %struct.Index, ptr %97, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %95, ptr align 8 %98, i64 16, i1 false), !tbaa.struct !20
  %99 = load ptr, ptr %12, align 8, !tbaa !5
  %100 = load ptr, ptr %12, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.Part, ptr %100, i32 0, i32 9
  %102 = getelementptr inbounds %struct.Index, ptr %101, i32 0, i32 13
  %103 = load i64, ptr %102, align 4, !tbaa !22
  call void @part_set_time_create(ptr noundef %99, i64 noundef %103)
  %104 = load ptr, ptr %12, align 8, !tbaa !5
  %105 = load ptr, ptr %12, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.Part, ptr %105, i32 0, i32 9
  %107 = getelementptr inbounds %struct.Index, ptr %106, i32 0, i32 14
  %108 = load i64, ptr %107, align 4, !tbaa !33
  call void @part_set_time_refresh(ptr noundef %104, i64 noundef %108)
  %109 = load ptr, ptr %12, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.Part, ptr %109, i32 0, i32 9
  %111 = getelementptr inbounds %struct.Index, ptr %110, i32 0, i32 16
  %112 = load i64, ptr %111, align 8, !tbaa !34
  call void @config_lsn_follow(i64 noundef %112)
  %113 = load ptr, ptr %10, align 8, !tbaa !5
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  call void @storage_add_metrics(ptr noundef %113, ptr noundef %114)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %115 = load ptr, ptr %12, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.Part, ptr %115, i32 0, i32 0
  %117 = getelementptr inbounds %struct.Id, ptr %116, i32 0, i32 0
  %118 = load i64, ptr %117, align 8, !tbaa !35
  %119 = load ptr, ptr %12, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.Part, ptr %119, i32 0, i32 0
  %121 = getelementptr inbounds %struct.Id, ptr %120, i32 0, i32 1
  %122 = load i64, ptr %121, align 8, !tbaa !36
  %123 = call ptr @ref_allocate(i64 noundef %118, i64 noundef %122)
  store ptr %123, ptr %13, align 8, !tbaa !5
  %124 = load ptr, ptr %13, align 8, !tbaa !5
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.Engine, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %2, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.Engine, ptr %127, i32 0, i32 1
  %129 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ref_prepare(ptr noundef %124, ptr noundef %126, ptr noundef %128, ptr noundef %129)
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.Engine, ptr %130, i32 0, i32 2
  %132 = load ptr, ptr %13, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.Ref, ptr %132, i32 0, i32 2
  call void @mapping_add(ptr noundef %131, ptr noundef %133)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %134

134:                                              ; preds = %93
  %135 = load ptr, ptr %11, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.List, ptr %135, i32 0, i32 0
  %137 = load ptr, ptr %136, align 8, !tbaa !13
  store ptr %137, ptr %11, align 8, !tbaa !5
  br label %73, !llvm.loop !37

138:                                              ; preds = %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %139

139:                                              ; preds = %138
  %140 = load ptr, ptr %8, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.List, ptr %140, i32 0, i32 0
  %142 = load ptr, ptr %141, align 8, !tbaa !13
  store ptr %142, ptr %8, align 8, !tbaa !5
  br label %60, !llvm.loop !38

143:                                              ; preds = %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden void @engine_recover_storage(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden void @engine_recover_validate(ptr noundef, ptr noundef) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @part_has(ptr noundef, i32 noundef) #2

declare void @part_open(ptr noundef, i32 noundef, i1 noundef zeroext) #3

; Function Attrs: noreturn nounwind
declare void @abort() #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @part_set_time_create(ptr noundef, i64 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @part_set_time_refresh(ptr noundef, i64 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @config_lsn_follow(i64 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @storage_add_metrics(ptr noundef, ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @ref_allocate(i64 noundef, i64 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @ref_prepare(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @mapping_add(ptr noundef, ptr noundef) #2

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 = { "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 = { noreturn 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { noreturn 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 0}
!10 = !{!"StorageMgr", !11, i64 0, !12, i64 16, !6, i64 24}
!11 = !{!"List", !6, i64 0, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!11, !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !6, i64 0}
!18 = !{!"Storage", !11, i64 0, !12, i64 16, !12, i64 20, !19, i64 24, !19, i64 32, !6, i64 40, !6, i64 48, !11, i64 56}
!19 = !{!"long", !7, i64 0}
!20 = !{i64 0, i64 8, !21, i64 8, i64 8, !21}
!21 = !{!19, !19, i64 0}
!22 = !{!23, !19, i64 420}
!23 = !{!"Part", !24, i64 0, !12, i64 16, !19, i64 24, !19, i64 32, !25, i64 40, !6, i64 48, !26, i64 56, !26, i64 168, !29, i64 280, !31, i64 336, !32, i64 472, !6, i64 496, !6, i64 504, !6, i64 512, !11, i64 520}
!24 = !{!"Id", !19, i64 0, !19, i64 8}
!25 = !{!"_Bool", !7, i64 0}
!26 = !{!"Memtable", !6, i64 0, !27, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !19, i64 32, !19, i64 40, !19, i64 48, !11, i64 56, !12, i64 72, !28, i64 80}
!27 = !{!"Rbtree", !6, i64 0}
!28 = !{!"Heap", !6, i64 0, !6, i64 8, !12, i64 16, !6, i64 24}
!29 = !{!"File", !12, i64 0, !19, i64 8, !30, i64 16, !11, i64 40}
!30 = !{!"Str", !6, i64 0, !6, i64 8, !25, i64 16}
!31 = !{!"Index", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !24, i64 16, !12, i64 32, !12, i64 36, !19, i64 40, !19, i64 48, !19, i64 56, !19, i64 64, !12, i64 72, !19, i64 76, !19, i64 84, !19, i64 92, !12, i64 100, !19, i64 104, !7, i64 112, !7, i64 113, !7, i64 114}
!32 = !{!"Buf", !6, i64 0, !6, i64 8, !6, i64 16}
!33 = !{!23, !19, i64 428}
!34 = !{!23, !19, i64 440}
!35 = !{!23, !19, i64 0}
!36 = !{!23, !19, i64 8}
!37 = distinct !{!37, !15}
!38 = distinct !{!38, !15}


; 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"

; Function Attrs: nounwind uwtable
define dso_local void @engine_recover(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 136
  %.055 = load ptr, ptr %2, align 8, !tbaa !5
  %.not56 = icmp eq ptr %.055, %2
  br i1 %.not56, label %.preheader54, label %.lr.ph

.preheader54.loopexit:                            ; preds = %.lr.ph
  %.04658.pre = load ptr, ptr %2, align 8, !tbaa !5
  br label %.preheader54

.preheader54:                                     ; preds = %.preheader54.loopexit, %1
  %.04658 = phi ptr [ %.04658.pre, %.preheader54.loopexit ], [ %.055, %1 ]
  %.not5159 = icmp eq ptr %.04658, %2
  br i1 %.not5159, label %.preheader, label %.lr.ph61

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.057 = phi ptr [ %.0, %.lr.ph ], [ %.055, %1 ]
  %3 = getelementptr inbounds i8, ptr %.057, i64 -56
  tail call void @engine_recover_storage(ptr noundef %0, ptr noundef nonnull %3)
  %.0 = load ptr, ptr %.057, align 8, !tbaa !5
  %.not = icmp eq ptr %.0, %2
  br i1 %.not, label %.preheader54.loopexit, label %.lr.ph, !llvm.loop !10

.preheader.loopexit:                              ; preds = %.lr.ph61
  %.04866.pre = load ptr, ptr %2, align 8, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader54
  %.04866 = phi ptr [ %.04866.pre, %.preheader.loopexit ], [ %.04658, %.preheader54 ]
  %.not5267 = icmp eq ptr %.04866, %2
  br i1 %.not5267, label %._crit_edge, label %.lr.ph69

.lr.ph69:                                         ; preds = %.preheader
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  br label %7

.lr.ph61:                                         ; preds = %.preheader54, %.lr.ph61
  %.04660 = phi ptr [ %.046, %.lr.ph61 ], [ %.04658, %.preheader54 ]
  %6 = getelementptr inbounds i8, ptr %.04660, i64 -56
  tail call void @engine_recover_validate(ptr noundef %0, ptr noundef nonnull %6)
  %.046 = load ptr, ptr %.04660, align 8, !tbaa !5
  %.not51 = icmp eq ptr %.046, %2
  br i1 %.not51, label %.preheader.loopexit, label %.lr.ph61, !llvm.loop !12

.loopexit:                                        ; preds = %14, %7
  %.048 = load ptr, ptr %.04868, align 8, !tbaa !5
  %.not52 = icmp eq ptr %.048, %2
  br i1 %.not52, label %._crit_edge, label %7, !llvm.loop !13

._crit_edge:                                      ; preds = %.loopexit, %.preheader
  ret void

7:                                                ; preds = %.lr.ph69, %.loopexit
  %.04868 = phi ptr [ %.04866, %.lr.ph69 ], [ %.048, %.loopexit ]
  %8 = getelementptr inbounds i8, ptr %.04868, i64 -56
  %.04762 = load ptr, ptr %8, align 8, !tbaa !5
  %.not5363 = icmp eq ptr %.04762, %8
  br i1 %.not5363, label %.loopexit, label %.lr.ph65

.lr.ph65:                                         ; preds = %7, %14
  %.04764 = phi ptr [ %.047, %14 ], [ %.04762, %7 ]
  %9 = getelementptr inbounds i8, ptr %.04764, i64 -520
  %10 = tail call zeroext i1 @part_has(ptr noundef nonnull %9, i32 noundef 1)
  br i1 %10, label %14, label %11

11:                                               ; preds = %.lr.ph65
  %12 = tail call zeroext i1 @part_has(ptr noundef nonnull %9, i32 noundef 8)
  br i1 %12, label %14, label %13

13:                                               ; preds = %11
  tail call void @abort() #5
  unreachable

14:                                               ; preds = %11, %.lr.ph65
  %.sink = phi i32 [ 1, %.lr.ph65 ], [ 8, %11 ]
  tail call void @part_open(ptr noundef nonnull %9, i32 noundef %.sink, i1 noundef zeroext true) #6
  %15 = getelementptr inbounds i8, ptr %.04764, i64 -168
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %15, i64 16, i1 false), !tbaa.struct !14
  %16 = getelementptr inbounds i8, ptr %.04764, i64 -100
  %17 = load i64, ptr %16, align 4, !tbaa !17
  tail call void @part_set_time_create(ptr noundef nonnull %9, i64 noundef %17)
  %18 = getelementptr inbounds i8, ptr %.04764, i64 -92
  %19 = load i64, ptr %18, align 4, !tbaa !29
  tail call void @part_set_time_refresh(ptr noundef nonnull %9, i64 noundef %19)
  %20 = getelementptr inbounds i8, ptr %.04764, i64 -80
  %21 = load i64, ptr %20, align 8, !tbaa !30
  tail call void @config_lsn_follow(i64 noundef %21)
  tail call void @storage_add_metrics(ptr noundef nonnull %8, ptr noundef nonnull %9)
  %22 = load i64, ptr %9, align 8, !tbaa !31
  %23 = getelementptr inbounds i8, ptr %.04764, i64 -512
  %24 = load i64, ptr %23, align 8, !tbaa !32
  %25 = tail call ptr @ref_allocate(i64 noundef %22, i64 noundef %24)
  tail call void @ref_prepare(ptr noundef %25, ptr noundef %0, ptr noundef nonnull %4, ptr noundef nonnull %9)
  %26 = getelementptr inbounds i8, ptr %25, i64 56
  tail call void @mapping_add(ptr noundef nonnull %5, ptr noundef nonnull %26)
  %.047 = load ptr, ptr %.04764, align 8, !tbaa !5
  %.not53 = icmp eq ptr %.047, %8
  br i1 %.not53, label %.loopexit, label %.lr.ph65, !llvm.loop !33
}

; Function Attrs: nounwind uwtable
declare hidden void @engine_recover_storage(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @engine_recover_validate(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @part_has(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @part_open(ptr noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @part_set_time_create(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @part_set_time_refresh(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @config_lsn_follow(i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @storage_add_metrics(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @ref_allocate(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @ref_prepare(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @mapping_add(ptr noundef, ptr noundef) local_unnamed_addr #1

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" }
attributes #1 = { inlinehint 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 = { noreturn 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { noreturn nounwind }
attributes #6 = { 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, !7, i64 0}
!6 = !{!"List", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = !{i64 0, i64 8, !15, i64 8, i64 8, !15}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!18, !16, i64 420}
!18 = !{!"Part", !19, i64 0, !20, i64 16, !16, i64 24, !16, i64 32, !21, i64 40, !7, i64 48, !22, i64 56, !22, i64 168, !25, i64 280, !27, i64 336, !28, i64 472, !7, i64 496, !7, i64 504, !7, i64 512, !6, i64 520}
!19 = !{!"Id", !16, i64 0, !16, i64 8}
!20 = !{!"int", !8, i64 0}
!21 = !{!"_Bool", !8, i64 0}
!22 = !{!"Memtable", !7, i64 0, !23, i64 8, !20, i64 16, !20, i64 20, !20, i64 24, !16, i64 32, !16, i64 40, !16, i64 48, !6, i64 56, !20, i64 72, !24, i64 80}
!23 = !{!"Rbtree", !7, i64 0}
!24 = !{!"Heap", !7, i64 0, !7, i64 8, !20, i64 16, !7, i64 24}
!25 = !{!"File", !20, i64 0, !16, i64 8, !26, i64 16, !6, i64 40}
!26 = !{!"Str", !7, i64 0, !7, i64 8, !21, i64 16}
!27 = !{!"Index", !20, i64 0, !20, i64 4, !20, i64 8, !20, i64 12, !19, i64 16, !20, i64 32, !20, i64 36, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !20, i64 72, !16, i64 76, !16, i64 84, !16, i64 92, !20, i64 100, !16, i64 104, !8, i64 112, !8, i64 113, !8, i64 114}
!28 = !{!"Buf", !7, i64 0, !7, i64 8, !7, i64 16}
!29 = !{!18, !16, i64 428}
!30 = !{!18, !16, i64 440}
!31 = !{!18, !16, i64 0}
!32 = !{!18, !16, i64 8}
!33 = distinct !{!33, !11}


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