; LLVM IR from gem5/gem5 :: ext/systemc/src/sysc/tracing (sc_vcd_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.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = 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::vcd_sc_signed_trace" = type { %"class.sc_core::vcd_trace.base", ptr, %"class.sc_dt::sc_signed" }
%"class.sc_core::vcd_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 }

@__dso_handle = external hidden global i8
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata = external hidden global %"class.std::vector.4", align 8
@_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata = external hidden global i64, align 8
@_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata = external hidden global %"class.std::vector.4", align 8
@_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata = external hidden global i64, align 8

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7sc_core9vcd_trace17compose_data_lineEPcS1_(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef, ptr noundef) #1 align 2

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

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

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

declare i32 @fputs(ptr noundef, ptr noundef) #4

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

; 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 #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 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)) #3 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)) #3 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) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 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)) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef %1) unnamed_addr #1 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 %"class.std::allocator", align 1
  %9 = alloca i64, align 8
  %10 = alloca %"class.std::vector.4", align 8
  %11 = alloca %"class.std::allocator", align 1
  %12 = alloca %"class.std::vector.4", align 8
  %13 = alloca %"class.std::allocator", align 1
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %3, align 8
  %17 = load atomic i8, ptr @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata acquire, align 8
  %18 = icmp eq i8 %17, 0
  br i1 %18, label %19, label %25, !prof !9

19:                                               ; preds = %2
  %20 = call i32 @__cxa_guard_acquire(ptr @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata) #0
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  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_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata, i64 noundef 1024, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %23 unwind label %52

23:                                               ; preds = %22
  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
  %24 = call i32 @__cxa_atexit(ptr @_ZNSt6vectorIcSaIcEED2Ev, ptr @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata, ptr @__dso_handle) #0
  call void @__cxa_guard_release(ptr @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata) #0
  br label %25

25:                                               ; preds = %23, %19, %2
  %26 = load atomic i8, ptr @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata acquire, align 8
  %27 = icmp eq i8 %26, 0
  br i1 %27, label %28, label %34, !prof !9

28:                                               ; preds = %25
  %29 = call i32 @__cxa_guard_acquire(ptr @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata) #0
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %34

31:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #0
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #0
  invoke void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata, i64 noundef 1024, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %32 unwind label %56

32:                                               ; preds = %31
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #0
  %33 = call i32 @__cxa_atexit(ptr @_ZNSt6vectorIcSaIcEED2Ev, ptr @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata, ptr @__dso_handle) #0
  call void @__cxa_guard_release(ptr @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata) #0
  br label %34

34:                                               ; preds = %32, %28, %25
  %35 = call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata) #0
  %36 = getelementptr inbounds %"class.sc_core::vcd_sc_signed_trace", ptr %16, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !10
  %38 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %37)
  %39 = sext i32 %38 to i64
  %40 = icmp ult i64 %35, %39
  br i1 %40, label %41, label %69

41:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #0
  %42 = getelementptr inbounds %"class.sc_core::vcd_sc_signed_trace", ptr %16, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !10
  %44 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %43)
  %45 = sext i32 %44 to i64
  %46 = add i64 %45, 4096
  %47 = and i64 %46, -4096
  store i64 %47, ptr %9, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #0
  %48 = load i64, ptr %9, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #0
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #0
  invoke void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %48, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %49 unwind label %60

49:                                               ; preds = %41
  call void @_ZNSt6vectorIcSaIcEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata) #0
  call void @_ZNSt6vectorIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #0
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #0
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #0
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #0
  %50 = load i64, ptr %9, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #0
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #0
  invoke void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %50, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %51 unwind label %64

51:                                               ; preds = %49
  call void @_ZNSt6vectorIcSaIcEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata) #0
  call void @_ZNSt6vectorIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #0
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #0
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #0
  br label %69

52:                                               ; preds = %22
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %6, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, 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_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata) #0
  br label %104

56:                                               ; preds = %31
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %6, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %7, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #0
  call void @__cxa_guard_abort(ptr @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata) #0
  br label %104

60:                                               ; preds = %41
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %6, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %7, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #0
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #0
  br label %68

64:                                               ; preds = %49
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %6, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %7, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #0
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #0
  br label %68

68:                                               ; preds = %64, %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #0
  br label %104

69:                                               ; preds = %51, %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #0
  %70 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata, i64 noundef 0) #0
  store ptr %70, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #0
  %71 = getelementptr inbounds %"class.sc_core::vcd_sc_signed_trace", ptr %16, i32 0, i32 1
  %72 = load ptr, ptr %71, align 8, !tbaa !10
  %73 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %72)
  %74 = sub nsw i32 %73, 1
  store i32 %74, ptr %15, align 4, !tbaa !20
  br label %75

75:                                               ; preds = %90, %69
  %76 = load i32, ptr %15, align 4, !tbaa !20
  %77 = icmp sge i32 %76, 0
  br i1 %77, label %79, label %78

78:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #0
  br label %93

79:                                               ; preds = %75
  %80 = getelementptr inbounds %"class.sc_core::vcd_sc_signed_trace", ptr %16, i32 0, i32 1
  %81 = load ptr, ptr %80, align 8, !tbaa !10
  %82 = load i32, ptr %15, align 4, !tbaa !20
  %83 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5sc_dt9sc_signedixEi(ptr noundef nonnull align 8 dereferenceable(32) %81, i32 noundef %82)
  %84 = call noundef zeroext i1 @_ZNK5sc_dt18sc_signed_bitref_r7to_boolEv(ptr noundef nonnull align 8 dereferenceable(24) %83)
  %85 = zext i1 %84 to i64
  %86 = getelementptr inbounds [3 x i8], ptr @.str.13, i64 0, i64 %85
  %87 = load i8, ptr %86, align 1, !tbaa !21
  %88 = load ptr, ptr %14, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %88, i32 1
  store ptr %89, ptr %14, align 8, !tbaa !5
  store i8 %87, ptr %88, align 1, !tbaa !21
  br label %90

90:                                               ; preds = %79
  %91 = load i32, ptr %15, align 4, !tbaa !20
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %15, align 4, !tbaa !20
  br label %75, !llvm.loop !22

93:                                               ; preds = %78
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  store i8 0, ptr %94, align 1, !tbaa !21
  %95 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata, i64 noundef 0) #0
  %96 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata, i64 noundef 0) #0
  call void @_ZN7sc_core9vcd_trace17compose_data_lineEPcS1_(ptr noundef nonnull align 8 dereferenceable(84) %16, ptr noundef %95, ptr noundef %96)
  %97 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata, i64 noundef 0) #0
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = call i32 @fputs(ptr noundef %97, ptr noundef %98)
  %100 = getelementptr inbounds %"class.sc_core::vcd_sc_signed_trace", ptr %16, i32 0, i32 1
  %101 = load ptr, ptr %100, align 8, !tbaa !10
  %102 = getelementptr inbounds %"class.sc_core::vcd_sc_signed_trace", ptr %16, i32 0, i32 2
  %103 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN5sc_dt9sc_signedaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %102, ptr noundef nonnull align 8 dereferenceable(32) %101)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #0
  ret void

104:                                              ; preds = %68, %56, %52
  %105 = load ptr, ptr %6, align 8
  %106 = load i32, ptr %7, align 4
  %107 = insertvalue { ptr, i32 } poison, ptr %105, 0
  %108 = insertvalue { ptr, i32 } %107, i32 %106, 1
  resume { ptr, i32 } %108
}

; 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) #1 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)) #1 align 2

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

attributes #0 = { nounwind }
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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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_core19vcd_sc_signed_traceE", !12, i64 0, !6, i64 88, !17, i64 96}
!12 = !{!"_ZTSN7sc_core9vcd_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.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = 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.13 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata = external hidden global %"class.std::vector.4", align 8
@_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata = external hidden global i64, align 8
@_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata = external hidden global %"class.std::vector.4", align 8
@_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata = 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 uwtable
declare dso_local void @_ZN7sc_core9vcd_trace17compose_data_lineEPcS1_(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fputs(ptr nocapture noundef readonly, ptr nocapture noundef) local_unnamed_addr #4

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

; 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 #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 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 #3 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 #3 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 #3 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 #3 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_core19vcd_sc_signed_trace5writeEP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr nocapture noundef %1) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca %"class.std::allocator", align 1
  %5 = alloca %"class.std::vector.4", align 8
  %6 = alloca %"class.std::allocator", align 1
  %7 = alloca %"class.std::vector.4", align 8
  %8 = alloca %"class.std::allocator", align 1
  %9 = load atomic i8, ptr @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata acquire, align 8
  %10 = icmp eq i8 %9, 0
  br i1 %10, label %11, label %16, !prof !5

11:                                               ; preds = %2
  %12 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata) #6
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %16, label %13

13:                                               ; preds = %11
  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_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata, i64 noundef 1024, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %14 unwind label %39

14:                                               ; preds = %13
  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
  %15 = call i32 @__cxa_atexit(ptr nonnull @_ZNSt6vectorIcSaIcEED2Ev, ptr nonnull @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata, ptr nonnull @__dso_handle) #6
  call void @__cxa_guard_release(ptr nonnull @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata) #6
  br label %16

16:                                               ; preds = %14, %11, %2
  %17 = load atomic i8, ptr @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata acquire, align 8
  %18 = icmp eq i8 %17, 0
  br i1 %18, label %19, label %24, !prof !5

19:                                               ; preds = %16
  %20 = call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata) #6
  %.not14 = icmp eq i32 %20, 0
  br i1 %.not14, label %24, label %21

21:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  invoke void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata, i64 noundef 1024, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %22 unwind label %41

22:                                               ; preds = %21
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  %23 = call i32 @__cxa_atexit(ptr nonnull @_ZNSt6vectorIcSaIcEED2Ev, ptr nonnull @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata, ptr nonnull @__dso_handle) #6
  call void @__cxa_guard_release(ptr nonnull @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata) #6
  br label %24

24:                                               ; preds = %22, %19, %16
  %25 = call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata) #6
  %26 = getelementptr inbounds i8, ptr %0, i64 88
  %27 = load ptr, ptr %26, align 8, !tbaa !6
  %28 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %27)
  %29 = sext i32 %28 to i64
  %30 = icmp ult i64 %25, %29
  br i1 %30, label %31, label %47

31:                                               ; preds = %24
  %32 = load ptr, ptr %26, align 8, !tbaa !6
  %33 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %32)
  %34 = and i32 %33, -4096
  %35 = sext i32 %34 to i64
  %36 = add nsw i64 %35, 4096
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #6
  invoke void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %36, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %37 unwind label %43

37:                                               ; preds = %31
  call void @_ZNSt6vectorIcSaIcEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata) #6
  call void @_ZNSt6vectorIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #6
  invoke void @_ZNSt6vectorIcSaIcEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %36, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %38 unwind label %45

38:                                               ; preds = %37
  call void @_ZNSt6vectorIcSaIcEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata) #6
  call void @_ZNSt6vectorIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  br label %47

39:                                               ; preds = %13
  %40 = 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_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata) #6
  br label %67

41:                                               ; preds = %21
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  call void @__cxa_guard_abort(ptr nonnull @_ZGVZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata) #6
  br label %67

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

45:                                               ; preds = %37
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  br label %67

47:                                               ; preds = %38, %24
  %48 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata, i64 noundef 0) #6
  %49 = load ptr, ptr %26, align 8, !tbaa !6
  %50 = call noundef i32 @_ZNK5sc_dt9sc_signed6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %49)
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %47
  %.010.lcssa = phi ptr [ %48, %47 ], [ %65, %.lr.ph ]
  store i8 0, ptr %.010.lcssa, align 1, !tbaa !18
  %52 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE7rawdata, i64 noundef 0) #6
  %53 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata, i64 noundef 0) #6
  call void @_ZN7sc_core9vcd_trace17compose_data_lineEPcS1_(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull %52, ptr noundef nonnull %53)
  %54 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZZN7sc_core19vcd_sc_signed_trace5writeEP8_IO_FILEE8compdata, i64 noundef 0) #6
  %55 = call i32 @fputs(ptr noundef nonnull %54, ptr noundef %1)
  %56 = load ptr, ptr %26, align 8, !tbaa !6
  %57 = getelementptr inbounds i8, ptr %0, i64 96
  %58 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN5sc_dt9sc_signedaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %57, ptr noundef nonnull align 8 dereferenceable(32) %56)
  ret void

.lr.ph:                                           ; preds = %47, %.lr.ph
  %.0.in18 = phi i32 [ %.0, %.lr.ph ], [ %50, %47 ]
  %.01017 = phi ptr [ %65, %.lr.ph ], [ %48, %47 ]
  %.0 = add nsw i32 %.0.in18, -1
  %59 = load ptr, ptr %26, align 8, !tbaa !6
  %60 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5sc_dt9sc_signedixEi(ptr noundef nonnull align 8 dereferenceable(32) %59, i32 noundef %.0)
  %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.13, i64 0, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !18
  %65 = getelementptr inbounds i8, ptr %.01017, i64 1
  store i8 %64, ptr %.01017, align 1, !tbaa !18
  %66 = icmp ugt i32 %.0.in18, 1
  br i1 %66, label %.lr.ph, label %._crit_edge, !llvm.loop !19

67:                                               ; preds = %43, %45, %41, %39
  %.pn.pn = phi { ptr, i32 } [ %42, %41 ], [ %40, %39 ], [ %46, %45 ], [ %44, %43 ]
  resume { ptr, i32 } %.pn.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 #1 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 #1 align 2

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

attributes #0 = { nofree nounwind }
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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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_core19vcd_sc_signed_traceE", !8, i64 0, !11, i64 88, !16, i64 96}
!8 = !{!"_ZTSN7sc_core9vcd_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