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

; 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.dir_list_t = type { ptr, i32, ptr }
%struct.rcutils_dir_iter_s = type { ptr, %struct.rcutils_allocator_s, ptr }

@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1
@stderr = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @rcutils_is_directory(ptr noundef) #0

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rcutils_calculate_directory_size_with_recursion(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef byval(%struct.rcutils_allocator_s) align 8 %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca [1024 x i8], align 16
  %14 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store ptr null, ptr %11, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = icmp eq ptr null, %15
  br i1 %16, label %17, label %23

17:                                               ; preds = %4
  br label %18

18:                                               ; preds = %17
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = call i64 @fwrite(ptr noundef @.str.3, i64 noundef 1, i64 noundef 24, ptr noundef %19)
  br label %21

21:                                               ; preds = %18
  br label %22

22:                                               ; preds = %21
  store i32 11, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %136

23:                                               ; preds = %4
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = icmp eq ptr null, %24
  br i1 %25, label %26, label %32

26:                                               ; preds = %23
  br label %27

27:                                               ; preds = %26
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = call i64 @fwrite(ptr noundef @.str.4, i64 noundef 1, i64 noundef 22, ptr noundef %28)
  br label %30

30:                                               ; preds = %27
  br label %31

31:                                               ; preds = %30
  store i32 11, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %136

32:                                               ; preds = %23
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = call zeroext i1 @rcutils_is_directory(ptr noundef %33)
  br i1 %34, label %60, label %35

35:                                               ; preds = %32
  br label %36

36:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 1024, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %37 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = call i32 (ptr, i64, ptr, ...) @rcutils_snprintf(ptr noundef %37, i64 noundef 1024, ptr noundef @.str.5, ptr noundef %38)
  store i32 %39, ptr %14, align 4, !tbaa !11
  %40 = load i32, ptr %14, align 4, !tbaa !11
  %41 = icmp slt i32 %40, 0
  br i1 %41, label %42, label %48

42:                                               ; preds = %36
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = call i64 @fwrite(ptr noundef @.str.6, i64 noundef 1, i64 noundef 53, ptr noundef %44)
  br label %46

46:                                               ; preds = %43
  br label %47

47:                                               ; preds = %46
  br label %57

48:                                               ; preds = %36
  br label %49

49:                                               ; preds = %48
  %50 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %51 = getelementptr inbounds [1024 x i8], ptr %13, i64 0, i64 0
  %52 = call i64 @strlen(ptr noundef %51) #5
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = call i64 @fwrite(ptr noundef %50, i64 noundef 1, i64 noundef %52, ptr noundef %53)
  br label %55

55:                                               ; preds = %49
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 1024, ptr %13) #4
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  store i32 2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %136

60:                                               ; preds = %32
  %61 = call zeroext i1 @rcutils_allocator_is_valid(ptr noundef %3)
  br i1 %61, label %63, label %62

62:                                               ; preds = %60
  store i32 11, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %136

63:                                               ; preds = %60
  %64 = getelementptr inbounds %struct.rcutils_allocator_s, ptr %3, i32 0, i32 3
  %65 = load ptr, ptr %64, align 8, !tbaa !13
  %66 = getelementptr inbounds %struct.rcutils_allocator_s, ptr %3, i32 0, i32 4
  %67 = load ptr, ptr %66, align 8, !tbaa !15
  %68 = call ptr %65(i64 noundef 1, i64 noundef 24, ptr noundef %67)
  store ptr %68, ptr %9, align 8, !tbaa !5
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = icmp eq ptr null, %69
  br i1 %70, label %71, label %77

71:                                               ; preds = %63
  br label %72

72:                                               ; preds = %71
  %73 = load ptr, ptr @stderr, align 8, !tbaa !5
  %74 = call i64 @fwrite(ptr noundef @.str.7, i64 noundef 1, i64 noundef 28, ptr noundef %73)
  br label %75

75:                                               ; preds = %72
  br label %76

76:                                               ; preds = %75
  store i32 10, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %136

77:                                               ; preds = %63
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.dir_list_t, ptr %78, i32 0, i32 1
  store i32 1, ptr %79, align 8, !tbaa !16
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = call ptr @rcutils_strdup(ptr noundef %80, ptr noundef byval(%struct.rcutils_allocator_s) align 8 %3)
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.dir_list_t, ptr %82, i32 0, i32 0
  store ptr %81, ptr %83, align 8, !tbaa !18
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.dir_list_t, ptr %84, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !18
  %87 = icmp eq ptr null, %86
  br i1 %87, label %88, label %99

88:                                               ; preds = %77
  br label %89

89:                                               ; preds = %88
  %90 = load ptr, ptr @stderr, align 8, !tbaa !5
  %91 = call i64 @fwrite(ptr noundef @.str.8, i64 noundef 1, i64 noundef 37, ptr noundef %90)
  br label %92

92:                                               ; preds = %89
  br label %93

93:                                               ; preds = %92
  %94 = getelementptr inbounds %struct.rcutils_allocator_s, ptr %3, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !19
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.rcutils_allocator_s, ptr %3, i32 0, i32 4
  %98 = load ptr, ptr %97, align 8, !tbaa !15
  call void %95(ptr noundef %96, ptr noundef %98)
  store i32 10, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %136

99:                                               ; preds = %77
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  store i64 0, ptr %100, align 8, !tbaa !9
  br label %101

101:                                              ; preds = %127, %99
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.dir_list_t, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %103, align 8, !tbaa !18
  %105 = call ptr @rcutils_dir_iter_start(ptr noundef %104, ptr noundef byval(%struct.rcutils_allocator_s) align 8 %3)
  store ptr %105, ptr %11, align 8, !tbaa !5
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  %107 = icmp eq ptr null, %106
  br i1 %107, label %108, label %109

108:                                              ; preds = %101
  store i32 2, ptr %10, align 4, !tbaa !11
  br label %132

109:                                              ; preds = %101
  br label %110

110:                                              ; preds = %122, %109
  %111 = load ptr, ptr %11, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.rcutils_dir_iter_s, ptr %111, i32 0, i32 0
  %113 = load ptr, ptr %112, align 8, !tbaa !20
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = load i64, ptr %7, align 8, !tbaa !9
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  %117 = call i32 @check_and_calculate_size(ptr noundef %113, ptr noundef %114, i64 noundef %115, ptr noundef %116, ptr noundef byval(%struct.rcutils_allocator_s) align 8 %3)
  store i32 %117, ptr %10, align 4, !tbaa !11
  %118 = load i32, ptr %10, align 4, !tbaa !11
  %119 = icmp ne i32 0, %118
  br i1 %119, label %120, label %121

120:                                              ; preds = %110
  br label %132

121:                                              ; preds = %110
  br label %122

122:                                              ; preds = %121
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = call zeroext i1 @rcutils_dir_iter_next(ptr noundef %123)
  br i1 %124, label %110, label %125, !llvm.loop !22

125:                                              ; preds = %122
  %126 = load ptr, ptr %11, align 8, !tbaa !5
  call void @rcutils_dir_iter_end(ptr noundef %126)
  call void @remove_first_dir_from_list(ptr noundef %9, ptr noundef byval(%struct.rcutils_allocator_s) align 8 %3)
  br label %127

127:                                              ; preds = %125
  %128 = load ptr, ptr %9, align 8, !tbaa !5
  %129 = icmp ne ptr %128, null
  br i1 %129, label %101, label %130, !llvm.loop !24

130:                                              ; preds = %127
  %131 = load i32, ptr %10, align 4, !tbaa !11
  store i32 %131, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %136

132:                                              ; preds = %120, %108
  %133 = load ptr, ptr %11, align 8, !tbaa !5
  call void @rcutils_dir_iter_end(ptr noundef %133)
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free_dir_list(ptr noundef %134, ptr noundef byval(%struct.rcutils_allocator_s) align 8 %3)
  %135 = load i32, ptr %10, align 4, !tbaa !11
  store i32 %135, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %136

136:                                              ; preds = %132, %130, %93, %76, %62, %59, %31, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %137 = load i32, ptr %5, align 4
  ret i32 %137
}

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

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

declare zeroext i1 @rcutils_allocator_is_valid(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare hidden i32 @check_and_calculate_size(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef byval(%struct.rcutils_allocator_s) align 8) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @rcutils_dir_iter_next(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @rcutils_dir_iter_end(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @remove_first_dir_from_list(ptr noundef, ptr noundef byval(%struct.rcutils_allocator_s) align 8) #0

; Function Attrs: nounwind uwtable
declare hidden void @free_dir_list(ptr noundef, ptr noundef byval(%struct.rcutils_allocator_s) align 8) #0

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 = { 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 willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 24}
!14 = !{!"rcutils_allocator_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!15 = !{!14, !6, i64 32}
!16 = !{!17, !12, i64 8}
!17 = !{!"dir_list_t", !6, i64 0, !12, i64 8, !6, i64 16}
!18 = !{!17, !6, i64 0}
!19 = !{!14, !6, i64 8}
!20 = !{!21, !6, i64 0}
!21 = !{!"rcutils_dir_iter_s", !6, i64 0, !14, i64 8, !6, i64 48}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}


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

@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @rcutils_is_directory(ptr noundef) local_unnamed_addr #0

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rcutils_calculate_directory_size_with_recursion(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef byval(%struct.rcutils_allocator_s) align 8 %3) local_unnamed_addr #0 {
  %5 = alloca ptr, align 8
  %6 = alloca [1024 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %7 = icmp eq ptr %0, null
  br i1 %7, label %8, label %11

8:                                                ; preds = %4
  %9 = load ptr, ptr @stderr, align 8, !tbaa !5
  %10 = tail call i64 @fwrite(ptr noundef nonnull @.str.3, i64 noundef 1, i64 noundef 24, ptr noundef %9) #6
  br label %.loopexit24

11:                                               ; preds = %4
  %12 = icmp eq ptr %2, null
  br i1 %12, label %13, label %16

13:                                               ; preds = %11
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  %15 = tail call i64 @fwrite(ptr noundef nonnull @.str.4, i64 noundef 1, i64 noundef 22, ptr noundef %14) #6
  br label %.loopexit24

16:                                               ; preds = %11
  %17 = tail call zeroext i1 @rcutils_is_directory(ptr noundef nonnull %0)
  br i1 %17, label %29, label %18

18:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %6) #5
  %19 = call i32 (ptr, i64, ptr, ...) @rcutils_snprintf(ptr noundef nonnull %6, i64 noundef 1024, ptr noundef nonnull @.str.5, ptr noundef nonnull %0) #5
  %20 = icmp slt i32 %19, 0
  br i1 %20, label %21, label %24

21:                                               ; preds = %18
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = call i64 @fwrite(ptr noundef nonnull @.str.6, i64 noundef 1, i64 noundef 53, ptr noundef %22) #6
  br label %28

24:                                               ; preds = %18
  %25 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %6) #7
  %26 = load ptr, ptr @stderr, align 8, !tbaa !5
  %27 = call i64 @fwrite(ptr noundef nonnull %6, i64 noundef 1, i64 noundef %25, ptr noundef %26) #6
  br label %28

28:                                               ; preds = %24, %21
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %6) #5
  br label %.loopexit24

29:                                               ; preds = %16
  %30 = call zeroext i1 @rcutils_allocator_is_valid(ptr noundef nonnull %3) #5
  br i1 %30, label %31, label %.loopexit24

31:                                               ; preds = %29
  %32 = getelementptr inbounds i8, ptr %3, i64 24
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds i8, ptr %3, i64 32
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = call ptr %33(i64 noundef 1, i64 noundef 24, ptr noundef %35) #5
  store ptr %36, ptr %5, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %41

38:                                               ; preds = %31
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = call i64 @fwrite(ptr noundef nonnull @.str.7, i64 noundef 1, i64 noundef 28, ptr noundef %39) #6
  br label %.loopexit24

41:                                               ; preds = %31
  %42 = getelementptr inbounds i8, ptr %36, i64 8
  store i32 1, ptr %42, align 8, !tbaa !12
  %43 = call ptr @rcutils_strdup(ptr noundef nonnull %0, ptr noundef nonnull byval(%struct.rcutils_allocator_s) align 8 %3) #5
  store ptr %43, ptr %36, align 8, !tbaa !15
  %44 = icmp eq ptr %43, null
  br i1 %44, label %45, label %51

45:                                               ; preds = %41
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = call i64 @fwrite(ptr noundef nonnull @.str.8, i64 noundef 1, i64 noundef 37, ptr noundef %46) #6
  %48 = getelementptr inbounds i8, ptr %3, i64 8
  %49 = load ptr, ptr %48, align 8, !tbaa !16
  %50 = load ptr, ptr %34, align 8, !tbaa !11
  call void %49(ptr noundef nonnull %36, ptr noundef %50) #5
  br label %.loopexit24

51:                                               ; preds = %41
  store i64 0, ptr %2, align 8, !tbaa !17
  br label %52

52:                                               ; preds = %62, %51
  %53 = phi ptr [ %63, %62 ], [ %36, %51 ]
  %54 = load ptr, ptr %53, align 8, !tbaa !15
  %55 = call ptr @rcutils_dir_iter_start(ptr noundef %54, ptr noundef nonnull byval(%struct.rcutils_allocator_s) align 8 %3)
  %56 = icmp eq ptr %55, null
  br i1 %56, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %52, %60
  %57 = load ptr, ptr %55, align 8, !tbaa !19
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = call i32 @check_and_calculate_size(ptr noundef %57, ptr noundef nonnull %2, i64 noundef %1, ptr noundef %58, ptr noundef nonnull byval(%struct.rcutils_allocator_s) align 8 %3)
  %.not = icmp eq i32 %59, 0
  br i1 %.not, label %60, label %.loopexit

60:                                               ; preds = %.preheader
  %61 = call zeroext i1 @rcutils_dir_iter_next(ptr noundef nonnull %55)
  br i1 %61, label %.preheader, label %62, !llvm.loop !21

62:                                               ; preds = %60
  call void @rcutils_dir_iter_end(ptr noundef nonnull %55)
  call void @remove_first_dir_from_list(ptr noundef nonnull %5, ptr noundef nonnull byval(%struct.rcutils_allocator_s) align 8 %3)
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %.not22 = icmp eq ptr %63, null
  br i1 %.not22, label %.loopexit24, label %52, !llvm.loop !23

.loopexit:                                        ; preds = %52, %.preheader
  %.017 = phi i32 [ %59, %.preheader ], [ 2, %52 ]
  call void @rcutils_dir_iter_end(ptr noundef %55)
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free_dir_list(ptr noundef %64, ptr noundef nonnull byval(%struct.rcutils_allocator_s) align 8 %3)
  br label %.loopexit24

.loopexit24:                                      ; preds = %62, %29, %.loopexit, %45, %38, %28, %13, %8
  %.0 = phi i32 [ 11, %8 ], [ 11, %13 ], [ 10, %38 ], [ 10, %45 ], [ %.017, %.loopexit ], [ 2, %28 ], [ 11, %29 ], [ 0, %62 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  ret i32 %.0
}

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

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

declare zeroext i1 @rcutils_allocator_is_valid(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare hidden i32 @check_and_calculate_size(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef byval(%struct.rcutils_allocator_s) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @rcutils_dir_iter_next(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @rcutils_dir_iter_end(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @remove_first_dir_from_list(ptr noundef, ptr noundef byval(%struct.rcutils_allocator_s) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @free_dir_list(ptr noundef, ptr noundef byval(%struct.rcutils_allocator_s) align 8) local_unnamed_addr #0

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 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { cold }
attributes #7 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 24}
!10 = !{!"rcutils_allocator_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!11 = !{!10, !6, i64 32}
!12 = !{!13, !14, i64 8}
!13 = !{!"dir_list_t", !6, i64 0, !14, i64 8, !6, i64 16}
!14 = !{!"int", !7, i64 0}
!15 = !{!13, !6, i64 0}
!16 = !{!10, !6, i64 8}
!17 = !{!18, !18, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!20, !6, i64 0}
!20 = !{!"rcutils_dir_iter_s", !6, i64 0, !10, i64 8, !6, i64 48}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass