; LLVM IR from buzz-lang/Buzz :: src/buzz (buzzdict)

; 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.buzzdict_entry_s = type { ptr, ptr }
%struct.buzzdict_s = type { ptr, i32, i32, ptr, ptr, ptr, i32, i32 }
%struct.buzzdarray_s = type { ptr, i64, i32, i32, ptr }

; 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 void @buzzdict_set(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.buzzdict_entry_s, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %struct.buzzdict_entry_s, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.buzzdict_s, ptr %13, i32 0, i32 3
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = call i32 %15(ptr noundef %16)
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.buzzdict_s, ptr %18, i32 0, i32 2
  %20 = load i32, ptr %19, align 4, !tbaa !12
  %21 = urem i32 %17, %20
  store i32 %21, ptr %7, align 4, !tbaa !13
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.buzzdict_s, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  %25 = load i32, ptr %7, align 4, !tbaa !13
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds ptr, ptr %24, i64 %26
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %85, label %30

30:                                               ; preds = %3
  %31 = call ptr @buzzdarray_new(i32 noundef 1, i32 noundef 16, ptr noundef null)
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.buzzdict_s, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !14
  %35 = load i32, ptr %7, align 4, !tbaa !13
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds ptr, ptr %34, i64 %36
  store ptr %31, ptr %37, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.buzzdict_s, ptr %38, i32 0, i32 6
  %40 = load i32, ptr %39, align 8, !tbaa !15
  %41 = zext i32 %40 to i64
  %42 = call noalias ptr @malloc(i64 noundef %41) #6
  %43 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %8, i32 0, i32 0
  store ptr %42, ptr %43, align 8, !tbaa !16
  %44 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %8, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !16
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.buzzdict_s, ptr %47, i32 0, i32 6
  %49 = load i32, ptr %48, align 8, !tbaa !15
  %50 = zext i32 %49 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %45, ptr align 1 %46, i64 %50, i1 false)
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.buzzdict_s, ptr %51, i32 0, i32 7
  %53 = load i32, ptr %52, align 4, !tbaa !18
  %54 = zext i32 %53 to i64
  %55 = call noalias ptr @malloc(i64 noundef %54) #6
  %56 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %8, i32 0, i32 1
  store ptr %55, ptr %56, align 8, !tbaa !19
  %57 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %8, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !19
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.buzzdict_s, ptr %60, i32 0, i32 7
  %62 = load i32, ptr %61, align 4, !tbaa !18
  %63 = zext i32 %62 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %58, ptr align 1 %59, i64 %63, i1 false)
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.buzzdict_s, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !14
  %67 = load i32, ptr %7, align 4, !tbaa !13
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds ptr, ptr %66, i64 %68
  %70 = load ptr, ptr %69, align 8, !tbaa !5
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.buzzdict_s, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !14
  %74 = load i32, ptr %7, align 4, !tbaa !13
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds ptr, ptr %73, i64 %75
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.buzzdarray_s, ptr %77, i32 0, i32 1
  %79 = load i64, ptr %78, align 8, !tbaa !20
  %80 = trunc i64 %79 to i32
  call void @buzzdarray_insert(ptr noundef %70, i32 noundef %80, ptr noundef %8)
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.buzzdict_s, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 8, !tbaa !23
  %84 = add i32 %83, 1
  store i32 %84, ptr %82, align 8, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  br label %199

85:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !13
  br label %86

86:                                               ; preds = %148, %85
  %87 = load i32, ptr %9, align 4, !tbaa !13
  %88 = zext i32 %87 to i64
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.buzzdict_s, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !14
  %92 = load i32, ptr %7, align 4, !tbaa !13
  %93 = zext i32 %92 to i64
  %94 = getelementptr inbounds ptr, ptr %91, i64 %93
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.buzzdarray_s, ptr %95, i32 0, i32 1
  %97 = load i64, ptr %96, align 8, !tbaa !20
  %98 = icmp slt i64 %88, %97
  br i1 %98, label %99, label %151

99:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.buzzdict_s, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !14
  %103 = load i32, ptr %7, align 4, !tbaa !13
  %104 = zext i32 %103 to i64
  %105 = getelementptr inbounds ptr, ptr %102, i64 %104
  %106 = load ptr, ptr %105, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.buzzdarray_s, ptr %106, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8, !tbaa !24
  %109 = load i32, ptr %9, align 4, !tbaa !13
  %110 = zext i32 %109 to i64
  %111 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %108, i64 %110
  store ptr %111, ptr %10, align 8, !tbaa !5
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.buzzdict_s, ptr %112, i32 0, i32 4
  %114 = load ptr, ptr %113, align 8, !tbaa !25
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8, !tbaa !16
  %119 = call i32 %114(ptr noundef %115, ptr noundef %118)
  %120 = icmp eq i32 %119, 0
  br i1 %120, label %121, label %144

121:                                              ; preds = %99
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.buzzdict_s, ptr %122, i32 0, i32 5
  %124 = load ptr, ptr %123, align 8, !tbaa !26
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8, !tbaa !16
  %128 = load ptr, ptr %10, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %128, i32 0, i32 1
  %130 = load ptr, ptr %129, align 8, !tbaa !19
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  call void %124(ptr noundef %127, ptr noundef %130, ptr noundef %131)
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.buzzdict_s, ptr %132, i32 0, i32 0
  %134 = load ptr, ptr %133, align 8, !tbaa !14
  %135 = load i32, ptr %7, align 4, !tbaa !13
  %136 = zext i32 %135 to i64
  %137 = getelementptr inbounds ptr, ptr %134, i64 %136
  %138 = load ptr, ptr %137, align 8, !tbaa !5
  %139 = load i32, ptr %9, align 4, !tbaa !13
  call void @buzzdarray_remove(ptr noundef %138, i32 noundef %139)
  %140 = load ptr, ptr %4, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.buzzdict_s, ptr %140, i32 0, i32 1
  %142 = load i32, ptr %141, align 8, !tbaa !23
  %143 = add i32 %142, -1
  store i32 %143, ptr %141, align 8, !tbaa !23
  store i32 2, ptr %11, align 4
  br label %145

144:                                              ; preds = %99
  store i32 0, ptr %11, align 4
  br label %145

145:                                              ; preds = %144, %121
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %146 = load i32, ptr %11, align 4
  switch i32 %146, label %200 [
    i32 0, label %147
    i32 2, label %151
  ]

147:                                              ; preds = %145
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %9, align 4, !tbaa !13
  %150 = add i32 %149, 1
  store i32 %150, ptr %9, align 4, !tbaa !13
  br label %86, !llvm.loop !27

151:                                              ; preds = %145, %86
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #5
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.buzzdict_s, ptr %152, i32 0, i32 6
  %154 = load i32, ptr %153, align 8, !tbaa !15
  %155 = zext i32 %154 to i64
  %156 = call noalias ptr @malloc(i64 noundef %155) #6
  %157 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %12, i32 0, i32 0
  store ptr %156, ptr %157, align 8, !tbaa !16
  %158 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %12, i32 0, i32 0
  %159 = load ptr, ptr %158, align 8, !tbaa !16
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.buzzdict_s, ptr %161, i32 0, i32 6
  %163 = load i32, ptr %162, align 8, !tbaa !15
  %164 = zext i32 %163 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %159, ptr align 1 %160, i64 %164, i1 false)
  %165 = load ptr, ptr %4, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.buzzdict_s, ptr %165, i32 0, i32 7
  %167 = load i32, ptr %166, align 4, !tbaa !18
  %168 = zext i32 %167 to i64
  %169 = call noalias ptr @malloc(i64 noundef %168) #6
  %170 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %12, i32 0, i32 1
  store ptr %169, ptr %170, align 8, !tbaa !19
  %171 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %12, i32 0, i32 1
  %172 = load ptr, ptr %171, align 8, !tbaa !19
  %173 = load ptr, ptr %6, align 8, !tbaa !5
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.buzzdict_s, ptr %174, i32 0, i32 7
  %176 = load i32, ptr %175, align 4, !tbaa !18
  %177 = zext i32 %176 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %172, ptr align 1 %173, i64 %177, i1 false)
  %178 = load ptr, ptr %4, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.buzzdict_s, ptr %178, i32 0, i32 0
  %180 = load ptr, ptr %179, align 8, !tbaa !14
  %181 = load i32, ptr %7, align 4, !tbaa !13
  %182 = zext i32 %181 to i64
  %183 = getelementptr inbounds ptr, ptr %180, i64 %182
  %184 = load ptr, ptr %183, align 8, !tbaa !5
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.buzzdict_s, ptr %185, i32 0, i32 0
  %187 = load ptr, ptr %186, align 8, !tbaa !14
  %188 = load i32, ptr %7, align 4, !tbaa !13
  %189 = zext i32 %188 to i64
  %190 = getelementptr inbounds ptr, ptr %187, i64 %189
  %191 = load ptr, ptr %190, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.buzzdarray_s, ptr %191, i32 0, i32 1
  %193 = load i64, ptr %192, align 8, !tbaa !20
  %194 = trunc i64 %193 to i32
  call void @buzzdarray_insert(ptr noundef %184, i32 noundef %194, ptr noundef %12)
  %195 = load ptr, ptr %4, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.buzzdict_s, ptr %195, i32 0, i32 1
  %197 = load i32, ptr %196, align 8, !tbaa !23
  %198 = add i32 %197, 1
  store i32 %198, ptr %196, align 8, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %199

199:                                              ; preds = %151, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void

200:                                              ; preds = %145
  unreachable
}

declare ptr @buzzdarray_new(i32 noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

; 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 @buzzdarray_insert(ptr noundef, i32 noundef, ptr noundef) #2

declare void @buzzdarray_remove(ptr noundef, i32 noundef) #2

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 = { "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 allocsize(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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 16}
!10 = !{!"buzzdict_s", !6, i64 0, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !11, i64 44}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 12}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 0}
!15 = !{!10, !11, i64 40}
!16 = !{!17, !6, i64 0}
!17 = !{!"buzzdict_entry_s", !6, i64 0, !6, i64 8}
!18 = !{!10, !11, i64 44}
!19 = !{!17, !6, i64 8}
!20 = !{!21, !22, i64 8}
!21 = !{!"buzzdarray_s", !6, i64 0, !22, i64 8, !11, i64 16, !11, i64 20, !6, i64 24}
!22 = !{!"long", !7, i64 0}
!23 = !{!10, !11, i64 8}
!24 = !{!21, !6, i64 0}
!25 = !{!10, !6, i64 24}
!26 = !{!10, !6, i64 32}
!27 = distinct !{!27, !28}
!28 = !{!"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.buzzdict_entry_s = type { ptr, ptr }

; 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 void @buzzdict_set(ptr noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #1 {
  %4 = alloca %struct.buzzdict_entry_s, align 8
  %5 = alloca %struct.buzzdict_entry_s, align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = tail call i32 %7(ptr noundef %1) #5
  %9 = getelementptr inbounds i8, ptr %0, i64 12
  %10 = load i32, ptr %9, align 4, !tbaa !11
  %11 = urem i32 %8, %10
  %12 = load ptr, ptr %0, align 8, !tbaa !12
  %13 = zext i32 %11 to i64
  %14 = getelementptr inbounds ptr, ptr %12, i64 %13
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %.not = icmp eq ptr %15, null
  br i1 %.not, label %20, label %.preheader

.preheader:                                       ; preds = %3
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load i64, ptr %16, align 8, !tbaa !14
  %18 = icmp sgt i64 %17, 0
  br i1 %18, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  br label %42

20:                                               ; preds = %3
  %21 = tail call ptr @buzzdarray_new(i32 noundef 1, i32 noundef 16, ptr noundef null) #5
  %22 = load ptr, ptr %0, align 8, !tbaa !12
  %23 = getelementptr inbounds ptr, ptr %22, i64 %13
  store ptr %21, ptr %23, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %24 = getelementptr inbounds i8, ptr %0, i64 40
  %25 = load i32, ptr %24, align 8, !tbaa !17
  %26 = zext i32 %25 to i64
  %27 = tail call noalias ptr @malloc(i64 noundef %26) #6
  store ptr %27, ptr %4, align 8, !tbaa !18
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %27, ptr align 1 %1, i64 %26, i1 false)
  %28 = getelementptr inbounds i8, ptr %0, i64 44
  %29 = load i32, ptr %28, align 4, !tbaa !20
  %30 = zext i32 %29 to i64
  %31 = tail call noalias ptr @malloc(i64 noundef %30) #6
  %32 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %31, ptr %32, align 8, !tbaa !21
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %31, ptr align 1 %2, i64 %30, i1 false)
  %33 = load ptr, ptr %0, align 8, !tbaa !12
  %34 = getelementptr inbounds ptr, ptr %33, i64 %13
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = getelementptr inbounds i8, ptr %35, i64 8
  %37 = load i64, ptr %36, align 8, !tbaa !14
  %38 = trunc i64 %37 to i32
  call void @buzzdarray_insert(ptr noundef %35, i32 noundef %38, ptr noundef nonnull %4) #5
  %39 = getelementptr inbounds i8, ptr %0, i64 8
  %40 = load i32, ptr %39, align 8, !tbaa !22
  %41 = add i32 %40, 1
  store i32 %41, ptr %39, align 8, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  br label %87

42:                                               ; preds = %.lr.ph, %63
  %43 = phi ptr [ %15, %.lr.ph ], [ %68, %63 ]
  %44 = phi i64 [ 0, %.lr.ph ], [ %65, %63 ]
  %.04752 = phi i32 [ 0, %.lr.ph ], [ %64, %63 ]
  %45 = load ptr, ptr %43, align 8, !tbaa !23
  %46 = getelementptr inbounds %struct.buzzdict_entry_s, ptr %45, i64 %44
  %47 = load ptr, ptr %19, align 8, !tbaa !24
  %48 = load ptr, ptr %46, align 8, !tbaa !18
  %49 = tail call i32 %47(ptr noundef %1, ptr noundef %48) #5
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %63

51:                                               ; preds = %42
  %52 = getelementptr inbounds i8, ptr %0, i64 32
  %53 = load ptr, ptr %52, align 8, !tbaa !25
  %54 = load ptr, ptr %46, align 8, !tbaa !18
  %55 = getelementptr inbounds i8, ptr %46, i64 8
  %56 = load ptr, ptr %55, align 8, !tbaa !21
  tail call void %53(ptr noundef %54, ptr noundef %56, ptr noundef nonnull %0) #5
  %57 = load ptr, ptr %0, align 8, !tbaa !12
  %58 = getelementptr inbounds ptr, ptr %57, i64 %13
  %59 = load ptr, ptr %58, align 8, !tbaa !13
  tail call void @buzzdarray_remove(ptr noundef %59, i32 noundef %.04752) #5
  %60 = getelementptr inbounds i8, ptr %0, i64 8
  %61 = load i32, ptr %60, align 8, !tbaa !22
  %62 = add i32 %61, -1
  store i32 %62, ptr %60, align 8, !tbaa !22
  %.pre = load ptr, ptr %0, align 8, !tbaa !12
  %.phi.trans.insert = getelementptr inbounds ptr, ptr %.pre, i64 %13
  %.pre55 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !13
  %.phi.trans.insert56 = getelementptr inbounds i8, ptr %.pre55, i64 8
  %.pre57 = load i64, ptr %.phi.trans.insert56, align 8, !tbaa !14
  br label %.loopexit

63:                                               ; preds = %42
  %64 = add i32 %.04752, 1
  %65 = zext i32 %64 to i64
  %66 = load ptr, ptr %0, align 8, !tbaa !12
  %67 = getelementptr inbounds ptr, ptr %66, i64 %13
  %68 = load ptr, ptr %67, align 8, !tbaa !13
  %69 = getelementptr inbounds i8, ptr %68, i64 8
  %70 = load i64, ptr %69, align 8, !tbaa !14
  %71 = icmp sgt i64 %70, %65
  br i1 %71, label %42, label %.loopexit, !llvm.loop !26

.loopexit:                                        ; preds = %63, %.preheader, %51
  %72 = phi i64 [ %17, %.preheader ], [ %.pre57, %51 ], [ %70, %63 ]
  %73 = phi ptr [ %15, %.preheader ], [ %.pre55, %51 ], [ %68, %63 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  %74 = getelementptr inbounds i8, ptr %0, i64 40
  %75 = load i32, ptr %74, align 8, !tbaa !17
  %76 = zext i32 %75 to i64
  %77 = tail call noalias ptr @malloc(i64 noundef %76) #6
  store ptr %77, ptr %5, align 8, !tbaa !18
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %77, ptr align 1 %1, i64 %76, i1 false)
  %78 = getelementptr inbounds i8, ptr %0, i64 44
  %79 = load i32, ptr %78, align 4, !tbaa !20
  %80 = zext i32 %79 to i64
  %81 = tail call noalias ptr @malloc(i64 noundef %80) #6
  %82 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %81, ptr %82, align 8, !tbaa !21
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %81, ptr align 1 %2, i64 %80, i1 false)
  %83 = trunc i64 %72 to i32
  call void @buzzdarray_insert(ptr noundef nonnull %73, i32 noundef %83, ptr noundef nonnull %5) #5
  %84 = getelementptr inbounds i8, ptr %0, i64 8
  %85 = load i32, ptr %84, align 8, !tbaa !22
  %86 = add i32 %85, 1
  store i32 %86, ptr %84, align 8, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  br label %87

87:                                               ; preds = %.loopexit, %20
  ret void
}

declare ptr @buzzdarray_new(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

; 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 @buzzdarray_insert(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

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 = { "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 allockind("alloc,uninitialized") allocsize(0) 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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, !7, i64 16}
!6 = !{!"buzzdict_s", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !10, i64 44}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 12}
!12 = !{!6, !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !16, i64 8}
!15 = !{!"buzzdarray_s", !7, i64 0, !16, i64 8, !10, i64 16, !10, i64 20, !7, i64 24}
!16 = !{!"long", !8, i64 0}
!17 = !{!6, !10, i64 40}
!18 = !{!19, !7, i64 0}
!19 = !{!"buzzdict_entry_s", !7, i64 0, !7, i64 8}
!20 = !{!6, !10, i64 44}
!21 = !{!19, !7, i64 8}
!22 = !{!6, !10, i64 8}
!23 = !{!15, !7, i64 0}
!24 = !{!6, !7, i64 24}
!25 = !{!6, !7, i64 32}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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