; LLVM IR from ros2/rcutils :: src (logging)

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

%struct.rcutils_allocator_s = type { ptr, ptr, ptr, ptr, ptr }
%struct.rcutils_hash_map_s = type { ptr }
%struct.rcutils_error_string_s = type { [1024 x i8] }

@g_rcutils_logging_initialized = external dso_local global i8, align 1
@.str.7 = external hidden unnamed_addr constant [60 x i8], align 1
@g_rcutils_logging_allocator = external hidden global %struct.rcutils_allocator_s, align 8
@g_rcutils_logging_default_logger_level = external hidden global i32, align 4
@.str.10 = external hidden unnamed_addr constant [54 x i8], align 1
@stderr = external global ptr, align 8
@g_rcutils_logging_severities_map = external hidden global %struct.rcutils_hash_map_s, align 8
@.str.34 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @rcutils_logging_initialize_with_allocator(ptr noundef byval(%struct.rcutils_allocator_s) align 8) #0

declare void @rcutils_get_default_allocator(ptr dead_on_unwind writable sret(%struct.rcutils_allocator_s) align 8) #1

declare void @rcutils_set_error_state(ptr noundef, ptr noundef, i64 noundef) #1

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

declare i32 @rcutils_snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #1

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #1

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

declare void @rcutils_reset_error() #1

declare void @rcutils_get_error_string(ptr dead_on_unwind writable sret(%struct.rcutils_error_string_s) align 1) #1

declare ptr @rcutils_strdup(ptr noundef, ptr noundef byval(%struct.rcutils_allocator_s) align 8) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @get_severity_level(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @rcutils_logging_get_logger_effective_level(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %struct.rcutils_allocator_s, align 8
  %5 = alloca %struct.rcutils_error_string_s, align 1
  %6 = alloca %struct.rcutils_error_string_s, align 1
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca [1024 x i8], align 16
  %10 = alloca i32, align 4
  %11 = alloca %struct.rcutils_error_string_s, align 1
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca [1024 x i8], align 16
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %1
  %22 = load i8, ptr @g_rcutils_logging_initialized, align 1, !tbaa !9, !range !11, !noundef !12
  %23 = trunc i8 %22 to i1
  %24 = xor i1 %23, true
  %25 = zext i1 %24 to i32
  %26 = sext i32 %25 to i64
  %27 = call i64 @llvm.expect.i64(i64 %26, i64 0)
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %29, label %51

29:                                               ; preds = %21
  call void @rcutils_get_default_allocator(ptr dead_on_unwind writable sret(%struct.rcutils_allocator_s) align 8 %4)
  %30 = call i32 @rcutils_logging_initialize_with_allocator(ptr noundef byval(%struct.rcutils_allocator_s) align 8 %4)
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %50

32:                                               ; preds = %29
  br label %33

33:                                               ; preds = %32
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = call i64 @fwrite(ptr noundef @.str.41, i64 noundef 1, i64 noundef 102, ptr noundef %34)
  br label %36

36:                                               ; preds = %33
  br label %37

37:                                               ; preds = %36
  call void @rcutils_get_error_string(ptr dead_on_unwind writable sret(%struct.rcutils_error_string_s) align 1 %5)
  %38 = getelementptr inbounds %struct.rcutils_error_string_s, ptr %5, i32 0, i32 0
  %39 = getelementptr inbounds [1024 x i8], ptr %38, i64 0, i64 0
  call void @rcutils_get_error_string(ptr dead_on_unwind writable sret(%struct.rcutils_error_string_s) align 1 %6)
  %40 = getelementptr inbounds %struct.rcutils_error_string_s, ptr %6, i32 0, i32 0
  %41 = getelementptr inbounds [1024 x i8], ptr %40, i64 0, i64 0
  %42 = call i64 @strlen(ptr noundef %41) #5
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = call i64 @fwrite(ptr noundef %39, i64 noundef 1, i64 noundef %42, ptr noundef %43)
  br label %45

45:                                               ; preds = %37
  br label %46

46:                                               ; preds = %45
  %47 = load ptr, ptr @stderr, align 8, !tbaa !5
  %48 = call i64 @fwrite(ptr noundef @.str.34, i64 noundef 1, i64 noundef 1, ptr noundef %47)
  br label %49

49:                                               ; preds = %46
  call void @rcutils_reset_error()
  br label %50

50:                                               ; preds = %49, %29
  br label %51

51:                                               ; preds = %50, %21
  br label %52

52:                                               ; preds = %51
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = icmp eq ptr null, %53
  br i1 %54, label %55, label %56

55:                                               ; preds = %52
  store i32 -1, ptr %2, align 4
  br label %185

56:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %57 = call i32 @rcutils_hash_map_get_size(ptr noundef @g_rcutils_logging_severities_map, ptr noundef %7)
  store i32 %57, ptr %8, align 4, !tbaa !13
  %58 = load i32, ptr %8, align 4, !tbaa !13
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %83

60:                                               ; preds = %56
  br label %61

61:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 1024, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %62 = getelementptr inbounds [1024 x i8], ptr %9, i64 0, i64 0
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  call void @rcutils_get_error_string(ptr dead_on_unwind writable sret(%struct.rcutils_error_string_s) align 1 %11)
  %64 = getelementptr inbounds %struct.rcutils_error_string_s, ptr %11, i32 0, i32 0
  %65 = getelementptr inbounds [1024 x i8], ptr %64, i64 0, i64 0
  %66 = call i32 (ptr, i64, ptr, ...) @rcutils_snprintf(ptr noundef %62, i64 noundef 1024, ptr noundef @.str.42, ptr noundef %63, ptr noundef %65)
  store i32 %66, ptr %10, align 4, !tbaa !13
  %67 = load i32, ptr %10, align 4, !tbaa !13
  %68 = icmp slt i32 %67, 0
  br i1 %68, label %69, label %75

69:                                               ; preds = %61
  br label %70

70:                                               ; preds = %69
  %71 = load ptr, ptr @stderr, align 8, !tbaa !5
  %72 = call i64 @fwrite(ptr noundef @.str.10, i64 noundef 1, i64 noundef 53, ptr noundef %71)
  br label %73

73:                                               ; preds = %70
  br label %74

74:                                               ; preds = %73
  br label %80

75:                                               ; preds = %61
  br label %76

76:                                               ; preds = %75
  %77 = getelementptr inbounds [1024 x i8], ptr %9, i64 0, i64 0
  call void @rcutils_set_error_state(ptr noundef %77, ptr noundef @.str.7, i64 noundef 988)
  br label %78

78:                                               ; preds = %76
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 1024, ptr %9) #6
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %184

83:                                               ; preds = %56
  %84 = load i64, ptr %7, align 8, !tbaa !15
  %85 = icmp eq i64 %84, 0
  br i1 %85, label %86, label %88

86:                                               ; preds = %83
  %87 = load i32, ptr @g_rcutils_logging_default_logger_level, align 4, !tbaa !13
  store i32 %87, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %184

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = call i32 @get_severity_level(ptr noundef %89, ptr noundef %13)
  store i32 %90, ptr %14, align 4, !tbaa !13
  %91 = load i32, ptr %14, align 4, !tbaa !13
  %92 = icmp eq i32 %91, 0
  br i1 %92, label %93, label %99

93:                                               ; preds = %88
  %94 = load i32, ptr %13, align 4, !tbaa !13
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %98

96:                                               ; preds = %93
  %97 = load i32, ptr %13, align 4, !tbaa !13
  store i32 %97, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %183

98:                                               ; preds = %93
  br label %104

99:                                               ; preds = %88
  %100 = load i32, ptr %14, align 4, !tbaa !13
  %101 = icmp ne i32 %100, 14
  br i1 %101, label %102, label %103

102:                                              ; preds = %99
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %183

103:                                              ; preds = %99
  br label %104

104:                                              ; preds = %103, %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = call i64 @strlen(ptr noundef %105) #5
  store i64 %106, ptr %15, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = call ptr @rcutils_strdup(ptr noundef %107, ptr noundef byval(%struct.rcutils_allocator_s) align 8 @g_rcutils_logging_allocator)
  store ptr %108, ptr %16, align 8, !tbaa !5
  %109 = load ptr, ptr %16, align 8, !tbaa !5
  %110 = icmp eq ptr %109, null
  br i1 %110, label %111, label %136

111:                                              ; preds = %104
  br label %112

112:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 1024, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %113 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 0
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = call i32 (ptr, i64, ptr, ...) @rcutils_snprintf(ptr noundef %113, i64 noundef 1024, ptr noundef @.str.43, ptr noundef %114)
  store i32 %115, ptr %18, align 4, !tbaa !13
  %116 = load i32, ptr %18, align 4, !tbaa !13
  %117 = icmp slt i32 %116, 0
  br i1 %117, label %118, label %124

118:                                              ; preds = %112
  br label %119

119:                                              ; preds = %118
  %120 = load ptr, ptr @stderr, align 8, !tbaa !5
  %121 = call i64 @fwrite(ptr noundef @.str.10, i64 noundef 1, i64 noundef 53, ptr noundef %120)
  br label %122

122:                                              ; preds = %119
  br label %123

123:                                              ; preds = %122
  br label %133

124:                                              ; preds = %112
  br label %125

125:                                              ; preds = %124
  %126 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 0
  %127 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 0
  %128 = call i64 @strlen(ptr noundef %127) #5
  %129 = load ptr, ptr @stderr, align 8, !tbaa !5
  %130 = call i64 @fwrite(ptr noundef %126, i64 noundef 1, i64 noundef %128, ptr noundef %129)
  br label %131

131:                                              ; preds = %125
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 1024, ptr %17) #6
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %182

136:                                              ; preds = %104
  store i32 0, ptr %13, align 4, !tbaa !13
  br label %137

137:                                              ; preds = %171, %136
  br label %138

138:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = load i64, ptr %15, align 8, !tbaa !15
  %141 = call i64 @rcutils_find_lastn(ptr noundef %139, i8 noundef signext 46, i64 noundef %140)
  store i64 %141, ptr %19, align 8, !tbaa !15
  %142 = load i64, ptr %19, align 8, !tbaa !15
  %143 = icmp eq i64 -1, %142
  br i1 %143, label %144, label %145

144:                                              ; preds = %138
  store i32 23, ptr %12, align 4
  br label %169

145:                                              ; preds = %138
  %146 = load i64, ptr %19, align 8, !tbaa !15
  store i64 %146, ptr %15, align 8, !tbaa !15
  %147 = load ptr, ptr %16, align 8, !tbaa !5
  %148 = load i64, ptr %19, align 8, !tbaa !15
  %149 = getelementptr inbounds i8, ptr %147, i64 %148
  store i8 0, ptr %149, align 1, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %150 = load ptr, ptr %16, align 8, !tbaa !5
  %151 = call i32 @get_severity_level(ptr noundef %150, ptr noundef %13)
  store i32 %151, ptr %20, align 4, !tbaa !13
  %152 = load i32, ptr %20, align 4, !tbaa !13
  %153 = icmp eq i32 %152, 0
  br i1 %153, label %154, label %159

154:                                              ; preds = %145
  %155 = load i32, ptr %13, align 4, !tbaa !13
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %157, label %158

157:                                              ; preds = %154
  store i32 23, ptr %12, align 4
  br label %168

158:                                              ; preds = %154
  br label %167

159:                                              ; preds = %145
  %160 = load i32, ptr %20, align 4, !tbaa !13
  %161 = icmp ne i32 %160, 14
  br i1 %161, label %162, label %166

162:                                              ; preds = %159
  %163 = load ptr, ptr getelementptr inbounds (%struct.rcutils_allocator_s, ptr @g_rcutils_logging_allocator, i32 0, i32 1), align 8, !tbaa !18
  %164 = load ptr, ptr %16, align 8, !tbaa !5
  %165 = load ptr, ptr getelementptr inbounds (%struct.rcutils_allocator_s, ptr @g_rcutils_logging_allocator, i32 0, i32 4), align 8, !tbaa !20
  call void %163(ptr noundef %164, ptr noundef %165)
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %168

166:                                              ; preds = %159
  br label %167

167:                                              ; preds = %166, %158
  store i32 0, ptr %12, align 4
  br label %168

168:                                              ; preds = %167, %162, %157
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %169

169:                                              ; preds = %168, %144
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  %170 = load i32, ptr %12, align 4
  switch i32 %170, label %182 [
    i32 0, label %171
    i32 23, label %172
  ]

171:                                              ; preds = %169
  br label %137

172:                                              ; preds = %169
  %173 = load ptr, ptr getelementptr inbounds (%struct.rcutils_allocator_s, ptr @g_rcutils_logging_allocator, i32 0, i32 1), align 8, !tbaa !18
  %174 = load ptr, ptr %16, align 8, !tbaa !5
  %175 = load ptr, ptr getelementptr inbounds (%struct.rcutils_allocator_s, ptr @g_rcutils_logging_allocator, i32 0, i32 4), align 8, !tbaa !20
  call void %173(ptr noundef %174, ptr noundef %175)
  %176 = load i32, ptr %13, align 4, !tbaa !13
  %177 = icmp eq i32 %176, 0
  br i1 %177, label %178, label %180

178:                                              ; preds = %172
  %179 = load i32, ptr @g_rcutils_logging_default_logger_level, align 4, !tbaa !13
  store i32 %179, ptr %13, align 4, !tbaa !13
  br label %180

180:                                              ; preds = %178, %172
  %181 = load i32, ptr %13, align 4, !tbaa !13
  store i32 %181, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %182

182:                                              ; preds = %180, %169, %135
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %183

183:                                              ; preds = %182, %102, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %184

184:                                              ; preds = %183, %86, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %185

185:                                              ; preds = %184, %55
  %186 = load i32, ptr %2, align 4
  ret i32 %186
}

declare i32 @rcutils_hash_map_get_size(ptr noundef, ptr noundef) #1

declare i64 @rcutils_find_lastn(ptr noundef, i8 noundef signext, i64 noundef) #1

attributes #0 = { 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 #1 = { "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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #4 = { 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 #5 = { nounwind willreturn memory(read) }
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 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !6, i64 8}
!19 = !{!"rcutils_allocator_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!20 = !{!19, !6, i64 32}


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

%struct.rcutils_allocator_s = type { ptr, ptr, ptr, ptr, ptr }
%struct.rcutils_hash_map_s = type { ptr }
%struct.rcutils_error_string_s = type { [1024 x i8] }

@g_rcutils_logging_initialized = external dso_local local_unnamed_addr global i8, align 1
@.str.7 = external hidden unnamed_addr constant [60 x i8], align 1
@g_rcutils_logging_allocator = external hidden global %struct.rcutils_allocator_s, align 8
@g_rcutils_logging_default_logger_level = external hidden local_unnamed_addr global i32, align 4
@.str.10 = external hidden unnamed_addr constant [54 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@g_rcutils_logging_severities_map = external hidden global %struct.rcutils_hash_map_s, align 8
@.str.34 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @rcutils_logging_initialize_with_allocator(ptr noundef byval(%struct.rcutils_allocator_s) align 8) local_unnamed_addr #0

declare void @rcutils_get_default_allocator(ptr dead_on_unwind writable sret(%struct.rcutils_allocator_s) align 8) local_unnamed_addr #1

declare void @rcutils_set_error_state(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

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

declare i32 @rcutils_snprintf(ptr noundef, i64 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

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

declare void @rcutils_reset_error() local_unnamed_addr #1

declare void @rcutils_get_error_string(ptr dead_on_unwind writable sret(%struct.rcutils_error_string_s) align 1) local_unnamed_addr #1

declare ptr @rcutils_strdup(ptr noundef, ptr noundef byval(%struct.rcutils_allocator_s) align 8) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare hidden i32 @get_severity_level(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @rcutils_logging_get_logger_effective_level(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.rcutils_allocator_s, align 8
  %3 = alloca %struct.rcutils_error_string_s, align 1
  %4 = alloca %struct.rcutils_error_string_s, align 1
  %5 = alloca i64, align 8
  %6 = alloca [1024 x i8], align 16
  %7 = alloca %struct.rcutils_error_string_s, align 1
  %8 = alloca i32, align 4
  %9 = alloca [1024 x i8], align 16
  %10 = load i8, ptr @g_rcutils_logging_initialized, align 1, !tbaa !5, !range !9, !noundef !10
  %11 = trunc nuw i8 %10 to i1
  br i1 %11, label %21, label %12, !prof !11

12:                                               ; preds = %1
  call void @rcutils_get_default_allocator(ptr dead_on_unwind nonnull writable sret(%struct.rcutils_allocator_s) align 8 %2) #6
  %13 = call i32 @rcutils_logging_initialize_with_allocator(ptr noundef nonnull byval(%struct.rcutils_allocator_s) align 8 %2)
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %21, label %14

14:                                               ; preds = %12
  %15 = load ptr, ptr @stderr, align 8, !tbaa !12
  %16 = call i64 @fwrite(ptr noundef nonnull @.str.41, i64 noundef 1, i64 noundef 102, ptr noundef %15) #7
  call void @rcutils_get_error_string(ptr dead_on_unwind nonnull writable sret(%struct.rcutils_error_string_s) align 1 %3) #6
  call void @rcutils_get_error_string(ptr dead_on_unwind nonnull writable sret(%struct.rcutils_error_string_s) align 1 %4) #6
  %17 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %4) #8
  %18 = load ptr, ptr @stderr, align 8, !tbaa !12
  %19 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 1, i64 noundef %17, ptr noundef %18) #7
  %20 = load ptr, ptr @stderr, align 8, !tbaa !12
  %char = load i8, ptr @.str.34, align 1
  %chari = sext i8 %char to i32
  %fputc = call i32 @fputc(i32 %chari, ptr %20)
  call void @rcutils_reset_error() #6
  br label %21

21:                                               ; preds = %1, %14, %12
  %22 = icmp eq ptr %0, null
  br i1 %22, label %77, label %23

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %24 = call i32 @rcutils_hash_map_get_size(ptr noundef nonnull @g_rcutils_logging_severities_map, ptr noundef nonnull %5) #6
  %.not34 = icmp eq i32 %24, 0
  br i1 %.not34, label %33, label %25

25:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %6) #6
  call void @rcutils_get_error_string(ptr dead_on_unwind nonnull writable sret(%struct.rcutils_error_string_s) align 1 %7) #6
  %26 = call i32 (ptr, i64, ptr, ...) @rcutils_snprintf(ptr noundef nonnull %6, i64 noundef 1024, ptr noundef nonnull @.str.42, ptr noundef nonnull %0, ptr noundef nonnull %7) #6
  %27 = icmp slt i32 %26, 0
  br i1 %27, label %28, label %31

28:                                               ; preds = %25
  %29 = load ptr, ptr @stderr, align 8, !tbaa !12
  %30 = call i64 @fwrite(ptr noundef nonnull @.str.10, i64 noundef 1, i64 noundef 53, ptr noundef %29) #7
  br label %32

31:                                               ; preds = %25
  call void @rcutils_set_error_state(ptr noundef nonnull %6, ptr noundef nonnull @.str.7, i64 noundef 988) #6
  br label %32

32:                                               ; preds = %31, %28
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %6) #6
  br label %76

33:                                               ; preds = %23
  %34 = load i64, ptr %5, align 8, !tbaa !14
  %35 = icmp eq i64 %34, 0
  br i1 %35, label %36, label %38

36:                                               ; preds = %33
  %37 = load i32, ptr @g_rcutils_logging_default_logger_level, align 4, !tbaa !16
  br label %76

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  %39 = call i32 @get_severity_level(ptr noundef nonnull %0, ptr noundef nonnull %8)
  switch i32 %39, label %75 [
    i32 0, label %40
    i32 14, label %42
  ]

40:                                               ; preds = %38
  %41 = load i32, ptr %8, align 4, !tbaa !16
  %.not36 = icmp eq i32 %41, 0
  br i1 %.not36, label %42, label %75

42:                                               ; preds = %38, %40
  %43 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #8
  %44 = call ptr @rcutils_strdup(ptr noundef nonnull %0, ptr noundef nonnull byval(%struct.rcutils_allocator_s) align 8 @g_rcutils_logging_allocator) #6
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %57

46:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %9) #6
  %47 = call i32 (ptr, i64, ptr, ...) @rcutils_snprintf(ptr noundef nonnull %9, i64 noundef 1024, ptr noundef nonnull @.str.43, ptr noundef nonnull %0) #6
  %48 = icmp slt i32 %47, 0
  br i1 %48, label %49, label %52

49:                                               ; preds = %46
  %50 = load ptr, ptr @stderr, align 8, !tbaa !12
  %51 = call i64 @fwrite(ptr noundef nonnull @.str.10, i64 noundef 1, i64 noundef 53, ptr noundef %50) #7
  br label %56

52:                                               ; preds = %46
  %53 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %9) #8
  %54 = load ptr, ptr @stderr, align 8, !tbaa !12
  %55 = call i64 @fwrite(ptr noundef nonnull %9, i64 noundef 1, i64 noundef %53, ptr noundef %54) #7
  br label %56

56:                                               ; preds = %52, %49
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %9) #6
  br label %75

57:                                               ; preds = %42
  store i32 0, ptr %8, align 4, !tbaa !16
  %58 = call i64 @rcutils_find_lastn(ptr noundef nonnull %0, i8 noundef signext 46, i64 noundef %43) #6
  %59 = icmp eq i64 %58, -1
  br i1 %59, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %57, %67
  %60 = phi i64 [ %68, %67 ], [ %58, %57 ]
  %61 = getelementptr inbounds i8, ptr %44, i64 %60
  store i8 0, ptr %61, align 1, !tbaa !18
  %62 = call i32 @get_severity_level(ptr noundef nonnull %44, ptr noundef nonnull %8)
  switch i32 %62, label %.thread41 [
    i32 0, label %63
    i32 14, label %67
  ]

63:                                               ; preds = %.lr.ph
  %64 = load i32, ptr %8, align 4, !tbaa !16
  %.not38 = icmp eq i32 %64, 0
  br i1 %.not38, label %67, label %._crit_edge

.thread41:                                        ; preds = %.lr.ph
  %65 = load ptr, ptr getelementptr inbounds (i8, ptr @g_rcutils_logging_allocator, i64 8), align 8, !tbaa !19
  %66 = load ptr, ptr getelementptr inbounds (i8, ptr @g_rcutils_logging_allocator, i64 32), align 8, !tbaa !21
  call void %65(ptr noundef nonnull %44, ptr noundef %66) #6
  br label %75

67:                                               ; preds = %63, %.lr.ph
  %68 = call i64 @rcutils_find_lastn(ptr noundef nonnull %0, i8 noundef signext 46, i64 noundef %60) #6
  %69 = icmp eq i64 %68, -1
  br i1 %69, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %63, %67, %57
  %70 = load ptr, ptr getelementptr inbounds (i8, ptr @g_rcutils_logging_allocator, i64 8), align 8, !tbaa !19
  %71 = load ptr, ptr getelementptr inbounds (i8, ptr @g_rcutils_logging_allocator, i64 32), align 8, !tbaa !21
  call void %70(ptr noundef nonnull %44, ptr noundef %71) #6
  %72 = load i32, ptr %8, align 4, !tbaa !16
  %73 = icmp eq i32 %72, 0
  %74 = load i32, ptr @g_rcutils_logging_default_logger_level, align 4
  %spec.select = select i1 %73, i32 %74, i32 %72
  br label %75

75:                                               ; preds = %._crit_edge, %.thread41, %56, %38, %40
  %.4 = phi i32 [ %41, %40 ], [ -1, %38 ], [ -1, %56 ], [ -1, %.thread41 ], [ %spec.select, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %76

76:                                               ; preds = %75, %36, %32
  %.5 = phi i32 [ -1, %32 ], [ %37, %36 ], [ %.4, %75 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %77

77:                                               ; preds = %21, %76
  %.6 = phi i32 [ %.5, %76 ], [ -1, %21 ]
  ret i32 %.6
}

declare i32 @rcutils_hash_map_get_size(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i64 @rcutils_find_lastn(ptr noundef, i8 noundef signext, i64 noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fputc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #5

attributes #0 = { 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 #1 = { "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 = { 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 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 #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { cold }
attributes #8 = { 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 = !{!"_Bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !13, i64 8}
!20 = !{!"rcutils_allocator_s", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!21 = !{!20, !13, i64 32}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass