; LLVM IR from stan-dev/math :: lib/boost_1.84.0/libs/serialization/src (codecvt_null)

; 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: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZNK5boost7archive12codecvt_nullIwE6do_outER11__mbstate_tPKwS6_RS6_PcS8_RS8_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef %2, ptr noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5, ptr noundef %6, ptr noundef nonnull align 8 dereferenceable(8) %7) unnamed_addr #0 align 2 {
  %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
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store ptr %3, ptr %13, align 8, !tbaa !5
  store ptr %4, ptr %14, align 8, !tbaa !5
  store ptr %5, ptr %15, align 8, !tbaa !5
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  %18 = load ptr, ptr %10, align 8
  br label %19

19:                                               ; preds = %35, %8
  %20 = load ptr, ptr %12, align 8, !tbaa !5
  %21 = load ptr, ptr %13, align 8, !tbaa !5
  %22 = icmp ne ptr %20, %21
  br i1 %22, label %23, label %42

23:                                               ; preds = %19
  %24 = load ptr, ptr %16, align 8, !tbaa !5
  %25 = load ptr, ptr %15, align 8, !tbaa !5
  %26 = ptrtoint ptr %24 to i64
  %27 = ptrtoint ptr %25 to i64
  %28 = sub i64 %26, %27
  %29 = icmp sgt i64 4, %28
  br i1 %29, label %30, label %35

30:                                               ; preds = %23
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %31, ptr %32, align 8, !tbaa !5
  %33 = load ptr, ptr %15, align 8, !tbaa !5
  %34 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %33, ptr %34, align 8, !tbaa !5
  store i32 1, ptr %9, align 4
  br label %47

35:                                               ; preds = %23
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  %37 = getelementptr inbounds i32, ptr %36, i32 1
  store ptr %37, ptr %12, align 8, !tbaa !5
  %38 = load i32, ptr %36, align 4, !tbaa !9
  %39 = load ptr, ptr %15, align 8, !tbaa !5
  store i32 %38, ptr %39, align 4, !tbaa !9
  %40 = load ptr, ptr %15, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 4
  store ptr %41, ptr %15, align 8, !tbaa !5
  br label %19, !llvm.loop !11

42:                                               ; preds = %19
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %43, ptr %44, align 8, !tbaa !5
  %45 = load ptr, ptr %15, align 8, !tbaa !5
  %46 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %45, ptr %46, align 8, !tbaa !5
  store i32 0, ptr %9, align 4
  br label %47

47:                                               ; preds = %42, %30
  %48 = load i32, ptr %9, align 4
  ret i32 %48
}

attributes #0 = { 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 = !{!"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 = distinct !{!11, !12}
!12 = !{!"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 nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZNK5boost7archive12codecvt_nullIwE6do_outER11__mbstate_tPKwS6_RS6_PcS8_RS8_(ptr nocapture noundef nonnull readnone align 8 dereferenceable(24) %0, ptr nocapture noundef nonnull readnone align 4 dereferenceable(8) %1, ptr noundef %2, ptr noundef readnone %3, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(8) %4, ptr noundef %5, ptr noundef %6, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(8) %7) unnamed_addr #0 align 2 {
  %9 = ptrtoint ptr %6 to i64
  %.not18 = icmp eq ptr %2, %3
  br i1 %.not18, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %8, %13
  %.01620 = phi ptr [ %14, %13 ], [ %2, %8 ]
  %.01719 = phi ptr [ %16, %13 ], [ %5, %8 ]
  %10 = ptrtoint ptr %.01719 to i64
  %11 = sub i64 %9, %10
  %12 = icmp slt i64 %11, 4
  br i1 %12, label %._crit_edge, label %13

13:                                               ; preds = %.lr.ph
  %14 = getelementptr inbounds i8, ptr %.01620, i64 4
  %15 = load i32, ptr %.01620, align 4, !tbaa !5
  store i32 %15, ptr %.01719, align 4, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %.01719, i64 4
  %.not = icmp eq ptr %14, %3
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %13, %8
  %.017.lcssa = phi ptr [ %5, %8 ], [ %16, %13 ], [ %.01719, %.lr.ph ]
  %.016.lcssa = phi ptr [ %2, %8 ], [ %14, %13 ], [ %.01620, %.lr.ph ]
  %.0 = phi i32 [ 0, %8 ], [ 0, %13 ], [ 1, %.lr.ph ]
  store ptr %.016.lcssa, ptr %4, align 8, !tbaa !11
  store ptr %.017.lcssa, ptr %7, align 8, !tbaa !11
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


; Effective O3 passes: IPSCCPPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass