; LLVM IR from vczh/herodb :: Kernel/Source (Vlpp)

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

@.str.2 = external hidden unnamed_addr constant [1 x i32], align 4
@_ZN2vl10reflection11description17globalTypeManagerE = external dso_local global ptr, align 8

; 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: mustprogress uwtable
declare dso_local void @_ZN2vl10reflection11description19LogTypeManager_EnumERNS_6stream10TextWriterEPNS1_15ITypeDescriptorEPNS1_16IValueSerializerE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl10reflection11description21LogTypeManager_StructERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl10reflection11description19LogTypeManager_DataERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl10reflection11description20LogTypeManager_ClassERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl10reflection11description14LogTypeManagerERNS_6stream10TextWriterE(ptr noundef nonnull align 8 dereferenceable(8) %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  store i64 0, ptr %3, align 8, !tbaa !9
  br label %6

6:                                                ; preds = %62, %1
  %7 = load i64, ptr %3, align 8, !tbaa !9
  %8 = load ptr, ptr @_ZN2vl10reflection11description17globalTypeManagerE, align 8, !tbaa !5
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = getelementptr inbounds ptr, ptr %9, i64 2
  %11 = load ptr, ptr %10, align 8
  %12 = call noundef i64 %11(ptr noundef nonnull align 8 dereferenceable(8) %8)
  %13 = icmp slt i64 %7, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  br label %65

15:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  %16 = load ptr, ptr @_ZN2vl10reflection11description17globalTypeManagerE, align 8, !tbaa !5
  %17 = load i64, ptr %3, align 8, !tbaa !9
  %18 = load ptr, ptr %16, align 8, !tbaa !11
  %19 = getelementptr inbounds ptr, ptr %18, i64 3
  %20 = load ptr, ptr %19, align 8
  %21 = call noundef ptr %20(ptr noundef nonnull align 8 dereferenceable(8) %16, i64 noundef %17)
  store ptr %21, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = getelementptr inbounds ptr, ptr %23, i64 4
  %25 = load ptr, ptr %24, align 8
  %26 = call noundef ptr %25(ptr noundef nonnull align 8 dereferenceable(8) %22)
  store ptr %26, ptr %5, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %54

29:                                               ; preds = %15
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = getelementptr inbounds ptr, ptr %31, i64 6
  %33 = load ptr, ptr %32, align 8
  %34 = call noundef zeroext i1 %33(ptr noundef nonnull align 8 dereferenceable(8) %30)
  br i1 %34, label %35, label %39

35:                                               ; preds = %29
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN2vl10reflection11description19LogTypeManager_EnumERNS_6stream10TextWriterEPNS1_15ITypeDescriptorEPNS1_16IValueSerializerE(ptr noundef nonnull align 8 dereferenceable(8) %36, ptr noundef %37, ptr noundef %38)
  br label %53

39:                                               ; preds = %29
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load ptr, ptr %40, align 8, !tbaa !11
  %42 = getelementptr inbounds ptr, ptr %41, i64 8
  %43 = load ptr, ptr %42, align 8
  %44 = call noundef i64 %43(ptr noundef nonnull align 8 dereferenceable(8) %40)
  %45 = icmp sgt i64 %44, 0
  br i1 %45, label %46, label %49

46:                                               ; preds = %39
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN2vl10reflection11description21LogTypeManager_StructERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef %48)
  br label %52

49:                                               ; preds = %39
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN2vl10reflection11description19LogTypeManager_DataERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8) %50, ptr noundef %51)
  br label %52

52:                                               ; preds = %49, %46
  br label %53

53:                                               ; preds = %52, %35
  br label %57

54:                                               ; preds = %15
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN2vl10reflection11description20LogTypeManager_ClassERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8) %55, ptr noundef %56)
  br label %57

57:                                               ; preds = %54, %53
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = load ptr, ptr %58, align 8, !tbaa !11
  %60 = getelementptr inbounds ptr, ptr %59, i64 7
  %61 = load ptr, ptr %60, align 8
  call void %61(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef @.str.2)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  br label %62

62:                                               ; preds = %57
  %63 = load i64, ptr %3, align 8, !tbaa !9
  %64 = add nsw i64 %63, 1
  store i64 %64, ptr %3, align 8, !tbaa !9
  br label %6, !llvm.loop !13

65:                                               ; preds = %14
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

@.str.2 = external hidden unnamed_addr constant [1 x i32], align 4
@_ZN2vl10reflection11description17globalTypeManagerE = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl10reflection11description19LogTypeManager_EnumERNS_6stream10TextWriterEPNS1_15ITypeDescriptorEPNS1_16IValueSerializerE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl10reflection11description21LogTypeManager_StructERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl10reflection11description19LogTypeManager_DataERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl10reflection11description20LogTypeManager_ClassERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl10reflection11description14LogTypeManagerERNS_6stream10TextWriterE(ptr noundef nonnull align 8 dereferenceable(8) %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr @_ZN2vl10reflection11description17globalTypeManagerE, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !9
  %4 = getelementptr inbounds i8, ptr %3, i64 16
  %5 = load ptr, ptr %4, align 8
  %6 = tail call noundef i64 %5(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %7 = icmp sgt i64 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %32, %1
  ret void

.lr.ph:                                           ; preds = %1, %32
  %.017 = phi i64 [ %36, %32 ], [ 0, %1 ]
  %8 = load ptr, ptr @_ZN2vl10reflection11description17globalTypeManagerE, align 8, !tbaa !5
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %9, i64 24
  %11 = load ptr, ptr %10, align 8
  %12 = tail call noundef ptr %11(ptr noundef nonnull align 8 dereferenceable(8) %8, i64 noundef %.017)
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %13, i64 32
  %15 = load ptr, ptr %14, align 8
  %16 = tail call noundef ptr %15(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %.not = icmp eq ptr %16, null
  br i1 %.not, label %31, label %17

17:                                               ; preds = %.lr.ph
  %18 = load ptr, ptr %16, align 8, !tbaa !9
  %19 = getelementptr inbounds i8, ptr %18, i64 48
  %20 = load ptr, ptr %19, align 8
  %21 = tail call noundef zeroext i1 %20(ptr noundef nonnull align 8 dereferenceable(8) %16)
  br i1 %21, label %22, label %23

22:                                               ; preds = %17
  tail call void @_ZN2vl10reflection11description19LogTypeManager_EnumERNS_6stream10TextWriterEPNS1_15ITypeDescriptorEPNS1_16IValueSerializerE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %12, ptr noundef nonnull %16)
  br label %32

23:                                               ; preds = %17
  %24 = load ptr, ptr %12, align 8, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %24, i64 64
  %26 = load ptr, ptr %25, align 8
  %27 = tail call noundef i64 %26(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %28 = icmp sgt i64 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %23
  tail call void @_ZN2vl10reflection11description21LogTypeManager_StructERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %12)
  br label %32

30:                                               ; preds = %23
  tail call void @_ZN2vl10reflection11description19LogTypeManager_DataERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %12)
  br label %32

31:                                               ; preds = %.lr.ph
  tail call void @_ZN2vl10reflection11description20LogTypeManager_ClassERNS_6stream10TextWriterEPNS1_15ITypeDescriptorE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %12)
  br label %32

32:                                               ; preds = %22, %30, %29, %31
  %33 = load ptr, ptr %0, align 8, !tbaa !9
  %34 = getelementptr inbounds i8, ptr %33, i64 56
  %35 = load ptr, ptr %34, align 8
  tail call void %35(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull @.str.2)
  %36 = add nuw nsw i64 %.017, 1
  %37 = load ptr, ptr @_ZN2vl10reflection11description17globalTypeManagerE, align 8, !tbaa !5
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  %40 = load ptr, ptr %39, align 8
  %41 = tail call noundef i64 %40(ptr noundef nonnull align 8 dereferenceable(8) %37)
  %42 = icmp slt i64 %36, %41
  br i1 %42, label %.lr.ph, label %._crit_edge, !llvm.loop !11
}

attributes #0 = { mustprogress 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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