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

@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@_ZN10_BlackBill7_LoaderL9TOKENNAMEE = external hidden constant [14 x [256 x i8]], align 16

declare i32 @printf(ptr noundef, ...) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10_BlackBill7_Loader13CRawLFSLoader10showTokensEv(ptr noundef nonnull align 8 dereferenceable(201) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %5

5:                                                ; preds = %29, %1
  %6 = load i32, ptr %3, align 4, !tbaa !9
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds %"class._BlackBill::_Loader::CRawLFSLoader", ptr %4, i32 0, i32 16
  %9 = call noundef i64 @_ZNKSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  %10 = icmp ult i64 %7, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %32

12:                                               ; preds = %5
  %13 = getelementptr inbounds %"class._BlackBill::_Loader::CRawLFSLoader", ptr %4, i32 0, i32 16
  %14 = load i32, ptr %3, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %15) #4
  %17 = getelementptr inbounds %"struct._BlackBill::_Loader::SLFSToken", ptr %16, i32 0, i32 0
  %18 = load i32, ptr %17, align 8, !tbaa !11
  %19 = zext i32 %18 to i64
  %20 = getelementptr inbounds [14 x [256 x i8]], ptr @_ZN10_BlackBill7_LoaderL9TOKENNAMEE, i64 0, i64 %19
  %21 = getelementptr inbounds [256 x i8], ptr %20, i64 0, i64 0
  %22 = getelementptr inbounds %"class._BlackBill::_Loader::CRawLFSLoader", ptr %4, i32 0, i32 16
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %24) #4
  %26 = getelementptr inbounds %"struct._BlackBill::_Loader::SLFSToken", ptr %25, i32 0, i32 1
  %27 = call noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %26) #4
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, ptr noundef %21, ptr noundef %27)
  br label %29

29:                                               ; preds = %12
  %30 = load i32, ptr %3, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %3, align 4, !tbaa !9
  br label %5, !llvm.loop !17

32:                                               ; preds = %11
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

attributes #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 0}
!12 = !{!"_ZTSN10_BlackBill7_Loader9SLFSTokenE", !13, i64 0, !14, i64 8}
!13 = !{!"_ZTSN10_BlackBill7_Loader10ETokenTypeE", !7, i64 0}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !7, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"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"

@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@_ZN10_BlackBill7_LoaderL9TOKENNAMEE = external hidden constant [14 x [256 x i8]], align 16

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN10_BlackBill7_Loader13CRawLFSLoader10showTokensEv(ptr noundef nonnull align 8 dereferenceable(201) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 88
  %3 = tail call noundef i64 @_ZNKSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #2
  %.not = icmp eq i64 %3, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %1
  ret void

.lr.ph:                                           ; preds = %1, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %1 ]
  %4 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %indvars.iv) #2
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = zext i32 %5 to i64
  %7 = getelementptr inbounds [14 x [256 x i8]], ptr @_ZN10_BlackBill7_LoaderL9TOKENNAMEE, i64 0, i64 %6
  %8 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %indvars.iv) #2
  %9 = getelementptr inbounds i8, ptr %8, i64 8
  %10 = tail call noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %9) #2
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, ptr noundef nonnull %7, ptr noundef %10)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %12 = tail call noundef i64 @_ZNKSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #2
  %13 = icmp ugt i64 %12, %indvars.iv.next
  br i1 %13, label %.lr.ph, label %._crit_edge, !llvm.loop !14
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorIN10_BlackBill7_Loader9SLFSTokenESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

attributes #0 = { nofree nounwind "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" }
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, !7, i64 0}
!6 = !{!"_ZTSN10_BlackBill7_Loader9SLFSTokenE", !7, i64 0, !10, i64 8}
!7 = !{!"_ZTSN10_BlackBill7_Loader10ETokenTypeE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !11, i64 0, !13, i64 8, !8, i64 16}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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