; LLVM IR from chensoft/libsocket :: lib/libchen/src/data (json)

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

@__const._ZN4chen4json6decodeEDnRKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_.n = external hidden unnamed_addr constant [5 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

; 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) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEeqERKS5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4chen4json6decodeEDnRKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_(ptr %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [5 x i8], align 1
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 5, ptr %9) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %9, ptr align 1 @__const._ZN4chen4json6decodeEDnRKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_.n, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 4, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %12

12:                                               ; preds = %34, %4
  %13 = load i64, ptr %11, align 8, !tbaa !11
  %14 = icmp ult i64 %13, 4
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %39

16:                                               ; preds = %12
  %17 = load ptr, ptr %7, align 8, !tbaa !9
  %18 = load ptr, ptr %8, align 8, !tbaa !9
  %19 = call noundef zeroext i1 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEeqERKS5_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18)
  br i1 %19, label %29, label %20

20:                                               ; preds = %16
  %21 = load ptr, ptr %7, align 8, !tbaa !9
  %22 = call noundef zeroext i8 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21)
  %23 = zext i8 %22 to i32
  %24 = load i64, ptr %11, align 8, !tbaa !11
  %25 = getelementptr inbounds [5 x i8], ptr %9, i64 0, i64 %24
  %26 = load i8, ptr %25, align 1, !tbaa !13
  %27 = sext i8 %26 to i32
  %28 = icmp ne i32 %23, %27
  br i1 %28, label %29, label %33

29:                                               ; preds = %20, %16
  %30 = load ptr, ptr %6, align 8, !tbaa !9
  %31 = load ptr, ptr %7, align 8, !tbaa !9
  %32 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN4chen4json9exceptionERKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull align 8 dereferenceable(8) %32)
  br label %33

33:                                               ; preds = %29, %20
  br label %34

34:                                               ; preds = %33
  %35 = load i64, ptr %11, align 8, !tbaa !11
  %36 = add i64 %35, 1
  store i64 %36, ptr %11, align 8, !tbaa !11
  %37 = load ptr, ptr %7, align 8, !tbaa !9
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEppEv(ptr noundef nonnull align 8 dereferenceable(8) %37)
  br label %12, !llvm.loop !14

39:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 5, ptr %9) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = !{!"std::nullptr_t", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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"

@__const._ZN4chen4json6decodeEDnRKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_.n = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEeqERKS5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4chen4json6decodeEDnRKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_(ptr nocapture readnone %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) local_unnamed_addr #0 align 2 {
  %5 = tail call noundef zeroext i1 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEeqERKS5_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br i1 %5, label %11, label %6

6:                                                ; preds = %4
  %7 = tail call noundef zeroext i8 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %8 = zext i8 %7 to i32
  %9 = load i8, ptr @__const._ZN4chen4json6decodeEDnRKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_.n, align 1, !tbaa !5
  %10 = sext i8 %9 to i32
  %.not = icmp eq i32 %8, %10
  br i1 %.not, label %12, label %11

11:                                               ; preds = %6, %4
  tail call void @_ZN4chen4json9exceptionERKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br label %12

12:                                               ; preds = %6, %11
  %13 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %14 = tail call noundef zeroext i1 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEeqERKS5_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br i1 %14, label %20, label %15

15:                                               ; preds = %12
  %16 = tail call noundef zeroext i8 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %17 = zext i8 %16 to i32
  %18 = load i8, ptr getelementptr inbounds (i8, ptr @__const._ZN4chen4json6decodeEDnRKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_.n, i64 1), align 1, !tbaa !5
  %19 = sext i8 %18 to i32
  %.not.1 = icmp eq i32 %17, %19
  br i1 %.not.1, label %21, label %20

20:                                               ; preds = %15, %12
  tail call void @_ZN4chen4json9exceptionERKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br label %21

21:                                               ; preds = %20, %15
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %23 = tail call noundef zeroext i1 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEeqERKS5_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br i1 %23, label %29, label %24

24:                                               ; preds = %21
  %25 = tail call noundef zeroext i8 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %26 = zext i8 %25 to i32
  %27 = load i8, ptr getelementptr inbounds (i8, ptr @__const._ZN4chen4json6decodeEDnRKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_.n, i64 2), align 1, !tbaa !5
  %28 = sext i8 %27 to i32
  %.not.2 = icmp eq i32 %26, %28
  br i1 %.not.2, label %30, label %29

29:                                               ; preds = %24, %21
  tail call void @_ZN4chen4json9exceptionERKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br label %30

30:                                               ; preds = %29, %24
  %31 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %32 = tail call noundef zeroext i1 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEeqERKS5_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br i1 %32, label %38, label %33

33:                                               ; preds = %30
  %34 = tail call noundef zeroext i8 @_ZNK4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %35 = zext i8 %34 to i32
  %36 = load i8, ptr getelementptr inbounds (i8, ptr @__const._ZN4chen4json6decodeEDnRKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_.n, i64 3), align 1, !tbaa !5
  %37 = sext i8 %36 to i32
  %.not.3 = icmp eq i32 %35, %37
  br i1 %.not.3, label %39, label %38

38:                                               ; preds = %33, %30
  tail call void @_ZN4chen4json9exceptionERKNS_8iterator7erasureISt18input_iterator_tagKhS4_PS4_lEERS6_S9_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br label %39

39:                                               ; preds = %38, %33
  %40 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4chen8iterator7erasureISt18input_iterator_tagKhS3_PS3_lEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass