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

; 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 @_ZN2vl7parsing4json18JsonUnescapeStringERKNS_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
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = 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) #3
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = call noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48) %13)
  store ptr %14, ptr %5, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %124, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds i32, ptr %16, i32 1
  store ptr %17, ptr %5, align 8, !tbaa !5
  %18 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %18, ptr %6, align 4, !tbaa !9
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %22, label %21

21:                                               ; preds = %15
  store i32 3, ptr %7, align 4
  br label %122

22:                                               ; preds = %15
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = icmp eq i32 %23, 92
  br i1 %24, label %25, label %115

25:                                               ; preds = %22
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %115

29:                                               ; preds = %25
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds i32, ptr %30, i32 1
  store ptr %31, ptr %5, align 8, !tbaa !5
  %32 = load i32, ptr %30, align 4, !tbaa !9
  store i32 %32, ptr %6, align 4, !tbaa !9
  switch i32 %32, label %108 [
    i32 98, label %33
    i32 102, label %38
    i32 110, label %43
    i32 114, label %48
    i32 116, label %53
    i32 117, label %58
  ]

33:                                               ; preds = %29
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = getelementptr inbounds ptr, ptr %35, i64 2
  %37 = load ptr, ptr %36, align 8
  call void %37(ptr noundef nonnull align 8 dereferenceable(8) %34, i32 noundef signext 8)
  br label %114

38:                                               ; preds = %29
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  %41 = getelementptr inbounds ptr, ptr %40, i64 2
  %42 = load ptr, ptr %41, align 8
  call void %42(ptr noundef nonnull align 8 dereferenceable(8) %39, i32 noundef signext 12)
  br label %114

43:                                               ; preds = %29
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = load ptr, ptr %44, align 8, !tbaa !11
  %46 = getelementptr inbounds ptr, ptr %45, i64 2
  %47 = load ptr, ptr %46, align 8
  call void %47(ptr noundef nonnull align 8 dereferenceable(8) %44, i32 noundef signext 10)
  br label %114

48:                                               ; preds = %29
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load ptr, ptr %49, align 8, !tbaa !11
  %51 = getelementptr inbounds ptr, ptr %50, i64 2
  %52 = load ptr, ptr %51, align 8
  call void %52(ptr noundef nonnull align 8 dereferenceable(8) %49, i32 noundef signext 13)
  br label %114

53:                                               ; preds = %29
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load ptr, ptr %54, align 8, !tbaa !11
  %56 = getelementptr inbounds ptr, ptr %55, i64 2
  %57 = load ptr, ptr %56, align 8
  call void %57(ptr noundef nonnull align 8 dereferenceable(8) %54, i32 noundef signext 9)
  br label %114

58:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds i32, ptr %59, i64 0
  %61 = load i32, ptr %60, align 4, !tbaa !9
  store i32 %61, ptr %8, align 4, !tbaa !9
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %107

63:                                               ; preds = %58
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds i32, ptr %64, i64 1
  %66 = load i32, ptr %65, align 4, !tbaa !9
  store i32 %66, ptr %9, align 4, !tbaa !9
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %107

68:                                               ; preds = %63
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds i32, ptr %69, i64 2
  %71 = load i32, ptr %70, align 4, !tbaa !9
  store i32 %71, ptr %10, align 4, !tbaa !9
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %107

73:                                               ; preds = %68
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds i32, ptr %74, i64 3
  %76 = load i32, ptr %75, align 4, !tbaa !9
  store i32 %76, ptr %11, align 4, !tbaa !9
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %107

78:                                               ; preds = %73
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds i32, ptr %79, i64 4
  store ptr %80, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %81 = load i32, ptr %8, align 4, !tbaa !9
  %82 = call noundef zeroext i16 @_ZN2vl7parsing4json6GetHexEw(i32 noundef signext %81)
  %83 = zext i16 %82 to i32
  %84 = shl i32 %83, 12
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = call noundef zeroext i16 @_ZN2vl7parsing4json6GetHexEw(i32 noundef signext %85)
  %87 = zext i16 %86 to i32
  %88 = shl i32 %87, 8
  %89 = add nsw i32 %84, %88
  %90 = load i32, ptr %10, align 4, !tbaa !9
  %91 = call noundef zeroext i16 @_ZN2vl7parsing4json6GetHexEw(i32 noundef signext %90)
  %92 = zext i16 %91 to i32
  %93 = shl i32 %92, 4
  %94 = add nsw i32 %89, %93
  %95 = load i32, ptr %11, align 4, !tbaa !9
  %96 = call noundef zeroext i16 @_ZN2vl7parsing4json6GetHexEw(i32 noundef signext %95)
  %97 = zext i16 %96 to i32
  %98 = shl i32 %97, 0
  %99 = add nsw i32 %94, %98
  %100 = trunc i32 %99 to i16
  %101 = zext i16 %100 to i32
  store i32 %101, ptr %12, align 4, !tbaa !9
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = load i32, ptr %12, align 4, !tbaa !9
  %104 = load ptr, ptr %102, align 8, !tbaa !11
  %105 = getelementptr inbounds ptr, ptr %104, i64 2
  %106 = load ptr, ptr %105, align 8
  call void %106(ptr noundef nonnull align 8 dereferenceable(8) %102, i32 noundef signext %103)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %107

107:                                              ; preds = %78, %73, %68, %63, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %114

108:                                              ; preds = %29
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = load i32, ptr %6, align 4, !tbaa !9
  %111 = load ptr, ptr %109, align 8, !tbaa !11
  %112 = getelementptr inbounds ptr, ptr %111, i64 2
  %113 = load ptr, ptr %112, align 8
  call void %113(ptr noundef nonnull align 8 dereferenceable(8) %109, i32 noundef signext %110)
  br label %114

114:                                              ; preds = %108, %107, %53, %48, %43, %38, %33
  br label %121

115:                                              ; preds = %25, %22
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = load i32, ptr %6, align 4, !tbaa !9
  %118 = load ptr, ptr %116, align 8, !tbaa !11
  %119 = getelementptr inbounds ptr, ptr %118, i64 2
  %120 = load ptr, ptr %119, align 8
  call void %120(ptr noundef nonnull align 8 dereferenceable(8) %116, i32 noundef signext %117)
  br label %121

121:                                              ; preds = %115, %114
  store i32 0, ptr %7, align 4
  br label %122

122:                                              ; preds = %121, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %123 = load i32, ptr %7, align 4
  switch i32 %123, label %126 [
    i32 0, label %124
    i32 3, label %125
  ]

124:                                              ; preds = %122
  br label %15, !llvm.loop !13

125:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void

126:                                              ; preds = %122
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i16 @_ZN2vl7parsing4json6GetHexEw(i32 noundef signext) #2

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 = { mustprogress 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 = !{!"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"

; 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 @_ZN2vl7parsing4json18JsonUnescapeStringERKNS_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
  %.0 = phi ptr [ %3, %2 ], [ %.0.be, %.backedge ]
  %5 = getelementptr inbounds i8, ptr %.0, i64 4
  %6 = load i32, ptr %.0, align 4, !tbaa !5
  switch i32 %6, label %.sink.split [
    i32 0, label %43
    i32 92, label %7
  ]

7:                                                ; preds = %4
  %8 = load i32, ptr %5, align 4, !tbaa !5
  %.not33 = icmp eq i32 %8, 0
  br i1 %.not33, label %.sink.split, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %.0, i64 8
  switch i32 %8, label %39 [
    i32 98, label %.sink.split
    i32 102, label %11
    i32 110, label %12
    i32 114, label %13
    i32 116, label %14
    i32 117, label %15
  ]

11:                                               ; preds = %9
  br label %.sink.split

12:                                               ; preds = %9
  br label %.sink.split

13:                                               ; preds = %9
  br label %.sink.split

14:                                               ; preds = %9
  br label %.sink.split

15:                                               ; preds = %9
  %16 = load i32, ptr %10, align 4, !tbaa !5
  %.not34 = icmp eq i32 %16, 0
  br i1 %.not34, label %.backedge, label %17

17:                                               ; preds = %15
  %18 = getelementptr inbounds i8, ptr %.0, i64 12
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %.not35 = icmp eq i32 %19, 0
  br i1 %.not35, label %.backedge, label %20

20:                                               ; preds = %17
  %21 = getelementptr inbounds i8, ptr %.0, i64 16
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %.not36 = icmp eq i32 %22, 0
  br i1 %.not36, label %.backedge, label %23

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %.0, i64 20
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %.not37 = icmp eq i32 %25, 0
  br i1 %.not37, label %.backedge, label %26

26:                                               ; preds = %23
  %27 = getelementptr inbounds i8, ptr %.0, i64 24
  %28 = tail call noundef zeroext i16 @_ZN2vl7parsing4json6GetHexEw(i32 noundef signext %16)
  %29 = shl i16 %28, 12
  %30 = tail call noundef zeroext i16 @_ZN2vl7parsing4json6GetHexEw(i32 noundef signext %19)
  %31 = shl i16 %30, 8
  %32 = add i16 %31, %29
  %33 = tail call noundef zeroext i16 @_ZN2vl7parsing4json6GetHexEw(i32 noundef signext %22)
  %34 = shl i16 %33, 4
  %35 = add i16 %32, %34
  %36 = tail call noundef zeroext i16 @_ZN2vl7parsing4json6GetHexEw(i32 noundef signext %25)
  %37 = add i16 %35, %36
  %38 = zext i16 %37 to i32
  br label %.sink.split

39:                                               ; preds = %9
  br label %.sink.split

.sink.split:                                      ; preds = %7, %4, %9, %26, %11, %12, %13, %14, %39
  %.sink = phi i32 [ %8, %39 ], [ 9, %14 ], [ 13, %13 ], [ 10, %12 ], [ 12, %11 ], [ %38, %26 ], [ 8, %9 ], [ %6, %4 ], [ %6, %7 ]
  %.3.ph = phi ptr [ %10, %39 ], [ %10, %14 ], [ %10, %13 ], [ %10, %12 ], [ %10, %11 ], [ %27, %26 ], [ %10, %9 ], [ %5, %4 ], [ %5, %7 ]
  %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 %.sink)
  br label %.backedge

.backedge:                                        ; preds = %.sink.split, %23, %20, %17, %15
  %.0.be = phi ptr [ %10, %23 ], [ %10, %20 ], [ %10, %17 ], [ %10, %15 ], [ %.3.ph, %.sink.split ]
  br label %4

43:                                               ; preds = %4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i16 @_ZN2vl7parsing4json6GetHexEw(i32 noundef signext) local_unnamed_addr #1

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" }
attributes #1 = { mustprogress 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" }

!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,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass