; LLVM IR from wichue/nethello :: depend/kcp (ikcp)

; 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.IKCPCB = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.IQUEUEHEAD, %struct.IQUEUEHEAD, %struct.IQUEUEHEAD, %struct.IQUEUEHEAD, ptr, i32, i32, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr }
%struct.IQUEUEHEAD = type { ptr, ptr }
%struct.IKCPSEG = type { %struct.IQUEUEHEAD, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [1 x i8] }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [67 x i8], align 1
@__PRETTY_FUNCTION__.ikcp_recv = external hidden unnamed_addr constant [37 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @ikcp_log(ptr noundef, i32 noundef, ptr 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ikcp_recv(ptr noundef %0, ptr noundef %1, i32 noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %15 = load i32, ptr %7, align 4, !tbaa !9
  %16 = icmp slt i32 %15, 0
  %17 = zext i1 %16 to i64
  %18 = select i1 %16, i32 1, i32 0
  store i32 %18, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %3
  br label %23

22:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 365, ptr noundef @__PRETTY_FUNCTION__.ikcp_recv) #5
  unreachable

23:                                               ; preds = %21
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.IKCPCB, ptr %24, i32 0, i32 34
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.IKCPCB, ptr %26, i32 0, i32 34
  %28 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  %30 = icmp eq ptr %25, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %23
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %269

32:                                               ; preds = %23
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = icmp slt i32 %33, 0
  br i1 %34, label %35, label %38

35:                                               ; preds = %32
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = sub nsw i32 0, %36
  store i32 %37, ptr %7, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %35, %32
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = call i32 @ikcp_peeksize(ptr noundef %39)
  store i32 %40, ptr %10, align 4, !tbaa !9
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = icmp slt i32 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %38
  store i32 -2, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %269

44:                                               ; preds = %38
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = icmp sgt i32 %45, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %44
  store i32 -3, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %269

49:                                               ; preds = %44
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.IKCPCB, ptr %50, i32 0, i32 25
  %52 = load i32, ptr %51, align 4, !tbaa !14
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.IKCPCB, ptr %53, i32 0, i32 15
  %55 = load i32, ptr %54, align 4, !tbaa !15
  %56 = icmp uge i32 %52, %55
  br i1 %56, label %57, label %58

57:                                               ; preds = %49
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %57, %49
  store i32 0, ptr %7, align 4, !tbaa !9
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.IKCPCB, ptr %59, i32 0, i32 34
  %61 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !11
  store ptr %62, ptr %8, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %150, %58
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.IKCPCB, ptr %65, i32 0, i32 34
  %67 = icmp ne ptr %64, %66
  br i1 %67, label %68, label %151

68:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %69, i64 0
  store ptr %70, ptr %12, align 8, !tbaa !5
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !16
  store ptr %73, ptr %8, align 8, !tbaa !5
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %91

76:                                               ; preds = %68
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.IKCPSEG, ptr %78, i32 0, i32 13
  %80 = getelementptr inbounds [1 x i8], ptr %79, i64 0, i64 0
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.IKCPSEG, ptr %81, i32 0, i32 8
  %83 = load i32, ptr %82, align 4, !tbaa !17
  %84 = zext i32 %83 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %77, ptr align 8 %80, i64 %84, i1 false)
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.IKCPSEG, ptr %85, i32 0, i32 8
  %87 = load i32, ptr %86, align 4, !tbaa !17
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = zext i32 %87 to i64
  %90 = getelementptr inbounds i8, ptr %88, i64 %89
  store ptr %90, ptr %6, align 8, !tbaa !5
  br label %91

91:                                               ; preds = %76, %68
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.IKCPSEG, ptr %92, i32 0, i32 8
  %94 = load i32, ptr %93, align 4, !tbaa !17
  %95 = load i32, ptr %7, align 4, !tbaa !9
  %96 = add i32 %95, %94
  store i32 %96, ptr %7, align 4, !tbaa !9
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.IKCPSEG, ptr %97, i32 0, i32 3
  %99 = load i32, ptr %98, align 8, !tbaa !19
  store i32 %99, ptr %14, align 4, !tbaa !9
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = call i32 @ikcp_canlog(ptr noundef %100, i32 noundef 8)
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %109

103:                                              ; preds = %91
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = load ptr, ptr %12, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.IKCPSEG, ptr %105, i32 0, i32 6
  %107 = load i32, ptr %106, align 4, !tbaa !20
  %108 = zext i32 %107 to i64
  call void (ptr, i32, ptr, ...) @ikcp_log(ptr noundef %104, i32 noundef 8, ptr noundef @.str.2, i64 noundef %108)
  br label %109

109:                                              ; preds = %103, %91
  %110 = load i32, ptr %9, align 4, !tbaa !9
  %111 = icmp eq i32 %110, 0
  br i1 %111, label %112, label %143

112:                                              ; preds = %109
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.IKCPSEG, ptr %113, i32 0, i32 0
  %115 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %114, i32 0, i32 1
  %116 = load ptr, ptr %115, align 8, !tbaa !21
  %117 = load ptr, ptr %12, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.IKCPSEG, ptr %117, i32 0, i32 0
  %119 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %118, i32 0, i32 0
  %120 = load ptr, ptr %119, align 8, !tbaa !22
  %121 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %120, i32 0, i32 1
  store ptr %116, ptr %121, align 8, !tbaa !23
  %122 = load ptr, ptr %12, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.IKCPSEG, ptr %122, i32 0, i32 0
  %124 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %123, i32 0, i32 0
  %125 = load ptr, ptr %124, align 8, !tbaa !22
  %126 = load ptr, ptr %12, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.IKCPSEG, ptr %126, i32 0, i32 0
  %128 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %127, i32 0, i32 1
  %129 = load ptr, ptr %128, align 8, !tbaa !21
  %130 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %129, i32 0, i32 0
  store ptr %125, ptr %130, align 8, !tbaa !16
  %131 = load ptr, ptr %12, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.IKCPSEG, ptr %131, i32 0, i32 0
  %133 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %132, i32 0, i32 0
  store ptr null, ptr %133, align 8, !tbaa !22
  %134 = load ptr, ptr %12, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.IKCPSEG, ptr %134, i32 0, i32 0
  %136 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %135, i32 0, i32 1
  store ptr null, ptr %136, align 8, !tbaa !21
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ikcp_segment_delete(ptr noundef %137, ptr noundef %138)
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.IKCPCB, ptr %139, i32 0, i32 25
  %141 = load i32, ptr %140, align 4, !tbaa !14
  %142 = add i32 %141, -1
  store i32 %142, ptr %140, align 4, !tbaa !14
  br label %143

143:                                              ; preds = %112, %109
  %144 = load i32, ptr %14, align 4, !tbaa !9
  %145 = icmp eq i32 %144, 0
  br i1 %145, label %146, label %147

146:                                              ; preds = %143
  store i32 2, ptr %13, align 4
  br label %148

147:                                              ; preds = %143
  store i32 0, ptr %13, align 4
  br label %148

148:                                              ; preds = %147, %146
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %149 = load i32, ptr %13, align 4
  switch i32 %149, label %271 [
    i32 0, label %150
    i32 2, label %151
  ]

150:                                              ; preds = %148
  br label %63, !llvm.loop !24

151:                                              ; preds = %148, %63
  %152 = load i32, ptr %7, align 4, !tbaa !9
  %153 = load i32, ptr %10, align 4, !tbaa !9
  %154 = icmp eq i32 %152, %153
  br i1 %154, label %155, label %156

155:                                              ; preds = %151
  br label %157

156:                                              ; preds = %151
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 411, ptr noundef @__PRETTY_FUNCTION__.ikcp_recv) #5
  unreachable

157:                                              ; preds = %155
  br label %158

158:                                              ; preds = %250, %157
  %159 = load ptr, ptr %5, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.IKCPCB, ptr %159, i32 0, i32 36
  %161 = load ptr, ptr %5, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.IKCPCB, ptr %161, i32 0, i32 36
  %163 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %162, i32 0, i32 0
  %164 = load ptr, ptr %163, align 8, !tbaa !26
  %165 = icmp eq ptr %160, %164
  %166 = xor i1 %165, true
  br i1 %166, label %167, label %251

167:                                              ; preds = %158
  %168 = load ptr, ptr %5, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.IKCPCB, ptr %168, i32 0, i32 36
  %170 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %169, i32 0, i32 0
  %171 = load ptr, ptr %170, align 8, !tbaa !26
  %172 = getelementptr inbounds i8, ptr %171, i64 0
  store ptr %172, ptr %12, align 8, !tbaa !5
  %173 = load ptr, ptr %12, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.IKCPSEG, ptr %173, i32 0, i32 6
  %175 = load i32, ptr %174, align 4, !tbaa !20
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.IKCPCB, ptr %176, i32 0, i32 6
  %178 = load i32, ptr %177, align 8, !tbaa !27
  %179 = icmp eq i32 %175, %178
  br i1 %179, label %180, label %249

180:                                              ; preds = %167
  %181 = load ptr, ptr %5, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.IKCPCB, ptr %181, i32 0, i32 25
  %183 = load i32, ptr %182, align 4, !tbaa !14
  %184 = load ptr, ptr %5, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.IKCPCB, ptr %184, i32 0, i32 15
  %186 = load i32, ptr %185, align 4, !tbaa !15
  %187 = icmp ult i32 %183, %186
  br i1 %187, label %188, label %249

188:                                              ; preds = %180
  %189 = load ptr, ptr %12, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.IKCPSEG, ptr %189, i32 0, i32 0
  %191 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %190, i32 0, i32 1
  %192 = load ptr, ptr %191, align 8, !tbaa !21
  %193 = load ptr, ptr %12, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.IKCPSEG, ptr %193, i32 0, i32 0
  %195 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %194, i32 0, i32 0
  %196 = load ptr, ptr %195, align 8, !tbaa !22
  %197 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %196, i32 0, i32 1
  store ptr %192, ptr %197, align 8, !tbaa !23
  %198 = load ptr, ptr %12, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.IKCPSEG, ptr %198, i32 0, i32 0
  %200 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %199, i32 0, i32 0
  %201 = load ptr, ptr %200, align 8, !tbaa !22
  %202 = load ptr, ptr %12, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.IKCPSEG, ptr %202, i32 0, i32 0
  %204 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %203, i32 0, i32 1
  %205 = load ptr, ptr %204, align 8, !tbaa !21
  %206 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %205, i32 0, i32 0
  store ptr %201, ptr %206, align 8, !tbaa !16
  %207 = load ptr, ptr %12, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.IKCPSEG, ptr %207, i32 0, i32 0
  %209 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %208, i32 0, i32 0
  store ptr null, ptr %209, align 8, !tbaa !22
  %210 = load ptr, ptr %12, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.IKCPSEG, ptr %210, i32 0, i32 0
  %212 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %211, i32 0, i32 1
  store ptr null, ptr %212, align 8, !tbaa !21
  %213 = load ptr, ptr %5, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.IKCPCB, ptr %213, i32 0, i32 23
  %215 = load i32, ptr %214, align 4, !tbaa !28
  %216 = add i32 %215, -1
  store i32 %216, ptr %214, align 4, !tbaa !28
  %217 = load ptr, ptr %5, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.IKCPCB, ptr %217, i32 0, i32 34
  %219 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %218, i32 0, i32 1
  %220 = load ptr, ptr %219, align 8, !tbaa !29
  %221 = load ptr, ptr %12, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.IKCPSEG, ptr %221, i32 0, i32 0
  %223 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %222, i32 0, i32 1
  store ptr %220, ptr %223, align 8, !tbaa !21
  %224 = load ptr, ptr %5, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.IKCPCB, ptr %224, i32 0, i32 34
  %226 = load ptr, ptr %12, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.IKCPSEG, ptr %226, i32 0, i32 0
  %228 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %227, i32 0, i32 0
  store ptr %225, ptr %228, align 8, !tbaa !22
  %229 = load ptr, ptr %12, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.IKCPSEG, ptr %229, i32 0, i32 0
  %231 = load ptr, ptr %5, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.IKCPCB, ptr %231, i32 0, i32 34
  %233 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %232, i32 0, i32 1
  %234 = load ptr, ptr %233, align 8, !tbaa !29
  %235 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %234, i32 0, i32 0
  store ptr %230, ptr %235, align 8, !tbaa !16
  %236 = load ptr, ptr %12, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.IKCPSEG, ptr %236, i32 0, i32 0
  %238 = load ptr, ptr %5, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.IKCPCB, ptr %238, i32 0, i32 34
  %240 = getelementptr inbounds %struct.IQUEUEHEAD, ptr %239, i32 0, i32 1
  store ptr %237, ptr %240, align 8, !tbaa !29
  %241 = load ptr, ptr %5, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.IKCPCB, ptr %241, i32 0, i32 25
  %243 = load i32, ptr %242, align 4, !tbaa !14
  %244 = add i32 %243, 1
  store i32 %244, ptr %242, align 4, !tbaa !14
  %245 = load ptr, ptr %5, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.IKCPCB, ptr %245, i32 0, i32 6
  %247 = load i32, ptr %246, align 8, !tbaa !27
  %248 = add i32 %247, 1
  store i32 %248, ptr %246, align 8, !tbaa !27
  br label %250

249:                                              ; preds = %180, %167
  br label %251

250:                                              ; preds = %188
  br label %158, !llvm.loop !30

251:                                              ; preds = %249, %158
  %252 = load ptr, ptr %5, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.IKCPCB, ptr %252, i32 0, i32 25
  %254 = load i32, ptr %253, align 4, !tbaa !14
  %255 = load ptr, ptr %5, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.IKCPCB, ptr %255, i32 0, i32 15
  %257 = load i32, ptr %256, align 4, !tbaa !15
  %258 = icmp ult i32 %254, %257
  br i1 %258, label %259, label %267

259:                                              ; preds = %251
  %260 = load i32, ptr %11, align 4, !tbaa !9
  %261 = icmp ne i32 %260, 0
  br i1 %261, label %262, label %267

262:                                              ; preds = %259
  %263 = load ptr, ptr %5, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct.IKCPCB, ptr %263, i32 0, i32 18
  %265 = load i32, ptr %264, align 8, !tbaa !31
  %266 = or i32 %265, 2
  store i32 %266, ptr %264, align 8, !tbaa !31
  br label %267

267:                                              ; preds = %262, %259, %251
  %268 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %268, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %269

269:                                              ; preds = %267, %48, %43, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %270 = load i32, ptr %4, align 4
  ret i32 %270

271:                                              ; preds = %148
  unreachable
}

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

; 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) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @ikcp_canlog(ptr 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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind }
attributes #5 = { 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, !6, i64 152}
!12 = !{!"IKCPCB", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !13, i64 136, !13, i64 152, !13, i64 168, !13, i64 184, !6, i64 200, !10, i64 208, !10, i64 212, !6, i64 216, !6, i64 224, !10, i64 232, !10, i64 236, !10, i64 240, !10, i64 244, !10, i64 248, !6, i64 256, !6, i64 264}
!13 = !{!"IQUEUEHEAD", !6, i64 0, !6, i64 8}
!14 = !{!12, !10, i64 100}
!15 = !{!12, !10, i64 60}
!16 = !{!13, !6, i64 0}
!17 = !{!18, !10, i64 44}
!18 = !{!"IKCPSEG", !13, i64 0, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !7, i64 64}
!19 = !{!18, !10, i64 24}
!20 = !{!18, !10, i64 36}
!21 = !{!18, !6, i64 8}
!22 = !{!18, !6, i64 0}
!23 = !{!13, !6, i64 8}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!12, !6, i64 184}
!27 = !{!12, !10, i64 24}
!28 = !{!12, !10, i64 92}
!29 = !{!12, !6, i64 160}
!30 = distinct !{!30, !25}
!31 = !{!12, !10, i64 72}


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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [67 x i8], align 1
@__PRETTY_FUNCTION__.ikcp_recv = external hidden unnamed_addr constant [37 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @ikcp_log(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ikcp_recv(ptr noundef %0, ptr noundef writeonly %1, i32 noundef %2) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 365, ptr noundef nonnull @__PRETTY_FUNCTION__.ikcp_recv) #5
  unreachable

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 152
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = icmp eq ptr %6, %7
  br i1 %8, label %106, label %9

9:                                                ; preds = %5
  %10 = tail call i32 @ikcp_peeksize(ptr noundef nonnull %0)
  %11 = icmp slt i32 %10, 0
  br i1 %11, label %106, label %12

12:                                               ; preds = %9
  %spec.select = tail call i32 @llvm.abs.i32(i32 %2, i1 true)
  %13 = icmp ugt i32 %10, %spec.select
  br i1 %13, label %106, label %14

14:                                               ; preds = %12
  %15 = getelementptr inbounds i8, ptr %0, i64 100
  %16 = load i32, ptr %15, align 4, !tbaa !12
  %17 = getelementptr inbounds i8, ptr %0, i64 60
  %18 = load i32, ptr %17, align 4, !tbaa !13
  %.not84 = icmp uge i32 %16, %18
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = icmp sgt i32 %2, -1
  br i1 %20, label %.split.us, label %.split

.split.us:                                        ; preds = %14, %41
  %.078.us = phi ptr [ %22, %41 ], [ %19, %14 ]
  %.177.us = phi i32 [ %33, %41 ], [ 0, %14 ]
  %.075.us = phi ptr [ %.1.us, %41 ], [ %1, %14 ]
  %.not85.us = icmp eq ptr %.078.us, %6
  br i1 %.not85.us, label %.split90.us, label %21

21:                                               ; preds = %.split.us
  %22 = load ptr, ptr %.078.us, align 8, !tbaa !14
  %.not86.us = icmp eq ptr %.075.us, null
  br i1 %.not86.us, label %._crit_edge97, label %23

._crit_edge97:                                    ; preds = %21
  %.phi.trans.insert98 = getelementptr inbounds i8, ptr %.078.us, i64 44
  %.pre99 = load i32, ptr %.phi.trans.insert98, align 4, !tbaa !15
  br label %31

23:                                               ; preds = %21
  %24 = getelementptr inbounds i8, ptr %.078.us, i64 64
  %25 = getelementptr inbounds i8, ptr %.078.us, i64 44
  %26 = load i32, ptr %25, align 4, !tbaa !15
  %27 = zext i32 %26 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %.075.us, ptr nonnull align 8 %24, i64 %27, i1 false)
  %28 = load i32, ptr %25, align 4, !tbaa !15
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds i8, ptr %.075.us, i64 %29
  br label %31

31:                                               ; preds = %._crit_edge97, %23
  %32 = phi i32 [ %28, %23 ], [ %.pre99, %._crit_edge97 ]
  %.1.us = phi ptr [ %30, %23 ], [ null, %._crit_edge97 ]
  %33 = add i32 %32, %.177.us
  %34 = getelementptr inbounds i8, ptr %.078.us, i64 24
  %35 = load i32, ptr %34, align 8, !tbaa !17
  %36 = tail call i32 @ikcp_canlog(ptr noundef nonnull %0, i32 noundef 8)
  %.not87.us = icmp eq i32 %36, 0
  br i1 %.not87.us, label %41, label %37

37:                                               ; preds = %31
  %38 = getelementptr inbounds i8, ptr %.078.us, i64 36
  %39 = load i32, ptr %38, align 4, !tbaa !18
  %40 = zext i32 %39 to i64
  tail call void (ptr, i32, ptr, ...) @ikcp_log(ptr noundef nonnull %0, i32 noundef 8, ptr noundef nonnull @.str.2, i64 noundef %40)
  br label %41

41:                                               ; preds = %37, %31
  %42 = getelementptr inbounds i8, ptr %.078.us, i64 8
  %43 = load ptr, ptr %42, align 8, !tbaa !19
  %44 = load ptr, ptr %.078.us, align 8, !tbaa !20
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  store ptr %43, ptr %45, align 8, !tbaa !21
  store ptr %44, ptr %43, align 8, !tbaa !14
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %.078.us, i8 0, i64 16, i1 false)
  tail call void @ikcp_segment_delete(ptr noundef nonnull %0, ptr noundef nonnull %.078.us)
  %46 = load i32, ptr %15, align 4, !tbaa !12
  %47 = add i32 %46, -1
  store i32 %47, ptr %15, align 4, !tbaa !12
  %48 = icmp eq i32 %35, 0
  br i1 %48, label %.split90.us, label %.split.us

.split:                                           ; preds = %14, %69
  %.078 = phi ptr [ %50, %69 ], [ %19, %14 ]
  %.177 = phi i32 [ %61, %69 ], [ 0, %14 ]
  %.075 = phi ptr [ %.1, %69 ], [ %1, %14 ]
  %.not85 = icmp eq ptr %.078, %6
  br i1 %.not85, label %.split90.us, label %49

49:                                               ; preds = %.split
  %50 = load ptr, ptr %.078, align 8, !tbaa !14
  %.not86 = icmp eq ptr %.075, null
  br i1 %.not86, label %._crit_edge96, label %51

._crit_edge96:                                    ; preds = %49
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.078, i64 44
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !15
  br label %59

51:                                               ; preds = %49
  %52 = getelementptr inbounds i8, ptr %.078, i64 64
  %53 = getelementptr inbounds i8, ptr %.078, i64 44
  %54 = load i32, ptr %53, align 4, !tbaa !15
  %55 = zext i32 %54 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %.075, ptr nonnull align 8 %52, i64 %55, i1 false)
  %56 = load i32, ptr %53, align 4, !tbaa !15
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds i8, ptr %.075, i64 %57
  br label %59

59:                                               ; preds = %._crit_edge96, %51
  %60 = phi i32 [ %56, %51 ], [ %.pre, %._crit_edge96 ]
  %.1 = phi ptr [ %58, %51 ], [ null, %._crit_edge96 ]
  %61 = add i32 %60, %.177
  %62 = getelementptr inbounds i8, ptr %.078, i64 24
  %63 = load i32, ptr %62, align 8, !tbaa !17
  %64 = tail call i32 @ikcp_canlog(ptr noundef nonnull %0, i32 noundef 8)
  %.not87 = icmp eq i32 %64, 0
  br i1 %.not87, label %69, label %65

65:                                               ; preds = %59
  %66 = getelementptr inbounds i8, ptr %.078, i64 36
  %67 = load i32, ptr %66, align 4, !tbaa !18
  %68 = zext i32 %67 to i64
  tail call void (ptr, i32, ptr, ...) @ikcp_log(ptr noundef nonnull %0, i32 noundef 8, ptr noundef nonnull @.str.2, i64 noundef %68)
  br label %69

69:                                               ; preds = %65, %59
  %70 = icmp eq i32 %63, 0
  br i1 %70, label %.split90.us, label %.split

.split90.us:                                      ; preds = %.split, %69, %.split.us, %41
  %.us-phi = phi i32 [ %33, %41 ], [ %.177.us, %.split.us ], [ %61, %69 ], [ %.177, %.split ]
  %71 = icmp eq i32 %.us-phi, %10
  br i1 %71, label %.preheader, label %77

.preheader:                                       ; preds = %.split90.us
  %72 = getelementptr inbounds i8, ptr %0, i64 184
  %73 = load ptr, ptr %72, align 8, !tbaa !22
  %.not8891 = icmp eq ptr %72, %73
  br i1 %.not8891, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %74 = getelementptr inbounds i8, ptr %0, i64 24
  %75 = getelementptr inbounds i8, ptr %0, i64 92
  %76 = getelementptr inbounds i8, ptr %0, i64 160
  %.promoted = load i32, ptr %74, align 8, !tbaa !23
  br label %78

77:                                               ; preds = %.split90.us
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 411, ptr noundef nonnull @__PRETTY_FUNCTION__.ikcp_recv) #5
  unreachable

78:                                               ; preds = %.lr.ph, %88
  %79 = phi i32 [ %.promoted, %.lr.ph ], [ %97, %88 ]
  %80 = phi ptr [ %73, %.lr.ph ], [ %98, %88 ]
  %81 = getelementptr inbounds i8, ptr %80, i64 36
  %82 = load i32, ptr %81, align 4, !tbaa !18
  %83 = icmp eq i32 %82, %79
  br i1 %83, label %84, label %._crit_edge

84:                                               ; preds = %78
  %85 = load i32, ptr %15, align 4, !tbaa !12
  %86 = load i32, ptr %17, align 4, !tbaa !13
  %87 = icmp ult i32 %85, %86
  br i1 %87, label %88, label %._crit_edge

88:                                               ; preds = %84
  %89 = getelementptr inbounds i8, ptr %80, i64 8
  %90 = load ptr, ptr %89, align 8, !tbaa !19
  %91 = load ptr, ptr %80, align 8, !tbaa !20
  %92 = getelementptr inbounds i8, ptr %91, i64 8
  store ptr %90, ptr %92, align 8, !tbaa !21
  store ptr %91, ptr %90, align 8, !tbaa !14
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %80, i8 0, i64 16, i1 false)
  %93 = load i32, ptr %75, align 4, !tbaa !24
  %94 = add i32 %93, -1
  store i32 %94, ptr %75, align 4, !tbaa !24
  %95 = load ptr, ptr %76, align 8, !tbaa !25
  store ptr %95, ptr %89, align 8, !tbaa !19
  store ptr %6, ptr %80, align 8, !tbaa !20
  store ptr %80, ptr %95, align 8, !tbaa !14
  store ptr %80, ptr %76, align 8, !tbaa !25
  %96 = add nuw i32 %85, 1
  store i32 %96, ptr %15, align 4, !tbaa !12
  %97 = add i32 %79, 1
  store i32 %97, ptr %74, align 8, !tbaa !23
  %98 = load ptr, ptr %72, align 8, !tbaa !22
  %.not88 = icmp eq ptr %72, %98
  br i1 %.not88, label %._crit_edge, label %78, !llvm.loop !26

._crit_edge:                                      ; preds = %88, %84, %78, %.preheader
  %99 = load i32, ptr %15, align 4, !tbaa !12
  %100 = load i32, ptr %17, align 4, !tbaa !13
  %101 = icmp ult i32 %99, %100
  %or.cond = and i1 %.not84, %101
  br i1 %or.cond, label %102, label %106

102:                                              ; preds = %._crit_edge
  %103 = getelementptr inbounds i8, ptr %0, i64 72
  %104 = load i32, ptr %103, align 8, !tbaa !28
  %105 = or i32 %104, 2
  store i32 %105, ptr %103, align 8, !tbaa !28
  br label %106

106:                                              ; preds = %._crit_edge, %102, %12, %9, %5
  %.0 = phi i32 [ -1, %5 ], [ -2, %9 ], [ -3, %12 ], [ %10, %102 ], [ %10, %._crit_edge ]
  ret i32 %.0
}

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

; Function Attrs: mustprogress 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) #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3

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

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 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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, !11, i64 152}
!6 = !{!"IKCPCB", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !7, i64 64, !7, i64 68, !7, i64 72, !7, i64 76, !7, i64 80, !7, i64 84, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !7, i64 116, !7, i64 120, !7, i64 124, !7, i64 128, !10, i64 136, !10, i64 152, !10, i64 168, !10, i64 184, !11, i64 200, !7, i64 208, !7, i64 212, !11, i64 216, !11, i64 224, !7, i64 232, !7, i64 236, !7, i64 240, !7, i64 244, !7, i64 248, !11, i64 256, !11, i64 264}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"IQUEUEHEAD", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 100}
!13 = !{!6, !7, i64 60}
!14 = !{!10, !11, i64 0}
!15 = !{!16, !7, i64 44}
!16 = !{!"IKCPSEG", !10, i64 0, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !8, i64 64}
!17 = !{!16, !7, i64 24}
!18 = !{!16, !7, i64 36}
!19 = !{!16, !11, i64 8}
!20 = !{!16, !11, i64 0}
!21 = !{!10, !11, i64 8}
!22 = !{!6, !11, i64 184}
!23 = !{!6, !7, i64 24}
!24 = !{!6, !7, i64 92}
!25 = !{!6, !11, i64 160}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!6, !7, i64 72}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass