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

; 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.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%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.fd_set = type { [16 x i64] }
%struct.hostent = type { ptr, ptr, i32, i32, ptr }

@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 [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [68 x i8], align 1
@__FUNCTION__.tls12_client_main = external hidden unnamed_addr constant [18 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [26 x i8], align 1
@client_ciphers = external hidden global [1 x i32], align 4
@.str.15 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [11 x i8], align 1
@stdin = external global ptr, align 8
@.str.17 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [19 x i8], align 1
@stdout = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @tls12_client_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 ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %struct.sockaddr_in, align 4
  %16 = alloca i32, align 4
  %17 = alloca %struct.TLS_CTX, align 8
  %18 = alloca %struct.TLS_CONNECT, align 8
  %19 = alloca [1024 x i8], align 16
  %20 = alloca i64, align 8
  %21 = alloca [1024 x i8], align 16
  %22 = alloca i32, align 4
  %23 = alloca %struct.fd_set, align 8
  %24 = alloca i64, align 8
  %25 = alloca i32, align 4
  %26 = alloca ptr, 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
  %27 = load ptr, ptr %5, align 8, !tbaa !9
  %28 = getelementptr inbounds ptr, ptr %27, i64 0
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  store ptr %29, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  store ptr null, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 443, ptr %9, align 4, !tbaa !5
  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 8, ptr %13) #9
  store ptr null, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 -1, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 568, ptr %17) #9
  call void @llvm.lifetime.start.p0(i64 63176, ptr %18) #9
  call void @llvm.lifetime.start.p0(i64 1024, ptr %19) #9
  call void @llvm.memset.p0.i64(ptr align 16 %19, i8 0, i64 1024, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  store i64 1024, ptr %20, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1024, ptr %21) #9
  call void @llvm.memset.p0.i64(ptr align 16 %21, i8 0, i64 1024, i1 false)
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = add nsw i32 %30, -1
  store i32 %31, ptr %4, align 4, !tbaa !5
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %32, i32 1
  store ptr %33, ptr %5, align 8, !tbaa !9
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = icmp slt i32 %34, 1
  br i1 %35, label %36, label %41

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

41:                                               ; preds = %2
  br label %42

42:                                               ; preds = %157, %41
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = icmp sge i32 %43, 1
  br i1 %44, label %45, label %162

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

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

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

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

63:                                               ; preds = %59
  br label %145

64:                                               ; preds = %59
  %65 = load ptr, ptr %5, align 8, !tbaa !9
  %66 = getelementptr inbounds ptr, ptr %65, i32 1
  store ptr %66, ptr %5, align 8, !tbaa !9
  %67 = load ptr, ptr %66, align 8, !tbaa !9
  store ptr %67, ptr %8, align 8, !tbaa !9
  br label %156

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

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

77:                                               ; preds = %73
  br label %145

78:                                               ; preds = %73
  %79 = load ptr, ptr %5, align 8, !tbaa !9
  %80 = getelementptr inbounds ptr, ptr %79, i32 1
  store ptr %80, ptr %5, align 8, !tbaa !9
  %81 = load ptr, ptr %80, align 8, !tbaa !9
  %82 = call i32 @atoi(ptr noundef %81) #10
  store i32 %82, ptr %9, align 4, !tbaa !5
  br label %155

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

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

92:                                               ; preds = %88
  br label %145

93:                                               ; preds = %88
  %94 = load ptr, ptr %5, align 8, !tbaa !9
  %95 = getelementptr inbounds ptr, ptr %94, i32 1
  store ptr %95, ptr %5, align 8, !tbaa !9
  %96 = load ptr, ptr %95, align 8, !tbaa !9
  store ptr %96, ptr %10, align 8, !tbaa !9
  br label %154

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

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

106:                                              ; preds = %102
  br label %145

107:                                              ; preds = %102
  %108 = load ptr, ptr %5, align 8, !tbaa !9
  %109 = getelementptr inbounds ptr, ptr %108, i32 1
  store ptr %109, ptr %5, align 8, !tbaa !9
  %110 = load ptr, ptr %109, align 8, !tbaa !9
  store ptr %110, ptr %11, align 8, !tbaa !9
  br label %153

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

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

120:                                              ; preds = %116
  br label %145

121:                                              ; preds = %116
  %122 = load ptr, ptr %5, align 8, !tbaa !9
  %123 = getelementptr inbounds ptr, ptr %122, i32 1
  store ptr %123, ptr %5, align 8, !tbaa !9
  %124 = load ptr, ptr %123, align 8, !tbaa !9
  store ptr %124, ptr %12, align 8, !tbaa !9
  br label %152

125:                                              ; preds = %111
  %126 = load ptr, ptr %5, align 8, !tbaa !9
  %127 = load ptr, ptr %126, align 8, !tbaa !9
  %128 = call i32 @strcmp(ptr noundef %127, ptr noundef @.str.7) #10
  %129 = icmp ne i32 %128, 0
  br i1 %129, label %139, label %130

130:                                              ; preds = %125
  %131 = load i32, ptr %4, align 4, !tbaa !5
  %132 = add nsw i32 %131, -1
  store i32 %132, ptr %4, align 4, !tbaa !5
  %133 = icmp slt i32 %132, 1
  br i1 %133, label %134, label %135

134:                                              ; preds = %130
  br label %145

135:                                              ; preds = %130
  %136 = load ptr, ptr %5, align 8, !tbaa !9
  %137 = getelementptr inbounds ptr, ptr %136, i32 1
  store ptr %137, ptr %5, align 8, !tbaa !9
  %138 = load ptr, ptr %137, align 8, !tbaa !9
  store ptr %138, ptr %13, align 8, !tbaa !9
  br label %151

139:                                              ; preds = %125
  %140 = load ptr, ptr @stderr, align 8, !tbaa !9
  %141 = load ptr, ptr %7, align 8, !tbaa !9
  %142 = load ptr, ptr %5, align 8, !tbaa !9
  %143 = load ptr, ptr %142, align 8, !tbaa !9
  %144 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %140, ptr noundef @.str.8, ptr noundef %141, ptr noundef %143) #9
  store i32 1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %420

145:                                              ; preds = %134, %120, %106, %92, %77, %63
  %146 = load ptr, ptr @stderr, align 8, !tbaa !9
  %147 = load ptr, ptr %7, align 8, !tbaa !9
  %148 = load ptr, ptr %5, align 8, !tbaa !9
  %149 = load ptr, ptr %148, align 8, !tbaa !9
  %150 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %146, ptr noundef @.str.9, ptr noundef %147, ptr noundef %149) #9
  store i32 0, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %420

151:                                              ; preds = %135
  br label %152

152:                                              ; preds = %151, %121
  br label %153

153:                                              ; preds = %152, %107
  br label %154

154:                                              ; preds = %153, %93
  br label %155

155:                                              ; preds = %154, %78
  br label %156

156:                                              ; preds = %155, %64
  br label %157

157:                                              ; preds = %156
  %158 = load i32, ptr %4, align 4, !tbaa !5
  %159 = add nsw i32 %158, -1
  store i32 %159, ptr %4, align 4, !tbaa !5
  %160 = load ptr, ptr %5, align 8, !tbaa !9
  %161 = getelementptr inbounds ptr, ptr %160, i32 1
  store ptr %161, ptr %5, align 8, !tbaa !9
  br label %42, !llvm.loop !13

162:                                              ; preds = %42
  %163 = load ptr, ptr %8, align 8, !tbaa !9
  %164 = icmp ne ptr %163, null
  br i1 %164, label %169, label %165

165:                                              ; preds = %162
  %166 = load ptr, ptr @stderr, align 8, !tbaa !9
  %167 = load ptr, ptr %7, align 8, !tbaa !9
  %168 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %166, ptr noundef @.str.10, ptr noundef %167) #9
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %420

169:                                              ; preds = %162
  %170 = call i32 @tls_socket_lib_init()
  %171 = icmp ne i32 %170, 1
  br i1 %171, label %172, label %178

172:                                              ; preds = %169
  br label %173

173:                                              ; preds = %172
  %174 = load ptr, ptr @stderr, align 8, !tbaa !9
  %175 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %174, ptr noundef @.str.11, ptr noundef @.str.12, i32 noundef 92, ptr noundef @__FUNCTION__.tls12_client_main) #9
  br label %176

176:                                              ; preds = %173
  br label %177

177:                                              ; preds = %176
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %420

178:                                              ; preds = %169
  %179 = load ptr, ptr %8, align 8, !tbaa !9
  %180 = call ptr @gethostbyname(ptr noundef %179)
  store ptr %180, ptr %14, align 8, !tbaa !9
  %181 = icmp ne ptr %180, null
  br i1 %181, label %183, label %182

182:                                              ; preds = %178
  br label %413

183:                                              ; preds = %178
  call void @llvm.memset.p0.i64(ptr align 8 %17, i8 0, i64 568, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %18, i8 0, i64 63176, i1 false)
  %184 = getelementptr inbounds %struct.sockaddr_in, ptr %15, i32 0, i32 2
  %185 = load ptr, ptr %14, align 8, !tbaa !9
  %186 = getelementptr inbounds %struct.hostent, ptr %185, i32 0, i32 4
  %187 = load ptr, ptr %186, align 8, !tbaa !15
  %188 = getelementptr inbounds ptr, ptr %187, i64 0
  %189 = load ptr, ptr %188, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %184, ptr align 4 %189, i64 4, i1 false), !tbaa.struct !17
  %190 = getelementptr inbounds %struct.sockaddr_in, ptr %15, i32 0, i32 0
  store i16 2, ptr %190, align 4, !tbaa !18
  %191 = load i32, ptr %9, align 4, !tbaa !5
  %192 = trunc i32 %191 to i16
  %193 = call zeroext i16 @__bswap_16(i16 noundef zeroext %192)
  %194 = getelementptr inbounds %struct.sockaddr_in, ptr %15, i32 0, i32 1
  store i16 %193, ptr %194, align 2, !tbaa !22
  %195 = call i32 @tls_socket_create(ptr noundef %16, i32 noundef 2, i32 noundef 1, i32 noundef 0)
  %196 = icmp ne i32 %195, 1
  br i1 %196, label %197, label %201

197:                                              ; preds = %183
  %198 = load ptr, ptr @stderr, align 8, !tbaa !9
  %199 = load ptr, ptr %7, align 8, !tbaa !9
  %200 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %198, ptr noundef @.str.13, ptr noundef %199) #9
  br label %413

201:                                              ; preds = %183
  %202 = load i32, ptr %16, align 4, !tbaa !5
  %203 = call i32 @tls_socket_connect(i32 noundef %202, ptr noundef %15)
  %204 = icmp ne i32 %203, 1
  br i1 %204, label %205, label %209

205:                                              ; preds = %201
  %206 = load ptr, ptr @stderr, align 8, !tbaa !9
  %207 = load ptr, ptr %7, align 8, !tbaa !9
  %208 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %206, ptr noundef @.str.14, ptr noundef %207) #9
  br label %413

209:                                              ; preds = %201
  %210 = call i32 @tls_ctx_init(ptr noundef %17, i32 noundef 771, i32 noundef 1)
  %211 = icmp ne i32 %210, 1
  br i1 %211, label %215, label %212

212:                                              ; preds = %209
  %213 = call i32 @tls_ctx_set_cipher_suites(ptr noundef %17, ptr noundef @client_ciphers, i64 noundef 1)
  %214 = icmp ne i32 %213, 1
  br i1 %214, label %215, label %219

215:                                              ; preds = %212, %209
  %216 = load ptr, ptr @stderr, align 8, !tbaa !9
  %217 = load ptr, ptr %7, align 8, !tbaa !9
  %218 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %216, ptr noundef @.str.15, ptr noundef %217) #9
  br label %413

219:                                              ; preds = %212
  %220 = load ptr, ptr %10, align 8, !tbaa !9
  %221 = icmp ne ptr %220, null
  br i1 %221, label %222, label %231

222:                                              ; preds = %219
  %223 = load ptr, ptr %10, align 8, !tbaa !9
  %224 = call i32 @tls_ctx_set_ca_certificates(ptr noundef %17, ptr noundef %223, i32 noundef 4)
  %225 = icmp ne i32 %224, 1
  br i1 %225, label %226, label %230

226:                                              ; preds = %222
  %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 %413

230:                                              ; preds = %222
  br label %231

231:                                              ; preds = %230, %219
  %232 = load ptr, ptr %11, align 8, !tbaa !9
  %233 = icmp ne ptr %232, null
  br i1 %233, label %234, label %245

234:                                              ; preds = %231
  %235 = load ptr, ptr %11, align 8, !tbaa !9
  %236 = load ptr, ptr %12, align 8, !tbaa !9
  %237 = load ptr, ptr %13, align 8, !tbaa !9
  %238 = call i32 @tls_ctx_set_certificate_and_key(ptr noundef %17, ptr noundef %235, ptr noundef %236, ptr noundef %237)
  %239 = icmp ne i32 %238, 1
  br i1 %239, label %240, label %244

240:                                              ; preds = %234
  %241 = load ptr, ptr @stderr, align 8, !tbaa !9
  %242 = load ptr, ptr %7, align 8, !tbaa !9
  %243 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %241, ptr noundef @.str.15, ptr noundef %242) #9
  br label %413

244:                                              ; preds = %234
  br label %245

245:                                              ; preds = %244, %231
  %246 = call i32 @tls_init(ptr noundef %18, ptr noundef %17)
  %247 = icmp ne i32 %246, 1
  br i1 %247, label %255, label %248

248:                                              ; preds = %245
  %249 = load i32, ptr %16, align 4, !tbaa !5
  %250 = call i32 @tls_set_socket(ptr noundef %18, i32 noundef %249)
  %251 = icmp ne i32 %250, 1
  br i1 %251, label %255, label %252

252:                                              ; preds = %248
  %253 = call i32 @tls_do_handshake(ptr noundef %18)
  %254 = icmp ne i32 %253, 1
  br i1 %254, label %255, label %259

255:                                              ; preds = %252, %248, %245
  %256 = load ptr, ptr @stderr, align 8, !tbaa !9
  %257 = load ptr, ptr %7, align 8, !tbaa !9
  %258 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %256, ptr noundef @.str.16, ptr noundef %257) #9
  br label %413

259:                                              ; preds = %252
  br label %260

260:                                              ; preds = %412, %410, %259
  call void @llvm.lifetime.start.p0(i64 128, ptr %23) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #9
  %261 = getelementptr inbounds [1024 x i8], ptr %21, i64 0, i64 0
  %262 = load ptr, ptr @stdin, align 8, !tbaa !9
  %263 = call ptr @fgets(ptr noundef %261, i32 noundef 1024, ptr noundef %262)
  %264 = icmp ne ptr %263, null
  br i1 %264, label %272, label %265

265:                                              ; preds = %260
  %266 = load ptr, ptr @stdin, align 8, !tbaa !9
  %267 = call i32 @feof(ptr noundef %266) #9
  %268 = icmp ne i32 %267, 0
  br i1 %268, label %269, label %271

269:                                              ; preds = %265
  %270 = call i32 @tls_shutdown(ptr noundef %18)
  store i32 7, ptr %22, align 4
  br label %410

271:                                              ; preds = %265
  store i32 9, ptr %22, align 4
  br label %410

272:                                              ; preds = %260
  %273 = getelementptr inbounds [1024 x i8], ptr %21, i64 0, i64 0
  %274 = getelementptr inbounds [1024 x i8], ptr %21, i64 0, i64 0
  %275 = call i64 @strlen(ptr noundef %274) #10
  %276 = call i32 @tls_send(ptr noundef %18, ptr noundef %273, i64 noundef %275, ptr noundef %24)
  %277 = icmp ne i32 %276, 1
  br i1 %277, label %278, label %282

278:                                              ; preds = %272
  %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.17, ptr noundef %280) #9
  store i32 7, ptr %22, align 4
  br label %410

282:                                              ; preds = %272
  br label %283

283:                                              ; preds = %282
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #9
  store ptr %23, ptr %26, align 8, !tbaa !9
  store i32 0, ptr %25, align 4, !tbaa !5
  br label %284

284:                                              ; preds = %294, %283
  %285 = load i32, ptr %25, align 4, !tbaa !5
  %286 = zext i32 %285 to i64
  %287 = icmp ult i64 %286, 16
  br i1 %287, label %288, label %297

288:                                              ; preds = %284
  %289 = load ptr, ptr %26, align 8, !tbaa !9
  %290 = getelementptr inbounds %struct.fd_set, ptr %289, i32 0, i32 0
  %291 = load i32, ptr %25, align 4, !tbaa !5
  %292 = zext i32 %291 to i64
  %293 = getelementptr inbounds [16 x i64], ptr %290, i64 0, i64 %292
  store i64 0, ptr %293, align 8, !tbaa !11
  br label %294

294:                                              ; preds = %288
  %295 = load i32, ptr %25, align 4, !tbaa !5
  %296 = add i32 %295, 1
  store i32 %296, ptr %25, align 4, !tbaa !5
  br label %284, !llvm.loop !23

297:                                              ; preds = %284
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  br label %298

298:                                              ; preds = %297
  br label %299

299:                                              ; preds = %298
  %300 = getelementptr inbounds %struct.TLS_CONNECT, ptr %18, i32 0, i32 4
  %301 = load i32, ptr %300, align 8, !tbaa !24
  %302 = srem i32 %301, 64
  %303 = zext i32 %302 to i64
  %304 = shl i64 1, %303
  %305 = getelementptr inbounds %struct.fd_set, ptr %23, i32 0, i32 0
  %306 = getelementptr inbounds %struct.TLS_CONNECT, ptr %18, i32 0, i32 4
  %307 = load i32, ptr %306, align 8, !tbaa !24
  %308 = sdiv i32 %307, 64
  %309 = sext i32 %308 to i64
  %310 = getelementptr inbounds [16 x i64], ptr %305, i64 0, i64 %309
  %311 = load i64, ptr %310, align 8, !tbaa !11
  %312 = or i64 %311, %304
  store i64 %312, ptr %310, align 8, !tbaa !11
  %313 = load ptr, ptr @stdin, align 8, !tbaa !9
  %314 = call i32 @fileno(ptr noundef %313) #9
  %315 = srem i32 %314, 64
  %316 = zext i32 %315 to i64
  %317 = shl i64 1, %316
  %318 = getelementptr inbounds %struct.fd_set, ptr %23, i32 0, i32 0
  %319 = load ptr, ptr @stdin, align 8, !tbaa !9
  %320 = call i32 @fileno(ptr noundef %319) #9
  %321 = sdiv i32 %320, 64
  %322 = sext i32 %321 to i64
  %323 = getelementptr inbounds [16 x i64], ptr %318, i64 0, i64 %322
  %324 = load i64, ptr %323, align 8, !tbaa !11
  %325 = or i64 %324, %317
  store i64 %325, ptr %323, align 8, !tbaa !11
  %326 = getelementptr inbounds %struct.TLS_CONNECT, ptr %18, i32 0, i32 4
  %327 = load i32, ptr %326, align 8, !tbaa !24
  %328 = add nsw i32 %327, 1
  %329 = call i32 @select(i32 noundef %328, ptr noundef %23, ptr noundef null, ptr noundef null, ptr noundef null)
  %330 = icmp slt i32 %329, 0
  br i1 %330, label %331, label %335

331:                                              ; preds = %299
  %332 = load ptr, ptr @stderr, align 8, !tbaa !9
  %333 = load ptr, ptr %7, align 8, !tbaa !9
  %334 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %332, ptr noundef @.str.18, ptr noundef %333) #9
  store i32 7, ptr %22, align 4
  br label %410

335:                                              ; preds = %299
  %336 = getelementptr inbounds %struct.fd_set, ptr %23, i32 0, i32 0
  %337 = getelementptr inbounds %struct.TLS_CONNECT, ptr %18, i32 0, i32 4
  %338 = load i32, ptr %337, align 8, !tbaa !24
  %339 = sdiv i32 %338, 64
  %340 = sext i32 %339 to i64
  %341 = getelementptr inbounds [16 x i64], ptr %336, i64 0, i64 %340
  %342 = load i64, ptr %341, align 8, !tbaa !11
  %343 = getelementptr inbounds %struct.TLS_CONNECT, ptr %18, i32 0, i32 4
  %344 = load i32, ptr %343, align 8, !tbaa !24
  %345 = srem i32 %344, 64
  %346 = zext i32 %345 to i64
  %347 = shl i64 1, %346
  %348 = and i64 %342, %347
  %349 = icmp ne i64 %348, 0
  br i1 %349, label %350, label %370

350:                                              ; preds = %335
  br label %351

351:                                              ; preds = %368, %350
  %352 = getelementptr inbounds [1024 x i8], ptr %19, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %352, i8 0, i64 1024, i1 false)
  %353 = getelementptr inbounds [1024 x i8], ptr %19, i64 0, i64 0
  %354 = call i32 @tls_recv(ptr noundef %18, ptr noundef %353, i64 noundef 1024, ptr noundef %20)
  %355 = icmp ne i32 %354, 1
  br i1 %355, label %356, label %357

356:                                              ; preds = %351
  store i32 7, ptr %22, align 4
  br label %410

357:                                              ; preds = %351
  %358 = getelementptr inbounds [1024 x i8], ptr %19, i64 0, i64 0
  %359 = load i64, ptr %20, align 8, !tbaa !11
  %360 = load ptr, ptr @stdout, align 8, !tbaa !9
  %361 = call i64 @fwrite(ptr noundef %358, i64 noundef 1, i64 noundef %359, ptr noundef %360)
  %362 = load ptr, ptr @stdout, align 8, !tbaa !9
  %363 = call i32 @fflush(ptr noundef %362)
  %364 = getelementptr inbounds %struct.TLS_CONNECT, ptr %18, i32 0, i32 10
  %365 = load i64, ptr %364, align 8, !tbaa !32
  %366 = icmp eq i64 %365, 0
  br i1 %366, label %367, label %368

367:                                              ; preds = %357
  br label %369

368:                                              ; preds = %357
  br label %351

369:                                              ; preds = %367
  br label %370

370:                                              ; preds = %369, %335
  %371 = getelementptr inbounds %struct.fd_set, ptr %23, i32 0, i32 0
  %372 = load ptr, ptr @stdin, align 8, !tbaa !9
  %373 = call i32 @fileno(ptr noundef %372) #9
  %374 = sdiv i32 %373, 64
  %375 = sext i32 %374 to i64
  %376 = getelementptr inbounds [16 x i64], ptr %371, i64 0, i64 %375
  %377 = load i64, ptr %376, align 8, !tbaa !11
  %378 = load ptr, ptr @stdin, align 8, !tbaa !9
  %379 = call i32 @fileno(ptr noundef %378) #9
  %380 = srem i32 %379, 64
  %381 = zext i32 %380 to i64
  %382 = shl i64 1, %381
  %383 = and i64 %377, %382
  %384 = icmp ne i64 %383, 0
  br i1 %384, label %385, label %409

385:                                              ; preds = %370
  %386 = getelementptr inbounds [1024 x i8], ptr %21, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %386, i8 0, i64 1024, i1 false)
  %387 = getelementptr inbounds [1024 x i8], ptr %21, i64 0, i64 0
  %388 = load ptr, ptr @stdin, align 8, !tbaa !9
  %389 = call ptr @fgets(ptr noundef %387, i32 noundef 1024, ptr noundef %388)
  %390 = icmp ne ptr %389, null
  br i1 %390, label %398, label %391

391:                                              ; preds = %385
  %392 = load ptr, ptr @stdin, align 8, !tbaa !9
  %393 = call i32 @feof(ptr noundef %392) #9
  %394 = icmp ne i32 %393, 0
  br i1 %394, label %395, label %397

395:                                              ; preds = %391
  %396 = call i32 @tls_shutdown(ptr noundef %18)
  store i32 7, ptr %22, align 4
  br label %410

397:                                              ; preds = %391
  store i32 9, ptr %22, align 4
  br label %410

398:                                              ; preds = %385
  %399 = getelementptr inbounds [1024 x i8], ptr %21, i64 0, i64 0
  %400 = getelementptr inbounds [1024 x i8], ptr %21, i64 0, i64 0
  %401 = call i64 @strlen(ptr noundef %400) #10
  %402 = call i32 @tls_send(ptr noundef %18, ptr noundef %399, i64 noundef %401, ptr noundef %24)
  %403 = icmp ne i32 %402, 1
  br i1 %403, label %404, label %408

404:                                              ; preds = %398
  %405 = load ptr, ptr @stderr, align 8, !tbaa !9
  %406 = load ptr, ptr %7, align 8, !tbaa !9
  %407 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %405, ptr noundef @.str.17, ptr noundef %406) #9
  store i32 7, ptr %22, align 4
  br label %410

408:                                              ; preds = %398
  br label %409

409:                                              ; preds = %408, %370
  store i32 0, ptr %22, align 4
  br label %410

410:                                              ; preds = %409, %404, %397, %395, %356, %331, %278, %271, %269
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #9
  call void @llvm.lifetime.end.p0(i64 128, ptr %23) #9
  %411 = load i32, ptr %22, align 4
  switch i32 %411, label %420 [
    i32 0, label %412
    i32 9, label %260
    i32 7, label %413
  ]

412:                                              ; preds = %410
  br label %260

413:                                              ; preds = %410, %255, %240, %226, %215, %205, %197, %182
  %414 = load i32, ptr %16, align 4, !tbaa !5
  %415 = icmp ne i32 %414, -1
  br i1 %415, label %416, label %419

416:                                              ; preds = %413
  %417 = load i32, ptr %16, align 4, !tbaa !5
  %418 = call i32 @close(i32 noundef %417)
  br label %419

419:                                              ; preds = %416, %413
  call void @tls_ctx_cleanup(ptr noundef %17)
  call void @tls_cleanup(ptr noundef %18)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %420

420:                                              ; preds = %419, %410, %177, %165, %145, %139, %50, %36
  call void @llvm.lifetime.end.p0(i64 1024, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 1024, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 63176, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 568, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 8, 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 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 8, 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
  %421 = load i32, ptr %3, align 4
  ret i32 %421
}

; 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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

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

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

declare i32 @tls_socket_lib_init() #5

declare ptr @gethostbyname(ptr noundef) #5

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

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

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

declare i32 @tls_socket_connect(i32 noundef, ptr noundef) #5

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

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

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

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

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

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

declare i32 @tls_do_handshake(ptr noundef) #5

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #5

; Function Attrs: nounwind
declare i32 @feof(ptr noundef) #3

declare i32 @tls_shutdown(ptr noundef) #5

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

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

; Function Attrs: nounwind
declare i32 @fileno(ptr noundef) #3

declare i32 @select(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #5

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

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #5

declare i32 @fflush(ptr noundef) #5

declare i32 @close(i32 noundef) #5

declare void @tls_ctx_cleanup(ptr noundef) #5

declare void @tls_cleanup(ptr noundef) #5

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: write) }
attributes #3 = { 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 = { 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 #5 = { "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 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 24}
!16 = !{!"hostent", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !10, i64 24}
!17 = !{i64 0, i64 4, !5}
!18 = !{!19, !20, i64 0}
!19 = !{!"sockaddr_in", !20, i64 0, !20, i64 2, !21, i64 4, !7, i64 8}
!20 = !{!"short", !7, i64 0}
!21 = !{!"in_addr", !6, i64 0}
!22 = !{!19, !20, i64 2}
!23 = distinct !{!23, !14}
!24 = !{!25, !6, i64 272}
!25 = !{!"", !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, !26, i64 61840, !26, i64 61968, !6, i64 62096, !7, i64 62100, !7, i64 62148, !28, i64 62248, !28, i64 62424, !30, i64 62600, !30, i64 62728, !7, i64 62856, !7, i64 62864, !7, i64 62872, !7, i64 62884, !31, i64 62896, !31, i64 63032, !6, i64 63168}
!26 = !{!"", !27, i64 0, !7, i64 96}
!27 = !{!"", !7, i64 0, !7, i64 32, !7, i64 64}
!28 = !{!"", !29, i64 0, !7, i64 112}
!29 = !{!"", !7, i64 0, !12, i64 32, !7, i64 40, !12, i64 104}
!30 = !{!"", !7, i64 0}
!31 = !{!"BLOCK_CIPHER_KEY", !7, i64 0, !10, i64 128}
!32 = !{!25, !12, i64 55616}


; 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.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%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.fd_set = type { [16 x i64] }

@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 [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [68 x i8], align 1
@__FUNCTION__.tls12_client_main = external hidden unnamed_addr constant [18 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [26 x i8], align 1
@client_ciphers = external hidden global [1 x i32], align 4
@.str.15 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [11 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.17 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [19 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8

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

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

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

.preheader117:                                    ; preds = %.preheader117.preheader, %73
  %.059.in145 = phi i32 [ %.1, %73 ], [ %0, %.preheader117.preheader ]
  %.060144 = phi ptr [ %.161, %73 ], [ null, %.preheader117.preheader ]
  %.062143 = phi ptr [ %.163, %73 ], [ null, %.preheader117.preheader ]
  %.064142 = phi ptr [ %.165, %73 ], [ null, %.preheader117.preheader ]
  %.066141 = phi ptr [ %.167, %73 ], [ null, %.preheader117.preheader ]
  %.068140 = phi i32 [ %.169, %73 ], [ 443, %.preheader117.preheader ]
  %.070139 = phi ptr [ %.171, %73 ], [ null, %.preheader117.preheader ]
  %.072138 = phi ptr [ %74, %73 ], [ %14, %.preheader117.preheader ]
  %19 = load ptr, ptr %.072138, align 8, !tbaa !5
  %20 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.1) #10
  %.not107 = icmp eq i32 %20, 0
  br i1 %.not107, label %21, label %24

21:                                               ; preds = %.preheader117
  %22 = load ptr, ptr @options, align 8, !tbaa !5
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %12, ptr noundef %22)
  br label %230

24:                                               ; preds = %.preheader117
  %25 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.2) #10
  %.not108 = icmp eq i32 %25, 0
  br i1 %.not108, label %26, label %31

26:                                               ; preds = %24
  %27 = icmp eq i32 %.059.in145, 2
  br i1 %27, label %70, label %28

28:                                               ; preds = %26
  %29 = getelementptr inbounds i8, ptr %.072138, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  br label %73

31:                                               ; preds = %24
  %32 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.3) #10
  %.not109 = icmp eq i32 %32, 0
  br i1 %.not109, label %33, label %39

33:                                               ; preds = %31
  %34 = icmp eq i32 %.059.in145, 2
  br i1 %34, label %70, label %35

35:                                               ; preds = %33
  %36 = getelementptr inbounds i8, ptr %.072138, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = tail call i32 @atoi(ptr nocapture noundef %37) #10
  br label %73

39:                                               ; preds = %31
  %40 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.4) #10
  %.not110 = icmp eq i32 %40, 0
  br i1 %.not110, label %41, label %46

41:                                               ; preds = %39
  %42 = icmp eq i32 %.059.in145, 2
  br i1 %42, label %70, label %43

43:                                               ; preds = %41
  %44 = getelementptr inbounds i8, ptr %.072138, i64 8
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  br label %73

46:                                               ; preds = %39
  %47 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.5) #10
  %.not111 = icmp eq i32 %47, 0
  br i1 %.not111, label %48, label %53

48:                                               ; preds = %46
  %49 = icmp eq i32 %.059.in145, 2
  br i1 %49, label %70, label %50

50:                                               ; preds = %48
  %51 = getelementptr inbounds i8, ptr %.072138, i64 8
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  br label %73

53:                                               ; preds = %46
  %54 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.6) #10
  %.not112 = icmp eq i32 %54, 0
  br i1 %.not112, label %55, label %60

55:                                               ; preds = %53
  %56 = icmp eq i32 %.059.in145, 2
  br i1 %56, label %70, label %57

57:                                               ; preds = %55
  %58 = getelementptr inbounds i8, ptr %.072138, i64 8
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  br label %73

60:                                               ; preds = %53
  %61 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.7) #10
  %.not113 = icmp eq i32 %61, 0
  br i1 %.not113, label %62, label %67

62:                                               ; preds = %60
  %63 = icmp eq i32 %.059.in145, 2
  br i1 %63, label %70, label %64

64:                                               ; preds = %62
  %65 = getelementptr inbounds i8, ptr %.072138, i64 8
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  br label %73

67:                                               ; preds = %60
  %68 = load ptr, ptr @stderr, align 8, !tbaa !5
  %69 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef nonnull @.str.8, ptr noundef %12, ptr noundef %19) #9
  br label %230

70:                                               ; preds = %62, %55, %48, %41, %33, %26
  %71 = load ptr, ptr @stderr, align 8, !tbaa !5
  %72 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef nonnull @.str.9, ptr noundef %12, ptr noundef %19) #9
  br label %230

73:                                               ; preds = %28, %43, %57, %64, %50, %35
  %.171 = phi ptr [ %.070139, %64 ], [ %.070139, %57 ], [ %.070139, %50 ], [ %.070139, %43 ], [ %.070139, %35 ], [ %30, %28 ]
  %.169 = phi i32 [ %.068140, %64 ], [ %.068140, %57 ], [ %.068140, %50 ], [ %.068140, %43 ], [ %38, %35 ], [ %.068140, %28 ]
  %.167 = phi ptr [ %.066141, %64 ], [ %.066141, %57 ], [ %.066141, %50 ], [ %45, %43 ], [ %.066141, %35 ], [ %.066141, %28 ]
  %.165 = phi ptr [ %.064142, %64 ], [ %.064142, %57 ], [ %52, %50 ], [ %.064142, %43 ], [ %.064142, %35 ], [ %.064142, %28 ]
  %.163 = phi ptr [ %.062143, %64 ], [ %59, %57 ], [ %.062143, %50 ], [ %.062143, %43 ], [ %.062143, %35 ], [ %.062143, %28 ]
  %.161 = phi ptr [ %66, %64 ], [ %.060144, %57 ], [ %.060144, %50 ], [ %.060144, %43 ], [ %.060144, %35 ], [ %.060144, %28 ]
  %.1 = add nsw i32 %.059.in145, -2
  %74 = getelementptr inbounds i8, ptr %.072138, i64 16
  %75 = icmp sgt i32 %.059.in145, 3
  br i1 %75, label %.preheader117, label %76, !llvm.loop !13

76:                                               ; preds = %73
  %.not = icmp eq ptr %.171, null
  br i1 %.not, label %77, label %80

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

80:                                               ; preds = %76
  %81 = tail call i32 @tls_socket_lib_init() #8
  %.not84 = icmp eq i32 %81, 1
  br i1 %.not84, label %85, label %82

82:                                               ; preds = %80
  %83 = load ptr, ptr @stderr, align 8, !tbaa !5
  %84 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %83, ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12, i32 noundef 92, ptr noundef nonnull @__FUNCTION__.tls12_client_main) #9
  br label %230

85:                                               ; preds = %80
  %86 = tail call ptr @gethostbyname(ptr noundef nonnull %.171) #8
  %.not85 = icmp eq ptr %86, null
  br i1 %.not85, label %225, label %87

87:                                               ; preds = %85
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(568) %5, i8 0, i64 568, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(63176) %6, i8 0, i64 63176, i1 false)
  %88 = getelementptr inbounds i8, ptr %3, i64 4
  %89 = getelementptr inbounds i8, ptr %86, i64 24
  %90 = load ptr, ptr %89, align 8, !tbaa !15
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = load i32, ptr %91, align 4, !tbaa !9
  store i32 %92, ptr %88, align 4, !tbaa !9
  store i16 2, ptr %3, align 4, !tbaa !17
  %93 = trunc i32 %.169 to i16
  %94 = tail call zeroext i16 @__bswap_16(i16 noundef zeroext %93)
  %95 = getelementptr inbounds i8, ptr %3, i64 2
  store i16 %94, ptr %95, align 2, !tbaa !21
  %96 = call i32 @tls_socket_create(ptr noundef nonnull %4, i32 noundef 2, i32 noundef 1, i32 noundef 0) #8
  %.not86 = icmp eq i32 %96, 1
  br i1 %.not86, label %100, label %97

97:                                               ; preds = %87
  %98 = load ptr, ptr @stderr, align 8, !tbaa !5
  %99 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef nonnull @.str.13, ptr noundef %12) #9
  br label %225

100:                                              ; preds = %87
  %101 = load i32, ptr %4, align 4, !tbaa !9
  %102 = call i32 @tls_socket_connect(i32 noundef %101, ptr noundef nonnull %3) #8
  %.not87 = icmp eq i32 %102, 1
  br i1 %.not87, label %106, label %103

103:                                              ; preds = %100
  %104 = load ptr, ptr @stderr, align 8, !tbaa !5
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %104, ptr noundef nonnull @.str.14, ptr noundef %12) #9
  br label %225

106:                                              ; preds = %100
  %107 = call i32 @tls_ctx_init(ptr noundef nonnull %5, i32 noundef 771, i32 noundef 1) #8
  %.not88 = icmp eq i32 %107, 1
  br i1 %.not88, label %108, label %110

108:                                              ; preds = %106
  %109 = call i32 @tls_ctx_set_cipher_suites(ptr noundef nonnull %5, ptr noundef nonnull @client_ciphers, i64 noundef 1) #8
  %.not89 = icmp eq i32 %109, 1
  br i1 %.not89, label %113, label %110

110:                                              ; preds = %108, %106
  %111 = load ptr, ptr @stderr, align 8, !tbaa !5
  %112 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %111, ptr noundef nonnull @.str.15, ptr noundef %12) #9
  br label %225

113:                                              ; preds = %108
  %.not90 = icmp eq ptr %.167, null
  br i1 %.not90, label %119, label %114

114:                                              ; preds = %113
  %115 = call i32 @tls_ctx_set_ca_certificates(ptr noundef nonnull %5, ptr noundef nonnull %.167, i32 noundef 4) #8
  %.not91 = icmp eq i32 %115, 1
  br i1 %.not91, label %119, label %116

116:                                              ; preds = %114
  %117 = load ptr, ptr @stderr, align 8, !tbaa !5
  %118 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %117, ptr noundef nonnull @.str.15, ptr noundef %12) #9
  br label %225

119:                                              ; preds = %114, %113
  %.not92 = icmp eq ptr %.165, null
  br i1 %.not92, label %125, label %120

120:                                              ; preds = %119
  %121 = call i32 @tls_ctx_set_certificate_and_key(ptr noundef nonnull %5, ptr noundef nonnull %.165, ptr noundef %.163, ptr noundef %.161) #8
  %.not93 = icmp eq i32 %121, 1
  br i1 %.not93, label %125, label %122

122:                                              ; preds = %120
  %123 = load ptr, ptr @stderr, align 8, !tbaa !5
  %124 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %123, ptr noundef nonnull @.str.15, ptr noundef %12) #9
  br label %225

125:                                              ; preds = %120, %119
  %126 = call i32 @tls_init(ptr noundef nonnull %6, ptr noundef nonnull %5) #8
  %.not94 = icmp eq i32 %126, 1
  br i1 %.not94, label %127, label %134

127:                                              ; preds = %125
  %128 = load i32, ptr %4, align 4, !tbaa !9
  %129 = call i32 @tls_set_socket(ptr noundef nonnull %6, i32 noundef %128) #8
  %.not95 = icmp eq i32 %129, 1
  br i1 %.not95, label %130, label %134

130:                                              ; preds = %127
  %131 = call i32 @tls_do_handshake(ptr noundef nonnull %6) #8
  %.not96 = icmp eq i32 %131, 1
  br i1 %.not96, label %.preheader116, label %134

.preheader116:                                    ; preds = %130
  %132 = getelementptr inbounds i8, ptr %6, i64 272
  %133 = getelementptr inbounds i8, ptr %6, i64 55616
  br label %137

134:                                              ; preds = %130, %127, %125
  %135 = load ptr, ptr @stderr, align 8, !tbaa !5
  %136 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef nonnull @.str.16, ptr noundef %12) #9
  br label %225

137:                                              ; preds = %.preheader116, %224
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %10) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #8
  %138 = load ptr, ptr @stdin, align 8, !tbaa !5
  %139 = call ptr @fgets(ptr noundef nonnull %9, i32 noundef 1024, ptr noundef %138)
  %.not97 = icmp eq ptr %139, null
  br i1 %.not97, label %140, label %145

140:                                              ; preds = %137
  %141 = load ptr, ptr @stdin, align 8, !tbaa !5
  %142 = call i32 @feof(ptr noundef %141) #8
  %.not98 = icmp eq i32 %142, 0
  br i1 %.not98, label %224, label %143

143:                                              ; preds = %140
  %144 = call i32 @tls_shutdown(ptr noundef nonnull %6) #8
  br label %.thread

145:                                              ; preds = %137
  %146 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %9) #10
  %147 = call i32 @tls_send(ptr noundef nonnull %6, ptr noundef nonnull %9, i64 noundef %146, ptr noundef nonnull %11) #8
  %.not99 = icmp eq i32 %147, 1
  br i1 %.not99, label %.preheader115.preheader, label %173

.preheader115.preheader:                          ; preds = %145
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %10, i8 0, i64 128, i1 false), !tbaa !11
  %148 = load i32, ptr %132, align 8, !tbaa !22
  %149 = srem i32 %148, 64
  %150 = zext nneg i32 %149 to i64
  %151 = shl nuw i64 1, %150
  %152 = sdiv i32 %148, 64
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [16 x i64], ptr %10, i64 0, i64 %153
  %155 = load i64, ptr %154, align 8, !tbaa !11
  %156 = or i64 %151, %155
  store i64 %156, ptr %154, align 8, !tbaa !11
  %157 = load ptr, ptr @stdin, align 8, !tbaa !5
  %158 = call i32 @fileno(ptr noundef %157) #8
  %159 = srem i32 %158, 64
  %160 = zext nneg i32 %159 to i64
  %161 = shl nuw i64 1, %160
  %162 = load ptr, ptr @stdin, align 8, !tbaa !5
  %163 = call i32 @fileno(ptr noundef %162) #8
  %164 = sdiv i32 %163, 64
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [16 x i64], ptr %10, i64 0, i64 %165
  %167 = load i64, ptr %166, align 8, !tbaa !11
  %168 = or i64 %167, %161
  store i64 %168, ptr %166, align 8, !tbaa !11
  %169 = load i32, ptr %132, align 8, !tbaa !22
  %170 = add nsw i32 %169, 1
  %171 = call i32 @select(i32 noundef %170, ptr noundef nonnull %10, ptr noundef null, ptr noundef null, ptr noundef null) #8
  %172 = icmp slt i32 %171, 0
  br i1 %172, label %176, label %179

173:                                              ; preds = %145
  %174 = load ptr, ptr @stderr, align 8, !tbaa !5
  %175 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %174, ptr noundef nonnull @.str.17, ptr noundef %12) #9
  br label %.thread

176:                                              ; preds = %.preheader115.preheader
  %177 = load ptr, ptr @stderr, align 8, !tbaa !5
  %178 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %177, ptr noundef nonnull @.str.18, ptr noundef %12) #9
  br label %.thread

179:                                              ; preds = %.preheader115.preheader
  %180 = load i32, ptr %132, align 8, !tbaa !22
  %181 = sdiv i32 %180, 64
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [16 x i64], ptr %10, i64 0, i64 %182
  %184 = load i64, ptr %183, align 8, !tbaa !11
  %185 = srem i32 %180, 64
  %186 = zext nneg i32 %185 to i64
  %187 = shl nuw i64 1, %186
  %188 = and i64 %187, %184
  %.not100 = icmp eq i64 %188, 0
  br i1 %.not100, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %179, %190
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %7, i8 0, i64 1024, i1 false)
  %189 = call i32 @tls_recv(ptr noundef nonnull %6, ptr noundef nonnull %7, i64 noundef 1024, ptr noundef nonnull %8) #8
  %.not101 = icmp eq i32 %189, 1
  br i1 %.not101, label %190, label %.thread

190:                                              ; preds = %.preheader
  %191 = load i64, ptr %8, align 8, !tbaa !11
  %192 = load ptr, ptr @stdout, align 8, !tbaa !5
  %193 = call i64 @fwrite(ptr noundef nonnull %7, i64 noundef 1, i64 noundef %191, ptr noundef %192)
  %194 = load ptr, ptr @stdout, align 8, !tbaa !5
  %195 = call i32 @fflush(ptr noundef %194)
  %196 = load i64, ptr %133, align 8, !tbaa !30
  %197 = icmp eq i64 %196, 0
  br i1 %197, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %190, %179
  %198 = load ptr, ptr @stdin, align 8, !tbaa !5
  %199 = call i32 @fileno(ptr noundef %198) #8
  %200 = sdiv i32 %199, 64
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [16 x i64], ptr %10, i64 0, i64 %201
  %203 = load i64, ptr %202, align 8, !tbaa !11
  %204 = load ptr, ptr @stdin, align 8, !tbaa !5
  %205 = call i32 @fileno(ptr noundef %204) #8
  %206 = srem i32 %205, 64
  %207 = zext nneg i32 %206 to i64
  %208 = shl nuw i64 1, %207
  %209 = and i64 %208, %203
  %.not102 = icmp eq i64 %209, 0
  br i1 %.not102, label %224, label %210

210:                                              ; preds = %.loopexit
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %9, i8 0, i64 1024, i1 false)
  %211 = load ptr, ptr @stdin, align 8, !tbaa !5
  %212 = call ptr @fgets(ptr noundef nonnull %9, i32 noundef 1024, ptr noundef %211)
  %.not103 = icmp eq ptr %212, null
  br i1 %.not103, label %213, label %218

213:                                              ; preds = %210
  %214 = load ptr, ptr @stdin, align 8, !tbaa !5
  %215 = call i32 @feof(ptr noundef %214) #8
  %.not104 = icmp eq i32 %215, 0
  br i1 %.not104, label %224, label %216

216:                                              ; preds = %213
  %217 = call i32 @tls_shutdown(ptr noundef nonnull %6) #8
  br label %.thread

218:                                              ; preds = %210
  %219 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %9) #10
  %220 = call i32 @tls_send(ptr noundef nonnull %6, ptr noundef nonnull %9, i64 noundef %219, ptr noundef nonnull %11) #8
  %.not105 = icmp eq i32 %220, 1
  br i1 %.not105, label %224, label %221

221:                                              ; preds = %218
  %222 = load ptr, ptr @stderr, align 8, !tbaa !5
  %223 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %222, ptr noundef nonnull @.str.17, ptr noundef %12) #9
  br label %.thread

.thread:                                          ; preds = %.preheader, %173, %176, %221, %216, %143
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %10) #8
  br label %225

224:                                              ; preds = %.loopexit, %218, %213, %140
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %10) #8
  br label %137

225:                                              ; preds = %.thread, %85, %134, %122, %116, %110, %103, %97
  %226 = load i32, ptr %4, align 4, !tbaa !9
  %.not106 = icmp eq i32 %226, -1
  br i1 %.not106, label %229, label %227

227:                                              ; preds = %225
  %228 = call i32 @close(i32 noundef %226) #8
  br label %229

229:                                              ; preds = %227, %225
  call void @tls_ctx_cleanup(ptr noundef nonnull %5) #8
  call void @tls_cleanup(ptr noundef nonnull %6) #8
  br label %230

230:                                              ; preds = %229, %82, %77, %70, %67, %21, %15
  %.0 = phi i32 [ 1, %15 ], [ 1, %67 ], [ 0, %70 ], [ 0, %21 ], [ -1, %82 ], [ 0, %229 ], [ -1, %77 ]
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 63176, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 568, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 16, 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 ptr @gethostbyname(ptr 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_create(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #6

declare i32 @tls_socket_connect(i32 noundef, ptr noundef) 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_ca_certificates(ptr noundef, ptr noundef, i32 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_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

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

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

declare i32 @tls_shutdown(ptr noundef) local_unnamed_addr #6

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

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

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

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

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

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

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

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

declare i32 @close(i32 noundef) local_unnamed_addr #6

declare void @tls_ctx_cleanup(ptr noundef) local_unnamed_addr #6

declare void @tls_cleanup(ptr noundef) local_unnamed_addr #6

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 24}
!16 = !{!"hostent", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !6, i64 24}
!17 = !{!18, !19, i64 0}
!18 = !{!"sockaddr_in", !19, i64 0, !19, i64 2, !20, i64 4, !7, i64 8}
!19 = !{!"short", !7, i64 0}
!20 = !{!"in_addr", !10, i64 0}
!21 = !{!18, !19, i64 2}
!22 = !{!23, !10, i64 272}
!23 = !{!"", !10, i64 0, !10, i64 4, !7, i64 8, !12, i64 264, !10, i64 272, !7, i64 276, !12, i64 18720, !7, i64 18728, !7, i64 37165, !6, i64 55608, !12, i64 55616, !10, 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, !10, 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, !10, 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, !6, i64 128}
!30 = !{!23, !12, i64 55616}


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