; LLVM IR from WayneLin92/SSeqCpp :: thirdparty/fmt/test (scan-test)

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

%"struct.fmt::v10::format_specs" = type <{ i32, i32, i8, i16, %"struct.fmt::v10::detail::fill_t" }>
%"struct.fmt::v10::detail::fill_t" = type { [4 x i8], i8 }

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN3fmt3v106detail16parse_scan_specsEPKcS3_RNS0_12format_specsIcEENS1_9scan_typeE(ptr noundef %0, ptr noundef %1, ptr noundef nonnull align 4 dereferenceable(16) %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %26, %4
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = icmp ne ptr %11, %12
  br i1 %13, label %14, label %27

14:                                               ; preds = %10
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = load i8, ptr %15, align 1, !tbaa !11
  %17 = call noundef signext i8 @_ZN3fmt3v106detail8to_asciiIcTnNSt9enable_ifIXsr3std11is_integralIT_EE5valueEiE4typeELi0EEEcS4_(i8 noundef signext %16)
  %18 = sext i8 %17 to i32
  switch i32 %18, label %26 [
    i32 120, label %19
    i32 125, label %24
  ]

19:                                               ; preds = %14
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.fmt::v10::format_specs", ptr %20, i32 0, i32 2
  store i8 3, ptr %21, align 4, !tbaa !12
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i32 1
  store ptr %23, ptr %6, align 8, !tbaa !5
  br label %26

24:                                               ; preds = %14
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %25, ptr %5, align 8
  br label %29

26:                                               ; preds = %19, %14
  br label %10, !llvm.loop !20

27:                                               ; preds = %10
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %28, ptr %5, align 8
  br label %29

29:                                               ; preds = %27, %24
  %30 = load ptr, ptr %5, align 8
  ret ptr %30
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZN3fmt3v106detail8to_asciiIcTnNSt9enable_ifIXsr3std11is_integralIT_EE5valueEiE4typeELi0EEEcS4_(i8 noundef signext) #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_ZTSN3fmt3v106detail9scan_typeE", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !15, i64 8}
!13 = !{!"_ZTSN3fmt3v1012format_specsIcEE", !14, i64 0, !14, i64 4, !15, i64 8, !16, i64 9, !17, i64 9, !18, i64 9, !18, i64 10, !19, i64 11}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN3fmt3v1017presentation_typeE", !7, i64 0}
!16 = !{!"_ZTSN3fmt3v105align4typeE", !7, i64 0}
!17 = !{!"_ZTSN3fmt3v104sign4typeE", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTSN3fmt3v106detail6fill_tIcEE", !7, i64 0, !7, i64 4}
!20 = distinct !{!20, !21}
!21 = !{!"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 nounwind uwtable
define dso_local noundef ptr @_ZN3fmt3v106detail16parse_scan_specsEPKcS3_RNS0_12format_specsIcEENS1_9scan_typeE(ptr noundef readonly %0, ptr noundef readnone %1, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(16) %2, i32 noundef %3) local_unnamed_addr #0 {
  %.not9 = icmp eq ptr %0, %1
  br i1 %.not9, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %4
  %5 = getelementptr inbounds i8, ptr %2, i64 8
  br label %6

6:                                                ; preds = %.lr.ph, %11
  %.0810 = phi ptr [ %0, %.lr.ph ], [ %.1, %11 ]
  %7 = load i8, ptr %.0810, align 1, !tbaa !5
  %8 = tail call noundef signext i8 @_ZN3fmt3v106detail8to_asciiIcTnNSt9enable_ifIXsr3std11is_integralIT_EE5valueEiE4typeELi0EEEcS4_(i8 noundef signext %7)
  switch i8 %8, label %11 [
    i8 120, label %9
    i8 125, label %._crit_edge
  ]

9:                                                ; preds = %6
  store i8 3, ptr %5, align 4, !tbaa !8
  %10 = getelementptr inbounds i8, ptr %.0810, i64 1
  br label %11

11:                                               ; preds = %9, %6
  %.1 = phi ptr [ %.0810, %6 ], [ %10, %9 ]
  %.not = icmp eq ptr %.1, %1
  br i1 %.not, label %._crit_edge, label %6, !llvm.loop !16

._crit_edge:                                      ; preds = %6, %11, %4
  %.08.lcssa = phi ptr [ %0, %4 ], [ %.1, %11 ], [ %.0810, %6 ]
  ret ptr %.08.lcssa
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZN3fmt3v106detail8to_asciiIcTnNSt9enable_ifIXsr3std11is_integralIT_EE5valueEiE4typeELi0EEEcS4_(i8 noundef signext) local_unnamed_addr #0

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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !11, i64 8}
!9 = !{!"_ZTSN3fmt3v1012format_specsIcEE", !10, i64 0, !10, i64 4, !11, i64 8, !12, i64 9, !13, i64 9, !14, i64 9, !14, i64 10, !15, i64 11}
!10 = !{!"int", !6, i64 0}
!11 = !{!"_ZTSN3fmt3v1017presentation_typeE", !6, i64 0}
!12 = !{!"_ZTSN3fmt3v105align4typeE", !6, i64 0}
!13 = !{!"_ZTSN3fmt3v104sign4typeE", !6, i64 0}
!14 = !{!"bool", !6, i64 0}
!15 = !{!"_ZTSN3fmt3v106detail6fill_tIcEE", !6, i64 0, !6, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass