; LLVM IR from gem5/gem5 :: ext/systemc/src/sysc/tracing (sc_wif_trace)

; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl" }
%"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl" = type { %"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.sc_dt::sc_fxnum_bitref" = type <{ ptr, i32, [4 x i8] }>
%"class.sc_core::wif_sc_fxnum_trace" = type { %"class.sc_core::wif_trace.base", ptr, %"class.sc_dt::sc_fxnum" }
%"class.sc_core::wif_trace.base" = type <{ ptr, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", ptr, i32 }>
%"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.sc_dt::sc_fxnum" = type { ptr, %"class.sc_dt::scfx_params", i8, i8, ptr }
%"class.sc_dt::scfx_params" = type { %"class.sc_dt::sc_fxtype_params", i32, %"class.sc_dt::sc_fxcast_switch" }
%"class.sc_dt::sc_fxtype_params" = type { i32, i32, i32, i32, i32 }
%"class.sc_dt::sc_fxcast_switch" = type { i32 }
%"class.sc_core::wif_trace" = type <{ ptr, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", ptr, i32, [4 x i8] }>

@__dso_handle = external hidden global i8
@.str.10 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf = external hidden global %"class.std::vector", align 8
@_ZGVZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf = external hidden global i64, align 8

; Function Attrs: nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) #0

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind
declare i32 @__cxa_guard_acquire(ptr) #0

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: nounwind
declare void @__cxa_guard_abort(ptr) #0

; Function Attrs: nounwind
declare void @__cxa_guard_release(ptr) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIcSaIcEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZN5sc_dt8sc_fxnumaSERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef %1) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.std::allocator", align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca %"class.std::vector", align 8
  %10 = alloca %"class.std::allocator", align 1
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.sc_dt::sc_fxnum_bitref", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8
  %15 = load atomic i8, ptr @_ZGVZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf acquire, align 8
  %16 = icmp eq i8 %15, 0
  br i1 %16, label %17, label %23, !prof !9

17:                                               ; preds = %2
  %18 = call i32 @__cxa_guard_acquire(ptr @_ZGVZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf) #0
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %23

20:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #0
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #0
  invoke void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf, i64 noundef 1024, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %21 unwind label %39

21:                                               ; preds = %20
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #0
  %22 = call i32 @__cxa_atexit(ptr @_ZNSt6vectorIcSaIcEED2Ev, ptr @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf, ptr @__dso_handle) #0
  call void @__cxa_guard_release(ptr @_ZGVZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf) #0
  br label %23

23:                                               ; preds = %21, %17, %2
  %24 = call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf) #0
  %25 = getelementptr inbounds %"class.sc_core::wif_sc_fxnum_trace", ptr %14, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !10
  %27 = call noundef i32 @_ZNK5sc_dt8sc_fxnum2wlEv(ptr noundef nonnull align 8 dereferenceable(48) %26)
  %28 = sext i32 %27 to i64
  %29 = icmp ult i64 %24, %28
  br i1 %29, label %30, label %47

30:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #0
  %31 = getelementptr inbounds %"class.sc_core::wif_sc_fxnum_trace", ptr %14, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !10
  %33 = call noundef i32 @_ZNK5sc_dt8sc_fxnum2wlEv(ptr noundef nonnull align 8 dereferenceable(48) %32)
  %34 = sext i32 %33 to i64
  %35 = add i64 %34, 4096
  %36 = and i64 %35, -4096
  store i64 %36, ptr %8, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #0
  %37 = load i64, ptr %8, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #0
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #0
  invoke void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %37, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %38 unwind label %43

38:                                               ; preds = %30
  call void @_ZNSt6vectorIcSaIcEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf) #0
  call void @_ZNSt6vectorIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #0
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #0
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #0
  br label %47

39:                                               ; preds = %20
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %6, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %7, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #0
  call void @__cxa_guard_abort(ptr @_ZGVZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf) #0
  br label %81

43:                                               ; preds = %30
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %6, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %7, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #0
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #0
  br label %81

47:                                               ; preds = %38, %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #0
  %48 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf, i64 noundef 0) #0
  store ptr %48, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #0
  %49 = getelementptr inbounds %"class.sc_core::wif_sc_fxnum_trace", ptr %14, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !10
  %51 = call noundef i32 @_ZNK5sc_dt8sc_fxnum2wlEv(ptr noundef nonnull align 8 dereferenceable(48) %50)
  %52 = sub nsw i32 %51, 1
  store i32 %52, ptr %12, align 4, !tbaa !27
  br label %53

53:                                               ; preds = %67, %47
  %54 = load i32, ptr %12, align 4, !tbaa !27
  %55 = icmp sge i32 %54, 0
  br i1 %55, label %57, label %56

56:                                               ; preds = %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #0
  br label %70

57:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #0
  %58 = getelementptr inbounds %"class.sc_core::wif_sc_fxnum_trace", ptr %14, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !10
  %60 = load i32, ptr %12, align 4, !tbaa !27
  call void @_ZNK5sc_dt8sc_fxnumixEi(ptr dead_on_unwind writable sret(%"class.sc_dt::sc_fxnum_bitref") align 8 %13, ptr noundef nonnull align 8 dereferenceable(48) %59, i32 noundef %60)
  %61 = call noundef zeroext i1 @_ZNK5sc_dt15sc_fxnum_bitrefcvbEv(ptr noundef nonnull align 8 dereferenceable(12) %13)
  %62 = zext i1 %61 to i64
  %63 = getelementptr inbounds [3 x i8], ptr @.str.15, i64 0, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !28
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i32 1
  store ptr %66, ptr %11, align 8, !tbaa !5
  store i8 %64, ptr %65, align 1, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #0
  br label %67

67:                                               ; preds = %57
  %68 = load i32, ptr %12, align 4, !tbaa !27
  %69 = add nsw i32 %68, -1
  store i32 %69, ptr %12, align 4, !tbaa !27
  br label %53, !llvm.loop !29

70:                                               ; preds = %56
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  store i8 0, ptr %71, align 1, !tbaa !28
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %"class.sc_core::wif_trace", ptr %14, i32 0, i32 2
  %74 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %73) #0
  %75 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf, i64 noundef 0) #0
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef @.str.10, ptr noundef %74, ptr noundef %75) #0
  %77 = getelementptr inbounds %"class.sc_core::wif_sc_fxnum_trace", ptr %14, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !10
  %79 = getelementptr inbounds %"class.sc_core::wif_sc_fxnum_trace", ptr %14, i32 0, i32 2
  %80 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZN5sc_dt8sc_fxnumaSERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %79, ptr noundef nonnull align 8 dereferenceable(48) %78)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #0
  ret void

81:                                               ; preds = %43, %39
  %82 = load ptr, ptr %6, align 8
  %83 = load i32, ptr %7, align 4
  %84 = insertvalue { ptr, i32 } poison, ptr %82, 0
  %85 = insertvalue { ptr, i32 } %84, i32 %83, 1
  resume { ptr, i32 } %85
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK5sc_dt8sc_fxnum2wlEv(ptr noundef nonnull align 8 dereferenceable(48)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5sc_dt8sc_fxnumixEi(ptr dead_on_unwind noalias writable sret(%"class.sc_dt::sc_fxnum_bitref") align 8, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt15sc_fxnum_bitrefcvbEv(ptr noundef nonnull align 8 dereferenceable(12)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

attributes #0 = { nounwind }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { inlinehint 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 = !{!"branch_weights", i32 1, i32 1048575}
!10 = !{!11, !6, i64 88}
!11 = !{!"_ZTSN7sc_core18wif_sc_fxnum_traceE", !12, i64 0, !6, i64 88, !17, i64 96}
!12 = !{!"_ZTSN7sc_core9wif_traceE", !13, i64 8, !13, i64 40, !6, i64 72, !16, i64 80}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !7, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSN5sc_dt8sc_fxnumE", !6, i64 0, !18, i64 8, !25, i64 36, !25, i64 37, !6, i64 40}
!18 = !{!"_ZTSN5sc_dt11scfx_paramsE", !19, i64 0, !22, i64 20, !23, i64 24}
!19 = !{!"_ZTSN5sc_dt16sc_fxtype_paramsE", !16, i64 0, !16, i64 4, !20, i64 8, !21, i64 12, !16, i64 16}
!20 = !{!"_ZTSN5sc_dt9sc_q_modeE", !7, i64 0}
!21 = !{!"_ZTSN5sc_dt9sc_o_modeE", !7, i64 0}
!22 = !{!"_ZTSN5sc_dt6sc_encE", !7, i64 0}
!23 = !{!"_ZTSN5sc_dt16sc_fxcast_switchE", !24, i64 0}
!24 = !{!"_ZTSN5sc_dt9sc_switchE", !7, i64 0}
!25 = !{!"bool", !7, i64 0}
!26 = !{!15, !15, i64 0}
!27 = !{!16, !16, i64 0}
!28 = !{!7, !7, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl" }
%"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl" = type { %"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.sc_dt::sc_fxnum_bitref" = type <{ ptr, i32, [4 x i8] }>

@__dso_handle = external hidden global i8
@.str.10 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf = external hidden global %"class.std::vector", align 8
@_ZGVZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf = external hidden global i64, align 8

; Function Attrs: nofree nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: nofree nounwind
declare i32 @__cxa_guard_acquire(ptr) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: nofree nounwind
declare void @__cxa_guard_abort(ptr) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare void @__cxa_guard_release(ptr) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIcSaIcEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZN5sc_dt8sc_fxnumaSERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr nocapture noundef %1) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca %"class.std::allocator", align 1
  %6 = alloca %"class.sc_dt::sc_fxnum_bitref", align 8
  %7 = load atomic i8, ptr @_ZGVZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf acquire, align 8
  %8 = icmp eq i8 %7, 0
  br i1 %8, label %9, label %14, !prof !5

9:                                                ; preds = %2
  %10 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf) #6
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %14, label %11

11:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  invoke void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf, i64 noundef 1024, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %12 unwind label %28

12:                                               ; preds = %11
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  %13 = call i32 @__cxa_atexit(ptr nonnull @_ZNSt6vectorIcSaIcEED2Ev, ptr nonnull @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf, ptr nonnull @__dso_handle) #6
  call void @__cxa_guard_release(ptr nonnull @_ZGVZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf) #6
  br label %14

14:                                               ; preds = %12, %9, %2
  %15 = call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf) #6
  %16 = getelementptr inbounds i8, ptr %0, i64 88
  %17 = load ptr, ptr %16, align 8, !tbaa !6
  %18 = call noundef i32 @_ZNK5sc_dt8sc_fxnum2wlEv(ptr noundef nonnull align 8 dereferenceable(48) %17)
  %19 = sext i32 %18 to i64
  %20 = icmp ult i64 %15, %19
  br i1 %20, label %21, label %32

21:                                               ; preds = %14
  %22 = load ptr, ptr %16, align 8, !tbaa !6
  %23 = call noundef i32 @_ZNK5sc_dt8sc_fxnum2wlEv(ptr noundef nonnull align 8 dereferenceable(48) %22)
  %24 = and i32 %23, -4096
  %25 = sext i32 %24 to i64
  %26 = add nsw i64 %25, 4096
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  invoke void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %26, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %27 unwind label %30

27:                                               ; preds = %21
  call void @_ZNSt6vectorIcSaIcEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf) #6
  call void @_ZNSt6vectorIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  br label %32

28:                                               ; preds = %11
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  call void @__cxa_guard_abort(ptr nonnull @_ZGVZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf) #6
  br label %51

30:                                               ; preds = %21
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  br label %51

32:                                               ; preds = %27, %14
  %33 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf, i64 noundef 0) #6
  %34 = load ptr, ptr %16, align 8, !tbaa !6
  %35 = call noundef i32 @_ZNK5sc_dt8sc_fxnum2wlEv(ptr noundef nonnull align 8 dereferenceable(48) %34)
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %32
  %.09.lcssa = phi ptr [ %33, %32 ], [ %49, %.lr.ph ]
  store i8 0, ptr %.09.lcssa, align 1, !tbaa !25
  %37 = getelementptr inbounds i8, ptr %0, i64 40
  %38 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %37) #6
  %39 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core18wif_sc_fxnum_trace5writeEP8_IO_FILEE3buf, i64 noundef 0) #6
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %1, ptr noundef nonnull @.str.10, ptr noundef %38, ptr noundef nonnull %39) #6
  %41 = load ptr, ptr %16, align 8, !tbaa !6
  %42 = getelementptr inbounds i8, ptr %0, i64 96
  %43 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZN5sc_dt8sc_fxnumaSERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %42, ptr noundef nonnull align 8 dereferenceable(48) %41)
  ret void

.lr.ph:                                           ; preds = %32, %.lr.ph
  %.0.in14 = phi i32 [ %.0, %.lr.ph ], [ %35, %32 ]
  %.0913 = phi ptr [ %49, %.lr.ph ], [ %33, %32 ]
  %.0 = add nsw i32 %.0.in14, -1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  %44 = load ptr, ptr %16, align 8, !tbaa !6
  call void @_ZNK5sc_dt8sc_fxnumixEi(ptr dead_on_unwind nonnull writable sret(%"class.sc_dt::sc_fxnum_bitref") align 8 %6, ptr noundef nonnull align 8 dereferenceable(48) %44, i32 noundef %.0)
  %45 = call noundef zeroext i1 @_ZNK5sc_dt15sc_fxnum_bitrefcvbEv(ptr noundef nonnull align 8 dereferenceable(12) %6)
  %46 = zext i1 %45 to i64
  %47 = getelementptr inbounds [3 x i8], ptr @.str.15, i64 0, i64 %46
  %48 = load i8, ptr %47, align 1, !tbaa !25
  %49 = getelementptr inbounds i8, ptr %.0913, i64 1
  store i8 %48, ptr %.0913, align 1, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  %50 = icmp ugt i32 %.0.in14, 1
  br i1 %50, label %.lr.ph, label %._crit_edge, !llvm.loop !26

51:                                               ; preds = %30, %28
  %.pn = phi { ptr, i32 } [ %31, %30 ], [ %29, %28 ]
  resume { ptr, i32 } %.pn
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK5sc_dt8sc_fxnum2wlEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5sc_dt8sc_fxnumixEi(ptr dead_on_unwind noalias writable sret(%"class.sc_dt::sc_fxnum_bitref") align 8, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt15sc_fxnum_bitrefcvbEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

attributes #0 = { nofree nounwind }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { inlinehint 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 #6 = { 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 = !{!"branch_weights", i32 1, i32 1048575}
!6 = !{!7, !11, i64 88}
!7 = !{!"_ZTSN7sc_core18wif_sc_fxnum_traceE", !8, i64 0, !11, i64 88, !16, i64 96}
!8 = !{!"_ZTSN7sc_core9wif_traceE", !9, i64 8, !9, i64 40, !11, i64 72, !15, i64 80}
!9 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !10, i64 0, !14, i64 8, !12, i64 16}
!10 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !11, i64 0}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"long", !12, i64 0}
!15 = !{!"int", !12, i64 0}
!16 = !{!"_ZTSN5sc_dt8sc_fxnumE", !11, i64 0, !17, i64 8, !24, i64 36, !24, i64 37, !11, i64 40}
!17 = !{!"_ZTSN5sc_dt11scfx_paramsE", !18, i64 0, !21, i64 20, !22, i64 24}
!18 = !{!"_ZTSN5sc_dt16sc_fxtype_paramsE", !15, i64 0, !15, i64 4, !19, i64 8, !20, i64 12, !15, i64 16}
!19 = !{!"_ZTSN5sc_dt9sc_q_modeE", !12, i64 0}
!20 = !{!"_ZTSN5sc_dt9sc_o_modeE", !12, i64 0}
!21 = !{!"_ZTSN5sc_dt6sc_encE", !12, i64 0}
!22 = !{!"_ZTSN5sc_dt16sc_fxcast_switchE", !23, i64 0}
!23 = !{!"_ZTSN5sc_dt9sc_switchE", !12, i64 0}
!24 = !{!"bool", !12, i64 0}
!25 = !{!12, !12, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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