; LLVM IR from ros2/rcutils :: test (test_logging_long_messages)

; 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_log_location_s = type { ptr, ptr, i64 }
%"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 }
%struct.rcutils_error_string_s = type { [1024 x i8] }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [32 x i8], align 1
@__const.main.location = external hidden unnamed_addr constant %struct.rcutils_log_location_s, align 8
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %struct.rcutils_error_string_s, align 1
  %8 = alloca i32, align 4
  %9 = alloca %struct.rcutils_log_location_s, align 8
  %10 = alloca [2048 x i8], align 16
  %11 = alloca i64, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %12 = call i32 @rcutils_logging_initialize()
  store i32 %12, ptr %6, align 4, !tbaa !5
  %13 = load i32, ptr %6, align 4, !tbaa !5
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %20

15:                                               ; preds = %2
  %16 = load ptr, ptr @stderr, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1024, ptr %7) #5
  call void @rcutils_get_error_string(ptr dead_on_unwind writable sret(%struct.rcutils_error_string_s) align 1 %7)
  %17 = getelementptr inbounds %struct.rcutils_error_string_s, ptr %7, i32 0, i32 0
  %18 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 0
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef @.str, ptr noundef %18) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %7) #5
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %40

20:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 @__const.main.location, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 2048, ptr %10) #5
  %21 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 0
  store i8 88, ptr %21, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 1, ptr %11, align 8, !tbaa !12
  br label %22

22:                                               ; preds = %29, %20
  %23 = load i64, ptr %11, align 8, !tbaa !12
  %24 = icmp ult i64 %23, 2046
  br i1 %24, label %26, label %25

25:                                               ; preds = %22
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %32

26:                                               ; preds = %22
  %27 = load i64, ptr %11, align 8, !tbaa !12
  %28 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 %27
  store i8 120, ptr %28, align 1, !tbaa !11
  br label %29

29:                                               ; preds = %26
  %30 = load i64, ptr %11, align 8, !tbaa !12
  %31 = add i64 %30, 1
  store i64 %31, ptr %11, align 8, !tbaa !12
  br label %22, !llvm.loop !14

32:                                               ; preds = %25
  %33 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 2046
  store i8 88, ptr %33, align 2, !tbaa !11
  %34 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 2047
  store i8 0, ptr %34, align 1, !tbaa !11
  %35 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 0
  call void (ptr, i32, ptr, ptr, ...) @rcutils_log(ptr noundef %9, i32 noundef 20, ptr noundef @.str.3, ptr noundef @.str.4, ptr noundef %35)
  %36 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 1
  store i8 37, ptr %36, align 1, !tbaa !11
  %37 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 2
  store i8 100, ptr %37, align 2, !tbaa !11
  %38 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 0
  call void (ptr, i32, ptr, ptr, ...) @rcutils_log(ptr noundef %9, i32 noundef 20, ptr noundef @.str.5, ptr noundef %38, i32 noundef 42)
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 2048, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #5
  br label %40

40:                                               ; preds = %32, %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %41 = load i32, ptr %3, align 4
  ret i32 %41
}

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

declare i32 @rcutils_logging_initialize() #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare void @rcutils_log(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #2

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

attributes #0 = { mustprogress norecurse 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.rcutils_log_location_s = type { ptr, ptr, i64 }
%"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 }
%struct.rcutils_error_string_s = type { [1024 x i8] }

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [32 x i8], align 1
@__const.main.location = external hidden unnamed_addr constant %struct.rcutils_log_location_s, align 8
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef range(i32 -1, 1) i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca %struct.rcutils_error_string_s, align 1
  %4 = alloca %struct.rcutils_log_location_s, align 8
  %5 = alloca [2048 x i8], align 16
  %6 = tail call i32 @rcutils_logging_initialize()
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %10, label %7

7:                                                ; preds = %2
  %8 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %3) #6
  call void @rcutils_get_error_string(ptr dead_on_unwind nonnull writable sret(%struct.rcutils_error_string_s) align 1 %3)
  %9 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str, ptr noundef nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %3) #6
  br label %15

10:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) @__const.main.location, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %5) #6
  store i8 88, ptr %5, align 16, !tbaa !9
  %scevgep = getelementptr inbounds i8, ptr %5, i64 1
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(2045) %scevgep, i8 120, i64 2045, i1 false), !tbaa !9
  %11 = getelementptr inbounds i8, ptr %5, i64 2046
  store i8 88, ptr %11, align 2, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %5, i64 2047
  store i8 0, ptr %12, align 1, !tbaa !9
  call void (ptr, i32, ptr, ptr, ...) @rcutils_log(ptr noundef nonnull %4, i32 noundef 20, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, ptr noundef nonnull %5)
  store i8 37, ptr %scevgep, align 1, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %5, i64 2
  store i8 100, ptr %13, align 2, !tbaa !9
  call void (ptr, i32, ptr, ptr, ...) @rcutils_log(ptr noundef nonnull %4, i32 noundef 20, ptr noundef nonnull @.str.5, ptr noundef nonnull %5, i32 noundef 42)
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout)
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  br label %15

15:                                               ; preds = %10, %7
  %.05 = phi i32 [ -1, %7 ], [ 0, %10 ]
  ret i32 %.05
}

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

declare i32 @rcutils_logging_initialize() local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare void @rcutils_log(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

attributes #0 = { mustprogress norecurse 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { cold 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 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopIdiomRecognizePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass