; LLVM IR from stan-dev/math :: lib/boost_1.84.0/libs/container/src (alloc_lib)

; 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.malloc_params = type { i64, i64, i64, i64, i64, i32 }
%struct.malloc_state = type { i32, i32, i64, i64, ptr, ptr, ptr, i64, i64, i64, [66 x ptr], [32 x ptr], i64, i64, i64, i32, i32, %struct.malloc_segment, ptr, i64 }
%struct.malloc_segment = type { ptr, i64, ptr, i32 }
%struct.boost_cont_command_ret_impl = type { ptr, i32 }
%struct.malloc_chunk = type { i64, i64, ptr, ptr }

@mparams = external hidden global %struct.malloc_params, align 8
@_gm_ = external hidden global %struct.malloc_state, align 8
@s_allocated_memory = external hidden global i64, align 8

; Function Attrs: nounwind uwtable
declare hidden i32 @init_mparams() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @spin_acquire_lock(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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @mspace_malloc_lockless(ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local { ptr, i32 } @boost_cont_allocation_command(i32 noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %7 = alloca %struct.boost_cont_command_ret_impl, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  store i32 %0, ptr %8, align 4, !tbaa !5
  store i64 %1, ptr %9, align 8, !tbaa !9
  store i64 %2, ptr %10, align 8, !tbaa !9
  store i64 %3, ptr %11, align 8, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !11
  store ptr %5, ptr %13, align 8, !tbaa !11
  call void @llvm.memset.p0.i64(ptr align 8 %7, i8 0, i64 16, i1 false)
  %20 = load i64, ptr @mparams, align 8, !tbaa !13
  %21 = icmp ne i64 %20, 0
  br i1 %21, label %25, label %22

22:                                               ; preds = %6
  %23 = call i32 @init_mparams()
  %24 = icmp ne i32 %23, 0
  br label %25

25:                                               ; preds = %22, %6
  %26 = phi i1 [ true, %6 ], [ %24, %22 ]
  %27 = zext i1 %26 to i32
  %28 = load i32, ptr %8, align 4, !tbaa !5
  %29 = and i32 %28, 72
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %47

31:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %32 = load ptr, ptr %13, align 8, !tbaa !11
  %33 = load i64, ptr %11, align 8, !tbaa !9
  %34 = load i64, ptr %10, align 8, !tbaa !9
  %35 = load ptr, ptr %12, align 8, !tbaa !11
  %36 = load i32, ptr %8, align 4, !tbaa !5
  %37 = and i32 %36, 8
  %38 = call i32 @boost_cont_shrink(ptr noundef %32, i64 noundef %33, i64 noundef %34, ptr noundef %35, i32 noundef %37)
  store i32 %38, ptr %14, align 4, !tbaa !5
  %39 = load i32, ptr %14, align 4, !tbaa !5
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %43

41:                                               ; preds = %31
  %42 = load ptr, ptr %13, align 8, !tbaa !11
  br label %44

43:                                               ; preds = %31
  br label %44

44:                                               ; preds = %43, %41
  %45 = phi ptr [ %42, %41 ], [ null, %43 ]
  %46 = getelementptr inbounds %struct.boost_cont_command_ret_impl, ptr %7, i32 0, i32 0
  store ptr %45, ptr %46, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %186

47:                                               ; preds = %25
  %48 = load ptr, ptr %12, align 8, !tbaa !11
  store i64 0, ptr %48, align 8, !tbaa !9
  %49 = load i64, ptr %10, align 8, !tbaa !9
  %50 = load i64, ptr %11, align 8, !tbaa !9
  %51 = icmp ugt i64 %49, %50
  br i1 %51, label %52, label %53

52:                                               ; preds = %47
  br label %186

53:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  store ptr @_gm_, ptr %15, align 8, !tbaa !11
  %54 = load ptr, ptr %15, align 8, !tbaa !11
  %55 = getelementptr inbounds %struct.malloc_state, ptr %54, i32 0, i32 15
  %56 = load i32, ptr %55, align 8, !tbaa !17
  %57 = and i32 %56, 2
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %70

59:                                               ; preds = %53
  %60 = load ptr, ptr %15, align 8, !tbaa !11
  %61 = getelementptr inbounds %struct.malloc_state, ptr %60, i32 0, i32 16
  %62 = atomicrmw xchg ptr %61, i32 1 seq_cst, align 4
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %69

64:                                               ; preds = %59
  %65 = load ptr, ptr %15, align 8, !tbaa !11
  %66 = getelementptr inbounds %struct.malloc_state, ptr %65, i32 0, i32 16
  %67 = call i32 @spin_acquire_lock(ptr noundef %66)
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %185, label %71

69:                                               ; preds = %59
  br i1 false, label %185, label %71

70:                                               ; preds = %53
  br i1 false, label %185, label %71

71:                                               ; preds = %70, %69, %64
  %72 = load ptr, ptr %13, align 8, !tbaa !11
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %97

74:                                               ; preds = %71
  %75 = load i32, ptr %8, align 4, !tbaa !5
  %76 = and i32 %75, 6
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %97

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %79 = load ptr, ptr %15, align 8, !tbaa !11
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = load ptr, ptr %13, align 8, !tbaa !11
  %82 = load i64, ptr %10, align 8, !tbaa !9
  %83 = load i64, ptr %11, align 8, !tbaa !9
  %84 = load ptr, ptr %12, align 8, !tbaa !11
  %85 = load i64, ptr %9, align 8, !tbaa !9
  %86 = call ptr @internal_grow_both_sides(ptr noundef %79, i32 noundef %80, ptr noundef %81, i64 noundef %82, i64 noundef %83, ptr noundef %84, i64 noundef %85, i32 noundef 1)
  store ptr %86, ptr %16, align 8, !tbaa !11
  %87 = load ptr, ptr %16, align 8, !tbaa !11
  %88 = icmp ne ptr %87, null
  br i1 %88, label %89, label %93

89:                                               ; preds = %78
  %90 = load ptr, ptr %16, align 8, !tbaa !11
  %91 = getelementptr inbounds %struct.boost_cont_command_ret_impl, ptr %7, i32 0, i32 0
  store ptr %90, ptr %91, align 8, !tbaa !15
  %92 = getelementptr inbounds %struct.boost_cont_command_ret_impl, ptr %7, i32 0, i32 1
  store i32 1, ptr %92, align 8, !tbaa !20
  store i32 2, ptr %17, align 4
  br label %94

93:                                               ; preds = %78
  store i32 0, ptr %17, align 4
  br label %94

94:                                               ; preds = %93, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  %95 = load i32, ptr %17, align 4
  switch i32 %95, label %188 [
    i32 0, label %96
    i32 2, label %175
  ]

96:                                               ; preds = %94
  br label %97

97:                                               ; preds = %96, %74, %71
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = and i32 %98, 1
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %148

101:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %102 = load ptr, ptr %15, align 8, !tbaa !11
  %103 = load i64, ptr %11, align 8, !tbaa !9
  %104 = call ptr @mspace_malloc_lockless(ptr noundef %102, i64 noundef %103)
  store ptr %104, ptr %18, align 8, !tbaa !11
  %105 = load ptr, ptr %18, align 8, !tbaa !11
  %106 = icmp ne ptr %105, null
  br i1 %106, label %111, label %107

107:                                              ; preds = %101
  %108 = load ptr, ptr %15, align 8, !tbaa !11
  %109 = load i64, ptr %10, align 8, !tbaa !9
  %110 = call ptr @mspace_malloc_lockless(ptr noundef %108, i64 noundef %109)
  store ptr %110, ptr %18, align 8, !tbaa !11
  br label %111

111:                                              ; preds = %107, %101
  %112 = load ptr, ptr %18, align 8, !tbaa !11
  %113 = icmp ne ptr %112, null
  br i1 %113, label %114, label %137

114:                                              ; preds = %111
  %115 = load ptr, ptr %18, align 8, !tbaa !11
  %116 = getelementptr inbounds i8, ptr %115, i64 -16
  %117 = getelementptr inbounds %struct.malloc_chunk, ptr %116, i32 0, i32 1
  %118 = load i64, ptr %117, align 8, !tbaa !21
  %119 = and i64 %118, -8
  %120 = load i64, ptr @s_allocated_memory, align 8, !tbaa !9
  %121 = add i64 %120, %119
  store i64 %121, ptr @s_allocated_memory, align 8, !tbaa !9
  %122 = load ptr, ptr %18, align 8, !tbaa !11
  %123 = getelementptr inbounds i8, ptr %122, i64 -16
  %124 = getelementptr inbounds %struct.malloc_chunk, ptr %123, i32 0, i32 1
  %125 = load i64, ptr %124, align 8, !tbaa !21
  %126 = and i64 %125, -8
  %127 = load ptr, ptr %18, align 8, !tbaa !11
  %128 = getelementptr inbounds i8, ptr %127, i64 -16
  %129 = getelementptr inbounds %struct.malloc_chunk, ptr %128, i32 0, i32 1
  %130 = load i64, ptr %129, align 8, !tbaa !21
  %131 = and i64 %130, 3
  %132 = icmp eq i64 %131, 0
  %133 = zext i1 %132 to i64
  %134 = select i1 %132, i64 16, i64 8
  %135 = sub i64 %126, %134
  %136 = load ptr, ptr %12, align 8, !tbaa !11
  store i64 %135, ptr %136, align 8, !tbaa !9
  br label %137

137:                                              ; preds = %114, %111
  %138 = load ptr, ptr %18, align 8, !tbaa !11
  %139 = getelementptr inbounds %struct.boost_cont_command_ret_impl, ptr %7, i32 0, i32 0
  store ptr %138, ptr %139, align 8, !tbaa !15
  %140 = getelementptr inbounds %struct.boost_cont_command_ret_impl, ptr %7, i32 0, i32 1
  store i32 0, ptr %140, align 8, !tbaa !20
  %141 = load ptr, ptr %18, align 8, !tbaa !11
  %142 = icmp ne ptr %141, null
  br i1 %142, label %143, label %144

143:                                              ; preds = %137
  store i32 2, ptr %17, align 4
  br label %145

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

145:                                              ; preds = %144, %143
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  %146 = load i32, ptr %17, align 4
  switch i32 %146, label %188 [
    i32 0, label %147
    i32 2, label %175
  ]

147:                                              ; preds = %145
  br label %148

148:                                              ; preds = %147, %97
  %149 = load ptr, ptr %13, align 8, !tbaa !11
  %150 = icmp ne ptr %149, null
  br i1 %150, label %151, label %174

151:                                              ; preds = %148
  %152 = load i32, ptr %8, align 4, !tbaa !5
  %153 = and i32 %152, 6
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %155, label %174

155:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %156 = load ptr, ptr %15, align 8, !tbaa !11
  %157 = load i32, ptr %8, align 4, !tbaa !5
  %158 = load ptr, ptr %13, align 8, !tbaa !11
  %159 = load i64, ptr %10, align 8, !tbaa !9
  %160 = load i64, ptr %11, align 8, !tbaa !9
  %161 = load ptr, ptr %12, align 8, !tbaa !11
  %162 = load i64, ptr %9, align 8, !tbaa !9
  %163 = call ptr @internal_grow_both_sides(ptr noundef %156, i32 noundef %157, ptr noundef %158, i64 noundef %159, i64 noundef %160, ptr noundef %161, i64 noundef %162, i32 noundef 0)
  store ptr %163, ptr %19, align 8, !tbaa !11
  %164 = load ptr, ptr %19, align 8, !tbaa !11
  %165 = icmp ne ptr %164, null
  br i1 %165, label %166, label %170

166:                                              ; preds = %155
  %167 = load ptr, ptr %19, align 8, !tbaa !11
  %168 = getelementptr inbounds %struct.boost_cont_command_ret_impl, ptr %7, i32 0, i32 0
  store ptr %167, ptr %168, align 8, !tbaa !15
  %169 = getelementptr inbounds %struct.boost_cont_command_ret_impl, ptr %7, i32 0, i32 1
  store i32 1, ptr %169, align 8, !tbaa !20
  store i32 2, ptr %17, align 4
  br label %171

170:                                              ; preds = %155
  store i32 0, ptr %17, align 4
  br label %171

171:                                              ; preds = %170, %166
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  %172 = load i32, ptr %17, align 4
  switch i32 %172, label %188 [
    i32 0, label %173
    i32 2, label %175
  ]

173:                                              ; preds = %171
  br label %174

174:                                              ; preds = %173, %151, %148
  br label %175

175:                                              ; preds = %174, %171, %145, %94
  %176 = load ptr, ptr %15, align 8, !tbaa !11
  %177 = getelementptr inbounds %struct.malloc_state, ptr %176, i32 0, i32 15
  %178 = load i32, ptr %177, align 8, !tbaa !17
  %179 = and i32 %178, 2
  %180 = icmp ne i32 %179, 0
  br i1 %180, label %181, label %184

181:                                              ; preds = %175
  %182 = load ptr, ptr %15, align 8, !tbaa !11
  %183 = getelementptr inbounds %struct.malloc_state, ptr %182, i32 0, i32 16
  store atomic i32 0, ptr %183 release, align 4
  br label %184

184:                                              ; preds = %181, %175
  br label %185

185:                                              ; preds = %184, %70, %69, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %186

186:                                              ; preds = %185, %52, %44
  %187 = load { ptr, i32 }, ptr %7, align 8
  ret { ptr, i32 } %187

188:                                              ; preds = %171, %145, %94
  unreachable
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @boost_cont_shrink(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @internal_grow_both_sides(ptr noundef, i32 noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef) #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 = !{!"int", !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 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"malloc_params", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40}
!15 = !{!16, !12, i64 0}
!16 = !{!"boost_cont_command_ret_impl", !12, i64 0, !6, i64 8}
!17 = !{!18, !6, i64 880}
!18 = !{!"malloc_state", !6, i64 0, !6, i64 4, !10, i64 8, !10, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !7, i64 600, !10, i64 856, !10, i64 864, !10, i64 872, !6, i64 880, !6, i64 884, !19, i64 888, !12, i64 920, !10, i64 928}
!19 = !{!"malloc_segment", !12, i64 0, !10, i64 8, !12, i64 16, !6, i64 24}
!20 = !{!16, !6, i64 8}
!21 = !{!22, !10, i64 8}
!22 = !{!"malloc_chunk", !10, i64 0, !10, i64 8, !12, i64 16, !12, i64 24}


; 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.malloc_params = type { i64, i64, i64, i64, i64, i32 }
%struct.malloc_state = type { i32, i32, i64, i64, ptr, ptr, ptr, i64, i64, i64, [66 x ptr], [32 x ptr], i64, i64, i64, i32, i32, %struct.malloc_segment, ptr, i64 }
%struct.malloc_segment = type { ptr, i64, ptr, i32 }

@mparams = external hidden local_unnamed_addr global %struct.malloc_params, align 8
@_gm_ = external hidden global %struct.malloc_state, align 8
@s_allocated_memory = external hidden local_unnamed_addr global i64, align 8

; Function Attrs: nounwind uwtable
declare hidden i32 @init_mparams() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @spin_acquire_lock(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @mspace_malloc_lockless(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local { ptr, i32 } @boost_cont_allocation_command(i32 noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = load i64, ptr @mparams, align 8, !tbaa !5
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %8, label %10

8:                                                ; preds = %6
  %9 = tail call i32 @init_mparams()
  br label %10

10:                                               ; preds = %8, %6
  %11 = and i32 %0, 72
  %.not60 = icmp eq i32 %11, 0
  br i1 %.not60, label %16, label %12

12:                                               ; preds = %10
  %13 = and i32 %0, 8
  %14 = tail call i32 @boost_cont_shrink(ptr noundef %5, i64 noundef %3, i64 noundef %2, ptr noundef %4, i32 noundef %13)
  %.not73 = icmp eq i32 %14, 0
  %15 = select i1 %.not73, ptr null, ptr %5
  br label %51

16:                                               ; preds = %10
  store i64 0, ptr %4, align 8, !tbaa !11
  %17 = icmp ugt i64 %2, %3
  br i1 %17, label %51, label %18

18:                                               ; preds = %16
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @_gm_, i64 880), align 8, !tbaa !12
  %20 = and i32 %19, 2
  %.not61 = icmp eq i32 %20, 0
  br i1 %.not61, label %25, label %21

21:                                               ; preds = %18
  %22 = atomicrmw xchg ptr getelementptr inbounds (i8, ptr @_gm_, i64 884), i32 1 seq_cst, align 4
  %.not62 = icmp eq i32 %22, 0
  br i1 %.not62, label %25, label %23

23:                                               ; preds = %21
  %24 = tail call i32 @spin_acquire_lock(ptr noundef nonnull getelementptr inbounds (i8, ptr @_gm_, i64 884))
  %.not63 = icmp eq i32 %24, 0
  br i1 %.not63, label %25, label %51

25:                                               ; preds = %18, %21, %23
  %.not64 = icmp eq ptr %5, null
  %26 = and i32 %0, 6
  %.not65 = icmp eq i32 %26, 0
  %or.cond = or i1 %.not65, %.not64
  br i1 %or.cond, label %29, label %27

27:                                               ; preds = %25
  %28 = tail call ptr @internal_grow_both_sides(ptr noundef nonnull @_gm_, i32 noundef %0, ptr noundef nonnull %5, i64 noundef %2, i64 noundef %3, ptr noundef nonnull %4, i64 noundef %1, i32 noundef 1)
  %.not66 = icmp eq ptr %28, null
  br i1 %.not66, label %29, label %47

29:                                               ; preds = %27, %25
  %30 = and i32 %0, 1
  %.not67 = icmp eq i32 %30, 0
  br i1 %.not67, label %.critedge, label %31

31:                                               ; preds = %29
  %32 = tail call ptr @mspace_malloc_lockless(ptr noundef nonnull @_gm_, i64 noundef %3)
  %.not68 = icmp eq ptr %32, null
  br i1 %.not68, label %33, label %.thread

33:                                               ; preds = %31
  %34 = tail call ptr @mspace_malloc_lockless(ptr noundef nonnull @_gm_, i64 noundef %2)
  %.not69 = icmp eq ptr %34, null
  br i1 %.not69, label %.critedge, label %.thread

.thread:                                          ; preds = %31, %33
  %.080 = phi ptr [ %34, %33 ], [ %32, %31 ]
  %35 = getelementptr inbounds i8, ptr %.080, i64 -8
  %36 = load i64, ptr %35, align 8, !tbaa !16
  %37 = and i64 %36, -8
  %38 = load i64, ptr @s_allocated_memory, align 8, !tbaa !11
  %39 = add i64 %38, %37
  store i64 %39, ptr @s_allocated_memory, align 8, !tbaa !11
  %40 = load i64, ptr %35, align 8, !tbaa !16
  %41 = and i64 %40, -8
  %42 = and i64 %40, 3
  %43 = icmp eq i64 %42, 0
  %.neg = select i1 %43, i64 -16, i64 -8
  %44 = add i64 %.neg, %41
  store i64 %44, ptr %4, align 8, !tbaa !11
  br label %47

.critedge:                                        ; preds = %33, %29
  br i1 %or.cond, label %47, label %45

45:                                               ; preds = %.critedge
  %46 = tail call ptr @internal_grow_both_sides(ptr noundef nonnull @_gm_, i32 noundef %0, ptr noundef nonnull %5, i64 noundef %2, i64 noundef %3, ptr noundef nonnull %4, i64 noundef %1, i32 noundef 0)
  %.not71 = icmp ne ptr %46, null
  %.sroa.6.2. = zext i1 %.not71 to i32
  br label %47

47:                                               ; preds = %.thread, %27, %45, %.critedge
  %.sroa.6.4 = phi i32 [ 1, %27 ], [ 0, %.thread ], [ %.sroa.6.2., %45 ], [ 0, %.critedge ]
  %.sroa.0.4 = phi ptr [ %28, %27 ], [ %.080, %.thread ], [ %46, %45 ], [ null, %.critedge ]
  %48 = load i32, ptr getelementptr inbounds (i8, ptr @_gm_, i64 880), align 8, !tbaa !12
  %49 = and i32 %48, 2
  %.not72 = icmp eq i32 %49, 0
  br i1 %.not72, label %51, label %50

50:                                               ; preds = %47
  store atomic i32 0, ptr getelementptr inbounds (i8, ptr @_gm_, i64 884) release, align 4
  br label %51

51:                                               ; preds = %23, %50, %47, %16, %12
  %.sroa.6.6 = phi i32 [ 0, %12 ], [ 0, %16 ], [ 0, %23 ], [ %.sroa.6.4, %50 ], [ %.sroa.6.4, %47 ]
  %.sroa.0.6 = phi ptr [ %15, %12 ], [ null, %16 ], [ null, %23 ], [ %.sroa.0.4, %50 ], [ %.sroa.0.4, %47 ]
  %.fca.0.insert = insertvalue { ptr, i32 } poison, ptr %.sroa.0.6, 0
  %.fca.1.insert = insertvalue { ptr, i32 } %.fca.0.insert, i32 %.sroa.6.6, 1
  ret { ptr, i32 } %.fca.1.insert
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @boost_cont_shrink(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @internal_grow_both_sides(ptr noundef, i32 noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef) 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" }

!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 0}
!6 = !{!"malloc_params", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 880}
!13 = !{!"malloc_state", !10, i64 0, !10, i64 4, !7, i64 8, !7, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !8, i64 72, !8, i64 600, !7, i64 856, !7, i64 864, !7, i64 872, !10, i64 880, !10, i64 884, !15, i64 888, !14, i64 920, !7, i64 928}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"malloc_segment", !14, i64 0, !7, i64 8, !14, i64 16, !10, i64 24}
!16 = !{!17, !7, i64 8}
!17 = !{!"malloc_chunk", !7, i64 0, !7, i64 8, !14, i64 16, !14, i64 24}


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