; LLVM IR from MikeMirzayanov/testlib :: checkers/acmp.ll (ZN8InStream4eolnEv)

; 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.InStream = type { ptr, i32, %"class.std::__cxx11::basic_string", i32, i8, i8, i8, i32, %"class.std::__cxx11::basic_string", i32, i64, i64, i64 }
%"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] }

; 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
define dso_local noundef zeroext i1 @_ZN8InStream4eolnEv(ptr noundef nonnull align 8 dereferenceable(128) %0) #1 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = getelementptr inbounds %struct.InStream, ptr %7, i32 0, i32 6
  %9 = load i8, ptr %8, align 2, !tbaa !9, !range !17, !noundef !18
  %10 = trunc i8 %9 to i1
  br i1 %10, label %16, label %11

11:                                               ; preds = %1
  %12 = getelementptr inbounds %struct.InStream, ptr %7, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !19
  %14 = icmp eq ptr null, %13
  br i1 %14, label %15, label %16

15:                                               ; preds = %11
  store i1 true, ptr %2, align 1
  br label %88

16:                                               ; preds = %11, %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  %17 = getelementptr inbounds %struct.InStream, ptr %7, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !19
  %19 = load ptr, ptr %18, align 8, !tbaa !20
  %20 = getelementptr inbounds ptr, ptr %19, i64 3
  %21 = load ptr, ptr %20, align 8
  %22 = call noundef i32 %21(ptr noundef nonnull align 8 dereferenceable(8) %18)
  store i32 %22, ptr %4, align 4, !tbaa !22
  %23 = getelementptr inbounds %struct.InStream, ptr %7, i32 0, i32 6
  %24 = load i8, ptr %23, align 2, !tbaa !9, !range !17, !noundef !18
  %25 = trunc i8 %24 to i1
  br i1 %25, label %66, label %26

26:                                               ; preds = %16
  %27 = load i32, ptr %4, align 4, !tbaa !22
  %28 = icmp eq i32 %27, 255
  br i1 %28, label %29, label %30

29:                                               ; preds = %26
  store i1 true, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %87

30:                                               ; preds = %26
  %31 = load i32, ptr %4, align 4, !tbaa !22
  %32 = icmp eq i32 %31, 13
  br i1 %32, label %33, label %55

33:                                               ; preds = %30
  %34 = getelementptr inbounds %struct.InStream, ptr %7, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !19
  %36 = load ptr, ptr %35, align 8, !tbaa !20
  %37 = getelementptr inbounds ptr, ptr %36, i64 3
  %38 = load ptr, ptr %37, align 8
  %39 = call noundef i32 %38(ptr noundef nonnull align 8 dereferenceable(8) %35)
  store i32 %39, ptr %4, align 4, !tbaa !22
  %40 = load i32, ptr %4, align 4, !tbaa !22
  %41 = icmp ne i32 %40, 10
  br i1 %41, label %42, label %54

42:                                               ; preds = %33
  %43 = getelementptr inbounds %struct.InStream, ptr %7, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !19
  %45 = load i32, ptr %4, align 4, !tbaa !22
  %46 = load ptr, ptr %44, align 8, !tbaa !20
  %47 = getelementptr inbounds ptr, ptr %46, i64 5
  %48 = load ptr, ptr %47, align 8
  call void %48(ptr noundef nonnull align 8 dereferenceable(8) %44, i32 noundef %45)
  %49 = getelementptr inbounds %struct.InStream, ptr %7, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !19
  %51 = load ptr, ptr %50, align 8, !tbaa !20
  %52 = getelementptr inbounds ptr, ptr %51, i64 5
  %53 = load ptr, ptr %52, align 8
  call void %53(ptr noundef nonnull align 8 dereferenceable(8) %50, i32 noundef 13)
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %87

54:                                               ; preds = %33
  store i1 true, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %87

55:                                               ; preds = %30
  %56 = load i32, ptr %4, align 4, !tbaa !22
  %57 = icmp eq i32 %56, 10
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  store i1 true, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %87

59:                                               ; preds = %55
  %60 = getelementptr inbounds %struct.InStream, ptr %7, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !19
  %62 = load i32, ptr %4, align 4, !tbaa !22
  %63 = load ptr, ptr %61, align 8, !tbaa !20
  %64 = getelementptr inbounds ptr, ptr %63, i64 5
  %65 = load ptr, ptr %64, align 8
  call void %65(ptr noundef nonnull align 8 dereferenceable(8) %61, i32 noundef %62)
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %87

66:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #2
  store i8 0, ptr %6, align 1, !tbaa !23
  %67 = load i32, ptr %4, align 4, !tbaa !22
  %68 = icmp ne i32 %67, 10
  br i1 %68, label %69, label %85

69:                                               ; preds = %66
  %70 = getelementptr inbounds %struct.InStream, ptr %7, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !19
  %72 = load i32, ptr %4, align 4, !tbaa !22
  %73 = load ptr, ptr %71, align 8, !tbaa !20
  %74 = getelementptr inbounds ptr, ptr %73, i64 5
  %75 = load ptr, ptr %74, align 8
  call void %75(ptr noundef nonnull align 8 dereferenceable(8) %71, i32 noundef %72)
  %76 = load i8, ptr %6, align 1, !tbaa !23, !range !17, !noundef !18
  %77 = trunc i8 %76 to i1
  br i1 %77, label %78, label %84

78:                                               ; preds = %69
  %79 = getelementptr inbounds %struct.InStream, ptr %7, i32 0, i32 0
  %80 = load ptr, ptr %79, align 8, !tbaa !19
  %81 = load ptr, ptr %80, align 8, !tbaa !20
  %82 = getelementptr inbounds ptr, ptr %81, i64 5
  %83 = load ptr, ptr %82, align 8
  call void %83(ptr noundef nonnull align 8 dereferenceable(8) %80, i32 noundef 13)
  br label %84

84:                                               ; preds = %78, %69
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %86

85:                                               ; preds = %66
  store i1 true, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %86

86:                                               ; preds = %85, %84
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #2
  br label %87

87:                                               ; preds = %86, %59, %58, %54, %42, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  br label %88

88:                                               ; preds = %87, %15
  %89 = load i1, ptr %2, align 1
  ret i1 %89
}

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 = { 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, !16, i64 54}
!10 = !{!"_ZTS8InStream", !6, i64 0, !11, i64 8, !12, i64 16, !15, i64 48, !16, i64 52, !16, i64 53, !16, i64 54, !11, i64 56, !12, i64 64, !11, i64 96, !14, i64 104, !14, i64 112, !14, i64 120}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTS5TMode", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!10, !6, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"vtable pointer", !8, i64 0}
!22 = !{!11, !11, i64 0}
!23 = !{!16, !16, i64 0}


; 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
define dso_local noundef zeroext i1 @_ZN8InStream4eolnEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(128) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 54
  %3 = load i8, ptr %2, align 2, !tbaa !5, !range !16, !noundef !17
  %4 = trunc nuw i8 %3 to i1
  %5 = load ptr, ptr %0, align 8
  %6 = icmp ne ptr %5, null
  %or.cond.not = select i1 %4, i1 true, i1 %6
  br i1 %or.cond.not, label %7, label %31

7:                                                ; preds = %1
  %8 = load ptr, ptr %5, align 8, !tbaa !18
  %9 = getelementptr inbounds i8, ptr %8, i64 24
  %10 = load ptr, ptr %9, align 8
  %11 = tail call noundef i32 %10(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %12 = load i8, ptr %2, align 2, !tbaa !5, !range !16, !noundef !17
  %13 = trunc nuw i8 %12 to i1
  br i1 %13, label %26, label %14

14:                                               ; preds = %7
  switch i32 %11, label %.sink.split [
    i32 255, label %31
    i32 13, label %15
    i32 10, label %31
  ]

15:                                               ; preds = %14
  %16 = load ptr, ptr %0, align 8, !tbaa !20
  %17 = load ptr, ptr %16, align 8, !tbaa !18
  %18 = getelementptr inbounds i8, ptr %17, i64 24
  %19 = load ptr, ptr %18, align 8
  %20 = tail call noundef i32 %19(ptr noundef nonnull align 8 dereferenceable(8) %16)
  %.not = icmp eq i32 %20, 10
  br i1 %.not, label %31, label %21

21:                                               ; preds = %15
  %22 = load ptr, ptr %0, align 8, !tbaa !20
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  %24 = getelementptr inbounds i8, ptr %23, i64 40
  %25 = load ptr, ptr %24, align 8
  tail call void %25(ptr noundef nonnull align 8 dereferenceable(8) %22, i32 noundef %20)
  br label %.sink.split

26:                                               ; preds = %7
  %.not13 = icmp eq i32 %11, 10
  br i1 %.not13, label %31, label %.sink.split

.sink.split:                                      ; preds = %26, %14, %21
  %.sink17 = phi i32 [ 13, %21 ], [ %11, %14 ], [ %11, %26 ]
  %27 = load ptr, ptr %0, align 8, !tbaa !20
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  %29 = getelementptr inbounds i8, ptr %28, i64 40
  %30 = load ptr, ptr %29, align 8
  tail call void %30(ptr noundef nonnull align 8 dereferenceable(8) %27, i32 noundef %.sink17)
  br label %31

31:                                               ; preds = %.sink.split, %15, %14, %14, %26, %1
  %.2 = phi i1 [ true, %1 ], [ true, %14 ], [ true, %15 ], [ true, %14 ], [ true, %26 ], [ false, %.sink.split ]
  ret i1 %.2
}

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, !15, i64 54}
!6 = !{!"_ZTS8InStream", !7, i64 0, !10, i64 8, !11, i64 16, !14, i64 48, !15, i64 52, !15, i64 53, !15, i64 54, !10, i64 56, !11, i64 64, !10, i64 96, !13, i64 104, !13, i64 112, !13, i64 120}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !13, i64 8, !8, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!"_ZTS5TMode", !8, i64 0}
!15 = !{!"bool", !8, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !19, i64 0}
!19 = !{!"vtable pointer", !9, i64 0}
!20 = !{!6, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass