; 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_core::wif_sc_signed_trace" = type { %"class.sc_core::wif_trace.base", ptr, %"class.sc_dt::sc_signed" }
%"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_signed" = type { %"class.sc_dt::sc_value_base", i32, i32, i32, ptr }
%"class.sc_dt::sc_value_base" = type { ptr }
%"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_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf = external hidden global %"class.std::vector", align 8
@_ZGVZN7sc_core19wif_sc_signed_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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZN5sc_dt9sc_signedaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(128) %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
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8
  %14 = load atomic i8, ptr @_ZGVZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf acquire, align 8
  %15 = icmp eq i8 %14, 0
  br i1 %15, label %16, label %22, !prof !9

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

19:                                               ; preds = %16
  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_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf, i64 noundef 1024, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %20 unwind label %38

20:                                               ; preds = %19
  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
  %21 = call i32 @__cxa_atexit(ptr @_ZNSt6vectorIcSaIcEED2Ev, ptr @_ZZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf, ptr @__dso_handle) #0
  call void @__cxa_guard_release(ptr @_ZGVZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf) #0
  br label %22

22:                                               ; preds = %20, %16, %2
  %23 = call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf) #0
  %24 = getelementptr inbounds %"class.sc_core::wif_sc_signed_trace", ptr %13, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !10
  %26 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %25)
  %27 = sext i32 %26 to i64
  %28 = icmp ult i64 %23, %27
  br i1 %28, label %29, label %46

29:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #0
  %30 = getelementptr inbounds %"class.sc_core::wif_sc_signed_trace", ptr %13, i32 0, i32 1
  %31 = load ptr, ptr %30, align 8, !tbaa !10
  %32 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %31)
  %33 = sext i32 %32 to i64
  %34 = add i64 %33, 4096
  %35 = and i64 %34, -4096
  store i64 %35, ptr %8, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #0
  %36 = load i64, ptr %8, align 8, !tbaa !19
  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 %36, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %37 unwind label %42

37:                                               ; preds = %29
  call void @_ZNSt6vectorIcSaIcEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19wif_sc_signed_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 %46

38:                                               ; preds = %19
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %6, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, 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_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf) #0
  br label %81

42:                                               ; preds = %29
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %6, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, 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

46:                                               ; preds = %37, %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #0
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf, i64 noundef 0) #0
  store ptr %47, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #0
  %48 = getelementptr inbounds %"class.sc_core::wif_sc_signed_trace", ptr %13, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !10
  %50 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %49)
  %51 = sub nsw i32 %50, 1
  store i32 %51, ptr %12, align 4, !tbaa !20
  br label %52

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

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

56:                                               ; preds = %52
  %57 = getelementptr inbounds %"class.sc_core::wif_sc_signed_trace", ptr %13, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !10
  %59 = load i32, ptr %12, align 4, !tbaa !20
  %60 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5sc_dt9sc_signedixEi(ptr noundef nonnull align 8 dereferenceable(32) %58, i32 noundef %59)
  %61 = call noundef zeroext i1 @_ZNK5sc_dt18sc_signed_bitref_r7to_boolEv(ptr noundef nonnull align 8 dereferenceable(24) %60)
  %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 !21
  %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 !21
  br label %67

67:                                               ; preds = %56
  %68 = load i32, ptr %12, align 4, !tbaa !20
  %69 = add nsw i32 %68, -1
  store i32 %69, ptr %12, align 4, !tbaa !20
  br label %52, !llvm.loop !22

70:                                               ; preds = %55
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  store i8 0, ptr %71, align 1, !tbaa !21
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %"class.sc_core::wif_trace", ptr %13, 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_core19wif_sc_signed_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_signed_trace", ptr %13, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !10
  %79 = getelementptr inbounds %"class.sc_core::wif_sc_signed_trace", ptr %13, i32 0, i32 2
  %80 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN5sc_dt9sc_signedaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %79, ptr noundef nonnull align 8 dereferenceable(32) %78)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #0
  ret void

81:                                               ; preds = %42, %38
  %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: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5sc_dt9sc_signedixEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt18sc_signed_bitref_r7to_boolEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 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 = { "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_core19wif_sc_signed_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_dt9sc_signedE", !18, i64 0, !16, i64 8, !16, i64 12, !16, i64 16, !6, i64 24}
!18 = !{!"_ZTSN5sc_dt13sc_value_baseE"}
!19 = !{!15, !15, i64 0}
!20 = !{!16, !16, i64 0}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"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 }

@__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_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf = external hidden global %"class.std::vector", align 8
@_ZGVZN7sc_core19wif_sc_signed_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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZN5sc_dt9sc_signedaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(128) %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 = load atomic i8, ptr @_ZGVZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf acquire, align 8
  %7 = icmp eq i8 %6, 0
  br i1 %7, label %8, label %13, !prof !5

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

10:                                               ; preds = %8
  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_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf, i64 noundef 1024, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %11 unwind label %27

11:                                               ; preds = %10
  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
  %12 = call i32 @__cxa_atexit(ptr nonnull @_ZNSt6vectorIcSaIcEED2Ev, ptr nonnull @_ZZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf, ptr nonnull @__dso_handle) #6
  call void @__cxa_guard_release(ptr nonnull @_ZGVZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf) #6
  br label %13

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

20:                                               ; preds = %13
  %21 = load ptr, ptr %15, align 8, !tbaa !6
  %22 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %21)
  %23 = and i32 %22, -4096
  %24 = sext i32 %23 to i64
  %25 = add nsw i64 %24, 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 %25, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %26 unwind label %29

26:                                               ; preds = %20
  call void @_ZNSt6vectorIcSaIcEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19wif_sc_signed_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 %31

27:                                               ; preds = %10
  %28 = 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_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf) #6
  br label %51

29:                                               ; preds = %20
  %30 = 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

31:                                               ; preds = %26, %13
  %32 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19wif_sc_signed_trace5writeEP8_IO_FILEE3buf, i64 noundef 0) #6
  %33 = load ptr, ptr %15, align 8, !tbaa !6
  %34 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %33)
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %.lr.ph, label %._crit_edge

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

.lr.ph:                                           ; preds = %31, %.lr.ph
  %.0.in14 = phi i32 [ %.0, %.lr.ph ], [ %34, %31 ]
  %.0913 = phi ptr [ %49, %.lr.ph ], [ %32, %31 ]
  %.0 = add nsw i32 %.0.in14, -1
  %43 = load ptr, ptr %15, align 8, !tbaa !6
  %44 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5sc_dt9sc_signedixEi(ptr noundef nonnull align 8 dereferenceable(32) %43, i32 noundef %.0)
  %45 = call noundef zeroext i1 @_ZNK5sc_dt18sc_signed_bitref_r7to_boolEv(ptr noundef nonnull align 8 dereferenceable(24) %44)
  %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 !18
  %49 = getelementptr inbounds i8, ptr %.0913, i64 1
  store i8 %48, ptr %.0913, align 1, !tbaa !18
  %50 = icmp ugt i32 %.0.in14, 1
  br i1 %50, label %.lr.ph, label %._crit_edge, !llvm.loop !19

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5sc_dt9sc_signedixEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt18sc_signed_bitref_r7to_boolEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 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 = { "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_core19wif_sc_signed_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_dt9sc_signedE", !17, i64 0, !15, i64 8, !15, i64 12, !15, i64 16, !11, i64 24}
!17 = !{!"_ZTSN5sc_dt13sc_value_baseE"}
!18 = !{!12, !12, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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