; LLVM IR from guanzhi/GmSSL :: tools (tls12_server)

; 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.TLS_CTX = type { i32, i32, [64 x i32], i64, ptr, i64, ptr, i64, %struct.SM2_KEY, %struct.SM2_KEY, i32, i32 }
%struct.SM2_KEY = type { %struct.SM2_Z256_POINT, [4 x i64] }
%struct.SM2_Z256_POINT = type { [4 x i64], [4 x i64], [4 x i64] }
%struct.TLS_CONNECT = type { i32, i32, [64 x i32], i64, i32, [18437 x i8], i64, [18437 x i8], [18437 x i8], ptr, i64, i32, [32 x i8], i64, [2048 x i8], i64, [2048 x i8], i64, [2048 x i8], i64, %struct.SM2_KEY, %struct.SM2_KEY, i32, [48 x i8], [96 x i8], %struct.SM3_HMAC_CTX, %struct.SM3_HMAC_CTX, %struct.SM4_KEY, %struct.SM4_KEY, [8 x i8], [8 x i8], [12 x i8], [12 x i8], %struct.BLOCK_CIPHER_KEY, %struct.BLOCK_CIPHER_KEY, i32 }
%struct.SM3_HMAC_CTX = type { %struct.SM3_CTX, [64 x i8] }
%struct.SM3_CTX = type { [8 x i32], i64, [64 x i8], i64 }
%struct.SM4_KEY = type { [32 x i32] }
%struct.BLOCK_CIPHER_KEY = type { %union.anon, ptr }
%union.anon = type { %struct.SM4_KEY }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }

@__const.tls12_server_main.server_ciphers = external hidden unnamed_addr constant [1 x i32], align 4
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@options = external hidden global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [68 x i8], align 1
@__FUNCTION__.tls12_server_main = external hidden unnamed_addr constant [18 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @tls12_server_main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca [1 x i32], align 4
  %14 = alloca %struct.TLS_CTX, align 8
  %15 = alloca %struct.TLS_CONNECT, align 8
  %16 = alloca [1600 x i8], align 16
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca %struct.sockaddr_in, align 4
  %21 = alloca %struct.sockaddr_in, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i64, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 0
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  store ptr %27, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  store i32 443, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  store ptr null, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  store ptr null, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  store ptr null, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 @__const.tls12_server_main.server_ciphers, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 568, ptr %14) #9
  call void @llvm.lifetime.start.p0(i64 63176, ptr %15) #9
  call void @llvm.lifetime.start.p0(i64 1600, ptr %16) #9
  call void @llvm.memset.p0.i64(ptr align 16 %16, i8 0, i64 1600, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  store i64 1600, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #9
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = add nsw i32 %28, -1
  store i32 %29, ptr %4, align 4, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !9
  %31 = getelementptr inbounds ptr, ptr %30, i32 1
  store ptr %31, ptr %5, align 8, !tbaa !9
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = icmp slt i32 %32, 1
  br i1 %33, label %34, label %39

34:                                               ; preds = %2
  %35 = load ptr, ptr @stderr, align 8, !tbaa !9
  %36 = load ptr, ptr %7, align 8, !tbaa !9
  %37 = load ptr, ptr @options, align 8, !tbaa !9
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str, ptr noundef %36, ptr noundef %37) #9
  store i32 1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

39:                                               ; preds = %2
  br label %40

40:                                               ; preds = %140, %39
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = icmp sgt i32 %41, 0
  br i1 %42, label %43, label %145

43:                                               ; preds = %40
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = call i32 @strcmp(ptr noundef %45, ptr noundef @.str.1) #10
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %52, label %48

48:                                               ; preds = %43
  %49 = load ptr, ptr %7, align 8, !tbaa !9
  %50 = load ptr, ptr @options, align 8, !tbaa !9
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %49, ptr noundef %50)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

52:                                               ; preds = %43
  %53 = load ptr, ptr %5, align 8, !tbaa !9
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = call i32 @strcmp(ptr noundef %54, ptr noundef @.str.2) #10
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %67, label %57

57:                                               ; preds = %52
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr %4, align 4, !tbaa !5
  %60 = icmp slt i32 %59, 1
  br i1 %60, label %61, label %62

61:                                               ; preds = %57
  br label %129

62:                                               ; preds = %57
  %63 = load ptr, ptr %5, align 8, !tbaa !9
  %64 = getelementptr inbounds ptr, ptr %63, i32 1
  store ptr %64, ptr %5, align 8, !tbaa !9
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  %66 = call i32 @atoi(ptr noundef %65) #10
  store i32 %66, ptr %8, align 4, !tbaa !5
  br label %139

67:                                               ; preds = %52
  %68 = load ptr, ptr %5, align 8, !tbaa !9
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  %70 = call i32 @strcmp(ptr noundef %69, ptr noundef @.str.3) #10
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %81, label %72

72:                                               ; preds = %67
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = add nsw i32 %73, -1
  store i32 %74, ptr %4, align 4, !tbaa !5
  %75 = icmp slt i32 %74, 1
  br i1 %75, label %76, label %77

76:                                               ; preds = %72
  br label %129

77:                                               ; preds = %72
  %78 = load ptr, ptr %5, align 8, !tbaa !9
  %79 = getelementptr inbounds ptr, ptr %78, i32 1
  store ptr %79, ptr %5, align 8, !tbaa !9
  %80 = load ptr, ptr %79, align 8, !tbaa !9
  store ptr %80, ptr %9, align 8, !tbaa !9
  br label %138

81:                                               ; preds = %67
  %82 = load ptr, ptr %5, align 8, !tbaa !9
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  %84 = call i32 @strcmp(ptr noundef %83, ptr noundef @.str.4) #10
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %95, label %86

86:                                               ; preds = %81
  %87 = load i32, ptr %4, align 4, !tbaa !5
  %88 = add nsw i32 %87, -1
  store i32 %88, ptr %4, align 4, !tbaa !5
  %89 = icmp slt i32 %88, 1
  br i1 %89, label %90, label %91

90:                                               ; preds = %86
  br label %129

91:                                               ; preds = %86
  %92 = load ptr, ptr %5, align 8, !tbaa !9
  %93 = getelementptr inbounds ptr, ptr %92, i32 1
  store ptr %93, ptr %5, align 8, !tbaa !9
  %94 = load ptr, ptr %93, align 8, !tbaa !9
  store ptr %94, ptr %10, align 8, !tbaa !9
  br label %137

95:                                               ; preds = %81
  %96 = load ptr, ptr %5, align 8, !tbaa !9
  %97 = load ptr, ptr %96, align 8, !tbaa !9
  %98 = call i32 @strcmp(ptr noundef %97, ptr noundef @.str.5) #10
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %109, label %100

100:                                              ; preds = %95
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = add nsw i32 %101, -1
  store i32 %102, ptr %4, align 4, !tbaa !5
  %103 = icmp slt i32 %102, 1
  br i1 %103, label %104, label %105

104:                                              ; preds = %100
  br label %129

105:                                              ; preds = %100
  %106 = load ptr, ptr %5, align 8, !tbaa !9
  %107 = getelementptr inbounds ptr, ptr %106, i32 1
  store ptr %107, ptr %5, align 8, !tbaa !9
  %108 = load ptr, ptr %107, align 8, !tbaa !9
  store ptr %108, ptr %11, align 8, !tbaa !9
  br label %136

109:                                              ; preds = %95
  %110 = load ptr, ptr %5, align 8, !tbaa !9
  %111 = load ptr, ptr %110, align 8, !tbaa !9
  %112 = call i32 @strcmp(ptr noundef %111, ptr noundef @.str.6) #10
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %123, label %114

114:                                              ; preds = %109
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = add nsw i32 %115, -1
  store i32 %116, ptr %4, align 4, !tbaa !5
  %117 = icmp slt i32 %116, 1
  br i1 %117, label %118, label %119

118:                                              ; preds = %114
  br label %129

119:                                              ; preds = %114
  %120 = load ptr, ptr %5, align 8, !tbaa !9
  %121 = getelementptr inbounds ptr, ptr %120, i32 1
  store ptr %121, ptr %5, align 8, !tbaa !9
  %122 = load ptr, ptr %121, align 8, !tbaa !9
  store ptr %122, ptr %12, align 8, !tbaa !9
  br label %135

123:                                              ; preds = %109
  %124 = load ptr, ptr @stderr, align 8, !tbaa !9
  %125 = load ptr, ptr %7, align 8, !tbaa !9
  %126 = load ptr, ptr %5, align 8, !tbaa !9
  %127 = load ptr, ptr %126, align 8, !tbaa !9
  %128 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %124, ptr noundef @.str.7, ptr noundef %125, ptr noundef %127) #9
  store i32 1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

129:                                              ; preds = %118, %104, %90, %76, %61
  %130 = load ptr, ptr @stderr, align 8, !tbaa !9
  %131 = load ptr, ptr %7, align 8, !tbaa !9
  %132 = load ptr, ptr %5, align 8, !tbaa !9
  %133 = load ptr, ptr %132, align 8, !tbaa !9
  %134 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %130, ptr noundef @.str.8, ptr noundef %131, ptr noundef %133) #9
  store i32 1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

135:                                              ; preds = %119
  br label %136

136:                                              ; preds = %135, %105
  br label %137

137:                                              ; preds = %136, %91
  br label %138

138:                                              ; preds = %137, %77
  br label %139

139:                                              ; preds = %138, %62
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %4, align 4, !tbaa !5
  %142 = add nsw i32 %141, -1
  store i32 %142, ptr %4, align 4, !tbaa !5
  %143 = load ptr, ptr %5, align 8, !tbaa !9
  %144 = getelementptr inbounds ptr, ptr %143, i32 1
  store ptr %144, ptr %5, align 8, !tbaa !9
  br label %40, !llvm.loop !13

145:                                              ; preds = %40
  %146 = load ptr, ptr %9, align 8, !tbaa !9
  %147 = icmp ne ptr %146, null
  br i1 %147, label %152, label %148

148:                                              ; preds = %145
  %149 = load ptr, ptr @stderr, align 8, !tbaa !9
  %150 = load ptr, ptr %7, align 8, !tbaa !9
  %151 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %149, ptr noundef @.str.9, ptr noundef %150) #9
  store i32 1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

152:                                              ; preds = %145
  %153 = load ptr, ptr %10, align 8, !tbaa !9
  %154 = icmp ne ptr %153, null
  br i1 %154, label %159, label %155

155:                                              ; preds = %152
  %156 = load ptr, ptr @stderr, align 8, !tbaa !9
  %157 = load ptr, ptr %7, align 8, !tbaa !9
  %158 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %156, ptr noundef @.str.10, ptr noundef %157) #9
  store i32 1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

159:                                              ; preds = %152
  %160 = load ptr, ptr %11, align 8, !tbaa !9
  %161 = icmp ne ptr %160, null
  br i1 %161, label %166, label %162

162:                                              ; preds = %159
  %163 = load ptr, ptr @stderr, align 8, !tbaa !9
  %164 = load ptr, ptr %7, align 8, !tbaa !9
  %165 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %163, ptr noundef @.str.11, ptr noundef %164) #9
  store i32 1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

166:                                              ; preds = %159
  call void @llvm.memset.p0.i64(ptr align 8 %14, i8 0, i64 568, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %15, i8 0, i64 63176, i1 false)
  %167 = call i32 @tls_socket_lib_init()
  %168 = icmp ne i32 %167, 1
  br i1 %168, label %169, label %175

169:                                              ; preds = %166
  br label %170

170:                                              ; preds = %169
  %171 = load ptr, ptr @stderr, align 8, !tbaa !9
  %172 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %171, ptr noundef @.str.12, ptr noundef @.str.13, i32 noundef 98, ptr noundef @__FUNCTION__.tls12_server_main) #9
  br label %173

173:                                              ; preds = %170
  br label %174

174:                                              ; preds = %173
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

175:                                              ; preds = %166
  %176 = call i32 @tls_ctx_init(ptr noundef %14, i32 noundef 771, i32 noundef 0)
  %177 = icmp ne i32 %176, 1
  br i1 %177, label %188, label %178

178:                                              ; preds = %175
  %179 = getelementptr inbounds [1 x i32], ptr %13, i64 0, i64 0
  %180 = call i32 @tls_ctx_set_cipher_suites(ptr noundef %14, ptr noundef %179, i64 noundef 1)
  %181 = icmp ne i32 %180, 1
  br i1 %181, label %188, label %182

182:                                              ; preds = %178
  %183 = load ptr, ptr %9, align 8, !tbaa !9
  %184 = load ptr, ptr %10, align 8, !tbaa !9
  %185 = load ptr, ptr %11, align 8, !tbaa !9
  %186 = call i32 @tls_ctx_set_certificate_and_key(ptr noundef %14, ptr noundef %183, ptr noundef %184, ptr noundef %185)
  %187 = icmp ne i32 %186, 1
  br i1 %187, label %188, label %194

188:                                              ; preds = %182, %178, %175
  br label %189

189:                                              ; preds = %188
  %190 = load ptr, ptr @stderr, align 8, !tbaa !9
  %191 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %190, ptr noundef @.str.12, ptr noundef @.str.13, i32 noundef 105, ptr noundef @__FUNCTION__.tls12_server_main) #9
  br label %192

192:                                              ; preds = %189
  br label %193

193:                                              ; preds = %192
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

194:                                              ; preds = %182
  %195 = load ptr, ptr %12, align 8, !tbaa !9
  %196 = icmp ne ptr %195, null
  br i1 %196, label %197, label %208

197:                                              ; preds = %194
  %198 = load ptr, ptr %12, align 8, !tbaa !9
  %199 = call i32 @tls_ctx_set_ca_certificates(ptr noundef %14, ptr noundef %198, i32 noundef 4)
  %200 = icmp ne i32 %199, 1
  br i1 %200, label %201, label %207

201:                                              ; preds = %197
  br label %202

202:                                              ; preds = %201
  %203 = load ptr, ptr @stderr, align 8, !tbaa !9
  %204 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %203, ptr noundef @.str.12, ptr noundef @.str.13, i32 noundef 110, ptr noundef @__FUNCTION__.tls12_server_main) #9
  br label %205

205:                                              ; preds = %202
  br label %206

206:                                              ; preds = %205
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

207:                                              ; preds = %197
  br label %208

208:                                              ; preds = %207, %194
  %209 = call i32 @tls_socket_create(ptr noundef %18, i32 noundef 2, i32 noundef 1, i32 noundef 0)
  %210 = icmp ne i32 %209, 1
  br i1 %210, label %211, label %215

211:                                              ; preds = %208
  %212 = load ptr, ptr @stderr, align 8, !tbaa !9
  %213 = load ptr, ptr %7, align 8, !tbaa !9
  %214 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %212, ptr noundef @.str.14, ptr noundef %213) #9
  br label %304

215:                                              ; preds = %208
  %216 = getelementptr inbounds %struct.sockaddr_in, ptr %20, i32 0, i32 0
  store i16 2, ptr %216, align 4, !tbaa !15
  %217 = getelementptr inbounds %struct.sockaddr_in, ptr %20, i32 0, i32 2
  %218 = getelementptr inbounds %struct.in_addr, ptr %217, i32 0, i32 0
  store i32 0, ptr %218, align 4, !tbaa !19
  %219 = load i32, ptr %8, align 4, !tbaa !5
  %220 = trunc i32 %219 to i16
  %221 = call zeroext i16 @__bswap_16(i16 noundef zeroext %220)
  %222 = getelementptr inbounds %struct.sockaddr_in, ptr %20, i32 0, i32 1
  store i16 %221, ptr %222, align 2, !tbaa !20
  %223 = load i32, ptr %18, align 4, !tbaa !5
  %224 = call i32 @tls_socket_bind(i32 noundef %223, ptr noundef %20)
  %225 = icmp ne i32 %224, 1
  br i1 %225, label %226, label %230

226:                                              ; preds = %215
  %227 = load ptr, ptr @stderr, align 8, !tbaa !9
  %228 = load ptr, ptr %7, align 8, !tbaa !9
  %229 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %227, ptr noundef @.str.15, ptr noundef %228) #9
  br label %304

230:                                              ; preds = %215
  %231 = call i32 @puts(ptr noundef @.str.16)
  %232 = load i32, ptr %18, align 4, !tbaa !5
  %233 = call i32 @tls_socket_listen(i32 noundef %232, i32 noundef 1)
  br label %234

234:                                              ; preds = %301, %230
  %235 = load i32, ptr %18, align 4, !tbaa !5
  %236 = call i32 @tls_socket_accept(i32 noundef %235, ptr noundef %21, ptr noundef %19)
  %237 = icmp ne i32 %236, 1
  br i1 %237, label %238, label %242

238:                                              ; preds = %234
  %239 = load ptr, ptr @stderr, align 8, !tbaa !9
  %240 = load ptr, ptr %7, align 8, !tbaa !9
  %241 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %239, ptr noundef @.str.17, ptr noundef %240) #9
  br label %304

242:                                              ; preds = %234
  %243 = call i32 @puts(ptr noundef @.str.18)
  %244 = call i32 @tls_init(ptr noundef %15, ptr noundef %14)
  %245 = icmp ne i32 %244, 1
  br i1 %245, label %250, label %246

246:                                              ; preds = %242
  %247 = load i32, ptr %19, align 4, !tbaa !5
  %248 = call i32 @tls_set_socket(ptr noundef %15, i32 noundef %247)
  %249 = icmp ne i32 %248, 1
  br i1 %249, label %250, label %256

250:                                              ; preds = %246, %242
  br label %251

251:                                              ; preds = %250
  %252 = load ptr, ptr @stderr, align 8, !tbaa !9
  %253 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %252, ptr noundef @.str.12, ptr noundef @.str.13, i32 noundef 146, ptr noundef @__FUNCTION__.tls12_server_main) #9
  br label %254

254:                                              ; preds = %251
  br label %255

255:                                              ; preds = %254
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

256:                                              ; preds = %246
  %257 = call i32 @tls_do_handshake(ptr noundef %15)
  %258 = icmp ne i32 %257, 1
  br i1 %258, label %259, label %265

259:                                              ; preds = %256
  br label %260

260:                                              ; preds = %259
  %261 = load ptr, ptr @stderr, align 8, !tbaa !9
  %262 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %261, ptr noundef @.str.12, ptr noundef @.str.13, i32 noundef 151, ptr noundef @__FUNCTION__.tls12_server_main) #9
  br label %263

263:                                              ; preds = %260
  br label %264

264:                                              ; preds = %263
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

265:                                              ; preds = %256
  br label %266

266:                                              ; preds = %303, %265
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #9
  br label %267

267:                                              ; preds = %284, %266
  store i64 1600, ptr %17, align 8, !tbaa !11
  %268 = getelementptr inbounds [1600 x i8], ptr %16, i64 0, i64 0
  %269 = call i32 @tls_recv(ptr noundef %15, ptr noundef %268, i64 noundef 1600, ptr noundef %17)
  store i32 %269, ptr %23, align 4, !tbaa !5
  %270 = icmp ne i32 %269, 1
  br i1 %270, label %271, label %283

271:                                              ; preds = %267
  %272 = load i32, ptr %23, align 4, !tbaa !5
  %273 = icmp slt i32 %272, 0
  br i1 %273, label %274, label %278

274:                                              ; preds = %271
  %275 = load ptr, ptr @stderr, align 8, !tbaa !9
  %276 = load ptr, ptr %7, align 8, !tbaa !9
  %277 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %275, ptr noundef @.str.19, ptr noundef %276) #9
  br label %282

278:                                              ; preds = %271
  %279 = load ptr, ptr @stderr, align 8, !tbaa !9
  %280 = load ptr, ptr %7, align 8, !tbaa !9
  %281 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %279, ptr noundef @.str.20, ptr noundef %280) #9
  br label %282

282:                                              ; preds = %278, %274
  call void @tls_cleanup(ptr noundef %15)
  store i32 12, ptr %22, align 4
  br label %301

283:                                              ; preds = %267
  br label %284

284:                                              ; preds = %283
  %285 = load i64, ptr %17, align 8, !tbaa !11
  %286 = icmp ne i64 %285, 0
  %287 = xor i1 %286, true
  br i1 %287, label %267, label %288, !llvm.loop !21

288:                                              ; preds = %284
  %289 = getelementptr inbounds [1600 x i8], ptr %16, i64 0, i64 0
  %290 = load i64, ptr %17, align 8, !tbaa !11
  %291 = call i32 @tls_send(ptr noundef %15, ptr noundef %289, i64 noundef %290, ptr noundef %24)
  %292 = icmp ne i32 %291, 1
  br i1 %292, label %293, label %300

293:                                              ; preds = %288
  %294 = load ptr, ptr @stderr, align 8, !tbaa !9
  %295 = load ptr, ptr %7, align 8, !tbaa !9
  %296 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %294, ptr noundef @.str.21, ptr noundef %295) #9
  %297 = getelementptr inbounds %struct.TLS_CONNECT, ptr %15, i32 0, i32 4
  %298 = load i32, ptr %297, align 8, !tbaa !22
  %299 = call i32 @close(i32 noundef %298)
  store i32 11, ptr %22, align 4
  br label %301

300:                                              ; preds = %288
  store i32 0, ptr %22, align 4
  br label %301

301:                                              ; preds = %300, %293, %282
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #9
  %302 = load i32, ptr %22, align 4
  switch i32 %302, label %306 [
    i32 0, label %303
    i32 12, label %234
    i32 11, label %304
  ]

303:                                              ; preds = %301
  br label %266

304:                                              ; preds = %301, %238, %226, %211
  %305 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %305, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %306

306:                                              ; preds = %304, %301, %264, %255, %206, %193, %174, %162, %155, %148, %129, %123, %48, %34
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 1600, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 63176, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 568, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  %307 = load i32, ptr %3, align 4
  ret i32 %307
}

; 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 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #5

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #7

declare i32 @tls_socket_lib_init() #6

declare i32 @tls_ctx_init(ptr noundef, i32 noundef, i32 noundef) #6

declare i32 @tls_ctx_set_cipher_suites(ptr noundef, ptr noundef, i64 noundef) #6

declare i32 @tls_ctx_set_certificate_and_key(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #6

declare i32 @tls_ctx_set_ca_certificates(ptr noundef, ptr noundef, i32 noundef) #6

declare i32 @tls_socket_create(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) #8

declare i32 @tls_socket_bind(i32 noundef, ptr noundef) #6

declare i32 @puts(ptr noundef) #6

declare i32 @tls_socket_listen(i32 noundef, i32 noundef) #6

declare i32 @tls_socket_accept(i32 noundef, ptr noundef, ptr noundef) #6

declare i32 @tls_init(ptr noundef, ptr noundef) #6

declare i32 @tls_set_socket(ptr noundef, i32 noundef) #6

declare i32 @tls_do_handshake(ptr noundef) #6

declare i32 @tls_recv(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #6

declare void @tls_cleanup(ptr noundef) #6

declare i32 @tls_send(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #6

declare i32 @close(i32 noundef) #6

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !17, i64 0}
!16 = !{!"sockaddr_in", !17, i64 0, !17, i64 2, !18, i64 4, !7, i64 8}
!17 = !{!"short", !7, i64 0}
!18 = !{!"in_addr", !6, i64 0}
!19 = !{!16, !6, i64 4}
!20 = !{!16, !17, i64 2}
!21 = distinct !{!21, !14}
!22 = !{!23, !6, i64 272}
!23 = !{!"", !6, i64 0, !6, i64 4, !7, i64 8, !12, i64 264, !6, i64 272, !7, i64 276, !12, i64 18720, !7, i64 18728, !7, i64 37165, !10, i64 55608, !12, i64 55616, !6, i64 55624, !7, i64 55628, !12, i64 55664, !7, i64 55672, !12, i64 57720, !7, i64 57728, !12, i64 59776, !7, i64 59784, !12, i64 61832, !24, i64 61840, !24, i64 61968, !6, i64 62096, !7, i64 62100, !7, i64 62148, !26, i64 62248, !26, i64 62424, !28, i64 62600, !28, i64 62728, !7, i64 62856, !7, i64 62864, !7, i64 62872, !7, i64 62884, !29, i64 62896, !29, i64 63032, !6, i64 63168}
!24 = !{!"", !25, i64 0, !7, i64 96}
!25 = !{!"", !7, i64 0, !7, i64 32, !7, i64 64}
!26 = !{!"", !27, i64 0, !7, i64 112}
!27 = !{!"", !7, i64 0, !12, i64 32, !7, i64 40, !12, i64 104}
!28 = !{!"", !7, i64 0}
!29 = !{!"BLOCK_CIPHER_KEY", !7, i64 0, !10, i64 128}


; 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.TLS_CTX = type { i32, i32, [64 x i32], i64, ptr, i64, ptr, i64, %struct.SM2_KEY, %struct.SM2_KEY, i32, i32 }
%struct.SM2_KEY = type { %struct.SM2_Z256_POINT, [4 x i64] }
%struct.SM2_Z256_POINT = type { [4 x i64], [4 x i64], [4 x i64] }
%struct.TLS_CONNECT = type { i32, i32, [64 x i32], i64, i32, [18437 x i8], i64, [18437 x i8], [18437 x i8], ptr, i64, i32, [32 x i8], i64, [2048 x i8], i64, [2048 x i8], i64, [2048 x i8], i64, %struct.SM2_KEY, %struct.SM2_KEY, i32, [48 x i8], [96 x i8], %struct.SM3_HMAC_CTX, %struct.SM3_HMAC_CTX, %struct.SM4_KEY, %struct.SM4_KEY, [8 x i8], [8 x i8], [12 x i8], [12 x i8], %struct.BLOCK_CIPHER_KEY, %struct.BLOCK_CIPHER_KEY, i32 }
%struct.SM3_HMAC_CTX = type { %struct.SM3_CTX, [64 x i8] }
%struct.SM3_CTX = type { [8 x i32], i64, [64 x i8], i64 }
%struct.SM4_KEY = type { [32 x i32] }
%struct.BLOCK_CIPHER_KEY = type { %union.anon, ptr }
%union.anon = type { %struct.SM4_KEY }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }

@__const.tls12_server_main.server_ciphers = external hidden unnamed_addr constant [1 x i32], align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@options = external hidden local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [68 x i8], align 1
@__FUNCTION__.tls12_server_main = external hidden unnamed_addr constant [18 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @tls12_server_main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca [1 x i32], align 4
  %4 = alloca %struct.TLS_CTX, align 8
  %5 = alloca %struct.TLS_CONNECT, align 8
  %6 = alloca [1600 x i8], align 16
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct.sockaddr_in, align 4
  %11 = alloca %struct.sockaddr_in, align 4
  %12 = alloca i64, align 8
  %13 = load ptr, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %14 = load i32, ptr @__const.tls12_server_main.server_ciphers, align 4
  store i32 %14, ptr %3, align 4
  call void @llvm.lifetime.start.p0(i64 568, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 63176, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %6) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600) %6, i8 0, i64 1600, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  store i64 1600, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #8
  %15 = icmp slt i32 %0, 2
  br i1 %15, label %17, label %.preheader96.preheader

.preheader96.preheader:                           ; preds = %2
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  br label %.preheader96

17:                                               ; preds = %2
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = load ptr, ptr @options, align 8, !tbaa !5
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str, ptr noundef %13, ptr noundef %19) #9
  br label %.loopexit

.preheader96:                                     ; preds = %.preheader96.preheader, %68
  %.051123 = phi ptr [ %.1, %68 ], [ null, %.preheader96.preheader ]
  %.052122 = phi ptr [ %.153, %68 ], [ null, %.preheader96.preheader ]
  %.054121 = phi ptr [ %.155, %68 ], [ null, %.preheader96.preheader ]
  %.056120 = phi ptr [ %.157, %68 ], [ null, %.preheader96.preheader ]
  %.058119 = phi i32 [ %.159, %68 ], [ 443, %.preheader96.preheader ]
  %.060.in118 = phi i32 [ %.161, %68 ], [ %0, %.preheader96.preheader ]
  %.062117 = phi ptr [ %69, %68 ], [ %16, %.preheader96.preheader ]
  %21 = load ptr, ptr %.062117, align 8, !tbaa !5
  %22 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.1) #10
  %.not88 = icmp eq i32 %22, 0
  br i1 %.not88, label %23, label %26

23:                                               ; preds = %.preheader96
  %24 = load ptr, ptr @options, align 8, !tbaa !5
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %13, ptr noundef %24)
  br label %.loopexit

26:                                               ; preds = %.preheader96
  %27 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.2) #10
  %.not89 = icmp eq i32 %27, 0
  br i1 %.not89, label %28, label %34

28:                                               ; preds = %26
  %29 = icmp eq i32 %.060.in118, 2
  br i1 %29, label %65, label %30

30:                                               ; preds = %28
  %31 = getelementptr inbounds i8, ptr %.062117, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = tail call i32 @atoi(ptr nocapture noundef %32) #10
  br label %68

34:                                               ; preds = %26
  %35 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.3) #10
  %.not90 = icmp eq i32 %35, 0
  br i1 %.not90, label %36, label %41

36:                                               ; preds = %34
  %37 = icmp eq i32 %.060.in118, 2
  br i1 %37, label %65, label %38

38:                                               ; preds = %36
  %39 = getelementptr inbounds i8, ptr %.062117, i64 8
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  br label %68

41:                                               ; preds = %34
  %42 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.4) #10
  %.not91 = icmp eq i32 %42, 0
  br i1 %.not91, label %43, label %48

43:                                               ; preds = %41
  %44 = icmp eq i32 %.060.in118, 2
  br i1 %44, label %65, label %45

45:                                               ; preds = %43
  %46 = getelementptr inbounds i8, ptr %.062117, i64 8
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  br label %68

48:                                               ; preds = %41
  %49 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.5) #10
  %.not92 = icmp eq i32 %49, 0
  br i1 %.not92, label %50, label %55

50:                                               ; preds = %48
  %51 = icmp eq i32 %.060.in118, 2
  br i1 %51, label %65, label %52

52:                                               ; preds = %50
  %53 = getelementptr inbounds i8, ptr %.062117, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  br label %68

55:                                               ; preds = %48
  %56 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.6) #10
  %.not93 = icmp eq i32 %56, 0
  br i1 %.not93, label %57, label %62

57:                                               ; preds = %55
  %58 = icmp eq i32 %.060.in118, 2
  br i1 %58, label %65, label %59

59:                                               ; preds = %57
  %60 = getelementptr inbounds i8, ptr %.062117, i64 8
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  br label %68

62:                                               ; preds = %55
  %63 = load ptr, ptr @stderr, align 8, !tbaa !5
  %64 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef nonnull @.str.7, ptr noundef %13, ptr noundef %21) #9
  br label %.loopexit

65:                                               ; preds = %57, %50, %43, %36, %28
  %66 = load ptr, ptr @stderr, align 8, !tbaa !5
  %67 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef nonnull @.str.8, ptr noundef %13, ptr noundef %21) #9
  br label %.loopexit

68:                                               ; preds = %30, %45, %59, %52, %38
  %.159 = phi i32 [ %.058119, %59 ], [ %.058119, %52 ], [ %.058119, %45 ], [ %.058119, %38 ], [ %33, %30 ]
  %.157 = phi ptr [ %.056120, %59 ], [ %.056120, %52 ], [ %.056120, %45 ], [ %40, %38 ], [ %.056120, %30 ]
  %.155 = phi ptr [ %.054121, %59 ], [ %.054121, %52 ], [ %47, %45 ], [ %.054121, %38 ], [ %.054121, %30 ]
  %.153 = phi ptr [ %.052122, %59 ], [ %54, %52 ], [ %.052122, %45 ], [ %.052122, %38 ], [ %.052122, %30 ]
  %.1 = phi ptr [ %61, %59 ], [ %.051123, %52 ], [ %.051123, %45 ], [ %.051123, %38 ], [ %.051123, %30 ]
  %.161 = add nsw i32 %.060.in118, -2
  %69 = getelementptr inbounds i8, ptr %.062117, i64 16
  %70 = icmp sgt i32 %.060.in118, 3
  br i1 %70, label %.preheader96, label %71, !llvm.loop !11

71:                                               ; preds = %68
  %.not = icmp eq ptr %.157, null
  br i1 %.not, label %72, label %75

72:                                               ; preds = %71
  %73 = load ptr, ptr @stderr, align 8, !tbaa !5
  %74 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef nonnull @.str.9, ptr noundef %13) #9
  br label %.loopexit

75:                                               ; preds = %71
  %.not71 = icmp eq ptr %.155, null
  br i1 %.not71, label %76, label %79

76:                                               ; preds = %75
  %77 = load ptr, ptr @stderr, align 8, !tbaa !5
  %78 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.10, ptr noundef %13) #9
  br label %.loopexit

79:                                               ; preds = %75
  %.not72 = icmp eq ptr %.153, null
  br i1 %.not72, label %80, label %83

80:                                               ; preds = %79
  %81 = load ptr, ptr @stderr, align 8, !tbaa !5
  %82 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef nonnull @.str.11, ptr noundef %13) #9
  br label %.loopexit

83:                                               ; preds = %79
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(568) %4, i8 0, i64 568, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(63176) %5, i8 0, i64 63176, i1 false)
  %84 = tail call i32 @tls_socket_lib_init() #8
  %.not73 = icmp eq i32 %84, 1
  br i1 %.not73, label %88, label %85

85:                                               ; preds = %83
  %86 = load ptr, ptr @stderr, align 8, !tbaa !5
  %87 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.13, i32 noundef 98, ptr noundef nonnull @__FUNCTION__.tls12_server_main) #9
  br label %.loopexit

88:                                               ; preds = %83
  %89 = call i32 @tls_ctx_init(ptr noundef nonnull %4, i32 noundef 771, i32 noundef 0) #8
  %.not74 = icmp eq i32 %89, 1
  br i1 %.not74, label %90, label %94

90:                                               ; preds = %88
  %91 = call i32 @tls_ctx_set_cipher_suites(ptr noundef nonnull %4, ptr noundef nonnull %3, i64 noundef 1) #8
  %.not75 = icmp eq i32 %91, 1
  br i1 %.not75, label %92, label %94

92:                                               ; preds = %90
  %93 = call i32 @tls_ctx_set_certificate_and_key(ptr noundef nonnull %4, ptr noundef nonnull %.157, ptr noundef nonnull %.155, ptr noundef nonnull %.153) #8
  %.not76 = icmp eq i32 %93, 1
  br i1 %.not76, label %97, label %94

94:                                               ; preds = %88, %90, %92
  %95 = load ptr, ptr @stderr, align 8, !tbaa !5
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.13, i32 noundef 105, ptr noundef nonnull @__FUNCTION__.tls12_server_main) #9
  br label %.loopexit

97:                                               ; preds = %92
  %.not77 = icmp eq ptr %.1, null
  br i1 %.not77, label %103, label %98

98:                                               ; preds = %97
  %99 = call i32 @tls_ctx_set_ca_certificates(ptr noundef nonnull %4, ptr noundef nonnull %.1, i32 noundef 4) #8
  %.not78 = icmp eq i32 %99, 1
  br i1 %.not78, label %103, label %100

100:                                              ; preds = %98
  %101 = load ptr, ptr @stderr, align 8, !tbaa !5
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.13, i32 noundef 110, ptr noundef nonnull @__FUNCTION__.tls12_server_main) #9
  br label %.loopexit

103:                                              ; preds = %98, %97
  %104 = call i32 @tls_socket_create(ptr noundef nonnull %8, i32 noundef 2, i32 noundef 1, i32 noundef 0) #8
  %.not79 = icmp eq i32 %104, 1
  br i1 %.not79, label %108, label %105

105:                                              ; preds = %103
  %106 = load ptr, ptr @stderr, align 8, !tbaa !5
  %107 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef nonnull @.str.14, ptr noundef %13) #9
  br label %.loopexit

108:                                              ; preds = %103
  store i16 2, ptr %10, align 4, !tbaa !13
  %109 = getelementptr inbounds i8, ptr %10, i64 4
  store i32 0, ptr %109, align 4, !tbaa !18
  %110 = trunc i32 %.159 to i16
  %111 = call zeroext i16 @__bswap_16(i16 noundef zeroext %110)
  %112 = getelementptr inbounds i8, ptr %10, i64 2
  store i16 %111, ptr %112, align 2, !tbaa !19
  %113 = load i32, ptr %8, align 4, !tbaa !20
  %114 = call i32 @tls_socket_bind(i32 noundef %113, ptr noundef nonnull %10) #8
  %.not80 = icmp eq i32 %114, 1
  br i1 %.not80, label %118, label %115

115:                                              ; preds = %108
  %116 = load ptr, ptr @stderr, align 8, !tbaa !5
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %116, ptr noundef nonnull @.str.15, ptr noundef %13) #9
  br label %.loopexit

118:                                              ; preds = %108
  %119 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.16)
  %120 = load i32, ptr %8, align 4, !tbaa !20
  %121 = call i32 @tls_socket_listen(i32 noundef %120, i32 noundef 1) #8
  %122 = load i32, ptr %8, align 4, !tbaa !20
  %123 = call i32 @tls_socket_accept(i32 noundef %122, ptr noundef nonnull %11, ptr noundef nonnull %9) #8
  %.not81124 = icmp eq i32 %123, 1
  br i1 %.not81124, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.loopexit95, %118
  %124 = load ptr, ptr @stderr, align 8, !tbaa !5
  %125 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %124, ptr noundef nonnull @.str.17, ptr noundef %13) #9
  br label %.loopexit

.lr.ph:                                           ; preds = %118, %.loopexit95
  %126 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.18)
  %127 = call i32 @tls_init(ptr noundef nonnull %5, ptr noundef nonnull %4) #8
  %.not82 = icmp eq i32 %127, 1
  br i1 %.not82, label %128, label %131

128:                                              ; preds = %.lr.ph
  %129 = load i32, ptr %9, align 4, !tbaa !20
  %130 = call i32 @tls_set_socket(ptr noundef nonnull %5, i32 noundef %129) #8
  %.not83 = icmp eq i32 %130, 1
  br i1 %.not83, label %134, label %131

131:                                              ; preds = %.lr.ph, %128
  %132 = load ptr, ptr @stderr, align 8, !tbaa !5
  %133 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %132, ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.13, i32 noundef 146, ptr noundef nonnull @__FUNCTION__.tls12_server_main) #9
  br label %.loopexit

134:                                              ; preds = %128
  %135 = call i32 @tls_do_handshake(ptr noundef nonnull %5) #8
  %.not84 = icmp eq i32 %135, 1
  br i1 %.not84, label %.preheader, label %136

136:                                              ; preds = %134
  %137 = load ptr, ptr @stderr, align 8, !tbaa !5
  %138 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %137, ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.13, i32 noundef 151, ptr noundef nonnull @__FUNCTION__.tls12_server_main) #9
  br label %.loopexit

.preheader:                                       ; preds = %134, %155
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #8
  br label %139

139:                                              ; preds = %146, %.preheader
  store i64 1600, ptr %7, align 8, !tbaa !9
  %140 = call i32 @tls_recv(ptr noundef nonnull %5, ptr noundef nonnull %6, i64 noundef 1600, ptr noundef nonnull %7) #8
  %.not85 = icmp eq i32 %140, 1
  br i1 %.not85, label %146, label %.loopexit95

.loopexit95:                                      ; preds = %139
  %141 = icmp slt i32 %140, 0
  %.str.19..str.20 = select i1 %141, ptr @.str.19, ptr @.str.20
  %142 = load ptr, ptr @stderr, align 8, !tbaa !5
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %142, ptr noundef nonnull %.str.19..str.20, ptr noundef %13) #9
  call void @tls_cleanup(ptr noundef nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  %144 = load i32, ptr %8, align 4, !tbaa !20
  %145 = call i32 @tls_socket_accept(i32 noundef %144, ptr noundef nonnull %11, ptr noundef nonnull %9) #8
  %.not81 = icmp eq i32 %145, 1
  br i1 %.not81, label %.lr.ph, label %._crit_edge

146:                                              ; preds = %139
  %147 = load i64, ptr %7, align 8, !tbaa !9
  %.not86 = icmp eq i64 %147, 0
  br i1 %.not86, label %139, label %148, !llvm.loop !21

148:                                              ; preds = %146
  %149 = call i32 @tls_send(ptr noundef nonnull %5, ptr noundef nonnull %6, i64 noundef %147, ptr noundef nonnull %12) #8
  %.not87 = icmp eq i32 %149, 1
  br i1 %.not87, label %155, label %.thread

.thread:                                          ; preds = %148
  %150 = load ptr, ptr @stderr, align 8, !tbaa !5
  %151 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %150, ptr noundef nonnull @.str.21, ptr noundef %13) #9
  %152 = getelementptr inbounds i8, ptr %5, i64 272
  %153 = load i32, ptr %152, align 8, !tbaa !22
  %154 = call i32 @close(i32 noundef %153) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  br label %.loopexit

155:                                              ; preds = %148
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  br label %.preheader

.loopexit:                                        ; preds = %.thread, %105, %115, %._crit_edge, %136, %131, %100, %94, %85, %80, %76, %72, %65, %62, %23, %17
  %.0 = phi i32 [ 1, %17 ], [ 1, %62 ], [ 1, %65 ], [ 0, %23 ], [ -1, %85 ], [ -1, %94 ], [ -1, %100 ], [ -1, %131 ], [ -1, %136 ], [ 1, %80 ], [ 1, %76 ], [ 1, %72 ], [ 1, %._crit_edge ], [ 1, %115 ], [ 1, %105 ], [ 1, %.thread ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 63176, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 568, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  ret i32 %.0
}

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #5

declare i32 @tls_socket_lib_init() local_unnamed_addr #6

declare i32 @tls_ctx_init(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #6

declare i32 @tls_ctx_set_cipher_suites(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #6

declare i32 @tls_ctx_set_certificate_and_key(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

declare i32 @tls_ctx_set_ca_certificates(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #6

declare i32 @tls_socket_create(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) local_unnamed_addr #7

declare i32 @tls_socket_bind(i32 noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3

declare i32 @tls_socket_listen(i32 noundef, i32 noundef) local_unnamed_addr #6

declare i32 @tls_socket_accept(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

declare i32 @tls_init(ptr noundef, ptr noundef) local_unnamed_addr #6

declare i32 @tls_set_socket(ptr noundef, i32 noundef) local_unnamed_addr #6

declare i32 @tls_do_handshake(ptr noundef) local_unnamed_addr #6

declare i32 @tls_recv(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #6

declare void @tls_cleanup(ptr noundef) local_unnamed_addr #6

declare i32 @tls_send(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #6

declare i32 @close(i32 noundef) local_unnamed_addr #6

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #6 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { inlinehint 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 #8 = { nounwind }
attributes #9 = { cold nounwind }
attributes #10 = { nounwind willreturn memory(read) }

!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 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !15, i64 0}
!14 = !{!"sockaddr_in", !15, i64 0, !15, i64 2, !16, i64 4, !7, i64 8}
!15 = !{!"short", !7, i64 0}
!16 = !{!"in_addr", !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!14, !17, i64 4}
!19 = !{!14, !15, i64 2}
!20 = !{!17, !17, i64 0}
!21 = distinct !{!21, !12}
!22 = !{!23, !17, i64 272}
!23 = !{!"", !17, i64 0, !17, i64 4, !7, i64 8, !10, i64 264, !17, i64 272, !7, i64 276, !10, i64 18720, !7, i64 18728, !7, i64 37165, !6, i64 55608, !10, i64 55616, !17, i64 55624, !7, i64 55628, !10, i64 55664, !7, i64 55672, !10, i64 57720, !7, i64 57728, !10, i64 59776, !7, i64 59784, !10, i64 61832, !24, i64 61840, !24, i64 61968, !17, i64 62096, !7, i64 62100, !7, i64 62148, !26, i64 62248, !26, i64 62424, !28, i64 62600, !28, i64 62728, !7, i64 62856, !7, i64 62864, !7, i64 62872, !7, i64 62884, !29, i64 62896, !29, i64 63032, !17, i64 63168}
!24 = !{!"", !25, i64 0, !7, i64 96}
!25 = !{!"", !7, i64 0, !7, i64 32, !7, i64 64}
!26 = !{!"", !27, i64 0, !7, i64 112}
!27 = !{!"", !7, i64 0, !10, i64 32, !7, i64 40, !10, i64 104}
!28 = !{!"", !7, i64 0}
!29 = !{!"BLOCK_CIPHER_KEY", !7, i64 0, !6, i64 128}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass