; LLVM IR from attractivechaos/klib :: test (kbtree_test)

; 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.kbtree_str_t = type { ptr, i32, i32, i32, i32, i32, i32, i32, i32 }

@data_size = external hidden global i32, align 4
@str_data = external hidden global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1

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

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #1

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

; 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
declare dso_local ptr @kb_init_str(i32 noundef) #3

declare i32 @printf(ptr noundef, ...) #4

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #5

; Function Attrs: nounwind uwtable
define dso_local void @ht_khash_str() #3 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  %9 = load ptr, ptr @str_data, align 8, !tbaa !5
  store ptr %9, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %10 = call ptr @kb_init_str(i32 noundef 512)
  store ptr %10, ptr %3, align 8, !tbaa !5
  store i32 0, ptr %1, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %40, %0
  %12 = load i32, ptr %1, align 4, !tbaa !9
  %13 = load i32, ptr @data_size, align 4, !tbaa !9
  %14 = icmp slt i32 %12, %13
  br i1 %14, label %15, label %43

15:                                               ; preds = %11
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = load i32, ptr %1, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds ptr, ptr %17, i64 %19
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = call ptr @kb_get_str(ptr noundef %16, ptr noundef %21)
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %31

24:                                               ; preds = %15
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = load i32, ptr %1, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds ptr, ptr %26, i64 %28
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  call void @kb_put_str(ptr noundef %25, ptr noundef %30)
  br label %39

31:                                               ; preds = %15
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = load i32, ptr %1, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds ptr, ptr %33, i64 %35
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = call ptr @kb_del_str(ptr noundef %32, ptr noundef %37)
  br label %39

39:                                               ; preds = %31, %24
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %1, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %1, align 4, !tbaa !9
  br label %11, !llvm.loop !11

43:                                               ; preds = %11
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.kbtree_str_t, ptr %44, i32 0, i32 7
  %46 = load i32, ptr %45, align 8, !tbaa !13
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %46)
  br label %48

48:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 8, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store ptr null, ptr %8, align 8, !tbaa !5
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %137

51:                                               ; preds = %48
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = call noalias ptr @calloc(i64 noundef %53, i64 noundef 8) #8
  store ptr %54, ptr %8, align 8, !tbaa !5
  store ptr %54, ptr %7, align 8, !tbaa !5
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.kbtree_str_t, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds ptr, ptr %58, i32 1
  store ptr %59, ptr %7, align 8, !tbaa !5
  store ptr %57, ptr %58, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %134, %73, %51
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = icmp ne ptr %61, %62
  br i1 %63, label %64, label %136

64:                                               ; preds = %60
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = getelementptr inbounds ptr, ptr %65, i32 -1
  store ptr %66, ptr %7, align 8, !tbaa !5
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  store ptr %67, ptr %6, align 8, !tbaa !5
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = load i32, ptr %68, align 4
  %70 = shl i32 %69, 31
  %71 = ashr i32 %70, 31
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %75

73:                                               ; preds = %64
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %74) #7
  br label %60, !llvm.loop !16

75:                                               ; preds = %64
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %131, %75
  %77 = load i32, ptr %4, align 4, !tbaa !9
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = load i32, ptr %78, align 4
  %80 = ashr i32 %79, 1
  %81 = icmp sle i32 %77, %80
  br i1 %81, label %82, label %134

82:                                               ; preds = %76
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.kbtree_str_t, ptr %84, i32 0, i32 2
  %86 = load i32, ptr %85, align 4, !tbaa !17
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i8, ptr %83, i64 %87
  %89 = load i32, ptr %4, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds ptr, ptr %88, i64 %90
  %92 = load ptr, ptr %91, align 8, !tbaa !5
  %93 = icmp ne ptr %92, null
  br i1 %93, label %94, label %130

94:                                               ; preds = %82
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = ptrtoint ptr %95 to i64
  %98 = ptrtoint ptr %96 to i64
  %99 = sub i64 %97, %98
  %100 = sdiv exact i64 %99, 8
  %101 = load i32, ptr %5, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = icmp eq i64 %100, %102
  br i1 %103, label %104, label %117

104:                                              ; preds = %94
  %105 = load i32, ptr %5, align 4, !tbaa !9
  %106 = shl i32 %105, 1
  store i32 %106, ptr %5, align 4, !tbaa !9
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  %108 = load i32, ptr %5, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = mul i64 %109, 8
  %111 = call ptr @realloc(ptr noundef %107, i64 noundef %110) #9
  store ptr %111, ptr %8, align 8, !tbaa !5
  %112 = load ptr, ptr %8, align 8, !tbaa !5
  %113 = load i32, ptr %5, align 4, !tbaa !9
  %114 = ashr i32 %113, 1
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds ptr, ptr %112, i64 %115
  store ptr %116, ptr %7, align 8, !tbaa !5
  br label %117

117:                                              ; preds = %104, %94
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.kbtree_str_t, ptr %119, i32 0, i32 2
  %121 = load i32, ptr %120, align 4, !tbaa !17
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds i8, ptr %118, i64 %122
  %124 = load i32, ptr %4, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds ptr, ptr %123, i64 %125
  %127 = load ptr, ptr %126, align 8, !tbaa !5
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  %129 = getelementptr inbounds ptr, ptr %128, i32 1
  store ptr %129, ptr %7, align 8, !tbaa !5
  store ptr %127, ptr %128, align 8, !tbaa !5
  br label %130

130:                                              ; preds = %117, %82
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %4, align 4, !tbaa !9
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %4, align 4, !tbaa !9
  br label %76, !llvm.loop !18

134:                                              ; preds = %76
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %135) #7
  br label %60, !llvm.loop !16

136:                                              ; preds = %60
  br label %137

137:                                              ; preds = %136, %48
  %138 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %138) #7
  %139 = load ptr, ptr %8, align 8, !tbaa !5
  call void @free(ptr noundef %139) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %140

140:                                              ; preds = %137
  br label %141

141:                                              ; preds = %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #7
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @kb_get_str(ptr noundef, ptr noundef) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @kb_put_str(ptr noundef, ptr noundef) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @kb_del_str(ptr noundef, ptr noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(0,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 = { 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 = { 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 #4 = { "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 allocsize(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 #6 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0,1) }
attributes #9 = { nounwind allocsize(1) }

!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}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 32}
!14 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36}
!15 = !{!14, !6, i64 0}
!16 = distinct !{!16, !12}
!17 = !{!14, !10, i64 12}
!18 = distinct !{!18, !12}


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

@data_size = external hidden local_unnamed_addr global i32, align 4
@str_data = external hidden local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @kb_init_str(i32 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local void @ht_khash_str() local_unnamed_addr #2 {
  %1 = load ptr, ptr @str_data, align 8, !tbaa !5
  %2 = tail call ptr @kb_init_str(i32 noundef 512)
  %3 = load i32, ptr @data_size, align 4, !tbaa !9
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %13
  %indvars.iv = phi i64 [ %indvars.iv.next, %13 ], [ 0, %0 ]
  %5 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = tail call ptr @kb_get_str(ptr noundef %2, ptr noundef %6)
  %8 = icmp eq ptr %7, null
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  br i1 %8, label %10, label %11

10:                                               ; preds = %.lr.ph
  tail call void @kb_put_str(ptr noundef %2, ptr noundef %9)
  br label %13

11:                                               ; preds = %.lr.ph
  %12 = tail call ptr @kb_del_str(ptr noundef %2, ptr noundef %9)
  br label %13

13:                                               ; preds = %10, %11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr @data_size, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next, %15
  br i1 %16, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %13, %0
  %17 = getelementptr inbounds i8, ptr %2, i64 32
  %18 = load i32, ptr %17, align 8, !tbaa !13
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %18)
  %20 = tail call noalias dereferenceable_or_null(64) ptr @calloc(i64 noundef 8, i64 noundef 8) #6
  %21 = load ptr, ptr %2, align 8, !tbaa !15
  %22 = getelementptr inbounds i8, ptr %20, i64 8
  store ptr %21, ptr %20, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %2, i64 12
  br label %.lr.ph59

.lr.ph59:                                         ; preds = %._crit_edge, %.outer
  %.0.ph74 = phi ptr [ %20, %._crit_edge ], [ %.1.lcssa, %.outer ]
  %.041.ph73 = phi ptr [ %22, %._crit_edge ], [ %.142.lcssa, %.outer ]
  %.046.ph72 = phi i32 [ 8, %._crit_edge ], [ %.147.lcssa, %.outer ]
  br label %24

24:                                               ; preds = %.lr.ph59, %30
  %.04158 = phi ptr [ %.041.ph73, %.lr.ph59 ], [ %25, %30 ]
  %25 = getelementptr inbounds i8, ptr %.04158, i64 -8
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = load i32, ptr %26, align 4
  %28 = and i32 %27, 1
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %.preheader

.preheader:                                       ; preds = %24
  %.not5362 = icmp slt i32 %27, 0
  br i1 %.not5362, label %.outer, label %.lr.ph67.preheader

.lr.ph67.preheader:                               ; preds = %.preheader
  %.pre = load i32, ptr %23, align 4, !tbaa !16
  br label %.lr.ph67

30:                                               ; preds = %24
  tail call void @free(ptr noundef nonnull %26) #7
  %.not52 = icmp eq ptr %25, %.0.ph74
  br i1 %.not52, label %.outer._crit_edge, label %24, !llvm.loop !17

.lr.ph67:                                         ; preds = %.lr.ph67.preheader, %60
  %31 = phi i32 [ %27, %.lr.ph67.preheader ], [ %61, %60 ]
  %32 = phi i32 [ %.pre, %.lr.ph67.preheader ], [ %62, %60 ]
  %33 = phi i32 [ %.pre, %.lr.ph67.preheader ], [ %63, %60 ]
  %indvars.iv81 = phi i64 [ 0, %.lr.ph67.preheader ], [ %indvars.iv.next82, %60 ]
  %.166 = phi ptr [ %.0.ph74, %.lr.ph67.preheader ], [ %.3, %60 ]
  %.14265 = phi ptr [ %25, %.lr.ph67.preheader ], [ %.344, %60 ]
  %.14764 = phi i32 [ %.046.ph72, %.lr.ph67.preheader ], [ %.349, %60 ]
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %26, i64 %34
  %36 = getelementptr inbounds ptr, ptr %35, i64 %indvars.iv81
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %.not54 = icmp eq ptr %37, null
  br i1 %.not54, label %60, label %38

38:                                               ; preds = %.lr.ph67
  %39 = ptrtoint ptr %.14265 to i64
  %40 = ptrtoint ptr %.166 to i64
  %41 = sub i64 %39, %40
  %42 = ashr exact i64 %41, 3
  %43 = sext i32 %.14764 to i64
  %44 = icmp eq i64 %42, %43
  br i1 %44, label %45, label %53

45:                                               ; preds = %38
  %46 = shl i32 %.14764, 1
  %47 = sext i32 %46 to i64
  %48 = shl nsw i64 %47, 3
  %49 = tail call ptr @realloc(ptr noundef %.166, i64 noundef %48) #8
  %50 = ashr exact i32 %46, 1
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds ptr, ptr %49, i64 %51
  %.pre84 = load i32, ptr %23, align 4, !tbaa !16
  br label %53

53:                                               ; preds = %45, %38
  %54 = phi i32 [ %.pre84, %45 ], [ %32, %38 ]
  %.248 = phi i32 [ %46, %45 ], [ %.14764, %38 ]
  %.243 = phi ptr [ %52, %45 ], [ %.14265, %38 ]
  %.2 = phi ptr [ %49, %45 ], [ %.166, %38 ]
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i8, ptr %26, i64 %55
  %57 = getelementptr inbounds ptr, ptr %56, i64 %indvars.iv81
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %.243, i64 8
  store ptr %58, ptr %.243, align 8, !tbaa !5
  %.pre85 = load i32, ptr %26, align 4
  br label %60

60:                                               ; preds = %.lr.ph67, %53
  %61 = phi i32 [ %.pre85, %53 ], [ %31, %.lr.ph67 ]
  %62 = phi i32 [ %54, %53 ], [ %32, %.lr.ph67 ]
  %63 = phi i32 [ %54, %53 ], [ %33, %.lr.ph67 ]
  %.349 = phi i32 [ %.248, %53 ], [ %.14764, %.lr.ph67 ]
  %.344 = phi ptr [ %59, %53 ], [ %.14265, %.lr.ph67 ]
  %.3 = phi ptr [ %.2, %53 ], [ %.166, %.lr.ph67 ]
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %64 = ashr i32 %61, 1
  %65 = sext i32 %64 to i64
  %.not53.not = icmp slt i64 %indvars.iv81, %65
  br i1 %.not53.not, label %.lr.ph67, label %.outer, !llvm.loop !18

.outer:                                           ; preds = %60, %.preheader
  %.147.lcssa = phi i32 [ %.046.ph72, %.preheader ], [ %.349, %60 ]
  %.142.lcssa = phi ptr [ %25, %.preheader ], [ %.344, %60 ]
  %.1.lcssa = phi ptr [ %.0.ph74, %.preheader ], [ %.3, %60 ]
  tail call void @free(ptr noundef nonnull %26) #7
  %.not5257 = icmp eq ptr %.142.lcssa, %.1.lcssa
  br i1 %.not5257, label %.outer._crit_edge, label %.lr.ph59, !llvm.loop !17

.outer._crit_edge:                                ; preds = %.outer, %30
  %.0.ph.lcssa = phi ptr [ %.0.ph74, %30 ], [ %.1.lcssa, %.outer ]
  tail call void @free(ptr noundef %2) #7
  tail call void @free(ptr noundef %.0.ph.lcssa) #7
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @kb_get_str(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @kb_put_str(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @kb_del_str(ptr noundef, ptr noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(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 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 #2 = { 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 #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 nounwind willreturn allockind("realloc") allocsize(1) 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 #5 = { inlinehint 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 #6 = { nounwind allocsize(0,1) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(1) }

!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}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 32}
!14 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36}
!15 = !{!14, !6, i64 0}
!16 = !{!14, !10, i64 12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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