; LLVM IR from ryanlayer/giggle :: src (search_file)

; 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.cache_def = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.__kstring_t = type { i64, i64, ptr }
%struct.file_id_offset_pair = type { i32, i64 }
%struct.giggle_index = type { ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.file_index = type { ptr, ptr }
%struct.unordered_list = type { ptr, i32, i32 }
%struct.input_file = type { ptr, ptr, ptr, ptr, ptr, ptr, i64, i32, ptr, ptr, ptr }
%struct.uint64_t_ll = type { i64, ptr, ptr }
%struct.uint64_t_ll_node = type { i64, ptr }
%struct.file_data = type { ptr, i32, double }
%struct.long_ll = type { i64, ptr, ptr }
%struct.long_ll_node = type { i64, ptr }

@WAH_SIZE = external dso_local global i32, align 4
@WAH_MAX_FILL_WORDS = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@cache = external dso_local global %struct.cache_def, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca %struct.__kstring_t, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca %struct.file_id_offset_pair, align 8
  %27 = alloca i32, align 4
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca i32, align 4
  %31 = alloca ptr, align 8
  %32 = alloca ptr, align 8
  %33 = alloca ptr, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store i32 32, ptr @WAH_SIZE, align 4, !tbaa !5
  %34 = load i32, ptr @WAH_SIZE, align 4, !tbaa !5
  %35 = sub i32 %34, 1
  %36 = shl i32 1, %35
  %37 = sub nsw i32 %36, 1
  store i32 %37, ptr @WAH_MAX_FILL_WORDS, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  store i32 100, ptr %6, align 4, !tbaa !5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = icmp ne i32 %38, 4
  br i1 %39, label %40, label %44

40:                                               ; preds = %2
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds ptr, ptr %41, i64 0
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef @.str, ptr noundef %43) #10
  unreachable

44:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  store double 0x41E710893C800000, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %45 = load ptr, ptr %5, align 8, !tbaa !9
  %46 = getelementptr inbounds ptr, ptr %45, i64 1
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  store ptr %47, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = getelementptr inbounds ptr, ptr %48, i64 2
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  store ptr %50, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %51 = load ptr, ptr %5, align 8, !tbaa !9
  %52 = getelementptr inbounds ptr, ptr %51, i64 3
  %53 = load ptr, ptr %52, align 8, !tbaa !9
  store ptr %53, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %54 = load ptr, ptr %8, align 8, !tbaa !9
  %55 = call ptr @input_file_init(ptr noundef %54)
  store ptr %55, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  store i32 50, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %56 = load i32, ptr %12, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = mul i64 %57, 1
  %59 = call noalias ptr @malloc(i64 noundef %58) #11
  store ptr %59, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #9
  call void @llvm.memset.p0.i64(ptr align 8 %17, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %60 = load ptr, ptr %9, align 8, !tbaa !9
  %61 = call ptr @giggle_load(ptr noundef %60, ptr noundef @uint64_t_ll_giggle_set_data_handler)
  store ptr %61, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  %62 = load ptr, ptr %18, align 8, !tbaa !9
  %63 = getelementptr inbounds %struct.giggle_index, ptr %62, i32 0, i32 4
  %64 = load ptr, ptr %63, align 8, !tbaa !13
  %65 = getelementptr inbounds %struct.file_index, ptr %64, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !15
  %67 = getelementptr inbounds %struct.unordered_list, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 8, !tbaa !17
  %69 = zext i32 %68 to i64
  %70 = call noalias ptr @calloc(i64 noundef %69, i64 noundef 8) #12
  store ptr %70, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %86, %44
  %72 = load i32, ptr %20, align 4, !tbaa !5
  %73 = load ptr, ptr %18, align 8, !tbaa !9
  %74 = getelementptr inbounds %struct.giggle_index, ptr %73, i32 0, i32 4
  %75 = load ptr, ptr %74, align 8, !tbaa !13
  %76 = getelementptr inbounds %struct.file_index, ptr %75, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !15
  %78 = getelementptr inbounds %struct.unordered_list, ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 8, !tbaa !17
  %80 = icmp ult i32 %72, %79
  br i1 %80, label %81, label %89

81:                                               ; preds = %71
  %82 = load ptr, ptr %19, align 8, !tbaa !9
  %83 = load i32, ptr %20, align 4, !tbaa !5
  %84 = zext i32 %83 to i64
  %85 = getelementptr inbounds ptr, ptr %82, i64 %84
  store ptr null, ptr %85, align 8, !tbaa !9
  br label %86

86:                                               ; preds = %81
  %87 = load i32, ptr %20, align 4, !tbaa !5
  %88 = add i32 %87, 1
  store i32 %88, ptr %20, align 4, !tbaa !5
  br label %71, !llvm.loop !19

89:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %135, %89
  %91 = load ptr, ptr %11, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.input_file, ptr %91, i32 0, i32 8
  %93 = load ptr, ptr %92, align 8, !tbaa !21
  %94 = load ptr, ptr %11, align 8, !tbaa !9
  %95 = call i32 %93(ptr noundef %94, ptr noundef %13, ptr noundef %12, ptr noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %17)
  %96 = icmp sge i32 %95, 0
  br i1 %96, label %97, label %138

97:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #9
  %98 = load ptr, ptr %18, align 8, !tbaa !9
  %99 = load ptr, ptr %13, align 8, !tbaa !9
  %100 = load i32, ptr %14, align 4, !tbaa !5
  %101 = load i32, ptr %15, align 4, !tbaa !5
  %102 = call ptr @giggle_query_region(ptr noundef %98, ptr noundef %99, i32 noundef %100, i32 noundef %101)
  store ptr %102, ptr %23, align 8, !tbaa !9
  %103 = load ptr, ptr %23, align 8, !tbaa !9
  %104 = icmp ne ptr %103, null
  br i1 %104, label %105, label %135

105:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #9
  %106 = load ptr, ptr %23, align 8, !tbaa !9
  %107 = getelementptr inbounds %struct.uint64_t_ll, ptr %106, i32 0, i32 1
  %108 = load ptr, ptr %107, align 8, !tbaa !24
  store ptr %108, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #9
  store i32 0, ptr %25, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %112, %105
  %110 = load ptr, ptr %24, align 8, !tbaa !9
  %111 = icmp ne ptr %110, null
  br i1 %111, label %112, label %134

112:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 16, ptr %26) #9
  %113 = load ptr, ptr %18, align 8, !tbaa !9
  %114 = getelementptr inbounds %struct.giggle_index, ptr %113, i32 0, i32 5
  %115 = load ptr, ptr %114, align 8, !tbaa !26
  %116 = load ptr, ptr %24, align 8, !tbaa !9
  %117 = getelementptr inbounds %struct.uint64_t_ll_node, ptr %116, i32 0, i32 0
  %118 = load i64, ptr %117, align 8, !tbaa !27
  %119 = call { i32, i64 } @offset_index_get(ptr noundef %115, i64 noundef %118)
  %120 = getelementptr inbounds { i32, i64 }, ptr %26, i32 0, i32 0
  %121 = extractvalue { i32, i64 } %119, 0
  store i32 %121, ptr %120, align 8
  %122 = getelementptr inbounds { i32, i64 }, ptr %26, i32 0, i32 1
  %123 = extractvalue { i32, i64 } %119, 1
  store i64 %123, ptr %122, align 8
  %124 = load ptr, ptr %19, align 8, !tbaa !9
  %125 = getelementptr inbounds %struct.file_id_offset_pair, ptr %26, i32 0, i32 0
  %126 = load i32, ptr %125, align 8, !tbaa !29
  %127 = zext i32 %126 to i64
  %128 = getelementptr inbounds ptr, ptr %124, i64 %127
  %129 = getelementptr inbounds %struct.file_id_offset_pair, ptr %26, i32 0, i32 1
  %130 = load i64, ptr %129, align 8, !tbaa !31
  call void @long_ll_append(ptr noundef %128, i64 noundef %130)
  %131 = load ptr, ptr %24, align 8, !tbaa !9
  %132 = getelementptr inbounds %struct.uint64_t_ll_node, ptr %131, i32 0, i32 1
  %133 = load ptr, ptr %132, align 8, !tbaa !32
  store ptr %133, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #9
  br label %109, !llvm.loop !33

134:                                              ; preds = %109
  call void @uint64_t_ll_free(ptr noundef %23)
  store ptr null, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #9
  br label %135

135:                                              ; preds = %134, %97
  %136 = load i32, ptr %22, align 4, !tbaa !5
  %137 = add i32 %136, 1
  store i32 %137, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #9
  br label %90, !llvm.loop !34

138:                                              ; preds = %90
  %139 = getelementptr inbounds %struct.__kstring_t, ptr %17, i32 0, i32 2
  %140 = load ptr, ptr %139, align 8, !tbaa !35
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %145

142:                                              ; preds = %138
  %143 = getelementptr inbounds %struct.__kstring_t, ptr %17, i32 0, i32 2
  %144 = load ptr, ptr %143, align 8, !tbaa !35
  call void @free(ptr noundef %144) #9
  br label %145

145:                                              ; preds = %142, %138
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #9
  %146 = load i32, ptr %22, align 4, !tbaa !5
  %147 = mul i32 %146, 2
  store i32 %147, ptr %27, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #9
  %148 = load i32, ptr %27, align 4, !tbaa !5
  %149 = zext i32 %148 to i64
  %150 = mul i64 %149, 8
  %151 = call noalias ptr @malloc(i64 noundef %150) #11
  store ptr %151, ptr %28, align 8, !tbaa !9
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %286, %145
  %153 = load i32, ptr %20, align 4, !tbaa !5
  %154 = load ptr, ptr %18, align 8, !tbaa !9
  %155 = getelementptr inbounds %struct.giggle_index, ptr %154, i32 0, i32 4
  %156 = load ptr, ptr %155, align 8, !tbaa !13
  %157 = getelementptr inbounds %struct.file_index, ptr %156, i32 0, i32 1
  %158 = load ptr, ptr %157, align 8, !tbaa !15
  %159 = getelementptr inbounds %struct.unordered_list, ptr %158, i32 0, i32 1
  %160 = load i32, ptr %159, align 8, !tbaa !17
  %161 = icmp ult i32 %153, %160
  br i1 %161, label %162, label %289

162:                                              ; preds = %152
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #9
  %163 = load ptr, ptr %18, align 8, !tbaa !9
  %164 = getelementptr inbounds %struct.giggle_index, ptr %163, i32 0, i32 4
  %165 = load ptr, ptr %164, align 8, !tbaa !13
  %166 = load i32, ptr %20, align 4, !tbaa !5
  %167 = call ptr @file_index_get(ptr noundef %165, i32 noundef %166)
  store ptr %167, ptr %29, align 8, !tbaa !9
  %168 = load ptr, ptr %29, align 8, !tbaa !9
  %169 = getelementptr inbounds %struct.file_data, ptr %168, i32 0, i32 0
  %170 = load ptr, ptr %169, align 8, !tbaa !37
  %171 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %170)
  %172 = load ptr, ptr %19, align 8, !tbaa !9
  %173 = load i32, ptr %20, align 4, !tbaa !5
  %174 = zext i32 %173 to i64
  %175 = getelementptr inbounds ptr, ptr %172, i64 %174
  %176 = load ptr, ptr %175, align 8, !tbaa !9
  %177 = icmp eq ptr %176, null
  br i1 %177, label %178, label %180

178:                                              ; preds = %162
  %179 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 11, ptr %30, align 4
  br label %283

180:                                              ; preds = %162
  %181 = load ptr, ptr %19, align 8, !tbaa !9
  %182 = load i32, ptr %20, align 4, !tbaa !5
  %183 = zext i32 %182 to i64
  %184 = getelementptr inbounds ptr, ptr %181, i64 %183
  %185 = load ptr, ptr %184, align 8, !tbaa !9
  %186 = getelementptr inbounds %struct.long_ll, ptr %185, i32 0, i32 0
  %187 = load i64, ptr %186, align 8, !tbaa !39
  %188 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %187)
  br label %189

189:                                              ; preds = %180
  %190 = load i32, ptr %27, align 4, !tbaa !5
  %191 = zext i32 %190 to i64
  %192 = load ptr, ptr %19, align 8, !tbaa !9
  %193 = load i32, ptr %20, align 4, !tbaa !5
  %194 = zext i32 %193 to i64
  %195 = getelementptr inbounds ptr, ptr %192, i64 %194
  %196 = load ptr, ptr %195, align 8, !tbaa !9
  %197 = getelementptr inbounds %struct.long_ll, ptr %196, i32 0, i32 0
  %198 = load i64, ptr %197, align 8, !tbaa !39
  %199 = icmp ult i64 %191, %198
  br i1 %199, label %200, label %215

200:                                              ; preds = %189
  %201 = load ptr, ptr %19, align 8, !tbaa !9
  %202 = load i32, ptr %20, align 4, !tbaa !5
  %203 = zext i32 %202 to i64
  %204 = getelementptr inbounds ptr, ptr %201, i64 %203
  %205 = load ptr, ptr %204, align 8, !tbaa !9
  %206 = getelementptr inbounds %struct.long_ll, ptr %205, i32 0, i32 0
  %207 = load i64, ptr %206, align 8, !tbaa !39
  %208 = mul i64 %207, 2
  %209 = trunc i64 %208 to i32
  store i32 %209, ptr %27, align 4, !tbaa !5
  %210 = load ptr, ptr %28, align 8, !tbaa !9
  %211 = load i32, ptr %27, align 4, !tbaa !5
  %212 = zext i32 %211 to i64
  %213 = mul i64 %212, 8
  %214 = call ptr @realloc(ptr noundef %210, i64 noundef %213) #13
  store ptr %214, ptr %28, align 8, !tbaa !9
  br label %215

215:                                              ; preds = %200, %189
  store i32 0, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #9
  %216 = load ptr, ptr %19, align 8, !tbaa !9
  %217 = load i32, ptr %20, align 4, !tbaa !5
  %218 = zext i32 %217 to i64
  %219 = getelementptr inbounds ptr, ptr %216, i64 %218
  %220 = load ptr, ptr %219, align 8, !tbaa !9
  %221 = getelementptr inbounds %struct.long_ll, ptr %220, i32 0, i32 1
  %222 = load ptr, ptr %221, align 8, !tbaa !41
  store ptr %222, ptr %31, align 8, !tbaa !9
  br label %223

223:                                              ; preds = %226, %215
  %224 = load ptr, ptr %31, align 8, !tbaa !9
  %225 = icmp ne ptr %224, null
  br i1 %225, label %226, label %238

226:                                              ; preds = %223
  %227 = load ptr, ptr %31, align 8, !tbaa !9
  %228 = getelementptr inbounds %struct.long_ll_node, ptr %227, i32 0, i32 0
  %229 = load i64, ptr %228, align 8, !tbaa !42
  %230 = load ptr, ptr %28, align 8, !tbaa !9
  %231 = load i32, ptr %21, align 4, !tbaa !5
  %232 = add i32 %231, 1
  store i32 %232, ptr %21, align 4, !tbaa !5
  %233 = zext i32 %231 to i64
  %234 = getelementptr inbounds i64, ptr %230, i64 %233
  store i64 %229, ptr %234, align 8, !tbaa !44
  %235 = load ptr, ptr %31, align 8, !tbaa !9
  %236 = getelementptr inbounds %struct.long_ll_node, ptr %235, i32 0, i32 1
  %237 = load ptr, ptr %236, align 8, !tbaa !45
  store ptr %237, ptr %31, align 8, !tbaa !9
  br label %223, !llvm.loop !46

238:                                              ; preds = %223
  %239 = load ptr, ptr %28, align 8, !tbaa !9
  %240 = load ptr, ptr %19, align 8, !tbaa !9
  %241 = load i32, ptr %20, align 4, !tbaa !5
  %242 = zext i32 %241 to i64
  %243 = getelementptr inbounds ptr, ptr %240, i64 %242
  %244 = load ptr, ptr %243, align 8, !tbaa !9
  %245 = getelementptr inbounds %struct.long_ll, ptr %244, i32 0, i32 0
  %246 = load i64, ptr %245, align 8, !tbaa !39
  call void @qsort(ptr noundef %239, i64 noundef %246, i64 noundef 8, ptr noundef @long_cmp)
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #9
  %247 = load ptr, ptr %29, align 8, !tbaa !9
  %248 = getelementptr inbounds %struct.file_data, ptr %247, i32 0, i32 0
  %249 = load ptr, ptr %248, align 8, !tbaa !37
  %250 = call ptr @input_file_init(ptr noundef %249)
  store ptr %250, ptr %32, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #9
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %251

251:                                              ; preds = %279, %238
  %252 = load i32, ptr %21, align 4, !tbaa !5
  %253 = zext i32 %252 to i64
  %254 = load ptr, ptr %19, align 8, !tbaa !9
  %255 = load i32, ptr %20, align 4, !tbaa !5
  %256 = zext i32 %255 to i64
  %257 = getelementptr inbounds ptr, ptr %254, i64 %256
  %258 = load ptr, ptr %257, align 8, !tbaa !9
  %259 = getelementptr inbounds %struct.long_ll, ptr %258, i32 0, i32 0
  %260 = load i64, ptr %259, align 8, !tbaa !39
  %261 = icmp ult i64 %253, %260
  br i1 %261, label %262, label %282

262:                                              ; preds = %251
  %263 = load ptr, ptr %32, align 8, !tbaa !9
  %264 = getelementptr inbounds %struct.input_file, ptr %263, i32 0, i32 10
  %265 = load ptr, ptr %264, align 8, !tbaa !47
  %266 = load ptr, ptr %32, align 8, !tbaa !9
  %267 = load ptr, ptr %28, align 8, !tbaa !9
  %268 = load i32, ptr %21, align 4, !tbaa !5
  %269 = zext i32 %268 to i64
  %270 = getelementptr inbounds i64, ptr %267, i64 %269
  %271 = load i64, ptr %270, align 8, !tbaa !44
  call void %265(ptr noundef %266, i64 noundef %271)
  %272 = load ptr, ptr %32, align 8, !tbaa !9
  %273 = getelementptr inbounds %struct.input_file, ptr %272, i32 0, i32 9
  %274 = load ptr, ptr %273, align 8, !tbaa !48
  %275 = load ptr, ptr %32, align 8, !tbaa !9
  %276 = call i32 %274(ptr noundef %275, ptr noundef %33)
  %277 = load ptr, ptr %33, align 8, !tbaa !9
  %278 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %277)
  br label %279

279:                                              ; preds = %262
  %280 = load i32, ptr %21, align 4, !tbaa !5
  %281 = add i32 %280, 1
  store i32 %281, ptr %21, align 4, !tbaa !5
  br label %251, !llvm.loop !49

282:                                              ; preds = %251
  call void @input_file_destroy(ptr noundef %32)
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #9
  store i32 0, ptr %30, align 4
  br label %283

283:                                              ; preds = %282, %178
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #9
  %284 = load i32, ptr %30, align 4
  switch i32 %284, label %292 [
    i32 0, label %285
    i32 11, label %286
  ]

285:                                              ; preds = %283
  br label %286

286:                                              ; preds = %285, %283
  %287 = load i32, ptr %20, align 4, !tbaa !5
  %288 = add i32 %287, 1
  store i32 %288, ptr %20, align 4, !tbaa !5
  br label %152, !llvm.loop !50

289:                                              ; preds = %152
  call void @giggle_index_destroy(ptr noundef %18)
  %290 = load ptr, ptr getelementptr inbounds (%struct.cache_def, ptr @cache, i32 0, i32 6), align 8, !tbaa !51
  call void (...) %290()
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  %291 = load i32, ptr %3, align 4
  ret i32 %291

292:                                              ; preds = %283
  unreachable
}

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

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) #2

declare ptr @input_file_init(ptr noundef) #3

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

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

declare ptr @giggle_load(ptr noundef, ptr noundef) #3

declare void @uint64_t_ll_giggle_set_data_handler(...) #3

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

declare ptr @giggle_query_region(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

declare { i32, i64 } @offset_index_get(ptr noundef, i64 noundef) #3

declare void @long_ll_append(ptr noundef, i64 noundef) #3

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

declare void @uint64_t_ll_free(ptr noundef) #3

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

declare ptr @file_index_get(ptr noundef, i32 noundef) #3

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

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

declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

declare i32 @long_cmp(ptr noundef, ptr noundef) #3

declare void @input_file_destroy(ptr noundef) #3

declare void @giggle_index_destroy(ptr noundef) #3

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 = { noreturn "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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(0,1) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { noreturn }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { nounwind allocsize(0,1) }
attributes #13 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 24}
!14 = !{!"giggle_index", !10, i64 0, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!15 = !{!16, !10, i64 8}
!16 = !{!"file_index", !10, i64 0, !10, i64 8}
!17 = !{!18, !6, i64 8}
!18 = !{!"unordered_list", !10, i64 0, !6, i64 8, !6, i64 12}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!22, !10, i64 64}
!22 = !{!"input_file", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !23, i64 48, !6, i64 56, !10, i64 64, !10, i64 72, !10, i64 80}
!23 = !{!"long", !7, i64 0}
!24 = !{!25, !10, i64 8}
!25 = !{!"uint64_t_ll", !23, i64 0, !10, i64 8, !10, i64 16}
!26 = !{!14, !10, i64 32}
!27 = !{!28, !23, i64 0}
!28 = !{!"uint64_t_ll_node", !23, i64 0, !10, i64 8}
!29 = !{!30, !6, i64 0}
!30 = !{!"file_id_offset_pair", !6, i64 0, !23, i64 8}
!31 = !{!30, !23, i64 8}
!32 = !{!28, !10, i64 8}
!33 = distinct !{!33, !20}
!34 = distinct !{!34, !20}
!35 = !{!36, !10, i64 16}
!36 = !{!"__kstring_t", !23, i64 0, !23, i64 8, !10, i64 16}
!37 = !{!38, !10, i64 0}
!38 = !{!"file_data", !10, i64 0, !6, i64 8, !12, i64 16}
!39 = !{!40, !23, i64 0}
!40 = !{!"long_ll", !23, i64 0, !10, i64 8, !10, i64 16}
!41 = !{!40, !10, i64 8}
!42 = !{!43, !23, i64 0}
!43 = !{!"long_ll_node", !23, i64 0, !10, i64 8}
!44 = !{!23, !23, i64 0}
!45 = !{!43, !10, i64 8}
!46 = distinct !{!46, !20}
!47 = !{!22, !10, i64 80}
!48 = !{!22, !10, i64 72}
!49 = distinct !{!49, !20}
!50 = distinct !{!50, !20}
!51 = !{!52, !10, i64 48}
!52 = !{!"cache_def", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}


; 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.cache_def = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.__kstring_t = type { i64, i64, ptr }

@WAH_SIZE = external dso_local local_unnamed_addr global i32, align 4
@WAH_MAX_FILL_WORDS = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@cache = external dso_local local_unnamed_addr global %struct.cache_def, align 8

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca %struct.__kstring_t, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  store i32 32, ptr @WAH_SIZE, align 4, !tbaa !5
  store i32 2147483647, ptr @WAH_MAX_FILL_WORDS, align 4, !tbaa !5
  %.not = icmp eq i32 %0, 4
  br i1 %.not, label %15, label %13

13:                                               ; preds = %2
  %14 = load ptr, ptr %1, align 8, !tbaa !9
  tail call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef nonnull @.str, ptr noundef %14) #11
  unreachable

15:                                               ; preds = %2
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = getelementptr inbounds i8, ptr %1, i64 16
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = tail call ptr @input_file_init(ptr noundef %17) #12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #12
  store i32 50, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #12
  %21 = tail call noalias dereferenceable_or_null(50) ptr @malloc(i64 noundef 50) #13
  store ptr %21, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #12
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #12
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #12
  %22 = tail call ptr @giggle_load(ptr noundef %19, ptr noundef nonnull @uint64_t_ll_giggle_set_data_handler) #12
  store ptr %22, ptr %9, align 8, !tbaa !9
  %23 = getelementptr inbounds i8, ptr %22, i64 24
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = getelementptr inbounds i8, ptr %24, i64 8
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %26, i64 8
  %28 = load i32, ptr %27, align 8, !tbaa !15
  %29 = zext i32 %28 to i64
  %30 = tail call noalias ptr @calloc(i64 noundef %29, i64 noundef 8) #14
  %.not101 = icmp eq i32 %28, 0
  br i1 %.not101, label %.preheader73, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %15
  %min.iters.check = icmp ult i32 %28, 4
  br i1 %min.iters.check, label %.lr.ph.preheader109, label %vector.ph

.lr.ph.preheader109:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %29, 4294967292
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %31 = getelementptr inbounds ptr, ptr %30, i64 %index
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  store <2 x ptr> zeroinitializer, ptr %31, align 8, !tbaa !9
  store <2 x ptr> zeroinitializer, ptr %32, align 8, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %33 = icmp eq i64 %index.next, %n.vec
  br i1 %33, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %29
  br i1 %cmp.n, label %.preheader73, label %.lr.ph.preheader109

.preheader73:                                     ; preds = %.lr.ph, %middle.block, %15
  %34 = getelementptr inbounds i8, ptr %20, i64 64
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  %36 = call i32 %35(ptr noundef %20, ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8) #12
  %37 = icmp sgt i32 %36, -1
  br i1 %37, label %.lr.ph81.preheader, label %._crit_edge82

.lr.ph81.preheader:                               ; preds = %.preheader73
  %38 = getelementptr inbounds i8, ptr %22, i64 32
  br label %.lr.ph81

.lr.ph:                                           ; preds = %.lr.ph.preheader109, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader109 ]
  %39 = getelementptr inbounds ptr, ptr %30, i64 %indvars.iv
  store ptr null, ptr %39, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %40 = icmp ult i64 %indvars.iv.next, %29
  br i1 %40, label %.lr.ph, label %.preheader73, !llvm.loop !24

.lr.ph81:                                         ; preds = %.lr.ph81.preheader, %52
  %.06180 = phi i32 [ %53, %52 ], [ 0, %.lr.ph81.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #12
  %41 = load ptr, ptr %4, align 8, !tbaa !9
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = load i32, ptr %6, align 4, !tbaa !5
  %44 = call ptr @giggle_query_region(ptr noundef %22, ptr noundef %41, i32 noundef %42, i32 noundef %43) #12
  store ptr %44, ptr %10, align 8, !tbaa !9
  %.not70 = icmp eq ptr %44, null
  br i1 %.not70, label %52, label %.preheader

.preheader:                                       ; preds = %.lr.ph81
  %.062.in75 = getelementptr inbounds i8, ptr %44, i64 8
  %.06276 = load ptr, ptr %.062.in75, align 8, !tbaa !9
  %.not7177 = icmp eq ptr %.06276, null
  br i1 %.not7177, label %._crit_edge, label %.lr.ph79

.lr.ph79:                                         ; preds = %.preheader, %.lr.ph79
  %.06278 = phi ptr [ %.062, %.lr.ph79 ], [ %.06276, %.preheader ]
  %45 = load ptr, ptr %38, align 8, !tbaa !25
  %46 = load i64, ptr %.06278, align 8, !tbaa !26
  %47 = call { i32, i64 } @offset_index_get(ptr noundef %45, i64 noundef %46) #12
  %48 = extractvalue { i32, i64 } %47, 0
  %49 = extractvalue { i32, i64 } %47, 1
  %50 = zext i32 %48 to i64
  %51 = getelementptr inbounds ptr, ptr %30, i64 %50
  call void @long_ll_append(ptr noundef %51, i64 noundef %49) #12
  %.062.in = getelementptr inbounds i8, ptr %.06278, i64 8
  %.062 = load ptr, ptr %.062.in, align 8, !tbaa !9
  %.not71 = icmp eq ptr %.062, null
  br i1 %.not71, label %._crit_edge, label %.lr.ph79, !llvm.loop !28

._crit_edge:                                      ; preds = %.lr.ph79, %.preheader
  call void @uint64_t_ll_free(ptr noundef nonnull %10) #12
  br label %52

52:                                               ; preds = %._crit_edge, %.lr.ph81
  %53 = add i32 %.06180, 1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #12
  %54 = load ptr, ptr %34, align 8, !tbaa !21
  %55 = call i32 %54(ptr noundef %20, ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8) #12
  %56 = icmp sgt i32 %55, -1
  br i1 %56, label %.lr.ph81, label %._crit_edge82.loopexit, !llvm.loop !29

._crit_edge82.loopexit:                           ; preds = %52
  %57 = shl i32 %53, 1
  br label %._crit_edge82

._crit_edge82:                                    ; preds = %._crit_edge82.loopexit, %.preheader73
  %.061.lcssa = phi i32 [ 0, %.preheader73 ], [ %57, %._crit_edge82.loopexit ]
  %58 = getelementptr inbounds i8, ptr %8, i64 16
  %59 = load ptr, ptr %58, align 8, !tbaa !30
  %.not68 = icmp eq ptr %59, null
  br i1 %.not68, label %61, label %60

60:                                               ; preds = %._crit_edge82
  call void @free(ptr noundef nonnull %59) #12
  br label %61

61:                                               ; preds = %60, %._crit_edge82
  %62 = zext i32 %.061.lcssa to i64
  %63 = shl nuw nsw i64 %62, 3
  %64 = call noalias ptr @malloc(i64 noundef %63) #13
  %65 = load ptr, ptr %23, align 8, !tbaa !11
  %66 = getelementptr inbounds i8, ptr %65, i64 8
  %67 = load ptr, ptr %66, align 8, !tbaa !13
  %68 = getelementptr inbounds i8, ptr %67, i64 8
  %69 = load i32, ptr %68, align 8, !tbaa !15
  %.not102 = icmp eq i32 %69, 0
  br i1 %.not102, label %._crit_edge100, label %.lr.ph99

.lr.ph99:                                         ; preds = %61, %121
  %70 = phi ptr [ %122, %121 ], [ %22, %61 ]
  %indvars.iv105 = phi i64 [ %indvars.iv.next106, %121 ], [ 0, %61 ]
  %71 = phi ptr [ %124, %121 ], [ %65, %61 ]
  %.05496 = phi ptr [ %.2, %121 ], [ %64, %61 ]
  %.05695 = phi i32 [ %.258, %121 ], [ %.061.lcssa, %61 ]
  %72 = trunc nuw i64 %indvars.iv105 to i32
  %73 = call ptr @file_index_get(ptr noundef nonnull %71, i32 noundef %72) #12
  %74 = load ptr, ptr %73, align 8, !tbaa !32
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %74)
  %76 = getelementptr inbounds ptr, ptr %30, i64 %indvars.iv105
  %77 = load ptr, ptr %76, align 8, !tbaa !9
  %78 = icmp eq ptr %77, null
  br i1 %78, label %79, label %81

79:                                               ; preds = %.lr.ph99
  %80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %121

81:                                               ; preds = %.lr.ph99
  %82 = load i64, ptr %77, align 8, !tbaa !35
  %83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %82)
  %84 = zext i32 %.05695 to i64
  %85 = load ptr, ptr %76, align 8, !tbaa !9
  %86 = load i64, ptr %85, align 8, !tbaa !35
  %87 = icmp ugt i64 %86, %84
  br i1 %87, label %88, label %93

88:                                               ; preds = %81
  %.tr = trunc i64 %86 to i32
  %89 = shl i32 %.tr, 1
  %90 = zext i32 %89 to i64
  %91 = shl nuw nsw i64 %90, 3
  %92 = call ptr @realloc(ptr noundef %.05496, i64 noundef %91) #15
  %.pre = load ptr, ptr %76, align 8, !tbaa !9
  br label %93

93:                                               ; preds = %88, %81
  %94 = phi ptr [ %.pre, %88 ], [ %85, %81 ]
  %.157 = phi i32 [ %89, %88 ], [ %.05695, %81 ]
  %.155 = phi ptr [ %92, %88 ], [ %.05496, %81 ]
  %.0.in83 = getelementptr inbounds i8, ptr %94, i64 8
  %.084 = load ptr, ptr %.0.in83, align 8, !tbaa !9
  %.not6985 = icmp eq ptr %.084, null
  br i1 %.not6985, label %._crit_edge90, label %.lr.ph89

.lr.ph89:                                         ; preds = %93, %.lr.ph89
  %.087 = phi ptr [ %.0, %.lr.ph89 ], [ %.084, %93 ]
  %.05986 = phi i32 [ %96, %.lr.ph89 ], [ 0, %93 ]
  %95 = load i64, ptr %.087, align 8, !tbaa !37
  %96 = add i32 %.05986, 1
  %97 = zext i32 %.05986 to i64
  %98 = getelementptr inbounds i64, ptr %.155, i64 %97
  store i64 %95, ptr %98, align 8, !tbaa !39
  %.0.in = getelementptr inbounds i8, ptr %.087, i64 8
  %.0 = load ptr, ptr %.0.in, align 8, !tbaa !9
  %.not69 = icmp eq ptr %.0, null
  br i1 %.not69, label %._crit_edge90, label %.lr.ph89, !llvm.loop !40

._crit_edge90:                                    ; preds = %.lr.ph89, %93
  %99 = load i64, ptr %94, align 8, !tbaa !35
  call void @qsort(ptr noundef %.155, i64 noundef %99, i64 noundef 8, ptr noundef nonnull @long_cmp) #12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #12
  %100 = load ptr, ptr %73, align 8, !tbaa !32
  %101 = call ptr @input_file_init(ptr noundef %100) #12
  store ptr %101, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #12
  %102 = load ptr, ptr %76, align 8, !tbaa !9
  %103 = load i64, ptr %102, align 8, !tbaa !35
  %.not103 = icmp eq i64 %103, 0
  br i1 %.not103, label %._crit_edge94, label %.lr.ph93

.lr.ph93:                                         ; preds = %._crit_edge90, %.lr.ph93
  %104 = phi i64 [ %117, %.lr.ph93 ], [ 0, %._crit_edge90 ]
  %.16091 = phi i32 [ %116, %.lr.ph93 ], [ 0, %._crit_edge90 ]
  %105 = load ptr, ptr %11, align 8, !tbaa !9
  %106 = getelementptr inbounds i8, ptr %105, i64 80
  %107 = load ptr, ptr %106, align 8, !tbaa !41
  %108 = getelementptr inbounds i64, ptr %.155, i64 %104
  %109 = load i64, ptr %108, align 8, !tbaa !39
  call void %107(ptr noundef %105, i64 noundef %109) #12
  %110 = load ptr, ptr %11, align 8, !tbaa !9
  %111 = getelementptr inbounds i8, ptr %110, i64 72
  %112 = load ptr, ptr %111, align 8, !tbaa !42
  %113 = call i32 %112(ptr noundef %110, ptr noundef nonnull %12) #12
  %114 = load ptr, ptr %12, align 8, !tbaa !9
  %115 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %114)
  %116 = add i32 %.16091, 1
  %117 = zext i32 %116 to i64
  %118 = load ptr, ptr %76, align 8, !tbaa !9
  %119 = load i64, ptr %118, align 8, !tbaa !35
  %120 = icmp ugt i64 %119, %117
  br i1 %120, label %.lr.ph93, label %._crit_edge94, !llvm.loop !43

._crit_edge94:                                    ; preds = %.lr.ph93, %._crit_edge90
  call void @input_file_destroy(ptr noundef nonnull %11) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #12
  %.pre108 = load ptr, ptr %9, align 8, !tbaa !9
  br label %121

121:                                              ; preds = %._crit_edge94, %79
  %122 = phi ptr [ %70, %79 ], [ %.pre108, %._crit_edge94 ]
  %.258 = phi i32 [ %.05695, %79 ], [ %.157, %._crit_edge94 ]
  %.2 = phi ptr [ %.05496, %79 ], [ %.155, %._crit_edge94 ]
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %123 = getelementptr inbounds i8, ptr %122, i64 24
  %124 = load ptr, ptr %123, align 8, !tbaa !11
  %125 = getelementptr inbounds i8, ptr %124, i64 8
  %126 = load ptr, ptr %125, align 8, !tbaa !13
  %127 = getelementptr inbounds i8, ptr %126, i64 8
  %128 = load i32, ptr %127, align 8, !tbaa !15
  %129 = zext i32 %128 to i64
  %130 = icmp ult i64 %indvars.iv.next106, %129
  br i1 %130, label %.lr.ph99, label %._crit_edge100, !llvm.loop !44

._crit_edge100:                                   ; preds = %121, %61
  call void @giggle_index_destroy(ptr noundef nonnull %9) #12
  %131 = load ptr, ptr getelementptr inbounds (i8, ptr @cache, i64 48), align 8, !tbaa !45
  call void (...) %131() #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #12
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #12
  ret i32 0
}

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

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) local_unnamed_addr #2

declare ptr @input_file_init(ptr noundef) local_unnamed_addr #3

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

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

declare ptr @giggle_load(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @uint64_t_ll_giggle_set_data_handler(...) #3

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

declare ptr @giggle_query_region(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare { i32, i64 } @offset_index_get(ptr noundef, i64 noundef) local_unnamed_addr #3

declare void @long_ll_append(ptr noundef, i64 noundef) local_unnamed_addr #3

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

declare void @uint64_t_ll_free(ptr noundef) local_unnamed_addr #3

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

declare ptr @file_index_get(ptr noundef, i32 noundef) local_unnamed_addr #3

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

; 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 #9

; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #10

declare i32 @long_cmp(ptr noundef, ptr noundef) #3

declare void @input_file_destroy(ptr noundef) local_unnamed_addr #3

declare void @giggle_index_destroy(ptr noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noreturn "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 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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 #9 = { 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 #10 = { nofree "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 #11 = { noreturn nounwind }
attributes #12 = { nounwind }
attributes #13 = { nounwind allocsize(0) }
attributes #14 = { nounwind allocsize(0,1) }
attributes #15 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"giggle_index", !10, i64 0, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!13 = !{!14, !10, i64 8}
!14 = !{!"file_index", !10, i64 0, !10, i64 8}
!15 = !{!16, !6, i64 8}
!16 = !{!"unordered_list", !10, i64 0, !6, i64 8, !6, i64 12}
!17 = distinct !{!17, !18, !19, !20}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = !{!22, !10, i64 64}
!22 = !{!"input_file", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !23, i64 48, !6, i64 56, !10, i64 64, !10, i64 72, !10, i64 80}
!23 = !{!"long", !7, i64 0}
!24 = distinct !{!24, !18, !20, !19}
!25 = !{!12, !10, i64 32}
!26 = !{!27, !23, i64 0}
!27 = !{!"uint64_t_ll_node", !23, i64 0, !10, i64 8}
!28 = distinct !{!28, !18}
!29 = distinct !{!29, !18}
!30 = !{!31, !10, i64 16}
!31 = !{!"__kstring_t", !23, i64 0, !23, i64 8, !10, i64 16}
!32 = !{!33, !10, i64 0}
!33 = !{!"file_data", !10, i64 0, !6, i64 8, !34, i64 16}
!34 = !{!"double", !7, i64 0}
!35 = !{!36, !23, i64 0}
!36 = !{!"long_ll", !23, i64 0, !10, i64 8, !10, i64 16}
!37 = !{!38, !23, i64 0}
!38 = !{!"long_ll_node", !23, i64 0, !10, i64 8}
!39 = !{!23, !23, i64 0}
!40 = distinct !{!40, !18}
!41 = !{!22, !10, i64 80}
!42 = !{!22, !10, i64 72}
!43 = distinct !{!43, !18}
!44 = distinct !{!44, !18}
!45 = !{!46, !10, i64 48}
!46 = !{!"cache_def", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}


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