; LLVM IR from turi-code/SFrame :: oss_src/logger/logger.ll (ZN11file_logger12start_streamEiPKcS1_ib)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.0 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.0 = type { i64, [8 x i8] }
%"class.std::fpos" = type { i64, %struct.__mbstate_t }
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%class.file_logger = type { %"class.std::basic_ofstream", %"class.std::__cxx11::basic_string", i32, i32, %union.pthread_mutex_t, i8, i8, i32, i64, [8 x %"class.std::function"], [8 x i32] }
%"class.std::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"struct.logger_impl::streambuff_tls_entry" = type <{ %"class.std::__cxx11::basic_stringstream", i8, [7 x i8], i64, i32, [4 x i8] }>
%"class.std::__cxx11::basic_stringstream" = type { %"class.std::basic_iostream.base", %"class.std::__cxx11::basic_stringbuf", %"class.std::basic_ios" }
%"class.std::basic_iostream.base" = type { %"class.std::basic_istream.base", %"class.std::basic_ostream.base" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }

@messages = external dso_local global [8 x ptr], align 16
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1

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) #0

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #1

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

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

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

; Function Attrs: nounwind willreturn memory(read)
declare noundef ptr @strrchr(ptr noundef, i32 noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_logger12start_streamEiPKcS1_ib(ptr noundef nonnull align 8 dereferenceable(896) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i1 noundef zeroext %5) #5 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::__cxx11::basic_string", align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca %"class.std::__cxx11::basic_string", align 8
  %23 = alloca %"class.std::fpos", align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i32 %4, ptr %12, align 4, !tbaa !9
  %24 = zext i1 %5 to i8
  store i8 %24, ptr %13, align 1, !tbaa !11
  %25 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %26 = getelementptr inbounds %class.file_logger, ptr %25, i32 0, i32 2
  %27 = load i32, ptr %26, align 8, !tbaa !13
  %28 = call ptr @pthread_getspecific(i32 noundef %27) #9
  store ptr %28, ptr %14, align 8, !tbaa !5
  %29 = load ptr, ptr %14, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %42

31:                                               ; preds = %6
  %32 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 416) #10
  invoke void @_ZN11logger_impl20streambuff_tls_entryC2Ev(ptr noundef nonnull align 8 dereferenceable(412) %32)
          to label %33 unwind label %38

33:                                               ; preds = %31
  store ptr %32, ptr %14, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.file_logger, ptr %25, i32 0, i32 2
  %35 = load i32, ptr %34, align 8, !tbaa !13
  %36 = load ptr, ptr %14, align 8, !tbaa !5
  %37 = call i32 @pthread_setspecific(i32 noundef %35, ptr noundef %36) #9
  br label %42

38:                                               ; preds = %31
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %15, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %16, align 4
  call void @_ZdlPvm(ptr noundef %32, i64 noundef 416) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  br label %123

42:                                               ; preds = %33, %6
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #9
  %43 = load ptr, ptr %14, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.logger_impl::streambuff_tls_entry", ptr %43, i32 0, i32 0
  call void @_ZNKSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEE3strEv(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %17, ptr noundef nonnull align 8 dereferenceable(128) %44)
  %45 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %17) #9
  %46 = icmp ugt i64 %45, 0
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #9
  br i1 %46, label %47, label %49

47:                                               ; preds = %42
  %48 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPFRSoS0_E(ptr noundef nonnull align 8 dereferenceable(896) %25, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %49

49:                                               ; preds = %47, %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %50 = load ptr, ptr %14, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.logger_impl::streambuff_tls_entry", ptr %50, i32 0, i32 0
  store ptr %51, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  %52 = load ptr, ptr %14, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.logger_impl::streambuff_tls_entry", ptr %52, i32 0, i32 1
  store ptr %53, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  %54 = load ptr, ptr %14, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.logger_impl::streambuff_tls_entry", ptr %54, i32 0, i32 3
  store ptr %55, ptr %20, align 8, !tbaa !5
  %56 = load i32, ptr %9, align 4, !tbaa !9
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.logger_impl::streambuff_tls_entry", ptr %57, i32 0, i32 4
  store i32 %56, ptr %58, align 8, !tbaa !26
  %59 = load i32, ptr %9, align 4, !tbaa !9
  %60 = getelementptr inbounds %class.file_logger, ptr %25, i32 0, i32 7
  %61 = load i32, ptr %60, align 4, !tbaa !32
  %62 = icmp sge i32 %59, %61
  br i1 %62, label %63, label %118

63:                                               ; preds = %49
  %64 = load i8, ptr %13, align 1, !tbaa !11, !range !33, !noundef !34
  %65 = trunc i8 %64 to i1
  %66 = zext i1 %65 to i32
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %70

68:                                               ; preds = %63
  %69 = load ptr, ptr %19, align 8, !tbaa !5
  store i8 0, ptr %69, align 1, !tbaa !11
  store ptr %25, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %121

70:                                               ; preds = %63
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = call noundef ptr @strrchr(ptr noundef %71, i32 noundef 47) #12
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %75

74:                                               ; preds = %70
  br label %78

75:                                               ; preds = %70
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %76, i64 -1
  br label %78

78:                                               ; preds = %75, %74
  %79 = phi ptr [ %72, %74 ], [ %77, %75 ]
  %80 = getelementptr inbounds i8, ptr %79, i64 1
  store ptr %80, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %22) #9
  %81 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZNKSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEE3strEv(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %22, ptr noundef nonnull align 8 dereferenceable(128) %81)
  %82 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %22) #9
  %83 = icmp eq i64 %82, 0
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %22) #9
  br i1 %83, label %84, label %105

84:                                               ; preds = %78
  %85 = load ptr, ptr %18, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %85, i64 16
  %87 = call i64 @time(ptr noundef null) #9
  %88 = trunc i64 %87 to i32
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %86, i32 noundef %88)
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %89, ptr noundef @.str.16)
  %91 = load i32, ptr %9, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [8 x ptr], ptr @messages, i64 0, i64 %92
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %90, ptr noundef %94)
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %95, ptr noundef %96)
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %97, ptr noundef @.str.17)
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %98, ptr noundef %99)
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %100, ptr noundef @.str.18)
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %101, i32 noundef %102)
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %103, ptr noundef @.str.19)
  br label %105

105:                                              ; preds = %84, %78
  %106 = load ptr, ptr %19, align 8, !tbaa !5
  store i8 1, ptr %106, align 1, !tbaa !11
  %107 = load i32, ptr %9, align 4, !tbaa !9
  %108 = getelementptr inbounds %class.file_logger, ptr %25, i32 0, i32 3
  store i32 %107, ptr %108, align 4, !tbaa !35
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #9
  %109 = load ptr, ptr %18, align 8, !tbaa !5
  %110 = getelementptr inbounds i8, ptr %109, i64 16
  %111 = call { i64, i64 } @_ZNSo5tellpEv(ptr noundef nonnull align 8 dereferenceable(8) %110)
  %112 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 0
  %113 = extractvalue { i64, i64 } %111, 0
  store i64 %113, ptr %112, align 8
  %114 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 1
  %115 = extractvalue { i64, i64 } %111, 1
  store i64 %115, ptr %114, align 8
  %116 = call noundef i64 @_ZNKSt4fposI11__mbstate_tEcvlEv(ptr noundef nonnull align 8 dereferenceable(16) %23)
  %117 = load ptr, ptr %20, align 8, !tbaa !5
  store i64 %116, ptr %117, align 8, !tbaa !36
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #9
  br label %120

118:                                              ; preds = %49
  %119 = load ptr, ptr %19, align 8, !tbaa !5
  store i8 0, ptr %119, align 1, !tbaa !11
  br label %120

120:                                              ; preds = %118, %105
  store ptr %25, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %121

121:                                              ; preds = %120, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  %122 = load ptr, ptr %7, align 8
  ret ptr %122

123:                                              ; preds = %38
  %124 = load ptr, ptr %15, align 8
  %125 = load i32, ptr %16, align 4
  %126 = insertvalue { ptr, i32 } poison, ptr %124, 0
  %127 = insertvalue { ptr, i32 } %126, i32 %125, 1
  resume { ptr, i32 } %127
}

; Function Attrs: nounwind
declare ptr @pthread_getspecific(i32 noundef) #6

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN11logger_impl20streambuff_tls_entryC2Ev(ptr noundef nonnull align 8 dereferenceable(412)) unnamed_addr #4 align 2

; Function Attrs: nounwind
declare i32 @pthread_setspecific(i32 noundef, ptr noundef) #6

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEE3strEv(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(128)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPFRSoS0_E(ptr noundef nonnull align 8 dereferenceable(896), ptr noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #8

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #6

declare { i64, i64 } @_ZNSo5tellpEv(ptr noundef nonnull align 8 dereferenceable(8)) #8

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 willreturn memory(read) "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 = { 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 #5 = { 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 "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 #7 = { nobuiltin allocsize(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 #8 = { "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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin nounwind }
attributes #12 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !10, i64 544}
!14 = !{!"_ZTS11file_logger", !15, i64 0, !24, i64 512, !10, i64 544, !10, i64 548, !7, i64 552, !12, i64 592, !12, i64 593, !10, i64 596, !23, i64 600, !7, i64 608, !7, i64 864}
!15 = !{!"_ZTSSt14basic_ofstreamIcSt11char_traitsIcEE", !16, i64 0, !17, i64 8}
!16 = !{!"_ZTSSo"}
!17 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !18, i64 0, !7, i64 64, !20, i64 104, !21, i64 120, !22, i64 124, !22, i64 132, !22, i64 140, !6, i64 152, !23, i64 160, !12, i64 168, !12, i64 169, !12, i64 170, !7, i64 171, !6, i64 176, !6, i64 184, !12, i64 192, !6, i64 200, !6, i64 208, !23, i64 216, !6, i64 224, !6, i64 232}
!18 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !19, i64 56}
!19 = !{!"_ZTSSt6locale", !6, i64 0}
!20 = !{!"_ZTSSt12__basic_fileIcE", !6, i64 0, !12, i64 8}
!21 = !{!"_ZTSSt13_Ios_Openmode", !7, i64 0}
!22 = !{!"_ZTS11__mbstate_t", !10, i64 0, !7, i64 4}
!23 = !{!"long", !7, i64 0}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !25, i64 0, !23, i64 8, !7, i64 16}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!26 = !{!27, !10, i64 408}
!27 = !{!"_ZTSN11logger_impl20streambuff_tls_entryE", !28, i64 0, !12, i64 392, !23, i64 400, !10, i64 408}
!28 = !{!"_ZTSNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE", !29, i64 0, !31, i64 24}
!29 = !{!"_ZTSSd", !30, i64 0, !16, i64 16}
!30 = !{!"_ZTSSi", !23, i64 8}
!31 = !{!"_ZTSNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE", !18, i64 0, !21, i64 64, !24, i64 72}
!32 = !{!14, !10, i64 596}
!33 = !{i8 0, i8 2}
!34 = !{}
!35 = !{!14, !10, i64 548}
!36 = !{!23, !23, i64 0}


; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.0 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.0 = type { i64, [8 x i8] }
%"class.std::fpos" = type { i64, %struct.__mbstate_t }
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }

@messages = external dso_local local_unnamed_addr global [8 x ptr], align 16
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1

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) #0

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare noundef ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_logger12start_streamEiPKcS1_ib(ptr noundef nonnull returned align 8 dereferenceable(896) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i1 noundef zeroext %5) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::fpos", align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 544
  %11 = load i32, ptr %10, align 8, !tbaa !5
  %12 = tail call ptr @pthread_getspecific(i32 noundef %11) #9
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %21

14:                                               ; preds = %6
  %15 = tail call noalias noundef nonnull dereferenceable(416) ptr @_Znwm(i64 noundef 416) #10
  invoke void @_ZN11logger_impl20streambuff_tls_entryC2Ev(ptr noundef nonnull align 8 dereferenceable(412) %15)
          to label %16 unwind label %19

16:                                               ; preds = %14
  %17 = load i32, ptr %10, align 8, !tbaa !5
  %18 = tail call i32 @pthread_setspecific(i32 noundef %17, ptr noundef nonnull %15) #9
  br label %21

19:                                               ; preds = %14
  %20 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %15, i64 noundef 416) #11
  resume { ptr, i32 } %20

21:                                               ; preds = %16, %6
  %.027 = phi ptr [ %15, %16 ], [ %12, %6 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #9
  call void @_ZNKSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEE3strEv(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %7, ptr noundef nonnull align 8 dereferenceable(128) %.027)
  %22 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %7) #9
  %.not = icmp eq i64 %22, 0
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #9
  br i1 %.not, label %25, label %23

23:                                               ; preds = %21
  %24 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPFRSoS0_E(ptr noundef nonnull align 8 dereferenceable(896) %0, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %25

25:                                               ; preds = %23, %21
  %26 = getelementptr inbounds i8, ptr %.027, i64 392
  %27 = getelementptr inbounds i8, ptr %.027, i64 400
  %28 = getelementptr inbounds i8, ptr %.027, i64 408
  store i32 %1, ptr %28, align 8, !tbaa !23
  %29 = getelementptr inbounds i8, ptr %0, i64 596
  %30 = load i32, ptr %29, align 4, !tbaa !29
  %.not29 = icmp sgt i32 %30, %1
  br i1 %.not29, label %64, label %31

31:                                               ; preds = %25
  br i1 %5, label %33, label %32

32:                                               ; preds = %31
  store i8 0, ptr %26, align 1, !tbaa !30
  br label %65

33:                                               ; preds = %31
  %34 = call noundef ptr @strrchr(ptr noundef nonnull dereferenceable(1) %2, i32 noundef 47) #12
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #9
  call void @_ZNKSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEE3strEv(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %8, ptr noundef nonnull align 8 dereferenceable(128) %.027)
  %35 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %8) #9
  %36 = icmp eq i64 %35, 0
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #9
  br i1 %36, label %37, label %56

37:                                               ; preds = %33
  %.not30 = icmp eq ptr %34, null
  %38 = getelementptr inbounds i8, ptr %2, i64 -1
  %39 = select i1 %.not30, ptr %38, ptr %34
  %40 = getelementptr inbounds i8, ptr %39, i64 1
  %41 = getelementptr inbounds i8, ptr %.027, i64 16
  %42 = call i64 @time(ptr noundef null) #9
  %43 = trunc i64 %42 to i32
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %41, i32 noundef %43)
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %44, ptr noundef nonnull @.str.16)
  %46 = sext i32 %1 to i64
  %47 = getelementptr inbounds [8 x ptr], ptr @messages, i64 0, i64 %46
  %48 = load ptr, ptr %47, align 8, !tbaa !31
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %45, ptr noundef %48)
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef nonnull %40)
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %50, ptr noundef nonnull @.str.17)
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef %3)
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull @.str.18)
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %53, i32 noundef %4)
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %54, ptr noundef nonnull @.str.19)
  br label %56

56:                                               ; preds = %37, %33
  store i8 1, ptr %26, align 1, !tbaa !30
  %57 = getelementptr inbounds i8, ptr %0, i64 548
  store i32 %1, ptr %57, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #9
  %58 = getelementptr inbounds i8, ptr %.027, i64 16
  %59 = call { i64, i64 } @_ZNSo5tellpEv(ptr noundef nonnull align 8 dereferenceable(8) %58)
  %60 = extractvalue { i64, i64 } %59, 0
  store i64 %60, ptr %9, align 8
  %61 = getelementptr inbounds i8, ptr %9, i64 8
  %62 = extractvalue { i64, i64 } %59, 1
  store i64 %62, ptr %61, align 8
  %63 = call noundef i64 @_ZNKSt4fposI11__mbstate_tEcvlEv(ptr noundef nonnull align 8 dereferenceable(16) %9)
  store i64 %63, ptr %27, align 8, !tbaa !33
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #9
  br label %65

64:                                               ; preds = %25
  store i8 0, ptr %26, align 1, !tbaa !30
  br label %65

65:                                               ; preds = %56, %64, %32
  ret ptr %0
}

; Function Attrs: nounwind
declare ptr @pthread_getspecific(i32 noundef) local_unnamed_addr #6

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN11logger_impl20streambuff_tls_entryC2Ev(ptr noundef nonnull align 8 dereferenceable(412)) unnamed_addr #4 align 2

; Function Attrs: nounwind
declare i32 @pthread_setspecific(i32 noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEE3strEv(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPFRSoS0_E(ptr noundef nonnull align 8 dereferenceable(896), ptr noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #8

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #6

declare { i64, i64 } @_ZNSo5tellpEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #8

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { 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 #5 = { 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 "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 #7 = { nobuiltin allocsize(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 #8 = { "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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin nounwind }
attributes #12 = { nounwind willreturn memory(read) }

!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, !19, i64 544}
!6 = !{!"_ZTS11file_logger", !7, i64 0, !21, i64 512, !19, i64 544, !19, i64 548, !12, i64 552, !16, i64 592, !16, i64 593, !19, i64 596, !20, i64 600, !12, i64 608, !12, i64 864}
!7 = !{!"_ZTSSt14basic_ofstreamIcSt11char_traitsIcEE", !8, i64 0, !9, i64 8}
!8 = !{!"_ZTSSo"}
!9 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !10, i64 0, !12, i64 64, !15, i64 104, !17, i64 120, !18, i64 124, !18, i64 132, !18, i64 140, !11, i64 152, !20, i64 160, !16, i64 168, !16, i64 169, !16, i64 170, !12, i64 171, !11, i64 176, !11, i64 184, !16, i64 192, !11, i64 200, !11, i64 208, !20, i64 216, !11, i64 224, !11, i64 232}
!10 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !14, i64 56}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSSt6locale", !11, i64 0}
!15 = !{!"_ZTSSt12__basic_fileIcE", !11, i64 0, !16, i64 8}
!16 = !{!"bool", !12, i64 0}
!17 = !{!"_ZTSSt13_Ios_Openmode", !12, i64 0}
!18 = !{!"_ZTS11__mbstate_t", !19, i64 0, !12, i64 4}
!19 = !{!"int", !12, i64 0}
!20 = !{!"long", !12, i64 0}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !22, i64 0, !20, i64 8, !12, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !11, i64 0}
!23 = !{!24, !19, i64 408}
!24 = !{!"_ZTSN11logger_impl20streambuff_tls_entryE", !25, i64 0, !16, i64 392, !20, i64 400, !19, i64 408}
!25 = !{!"_ZTSNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE", !26, i64 0, !28, i64 24}
!26 = !{!"_ZTSSd", !27, i64 0, !8, i64 16}
!27 = !{!"_ZTSSi", !20, i64 8}
!28 = !{!"_ZTSNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE", !10, i64 0, !17, i64 64, !21, i64 72}
!29 = !{!6, !19, i64 596}
!30 = !{!16, !16, i64 0}
!31 = !{!11, !11, i64 0}
!32 = !{!6, !19, i64 548}
!33 = !{!20, !20, i64 0}


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