; LLVM IR from seppo0010/rlite :: src (page_skiplist)

; 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.rl_data_type = type { ptr, ptr, ptr, ptr }
%struct.rl_skiplist = type { i64, i64, i64, i64 }
%struct.rl_skiplist_node = type { i64, double, i64, i64, [0 x %struct.rl_skiplist_node_level] }
%struct.rl_skiplist_node_level = type { i64, i64 }

@rl_data_type_skiplist_node = external global %struct.rl_data_type, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [61 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 allocsize(0)
declare noalias ptr @malloc(i64 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) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_skiplist_is_balanced(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, 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 i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.rl_skiplist, ptr %14, i32 0, i32 0
  %16 = load i64, ptr %15, align 8, !tbaa !9
  store i64 %16, ptr %5, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 0, ptr %7, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store ptr null, ptr %11, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.rl_skiplist, ptr %17, i32 0, i32 2
  %19 = load i64, ptr %18, align 8, !tbaa !13
  %20 = add nsw i64 %19, 1
  %21 = mul i64 8, %20
  %22 = call noalias ptr @malloc(i64 noundef %21) #6
  store ptr %22, ptr %10, align 8, !tbaa !5
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %26, label %25

25:                                               ; preds = %2
  store i32 4, ptr %6, align 4, !tbaa !14
  br label %286

26:                                               ; preds = %2
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.rl_skiplist, ptr %27, i32 0, i32 2
  %29 = load i64, ptr %28, align 8, !tbaa !13
  %30 = add nsw i64 %29, 1
  %31 = mul i64 8, %30
  %32 = call noalias ptr @malloc(i64 noundef %31) #6
  store ptr %32, ptr %11, align 8, !tbaa !5
  %33 = load ptr, ptr %11, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %36, label %35

35:                                               ; preds = %26
  store i32 4, ptr %6, align 4, !tbaa !14
  br label %286

36:                                               ; preds = %26
  br label %37

37:                                               ; preds = %65, %36
  %38 = load i64, ptr %5, align 8, !tbaa !12
  %39 = icmp sgt i64 %38, 0
  br i1 %39, label %40, label %77

40:                                               ; preds = %37
  %41 = load i64, ptr %7, align 8, !tbaa !12
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.rl_skiplist, ptr %42, i32 0, i32 2
  %44 = load i64, ptr %43, align 8, !tbaa !13
  %45 = add nsw i64 %44, 1
  %46 = icmp sgt i64 %41, %45
  br i1 %46, label %47, label %53

47:                                               ; preds = %40
  %48 = load ptr, ptr @stderr, align 8, !tbaa !5
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.rl_skiplist, ptr %49, i32 0, i32 2
  %51 = load i64, ptr %50, align 8, !tbaa !13
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str, i64 noundef %51) #5
  store i32 6, ptr %6, align 4, !tbaa !14
  br label %286

53:                                               ; preds = %40
  %54 = load i64, ptr %5, align 8, !tbaa !12
  %55 = load ptr, ptr %11, align 8, !tbaa !5
  %56 = load i64, ptr %7, align 8, !tbaa !12
  %57 = getelementptr inbounds i64, ptr %55, i64 %56
  store i64 %54, ptr %57, align 8, !tbaa !12
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = load i64, ptr %5, align 8, !tbaa !12
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = call i32 @rl_read(ptr noundef %58, ptr noundef @rl_data_type_skiplist_node, i64 noundef %59, ptr noundef %60, ptr noundef %8, i32 noundef 1)
  store i32 %61, ptr %6, align 4, !tbaa !14
  %62 = load i32, ptr %6, align 4, !tbaa !14
  %63 = icmp ne i32 2, %62
  br i1 %63, label %64, label %65

64:                                               ; preds = %53
  br label %286

65:                                               ; preds = %53
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %66, ptr %9, align 8, !tbaa !5
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = load i64, ptr %7, align 8, !tbaa !12
  %70 = add nsw i64 %69, 1
  store i64 %70, ptr %7, align 8, !tbaa !12
  %71 = getelementptr inbounds ptr, ptr %68, i64 %69
  store ptr %67, ptr %71, align 8, !tbaa !5
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.rl_skiplist_node, ptr %72, i32 0, i32 4
  %74 = getelementptr inbounds [0 x %struct.rl_skiplist_node_level], ptr %73, i64 0, i64 0
  %75 = getelementptr inbounds %struct.rl_skiplist_node_level, ptr %74, i32 0, i32 0
  %76 = load i64, ptr %75, align 8, !tbaa !16
  store i64 %76, ptr %5, align 8, !tbaa !12
  br label %37, !llvm.loop !18

77:                                               ; preds = %37
  %78 = load i64, ptr %7, align 8, !tbaa !12
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.rl_skiplist, ptr %79, i32 0, i32 2
  %81 = load i64, ptr %80, align 8, !tbaa !13
  %82 = add nsw i64 %81, 1
  %83 = icmp ne i64 %78, %82
  br i1 %83, label %84, label %92

84:                                               ; preds = %77
  %85 = load ptr, ptr @stderr, align 8, !tbaa !5
  %86 = load i64, ptr %7, align 8, !tbaa !12
  %87 = sub nsw i64 %86, 1
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.rl_skiplist, ptr %88, i32 0, i32 2
  %90 = load i64, ptr %89, align 8, !tbaa !13
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef @.str.1, i64 noundef %87, i64 noundef %90) #5
  store i32 6, ptr %6, align 4, !tbaa !14
  br label %286

92:                                               ; preds = %77
  store i64 2, ptr %7, align 8, !tbaa !12
  br label %93

93:                                               ; preds = %176, %92
  %94 = load i64, ptr %7, align 8, !tbaa !12
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.rl_skiplist, ptr %95, i32 0, i32 2
  %97 = load i64, ptr %96, align 8, !tbaa !13
  %98 = icmp slt i64 %94, %97
  br i1 %98, label %99, label %179

99:                                               ; preds = %93
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = load i64, ptr %7, align 8, !tbaa !12
  %102 = sub nsw i64 %101, 1
  %103 = getelementptr inbounds ptr, ptr %100, i64 %102
  %104 = load ptr, ptr %103, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.rl_skiplist_node, ptr %104, i32 0, i32 1
  %106 = load double, ptr %105, align 8, !tbaa !20
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = load i64, ptr %7, align 8, !tbaa !12
  %109 = getelementptr inbounds ptr, ptr %107, i64 %108
  %110 = load ptr, ptr %109, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.rl_skiplist_node, ptr %110, i32 0, i32 1
  %112 = load double, ptr %111, align 8, !tbaa !20
  %113 = fcmp ogt double %106, %112
  br i1 %113, label %114, label %131

114:                                              ; preds = %99
  %115 = load ptr, ptr @stderr, align 8, !tbaa !5
  %116 = load i64, ptr %7, align 8, !tbaa !12
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  %118 = load i64, ptr %7, align 8, !tbaa !12
  %119 = sub nsw i64 %118, 1
  %120 = getelementptr inbounds ptr, ptr %117, i64 %119
  %121 = load ptr, ptr %120, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.rl_skiplist_node, ptr %121, i32 0, i32 1
  %123 = load double, ptr %122, align 8, !tbaa !20
  %124 = load ptr, ptr %10, align 8, !tbaa !5
  %125 = load i64, ptr %7, align 8, !tbaa !12
  %126 = getelementptr inbounds ptr, ptr %124, i64 %125
  %127 = load ptr, ptr %126, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.rl_skiplist_node, ptr %127, i32 0, i32 1
  %129 = load double, ptr %128, align 8, !tbaa !20
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %115, ptr noundef @.str.2, i64 noundef %116, double noundef %123, double noundef %129) #5
  store i32 6, ptr %6, align 4, !tbaa !14
  br label %286

131:                                              ; preds = %99
  %132 = load ptr, ptr %10, align 8, !tbaa !5
  %133 = load i64, ptr %7, align 8, !tbaa !12
  %134 = sub nsw i64 %133, 1
  %135 = getelementptr inbounds ptr, ptr %132, i64 %134
  %136 = load ptr, ptr %135, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.rl_skiplist_node, ptr %136, i32 0, i32 1
  %138 = load double, ptr %137, align 8, !tbaa !20
  %139 = load ptr, ptr %10, align 8, !tbaa !5
  %140 = load i64, ptr %7, align 8, !tbaa !12
  %141 = getelementptr inbounds ptr, ptr %139, i64 %140
  %142 = load ptr, ptr %141, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.rl_skiplist_node, ptr %142, i32 0, i32 1
  %144 = load double, ptr %143, align 8, !tbaa !20
  %145 = fcmp oeq double %138, %144
  br i1 %145, label %146, label %174

146:                                              ; preds = %131
  %147 = load ptr, ptr %3, align 8, !tbaa !5
  %148 = load ptr, ptr %10, align 8, !tbaa !5
  %149 = load i64, ptr %7, align 8, !tbaa !12
  %150 = sub nsw i64 %149, 1
  %151 = getelementptr inbounds ptr, ptr %148, i64 %150
  %152 = load ptr, ptr %151, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.rl_skiplist_node, ptr %152, i32 0, i32 0
  %154 = load i64, ptr %153, align 8, !tbaa !12
  %155 = load ptr, ptr %10, align 8, !tbaa !5
  %156 = load i64, ptr %7, align 8, !tbaa !12
  %157 = getelementptr inbounds ptr, ptr %155, i64 %156
  %158 = load ptr, ptr %157, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.rl_skiplist_node, ptr %158, i32 0, i32 0
  %160 = load i64, ptr %159, align 8, !tbaa !12
  %161 = call i32 @rl_multi_string_cmp(ptr noundef %147, i64 noundef %154, i64 noundef %160, ptr noundef %12)
  store i32 %161, ptr %6, align 4, !tbaa !14
  %162 = load i32, ptr %6, align 4, !tbaa !14
  %163 = icmp ne i32 0, %162
  br i1 %163, label %164, label %165

164:                                              ; preds = %146
  br label %286

165:                                              ; preds = %146
  %166 = load i32, ptr %12, align 4, !tbaa !14
  %167 = icmp sgt i32 %166, 0
  br i1 %167, label %168, label %173

168:                                              ; preds = %165
  %169 = load ptr, ptr @stderr, align 8, !tbaa !5
  %170 = load i64, ptr %7, align 8, !tbaa !12
  %171 = load i32, ptr %12, align 4, !tbaa !14
  %172 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %169, ptr noundef @.str.3, i64 noundef %170, i32 noundef %171) #5
  store i32 6, ptr %6, align 4, !tbaa !14
  br label %286

173:                                              ; preds = %165
  br label %174

174:                                              ; preds = %173, %131
  br label %175

175:                                              ; preds = %174
  br label %176

176:                                              ; preds = %175
  %177 = load i64, ptr %7, align 8, !tbaa !12
  %178 = add nsw i64 %177, 1
  store i64 %178, ptr %7, align 8, !tbaa !12
  br label %93, !llvm.loop !22

179:                                              ; preds = %93
  store i64 2, ptr %7, align 8, !tbaa !12
  br label %180

180:                                              ; preds = %215, %179
  %181 = load i64, ptr %7, align 8, !tbaa !12
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.rl_skiplist, ptr %182, i32 0, i32 2
  %184 = load i64, ptr %183, align 8, !tbaa !13
  %185 = icmp slt i64 %181, %184
  br i1 %185, label %186, label %218

186:                                              ; preds = %180
  %187 = load ptr, ptr %10, align 8, !tbaa !5
  %188 = load i64, ptr %7, align 8, !tbaa !12
  %189 = getelementptr inbounds ptr, ptr %187, i64 %188
  %190 = load ptr, ptr %189, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.rl_skiplist_node, ptr %190, i32 0, i32 2
  %192 = load i64, ptr %191, align 8, !tbaa !12
  %193 = load ptr, ptr %11, align 8, !tbaa !5
  %194 = load i64, ptr %7, align 8, !tbaa !12
  %195 = sub nsw i64 %194, 1
  %196 = getelementptr inbounds i64, ptr %193, i64 %195
  %197 = load i64, ptr %196, align 8, !tbaa !12
  %198 = icmp ne i64 %192, %197
  br i1 %198, label %199, label %214

199:                                              ; preds = %186
  %200 = load ptr, ptr @stderr, align 8, !tbaa !5
  %201 = load i64, ptr %7, align 8, !tbaa !12
  %202 = load ptr, ptr %11, align 8, !tbaa !5
  %203 = load i64, ptr %7, align 8, !tbaa !12
  %204 = sub nsw i64 %203, 1
  %205 = getelementptr inbounds i64, ptr %202, i64 %204
  %206 = load i64, ptr %205, align 8, !tbaa !12
  %207 = load ptr, ptr %10, align 8, !tbaa !5
  %208 = load i64, ptr %7, align 8, !tbaa !12
  %209 = getelementptr inbounds ptr, ptr %207, i64 %208
  %210 = load ptr, ptr %209, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.rl_skiplist_node, ptr %210, i32 0, i32 2
  %212 = load i64, ptr %211, align 8, !tbaa !12
  %213 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %200, ptr noundef @.str.4, i64 noundef %201, i64 noundef %206, i64 noundef %212) #5
  store i32 6, ptr %6, align 4, !tbaa !14
  br label %286

214:                                              ; preds = %186
  br label %215

215:                                              ; preds = %214
  %216 = load i64, ptr %7, align 8, !tbaa !12
  %217 = add nsw i64 %216, 1
  store i64 %217, ptr %7, align 8, !tbaa !12
  br label %180, !llvm.loop !23

218:                                              ; preds = %180
  store i64 1, ptr %7, align 8, !tbaa !12
  br label %219

219:                                              ; preds = %282, %218
  %220 = load i64, ptr %7, align 8, !tbaa !12
  %221 = load ptr, ptr %4, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.rl_skiplist, ptr %221, i32 0, i32 3
  %223 = load i64, ptr %222, align 8, !tbaa !24
  %224 = icmp slt i64 %220, %223
  br i1 %224, label %225, label %285

225:                                              ; preds = %219
  %226 = load ptr, ptr %10, align 8, !tbaa !5
  %227 = getelementptr inbounds ptr, ptr %226, i64 0
  %228 = load ptr, ptr %227, align 8, !tbaa !5
  store ptr %228, ptr %9, align 8, !tbaa !5
  %229 = load ptr, ptr %9, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.rl_skiplist_node, ptr %229, i32 0, i32 4
  %231 = load i64, ptr %7, align 8, !tbaa !12
  %232 = getelementptr inbounds [0 x %struct.rl_skiplist_node_level], ptr %230, i64 0, i64 %231
  %233 = getelementptr inbounds %struct.rl_skiplist_node_level, ptr %232, i32 0, i32 0
  %234 = load i64, ptr %233, align 8, !tbaa !16
  %235 = icmp eq i64 %234, 0
  br i1 %235, label %236, label %240

236:                                              ; preds = %225
  %237 = load ptr, ptr @stderr, align 8, !tbaa !5
  %238 = load i64, ptr %7, align 8, !tbaa !12
  %239 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %237, ptr noundef @.str.5, i64 noundef %238) #5
  store i32 6, ptr %6, align 4, !tbaa !14
  br label %286

240:                                              ; preds = %225
  store i64 0, ptr %13, align 8, !tbaa !12
  br label %241

241:                                              ; preds = %276, %240
  br label %242

242:                                              ; preds = %241
  %243 = load ptr, ptr %9, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.rl_skiplist_node, ptr %243, i32 0, i32 4
  %245 = load i64, ptr %7, align 8, !tbaa !12
  %246 = getelementptr inbounds [0 x %struct.rl_skiplist_node_level], ptr %244, i64 0, i64 %245
  %247 = getelementptr inbounds %struct.rl_skiplist_node_level, ptr %246, i32 0, i32 1
  %248 = load i64, ptr %247, align 8, !tbaa !25
  %249 = load i64, ptr %13, align 8, !tbaa !12
  %250 = add nsw i64 %249, %248
  store i64 %250, ptr %13, align 8, !tbaa !12
  %251 = load ptr, ptr %9, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct.rl_skiplist_node, ptr %251, i32 0, i32 4
  %253 = load i64, ptr %7, align 8, !tbaa !12
  %254 = getelementptr inbounds [0 x %struct.rl_skiplist_node_level], ptr %252, i64 0, i64 %253
  %255 = getelementptr inbounds %struct.rl_skiplist_node_level, ptr %254, i32 0, i32 0
  %256 = load i64, ptr %255, align 8, !tbaa !16
  store i64 %256, ptr %5, align 8, !tbaa !12
  %257 = load i64, ptr %5, align 8, !tbaa !12
  %258 = icmp eq i64 %257, 0
  br i1 %258, label %259, label %260

259:                                              ; preds = %242
  br label %281

260:                                              ; preds = %242
  %261 = load ptr, ptr %11, align 8, !tbaa !5
  %262 = load i64, ptr %13, align 8, !tbaa !12
  %263 = getelementptr inbounds i64, ptr %261, i64 %262
  %264 = load i64, ptr %263, align 8, !tbaa !12
  %265 = load i64, ptr %5, align 8, !tbaa !12
  %266 = icmp ne i64 %264, %265
  br i1 %266, label %267, label %276

267:                                              ; preds = %260
  %268 = load ptr, ptr @stderr, align 8, !tbaa !5
  %269 = load i64, ptr %7, align 8, !tbaa !12
  %270 = load ptr, ptr %11, align 8, !tbaa !5
  %271 = load i64, ptr %13, align 8, !tbaa !12
  %272 = getelementptr inbounds i64, ptr %270, i64 %271
  %273 = load i64, ptr %272, align 8, !tbaa !12
  %274 = load i64, ptr %5, align 8, !tbaa !12
  %275 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %268, ptr noundef @.str.6, i64 noundef %269, i64 noundef %273, i64 noundef %274) #5
  store i32 6, ptr %6, align 4, !tbaa !14
  br label %286

276:                                              ; preds = %260
  %277 = load ptr, ptr %10, align 8, !tbaa !5
  %278 = load i64, ptr %13, align 8, !tbaa !12
  %279 = getelementptr inbounds ptr, ptr %277, i64 %278
  %280 = load ptr, ptr %279, align 8, !tbaa !5
  store ptr %280, ptr %9, align 8, !tbaa !5
  br label %241

281:                                              ; preds = %259
  br label %282

282:                                              ; preds = %281
  %283 = load i64, ptr %7, align 8, !tbaa !12
  %284 = add nsw i64 %283, 1
  store i64 %284, ptr %7, align 8, !tbaa !12
  br label %219, !llvm.loop !26

285:                                              ; preds = %219
  store i32 0, ptr %6, align 4, !tbaa !14
  br label %286

286:                                              ; preds = %285, %267, %236, %199, %168, %164, %114, %84, %64, %47, %35, %25
  %287 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %287) #5
  %288 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %288) #5
  %289 = load i32, ptr %6, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret i32 %289
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!11 = !{!"long", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 16}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !11, i64 0}
!17 = !{!"rl_skiplist_node_level", !11, i64 0, !11, i64 8}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !21, i64 0}
!21 = !{!"double", !7, i64 0}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !19}
!24 = !{!10, !11, i64 24}
!25 = !{!17, !11, i64 8}
!26 = distinct !{!26, !19}


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

@rl_data_type_skiplist_node = external global %struct.rl_data_type, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [61 x i8], align 1

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_skiplist_is_balanced(ptr noundef %0, ptr noundef %1) local_unnamed_addr #4 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = load i64, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = load i64, ptr %6, align 8, !tbaa !10
  %8 = shl i64 %7, 3
  %9 = add i64 %8, 8
  %10 = tail call noalias ptr @malloc(i64 noundef %9) #7
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %.loopexit, label %11

11:                                               ; preds = %2
  %12 = tail call noalias ptr @malloc(i64 noundef %9) #7
  %.not101 = icmp eq ptr %12, null
  br i1 %.not101, label %.loopexit, label %.preheader111

.preheader111:                                    ; preds = %11
  %13 = icmp sgt i64 %5, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader111, %23
  %.084141 = phi i64 [ %28, %23 ], [ %5, %.preheader111 ]
  %.086140 = phi i64 [ %25, %23 ], [ 0, %.preheader111 ]
  %14 = load i64, ptr %6, align 8, !tbaa !10
  %15 = add nsw i64 %14, 1
  %16 = icmp sgt i64 %.086140, %15
  br i1 %16, label %17, label %20

17:                                               ; preds = %.lr.ph
  %18 = load ptr, ptr @stderr, align 8, !tbaa !11
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str, i64 noundef %14) #8
  br label %.loopexit

20:                                               ; preds = %.lr.ph
  %21 = getelementptr inbounds i64, ptr %12, i64 %.086140
  store i64 %.084141, ptr %21, align 8, !tbaa !13
  %22 = call i32 @rl_read(ptr noundef %0, ptr noundef nonnull @rl_data_type_skiplist_node, i64 noundef %.084141, ptr noundef nonnull %1, ptr noundef nonnull %3, i32 noundef 1) #6
  %.not106 = icmp eq i32 %22, 2
  br i1 %.not106, label %23, label %.loopexit

23:                                               ; preds = %20
  %24 = load ptr, ptr %3, align 8, !tbaa !11
  %25 = add nuw nsw i64 %.086140, 1
  %26 = getelementptr inbounds ptr, ptr %10, i64 %.086140
  store ptr %24, ptr %26, align 8, !tbaa !11
  %27 = getelementptr inbounds i8, ptr %24, i64 32
  %28 = load i64, ptr %27, align 8, !tbaa !14
  %29 = icmp sgt i64 %28, 0
  br i1 %29, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !16

._crit_edge.loopexit:                             ; preds = %23
  %.pre = load i64, ptr %6, align 8, !tbaa !10
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader111
  %30 = phi i64 [ %7, %.preheader111 ], [ %.pre, %._crit_edge.loopexit ]
  %.086.lcssa = phi i64 [ 0, %.preheader111 ], [ %25, %._crit_edge.loopexit ]
  %31 = add nsw i64 %30, 1
  %.not102 = icmp eq i64 %.086.lcssa, %31
  br i1 %.not102, label %.preheader109, label %33

.preheader109:                                    ; preds = %._crit_edge
  %32 = icmp sgt i64 %30, 2
  br i1 %32, label %.lr.ph143, label %.preheader107

33:                                               ; preds = %._crit_edge
  %34 = load ptr, ptr @stderr, align 8, !tbaa !11
  %35 = add nsw i64 %.086.lcssa, -1
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.1, i64 noundef %35, i64 noundef %30) #8
  br label %.loopexit

.preheader108:                                    ; preds = %63
  %invariant.gep = getelementptr i8, ptr %12, i64 -8
  %37 = icmp sgt i64 %64, 2
  br i1 %37, label %.lr.ph146, label %.preheader107

.lr.ph143:                                        ; preds = %.preheader109, %63
  %38 = phi i64 [ %64, %63 ], [ %30, %.preheader109 ]
  %.1142 = phi i64 [ %65, %63 ], [ 2, %.preheader109 ]
  %39 = getelementptr ptr, ptr %10, i64 %.1142
  %40 = getelementptr i8, ptr %39, i64 -8
  %41 = load ptr, ptr %40, align 8, !tbaa !11
  %42 = getelementptr inbounds i8, ptr %41, i64 8
  %43 = load double, ptr %42, align 8, !tbaa !18
  %44 = load ptr, ptr %39, align 8, !tbaa !11
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  %46 = load double, ptr %45, align 8, !tbaa !18
  %47 = fcmp ogt double %43, %46
  br i1 %47, label %48, label %51

48:                                               ; preds = %.lr.ph143
  %49 = load ptr, ptr @stderr, align 8, !tbaa !11
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef nonnull @.str.2, i64 noundef %.1142, double noundef %43, double noundef %46) #8
  br label %.loopexit

51:                                               ; preds = %.lr.ph143
  %52 = fcmp oeq double %43, %46
  br i1 %52, label %53, label %63

53:                                               ; preds = %51
  %54 = load i64, ptr %41, align 8, !tbaa !13
  %55 = load i64, ptr %44, align 8, !tbaa !13
  %56 = call i32 @rl_multi_string_cmp(ptr noundef %0, i64 noundef %54, i64 noundef %55, ptr noundef nonnull %4) #6
  %.not105 = icmp eq i32 %56, 0
  br i1 %.not105, label %57, label %.loopexit

57:                                               ; preds = %53
  %58 = load i32, ptr %4, align 4, !tbaa !20
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %60, label %._crit_edge185

._crit_edge185:                                   ; preds = %57
  %.pre186 = load i64, ptr %6, align 8, !tbaa !10
  br label %63

60:                                               ; preds = %57
  %61 = load ptr, ptr @stderr, align 8, !tbaa !11
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef nonnull @.str.3, i64 noundef %.1142, i32 noundef %58) #8
  br label %.loopexit

63:                                               ; preds = %._crit_edge185, %51
  %64 = phi i64 [ %.pre186, %._crit_edge185 ], [ %38, %51 ]
  %65 = add nuw nsw i64 %.1142, 1
  %66 = icmp slt i64 %65, %64
  br i1 %66, label %.lr.ph143, label %.preheader108, !llvm.loop !22

.preheader107:                                    ; preds = %80, %.preheader109, %.preheader108
  %67 = getelementptr inbounds i8, ptr %1, i64 24
  %68 = load i64, ptr %67, align 8, !tbaa !23
  %69 = icmp sgt i64 %68, 1
  br i1 %69, label %.lr.ph150, label %.loopexit

.lr.ph150:                                        ; preds = %.preheader107
  %70 = load ptr, ptr %10, align 8, !tbaa !11
  %71 = getelementptr inbounds i8, ptr %70, i64 32
  br label %82

.lr.ph146:                                        ; preds = %.preheader108, %80
  %.2145 = phi i64 [ %81, %80 ], [ 2, %.preheader108 ]
  %72 = getelementptr inbounds ptr, ptr %10, i64 %.2145
  %73 = load ptr, ptr %72, align 8, !tbaa !11
  %74 = getelementptr inbounds i8, ptr %73, i64 16
  %75 = load i64, ptr %74, align 8, !tbaa !13
  %gep = getelementptr i64, ptr %invariant.gep, i64 %.2145
  %76 = load i64, ptr %gep, align 8, !tbaa !13
  %.not104 = icmp eq i64 %75, %76
  br i1 %.not104, label %80, label %77

77:                                               ; preds = %.lr.ph146
  %78 = load ptr, ptr @stderr, align 8, !tbaa !11
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef nonnull @.str.4, i64 noundef %.2145, i64 noundef %76, i64 noundef %75) #8
  br label %.loopexit

80:                                               ; preds = %.lr.ph146
  %81 = add nuw nsw i64 %.2145, 1
  %exitcond.not = icmp eq i64 %81, %64
  br i1 %exitcond.not, label %.preheader107, label %.lr.ph146, !llvm.loop !24

82:                                               ; preds = %.lr.ph150, %._crit_edge148
  %.3149 = phi i64 [ 1, %.lr.ph150 ], [ %108, %._crit_edge148 ]
  %83 = getelementptr inbounds [0 x %struct.rl_skiplist_node_level], ptr %71, i64 0, i64 %.3149
  %84 = load i64, ptr %83, align 8, !tbaa !14
  %85 = icmp eq i64 %84, 0
  br i1 %85, label %88, label %.lr.ph147.preheader

.lr.ph147.preheader:                              ; preds = %82
  %86 = getelementptr inbounds i8, ptr %83, i64 8
  %87 = load i64, ptr %86, align 8, !tbaa !25
  br label %.lr.ph147

88:                                               ; preds = %82
  %89 = load ptr, ptr @stderr, align 8, !tbaa !11
  %90 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef nonnull @.str.5, i64 noundef %.3149) #8
  br label %.loopexit

.lr.ph147:                                        ; preds = %.lr.ph147.preheader, %98
  %91 = phi i64 [ %106, %98 ], [ %84, %.lr.ph147.preheader ]
  %92 = phi i64 [ %105, %98 ], [ %87, %.lr.ph147.preheader ]
  %93 = getelementptr inbounds i64, ptr %12, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !13
  %.not103 = icmp eq i64 %94, %91
  br i1 %.not103, label %98, label %95

95:                                               ; preds = %.lr.ph147
  %96 = load ptr, ptr @stderr, align 8, !tbaa !11
  %97 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef nonnull @.str.6, i64 noundef %.3149, i64 noundef %94, i64 noundef %91) #8
  br label %.loopexit

98:                                               ; preds = %.lr.ph147
  %99 = getelementptr inbounds ptr, ptr %10, i64 %92
  %100 = load ptr, ptr %99, align 8, !tbaa !11
  %101 = getelementptr inbounds i8, ptr %100, i64 32
  %102 = getelementptr inbounds [0 x %struct.rl_skiplist_node_level], ptr %101, i64 0, i64 %.3149
  %103 = getelementptr inbounds i8, ptr %102, i64 8
  %104 = load i64, ptr %103, align 8, !tbaa !25
  %105 = add nsw i64 %104, %92
  %106 = load i64, ptr %102, align 8, !tbaa !14
  %107 = icmp eq i64 %106, 0
  br i1 %107, label %._crit_edge148, label %.lr.ph147

._crit_edge148:                                   ; preds = %98
  %108 = add nuw nsw i64 %.3149, 1
  %exitcond184.not = icmp eq i64 %108, %68
  br i1 %exitcond184.not, label %.loopexit, label %82, !llvm.loop !26

.loopexit:                                        ; preds = %20, %53, %._crit_edge148, %.preheader107, %11, %2, %95, %88, %77, %60, %48, %33, %17
  %.087 = phi i32 [ 6, %17 ], [ 6, %33 ], [ 6, %48 ], [ 6, %60 ], [ 6, %77 ], [ 6, %88 ], [ 6, %95 ], [ 4, %2 ], [ 4, %11 ], [ 0, %.preheader107 ], [ 0, %._crit_edge148 ], [ %56, %53 ], [ %22, %20 ]
  %.083 = phi ptr [ %12, %17 ], [ %12, %33 ], [ %12, %48 ], [ %12, %60 ], [ %12, %77 ], [ %12, %88 ], [ %12, %95 ], [ null, %2 ], [ null, %11 ], [ %12, %.preheader107 ], [ %12, %._crit_edge148 ], [ %12, %53 ], [ %12, %20 ]
  call void @free(ptr noundef %.083) #6
  call void @free(ptr noundef %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  ret i32 %.087
}

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { cold nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 16}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !7, i64 0}
!15 = !{!"rl_skiplist_node_level", !7, i64 0, !7, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !19, i64 0}
!19 = !{!"double", !8, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !8, i64 0}
!22 = distinct !{!22, !17}
!23 = !{!6, !7, i64 24}
!24 = distinct !{!24, !17}
!25 = !{!15, !7, i64 8}
!26 = distinct !{!26, !17}


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