; LLVM IR from Water-Melon/Melon :: src (mln_websocket)

; 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.mln_string_t = type { ptr, i64, i32 }
%struct.mln_websocket_s = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i16, i16, i32 }
%struct.mln_http_s = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i8 }

@__const.mln_websocket_handshake_request_generate.tmp = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.upgrade_key = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.upgrade_val = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.connection_key = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.version_key = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.version_val = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.key_key = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8

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

declare void @mln_alloc_free(ptr noundef) #1

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

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

; 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

declare ptr @mln_string_pool_dup(ptr noundef, ptr noundef) #1

declare i32 @mln_hash_iterate(ptr noundef, ptr noundef, ptr noundef) #1

declare void @mln_http_reset(ptr noundef) #1

declare i32 @mln_http_field_set(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @mln_websocket_iterate_set_fields(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

declare i32 @mln_http_generate(ptr noundef, ptr noundef, ptr noundef) #1

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

33:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 @__const.mln_websocket_handshake_request_generate.tmp, i64 24, i1 false)
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = call ptr @mln_string_pool_dup(ptr noundef %34, ptr noundef %11)
  store ptr %35, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  br label %42

36:                                               ; preds = %3
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.mln_websocket_s, ptr %38, i32 0, i32 4
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  %41 = call ptr @mln_string_pool_dup(ptr noundef %37, ptr noundef %40)
  store ptr %41, ptr %10, align 8, !tbaa !5
  br label %42

42:                                               ; preds = %36, %33
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %45, label %46

45:                                               ; preds = %42
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %252

46:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store ptr null, ptr %13, align 8, !tbaa !5
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.mln_websocket_s, ptr %47, i32 0, i32 5
  %49 = load ptr, ptr %48, align 8, !tbaa !16
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %123

51:                                               ; preds = %46
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.mln_websocket_s, ptr %53, i32 0, i32 5
  %55 = load ptr, ptr %54, align 8, !tbaa !16
  %56 = call ptr @mln_string_pool_dup(ptr noundef %52, ptr noundef %55)
  store ptr %56, ptr %13, align 8, !tbaa !5
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %122

59:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %60 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %60, ptr %14, align 8, !tbaa !5
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = icmp ne ptr %61, null
  br i1 %62, label %63, label %121

63:                                               ; preds = %59
  %64 = load ptr, ptr %14, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.mln_string_t, ptr %64, i32 0, i32 2
  %66 = load i32, ptr %65, align 8
  %67 = lshr i32 %66, 2
  %68 = zext i32 %67 to i64
  %69 = add i64 %68, -1
  %70 = trunc i64 %69 to i32
  %71 = load i32, ptr %65, align 8
  %72 = and i32 %70, 1073741823
  %73 = shl i32 %72, 2
  %74 = and i32 %71, 3
  %75 = or i32 %74, %73
  store i32 %75, ptr %65, align 8
  %76 = zext i32 %72 to i64
  %77 = icmp ule i64 %68, 1
  br i1 %77, label %78, label %120

78:                                               ; preds = %63
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.mln_string_t, ptr %79, i32 0, i32 2
  %81 = load i32, ptr %80, align 8
  %82 = and i32 %81, 1
  %83 = zext i32 %82 to i64
  %84 = icmp ne i64 %83, 0
  br i1 %84, label %107, label %85

85:                                               ; preds = %78
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.mln_string_t, ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !17
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %107

90:                                               ; preds = %85
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.mln_string_t, ptr %91, i32 0, i32 2
  %93 = load i32, ptr %92, align 8
  %94 = lshr i32 %93, 1
  %95 = and i32 %94, 1
  %96 = zext i32 %95 to i64
  %97 = icmp ne i64 %96, 0
  br i1 %97, label %98, label %102

98:                                               ; preds = %90
  %99 = load ptr, ptr %14, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.mln_string_t, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !17
  call void @mln_alloc_free(ptr noundef %101)
  br label %106

102:                                              ; preds = %90
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.mln_string_t, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !17
  call void @free(ptr noundef %105) #5
  br label %106

106:                                              ; preds = %102, %98
  br label %107

107:                                              ; preds = %106, %85, %78
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.mln_string_t, ptr %108, i32 0, i32 2
  %110 = load i32, ptr %109, align 8
  %111 = lshr i32 %110, 1
  %112 = and i32 %111, 1
  %113 = zext i32 %112 to i64
  %114 = icmp ne i64 %113, 0
  br i1 %114, label %115, label %117

115:                                              ; preds = %107
  %116 = load ptr, ptr %14, align 8, !tbaa !5
  call void @mln_alloc_free(ptr noundef %116)
  br label %119

117:                                              ; preds = %107
  %118 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %118) #5
  br label %119

119:                                              ; preds = %117, %115
  br label %120

120:                                              ; preds = %119, %63
  br label %121

121:                                              ; preds = %120, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %251

122:                                              ; preds = %51
  br label %123

123:                                              ; preds = %122, %46
  %124 = load ptr, ptr %8, align 8, !tbaa !5
  call void @mln_http_reset(ptr noundef %124)
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.mln_http_s, ptr %125, i32 0, i32 12
  store i32 0, ptr %126, align 8, !tbaa !19
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.mln_http_s, ptr %127, i32 0, i32 13
  store i32 1, ptr %128, align 4, !tbaa !21
  %129 = load ptr, ptr %8, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.mln_http_s, ptr %129, i32 0, i32 14
  %131 = load i8, ptr %130, align 8
  %132 = and i8 %131, -4
  %133 = or i8 %132, 1
  store i8 %133, ptr %130, align 8
  %134 = load ptr, ptr %10, align 8, !tbaa !5
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.mln_http_s, ptr %135, i32 0, i32 7
  store ptr %134, ptr %136, align 8, !tbaa !22
  %137 = load ptr, ptr %13, align 8, !tbaa !5
  %138 = icmp ne ptr %137, null
  br i1 %138, label %139, label %143

139:                                              ; preds = %123
  %140 = load ptr, ptr %13, align 8, !tbaa !5
  %141 = load ptr, ptr %8, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.mln_http_s, ptr %141, i32 0, i32 8
  store ptr %140, ptr %142, align 8, !tbaa !23
  br label %143

143:                                              ; preds = %139, %123
  %144 = load ptr, ptr %8, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.mln_http_s, ptr %144, i32 0, i32 5
  store ptr null, ptr %145, align 8, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 @__const.mln_websocket_handshake_request_generate.upgrade_key, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 @__const.mln_websocket_handshake_request_generate.upgrade_val, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 @__const.mln_websocket_handshake_request_generate.connection_key, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 @__const.mln_websocket_handshake_request_generate.version_key, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 @__const.mln_websocket_handshake_request_generate.version_val, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 @__const.mln_websocket_handshake_request_generate.key_key, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  %147 = call ptr @mln_websocket_client_handshake_key_generate(ptr noundef %146)
  store ptr %147, ptr %21, align 8, !tbaa !5
  %148 = load ptr, ptr %21, align 8, !tbaa !5
  %149 = icmp eq ptr %148, null
  br i1 %149, label %150, label %151

150:                                              ; preds = %143
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %250

151:                                              ; preds = %143
  %152 = load ptr, ptr %8, align 8, !tbaa !5
  %153 = load ptr, ptr %21, align 8, !tbaa !5
  %154 = call i32 @mln_http_field_set(ptr noundef %152, ptr noundef %20, ptr noundef %153)
  %155 = icmp slt i32 %154, 0
  br i1 %155, label %156, label %219

156:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %157 = load ptr, ptr %21, align 8, !tbaa !5
  store ptr %157, ptr %22, align 8, !tbaa !5
  %158 = load ptr, ptr %22, align 8, !tbaa !5
  %159 = icmp ne ptr %158, null
  br i1 %159, label %160, label %218

160:                                              ; preds = %156
  %161 = load ptr, ptr %22, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.mln_string_t, ptr %161, i32 0, i32 2
  %163 = load i32, ptr %162, align 8
  %164 = lshr i32 %163, 2
  %165 = zext i32 %164 to i64
  %166 = add i64 %165, -1
  %167 = trunc i64 %166 to i32
  %168 = load i32, ptr %162, align 8
  %169 = and i32 %167, 1073741823
  %170 = shl i32 %169, 2
  %171 = and i32 %168, 3
  %172 = or i32 %171, %170
  store i32 %172, ptr %162, align 8
  %173 = zext i32 %169 to i64
  %174 = icmp ule i64 %165, 1
  br i1 %174, label %175, label %217

175:                                              ; preds = %160
  %176 = load ptr, ptr %22, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.mln_string_t, ptr %176, i32 0, i32 2
  %178 = load i32, ptr %177, align 8
  %179 = and i32 %178, 1
  %180 = zext i32 %179 to i64
  %181 = icmp ne i64 %180, 0
  br i1 %181, label %204, label %182

182:                                              ; preds = %175
  %183 = load ptr, ptr %22, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.mln_string_t, ptr %183, i32 0, i32 0
  %185 = load ptr, ptr %184, align 8, !tbaa !17
  %186 = icmp ne ptr %185, null
  br i1 %186, label %187, label %204

187:                                              ; preds = %182
  %188 = load ptr, ptr %22, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.mln_string_t, ptr %188, i32 0, i32 2
  %190 = load i32, ptr %189, align 8
  %191 = lshr i32 %190, 1
  %192 = and i32 %191, 1
  %193 = zext i32 %192 to i64
  %194 = icmp ne i64 %193, 0
  br i1 %194, label %195, label %199

195:                                              ; preds = %187
  %196 = load ptr, ptr %22, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.mln_string_t, ptr %196, i32 0, i32 0
  %198 = load ptr, ptr %197, align 8, !tbaa !17
  call void @mln_alloc_free(ptr noundef %198)
  br label %203

199:                                              ; preds = %187
  %200 = load ptr, ptr %22, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.mln_string_t, ptr %200, i32 0, i32 0
  %202 = load ptr, ptr %201, align 8, !tbaa !17
  call void @free(ptr noundef %202) #5
  br label %203

203:                                              ; preds = %199, %195
  br label %204

204:                                              ; preds = %203, %182, %175
  %205 = load ptr, ptr %22, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.mln_string_t, ptr %205, i32 0, i32 2
  %207 = load i32, ptr %206, align 8
  %208 = lshr i32 %207, 1
  %209 = and i32 %208, 1
  %210 = zext i32 %209 to i64
  %211 = icmp ne i64 %210, 0
  br i1 %211, label %212, label %214

212:                                              ; preds = %204
  %213 = load ptr, ptr %22, align 8, !tbaa !5
  call void @mln_alloc_free(ptr noundef %213)
  br label %216

214:                                              ; preds = %204
  %215 = load ptr, ptr %22, align 8, !tbaa !5
  call void @free(ptr noundef %215) #5
  br label %216

216:                                              ; preds = %214, %212
  br label %217

217:                                              ; preds = %216, %160
  br label %218

218:                                              ; preds = %217, %156
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %250

219:                                              ; preds = %151
  %220 = load ptr, ptr %8, align 8, !tbaa !5
  %221 = call i32 @mln_http_field_set(ptr noundef %220, ptr noundef %15, ptr noundef %16)
  %222 = icmp slt i32 %221, 0
  br i1 %222, label %223, label %224

223:                                              ; preds = %219
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %250

224:                                              ; preds = %219
  %225 = load ptr, ptr %8, align 8, !tbaa !5
  %226 = call i32 @mln_http_field_set(ptr noundef %225, ptr noundef %17, ptr noundef %15)
  %227 = icmp slt i32 %226, 0
  br i1 %227, label %228, label %229

228:                                              ; preds = %224
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %250

229:                                              ; preds = %224
  %230 = load ptr, ptr %8, align 8, !tbaa !5
  %231 = call i32 @mln_http_field_set(ptr noundef %230, ptr noundef %18, ptr noundef %19)
  %232 = icmp slt i32 %231, 0
  br i1 %232, label %233, label %234

233:                                              ; preds = %229
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %250

234:                                              ; preds = %229
  %235 = load ptr, ptr %5, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.mln_websocket_s, ptr %235, i32 0, i32 3
  %237 = load ptr, ptr %236, align 8, !tbaa !25
  %238 = load ptr, ptr %8, align 8, !tbaa !5
  %239 = call i32 @mln_hash_iterate(ptr noundef %237, ptr noundef @mln_websocket_iterate_set_fields, ptr noundef %238)
  %240 = icmp slt i32 %239, 0
  br i1 %240, label %241, label %242

241:                                              ; preds = %234
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %250

242:                                              ; preds = %234
  %243 = load ptr, ptr %8, align 8, !tbaa !5
  %244 = load ptr, ptr %6, align 8, !tbaa !5
  %245 = load ptr, ptr %7, align 8, !tbaa !5
  %246 = call i32 @mln_http_generate(ptr noundef %243, ptr noundef %244, ptr noundef %245)
  %247 = icmp eq i32 %246, 2
  br i1 %247, label %248, label %249

248:                                              ; preds = %242
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %250

249:                                              ; preds = %242
  store i32 0, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %250

250:                                              ; preds = %249, %248, %241, %233, %228, %223, %218, %150
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #5
  br label %251

251:                                              ; preds = %250, %121
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %252

252:                                              ; preds = %251, %45
  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
  %253 = load i32, ptr %4, align 4
  ret i32 %253
}

; Function Attrs: nounwind uwtable
declare hidden ptr @mln_websocket_client_handshake_key_generate(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 }

!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, !6, i64 0}
!10 = !{!"mln_websocket_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !11, i64 80, !12, i64 88, !12, i64 88, !12, i64 88, !12, i64 88, !12, i64 88, !12, i64 88, !12, i64 89, !12, i64 89, !12, i64 90, !13, i64 92}
!11 = !{!"long", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !6, i64 8}
!15 = !{!10, !6, i64 32}
!16 = !{!10, !6, i64 40}
!17 = !{!18, !6, i64 0}
!18 = !{!"", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 16, !11, i64 16}
!19 = !{!20, !13, i64 88}
!20 = !{!"mln_http_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !13, i64 80, !13, i64 84, !13, i64 88, !13, i64 92, !13, i64 96, !13, i64 96}
!21 = !{!20, !13, i64 92}
!22 = !{!20, !6, i64 56}
!23 = !{!20, !6, i64 64}
!24 = !{!20, !6, i64 40}
!25 = !{!10, !6, i64 24}


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

@__const.mln_websocket_handshake_request_generate.tmp = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.upgrade_key = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.upgrade_val = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.connection_key = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.version_key = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.version_val = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8
@__const.mln_websocket_handshake_request_generate.key_key = external hidden unnamed_addr constant { ptr, i64, i8, i8, i8, i8 }, align 8

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

declare void @mln_alloc_free(ptr 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

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

declare ptr @mln_string_pool_dup(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @mln_hash_iterate(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @mln_http_reset(ptr noundef) local_unnamed_addr #1

declare i32 @mln_http_field_set(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @mln_websocket_iterate_set_fields(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

declare i32 @mln_http_generate(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @mln_websocket_handshake_request_generate(ptr nocapture noundef nonnull readonly %0, ptr noundef nonnull %1, ptr noundef nonnull %2) local_unnamed_addr #4 {
  %4 = alloca %struct.mln_string_t, align 8
  %5 = alloca %struct.mln_string_t, align 8
  %6 = alloca %struct.mln_string_t, align 8
  %7 = alloca %struct.mln_string_t, align 8
  %8 = alloca %struct.mln_string_t, align 8
  %9 = alloca %struct.mln_string_t, align 8
  %10 = alloca %struct.mln_string_t, align 8
  %11 = load ptr, ptr %0, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !13
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %19

17:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) @__const.mln_websocket_handshake_request_generate.tmp, i64 24, i1 false)
  %18 = call ptr @mln_string_pool_dup(ptr noundef %13, ptr noundef nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  br label %21

19:                                               ; preds = %3
  %20 = tail call ptr @mln_string_pool_dup(ptr noundef %13, ptr noundef nonnull %15) #5
  br label %21

21:                                               ; preds = %19, %17
  %.055 = phi ptr [ %18, %17 ], [ %20, %19 ]
  %22 = icmp eq ptr %.055, null
  br i1 %22, label %106, label %23

23:                                               ; preds = %21
  %24 = getelementptr inbounds i8, ptr %0, i64 40
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  %.not = icmp eq ptr %25, null
  br i1 %.not, label %50, label %26

26:                                               ; preds = %23
  %27 = call ptr @mln_string_pool_dup(ptr noundef %13, ptr noundef nonnull %25) #5
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %50

29:                                               ; preds = %26
  %30 = getelementptr inbounds i8, ptr %.055, i64 16
  %31 = load i32, ptr %30, align 8
  %32 = and i32 %31, -4
  %33 = add i32 %32, -4
  %34 = and i32 %31, 3
  %35 = or disjoint i32 %33, %34
  store i32 %35, ptr %30, align 8
  %36 = icmp ult i32 %31, 8
  br i1 %36, label %37, label %106

37:                                               ; preds = %29
  %38 = and i32 %31, 1
  %.not68 = icmp eq i32 %38, 0
  br i1 %.not68, label %39, label %45

39:                                               ; preds = %37
  %40 = load ptr, ptr %.055, align 8, !tbaa !16
  %.not69 = icmp eq ptr %40, null
  br i1 %.not69, label %45, label %41

41:                                               ; preds = %39
  %42 = and i32 %31, 2
  %.not70 = icmp eq i32 %42, 0
  br i1 %.not70, label %44, label %43

43:                                               ; preds = %41
  call void @mln_alloc_free(ptr noundef nonnull %40) #5
  br label %45

44:                                               ; preds = %41
  call void @free(ptr noundef nonnull %40) #5
  br label %45

45:                                               ; preds = %43, %44, %39, %37
  %46 = load i32, ptr %30, align 8
  %47 = and i32 %46, 2
  %.not71 = icmp eq i32 %47, 0
  br i1 %.not71, label %49, label %48

48:                                               ; preds = %45
  call void @mln_alloc_free(ptr noundef nonnull %.055) #5
  br label %106

49:                                               ; preds = %45
  call void @free(ptr noundef nonnull %.055) #5
  br label %106

50:                                               ; preds = %26, %23
  %.056 = phi ptr [ %27, %26 ], [ null, %23 ]
  call void @mln_http_reset(ptr noundef %11) #5
  %51 = getelementptr inbounds i8, ptr %11, i64 88
  store i32 0, ptr %51, align 8, !tbaa !18
  %52 = getelementptr inbounds i8, ptr %11, i64 92
  store i32 1, ptr %52, align 4, !tbaa !20
  %53 = getelementptr inbounds i8, ptr %11, i64 96
  %54 = load i8, ptr %53, align 8
  %55 = and i8 %54, -4
  %56 = or disjoint i8 %55, 1
  store i8 %56, ptr %53, align 8
  %57 = getelementptr inbounds i8, ptr %11, i64 56
  store ptr %.055, ptr %57, align 8, !tbaa !21
  %.not63 = icmp eq ptr %.056, null
  br i1 %.not63, label %60, label %58

58:                                               ; preds = %50
  %59 = getelementptr inbounds i8, ptr %11, i64 64
  store ptr %.056, ptr %59, align 8, !tbaa !22
  br label %60

60:                                               ; preds = %58, %50
  %61 = getelementptr inbounds i8, ptr %11, i64 40
  store ptr null, ptr %61, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) @__const.mln_websocket_handshake_request_generate.upgrade_key, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) @__const.mln_websocket_handshake_request_generate.upgrade_val, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) @__const.mln_websocket_handshake_request_generate.connection_key, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) @__const.mln_websocket_handshake_request_generate.version_key, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) @__const.mln_websocket_handshake_request_generate.version_val, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) @__const.mln_websocket_handshake_request_generate.key_key, i64 24, i1 false)
  %62 = call ptr @mln_websocket_client_handshake_key_generate(ptr noundef %13)
  %63 = icmp eq ptr %62, null
  br i1 %63, label %105, label %64

64:                                               ; preds = %60
  %65 = call i32 @mln_http_field_set(ptr noundef nonnull %11, ptr noundef nonnull %10, ptr noundef nonnull %62) #5
  %66 = icmp slt i32 %65, 0
  br i1 %66, label %67, label %88

67:                                               ; preds = %64
  %68 = getelementptr inbounds i8, ptr %62, i64 16
  %69 = load i32, ptr %68, align 8
  %70 = and i32 %69, -4
  %71 = add i32 %70, -4
  %72 = and i32 %69, 3
  %73 = or disjoint i32 %71, %72
  store i32 %73, ptr %68, align 8
  %74 = icmp ult i32 %69, 8
  br i1 %74, label %75, label %105

75:                                               ; preds = %67
  %76 = and i32 %69, 1
  %.not64 = icmp eq i32 %76, 0
  br i1 %.not64, label %77, label %83

77:                                               ; preds = %75
  %78 = load ptr, ptr %62, align 8, !tbaa !16
  %.not65 = icmp eq ptr %78, null
  br i1 %.not65, label %83, label %79

79:                                               ; preds = %77
  %80 = and i32 %69, 2
  %.not66 = icmp eq i32 %80, 0
  br i1 %.not66, label %82, label %81

81:                                               ; preds = %79
  call void @mln_alloc_free(ptr noundef nonnull %78) #5
  br label %83

82:                                               ; preds = %79
  call void @free(ptr noundef nonnull %78) #5
  br label %83

83:                                               ; preds = %81, %82, %77, %75
  %84 = load i32, ptr %68, align 8
  %85 = and i32 %84, 2
  %.not67 = icmp eq i32 %85, 0
  br i1 %.not67, label %87, label %86

86:                                               ; preds = %83
  call void @mln_alloc_free(ptr noundef nonnull %62) #5
  br label %105

87:                                               ; preds = %83
  call void @free(ptr noundef nonnull %62) #5
  br label %105

88:                                               ; preds = %64
  %89 = call i32 @mln_http_field_set(ptr noundef nonnull %11, ptr noundef nonnull %5, ptr noundef nonnull %6) #5
  %90 = icmp slt i32 %89, 0
  br i1 %90, label %105, label %91

91:                                               ; preds = %88
  %92 = call i32 @mln_http_field_set(ptr noundef nonnull %11, ptr noundef nonnull %7, ptr noundef nonnull %5) #5
  %93 = icmp slt i32 %92, 0
  br i1 %93, label %105, label %94

94:                                               ; preds = %91
  %95 = call i32 @mln_http_field_set(ptr noundef nonnull %11, ptr noundef nonnull %8, ptr noundef nonnull %9) #5
  %96 = icmp slt i32 %95, 0
  br i1 %96, label %105, label %97

97:                                               ; preds = %94
  %98 = getelementptr inbounds i8, ptr %0, i64 24
  %99 = load ptr, ptr %98, align 8, !tbaa !24
  %100 = call i32 @mln_hash_iterate(ptr noundef %99, ptr noundef nonnull @mln_websocket_iterate_set_fields, ptr noundef nonnull %11) #5
  %101 = icmp slt i32 %100, 0
  br i1 %101, label %105, label %102

102:                                              ; preds = %97
  %103 = call i32 @mln_http_generate(ptr noundef nonnull %11, ptr noundef nonnull %1, ptr noundef nonnull %2) #5
  %104 = icmp eq i32 %103, 2
  %. = zext i1 %104 to i32
  br label %105

105:                                              ; preds = %102, %97, %94, %91, %88, %86, %87, %67, %60
  %.0 = phi i32 [ 1, %60 ], [ 1, %67 ], [ 1, %87 ], [ 1, %86 ], [ 1, %88 ], [ 1, %91 ], [ 1, %94 ], [ 1, %97 ], [ %., %102 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  br label %106

106:                                              ; preds = %105, %29, %49, %48, %21
  %.2 = phi i32 [ 1, %21 ], [ %.0, %105 ], [ 1, %29 ], [ 1, %49 ], [ 1, %48 ]
  ret i32 %.2
}

; Function Attrs: nounwind uwtable
declare hidden ptr @mln_websocket_client_handshake_key_generate(ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 }

!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 = !{!"mln_websocket_s", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !10, i64 80, !11, i64 88, !11, i64 88, !11, i64 88, !11, i64 88, !11, i64 88, !11, i64 88, !11, i64 89, !11, i64 89, !11, i64 90, !12, i64 92}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 32}
!15 = !{!6, !7, i64 40}
!16 = !{!17, !7, i64 0}
!17 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 16, !10, i64 16}
!18 = !{!19, !12, i64 88}
!19 = !{!"mln_http_s", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 96}
!20 = !{!19, !12, i64 92}
!21 = !{!19, !7, i64 56}
!22 = !{!19, !7, i64 64}
!23 = !{!19, !7, i64 40}
!24 = !{!6, !7, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass