; LLVM IR from 0xilis/libNeoAppleArchive :: libNeoAppleArchive (neo_aa_header)

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

@stderr = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [48 x i8], align 1
@__FUNCTION__.neo_aa_header_remove_field_at_index = external hidden unnamed_addr constant [36 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
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

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

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

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

declare i64 @internal_do_not_call_neo_aa_archive_header_key_pos_in_encoded_data(ptr noundef, i32 noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #4

; Function Attrs: nounwind uwtable
define dso_local void @neo_aa_header_remove_field_at_index(ptr noundef %0, i32 noundef %1) #5 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %19, i32 0, i32 5
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = load i32, ptr %4, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i64, ptr %21, i64 %23
  %25 = load i64, ptr %24, align 8, !tbaa !14
  store i64 %25, ptr %5, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %26 = load i64, ptr %5, align 8, !tbaa !14
  %27 = add i64 %26, 4
  store i64 %27, ptr %6, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = load i32, ptr %4, align 4, !tbaa !9
  %30 = call i64 @internal_do_not_call_neo_aa_archive_header_key_pos_in_encoded_data(ptr noundef %28, i32 noundef %29)
  store i64 %30, ptr %7, align 8, !tbaa !14
  %31 = load i64, ptr %7, align 8, !tbaa !14
  %32 = icmp ne i64 %31, 0
  br i1 %32, label %36, label %33

33:                                               ; preds = %2
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str.7, ptr noundef @__FUNCTION__.neo_aa_header_remove_field_at_index, ptr noundef @.str.14) #6
  store i32 1, ptr %8, align 4
  br label %216

36:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %37, i32 0, i32 1
  %39 = load ptr, ptr %38, align 8, !tbaa !15
  store ptr %39, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %40, i32 0, i32 6
  %42 = load i64, ptr %41, align 8, !tbaa !16
  store i64 %42, ptr %10, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %43 = load i64, ptr %10, align 8, !tbaa !14
  %44 = load i64, ptr %6, align 8, !tbaa !14
  %45 = sub i64 %43, %44
  store i64 %45, ptr %11, align 8, !tbaa !14
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = load i64, ptr %7, align 8, !tbaa !14
  %48 = getelementptr inbounds i8, ptr %46, i64 %47
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = load i64, ptr %7, align 8, !tbaa !14
  %51 = getelementptr inbounds i8, ptr %49, i64 %50
  %52 = load i64, ptr %6, align 8, !tbaa !14
  %53 = getelementptr inbounds i8, ptr %51, i64 %52
  %54 = load i64, ptr %10, align 8, !tbaa !14
  %55 = load i64, ptr %7, align 8, !tbaa !14
  %56 = load i64, ptr %6, align 8, !tbaa !14
  %57 = add i64 %55, %56
  %58 = sub i64 %54, %57
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %48, ptr align 1 %53, i64 %58, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = load i64, ptr %11, align 8, !tbaa !14
  %61 = call ptr @realloc(ptr noundef %59, i64 noundef %60) #7
  store ptr %61, ptr %12, align 8, !tbaa !5
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %67, label %64

64:                                               ; preds = %36
  %65 = load ptr, ptr @stderr, align 8, !tbaa !5
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef @.str.7, ptr noundef @__FUNCTION__.neo_aa_header_remove_field_at_index, ptr noundef @.str.10) #6
  store i32 1, ptr %8, align 4
  br label %215

67:                                               ; preds = %36
  %68 = load ptr, ptr %12, align 8, !tbaa !5
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %69, i32 0, i32 1
  store ptr %68, ptr %70, align 8, !tbaa !15
  %71 = load i64, ptr %11, align 8, !tbaa !14
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %72, i32 0, i32 6
  store i64 %71, ptr %73, align 8, !tbaa !16
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %74, i32 0, i32 4
  %76 = load ptr, ptr %75, align 8, !tbaa !17
  %77 = load i32, ptr %4, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds ptr, ptr %76, i64 %78
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  call void @free(ptr noundef %80) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %81, i32 0, i32 0
  %83 = load i32, ptr %82, align 8, !tbaa !18
  store i32 %83, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %84 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %84, ptr %14, align 4, !tbaa !9
  br label %85

85:                                               ; preds = %148, %67
  %86 = load i32, ptr %14, align 4, !tbaa !9
  %87 = load i32, ptr %13, align 4, !tbaa !9
  %88 = sub i32 %87, 1
  %89 = icmp ult i32 %86, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %85
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %151

91:                                               ; preds = %85
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %92, i32 0, i32 2
  %94 = load ptr, ptr %93, align 8, !tbaa !19
  %95 = load i32, ptr %14, align 4, !tbaa !9
  %96 = add i32 %95, 1
  %97 = zext i32 %96 to i64
  %98 = getelementptr inbounds i32, ptr %94, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !9
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %100, i32 0, i32 2
  %102 = load ptr, ptr %101, align 8, !tbaa !19
  %103 = load i32, ptr %14, align 4, !tbaa !9
  %104 = zext i32 %103 to i64
  %105 = getelementptr inbounds i32, ptr %102, i64 %104
  store i32 %99, ptr %105, align 4, !tbaa !9
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %106, i32 0, i32 3
  %108 = load ptr, ptr %107, align 8, !tbaa !20
  %109 = load i32, ptr %14, align 4, !tbaa !9
  %110 = add i32 %109, 1
  %111 = zext i32 %110 to i64
  %112 = getelementptr inbounds i8, ptr %108, i64 %111
  %113 = load i8, ptr %112, align 1, !tbaa !21
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %114, i32 0, i32 3
  %116 = load ptr, ptr %115, align 8, !tbaa !20
  %117 = load i32, ptr %14, align 4, !tbaa !9
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds i8, ptr %116, i64 %118
  store i8 %113, ptr %119, align 1, !tbaa !21
  %120 = load ptr, ptr %3, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %120, i32 0, i32 4
  %122 = load ptr, ptr %121, align 8, !tbaa !17
  %123 = load i32, ptr %14, align 4, !tbaa !9
  %124 = add i32 %123, 1
  %125 = zext i32 %124 to i64
  %126 = getelementptr inbounds ptr, ptr %122, i64 %125
  %127 = load ptr, ptr %126, align 8, !tbaa !5
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %128, i32 0, i32 4
  %130 = load ptr, ptr %129, align 8, !tbaa !17
  %131 = load i32, ptr %14, align 4, !tbaa !9
  %132 = zext i32 %131 to i64
  %133 = getelementptr inbounds ptr, ptr %130, i64 %132
  store ptr %127, ptr %133, align 8, !tbaa !5
  %134 = load ptr, ptr %3, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %134, i32 0, i32 5
  %136 = load ptr, ptr %135, align 8, !tbaa !11
  %137 = load i32, ptr %14, align 4, !tbaa !9
  %138 = add i32 %137, 1
  %139 = zext i32 %138 to i64
  %140 = getelementptr inbounds i64, ptr %136, i64 %139
  %141 = load i64, ptr %140, align 8, !tbaa !14
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %142, i32 0, i32 5
  %144 = load ptr, ptr %143, align 8, !tbaa !11
  %145 = load i32, ptr %14, align 4, !tbaa !9
  %146 = zext i32 %145 to i64
  %147 = getelementptr inbounds i64, ptr %144, i64 %146
  store i64 %141, ptr %147, align 8, !tbaa !14
  br label %148

148:                                              ; preds = %91
  %149 = load i32, ptr %14, align 4, !tbaa !9
  %150 = add i32 %149, 1
  store i32 %150, ptr %14, align 4, !tbaa !9
  br label %85, !llvm.loop !22

151:                                              ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %152 = load ptr, ptr %3, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %152, i32 0, i32 2
  %154 = load ptr, ptr %153, align 8, !tbaa !19
  %155 = load i32, ptr %13, align 4, !tbaa !9
  %156 = sub i32 %155, 1
  %157 = zext i32 %156 to i64
  %158 = mul i64 %157, 4
  %159 = call ptr @realloc(ptr noundef %154, i64 noundef %158) #7
  store ptr %159, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %160 = load ptr, ptr %3, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %160, i32 0, i32 3
  %162 = load ptr, ptr %161, align 8, !tbaa !20
  %163 = load i32, ptr %13, align 4, !tbaa !9
  %164 = sub i32 %163, 1
  %165 = zext i32 %164 to i64
  %166 = call ptr @realloc(ptr noundef %162, i64 noundef %165) #7
  store ptr %166, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %167 = load ptr, ptr %3, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %167, i32 0, i32 4
  %169 = load ptr, ptr %168, align 8, !tbaa !17
  %170 = load i32, ptr %13, align 4, !tbaa !9
  %171 = sub i32 %170, 1
  %172 = zext i32 %171 to i64
  %173 = mul i64 %172, 8
  %174 = call ptr @realloc(ptr noundef %169, i64 noundef %173) #7
  store ptr %174, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %175 = load ptr, ptr %3, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %175, i32 0, i32 5
  %177 = load ptr, ptr %176, align 8, !tbaa !11
  %178 = load i32, ptr %13, align 4, !tbaa !9
  %179 = sub i32 %178, 1
  %180 = zext i32 %179 to i64
  %181 = mul i64 %180, 8
  %182 = call ptr @realloc(ptr noundef %177, i64 noundef %181) #7
  store ptr %182, ptr %18, align 8, !tbaa !5
  %183 = load ptr, ptr %15, align 8, !tbaa !5
  %184 = icmp ne ptr %183, null
  br i1 %184, label %185, label %194

185:                                              ; preds = %151
  %186 = load ptr, ptr %16, align 8, !tbaa !5
  %187 = icmp ne ptr %186, null
  br i1 %187, label %188, label %194

188:                                              ; preds = %185
  %189 = load ptr, ptr %17, align 8, !tbaa !5
  %190 = icmp ne ptr %189, null
  br i1 %190, label %191, label %194

191:                                              ; preds = %188
  %192 = load ptr, ptr %18, align 8, !tbaa !5
  %193 = icmp ne ptr %192, null
  br i1 %193, label %197, label %194

194:                                              ; preds = %191, %188, %185, %151
  %195 = load ptr, ptr @stderr, align 8, !tbaa !5
  %196 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %195, ptr noundef @.str.7, ptr noundef @__FUNCTION__.neo_aa_header_remove_field_at_index, ptr noundef @.str.10) #6
  store i32 1, ptr %8, align 4
  br label %214

197:                                              ; preds = %191
  %198 = load ptr, ptr %15, align 8, !tbaa !5
  %199 = load ptr, ptr %3, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %199, i32 0, i32 2
  store ptr %198, ptr %200, align 8, !tbaa !19
  %201 = load ptr, ptr %16, align 8, !tbaa !5
  %202 = load ptr, ptr %3, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %202, i32 0, i32 3
  store ptr %201, ptr %203, align 8, !tbaa !20
  %204 = load ptr, ptr %17, align 8, !tbaa !5
  %205 = load ptr, ptr %3, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %205, i32 0, i32 4
  store ptr %204, ptr %206, align 8, !tbaa !17
  %207 = load ptr, ptr %18, align 8, !tbaa !5
  %208 = load ptr, ptr %3, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %208, i32 0, i32 5
  store ptr %207, ptr %209, align 8, !tbaa !11
  %210 = load i32, ptr %13, align 4, !tbaa !9
  %211 = sub i32 %210, 1
  %212 = load ptr, ptr %3, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.neo_aa_header_impl, ptr %212, i32 0, i32 0
  store i32 %211, ptr %213, align 8, !tbaa !18
  store i32 0, ptr %8, align 4
  br label %214

214:                                              ; preds = %197, %194
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %215

215:                                              ; preds = %214, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %216

216:                                              ; preds = %215, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  %217 = load i32, ptr %8, align 4
  switch i32 %217, label %219 [
    i32 0, label %218
    i32 1, label %218
  ]

218:                                              ; preds = %216, %216
  ret void

219:                                              ; preds = %216
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 }
attributes #7 = { 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 = !{!12, !6, i64 40}
!12 = !{!"neo_aa_header_impl", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !13, i64 48, !6, i64 56}
!13 = !{!"long", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!12, !6, i64 8}
!16 = !{!12, !13, i64 48}
!17 = !{!12, !6, i64 32}
!18 = !{!12, !10, i64 0}
!19 = !{!12, !6, i64 16}
!20 = !{!12, !6, i64 24}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [48 x i8], align 1
@__FUNCTION__.neo_aa_header_remove_field_at_index = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) 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: 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 #2

declare i64 @internal_do_not_call_neo_aa_archive_header_key_pos_in_encoded_data(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #4

; Function Attrs: nounwind uwtable
define dso_local void @neo_aa_header_remove_field_at_index(ptr noundef %0, i32 noundef %1) local_unnamed_addr #5 {
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = sext i32 %1 to i64
  %6 = getelementptr inbounds i64, ptr %4, i64 %5
  %7 = load i64, ptr %6, align 8, !tbaa !12
  %8 = tail call i64 @internal_do_not_call_neo_aa_archive_header_key_pos_in_encoded_data(ptr noundef %0, i32 noundef %1) #6
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %9, label %12

9:                                                ; preds = %2
  %10 = load ptr, ptr @stderr, align 8, !tbaa !13
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str.7, ptr noundef nonnull @__FUNCTION__.neo_aa_header_remove_field_at_index, ptr noundef nonnull @.str.14) #7
  br label %78

12:                                               ; preds = %2
  %13 = add i64 %7, 4
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = getelementptr inbounds i8, ptr %0, i64 48
  %17 = load i64, ptr %16, align 8, !tbaa !15
  %18 = sub i64 %17, %13
  %19 = getelementptr inbounds i8, ptr %15, i64 %8
  %20 = getelementptr inbounds i8, ptr %19, i64 %13
  %21 = add i64 %7, %8
  %reass.sub = sub i64 %17, %21
  %22 = add i64 %reass.sub, -4
  tail call void @llvm.memmove.p0.p0.i64(ptr nonnull align 1 %19, ptr nonnull align 1 %20, i64 %22, i1 false)
  %23 = tail call ptr @realloc(ptr noundef %15, i64 noundef %18) #8
  %.not81 = icmp eq ptr %23, null
  br i1 %.not81, label %24, label %27

24:                                               ; preds = %12
  %25 = load ptr, ptr @stderr, align 8, !tbaa !13
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.7, ptr noundef nonnull @__FUNCTION__.neo_aa_header_remove_field_at_index, ptr noundef nonnull @.str.10) #7
  br label %78

27:                                               ; preds = %12
  store ptr %23, ptr %14, align 8, !tbaa !14
  store i64 %18, ptr %16, align 8, !tbaa !15
  %28 = getelementptr inbounds i8, ptr %0, i64 32
  %29 = load ptr, ptr %28, align 8, !tbaa !16
  %30 = getelementptr inbounds ptr, ptr %29, i64 %5
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  tail call void @free(ptr noundef %31) #6
  %32 = load i32, ptr %0, align 8, !tbaa !17
  %33 = add i32 %32, -1
  %34 = icmp ugt i32 %33, %1
  br i1 %34, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %27
  %.pre = zext i32 %33 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %27
  %35 = getelementptr inbounds i8, ptr %0, i64 16
  %36 = getelementptr inbounds i8, ptr %0, i64 24
  %37 = zext i32 %1 to i64
  %wide.trip.count = zext i32 %33 to i64
  br label %57

._crit_edge:                                      ; preds = %57, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %wide.trip.count, %57 ]
  %38 = getelementptr inbounds i8, ptr %0, i64 16
  %39 = load ptr, ptr %38, align 8, !tbaa !18
  %40 = shl nuw nsw i64 %.pre-phi, 2
  %41 = tail call ptr @realloc(ptr noundef %39, i64 noundef %40) #8
  %42 = getelementptr inbounds i8, ptr %0, i64 24
  %43 = load ptr, ptr %42, align 8, !tbaa !19
  %44 = tail call ptr @realloc(ptr noundef %43, i64 noundef %.pre-phi) #8
  %45 = load ptr, ptr %28, align 8, !tbaa !16
  %46 = shl nuw nsw i64 %.pre-phi, 3
  %47 = tail call ptr @realloc(ptr noundef %45, i64 noundef %46) #8
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = tail call ptr @realloc(ptr noundef %48, i64 noundef %46) #8
  %50 = insertelement <4 x ptr> poison, ptr %41, i64 0
  %51 = insertelement <4 x ptr> %50, ptr %44, i64 1
  %52 = insertelement <4 x ptr> %51, ptr %47, i64 2
  %53 = insertelement <4 x ptr> %52, ptr %49, i64 3
  %54 = icmp eq <4 x ptr> %53, zeroinitializer
  %55 = bitcast <4 x i1> %54 to i4
  %56 = icmp eq i4 %55, 0
  br i1 %56, label %77, label %74

57:                                               ; preds = %.lr.ph, %57
  %indvars.iv = phi i64 [ %37, %.lr.ph ], [ %indvars.iv.next, %57 ]
  %58 = load ptr, ptr %35, align 8, !tbaa !18
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %59 = getelementptr inbounds i32, ptr %58, i64 %indvars.iv.next
  %60 = load i32, ptr %59, align 4, !tbaa !20
  %61 = getelementptr inbounds i32, ptr %58, i64 %indvars.iv
  store i32 %60, ptr %61, align 4, !tbaa !20
  %62 = load ptr, ptr %36, align 8, !tbaa !19
  %63 = getelementptr inbounds i8, ptr %62, i64 %indvars.iv.next
  %64 = load i8, ptr %63, align 1, !tbaa !21
  %65 = getelementptr inbounds i8, ptr %62, i64 %indvars.iv
  store i8 %64, ptr %65, align 1, !tbaa !21
  %66 = load ptr, ptr %28, align 8, !tbaa !16
  %67 = getelementptr inbounds ptr, ptr %66, i64 %indvars.iv.next
  %68 = load ptr, ptr %67, align 8, !tbaa !13
  %69 = getelementptr inbounds ptr, ptr %66, i64 %indvars.iv
  store ptr %68, ptr %69, align 8, !tbaa !13
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds i64, ptr %70, i64 %indvars.iv.next
  %72 = load i64, ptr %71, align 8, !tbaa !12
  %73 = getelementptr inbounds i64, ptr %70, i64 %indvars.iv
  store i64 %72, ptr %73, align 8, !tbaa !12
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %57, !llvm.loop !22

74:                                               ; preds = %._crit_edge
  %75 = load ptr, ptr @stderr, align 8, !tbaa !13
  %76 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef nonnull @.str.7, ptr noundef nonnull @__FUNCTION__.neo_aa_header_remove_field_at_index, ptr noundef nonnull @.str.10) #7
  br label %78

77:                                               ; preds = %._crit_edge
  store ptr %41, ptr %38, align 8, !tbaa !18
  store ptr %44, ptr %42, align 8, !tbaa !19
  store ptr %47, ptr %28, align 8, !tbaa !16
  store ptr %49, ptr %3, align 8, !tbaa !5
  store i32 %33, ptr %0, align 8, !tbaa !17
  br label %78

78:                                               ; preds = %24, %77, %74, %9
  ret void
}

attributes #0 = { 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 #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 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 }
attributes #7 = { cold 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, !10, i64 40}
!6 = !{!"neo_aa_header_impl", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !10, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !10, i64 8}
!15 = !{!6, !11, i64 48}
!16 = !{!6, !10, i64 32}
!17 = !{!6, !7, i64 0}
!18 = !{!6, !10, i64 16}
!19 = !{!6, !10, i64 24}
!20 = !{!7, !7, i64 0}
!21 = !{!8, !8, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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