; 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.63 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.64 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.65 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.66 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.67 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.68 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.69 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.70 = external hidden unnamed_addr constant [3 x i32], align 4

; 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 noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

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

10:                                               ; preds = %68, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds i32, ptr %11, i32 1
  store ptr %12, ptr %5, align 8, !tbaa !5
  %13 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %13, ptr %6, align 4, !tbaa !9
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %17, label %16

16:                                               ; preds = %10
  store i32 3, ptr %7, align 4
  br label %66

17:                                               ; preds = %10
  %18 = load i32, ptr %6, align 4, !tbaa !9
  switch i32 %18, label %59 [
    i32 34, label %19
    i32 92, label %24
    i32 47, label %29
    i32 8, label %34
    i32 12, label %39
    i32 10, label %44
    i32 13, label %49
    i32 9, label %54
  ]

19:                                               ; preds = %17
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = getelementptr inbounds ptr, ptr %21, i64 4
  %23 = load ptr, ptr %22, align 8
  call void %23(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef @.str.63)
  br label %65

24:                                               ; preds = %17
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = load ptr, ptr %25, align 8, !tbaa !11
  %27 = getelementptr inbounds ptr, ptr %26, i64 4
  %28 = load ptr, ptr %27, align 8
  call void %28(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef @.str.64)
  br label %65

29:                                               ; preds = %17
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = getelementptr inbounds ptr, ptr %31, i64 4
  %33 = load ptr, ptr %32, align 8
  call void %33(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef @.str.65)
  br label %65

34:                                               ; preds = %17
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load ptr, ptr %35, align 8, !tbaa !11
  %37 = getelementptr inbounds ptr, ptr %36, i64 4
  %38 = load ptr, ptr %37, align 8
  call void %38(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef @.str.66)
  br label %65

39:                                               ; preds = %17
  %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 4
  %43 = load ptr, ptr %42, align 8
  call void %43(ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef @.str.67)
  br label %65

44:                                               ; preds = %17
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = getelementptr inbounds ptr, ptr %46, i64 4
  %48 = load ptr, ptr %47, align 8
  call void %48(ptr noundef nonnull align 8 dereferenceable(8) %45, ptr noundef @.str.68)
  br label %65

49:                                               ; preds = %17
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = getelementptr inbounds ptr, ptr %51, i64 4
  %53 = load ptr, ptr %52, align 8
  call void %53(ptr noundef nonnull align 8 dereferenceable(8) %50, ptr noundef @.str.69)
  br label %65

54:                                               ; preds = %17
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = load ptr, ptr %55, align 8, !tbaa !11
  %57 = getelementptr inbounds ptr, ptr %56, i64 4
  %58 = load ptr, ptr %57, align 8
  call void %58(ptr noundef nonnull align 8 dereferenceable(8) %55, ptr noundef @.str.70)
  br label %65

59:                                               ; preds = %17
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = load ptr, ptr %60, align 8, !tbaa !11
  %63 = getelementptr inbounds ptr, ptr %62, i64 2
  %64 = load ptr, ptr %63, align 8
  call void %64(ptr noundef nonnull align 8 dereferenceable(8) %60, i32 noundef signext %61)
  br label %65

65:                                               ; preds = %59, %54, %49, %44, %39, %34, %29, %24, %19
  store i32 0, ptr %7, align 4
  br label %66

66:                                               ; preds = %65, %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  %67 = load i32, ptr %7, align 4
  switch i32 %67, label %70 [
    i32 0, label %68
    i32 3, label %69
  ]

68:                                               ; preds = %66
  br label %10, !llvm.loop !13

69:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret void

70:                                               ; preds = %66
  unreachable
}

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 = !{!"wchar_t", !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.63 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.64 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.65 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.66 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.67 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.68 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.69 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.70 = external hidden unnamed_addr constant [3 x i32], align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl7parsing4json16JsonEscapeStringERKNS_12ObjectStringIwEERNS_6stream10TextWriterE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) local_unnamed_addr #0 {
  %3 = tail call noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  br label %4

4:                                                ; preds = %.backedge, %2
  %.014 = phi ptr [ %3, %2 ], [ %5, %.backedge ]
  %5 = getelementptr inbounds i8, ptr %.014, i64 4
  %6 = load i32, ptr %.014, align 4, !tbaa !5
  switch i32 %6, label %39 [
    i32 0, label %43
    i32 34, label %7
    i32 92, label %11
    i32 47, label %15
    i32 8, label %19
    i32 12, label %23
    i32 10, label %27
    i32 13, label %31
    i32 9, label %35
  ]

7:                                                ; preds = %4
  %8 = load ptr, ptr %1, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %8, i64 32
  %10 = load ptr, ptr %9, align 8
  tail call void %10(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull @.str.63)
  br label %.backedge

.backedge:                                        ; preds = %7, %11, %15, %19, %23, %27, %31, %35, %39
  br label %4

11:                                               ; preds = %4
  %12 = load ptr, ptr %1, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %12, i64 32
  %14 = load ptr, ptr %13, align 8
  tail call void %14(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull @.str.64)
  br label %.backedge

15:                                               ; preds = %4
  %16 = load ptr, ptr %1, align 8, !tbaa !9
  %17 = getelementptr inbounds i8, ptr %16, i64 32
  %18 = load ptr, ptr %17, align 8
  tail call void %18(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull @.str.65)
  br label %.backedge

19:                                               ; preds = %4
  %20 = load ptr, ptr %1, align 8, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %20, i64 32
  %22 = load ptr, ptr %21, align 8
  tail call void %22(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull @.str.66)
  br label %.backedge

23:                                               ; preds = %4
  %24 = load ptr, ptr %1, align 8, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %24, i64 32
  %26 = load ptr, ptr %25, align 8
  tail call void %26(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull @.str.67)
  br label %.backedge

27:                                               ; preds = %4
  %28 = load ptr, ptr %1, align 8, !tbaa !9
  %29 = getelementptr inbounds i8, ptr %28, i64 32
  %30 = load ptr, ptr %29, align 8
  tail call void %30(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull @.str.68)
  br label %.backedge

31:                                               ; preds = %4
  %32 = load ptr, ptr %1, align 8, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %32, i64 32
  %34 = load ptr, ptr %33, align 8
  tail call void %34(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull @.str.69)
  br label %.backedge

35:                                               ; preds = %4
  %36 = load ptr, ptr %1, align 8, !tbaa !9
  %37 = getelementptr inbounds i8, ptr %36, i64 32
  %38 = load ptr, ptr %37, align 8
  tail call void %38(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull @.str.70)
  br label %.backedge

39:                                               ; preds = %4
  %40 = load ptr, ptr %1, align 8, !tbaa !9
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %42 = load ptr, ptr %41, align 8
  tail call void %42(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef signext %6)
  br label %.backedge

43:                                               ; preds = %4
  ret void
}

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 = !{!"wchar_t", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}


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