; LLVM IR from cruppstahl/upscaledb :: tools/ups_bench/generator_parser.ll (ZN15ParserGenerator9txn_abortEv)

; 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.ParserGenerator = type { %class.Generator.base, ptr, ptr, ptr, i8, %struct.Metrics, %"class.std::vector", i32, %struct.Timer, i32, ptr, %"class.std::vector" }
%class.Generator.base = type <{ ptr, i32, [4 x i8], ptr, ptr, i32, [4 x i8], %struct.ups_record_t, ptr, [4 x i32], i8 }>
%struct.ups_record_t = type { i32, ptr, i32 }
%struct.Metrics = type { ptr, i64, i64, i64, i64, i64, i64, i64, double, double, double, double, double, double, double, double, double, double, double, double, double, %struct.ups_env_metrics_t }
%struct.ups_env_metrics_t = type { i16, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, %struct.btree_metrics_t, %struct.btree_metrics_t, i32 }
%struct.btree_metrics_t = type { i16, i64, i64, i64, i32, %struct.min_max_avg_u32_t, %struct.min_max_avg_u32_t, %struct.min_max_avg_u32_t, %struct.min_max_avg_u32_t, %struct.min_max_avg_u32_t, %struct.min_max_avg_u32_t, %struct.min_max_avg_u32_t, %struct.min_max_avg_u32_t, %struct.min_max_avg_u32_t }
%struct.min_max_avg_u32_t = type { i32, i32, i32, i32, i32 }
%struct.Timer = type { %"class.boost::chrono::time_point" }
%"class.boost::chrono::time_point" = type { %"class.boost::chrono::duration" }
%"class.boost::chrono::duration" = type { i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Generator = type <{ ptr, i32, [4 x i8], ptr, ptr, i32, [4 x i8], %struct.ups_record_t, ptr, [4 x i32], i8, [7 x i8] }>

@.str.4 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [11 x i8], align 1
@__PRETTY_FUNCTION__._ZN15ParserGenerator9txn_abortEv = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN15ParserGenerator9txn_abortEv(ptr noundef nonnull align 8 dereferenceable(1040) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %class.ParserGenerator, ptr %3, i32 0, i32 1
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = icmp ne ptr %5, null
  br i1 %6, label %7, label %8

7:                                                ; preds = %1
  br label %10

8:                                                ; preds = %1
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.4, i32 noundef 292, ptr noundef @__PRETTY_FUNCTION__._ZN15ParserGenerator9txn_abortEv) #3
  unreachable

9:                                                ; No predecessors!
  br label %10

10:                                               ; preds = %9, %7
  %11 = getelementptr inbounds %class.ParserGenerator, ptr %3, i32 0, i32 2
  %12 = load ptr, ptr %11, align 8, !tbaa !29
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %21

14:                                               ; preds = %10
  %15 = getelementptr inbounds %class.Generator, ptr %3, i32 0, i32 4
  %16 = load ptr, ptr %15, align 8, !tbaa !30
  %17 = getelementptr inbounds %class.ParserGenerator, ptr %3, i32 0, i32 2
  %18 = load ptr, ptr %17, align 8, !tbaa !29
  %19 = call noundef i32 @_ZN8Database12cursor_closeEPm(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef %18)
  %20 = getelementptr inbounds %class.ParserGenerator, ptr %3, i32 0, i32 2
  store ptr null, ptr %20, align 8, !tbaa !29
  br label %21

21:                                               ; preds = %14, %10
  %22 = getelementptr inbounds %class.Generator, ptr %3, i32 0, i32 4
  %23 = load ptr, ptr %22, align 8, !tbaa !30
  %24 = getelementptr inbounds %class.ParserGenerator, ptr %3, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = call noundef i32 @_ZN8Database9txn_abortEPm(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef %25)
  %27 = getelementptr inbounds %class.Generator, ptr %3, i32 0, i32 5
  store i32 %26, ptr %27, align 8, !tbaa !31
  %28 = getelementptr inbounds %class.ParserGenerator, ptr %3, i32 0, i32 1
  store ptr null, ptr %28, align 8, !tbaa !9
  %29 = getelementptr inbounds %class.Generator, ptr %3, i32 0, i32 5
  %30 = load i32, ptr %29, align 8, !tbaa !31
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %21
  %33 = getelementptr inbounds %class.ParserGenerator, ptr %3, i32 0, i32 4
  store i8 0, ptr %33, align 8, !tbaa !32
  br label %34

34:                                               ; preds = %32, %21
  %35 = getelementptr inbounds %class.ParserGenerator, ptr %3, i32 0, i32 5
  %36 = getelementptr inbounds %struct.Metrics, ptr %35, i32 0, i32 5
  %37 = load i64, ptr %36, align 8, !tbaa !33
  %38 = add i64 %37, 1
  store i64 %38, ptr %36, align 8, !tbaa !33
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

declare noundef i32 @_ZN8Database12cursor_closeEPm(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #2

declare noundef i32 @_ZN8Database9txn_abortEPm(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #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" }
attributes #1 = { noreturn 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 #2 = { "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 = { noreturn 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, !6, i64 96}
!10 = !{!"_ZTS15ParserGenerator", !11, i64 0, !6, i64 96, !6, i64 104, !6, i64 112, !14, i64 120, !15, i64 128, !22, i64 960, !12, i64 984, !26, i64 992, !12, i64 1000, !6, i64 1008, !22, i64 1016}
!11 = !{!"_ZTS9Generator", !12, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !13, i64 40, !6, i64 64, !7, i64 72, !14, i64 88}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTS12ups_record_t", !12, i64 0, !6, i64 8, !12, i64 16}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTS7Metrics", !6, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !16, i64 40, !16, i64 48, !16, i64 56, !17, i64 64, !17, i64 72, !17, i64 80, !17, i64 88, !17, i64 96, !17, i64 104, !17, i64 112, !17, i64 120, !17, i64 128, !17, i64 136, !17, i64 144, !17, i64 152, !17, i64 160, !18, i64 168}
!16 = !{!"long", !7, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{!"_ZTS17ups_env_metrics_t", !19, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96, !16, i64 104, !16, i64 112, !16, i64 120, !16, i64 128, !16, i64 136, !16, i64 144, !16, i64 152, !16, i64 160, !16, i64 168, !16, i64 176, !16, i64 184, !16, i64 192, !16, i64 200, !16, i64 208, !16, i64 216, !20, i64 224, !20, i64 440, !12, i64 656}
!19 = !{!"short", !7, i64 0}
!20 = !{!"_ZTS15btree_metrics_t", !19, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !12, i64 32, !21, i64 36, !21, i64 56, !21, i64 76, !21, i64 96, !21, i64 116, !21, i64 136, !21, i64 156, !21, i64 176, !21, i64 196}
!21 = !{!"_ZTS17min_max_avg_u32_t", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!22 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!"_ZTS5TimerIN5boost6chrono12system_clockEE", !27, i64 0}
!27 = !{!"_ZTSN5boost6chrono10time_pointINS0_12system_clockENS0_8durationIlNS_5ratioILl1ELl1000000000EEEEEEE", !28, i64 0}
!28 = !{!"_ZTSN5boost6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE", !16, i64 0}
!29 = !{!10, !6, i64 104}
!30 = !{!11, !6, i64 24}
!31 = !{!11, !12, i64 32}
!32 = !{!10, !14, i64 120}
!33 = !{!10, !16, i64 168}


; 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.4 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [11 x i8], align 1
@__PRETTY_FUNCTION__._ZN15ParserGenerator9txn_abortEv = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN15ParserGenerator9txn_abortEv(ptr nocapture noundef nonnull align 8 dereferenceable(1040) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 96
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.4, i32 noundef 292, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN15ParserGenerator9txn_abortEv) #3
  unreachable

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 104
  %7 = load ptr, ptr %6, align 8, !tbaa !28
  %.not1 = icmp eq ptr %7, null
  br i1 %.not1, label %12, label %8

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !29
  %11 = tail call noundef i32 @_ZN8Database12cursor_closeEPm(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull %7)
  store ptr null, ptr %6, align 8, !tbaa !28
  %.pre = load ptr, ptr %2, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %8, %5
  %13 = phi ptr [ %.pre, %8 ], [ %3, %5 ]
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  %15 = load ptr, ptr %14, align 8, !tbaa !29
  %16 = tail call noundef i32 @_ZN8Database9txn_abortEPm(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef %13)
  %17 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %16, ptr %17, align 8, !tbaa !30
  store ptr null, ptr %2, align 8, !tbaa !5
  %.not2 = icmp eq i32 %16, 0
  br i1 %.not2, label %20, label %18

18:                                               ; preds = %12
  %19 = getelementptr inbounds i8, ptr %0, i64 120
  store i8 0, ptr %19, align 8, !tbaa !31
  br label %20

20:                                               ; preds = %18, %12
  %21 = getelementptr inbounds i8, ptr %0, i64 168
  %22 = load i64, ptr %21, align 8, !tbaa !32
  %23 = add i64 %22, 1
  store i64 %23, ptr %21, align 8, !tbaa !32
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare noundef i32 @_ZN8Database12cursor_closeEPm(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #2

declare noundef i32 @_ZN8Database9txn_abortEPm(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #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" }
attributes #1 = { noreturn 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 #2 = { "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 = { noreturn 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, !11, i64 96}
!6 = !{!"_ZTS15ParserGenerator", !7, i64 0, !11, i64 96, !11, i64 104, !11, i64 112, !13, i64 120, !14, i64 128, !21, i64 960, !8, i64 984, !25, i64 992, !8, i64 1000, !11, i64 1008, !21, i64 1016}
!7 = !{!"_ZTS9Generator", !8, i64 8, !11, i64 16, !11, i64 24, !8, i64 32, !12, i64 40, !11, i64 64, !9, i64 72, !13, i64 88}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTS12ups_record_t", !8, i64 0, !11, i64 8, !8, i64 16}
!13 = !{!"bool", !9, i64 0}
!14 = !{!"_ZTS7Metrics", !11, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48, !15, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96, !16, i64 104, !16, i64 112, !16, i64 120, !16, i64 128, !16, i64 136, !16, i64 144, !16, i64 152, !16, i64 160, !17, i64 168}
!15 = !{!"long", !9, i64 0}
!16 = !{!"double", !9, i64 0}
!17 = !{!"_ZTS17ups_env_metrics_t", !18, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !15, i64 104, !15, i64 112, !15, i64 120, !15, i64 128, !15, i64 136, !15, i64 144, !15, i64 152, !15, i64 160, !15, i64 168, !15, i64 176, !15, i64 184, !15, i64 192, !15, i64 200, !15, i64 208, !15, i64 216, !19, i64 224, !19, i64 440, !8, i64 656}
!18 = !{!"short", !9, i64 0}
!19 = !{!"_ZTS15btree_metrics_t", !18, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !8, i64 32, !20, i64 36, !20, i64 56, !20, i64 76, !20, i64 96, !20, i64 116, !20, i64 136, !20, i64 156, !20, i64 176, !20, i64 196}
!20 = !{!"_ZTS17min_max_avg_u32_t", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !8, i64 16}
!21 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!25 = !{!"_ZTS5TimerIN5boost6chrono12system_clockEE", !26, i64 0}
!26 = !{!"_ZTSN5boost6chrono10time_pointINS0_12system_clockENS0_8durationIlNS_5ratioILl1ELl1000000000EEEEEEE", !27, i64 0}
!27 = !{!"_ZTSN5boost6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE", !15, i64 0}
!28 = !{!6, !11, i64 104}
!29 = !{!7, !11, i64 24}
!30 = !{!7, !8, i64 32}
!31 = !{!6, !13, i64 120}
!32 = !{!6, !15, i64 168}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass