; LLVM IR from BitFunnel/NativeJIT :: test/CodeGen/ML64Verifier.ll (ZN9NativeJIT12ML64Verifier17AdvanceToNextLineEv)

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

%"class.NativeJIT::ML64Verifier" = type { ptr, i32, ptr, i32, ptr, %"class.std::__cxx11::basic_stringstream" }
%"class.std::__cxx11::basic_stringstream" = type { %"class.std::basic_iostream.base", %"class.std::__cxx11::basic_stringbuf", %"class.std::basic_ios" }
%"class.std::basic_iostream.base" = type { %"class.std::basic_istream.base", %"class.std::basic_ostream.base" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9NativeJIT12ML64Verifier17AdvanceToNextLineEv(ptr noundef nonnull align 8 dereferenceable(432) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  br label %4

4:                                                ; preds = %18, %1
  %5 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  %6 = sext i8 %5 to i32
  %7 = icmp ne i32 %6, 0
  br i1 %7, label %8, label %16

8:                                                ; preds = %4
  %9 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  %10 = sext i8 %9 to i32
  %11 = icmp ne i32 %10, 10
  br i1 %11, label %12, label %16

12:                                               ; preds = %8
  %13 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  %14 = sext i8 %13 to i32
  %15 = icmp ne i32 %14, 13
  br label %16

16:                                               ; preds = %12, %8, %4
  %17 = phi i1 [ false, %8 ], [ false, %4 ], [ %15, %12 ]
  br i1 %17, label %18, label %20

18:                                               ; preds = %16
  %19 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  br label %4, !llvm.loop !9

20:                                               ; preds = %16
  %21 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  %22 = sext i8 %21 to i32
  %23 = icmp eq i32 %22, 10
  br i1 %23, label %24, label %32

24:                                               ; preds = %20
  %25 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  %26 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  %27 = sext i8 %26 to i32
  %28 = icmp eq i32 %27, 13
  br i1 %28, label %29, label %31

29:                                               ; preds = %24
  %30 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  br label %31

31:                                               ; preds = %29, %24
  br label %45

32:                                               ; preds = %20
  %33 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  %34 = sext i8 %33 to i32
  %35 = icmp eq i32 %34, 13
  br i1 %35, label %36, label %44

36:                                               ; preds = %32
  %37 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  %38 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  %39 = sext i8 %38 to i32
  %40 = icmp eq i32 %39, 10
  br i1 %40, label %41, label %43

41:                                               ; preds = %36
  %42 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432) %3)
  br label %43

43:                                               ; preds = %41, %36
  br label %44

44:                                               ; preds = %43, %32
  br label %45

45:                                               ; preds = %44, %31
  %46 = getelementptr inbounds %"class.NativeJIT::ML64Verifier", ptr %3, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !11
  %48 = getelementptr inbounds %"class.NativeJIT::ML64Verifier", ptr %3, i32 0, i32 2
  store ptr %47, ptr %48, align 8, !tbaa !25
  %49 = getelementptr inbounds %"class.NativeJIT::ML64Verifier", ptr %3, i32 0, i32 1
  %50 = load i32, ptr %49, align 8, !tbaa !26
  %51 = add i32 %50, 1
  store i32 %51, ptr %49, align 8, !tbaa !26
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432)) #0 align 2

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

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN9NativeJIT12ML64VerifierE", !6, i64 0, !13, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !14, i64 40}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE", !15, i64 0, !19, i64 24}
!15 = !{!"_ZTSSd", !16, i64 0, !18, i64 16}
!16 = !{!"_ZTSSi", !17, i64 8}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSSo"}
!19 = !{!"_ZTSNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE", !20, i64 0, !22, i64 64, !23, i64 72}
!20 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !21, i64 56}
!21 = !{!"_ZTSSt6locale", !6, i64 0}
!22 = !{!"_ZTSSt13_Ios_Openmode", !7, i64 0}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !24, i64 0, !17, i64 8, !7, i64 16}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!25 = !{!12, !6, i64 16}
!26 = !{!12, !13, i64 8}


; 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
declare dso_local noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN9NativeJIT12ML64Verifier17AdvanceToNextLineEv(ptr noundef nonnull align 8 dereferenceable(432) %0) local_unnamed_addr #0 align 2 {
  %2 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %.not3 = icmp eq i8 %2, 0
  br i1 %.not3, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %6
  %3 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %.not1 = icmp eq i8 %3, 10
  br i1 %.not1, label %.critedge, label %4

4:                                                ; preds = %.lr.ph
  %5 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %.not2 = icmp eq i8 %5, 13
  br i1 %.not2, label %.critedge, label %6

6:                                                ; preds = %4
  %7 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %8 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %.not = icmp eq i8 %8, 0
  br i1 %.not, label %.critedge, label %.lr.ph, !llvm.loop !5

.critedge:                                        ; preds = %4, %6, %.lr.ph, %1
  %9 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %10 = icmp eq i8 %9, 10
  br i1 %10, label %11, label %15

11:                                               ; preds = %.critedge
  %12 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %13 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %14 = icmp eq i8 %13, 13
  br i1 %14, label %.sink.split, label %23

15:                                               ; preds = %.critedge
  %16 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %17 = icmp eq i8 %16, 13
  br i1 %17, label %18, label %23

18:                                               ; preds = %15
  %19 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %20 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %21 = icmp eq i8 %20, 10
  br i1 %21, label %.sink.split, label %23

.sink.split:                                      ; preds = %18, %11
  %22 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  br label %23

23:                                               ; preds = %.sink.split, %15, %18, %11
  %24 = load ptr, ptr %0, align 8, !tbaa !7
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %24, ptr %25, align 8, !tbaa !24
  %26 = getelementptr inbounds i8, ptr %0, i64 8
  %27 = load i32, ptr %26, align 8, !tbaa !25
  %28 = add i32 %27, 1
  store i32 %28, ptr %26, align 8, !tbaa !25
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZN9NativeJIT12ML64Verifier7GetCharEv(ptr noundef nonnull align 8 dereferenceable(432)) local_unnamed_addr #0 align 2

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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !9, i64 0}
!8 = !{!"_ZTSN9NativeJIT12ML64VerifierE", !9, i64 0, !12, i64 8, !9, i64 16, !12, i64 24, !9, i64 32, !13, i64 40}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"_ZTSNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE", !14, i64 0, !18, i64 24}
!14 = !{!"_ZTSSd", !15, i64 0, !17, i64 16}
!15 = !{!"_ZTSSi", !16, i64 8}
!16 = !{!"long", !10, i64 0}
!17 = !{!"_ZTSSo"}
!18 = !{!"_ZTSNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE", !19, i64 0, !21, i64 64, !22, i64 72}
!19 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !9, i64 8, !9, i64 16, !9, i64 24, !9, i64 32, !9, i64 40, !9, i64 48, !20, i64 56}
!20 = !{!"_ZTSSt6locale", !9, i64 0}
!21 = !{!"_ZTSSt13_Ios_Openmode", !10, i64 0}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !16, i64 8, !10, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !9, i64 0}
!24 = !{!8, !9, i64 16}
!25 = !{!8, !12, i64 8}


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