; LLVM IR from facebook/redex :: libresource/VectorImpl.ll (ZN7android10VectorImpl7_shrinkEmm)

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

%"class.android::VectorImpl" = type { ptr, ptr, i64, i32, i64 }

@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7android12SharedBuffer14bufferFromDataEPv(ptr noundef) #0 align 2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: noreturn nounwind
declare void @abort() #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7android10VectorImpl15release_storageEv(ptr noundef nonnull align 8 dereferenceable(40)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7android10VectorImpl13editArrayImplEv(ptr noundef nonnull align 8 dereferenceable(40)) #3 align 2

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

declare noundef ptr @_ZN7android12SharedBuffer5allocEm(i64 noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK7android10VectorImpl8_do_copyEPvPKvm(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef, i64 noundef) #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7android12SharedBuffer4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK7android10VectorImpl8capacityEv(ptr noundef nonnull align 8 dereferenceable(40)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK7android10VectorImpl11_do_destroyEPvm(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, i64 noundef) #6 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7android10VectorImpl7_shrinkEmm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef %1, i64 noundef %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !9
  %19 = load ptr, ptr %4, align 8
  %20 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = icmp ne ptr %21, null
  br i1 %22, label %24, label %23

23:                                               ; preds = %3
  br label %225

24:                                               ; preds = %3
  br label %25

25:                                               ; preds = %24
  %26 = load i64, ptr %5, align 8, !tbaa !9
  %27 = load i64, ptr %6, align 8, !tbaa !9
  %28 = add i64 %26, %27
  %29 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 2
  %30 = load i64, ptr %29, align 8, !tbaa !14
  %31 = icmp ule i64 %28, %30
  br i1 %31, label %64, label %32

32:                                               ; preds = %25
  br label %33

33:                                               ; preds = %32
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str.4) #8
  %36 = load ptr, ptr @stderr, align 8, !tbaa !5
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef @.str.9) #8
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef @.str.2) #8
  br label %40

40:                                               ; preds = %33
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  %43 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef @.str.4) #8
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str.28) #8
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.2) #8
  br label %48

48:                                               ; preds = %41
  br label %49

49:                                               ; preds = %48
  %50 = load ptr, ptr @stderr, align 8, !tbaa !5
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.4) #8
  %52 = load ptr, ptr @stderr, align 8, !tbaa !5
  %53 = load i64, ptr %5, align 8, !tbaa !9
  %54 = trunc i64 %53 to i32
  %55 = load i64, ptr %6, align 8, !tbaa !9
  %56 = trunc i64 %55 to i32
  %57 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 2
  %58 = load i64, ptr %57, align 8, !tbaa !14
  %59 = trunc i64 %58 to i32
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef @.str.29, ptr noundef %19, i32 noundef %54, i32 noundef %56, i32 noundef %59) #8
  %61 = load ptr, ptr @stderr, align 8, !tbaa !5
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef @.str.2) #8
  br label %63

63:                                               ; preds = %49
  call void @abort() #9
  unreachable

64:                                               ; preds = %25
  br label %65

65:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  br label %66

66:                                               ; preds = %65
  %67 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 2
  %68 = load i64, ptr %67, align 8, !tbaa !14
  %69 = load i64, ptr %6, align 8, !tbaa !9
  %70 = call { i64, i1 } @llvm.usub.with.overflow.i64(i64 %68, i64 %69)
  %71 = extractvalue { i64, i1 } %70, 1
  %72 = extractvalue { i64, i1 } %70, 0
  store i64 %72, ptr %7, align 8
  br i1 %71, label %73, label %92

73:                                               ; preds = %66
  br label %74

74:                                               ; preds = %73
  %75 = load ptr, ptr @stderr, align 8, !tbaa !5
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef @.str.4) #8
  %77 = load ptr, ptr @stderr, align 8, !tbaa !5
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef @.str.30) #8
  %79 = load ptr, ptr @stderr, align 8, !tbaa !5
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef @.str.2) #8
  br label %81

81:                                               ; preds = %74
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  %84 = load ptr, ptr @stderr, align 8, !tbaa !5
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef @.str.4) #8
  %86 = load ptr, ptr @stderr, align 8, !tbaa !5
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef @.str.18) #8
  %88 = load ptr, ptr @stderr, align 8, !tbaa !5
  %89 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %88, ptr noundef @.str.2) #8
  br label %90

90:                                               ; preds = %83
  br label %91

91:                                               ; preds = %90
  call void @abort() #9
  unreachable

92:                                               ; preds = %66
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93
  %95 = load i64, ptr %7, align 8, !tbaa !9
  %96 = call noundef i64 @_ZNK7android10VectorImpl8capacityEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
  %97 = udiv i64 %96, 2
  %98 = icmp ult i64 %95, %97
  br i1 %98, label %99, label %192

99:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %100 = load i64, ptr %7, align 8, !tbaa !9
  %101 = mul i64 %100, 2
  %102 = call noundef i64 @_ZN7androidL3maxEmm(i64 noundef 4, i64 noundef %101)
  store i64 %102, ptr %8, align 8, !tbaa !9
  %103 = load i64, ptr %5, align 8, !tbaa !9
  %104 = load i64, ptr %7, align 8, !tbaa !9
  %105 = icmp eq i64 %103, %104
  br i1 %105, label %106, label %137

106:                                              ; preds = %99
  %107 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 3
  %108 = load i32, ptr %107, align 8, !tbaa !15
  %109 = and i32 %108, 4
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %137

111:                                              ; preds = %106
  %112 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 3
  %113 = load i32, ptr %112, align 8, !tbaa !15
  %114 = and i32 %113, 2
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %116, label %137

116:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %117 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 1
  %118 = load ptr, ptr %117, align 8, !tbaa !11
  %119 = call noundef ptr @_ZN7android12SharedBuffer14bufferFromDataEPv(ptr noundef %118)
  store ptr %119, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  %121 = load i64, ptr %8, align 8, !tbaa !9
  %122 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 4
  %123 = load i64, ptr %122, align 8, !tbaa !16
  %124 = mul i64 %121, %123
  %125 = call noundef ptr @_ZNK7android12SharedBuffer10editResizeEm(ptr noundef nonnull align 8 dereferenceable(24) %120, i64 noundef %124)
  store ptr %125, ptr %10, align 8, !tbaa !5
  %126 = load ptr, ptr %10, align 8, !tbaa !5
  %127 = icmp ne ptr %126, null
  br i1 %127, label %128, label %132

128:                                              ; preds = %116
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  %130 = call noundef ptr @_ZN7android12SharedBuffer4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %129)
  %131 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 1
  store ptr %130, ptr %131, align 8, !tbaa !11
  br label %133

132:                                              ; preds = %116
  store i32 1, ptr %11, align 4
  br label %134

133:                                              ; preds = %128
  store i32 0, ptr %11, align 4
  br label %134

134:                                              ; preds = %133, %132
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  %135 = load i32, ptr %11, align 4
  switch i32 %135, label %189 [
    i32 0, label %136
  ]

136:                                              ; preds = %134
  br label %188

137:                                              ; preds = %111, %106, %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %138 = load i64, ptr %8, align 8, !tbaa !9
  %139 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 4
  %140 = load i64, ptr %139, align 8, !tbaa !16
  %141 = mul i64 %138, %140
  %142 = call noundef ptr @_ZN7android12SharedBuffer5allocEm(i64 noundef %141)
  store ptr %142, ptr %12, align 8, !tbaa !5
  %143 = load ptr, ptr %12, align 8, !tbaa !5
  %144 = icmp ne ptr %143, null
  br i1 %144, label %145, label %183

145:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %146 = load ptr, ptr %12, align 8, !tbaa !5
  %147 = call noundef ptr @_ZN7android12SharedBuffer4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %146)
  store ptr %147, ptr %13, align 8, !tbaa !5
  %148 = load i64, ptr %5, align 8, !tbaa !9
  %149 = icmp ne i64 %148, 0
  br i1 %149, label %150, label %155

150:                                              ; preds = %145
  %151 = load ptr, ptr %13, align 8, !tbaa !5
  %152 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 1
  %153 = load ptr, ptr %152, align 8, !tbaa !11
  %154 = load i64, ptr %5, align 8, !tbaa !9
  call void @_ZNK7android10VectorImpl8_do_copyEPvPKvm(ptr noundef nonnull align 8 dereferenceable(40) %19, ptr noundef %151, ptr noundef %153, i64 noundef %154)
  br label %155

155:                                              ; preds = %150, %145
  %156 = load i64, ptr %5, align 8, !tbaa !9
  %157 = load i64, ptr %7, align 8, !tbaa !9
  %158 = icmp ne i64 %156, %157
  br i1 %158, label %159, label %180

159:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %160 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 1
  %161 = load ptr, ptr %160, align 8, !tbaa !11
  %162 = load i64, ptr %5, align 8, !tbaa !9
  %163 = load i64, ptr %6, align 8, !tbaa !9
  %164 = add i64 %162, %163
  %165 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 4
  %166 = load i64, ptr %165, align 8, !tbaa !16
  %167 = mul i64 %164, %166
  %168 = getelementptr inbounds i8, ptr %161, i64 %167
  store ptr %168, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %169 = load ptr, ptr %13, align 8, !tbaa !5
  %170 = load i64, ptr %5, align 8, !tbaa !9
  %171 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 4
  %172 = load i64, ptr %171, align 8, !tbaa !16
  %173 = mul i64 %170, %172
  %174 = getelementptr inbounds i8, ptr %169, i64 %173
  store ptr %174, ptr %15, align 8, !tbaa !5
  %175 = load ptr, ptr %15, align 8, !tbaa !5
  %176 = load ptr, ptr %14, align 8, !tbaa !5
  %177 = load i64, ptr %7, align 8, !tbaa !9
  %178 = load i64, ptr %5, align 8, !tbaa !9
  %179 = sub i64 %177, %178
  call void @_ZNK7android10VectorImpl8_do_copyEPvPKvm(ptr noundef nonnull align 8 dereferenceable(40) %19, ptr noundef %175, ptr noundef %176, i64 noundef %179)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %180

180:                                              ; preds = %159, %155
  call void @_ZN7android10VectorImpl15release_storageEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
  %181 = load ptr, ptr %13, align 8, !tbaa !5
  %182 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 1
  store ptr %181, ptr %182, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %184

183:                                              ; preds = %137
  store i32 1, ptr %11, align 4
  br label %185

184:                                              ; preds = %180
  store i32 0, ptr %11, align 4
  br label %185

185:                                              ; preds = %184, %183
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  %186 = load i32, ptr %11, align 4
  switch i32 %186, label %189 [
    i32 0, label %187
  ]

187:                                              ; preds = %185
  br label %188

188:                                              ; preds = %187, %136
  store i32 0, ptr %11, align 4
  br label %189

189:                                              ; preds = %188, %185, %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  %190 = load i32, ptr %11, align 4
  switch i32 %190, label %223 [
    i32 0, label %191
  ]

191:                                              ; preds = %189
  br label %220

192:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %193 = call noundef ptr @_ZN7android10VectorImpl13editArrayImplEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
  store ptr %193, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %194 = load ptr, ptr %16, align 8, !tbaa !5
  %195 = load i64, ptr %5, align 8, !tbaa !9
  %196 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 4
  %197 = load i64, ptr %196, align 8, !tbaa !16
  %198 = mul i64 %195, %197
  %199 = getelementptr inbounds i8, ptr %194, i64 %198
  store ptr %199, ptr %17, align 8, !tbaa !5
  %200 = load ptr, ptr %17, align 8, !tbaa !5
  %201 = load i64, ptr %6, align 8, !tbaa !9
  call void @_ZNK7android10VectorImpl11_do_destroyEPvm(ptr noundef nonnull align 8 dereferenceable(40) %19, ptr noundef %200, i64 noundef %201)
  %202 = load i64, ptr %5, align 8, !tbaa !9
  %203 = load i64, ptr %7, align 8, !tbaa !9
  %204 = icmp ne i64 %202, %203
  br i1 %204, label %205, label %219

205:                                              ; preds = %192
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %206 = load ptr, ptr %16, align 8, !tbaa !5
  %207 = load i64, ptr %5, align 8, !tbaa !9
  %208 = load i64, ptr %6, align 8, !tbaa !9
  %209 = add i64 %207, %208
  %210 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 4
  %211 = load i64, ptr %210, align 8, !tbaa !16
  %212 = mul i64 %209, %211
  %213 = getelementptr inbounds i8, ptr %206, i64 %212
  store ptr %213, ptr %18, align 8, !tbaa !5
  %214 = load ptr, ptr %17, align 8, !tbaa !5
  %215 = load ptr, ptr %18, align 8, !tbaa !5
  %216 = load i64, ptr %7, align 8, !tbaa !9
  %217 = load i64, ptr %5, align 8, !tbaa !9
  %218 = sub i64 %216, %217
  call void @_ZNK7android10VectorImpl17_do_move_backwardEPvPKvm(ptr noundef nonnull align 8 dereferenceable(40) %19, ptr noundef %214, ptr noundef %215, i64 noundef %218)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %219

219:                                              ; preds = %205, %192
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %220

220:                                              ; preds = %219, %191
  %221 = load i64, ptr %7, align 8, !tbaa !9
  %222 = getelementptr inbounds %"class.android::VectorImpl", ptr %19, i32 0, i32 2
  store i64 %221, ptr %222, align 8, !tbaa !14
  store i32 0, ptr %11, align 4
  br label %223

223:                                              ; preds = %220, %189
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  %224 = load i32, ptr %11, align 4
  switch i32 %224, label %226 [
    i32 0, label %225
    i32 1, label %225
  ]

225:                                              ; preds = %223, %223, %23
  ret void

226:                                              ; preds = %223
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN7androidL3maxEmm(i64 noundef, i64 noundef) #0

declare noundef ptr @_ZNK7android12SharedBuffer10editResizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.usub.with.overflow.i64(i64, i64) #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK7android10VectorImpl17_do_move_backwardEPvPKvm(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef, i64 noundef) #6 align 2

attributes #0 = { inlinehint mustprogress 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 = { 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 #2 = { noreturn 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 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { "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 mustprogress 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { noreturn 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTSN7android10VectorImplE", !6, i64 8, !10, i64 16, !13, i64 24, !10, i64 32}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !10, i64 16}
!15 = !{!12, !13, i64 24}
!16 = !{!12, !10, i64 32}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7android12SharedBuffer14bufferFromDataEPv(ptr noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7android10VectorImpl15release_storageEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7android10VectorImpl13editArrayImplEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #3 align 2

declare noundef ptr @_ZN7android12SharedBuffer5allocEm(i64 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK7android10VectorImpl8_do_copyEPvPKvm(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7android12SharedBuffer4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK7android10VectorImpl8capacityEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK7android10VectorImpl11_do_destroyEPvm(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, i64 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7android10VectorImpl7_shrinkEmm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #3 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %.critedge, label %6

6:                                                ; preds = %3
  %7 = add i64 %2, %1
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load i64, ptr %8, align 8, !tbaa !12
  %.not58 = icmp ugt i64 %7, %9
  br i1 %.not58, label %10, label %33

10:                                               ; preds = %6
  %11 = load ptr, ptr @stderr, align 8, !tbaa !13
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.4) #7
  %13 = load ptr, ptr @stderr, align 8, !tbaa !13
  %14 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str.9) #7
  %15 = load ptr, ptr @stderr, align 8, !tbaa !13
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.2) #7
  %17 = load ptr, ptr @stderr, align 8, !tbaa !13
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.4) #7
  %19 = load ptr, ptr @stderr, align 8, !tbaa !13
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.28) #7
  %21 = load ptr, ptr @stderr, align 8, !tbaa !13
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.2) #7
  %23 = load ptr, ptr @stderr, align 8, !tbaa !13
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.4) #7
  %25 = load ptr, ptr @stderr, align 8, !tbaa !13
  %26 = trunc i64 %1 to i32
  %27 = trunc i64 %2 to i32
  %28 = load i64, ptr %8, align 8, !tbaa !12
  %29 = trunc i64 %28 to i32
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.29, ptr noundef nonnull %0, i32 noundef %26, i32 noundef %27, i32 noundef %29) #7
  %31 = load ptr, ptr @stderr, align 8, !tbaa !13
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.2) #7
  tail call void @abort() #8
  unreachable

33:                                               ; preds = %6
  %34 = tail call { i64, i1 } @llvm.usub.with.overflow.i64(i64 %9, i64 %2)
  %35 = extractvalue { i64, i1 } %34, 1
  %36 = extractvalue { i64, i1 } %34, 0
  br i1 %35, label %37, label %50

37:                                               ; preds = %33
  %38 = load ptr, ptr @stderr, align 8, !tbaa !13
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.4) #7
  %40 = load ptr, ptr @stderr, align 8, !tbaa !13
  %41 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.30) #7
  %42 = load ptr, ptr @stderr, align 8, !tbaa !13
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.2) #7
  %44 = load ptr, ptr @stderr, align 8, !tbaa !13
  %45 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str.4) #7
  %46 = load ptr, ptr @stderr, align 8, !tbaa !13
  %47 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef nonnull @.str.18) #7
  %48 = load ptr, ptr @stderr, align 8, !tbaa !13
  %49 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef nonnull @.str.2) #7
  tail call void @abort() #8
  unreachable

50:                                               ; preds = %33
  %51 = tail call noundef i64 @_ZNK7android10VectorImpl8capacityEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  %52 = lshr i64 %51, 1
  %53 = icmp ult i64 %36, %52
  br i1 %53, label %54, label %90

54:                                               ; preds = %50
  %55 = shl nuw i64 %36, 1
  %56 = tail call noundef i64 @_ZN7androidL3maxEmm(i64 noundef 4, i64 noundef %55)
  %57 = icmp eq i64 %36, %1
  br i1 %57, label %58, label %71

58:                                               ; preds = %54
  %59 = getelementptr inbounds i8, ptr %0, i64 24
  %60 = load i32, ptr %59, align 8, !tbaa !14
  %61 = and i32 %60, 6
  %or.cond.not = icmp eq i32 %61, 6
  br i1 %or.cond.not, label %62, label %71

62:                                               ; preds = %58
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = tail call noundef ptr @_ZN7android12SharedBuffer14bufferFromDataEPv(ptr noundef %63)
  %65 = getelementptr inbounds i8, ptr %0, i64 32
  %66 = load i64, ptr %65, align 8, !tbaa !15
  %67 = mul i64 %66, %56
  %68 = tail call noundef ptr @_ZNK7android12SharedBuffer10editResizeEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef %67)
  %.not65.not = icmp eq ptr %68, null
  br i1 %.not65.not, label %.critedge, label %69

69:                                               ; preds = %62
  %70 = tail call noundef ptr @_ZN7android12SharedBuffer4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %68)
  store ptr %70, ptr %4, align 8, !tbaa !5
  br label %.critedge68

71:                                               ; preds = %58, %54
  %72 = getelementptr inbounds i8, ptr %0, i64 32
  %73 = load i64, ptr %72, align 8, !tbaa !15
  %74 = mul i64 %73, %56
  %75 = tail call noundef ptr @_ZN7android12SharedBuffer5allocEm(i64 noundef %74)
  %.not62.not = icmp eq ptr %75, null
  br i1 %.not62.not, label %.critedge, label %76

76:                                               ; preds = %71
  %77 = tail call noundef ptr @_ZN7android12SharedBuffer4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %75)
  %.not63 = icmp eq i64 %1, 0
  br i1 %.not63, label %80, label %78

78:                                               ; preds = %76
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  tail call void @_ZNK7android10VectorImpl8_do_copyEPvPKvm(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %77, ptr noundef %79, i64 noundef %1)
  br label %80

80:                                               ; preds = %78, %76
  br i1 %57, label %89, label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = load i64, ptr %72, align 8, !tbaa !15
  %84 = mul i64 %83, %7
  %85 = getelementptr inbounds i8, ptr %82, i64 %84
  %86 = mul i64 %83, %1
  %87 = getelementptr inbounds i8, ptr %77, i64 %86
  %88 = sub i64 %36, %1
  tail call void @_ZNK7android10VectorImpl8_do_copyEPvPKvm(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %87, ptr noundef %85, i64 noundef %88)
  br label %89

89:                                               ; preds = %81, %80
  tail call void @_ZN7android10VectorImpl15release_storageEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  store ptr %77, ptr %4, align 8, !tbaa !5
  br label %.critedge68

90:                                               ; preds = %50
  %91 = tail call noundef ptr @_ZN7android10VectorImpl13editArrayImplEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  %92 = getelementptr inbounds i8, ptr %0, i64 32
  %93 = load i64, ptr %92, align 8, !tbaa !15
  %94 = mul i64 %93, %1
  %95 = getelementptr inbounds i8, ptr %91, i64 %94
  tail call void @_ZNK7android10VectorImpl11_do_destroyEPvm(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %95, i64 noundef %2)
  %.not59 = icmp eq i64 %36, %1
  br i1 %.not59, label %.critedge68, label %96

96:                                               ; preds = %90
  %97 = load i64, ptr %92, align 8, !tbaa !15
  %98 = mul i64 %97, %7
  %99 = getelementptr inbounds i8, ptr %91, i64 %98
  %100 = sub i64 %36, %1
  tail call void @_ZNK7android10VectorImpl17_do_move_backwardEPvPKvm(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %95, ptr noundef %99, i64 noundef %100)
  br label %.critedge68

.critedge68:                                      ; preds = %89, %69, %90, %96
  store i64 %36, ptr %8, align 8, !tbaa !12
  br label %.critedge

.critedge:                                        ; preds = %.critedge68, %71, %62, %3
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN7androidL3maxEmm(i64 noundef, i64 noundef) local_unnamed_addr #0

declare noundef ptr @_ZNK7android12SharedBuffer10editResizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.usub.with.overflow.i64(i64, i64) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK7android10VectorImpl17_do_move_backwardEPvPKvm(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #5 align 2

attributes #0 = { inlinehint mustprogress 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 = { 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 #2 = { noreturn 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 = { mustprogress 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 = { inlinehint mustprogress 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { cold nounwind }
attributes #8 = { noreturn 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, !7, i64 8}
!6 = !{!"_ZTSN7android10VectorImplE", !7, i64 8, !10, i64 16, !11, i64 24, !10, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !10, i64 16}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !11, i64 24}
!15 = !{!6, !10, i64 32}


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