; LLVM IR from clibs/clib :: deps/parse-repo (parse-repo)

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

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

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

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strchr(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

declare ptr @substr(ptr noundef, i32 noundef, i32 noundef) #3

; 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 ptr @parse_repo_name(ptr noundef %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr null, ptr %7, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = icmp eq ptr null, %13
  br i1 %14, label %15, label %16

15:                                               ; preds = %1
  store ptr null, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %83

16:                                               ; preds = %1
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = call i64 @strlen(ptr noundef %17) #6
  %19 = icmp eq i64 0, %18
  br i1 %19, label %20, label %21

20:                                               ; preds = %16
  store ptr null, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %83

21:                                               ; preds = %16
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = call noalias ptr @strdup(ptr noundef %22) #5
  store ptr %23, ptr %5, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store ptr null, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %83

26:                                               ; preds = %21
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = call ptr @strchr(ptr noundef %27, i32 noundef 64) #6
  store ptr %28, ptr %7, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %49

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = ptrtoint ptr %31 to i64
  %34 = ptrtoint ptr %32 to i64
  %35 = sub i64 %33, %34
  %36 = trunc i64 %35 to i32
  store i32 %36, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = load i32, ptr %9, align 4, !tbaa !9
  %39 = call ptr @substr(ptr noundef %37, i32 noundef 0, i32 noundef %38)
  store ptr %39, ptr %10, align 8, !tbaa !5
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %40) #5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %44, label %43

43:                                               ; preds = %30
  store ptr null, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %46

44:                                               ; preds = %30
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %45, ptr %5, align 8, !tbaa !5
  store i32 0, ptr %8, align 4
  br label %46

46:                                               ; preds = %44, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %47 = load i32, ptr %8, align 4
  switch i32 %47, label %83 [
    i32 0, label %48
  ]

48:                                               ; preds = %46
  br label %49

49:                                               ; preds = %48, %26
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = call ptr @strchr(ptr noundef %50, i32 noundef 47) #6
  store ptr %51, ptr %4, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %53, label %74

53:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = ptrtoint ptr %54 to i64
  %57 = ptrtoint ptr %55 to i64
  %58 = sub i64 %56, %57
  %59 = trunc i64 %58 to i32
  store i32 %59, ptr %11, align 4, !tbaa !9
  %60 = load i32, ptr %11, align 4, !tbaa !9
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %64, label %62

62:                                               ; preds = %53
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %63) #5
  store ptr null, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %71

64:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = load i32, ptr %11, align 4, !tbaa !9
  %67 = add nsw i32 %66, 1
  %68 = call ptr @substr(ptr noundef %65, i32 noundef %67, i32 noundef -1)
  store ptr %68, ptr %12, align 8, !tbaa !5
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %69) #5
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %70, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  store i32 0, ptr %8, align 4
  br label %71

71:                                               ; preds = %64, %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %72 = load i32, ptr %8, align 4
  switch i32 %72, label %83 [
    i32 0, label %73
  ]

73:                                               ; preds = %71
  br label %74

74:                                               ; preds = %73, %49
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = icmp ne ptr %75, null
  br i1 %76, label %77, label %80

77:                                               ; preds = %74
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = call noalias ptr @strdup(ptr noundef %78) #5
  store ptr %79, ptr %6, align 8, !tbaa !5
  br label %80

80:                                               ; preds = %77, %74
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %81) #5
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %82, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %83

83:                                               ; preds = %80, %71, %46, %25, %20, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %84 = load ptr, ptr %2, align 8
  ret ptr %84
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "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 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"int", !7, i64 0}


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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strchr(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

declare ptr @substr(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local noalias ptr @parse_repo_name(ptr noundef readonly %0) local_unnamed_addr #4 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %27, label %3

3:                                                ; preds = %1
  %char0 = load i8, ptr %0, align 1
  %4 = icmp eq i8 %char0, 0
  br i1 %4, label %27, label %5

5:                                                ; preds = %3
  %6 = tail call noalias ptr @strdup(ptr noundef nonnull %0) #5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %27, label %7

7:                                                ; preds = %5
  %8 = tail call ptr @strchr(ptr noundef nonnull dereferenceable(1) %6, i32 noundef 64) #6
  %.not39 = icmp eq ptr %8, null
  br i1 %.not39, label %15, label %9

9:                                                ; preds = %7
  %10 = ptrtoint ptr %8 to i64
  %11 = ptrtoint ptr %6 to i64
  %12 = sub i64 %10, %11
  %13 = trunc i64 %12 to i32
  %14 = tail call ptr @substr(ptr noundef nonnull %6, i32 noundef 0, i32 noundef %13) #5
  tail call void @free(ptr noundef nonnull %6) #5
  %.not40.not = icmp eq ptr %14, null
  br i1 %.not40.not, label %27, label %15

15:                                               ; preds = %9, %7
  %.128 = phi ptr [ %14, %9 ], [ %6, %7 ]
  %16 = tail call ptr @strchr(ptr noundef nonnull dereferenceable(1) %.128, i32 noundef 47) #6
  %.not41 = icmp eq ptr %16, null
  br i1 %.not41, label %.thread45, label %17

17:                                               ; preds = %15
  %18 = ptrtoint ptr %16 to i64
  %19 = ptrtoint ptr %.128 to i64
  %20 = sub i64 %18, %19
  %21 = trunc i64 %20 to i32
  %.not42.not = icmp eq i32 %21, 0
  br i1 %.not42.not, label %.thread, label %22

.thread:                                          ; preds = %17
  tail call void @free(ptr noundef nonnull %.128) #5
  br label %27

22:                                               ; preds = %17
  %23 = add nsw i32 %21, 1
  %24 = tail call ptr @substr(ptr noundef nonnull %.128, i32 noundef %23, i32 noundef -1) #5
  tail call void @free(ptr noundef nonnull %.128) #5
  %.not43 = icmp eq ptr %24, null
  br i1 %.not43, label %26, label %.thread45

.thread45:                                        ; preds = %15, %22
  %.33048 = phi ptr [ %24, %22 ], [ %.128, %15 ]
  %25 = tail call noalias ptr @strdup(ptr noundef nonnull %.33048) #5
  br label %26

26:                                               ; preds = %.thread45, %22
  %.33049 = phi ptr [ %.33048, %.thread45 ], [ null, %22 ]
  %.031 = phi ptr [ %25, %.thread45 ], [ null, %22 ]
  tail call void @free(ptr noundef %.33049) #5
  br label %27

27:                                               ; preds = %.thread, %5, %3, %1, %9, %26
  %.3 = phi ptr [ %.031, %26 ], [ null, %9 ], [ null, %1 ], [ null, %3 ], [ null, %5 ], [ null, %.thread ]
  ret ptr %.3
}

attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 #2 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 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 #5 = { nounwind }
attributes #6 = { 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)"}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass