; LLVM IR from Yinxiaoli/iros2015_folding :: src/folding_planner_cmake/lib/blackbill/loader (rawlfsloader)

; 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._BlackBill::_Loader::CRawLFSLoader" = type <{ ptr, ptr, ptr, i32, i32, i8, i8, i8, i8, i32, %"struct._BlackBill::_Loader::SLFSToken", i8, i8, i8, i8, i32, %"class.std::vector", %"class.std::vector.3", %"struct._BlackBill::_Loader::SLFSProgramSpec", %"class.std::map", i8, [7 x i8] }>
%"struct._BlackBill::_Loader::SLFSToken" = type { i32, %"class.std::__cxx11::basic_string" }
%"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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<_BlackBill::_Loader::SLFSToken, std::allocator<_BlackBill::_Loader::SLFSToken>>::_Vector_impl" }
%"struct.std::_Vector_base<_BlackBill::_Loader::SLFSToken, std::allocator<_BlackBill::_Loader::SLFSToken>>::_Vector_impl" = type { %"struct.std::_Vector_base<_BlackBill::_Loader::SLFSToken, std::allocator<_BlackBill::_Loader::SLFSToken>>::_Vector_impl_data" }
%"struct.std::_Vector_base<_BlackBill::_Loader::SLFSToken, std::allocator<_BlackBill::_Loader::SLFSToken>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<_BlackBill::_Loader::SLFSStatement, std::allocator<_BlackBill::_Loader::SLFSStatement>>::_Vector_impl" }
%"struct.std::_Vector_base<_BlackBill::_Loader::SLFSStatement, std::allocator<_BlackBill::_Loader::SLFSStatement>>::_Vector_impl" = type { %"struct.std::_Vector_base<_BlackBill::_Loader::SLFSStatement, std::allocator<_BlackBill::_Loader::SLFSStatement>>::_Vector_impl_data" }
%"struct.std::_Vector_base<_BlackBill::_Loader::SLFSStatement, std::allocator<_BlackBill::_Loader::SLFSStatement>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct._BlackBill::_Loader::SLFSProgramSpec" = type { ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, _BlackBill::_Loader::SLFSDataField>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, _BlackBill::_Loader::SLFSDataField>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, _BlackBill::_Loader::SLFSDataField>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, _BlackBill::_Loader::SLFSDataField>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef signext i8 @_ZN10_BlackBill7_Loader13CRawLFSLoader11getNextCharEv(ptr noundef nonnull align 8 dereferenceable(201)) #1 align 2

; 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 void @_ZN10_BlackBill7_Loader13CRawLFSLoader8readLineEPci(ptr noundef nonnull align 8 dereferenceable(201) %0, ptr noundef %1, i32 noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %10 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %42, %40, %3
  %12 = getelementptr inbounds %"class._BlackBill::_Loader::CRawLFSLoader", ptr %10, i32 0, i32 7
  %13 = load i8, ptr %12, align 2, !tbaa !11, !range !36, !noundef !37
  %14 = trunc i8 %13 to i1
  %15 = xor i1 %14, true
  br i1 %15, label %16, label %43

16:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #2
  %17 = call noundef signext i8 @_ZN10_BlackBill7_Loader13CRawLFSLoader11getNextCharEv(ptr noundef nonnull align 8 dereferenceable(201) %10)
  store i8 %17, ptr %8, align 1, !tbaa !38
  %18 = load i8, ptr %8, align 1, !tbaa !38
  %19 = sext i8 %18 to i32
  %20 = icmp eq i32 %19, 10
  br i1 %20, label %21, label %22

21:                                               ; preds = %16
  store i32 3, ptr %9, align 4
  br label %40

22:                                               ; preds = %16
  %23 = load i8, ptr %8, align 1, !tbaa !38
  %24 = sext i8 %23 to i32
  %25 = icmp eq i32 %24, 13
  br i1 %25, label %26, label %27

26:                                               ; preds = %22
  store i32 2, ptr %9, align 4
  br label %40, !llvm.loop !39

27:                                               ; preds = %22
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = sub nsw i32 %29, 1
  %31 = icmp slt i32 %28, %30
  br i1 %31, label %32, label %39

32:                                               ; preds = %27
  %33 = load i8, ptr %8, align 1, !tbaa !38
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %7, align 4, !tbaa !9
  %37 = sext i32 %35 to i64
  %38 = getelementptr inbounds i8, ptr %34, i64 %37
  store i8 %33, ptr %38, align 1, !tbaa !38
  br label %39

39:                                               ; preds = %32, %27
  store i32 0, ptr %9, align 4
  br label %40

40:                                               ; preds = %39, %26, %21
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #2
  %41 = load i32, ptr %9, align 4
  switch i32 %41, label %51 [
    i32 0, label %42
    i32 3, label %43
    i32 2, label %11
  ]

42:                                               ; preds = %40
  br label %11, !llvm.loop !39

43:                                               ; preds = %40, %11
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i8, ptr %44, i64 %46
  store i8 0, ptr %47, align 1, !tbaa !38
  %48 = getelementptr inbounds %"class._BlackBill::_Loader::CRawLFSLoader", ptr %10, i32 0, i32 15
  %49 = load i32, ptr %48, align 4, !tbaa !41
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %48, align 4, !tbaa !41
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  ret void

51:                                               ; preds = %40
  unreachable
}

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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 34}
!12 = !{!"_ZTSN10_BlackBill7_Loader13CRawLFSLoaderE", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !7, i64 32, !13, i64 33, !13, i64 34, !10, i64 36, !14, i64 40, !13, i64 80, !13, i64 81, !13, i64 82, !10, i64 84, !19, i64 88, !23, i64 112, !27, i64 136, !28, i64 152, !13, i64 200}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN10_BlackBill7_Loader9SLFSTokenE", !15, i64 0, !16, i64 8}
!15 = !{!"_ZTSN10_BlackBill7_Loader10ETokenTypeE", !7, i64 0}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTSSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"_ZTSSt6vectorIN10_BlackBill7_Loader13SLFSStatementESaIS2_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIN10_BlackBill7_Loader13SLFSStatementESaIS2_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN10_BlackBill7_Loader13SLFSStatementESaIS2_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN10_BlackBill7_Loader13SLFSStatementESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{!"_ZTSN10_BlackBill7_Loader15SLFSProgramSpecE", !6, i64 0, !6, i64 8}
!28 = !{!"_ZTSSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN10_BlackBill7_Loader13SLFSDataFieldESt4lessIS5_ESaISt4pairIKS5_S8_EEE", !29, i64 0}
!29 = !{!"_ZTSSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_N10_BlackBill7_Loader13SLFSDataFieldEESt10_Select1stISB_ESt4lessIS5_ESaISB_EE", !30, i64 0}
!30 = !{!"_ZTSNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_N10_BlackBill7_Loader13SLFSDataFieldEESt10_Select1stISB_ESt4lessIS5_ESaISB_EE13_Rb_tree_implISF_Lb1EEE", !31, i64 0, !33, i64 8}
!31 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE", !32, i64 0}
!32 = !{!"_ZTSSt4lessINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE"}
!33 = !{!"_ZTSSt15_Rb_tree_header", !34, i64 0, !18, i64 32}
!34 = !{!"_ZTSSt18_Rb_tree_node_base", !35, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!35 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!36 = !{i8 0, i8 2}
!37 = !{}
!38 = !{!7, !7, i64 0}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}
!41 = !{!12, !10, i64 84}


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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10_BlackBill7_Loader13CRawLFSLoader8readLineEPci(ptr noundef nonnull align 8 dereferenceable(201) %0, ptr nocapture noundef writeonly %1, i32 noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 34
  %5 = load i8, ptr %4, align 2, !tbaa !5, !range !34, !noundef !35
  %6 = trunc nuw i8 %5 to i1
  br i1 %6, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %7 = add nsw i32 %2, -1
  br label %8

8:                                                ; preds = %.lr.ph, %16
  %.01016 = phi i32 [ 0, %.lr.ph ], [ %.2, %16 ]
  %9 = tail call noundef signext i8 @_ZN10_BlackBill7_Loader13CRawLFSLoader11getNextCharEv(ptr noundef nonnull align 8 dereferenceable(201) %0)
  switch i8 %9, label %10 [
    i8 10, label %.thread.loopexit
    i8 13, label %16
  ], !llvm.loop !36

10:                                               ; preds = %8
  %11 = icmp slt i32 %.01016, %7
  br i1 %11, label %12, label %16

12:                                               ; preds = %10
  %13 = add nsw i32 %.01016, 1
  %14 = sext i32 %.01016 to i64
  %15 = getelementptr inbounds i8, ptr %1, i64 %14
  store i8 %9, ptr %15, align 1, !tbaa !38
  br label %16

16:                                               ; preds = %8, %10, %12
  %.2 = phi i32 [ %13, %12 ], [ %.01016, %10 ], [ %.01016, %8 ]
  %17 = load i8, ptr %4, align 2, !tbaa !5, !range !34, !noundef !35
  %18 = trunc nuw i8 %17 to i1
  br i1 %18, label %.thread.loopexit, label %8

.thread.loopexit:                                 ; preds = %8, %16
  %.010.lcssa.ph = phi i32 [ %.2, %16 ], [ %.01016, %8 ]
  %19 = sext i32 %.010.lcssa.ph to i64
  br label %.thread

.thread:                                          ; preds = %.thread.loopexit, %3
  %.010.lcssa = phi i64 [ 0, %3 ], [ %19, %.thread.loopexit ]
  %20 = getelementptr inbounds i8, ptr %1, i64 %.010.lcssa
  store i8 0, ptr %20, align 1, !tbaa !38
  %21 = getelementptr inbounds i8, ptr %0, i64 84
  %22 = load i32, ptr %21, align 4, !tbaa !39
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %21, align 4, !tbaa !39
  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, !11, i64 34}
!6 = !{!"_ZTSN10_BlackBill7_Loader13CRawLFSLoaderE", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !8, i64 32, !11, i64 33, !11, i64 34, !10, i64 36, !12, i64 40, !11, i64 80, !11, i64 81, !11, i64 82, !10, i64 84, !17, i64 88, !21, i64 112, !25, i64 136, !26, i64 152, !11, i64 200}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTSN10_BlackBill7_Loader9SLFSTokenE", !13, i64 0, !14, i64 8}
!13 = !{!"_ZTSN10_BlackBill7_Loader10ETokenTypeE", !8, i64 0}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !8, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!"_ZTSSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!21 = !{!"_ZTSSt6vectorIN10_BlackBill7_Loader13SLFSStatementESaIS2_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIN10_BlackBill7_Loader13SLFSStatementESaIS2_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIN10_BlackBill7_Loader13SLFSStatementESaIS2_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIN10_BlackBill7_Loader13SLFSStatementESaIS2_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!25 = !{!"_ZTSN10_BlackBill7_Loader15SLFSProgramSpecE", !7, i64 0, !7, i64 8}
!26 = !{!"_ZTSSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN10_BlackBill7_Loader13SLFSDataFieldESt4lessIS5_ESaISt4pairIKS5_S8_EEE", !27, i64 0}
!27 = !{!"_ZTSSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_N10_BlackBill7_Loader13SLFSDataFieldEESt10_Select1stISB_ESt4lessIS5_ESaISB_EE", !28, i64 0}
!28 = !{!"_ZTSNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_N10_BlackBill7_Loader13SLFSDataFieldEESt10_Select1stISB_ESt4lessIS5_ESaISB_EE13_Rb_tree_implISF_Lb1EEE", !29, i64 0, !31, i64 8}
!29 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE", !30, i64 0}
!30 = !{!"_ZTSSt4lessINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE"}
!31 = !{!"_ZTSSt15_Rb_tree_header", !32, i64 0, !16, i64 32}
!32 = !{!"_ZTSSt18_Rb_tree_node_base", !33, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!33 = !{!"_ZTSSt14_Rb_tree_color", !8, i64 0}
!34 = !{i8 0, i8 2}
!35 = !{}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = !{!8, !8, i64 0}
!39 = !{!6, !10, i64 84}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass