; LLVM IR from likle/cwalk :: src (cwalk)

; 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.cwk_segment_joined = type { %struct.cwk_segment, ptr, i64 }
%struct.cwk_segment = type { ptr, ptr, ptr, ptr, i64 }

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @cwk_path_get_relative(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) #1 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i8, align 1
  %16 = alloca i8, align 1
  %17 = alloca [2 x ptr], align 16
  %18 = alloca [2 x ptr], align 16
  %19 = alloca %struct.cwk_segment_joined, align 8
  %20 = alloca %struct.cwk_segment_joined, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i64 %3, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #2
  call void @llvm.lifetime.start.p0(i64 56, ptr %19) #2
  call void @llvm.lifetime.start.p0(i64 56, ptr %20) #2
  store i64 0, ptr %10, align 8, !tbaa !9
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  call void @cwk_path_get_root(ptr noundef %22, ptr noundef %11)
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  call void @cwk_path_get_root(ptr noundef %23, ptr noundef %12)
  %24 = load i64, ptr %11, align 8, !tbaa !9
  %25 = load i64, ptr %12, align 8, !tbaa !9
  %26 = icmp ne i64 %24, %25
  br i1 %26, label %33, label %27

27:                                               ; preds = %4
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = load i64, ptr %11, align 8, !tbaa !9
  %31 = load i64, ptr %12, align 8, !tbaa !9
  %32 = call zeroext i1 @cwk_path_is_string_equal(ptr noundef %28, ptr noundef %29, i64 noundef %30, i64 noundef %31)
  br i1 %32, label %38, label %33

33:                                               ; preds = %27, %4
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = load i64, ptr %9, align 8, !tbaa !9
  %36 = load i64, ptr %10, align 8, !tbaa !9
  call void @cwk_path_terminate_output(ptr noundef %34, i64 noundef %35, i64 noundef %36)
  %37 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %37, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %128

38:                                               ; preds = %27
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load i64, ptr %11, align 8, !tbaa !9
  %41 = call zeroext i1 @cwk_path_is_root_absolute(ptr noundef %39, i64 noundef %40)
  %42 = zext i1 %41 to i8
  store i8 %42, ptr %13, align 1, !tbaa !11
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds [2 x ptr], ptr %17, i64 0, i64 0
  store ptr %43, ptr %44, align 16, !tbaa !5
  %45 = getelementptr inbounds [2 x ptr], ptr %17, i64 0, i64 1
  store ptr null, ptr %45, align 8, !tbaa !5
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds [2 x ptr], ptr %18, i64 0, i64 0
  store ptr %46, ptr %47, align 16, !tbaa !5
  %48 = getelementptr inbounds [2 x ptr], ptr %18, i64 0, i64 1
  store ptr null, ptr %48, align 8, !tbaa !5
  %49 = getelementptr inbounds [2 x ptr], ptr %17, i64 0, i64 0
  %50 = call zeroext i1 @cwk_path_get_first_segment_joined(ptr noundef %49, ptr noundef %19)
  %51 = getelementptr inbounds [2 x ptr], ptr %18, i64 0, i64 0
  %52 = call zeroext i1 @cwk_path_get_first_segment_joined(ptr noundef %51, ptr noundef %20)
  %53 = load i8, ptr %13, align 1, !tbaa !11, !range !13, !noundef !14
  %54 = trunc i8 %53 to i1
  call void @cwk_path_skip_segments_until_diverge(ptr noundef %19, ptr noundef %20, i1 noundef zeroext %54, ptr noundef %14, ptr noundef %15)
  store i8 0, ptr %16, align 1, !tbaa !11
  %55 = load i8, ptr %14, align 1, !tbaa !11, !range !13, !noundef !14
  %56 = trunc i8 %55 to i1
  br i1 %56, label %57, label %79

57:                                               ; preds = %38
  br label %58

58:                                               ; preds = %76, %57
  %59 = load i8, ptr %13, align 1, !tbaa !11, !range !13, !noundef !14
  %60 = trunc i8 %59 to i1
  %61 = call zeroext i1 @cwk_path_segment_joined_skip_invisible(ptr noundef %19, i1 noundef zeroext %60)
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  br label %78

63:                                               ; preds = %58
  store i8 1, ptr %16, align 1, !tbaa !11
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = load i64, ptr %9, align 8, !tbaa !9
  %66 = load i64, ptr %10, align 8, !tbaa !9
  %67 = call i64 @cwk_path_output_back(ptr noundef %64, i64 noundef %65, i64 noundef %66)
  %68 = load i64, ptr %10, align 8, !tbaa !9
  %69 = add i64 %68, %67
  store i64 %69, ptr %10, align 8, !tbaa !9
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = load i64, ptr %9, align 8, !tbaa !9
  %72 = load i64, ptr %10, align 8, !tbaa !9
  %73 = call i64 @cwk_path_output_separator(ptr noundef %70, i64 noundef %71, i64 noundef %72)
  %74 = load i64, ptr %10, align 8, !tbaa !9
  %75 = add i64 %74, %73
  store i64 %75, ptr %10, align 8, !tbaa !9
  br label %76

76:                                               ; preds = %63
  %77 = call zeroext i1 @cwk_path_get_next_segment_joined(ptr noundef %19)
  br i1 %77, label %58, label %78, !llvm.loop !15

78:                                               ; preds = %76, %62
  br label %79

79:                                               ; preds = %78, %38
  %80 = load i8, ptr %15, align 1, !tbaa !11, !range !13, !noundef !14
  %81 = trunc i8 %80 to i1
  br i1 %81, label %82, label %110

82:                                               ; preds = %79
  br label %83

83:                                               ; preds = %107, %82
  %84 = load i8, ptr %13, align 1, !tbaa !11, !range !13, !noundef !14
  %85 = trunc i8 %84 to i1
  %86 = call zeroext i1 @cwk_path_segment_joined_skip_invisible(ptr noundef %20, i1 noundef zeroext %85)
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  br label %109

88:                                               ; preds = %83
  store i8 1, ptr %16, align 1, !tbaa !11
  %89 = load ptr, ptr %8, align 8, !tbaa !5
  %90 = load i64, ptr %9, align 8, !tbaa !9
  %91 = load i64, ptr %10, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.cwk_segment_joined, ptr %20, i32 0, i32 0
  %93 = getelementptr inbounds %struct.cwk_segment, ptr %92, i32 0, i32 2
  %94 = load ptr, ptr %93, align 8, !tbaa !17
  %95 = getelementptr inbounds %struct.cwk_segment_joined, ptr %20, i32 0, i32 0
  %96 = getelementptr inbounds %struct.cwk_segment, ptr %95, i32 0, i32 4
  %97 = load i64, ptr %96, align 8, !tbaa !20
  %98 = call i64 @cwk_path_output_sized(ptr noundef %89, i64 noundef %90, i64 noundef %91, ptr noundef %94, i64 noundef %97)
  %99 = load i64, ptr %10, align 8, !tbaa !9
  %100 = add i64 %99, %98
  store i64 %100, ptr %10, align 8, !tbaa !9
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = load i64, ptr %9, align 8, !tbaa !9
  %103 = load i64, ptr %10, align 8, !tbaa !9
  %104 = call i64 @cwk_path_output_separator(ptr noundef %101, i64 noundef %102, i64 noundef %103)
  %105 = load i64, ptr %10, align 8, !tbaa !9
  %106 = add i64 %105, %104
  store i64 %106, ptr %10, align 8, !tbaa !9
  br label %107

107:                                              ; preds = %88
  %108 = call zeroext i1 @cwk_path_get_next_segment_joined(ptr noundef %20)
  br i1 %108, label %83, label %109, !llvm.loop !21

109:                                              ; preds = %107, %87
  br label %110

110:                                              ; preds = %109, %79
  %111 = load i8, ptr %16, align 1, !tbaa !11, !range !13, !noundef !14
  %112 = trunc i8 %111 to i1
  br i1 %112, label %113, label %116

113:                                              ; preds = %110
  %114 = load i64, ptr %10, align 8, !tbaa !9
  %115 = add i64 %114, -1
  store i64 %115, ptr %10, align 8, !tbaa !9
  br label %123

116:                                              ; preds = %110
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  %118 = load i64, ptr %9, align 8, !tbaa !9
  %119 = load i64, ptr %10, align 8, !tbaa !9
  %120 = call i64 @cwk_path_output_current(ptr noundef %117, i64 noundef %118, i64 noundef %119)
  %121 = load i64, ptr %10, align 8, !tbaa !9
  %122 = add i64 %121, %120
  store i64 %122, ptr %10, align 8, !tbaa !9
  br label %123

123:                                              ; preds = %116, %113
  %124 = load ptr, ptr %8, align 8, !tbaa !5
  %125 = load i64, ptr %9, align 8, !tbaa !9
  %126 = load i64, ptr %10, align 8, !tbaa !9
  call void @cwk_path_terminate_output(ptr noundef %124, i64 noundef %125, i64 noundef %126)
  %127 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %127, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %128

128:                                              ; preds = %123, %33
  call void @llvm.lifetime.end.p0(i64 56, ptr %20) #2
  call void @llvm.lifetime.end.p0(i64 56, ptr %19) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  %129 = load i64, ptr %5, align 8
  ret i64 %129
}

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @cwk_path_is_string_equal(ptr noundef, ptr noundef, i64 noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @cwk_path_terminate_output(ptr noundef, i64 noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @cwk_path_is_root_absolute(ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @cwk_path_get_first_segment_joined(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @cwk_path_skip_segments_until_diverge(ptr noundef, ptr noundef, i1 noundef zeroext, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @cwk_path_segment_joined_skip_invisible(ptr noundef, i1 noundef zeroext) #1

; Function Attrs: nounwind uwtable
declare hidden i64 @cwk_path_output_back(ptr noundef, i64 noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i64 @cwk_path_output_separator(ptr noundef, i64 noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @cwk_path_get_next_segment_joined(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i64 @cwk_path_output_sized(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i64 @cwk_path_output_current(ptr noundef, i64 noundef, i64 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !6, i64 16}
!18 = !{!"cwk_segment_joined", !19, i64 0, !6, i64 40, !10, i64 48}
!19 = !{!"cwk_segment", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32}
!20 = !{!18, !10, i64 32}
!21 = distinct !{!21, !16}


; 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.cwk_segment_joined = type { %struct.cwk_segment, ptr, i64 }
%struct.cwk_segment = type { ptr, ptr, ptr, ptr, i64 }

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i64 @cwk_path_get_relative(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) local_unnamed_addr #1 {
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i8, align 1
  %8 = alloca i8, align 1
  %9 = alloca [2 x ptr], align 16
  %10 = alloca [2 x ptr], align 16
  %11 = alloca %struct.cwk_segment_joined, align 8
  %12 = alloca %struct.cwk_segment_joined, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #2
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %11) #2
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %12) #2
  call void @cwk_path_get_root(ptr noundef %0, ptr noundef nonnull %5)
  call void @cwk_path_get_root(ptr noundef %1, ptr noundef nonnull %6)
  %13 = load i64, ptr %5, align 8, !tbaa !5
  %14 = load i64, ptr %6, align 8, !tbaa !5
  %.not = icmp eq i64 %13, %14
  br i1 %.not, label %15, label %53

15:                                               ; preds = %4
  %16 = call zeroext i1 @cwk_path_is_string_equal(ptr noundef %0, ptr noundef %1, i64 noundef %13, i64 noundef %13)
  br i1 %16, label %17, label %53

17:                                               ; preds = %15
  %18 = load i64, ptr %5, align 8, !tbaa !5
  %19 = call zeroext i1 @cwk_path_is_root_absolute(ptr noundef %0, i64 noundef %18)
  store ptr %0, ptr %9, align 16, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %9, i64 8
  store ptr null, ptr %20, align 8, !tbaa !9
  store ptr %1, ptr %10, align 16, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %10, i64 8
  store ptr null, ptr %21, align 8, !tbaa !9
  %22 = call zeroext i1 @cwk_path_get_first_segment_joined(ptr noundef nonnull %9, ptr noundef nonnull %11)
  %23 = call zeroext i1 @cwk_path_get_first_segment_joined(ptr noundef nonnull %10, ptr noundef nonnull %12)
  call void @cwk_path_skip_segments_until_diverge(ptr noundef nonnull %11, ptr noundef nonnull %12, i1 noundef zeroext %19, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %24 = load i8, ptr %7, align 1, !tbaa !11, !range !13, !noundef !14
  %25 = trunc nuw i8 %24 to i1
  br i1 %25, label %.preheader50, label %.loopexit51

.preheader50:                                     ; preds = %17
  %26 = call zeroext i1 @cwk_path_segment_joined_skip_invisible(ptr noundef nonnull %11, i1 noundef zeroext %19)
  br i1 %26, label %.lr.ph, label %.loopexit51

27:                                               ; preds = %.lr.ph
  %28 = call zeroext i1 @cwk_path_segment_joined_skip_invisible(ptr noundef nonnull %11, i1 noundef zeroext %19)
  br i1 %28, label %.lr.ph, label %.loopexit51, !llvm.loop !15

.lr.ph:                                           ; preds = %.preheader50, %27
  %.04154 = phi i64 [ %32, %27 ], [ 0, %.preheader50 ]
  %29 = call i64 @cwk_path_output_back(ptr noundef %2, i64 noundef %3, i64 noundef %.04154)
  %30 = add i64 %29, %.04154
  %31 = call i64 @cwk_path_output_separator(ptr noundef %2, i64 noundef %3, i64 noundef %30)
  %32 = add i64 %30, %31
  %33 = call zeroext i1 @cwk_path_get_next_segment_joined(ptr noundef nonnull %11)
  br i1 %33, label %27, label %.loopexit51, !llvm.loop !15

.loopexit51:                                      ; preds = %27, %.lr.ph, %.preheader50, %17
  %.142 = phi i64 [ 0, %17 ], [ 0, %.preheader50 ], [ %32, %.lr.ph ], [ %32, %27 ]
  %.1 = phi i1 [ false, %17 ], [ false, %.preheader50 ], [ true, %.lr.ph ], [ true, %27 ]
  %34 = load i8, ptr %8, align 1, !tbaa !11, !range !13, !noundef !14
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %.loopexit51
  %36 = call zeroext i1 @cwk_path_segment_joined_skip_invisible(ptr noundef nonnull %12, i1 noundef zeroext %19)
  br i1 %36, label %.lr.ph60, label %.loopexit

.lr.ph60:                                         ; preds = %.preheader
  %37 = getelementptr inbounds i8, ptr %12, i64 16
  %38 = getelementptr inbounds i8, ptr %12, i64 32
  br label %41

39:                                               ; preds = %41
  %40 = call zeroext i1 @cwk_path_segment_joined_skip_invisible(ptr noundef nonnull %12, i1 noundef zeroext %19)
  br i1 %40, label %41, label %.thread, !llvm.loop !17

41:                                               ; preds = %.lr.ph60, %39
  %.24359 = phi i64 [ %.142, %.lr.ph60 ], [ %47, %39 ]
  %42 = load ptr, ptr %37, align 8, !tbaa !18
  %43 = load i64, ptr %38, align 8, !tbaa !21
  %44 = call i64 @cwk_path_output_sized(ptr noundef %2, i64 noundef %3, i64 noundef %.24359, ptr noundef %42, i64 noundef %43)
  %45 = add i64 %44, %.24359
  %46 = call i64 @cwk_path_output_separator(ptr noundef %2, i64 noundef %3, i64 noundef %45)
  %47 = add i64 %45, %46
  %48 = call zeroext i1 @cwk_path_get_next_segment_joined(ptr noundef nonnull %12)
  br i1 %48, label %39, label %.thread, !llvm.loop !17

.loopexit:                                        ; preds = %.preheader, %.loopexit51
  br i1 %.1, label %.thread, label %50

.thread:                                          ; preds = %39, %41, %.loopexit
  %.34449 = phi i64 [ %.142, %.loopexit ], [ %47, %41 ], [ %47, %39 ]
  %49 = add i64 %.34449, -1
  br label %53

50:                                               ; preds = %.loopexit
  %51 = call i64 @cwk_path_output_current(ptr noundef %2, i64 noundef %3, i64 noundef %.142)
  %52 = add i64 %51, %.142
  br label %53

53:                                               ; preds = %.thread, %50, %4, %15
  %.4.sink = phi i64 [ 0, %15 ], [ 0, %4 ], [ %49, %.thread ], [ %52, %50 ]
  call void @cwk_path_terminate_output(ptr noundef %2, i64 noundef %3, i64 noundef %.4.sink)
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %12) #2
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %11) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #2
  ret i64 %.4.sink
}

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @cwk_path_is_string_equal(ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @cwk_path_terminate_output(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @cwk_path_is_root_absolute(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @cwk_path_get_first_segment_joined(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @cwk_path_skip_segments_until_diverge(ptr noundef, ptr noundef, i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @cwk_path_segment_joined_skip_invisible(ptr noundef, i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i64 @cwk_path_output_back(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i64 @cwk_path_output_separator(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @cwk_path_get_next_segment_joined(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i64 @cwk_path_output_sized(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i64 @cwk_path_output_current(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!19, !10, i64 16}
!19 = !{!"cwk_segment_joined", !20, i64 0, !10, i64 40, !6, i64 48}
!20 = !{!"cwk_segment", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !6, i64 32}
!21 = !{!19, !6, i64 32}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass