; LLVM IR from bjourne/fast_snn_fpga :: src (synapse_index)

; 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.synapse = type { i32, float }
%struct.synapse_index = type { ptr, ptr, i32, i32, i32 }
%struct.var_vector = type { ptr, i64, i64, i64 }

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@__PRETTY_FUNCTION__.synapse_index_frontier_index = external hidden unnamed_addr constant [91 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [30 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @synapse_index_frontier_index(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %struct.synapse, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca [64 x i32], align 16
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca %struct.synapse, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca %struct.synapse, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.synapse_index, ptr %34, i32 0, i32 3
  %36 = load i32, ptr %35, align 4, !tbaa !11
  store i32 %36, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = udiv i32 64, %37
  store i32 %38, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %39 = call ptr @var_vec_init(i64 noundef 4, i64 noundef 8)
  store ptr %39, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = mul i32 %40, %41
  %43 = add i32 %42, 1
  %44 = zext i32 %43 to i64
  store i64 %44, ptr %12, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %45 = load i64, ptr %12, align 8, !tbaa !13
  %46 = call ptr @aligned_calloc(i64 noundef %45, i64 noundef 4)
  store ptr %46, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %47 = load i32, ptr %6, align 4, !tbaa !9
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = sub i32 %47, %48
  store i32 %49, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %50 = load i32, ptr %14, align 4, !tbaa !9
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = call i64 @pack_synapse(i32 noundef 0, i32 noundef %50, float noundef 0.000000e+00, i32 noundef %51)
  store i64 %52, ptr %15, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !9
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = load i32, ptr %16, align 4, !tbaa !9
  %55 = add i32 %54, 1
  store i32 %55, ptr %16, align 4, !tbaa !9
  %56 = zext i32 %54 to i64
  %57 = getelementptr inbounds i32, ptr %53, i64 %56
  store i32 0, ptr %57, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %240, %4
  %59 = load i32, ptr %17, align 4, !tbaa !9
  %60 = load i32, ptr %9, align 4, !tbaa !9
  %61 = icmp ult i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 2, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %243

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %236, %63
  %65 = load i32, ptr %19, align 4, !tbaa !9
  %66 = load i32, ptr %10, align 4, !tbaa !9
  %67 = icmp ult i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 5, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %239

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.var_vector, ptr %70, i32 0, i32 2
  %72 = load i64, ptr %71, align 8, !tbaa !15
  %73 = trunc i64 %72 to i32
  store i32 %73, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 256, ptr %21) #7
  call void @llvm.memset.p0.i64(ptr align 16 %21, i8 0, i64 256, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %74

74:                                               ; preds = %171, %69
  %75 = load i32, ptr %22, align 4, !tbaa !9
  %76 = load i32, ptr %7, align 4, !tbaa !9
  %77 = icmp ult i32 %75, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %74
  store i32 8, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %174

79:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %81 = load i32, ptr %19, align 4, !tbaa !9
  %82 = mul i32 %80, %81
  %83 = load i32, ptr %22, align 4, !tbaa !9
  %84 = add i32 %82, %83
  %85 = add i32 %84, 1
  store i32 %85, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.synapse_index, ptr %86, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !17
  %89 = load i32, ptr %17, align 4, !tbaa !9
  %90 = mul i32 64, %89
  %91 = load i32, ptr %23, align 4, !tbaa !9
  %92 = icmp ugt i32 %91, 63
  br i1 %92, label %93, label %94

93:                                               ; preds = %79
  br label %96

94:                                               ; preds = %79
  %95 = load i32, ptr %23, align 4, !tbaa !9
  br label %96

96:                                               ; preds = %94, %93
  %97 = phi i32 [ 63, %93 ], [ %95, %94 ]
  %98 = add i32 %90, %97
  %99 = zext i32 %98 to i64
  %100 = getelementptr inbounds i32, ptr %88, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !9
  store i32 %101, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.synapse_index, ptr %102, i32 0, i32 1
  %104 = load ptr, ptr %103, align 8, !tbaa !17
  %105 = load i32, ptr %17, align 4, !tbaa !9
  %106 = mul i32 64, %105
  %107 = load i32, ptr %23, align 4, !tbaa !9
  %108 = add i32 %107, 1
  %109 = icmp ugt i32 %108, 63
  br i1 %109, label %110, label %111

110:                                              ; preds = %96
  br label %114

111:                                              ; preds = %96
  %112 = load i32, ptr %23, align 4, !tbaa !9
  %113 = add i32 %112, 1
  br label %114

114:                                              ; preds = %111, %110
  %115 = phi i32 [ 63, %110 ], [ %113, %111 ]
  %116 = add i32 %106, %115
  %117 = zext i32 %116 to i64
  %118 = getelementptr inbounds i32, ptr %104, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !9
  store i32 %119, ptr %25, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  %120 = load i32, ptr %24, align 4, !tbaa !9
  store i32 %120, ptr %26, align 4, !tbaa !9
  br label %121

121:                                              ; preds = %167, %114
  %122 = load i32, ptr %26, align 4, !tbaa !9
  %123 = load i32, ptr %25, align 4, !tbaa !9
  %124 = icmp ult i32 %122, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %121
  store i32 11, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  br label %170

126:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.synapse_index, ptr %127, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8, !tbaa !18
  %130 = load i32, ptr %26, align 4, !tbaa !9
  %131 = zext i32 %130 to i64
  %132 = getelementptr inbounds %struct.synapse, ptr %129, i64 %131
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %132, i64 8, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #7
  %133 = getelementptr inbounds %struct.synapse, ptr %27, i32 0, i32 0
  %134 = load i32, ptr %133, align 4, !tbaa !22
  %135 = load i32, ptr %8, align 4, !tbaa !9
  %136 = urem i32 %134, %135
  store i32 %136, ptr %28, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #7
  %137 = load i32, ptr %20, align 4, !tbaa !9
  %138 = load i32, ptr %8, align 4, !tbaa !9
  %139 = load i32, ptr %28, align 4, !tbaa !9
  %140 = zext i32 %139 to i64
  %141 = getelementptr inbounds [64 x i32], ptr %21, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !9
  %143 = mul i32 %138, %142
  %144 = add i32 %137, %143
  %145 = load i32, ptr %28, align 4, !tbaa !9
  %146 = add i32 %144, %145
  store i32 %146, ptr %29, align 4, !tbaa !9
  %147 = load i32, ptr %23, align 4, !tbaa !9
  %148 = icmp ne i32 %147, 0
  br i1 %148, label %149, label %150

149:                                              ; preds = %126
  br label %151

150:                                              ; preds = %126
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 76, ptr noundef @__PRETTY_FUNCTION__.synapse_index_frontier_index) #8
  unreachable

151:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  %152 = load i32, ptr %23, align 4, !tbaa !9
  %153 = getelementptr inbounds %struct.synapse, ptr %27, i32 0, i32 0
  %154 = load i32, ptr %153, align 4, !tbaa !22
  %155 = getelementptr inbounds %struct.synapse, ptr %27, i32 0, i32 1
  %156 = load float, ptr %155, align 4, !tbaa !24
  %157 = load i32, ptr %8, align 4, !tbaa !9
  %158 = call i64 @pack_synapse(i32 noundef %152, i32 noundef %154, float noundef %156, i32 noundef %157)
  store i64 %158, ptr %30, align 4
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = load i32, ptr %29, align 4, !tbaa !9
  %161 = zext i32 %160 to i64
  call void @var_vec_add_sparse(ptr noundef %159, i64 noundef %161, ptr noundef %30, ptr noundef %15)
  %162 = load i32, ptr %28, align 4, !tbaa !9
  %163 = zext i32 %162 to i64
  %164 = getelementptr inbounds [64 x i32], ptr %21, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !9
  %166 = add i32 %165, 1
  store i32 %166, ptr %164, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %167

167:                                              ; preds = %151
  %168 = load i32, ptr %26, align 4, !tbaa !9
  %169 = add i32 %168, 1
  store i32 %169, ptr %26, align 4, !tbaa !9
  br label %121, !llvm.loop !25

170:                                              ; preds = %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %22, align 4, !tbaa !9
  %173 = add i32 %172, 1
  store i32 %173, ptr %22, align 4, !tbaa !9
  br label %74, !llvm.loop !27

174:                                              ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #7
  %175 = load i32, ptr %8, align 4, !tbaa !9
  %176 = zext i32 %175 to i64
  %177 = load ptr, ptr %11, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.var_vector, ptr %177, i32 0, i32 2
  %179 = load i64, ptr %178, align 8, !tbaa !15
  %180 = load i32, ptr %8, align 4, !tbaa !9
  %181 = zext i32 %180 to i64
  %182 = urem i64 %179, %181
  %183 = sub i64 %176, %182
  %184 = trunc i64 %183 to i32
  store i32 %184, ptr %31, align 4, !tbaa !9
  %185 = load ptr, ptr %11, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.var_vector, ptr %185, i32 0, i32 2
  %187 = load i64, ptr %186, align 8, !tbaa !15
  %188 = load i32, ptr %31, align 4, !tbaa !9
  %189 = load i32, ptr %8, align 4, !tbaa !9
  %190 = icmp eq i32 %188, %189
  br i1 %190, label %191, label %192

191:                                              ; preds = %174
  br label %194

192:                                              ; preds = %174
  %193 = load i32, ptr %31, align 4, !tbaa !9
  br label %194

194:                                              ; preds = %192, %191
  %195 = phi i32 [ 0, %191 ], [ %193, %192 ]
  %196 = zext i32 %195 to i64
  %197 = add i64 %187, %196
  %198 = trunc i64 %197 to i32
  store i32 %198, ptr %31, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #7
  %199 = load ptr, ptr %11, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.var_vector, ptr %199, i32 0, i32 2
  %201 = load i64, ptr %200, align 8, !tbaa !15
  %202 = trunc i64 %201 to i32
  store i32 %202, ptr %32, align 4, !tbaa !9
  br label %203

203:                                              ; preds = %210, %194
  %204 = load i32, ptr %32, align 4, !tbaa !9
  %205 = load i32, ptr %31, align 4, !tbaa !9
  %206 = icmp ult i32 %204, %205
  br i1 %206, label %208, label %207

207:                                              ; preds = %203
  store i32 14, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #7
  br label %213

208:                                              ; preds = %203
  %209 = load ptr, ptr %11, align 8, !tbaa !5
  call void @var_vec_add(ptr noundef %209, ptr noundef %15)
  br label %210

210:                                              ; preds = %208
  %211 = load i32, ptr %32, align 4, !tbaa !9
  %212 = add i32 %211, 1
  store i32 %212, ptr %32, align 4, !tbaa !9
  br label %203, !llvm.loop !28

213:                                              ; preds = %207
  %214 = load ptr, ptr %11, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.var_vector, ptr %214, i32 0, i32 2
  %216 = load i64, ptr %215, align 8, !tbaa !15
  %217 = load i32, ptr %8, align 4, !tbaa !9
  %218 = zext i32 %217 to i64
  %219 = urem i64 %216, %218
  %220 = icmp eq i64 %219, 0
  br i1 %220, label %221, label %222

221:                                              ; preds = %213
  br label %223

222:                                              ; preds = %213
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 88, ptr noundef @__PRETTY_FUNCTION__.synapse_index_frontier_index) #8
  unreachable

223:                                              ; preds = %221
  %224 = load ptr, ptr %11, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.var_vector, ptr %224, i32 0, i32 2
  %226 = load i64, ptr %225, align 8, !tbaa !15
  %227 = load i32, ptr %8, align 4, !tbaa !9
  %228 = zext i32 %227 to i64
  %229 = udiv i64 %226, %228
  %230 = trunc i64 %229 to i32
  %231 = load ptr, ptr %13, align 8, !tbaa !5
  %232 = load i32, ptr %16, align 4, !tbaa !9
  %233 = add i32 %232, 1
  store i32 %233, ptr %16, align 4, !tbaa !9
  %234 = zext i32 %232 to i64
  %235 = getelementptr inbounds i32, ptr %231, i64 %234
  store i32 %230, ptr %235, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #7
  call void @llvm.lifetime.end.p0(i64 256, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %236

236:                                              ; preds = %223
  %237 = load i32, ptr %19, align 4, !tbaa !9
  %238 = add i32 %237, 1
  store i32 %238, ptr %19, align 4, !tbaa !9
  br label %64, !llvm.loop !29

239:                                              ; preds = %68
  br label %240

240:                                              ; preds = %239
  %241 = load i32, ptr %17, align 4, !tbaa !9
  %242 = add i32 %241, 1
  store i32 %242, ptr %17, align 4, !tbaa !9
  br label %58, !llvm.loop !30

243:                                              ; preds = %62
  %244 = load i32, ptr %16, align 4, !tbaa !9
  %245 = load i32, ptr %10, align 4, !tbaa !9
  %246 = load i32, ptr %9, align 4, !tbaa !9
  %247 = mul i32 %245, %246
  %248 = add i32 %247, 1
  %249 = icmp eq i32 %244, %248
  br i1 %249, label %250, label %251

250:                                              ; preds = %243
  br label %252

251:                                              ; preds = %243
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 92, ptr noundef @__PRETTY_FUNCTION__.synapse_index_frontier_index) #8
  unreachable

252:                                              ; preds = %250
  %253 = load ptr, ptr %5, align 8, !tbaa !5
  %254 = load ptr, ptr %11, align 8, !tbaa !5
  %255 = load i32, ptr %7, align 4, !tbaa !9
  %256 = load i64, ptr %12, align 8, !tbaa !13
  %257 = load i32, ptr %8, align 4, !tbaa !9
  call void @print_index_info(ptr noundef %253, ptr noundef %254, i32 noundef %255, i64 noundef %256, i32 noundef %257)
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #7
  %258 = load ptr, ptr %11, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct.var_vector, ptr %258, i32 0, i32 0
  %260 = load ptr, ptr %259, align 8, !tbaa !31
  %261 = load ptr, ptr %13, align 8, !tbaa !5
  %262 = load i32, ptr %10, align 4, !tbaa !9
  %263 = load i32, ptr %9, align 4, !tbaa !9
  %264 = load ptr, ptr %11, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.var_vector, ptr %264, i32 0, i32 2
  %266 = load i64, ptr %265, align 8, !tbaa !15
  %267 = trunc i64 %266 to i32
  %268 = call ptr @synapse_index_init(ptr noundef %260, ptr noundef %261, i32 noundef %262, i32 noundef %263, i32 noundef %267)
  store ptr %268, ptr %33, align 8, !tbaa !5
  %269 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %269) #7
  %270 = load ptr, ptr %33, align 8, !tbaa !5
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  ret ptr %270
}

declare ptr @var_vec_init(i64 noundef, i64 noundef) #3

declare ptr @aligned_calloc(i64 noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i64 @pack_synapse(i32 noundef, i32 noundef, float noundef, i32 noundef) #0

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #6

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

declare void @var_vec_add(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @print_index_info(ptr noundef, ptr noundef, i32 noundef, i64 noundef, i32 noundef) #0

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { "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: write) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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, !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, !10, i64 20}
!12 = !{!"", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !14, i64 16}
!16 = !{!"", !6, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!17 = !{!12, !6, i64 8}
!18 = !{!12, !6, i64 0}
!19 = !{i64 0, i64 4, !9, i64 4, i64 4, !20}
!20 = !{!21, !21, i64 0}
!21 = !{!"float", !7, i64 0}
!22 = !{!23, !10, i64 0}
!23 = !{!"", !10, i64 0, !21, i64 4}
!24 = !{!23, !21, i64 4}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}
!28 = distinct !{!28, !26}
!29 = distinct !{!29, !26}
!30 = distinct !{!30, !26}
!31 = !{!16, !6, i64 0}


; 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.synapse = type { i32, float }

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@__PRETTY_FUNCTION__.synapse_index_frontier_index = external hidden unnamed_addr constant [91 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [30 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @synapse_index_init(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @synapse_index_frontier_index(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = alloca %struct.synapse, align 8
  %6 = alloca [64 x i32], align 16
  %7 = alloca %struct.synapse, align 8
  %8 = getelementptr inbounds i8, ptr %0, i64 20
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = udiv i32 64, %2
  %11 = tail call ptr @var_vec_init(i64 noundef 4, i64 noundef 8) #7
  %12 = mul i32 %10, %9
  %13 = add i32 %12, 1
  %14 = zext i32 %13 to i64
  %15 = tail call ptr @aligned_calloc(i64 noundef %14, i64 noundef 4) #7
  %16 = sub i32 %1, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %17 = tail call i64 @pack_synapse(i32 noundef 0, i32 noundef %16, float noundef 0.000000e+00, i32 noundef %3)
  store i64 %17, ptr %5, align 8
  store i32 0, ptr %15, align 4, !tbaa !11
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %._crit_edge106, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %4
  %.not110 = icmp ugt i32 %2, 64
  %18 = getelementptr inbounds i8, ptr %11, i64 16
  %19 = getelementptr inbounds i8, ptr %0, i64 8
  %20 = zext i32 %3 to i64
  br i1 %.not110, label %._crit_edge106, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %umax = tail call i32 @llvm.umax.i32(i32 %2, i32 1)
  %.pre.pre = load i64, ptr %18, align 8, !tbaa !12
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge103.us
  %.pre = phi i64 [ %38, %._crit_edge103.us ], [ %.pre.pre, %.preheader.us.preheader ]
  %.0105.us = phi i32 [ %44, %._crit_edge103.us ], [ 1, %.preheader.us.preheader ]
  %.083104.us = phi i32 [ %80, %._crit_edge103.us ], [ 0, %.preheader.us.preheader ]
  %21 = shl i32 %.083104.us, 6
  br label %22

22:                                               ; preds = %.preheader.us, %42
  %23 = phi i64 [ %.pre, %.preheader.us ], [ %38, %42 ]
  %.1101.us = phi i32 [ %.0105.us, %.preheader.us ], [ %44, %42 ]
  %.084100.us = phi i32 [ 0, %.preheader.us ], [ %47, %42 ]
  %24 = trunc i64 %23 to i32
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %6) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(256) %6, i8 0, i64 256, i1 false)
  %25 = mul i32 %.084100.us, %2
  br label %50

26:                                               ; preds = %._crit_edge.us
  %27 = load i64, ptr %18, align 8, !tbaa !12
  %28 = urem i64 %27, %20
  %29 = trunc nuw i64 %28 to i32
  %30 = sub i32 %3, %29
  %31 = icmp eq i64 %28, 0
  %32 = zext i32 %30 to i64
  %33 = select i1 %31, i64 0, i64 %32
  %34 = add i64 %33, %27
  %35 = trunc i64 %34 to i32
  %36 = trunc i64 %27 to i32
  %37 = icmp ult i32 %36, %35
  br i1 %37, label %.lr.ph98.us, label %._crit_edge99.us

._crit_edge99.us.loopexit:                        ; preds = %.lr.ph98.us
  %.pre116 = load i64, ptr %18, align 8, !tbaa !12
  br label %._crit_edge99.us

._crit_edge99.us:                                 ; preds = %._crit_edge99.us.loopexit, %26
  %38 = phi i64 [ %.pre116, %._crit_edge99.us.loopexit ], [ %27, %26 ]
  %39 = urem i64 %38, %20
  %40 = udiv i64 %38, %20
  %41 = icmp eq i64 %39, 0
  br i1 %41, label %42, label %.split.us

42:                                               ; preds = %._crit_edge99.us
  %43 = trunc i64 %40 to i32
  %44 = add i32 %.1101.us, 1
  %45 = zext i32 %.1101.us to i64
  %46 = getelementptr inbounds i32, ptr %15, i64 %45
  store i32 %43, ptr %46, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %6) #7
  %47 = add nuw nsw i32 %.084100.us, 1
  %48 = icmp ult i32 %47, %10
  br i1 %48, label %22, label %._crit_edge103.us, !llvm.loop !15

.lr.ph98.us:                                      ; preds = %26, %.lr.ph98.us
  %.08296.us = phi i32 [ %49, %.lr.ph98.us ], [ %36, %26 ]
  call void @var_vec_add(ptr noundef %11, ptr noundef nonnull %5) #7
  %49 = add i32 %.08296.us, 1
  %exitcond114.not = icmp eq i32 %49, %35
  br i1 %exitcond114.not, label %._crit_edge99.us.loopexit, label %.lr.ph98.us, !llvm.loop !17

50:                                               ; preds = %._crit_edge.us, %22
  %.08595.us = phi i32 [ 0, %22 ], [ %66, %._crit_edge.us ]
  %51 = add i32 %.08595.us, %25
  %52 = add i32 %51, 1
  %53 = load ptr, ptr %19, align 8, !tbaa !18
  %54 = call i32 @llvm.umin.i32(i32 %52, i32 63)
  %55 = or disjoint i32 %54, %21
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr %53, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !11
  %59 = add i32 %51, 2
  %60 = call i32 @llvm.umin.i32(i32 %59, i32 63)
  %61 = or disjoint i32 %60, %21
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds i32, ptr %53, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !11
  %65 = icmp ult i32 %58, %64
  br i1 %65, label %.lr.ph.us, label %._crit_edge.us

._crit_edge.us:                                   ; preds = %.lr.ph.split.us, %50
  %66 = add nuw i32 %.08595.us, 1
  %exitcond113.not = icmp eq i32 %66, %umax
  br i1 %exitcond113.not, label %26, label %50, !llvm.loop !19

.lr.ph.split.us:                                  ; preds = %.lr.ph.split.us.preheader, %.lr.ph.split.us
  %indvars.iv = phi i64 [ %79, %.lr.ph.split.us.preheader ], [ %indvars.iv.next, %.lr.ph.split.us ]
  %67 = load ptr, ptr %0, align 8, !tbaa !20
  %68 = getelementptr inbounds %struct.synapse, ptr %67, i64 %indvars.iv
  %.sroa.0.0.copyload.us = load i32, ptr %68, align 4, !tbaa !11
  %69 = urem i32 %.sroa.0.0.copyload.us, %3
  %70 = zext i32 %69 to i64
  %71 = getelementptr inbounds [64 x i32], ptr %6, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %73 = mul i32 %72, %3
  %74 = add i32 %69, %24
  %75 = add i32 %74, %73
  %.sroa.5.0..sroa_idx.us = getelementptr inbounds i8, ptr %68, i64 4
  %.sroa.5.0.copyload.us = load float, ptr %.sroa.5.0..sroa_idx.us, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %76 = call i64 @pack_synapse(i32 noundef %52, i32 noundef %.sroa.0.0.copyload.us, float noundef %.sroa.5.0.copyload.us, i32 noundef %3)
  store i64 %76, ptr %7, align 8
  %77 = zext i32 %75 to i64
  call void @var_vec_add_sparse(ptr noundef %11, i64 noundef %77, ptr noundef nonnull %7, ptr noundef nonnull %5) #7
  %78 = add i32 %72, 1
  store i32 %78, ptr %71, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %64, %lftr.wideiv
  br i1 %exitcond.not, label %._crit_edge.us, label %.lr.ph.split.us, !llvm.loop !23

.lr.ph.us:                                        ; preds = %50
  %.not.us = icmp eq i32 %52, 0
  br i1 %.not.us, label %.split109.us, label %.lr.ph.split.us.preheader

.lr.ph.split.us.preheader:                        ; preds = %.lr.ph.us
  %79 = zext i32 %58 to i64
  br label %.lr.ph.split.us

._crit_edge103.us:                                ; preds = %42
  %80 = add nuw i32 %.083104.us, 1
  %exitcond115.not = icmp eq i32 %80, %9
  br i1 %exitcond115.not, label %._crit_edge106, label %.preheader.us, !llvm.loop !24

._crit_edge106:                                   ; preds = %._crit_edge103.us, %.preheader.lr.ph, %4
  %.0.lcssa = phi i32 [ 1, %4 ], [ 1, %.preheader.lr.ph ], [ %44, %._crit_edge103.us ]
  %81 = icmp eq i32 %.0.lcssa, %13
  br i1 %81, label %83, label %82

.split109.us:                                     ; preds = %.lr.ph.us
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 76, ptr noundef nonnull @__PRETTY_FUNCTION__.synapse_index_frontier_index) #8
  unreachable

.split.us:                                        ; preds = %._crit_edge99.us
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 88, ptr noundef nonnull @__PRETTY_FUNCTION__.synapse_index_frontier_index) #8
  unreachable

82:                                               ; preds = %._crit_edge106
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 92, ptr noundef nonnull @__PRETTY_FUNCTION__.synapse_index_frontier_index) #8
  unreachable

83:                                               ; preds = %._crit_edge106
  call void @print_index_info(ptr noundef %0, ptr noundef %11, i32 noundef %2, i64 noundef %14, i32 noundef %3)
  %84 = load ptr, ptr %11, align 8, !tbaa !25
  %85 = getelementptr inbounds i8, ptr %11, i64 16
  %86 = load i64, ptr %85, align 8, !tbaa !12
  %87 = trunc i64 %86 to i32
  %88 = call ptr @synapse_index_init(ptr noundef %84, ptr noundef nonnull %15, i32 noundef %10, i32 noundef %9, i32 noundef %87)
  call void @free(ptr noundef %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  ret ptr %88
}

declare ptr @var_vec_init(i64 noundef, i64 noundef) local_unnamed_addr #3

declare ptr @aligned_calloc(i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden i64 @pack_synapse(i32 noundef, i32 noundef, float noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

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

declare void @var_vec_add(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @print_index_info(ptr noundef, ptr noundef, i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #6

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 = { 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 #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: write) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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, !10, i64 20}
!6 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!13, !14, i64 16}
!13 = !{!"", !7, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!14 = !{!"long", !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!6, !7, i64 8}
!19 = distinct !{!19, !16}
!20 = !{!6, !7, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"float", !8, i64 0}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16}
!25 = !{!13, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DivRemPairsPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass