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

; 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 } }

@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@stderr = external global ptr, align 8
@stdout = external global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4goodEv(ptr noundef nonnull align 8 dereferenceable(264)) #1 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8)) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z9textcolorP8_IO_FILEii(ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z11reset_colorP8_IO_FILE(ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11file_logger7_lograwEiPKci(ptr noundef nonnull align 8 dereferenceable(896) %0, i32 noundef %1, ptr noundef %2, i32 noundef %3) #3 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  %9 = load ptr, ptr %5, align 8
  %10 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 4
  %11 = call i32 @pthread_mutex_lock(ptr noundef %10) #4
  %12 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr %12, i64 %15
  %17 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4goodEv(ptr noundef nonnull align 8 dereferenceable(264) %16)
  br i1 %17, label %18, label %26

18:                                               ; preds = %4
  %19 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 0
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = load i32, ptr %8, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef %20, i64 noundef %22)
  %24 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 0
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8) %24)
  br label %26

26:                                               ; preds = %18, %4
  %27 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 4
  %28 = call i32 @pthread_mutex_unlock(ptr noundef %27) #4
  %29 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 5
  %30 = load i8, ptr %29, align 8, !tbaa !13, !range !27, !noundef !28
  %31 = trunc i8 %30 to i1
  br i1 %31, label %36, label %32

32:                                               ; preds = %26
  %33 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 6
  %34 = load i8, ptr %33, align 1, !tbaa !29, !range !27, !noundef !28
  %35 = trunc i8 %34 to i1
  br i1 %35, label %36, label %137

36:                                               ; preds = %32, %26
  %37 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 4
  %38 = call i32 @pthread_mutex_lock(ptr noundef %37) #4
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = icmp eq i32 %39, 7
  br i1 %40, label %41, label %43

41:                                               ; preds = %36
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @_Z9textcolorP8_IO_FILEii(ptr noundef %42, i32 noundef 1, i32 noundef 1)
  br label %99

43:                                               ; preds = %36
  %44 = load i32, ptr %6, align 4, !tbaa !9
  %45 = icmp eq i32 %44, 6
  br i1 %45, label %46, label %56

46:                                               ; preds = %43
  %47 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 6
  %48 = load i8, ptr %47, align 1, !tbaa !29, !range !27, !noundef !28
  %49 = trunc i8 %48 to i1
  br i1 %49, label %50, label %52

50:                                               ; preds = %46
  %51 = load ptr, ptr @stderr, align 8, !tbaa !5
  br label %54

52:                                               ; preds = %46
  %53 = load ptr, ptr @stdout, align 8, !tbaa !5
  br label %54

54:                                               ; preds = %52, %50
  %55 = phi ptr [ %51, %50 ], [ %53, %52 ]
  call void @_Z9textcolorP8_IO_FILEii(ptr noundef %55, i32 noundef 1, i32 noundef 1)
  br label %98

56:                                               ; preds = %43
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = icmp eq i32 %57, 5
  br i1 %58, label %59, label %69

59:                                               ; preds = %56
  %60 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 6
  %61 = load i8, ptr %60, align 1, !tbaa !29, !range !27, !noundef !28
  %62 = trunc i8 %61 to i1
  br i1 %62, label %63, label %65

63:                                               ; preds = %59
  %64 = load ptr, ptr @stderr, align 8, !tbaa !5
  br label %67

65:                                               ; preds = %59
  %66 = load ptr, ptr @stdout, align 8, !tbaa !5
  br label %67

67:                                               ; preds = %65, %63
  %68 = phi ptr [ %64, %63 ], [ %66, %65 ]
  call void @_Z9textcolorP8_IO_FILEii(ptr noundef %68, i32 noundef 1, i32 noundef 5)
  br label %97

69:                                               ; preds = %56
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = icmp eq i32 %70, 1
  br i1 %71, label %72, label %82

72:                                               ; preds = %69
  %73 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 6
  %74 = load i8, ptr %73, align 1, !tbaa !29, !range !27, !noundef !28
  %75 = trunc i8 %74 to i1
  br i1 %75, label %76, label %78

76:                                               ; preds = %72
  %77 = load ptr, ptr @stderr, align 8, !tbaa !5
  br label %80

78:                                               ; preds = %72
  %79 = load ptr, ptr @stdout, align 8, !tbaa !5
  br label %80

80:                                               ; preds = %78, %76
  %81 = phi ptr [ %77, %76 ], [ %79, %78 ]
  call void @_Z9textcolorP8_IO_FILEii(ptr noundef %81, i32 noundef 1, i32 noundef 3)
  br label %96

82:                                               ; preds = %69
  %83 = load i32, ptr %6, align 4, !tbaa !9
  %84 = icmp eq i32 %83, 3
  br i1 %84, label %85, label %95

85:                                               ; preds = %82
  %86 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 6
  %87 = load i8, ptr %86, align 1, !tbaa !29, !range !27, !noundef !28
  %88 = trunc i8 %87 to i1
  br i1 %88, label %89, label %91

89:                                               ; preds = %85
  %90 = load ptr, ptr @stderr, align 8, !tbaa !5
  br label %93

91:                                               ; preds = %85
  %92 = load ptr, ptr @stdout, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %91, %89
  %94 = phi ptr [ %90, %89 ], [ %92, %91 ]
  call void @_Z9textcolorP8_IO_FILEii(ptr noundef %94, i32 noundef 1, i32 noundef 2)
  br label %95

95:                                               ; preds = %93, %82
  br label %96

96:                                               ; preds = %95, %80
  br label %97

97:                                               ; preds = %96, %67
  br label %98

98:                                               ; preds = %97, %54
  br label %99

99:                                               ; preds = %98, %41
  %100 = load i32, ptr %6, align 4, !tbaa !9
  %101 = icmp sge i32 %100, 7
  br i1 %101, label %102, label %107

102:                                              ; preds = %99
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = load i32, ptr %8, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef %103, i64 noundef %105)
  br label %119

107:                                              ; preds = %99
  %108 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 6
  %109 = load i8, ptr %108, align 1, !tbaa !29, !range !27, !noundef !28
  %110 = trunc i8 %109 to i1
  br i1 %110, label %111, label %112

111:                                              ; preds = %107
  br label %113

112:                                              ; preds = %107
  br label %113

113:                                              ; preds = %112, %111
  %114 = phi ptr [ @_ZSt4cerr, %111 ], [ @_ZSt4cout, %112 ]
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = load i32, ptr %8, align 4, !tbaa !9
  %117 = sext i32 %116 to i64
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %114, ptr noundef %115, i64 noundef %117)
  br label %119

119:                                              ; preds = %113, %102
  %120 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 4
  %121 = call i32 @pthread_mutex_unlock(ptr noundef %120) #4
  %122 = load i32, ptr %6, align 4, !tbaa !9
  %123 = icmp sge i32 %122, 7
  br i1 %123, label %124, label %126

124:                                              ; preds = %119
  %125 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @_Z11reset_colorP8_IO_FILE(ptr noundef %125)
  br label %136

126:                                              ; preds = %119
  %127 = getelementptr inbounds %class.file_logger, ptr %9, i32 0, i32 6
  %128 = load i8, ptr %127, align 1, !tbaa !29, !range !27, !noundef !28
  %129 = trunc i8 %128 to i1
  br i1 %129, label %130, label %132

130:                                              ; preds = %126
  %131 = load ptr, ptr @stderr, align 8, !tbaa !5
  br label %134

132:                                              ; preds = %126
  %133 = load ptr, ptr @stdout, align 8, !tbaa !5
  br label %134

134:                                              ; preds = %132, %130
  %135 = phi ptr [ %131, %130 ], [ %133, %132 ]
  call void @_Z11reset_colorP8_IO_FILE(ptr noundef %135)
  br label %136

136:                                              ; preds = %134, %124
  br label %137

137:                                              ; preds = %136, %32
  ret void
}

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i64 noundef) #2

attributes #0 = { 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 #1 = { 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 #2 = { "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 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 = { 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, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !21, i64 592}
!14 = !{!"_ZTS11file_logger", !15, i64 0, !25, i64 512, !10, i64 544, !10, i64 548, !7, i64 552, !21, i64 592, !21, i64 593, !10, i64 596, !24, 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, !22, i64 120, !23, i64 124, !23, i64 132, !23, i64 140, !6, i64 152, !24, i64 160, !21, i64 168, !21, i64 169, !21, i64 170, !7, i64 171, !6, i64 176, !6, i64 184, !21, i64 192, !6, i64 200, !6, i64 208, !24, 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, !21, i64 8}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTSSt13_Ios_Openmode", !7, i64 0}
!23 = !{!"_ZTS11__mbstate_t", !10, i64 0, !7, i64 4}
!24 = !{!"long", !7, i64 0}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !26, i64 0, !24, i64 8, !7, i64 16}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = !{!14, !21, i64 593}


; 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 }

@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@stderr = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4goodEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z9textcolorP8_IO_FILEii(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z11reset_colorP8_IO_FILE(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11file_logger7_lograwEiPKci(ptr noundef nonnull align 8 dereferenceable(896) %0, i32 noundef %1, ptr noundef %2, i32 noundef %3) local_unnamed_addr #3 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 552
  %6 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull %5) #4
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 %9
  %11 = tail call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4goodEv(ptr noundef nonnull align 8 dereferenceable(264) %10)
  br i1 %11, label %12, label %16

12:                                               ; preds = %4
  %13 = sext i32 %3 to i64
  %14 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %2, i64 noundef %13)
  %15 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  br label %16

16:                                               ; preds = %12, %4
  %17 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %5) #4
  %18 = getelementptr inbounds i8, ptr %0, i64 592
  %19 = load i8, ptr %18, align 8, !tbaa !8, !range !25, !noundef !26
  %20 = trunc nuw i8 %19 to i1
  br i1 %20, label %25, label %21

21:                                               ; preds = %16
  %22 = getelementptr inbounds i8, ptr %0, i64 593
  %23 = load i8, ptr %22, align 1, !tbaa !27, !range !25, !noundef !26
  %24 = trunc nuw i8 %23 to i1
  br i1 %24, label %25, label %54

25:                                               ; preds = %21, %16
  %26 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull %5) #4
  switch i32 %1, label %31 [
    i32 7, label %.thread13
    i32 6, label %.critedge.sink.split
    i32 5, label %28
    i32 1, label %29
    i32 3, label %30
  ]

.thread13:                                        ; preds = %25
  %27 = load ptr, ptr @stderr, align 8, !tbaa !28
  tail call void @_Z9textcolorP8_IO_FILEii(ptr noundef %27, i32 noundef 1, i32 noundef 1)
  br label %.critedge15

28:                                               ; preds = %25
  br label %.critedge.sink.split

29:                                               ; preds = %25
  br label %.critedge.sink.split

30:                                               ; preds = %25
  br label %.critedge.sink.split

31:                                               ; preds = %25
  %32 = icmp sgt i32 %1, 6
  br i1 %32, label %.critedge15, label %.critedge

.critedge15:                                      ; preds = %31, %.thread13
  %33 = sext i32 %3 to i64
  %34 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef %2, i64 noundef %33)
  %35 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %5) #4
  %36 = load ptr, ptr @stderr, align 8, !tbaa !28
  br label %.sink.split

.critedge.sink.split:                             ; preds = %25, %29, %30, %28
  %.sink16 = phi i32 [ 5, %28 ], [ 2, %30 ], [ 3, %29 ], [ 1, %25 ]
  %37 = getelementptr inbounds i8, ptr %0, i64 593
  %38 = load i8, ptr %37, align 1, !tbaa !27, !range !25, !noundef !26
  %39 = trunc nuw i8 %38 to i1
  %40 = load ptr, ptr @stderr, align 8
  %41 = load ptr, ptr @stdout, align 8
  %42 = select i1 %39, ptr %40, ptr %41
  tail call void @_Z9textcolorP8_IO_FILEii(ptr noundef %42, i32 noundef 1, i32 noundef %.sink16)
  br label %.critedge

.critedge:                                        ; preds = %.critedge.sink.split, %31
  %43 = getelementptr inbounds i8, ptr %0, i64 593
  %44 = load i8, ptr %43, align 1, !tbaa !27, !range !25, !noundef !26
  %45 = trunc nuw i8 %44 to i1
  %_ZSt4cerr._ZSt4cout.c = select i1 %45, ptr @_ZSt4cerr, ptr @_ZSt4cout
  %46 = sext i32 %3 to i64
  %47 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %_ZSt4cerr._ZSt4cout.c, ptr noundef %2, i64 noundef %46)
  %48 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %5) #4
  %49 = load i8, ptr %43, align 1, !tbaa !27, !range !25, !noundef !26
  %50 = trunc nuw i8 %49 to i1
  %51 = load ptr, ptr @stderr, align 8
  %52 = load ptr, ptr @stdout, align 8
  %53 = select i1 %50, ptr %51, ptr %52
  br label %.sink.split

.sink.split:                                      ; preds = %.critedge, %.critedge15
  %.sink = phi ptr [ %36, %.critedge15 ], [ %53, %.critedge ]
  tail call void @_Z11reset_colorP8_IO_FILE(ptr noundef %.sink)
  br label %54

54:                                               ; preds = %.sink.split, %21
  ret void
}

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i64 noundef) local_unnamed_addr #2

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass