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

; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"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 }
%"class.std::locale" = type { ptr }
%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::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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] }
%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 } }

@messages = external dso_local global [8 x ptr], align 16
@.str.13 = external hidden unnamed_addr constant [14 x i8], align 1
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str.14 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) #1

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

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt8functionIFviPKcmEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNKSt8functionIFviPKcmEEclEiS1_m(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, ptr noundef, i64 noundef) #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11file_logger7_logbufEiPKcS1_iS1_i(ptr noundef nonnull align 8 dereferenceable(896) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6) #4 align 2 {
  %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 ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca [2048 x i8], align 16
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i64, 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
  store ptr %5, ptr %13, align 8, !tbaa !5
  store i32 %6, ptr %14, align 4, !tbaa !9
  %21 = load ptr, ptr %8, align 8
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = getelementptr inbounds %class.file_logger, ptr %21, i32 0, i32 7
  %24 = load i32, ptr %23, align 4, !tbaa !11
  %25 = icmp sge i32 %22, %24
  br i1 %25, label %26, label %121

26:                                               ; preds = %7
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = call noundef ptr @strrchr(ptr noundef %27, i32 noundef 47) #7
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  br label %34

31:                                               ; preds = %26
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 -1
  br label %34

34:                                               ; preds = %31, %30
  %35 = phi ptr [ %28, %30 ], [ %33, %31 ]
  %36 = getelementptr inbounds i8, ptr %35, i64 1
  store ptr %36, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [8 x ptr], ptr @messages, i64 0, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  %43 = load i32, ptr %12, align 4, !tbaa !9
  %44 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef null, i64 noundef 0, ptr noundef @.str.13, ptr noundef %40, ptr noundef %41, ptr noundef %42, i32 noundef %43) #8
  %45 = sext i32 %44 to i64
  store i64 %45, ptr %15, align 8, !tbaa !25
  %46 = load i64, ptr %15, align 8, !tbaa !25
  %47 = icmp ugt i64 %46, 2047
  br i1 %47, label %48, label %50

48:                                               ; preds = %34
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str.14)
  br label %120

50:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 2048, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  store ptr @.str.15, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %51 = getelementptr inbounds [2048 x i8], ptr %16, i64 0, i64 0
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [8 x ptr], ptr @messages, i64 0, i64 %53
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  %58 = load i32, ptr %12, align 4, !tbaa !9
  %59 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %51, i64 noundef 2047, ptr noundef @.str.13, ptr noundef %55, ptr noundef %56, ptr noundef %57, i32 noundef %58) #8
  store i32 %59, ptr %18, align 4, !tbaa !9
  %60 = load i32, ptr %18, align 4, !tbaa !9
  %61 = load i32, ptr %14, align 4, !tbaa !9
  %62 = add nsw i32 %60, %61
  %63 = sext i32 %62 to i64
  %64 = load ptr, ptr %17, align 8, !tbaa !5
  %65 = call i64 @strlen(ptr noundef %64) #7
  %66 = add i64 %63, %65
  %67 = add i64 %66, 1
  %68 = call ptr @llvm.stacksave.p0()
  store ptr %68, ptr %19, align 8
  %69 = alloca i8, i64 %67, align 16
  store i64 %67, ptr %20, align 8
  %70 = getelementptr inbounds i8, ptr %69, i64 0
  store i8 0, ptr %70, align 16, !tbaa !26
  %71 = getelementptr inbounds [2048 x i8], ptr %16, i64 0, i64 0
  %72 = load i32, ptr %18, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = call ptr @strncpy(ptr noundef %69, ptr noundef %71, i64 noundef %73) #8
  %75 = load ptr, ptr %13, align 8, !tbaa !5
  %76 = load i32, ptr %14, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = call ptr @strncat(ptr noundef %69, ptr noundef %75, i64 noundef %77) #8
  %79 = load ptr, ptr %17, align 8, !tbaa !5
  %80 = load ptr, ptr %17, align 8, !tbaa !5
  %81 = call i64 @strlen(ptr noundef %80) #7
  %82 = call ptr @strncat(ptr noundef %69, ptr noundef %79, i64 noundef %81) #8
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = load i32, ptr %18, align 4, !tbaa !9
  %85 = load i32, ptr %14, align 4, !tbaa !9
  %86 = add nsw i32 %84, %85
  %87 = sext i32 %86 to i64
  %88 = load ptr, ptr %17, align 8, !tbaa !5
  %89 = call i64 @strlen(ptr noundef %88) #7
  %90 = add i64 %87, %89
  %91 = trunc i64 %90 to i32
  call void @_ZN11file_logger7_lograwEiPKci(ptr noundef nonnull align 8 dereferenceable(896) %21, i32 noundef %83, ptr noundef %69, i32 noundef %91)
  %92 = getelementptr inbounds %class.file_logger, ptr %21, i32 0, i32 10
  %93 = load i32, ptr %9, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [8 x i32], ptr %92, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !9
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %118

98:                                               ; preds = %50
  %99 = getelementptr inbounds %class.file_logger, ptr %21, i32 0, i32 4
  %100 = call i32 @pthread_mutex_lock(ptr noundef %99) #8
  %101 = getelementptr inbounds %class.file_logger, ptr %21, i32 0, i32 9
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [8 x %"class.std::function"], ptr %101, i64 0, i64 %103
  %105 = call noundef zeroext i1 @_ZNKSt8functionIFviPKcmEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32) %104) #8
  br i1 %105, label %106, label %115

106:                                              ; preds = %98
  %107 = getelementptr inbounds %class.file_logger, ptr %21, i32 0, i32 9
  %108 = load i32, ptr %9, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [8 x %"class.std::function"], ptr %107, i64 0, i64 %109
  %111 = load i32, ptr %9, align 4, !tbaa !9
  %112 = load ptr, ptr %13, align 8, !tbaa !5
  %113 = load i32, ptr %14, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  call void @_ZNKSt8functionIFviPKcmEEclEiS1_m(ptr noundef nonnull align 8 dereferenceable(32) %110, i32 noundef %111, ptr noundef %112, i64 noundef %114)
  br label %115

115:                                              ; preds = %106, %98
  %116 = getelementptr inbounds %class.file_logger, ptr %21, i32 0, i32 4
  %117 = call i32 @pthread_mutex_unlock(ptr noundef %116) #8
  br label %118

118:                                              ; preds = %115, %50
  %119 = load ptr, ptr %19, align 8
  call void @llvm.stackrestore.p0(ptr %119)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 2048, ptr %16) #8
  br label %120

120:                                              ; preds = %118, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %121

121:                                              ; preds = %120, %7
  ret void
}

; 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) #5

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #6

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nounwind
declare ptr @strncat(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 #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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind willreturn }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 596}
!12 = !{!"_ZTS11file_logger", !13, i64 0, !23, i64 512, !10, i64 544, !10, i64 548, !7, i64 552, !19, i64 592, !19, i64 593, !10, i64 596, !22, i64 600, !7, i64 608, !7, i64 864}
!13 = !{!"_ZTSSt14basic_ofstreamIcSt11char_traitsIcEE", !14, i64 0, !15, i64 8}
!14 = !{!"_ZTSSo"}
!15 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !16, i64 0, !7, i64 64, !18, i64 104, !20, i64 120, !21, i64 124, !21, i64 132, !21, i64 140, !6, i64 152, !22, i64 160, !19, i64 168, !19, i64 169, !19, i64 170, !7, i64 171, !6, i64 176, !6, i64 184, !19, i64 192, !6, i64 200, !6, i64 208, !22, i64 216, !6, i64 224, !6, i64 232}
!16 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !17, i64 56}
!17 = !{!"_ZTSSt6locale", !6, i64 0}
!18 = !{!"_ZTSSt12__basic_fileIcE", !6, i64 0, !19, i64 8}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTSSt13_Ios_Openmode", !7, i64 0}
!21 = !{!"_ZTS11__mbstate_t", !10, i64 0, !7, i64 4}
!22 = !{!"long", !7, i64 0}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !24, i64 0, !22, i64 8, !7, i64 16}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!25 = !{!22, !22, i64 0}
!26 = !{!7, !7, 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"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 }
%"class.std::locale" = type { 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 } }

@messages = external dso_local local_unnamed_addr global [8 x ptr], align 16
@.str.13 = external hidden unnamed_addr constant [14 x i8], align 1
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str.14 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt8functionIFviPKcmEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNKSt8functionIFviPKcmEEclEiS1_m(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11file_logger7_lograwEiPKci(ptr noundef nonnull align 8 dereferenceable(896), i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11file_logger7_logbufEiPKcS1_iS1_i(ptr noundef nonnull align 8 dereferenceable(896) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6) local_unnamed_addr #5 align 2 {
  %8 = alloca [2048 x i8], align 16
  %9 = getelementptr inbounds i8, ptr %0, i64 596
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %.not = icmp sgt i32 %10, %1
  br i1 %.not, label %53, label %11

11:                                               ; preds = %7
  %12 = tail call noundef ptr @strrchr(ptr noundef nonnull dereferenceable(1) %2, i32 noundef 47) #9
  %.not31 = icmp eq ptr %12, null
  %13 = getelementptr inbounds i8, ptr %2, i64 -1
  %14 = select i1 %.not31, ptr %13, ptr %12
  %15 = getelementptr inbounds i8, ptr %14, i64 1
  %16 = sext i32 %1 to i64
  %17 = getelementptr inbounds [8 x ptr], ptr @messages, i64 0, i64 %16
  %18 = load ptr, ptr %17, align 8, !tbaa !23
  %19 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef null, i64 noundef 0, ptr noundef nonnull @.str.13, ptr noundef %18, ptr noundef nonnull %15, ptr noundef %3, i32 noundef %4) #10
  %20 = icmp ugt i32 %19, 2047
  br i1 %20, label %21, label %23

21:                                               ; preds = %11
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str.14)
  br label %53

23:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %8) #10
  %24 = load ptr, ptr %17, align 8, !tbaa !23
  %25 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %8, i64 noundef 2047, ptr noundef nonnull @.str.13, ptr noundef %24, ptr noundef nonnull %15, ptr noundef %3, i32 noundef %4) #10
  %26 = add nsw i32 %25, %6
  %27 = sext i32 %26 to i64
  %28 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @.str.15) #9
  %29 = add i64 %28, 1
  %30 = add i64 %29, %27
  %31 = tail call ptr @llvm.stacksave.p0()
  %32 = alloca i8, i64 %30, align 16
  store i8 0, ptr %32, align 16, !tbaa !24
  %33 = sext i32 %25 to i64
  %34 = call ptr @strncpy(ptr noundef nonnull %32, ptr noundef nonnull %8, i64 noundef %33) #10
  %35 = sext i32 %6 to i64
  %36 = call ptr @strncat(ptr noundef nonnull dereferenceable(1) %32, ptr noundef %5, i64 noundef %35) #10
  %37 = call ptr @strncat(ptr noundef nonnull dereferenceable(1) %32, ptr noundef nonnull @.str.15, i64 noundef %28) #10
  %38 = trunc i64 %28 to i32
  %39 = add i32 %26, %38
  call void @_ZN11file_logger7_lograwEiPKci(ptr noundef nonnull align 8 dereferenceable(896) %0, i32 noundef %1, ptr noundef nonnull %32, i32 noundef %39)
  %40 = getelementptr inbounds i8, ptr %0, i64 864
  %41 = getelementptr inbounds [8 x i32], ptr %40, i64 0, i64 %16
  %42 = load i32, ptr %41, align 4, !tbaa !25
  %.not32 = icmp eq i32 %42, 0
  br i1 %.not32, label %52, label %43

43:                                               ; preds = %23
  %44 = getelementptr inbounds i8, ptr %0, i64 552
  %45 = call i32 @pthread_mutex_lock(ptr noundef nonnull %44) #10
  %46 = getelementptr inbounds i8, ptr %0, i64 608
  %47 = getelementptr inbounds [8 x %"class.std::function"], ptr %46, i64 0, i64 %16
  %48 = call noundef zeroext i1 @_ZNKSt8functionIFviPKcmEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32) %47) #10
  br i1 %48, label %49, label %50

49:                                               ; preds = %43
  call void @_ZNKSt8functionIFviPKcmEEclEiS1_m(ptr noundef nonnull align 8 dereferenceable(32) %47, i32 noundef %1, ptr noundef %5, i64 noundef %35)
  br label %50

50:                                               ; preds = %49, %43
  %51 = call i32 @pthread_mutex_unlock(ptr noundef nonnull %44) #10
  br label %52

52:                                               ; preds = %50, %23
  call void @llvm.stackrestore.p0(ptr %31)
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %8) #10
  br label %53

53:                                               ; preds = %21, %52, %7
  ret void
}

; 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 #6

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #7

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #8

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #8

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 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 #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 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 #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 = { 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 #7 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #8 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 willreturn memory(read) }
attributes #10 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !19, i64 596}
!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 = !{!11, !11, i64 0}
!24 = !{!12, !12, i64 0}
!25 = !{!19, !19, i64 0}


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