; LLVM IR from PacktPublishing/Demystifying-Cryptography-with-OpenSSL-3 :: Chapter11 (tls-client-non-blocking)

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

@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [126 x i8], align 1
@__PRETTY_FUNCTION__.run_tls_client = external hidden unnamed_addr constant [69 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [32 x i8], align 1
@stdout = external global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [38 x i8], align 1

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

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

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

31:                                               ; preds = %4
  br label %33

32:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 49, ptr noundef @__PRETTY_FUNCTION__.run_tls_client) #9
  unreachable

33:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %34 = call noalias ptr @malloc(i64 noundef 16384) #8
  store ptr %34, ptr %17, align 8, !tbaa !5
  %35 = load ptr, ptr %17, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  br label %39

38:                                               ; preds = %33
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.4, i32 noundef 51, ptr noundef @__PRETTY_FUNCTION__.run_tls_client) #9
  unreachable

39:                                               ; preds = %37
  call void @ERR_clear_error()
  %40 = call ptr @TLS_client_method()
  %41 = call ptr @SSL_CTX_new(ptr noundef %40)
  store ptr %41, ptr %12, align 8, !tbaa !5
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %45

44:                                               ; preds = %39
  br label %46

45:                                               ; preds = %39
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.4, i32 noundef 56, ptr noundef @__PRETTY_FUNCTION__.run_tls_client) #9
  unreachable

46:                                               ; preds = %44
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %53

49:                                               ; preds = %46
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = call i32 @SSL_CTX_load_verify_locations(ptr noundef %50, ptr noundef %51, ptr noundef null)
  store i32 %52, ptr %11, align 4, !tbaa !9
  br label %56

53:                                               ; preds = %46
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = call i32 @SSL_CTX_set_default_verify_paths(ptr noundef %54)
  store i32 %55, ptr %11, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %53, %49
  %57 = load i32, ptr %11, align 4, !tbaa !9
  %58 = icmp sle i32 %57, 0
  br i1 %58, label %59, label %66

59:                                               ; preds = %56
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %65

62:                                               ; preds = %59
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef @.str.7) #7
  br label %65

65:                                               ; preds = %62, %59
  br label %262

66:                                               ; preds = %56
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  call void @SSL_CTX_set_verify(ptr noundef %67, i32 noundef 1, ptr noundef null)
  %68 = load ptr, ptr %12, align 8, !tbaa !5
  %69 = call i64 @SSL_CTX_ctrl(ptr noundef %68, i32 noundef 33, i64 noundef 4, ptr noundef null)
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = call ptr @BIO_new_ssl_connect(ptr noundef %70)
  store ptr %71, ptr %13, align 8, !tbaa !5
  %72 = load ptr, ptr %13, align 8, !tbaa !5
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %75

74:                                               ; preds = %66
  br label %76

75:                                               ; preds = %66
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.4, i32 noundef 72, ptr noundef @__PRETTY_FUNCTION__.run_tls_client) #9
  unreachable

76:                                               ; preds = %74
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = call i64 @BIO_ctrl(ptr noundef %77, i32 noundef 100, i64 noundef 0, ptr noundef %78)
  %80 = load ptr, ptr %13, align 8, !tbaa !5
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = call i64 @BIO_ctrl(ptr noundef %80, i32 noundef 100, i64 noundef 1, ptr noundef %81)
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = call i64 @BIO_ctrl(ptr noundef %83, i32 noundef 110, i64 noundef 0, ptr noundef %14)
  %85 = trunc i64 %84 to i32
  store i32 %85, ptr %11, align 4, !tbaa !9
  %86 = load i32, ptr %11, align 4, !tbaa !9
  %87 = icmp eq i32 %86, 1
  br i1 %87, label %88, label %89

88:                                               ; preds = %76
  br label %90

89:                                               ; preds = %76
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.4, i32 noundef 78, ptr noundef @__PRETTY_FUNCTION__.run_tls_client) #9
  unreachable

90:                                               ; preds = %88
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = icmp ne ptr %91, null
  br i1 %92, label %93, label %94

93:                                               ; preds = %90
  br label %95

94:                                               ; preds = %90
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.4, i32 noundef 79, ptr noundef @__PRETTY_FUNCTION__.run_tls_client) #9
  unreachable

95:                                               ; preds = %93
  %96 = load ptr, ptr %14, align 8, !tbaa !5
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = call i64 @SSL_ctrl(ptr noundef %96, i32 noundef 55, i64 noundef 0, ptr noundef %97)
  %99 = trunc i64 %98 to i32
  store i32 %99, ptr %11, align 4, !tbaa !9
  %100 = load i32, ptr %11, align 4, !tbaa !9
  %101 = icmp eq i32 %100, 1
  br i1 %101, label %102, label %103

102:                                              ; preds = %95
  br label %104

103:                                              ; preds = %95
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.4, i32 noundef 82, ptr noundef @__PRETTY_FUNCTION__.run_tls_client) #9
  unreachable

104:                                              ; preds = %102
  %105 = load ptr, ptr %14, align 8, !tbaa !5
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = call i32 @SSL_set1_host(ptr noundef %105, ptr noundef %106)
  store i32 %107, ptr %11, align 4, !tbaa !9
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = icmp eq i32 %108, 1
  br i1 %109, label %110, label %111

110:                                              ; preds = %104
  br label %112

111:                                              ; preds = %104
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.4, i32 noundef 85, ptr noundef @__PRETTY_FUNCTION__.run_tls_client) #9
  unreachable

112:                                              ; preds = %110
  %113 = load ptr, ptr %13, align 8, !tbaa !5
  %114 = call i64 @BIO_ctrl(ptr noundef %113, i32 noundef 102, i64 noundef 1, ptr noundef null)
  %115 = trunc i64 %114 to i32
  store i32 %115, ptr %11, align 4, !tbaa !9
  %116 = load i32, ptr %11, align 4, !tbaa !9
  %117 = icmp sle i32 %116, 0
  br i1 %117, label %118, label %125

118:                                              ; preds = %112
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %124

121:                                              ; preds = %118
  %122 = load ptr, ptr %9, align 8, !tbaa !5
  %123 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef @.str.11) #7
  br label %124

124:                                              ; preds = %121, %118
  br label %262

125:                                              ; preds = %112
  store i64 10, ptr %18, align 8, !tbaa !11
  store i32 100, ptr %19, align 4, !tbaa !9
  %126 = call i64 @time(ptr noundef null) #7
  %127 = add nsw i64 %126, 10
  store i64 %127, ptr %20, align 8, !tbaa !11
  %128 = load ptr, ptr %13, align 8, !tbaa !5
  %129 = call i64 @BIO_ctrl(ptr noundef %128, i32 noundef 101, i64 noundef 0, ptr noundef null)
  %130 = trunc i64 %129 to i32
  store i32 %130, ptr %11, align 4, !tbaa !9
  br label %131

131:                                              ; preds = %153, %125
  %132 = load i32, ptr %11, align 4, !tbaa !9
  %133 = icmp sle i32 %132, 0
  br i1 %133, label %134, label %138

134:                                              ; preds = %131
  %135 = load ptr, ptr %13, align 8, !tbaa !5
  %136 = call i32 @BIO_test_flags(ptr noundef %135, i32 noundef 8)
  %137 = icmp ne i32 %136, 0
  br label %138

138:                                              ; preds = %134, %131
  %139 = phi i1 [ false, %131 ], [ %137, %134 ]
  br i1 %139, label %140, label %154

140:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %141 = load ptr, ptr %13, align 8, !tbaa !5
  %142 = load i64, ptr %20, align 8, !tbaa !11
  %143 = call i32 @BIO_wait(ptr noundef %141, i64 noundef %142, i32 noundef 100)
  store i32 %143, ptr %21, align 4, !tbaa !9
  %144 = load i32, ptr %21, align 4, !tbaa !9
  %145 = icmp ne i32 %144, 1
  br i1 %145, label %146, label %147

146:                                              ; preds = %140
  store i32 4, ptr %22, align 4
  br label %151

147:                                              ; preds = %140
  %148 = load ptr, ptr %13, align 8, !tbaa !5
  %149 = call i64 @BIO_ctrl(ptr noundef %148, i32 noundef 101, i64 noundef 0, ptr noundef null)
  %150 = trunc i64 %149 to i32
  store i32 %150, ptr %11, align 4, !tbaa !9
  store i32 0, ptr %22, align 4
  br label %151

151:                                              ; preds = %147, %146
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  %152 = load i32, ptr %22, align 4
  switch i32 %152, label %290 [
    i32 0, label %153
    i32 4, label %154
  ]

153:                                              ; preds = %151
  br label %131, !llvm.loop !13

154:                                              ; preds = %151, %138
  %155 = load i32, ptr %11, align 4, !tbaa !9
  %156 = icmp sle i32 %155, 0
  br i1 %156, label %157, label %166

157:                                              ; preds = %154
  %158 = load ptr, ptr %9, align 8, !tbaa !5
  %159 = icmp ne ptr %158, null
  br i1 %159, label %160, label %165

160:                                              ; preds = %157
  %161 = load ptr, ptr %9, align 8, !tbaa !5
  %162 = load ptr, ptr %6, align 8, !tbaa !5
  %163 = load ptr, ptr %7, align 8, !tbaa !5
  %164 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %161, ptr noundef @.str.12, ptr noundef %162, ptr noundef %163) #7
  br label %165

165:                                              ; preds = %160, %157
  br label %262

166:                                              ; preds = %154
  %167 = load ptr, ptr %17, align 8, !tbaa !5
  %168 = load ptr, ptr %6, align 8, !tbaa !5
  %169 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %167, i64 noundef 16384, ptr noundef @.str.13, ptr noundef %168) #7
  %170 = load ptr, ptr %17, align 8, !tbaa !5
  %171 = call i64 @strlen(ptr noundef %170) #10
  %172 = trunc i64 %171 to i32
  store i32 %172, ptr %23, align 4, !tbaa !9
  %173 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %174 = load ptr, ptr %17, align 8, !tbaa !5
  %175 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, ptr noundef %174)
  store i32 0, ptr %24, align 4, !tbaa !9
  br label %176

176:                                              ; preds = %211, %166
  %177 = load i32, ptr %24, align 4, !tbaa !9
  %178 = load i32, ptr %23, align 4, !tbaa !9
  %179 = icmp slt i32 %177, %178
  br i1 %179, label %180, label %213

180:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  %181 = load ptr, ptr %13, align 8, !tbaa !5
  %182 = load ptr, ptr %17, align 8, !tbaa !5
  %183 = load i32, ptr %24, align 4, !tbaa !9
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds i8, ptr %182, i64 %184
  %186 = load i32, ptr %23, align 4, !tbaa !9
  %187 = load i32, ptr %24, align 4, !tbaa !9
  %188 = sub nsw i32 %186, %187
  %189 = call i32 @BIO_write(ptr noundef %181, ptr noundef %185, i32 noundef %188)
  store i32 %189, ptr %25, align 4, !tbaa !9
  %190 = load i32, ptr %25, align 4, !tbaa !9
  %191 = icmp sgt i32 %190, 0
  br i1 %191, label %192, label %196

192:                                              ; preds = %180
  %193 = load i32, ptr %25, align 4, !tbaa !9
  %194 = load i32, ptr %24, align 4, !tbaa !9
  %195 = add nsw i32 %194, %193
  store i32 %195, ptr %24, align 4, !tbaa !9
  store i32 5, ptr %22, align 4
  br label %211, !llvm.loop !15

196:                                              ; preds = %180
  %197 = load ptr, ptr %13, align 8, !tbaa !5
  %198 = call i32 @BIO_test_flags(ptr noundef %197, i32 noundef 8)
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %204

200:                                              ; preds = %196
  %201 = load ptr, ptr %13, align 8, !tbaa !5
  %202 = load i64, ptr %20, align 8, !tbaa !11
  %203 = call i32 @BIO_wait(ptr noundef %201, i64 noundef %202, i32 noundef 100)
  store i32 5, ptr %22, align 4
  br label %211, !llvm.loop !15

204:                                              ; preds = %196
  %205 = load ptr, ptr %9, align 8, !tbaa !5
  %206 = icmp ne ptr %205, null
  br i1 %206, label %207, label %210

207:                                              ; preds = %204
  %208 = load ptr, ptr %9, align 8, !tbaa !5
  %209 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %208, ptr noundef @.str.16) #7
  br label %210

210:                                              ; preds = %207, %204
  store i32 2, ptr %22, align 4
  br label %211

211:                                              ; preds = %210, %200, %192
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  %212 = load i32, ptr %22, align 4
  switch i32 %212, label %288 [
    i32 5, label %176
    i32 2, label %262
  ]

213:                                              ; preds = %176
  %214 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  %215 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  br label %216

216:                                              ; preds = %257, %213
  %217 = load ptr, ptr %14, align 8, !tbaa !5
  %218 = call i32 @SSL_get_shutdown(ptr noundef %217)
  %219 = and i32 %218, 2
  %220 = icmp ne i32 %219, 2
  br i1 %220, label %221, label %259

221:                                              ; preds = %216
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  %222 = load ptr, ptr %13, align 8, !tbaa !5
  %223 = load ptr, ptr %16, align 8, !tbaa !5
  %224 = call i32 @BIO_read(ptr noundef %222, ptr noundef %223, i32 noundef 16384)
  store i32 %224, ptr %26, align 4, !tbaa !9
  %225 = load i32, ptr %26, align 4, !tbaa !9
  %226 = icmp sgt i32 %225, 0
  br i1 %226, label %227, label %233

227:                                              ; preds = %221
  %228 = load ptr, ptr %16, align 8, !tbaa !5
  %229 = load i32, ptr %26, align 4, !tbaa !9
  %230 = sext i32 %229 to i64
  %231 = load ptr, ptr @stdout, align 8, !tbaa !5
  %232 = call i64 @fwrite(ptr noundef %228, i64 noundef 1, i64 noundef %230, ptr noundef %231)
  store i32 7, ptr %22, align 4
  br label %257, !llvm.loop !16

233:                                              ; preds = %221
  %234 = load ptr, ptr %13, align 8, !tbaa !5
  %235 = call i32 @BIO_test_flags(ptr noundef %234, i32 noundef 8)
  %236 = icmp ne i32 %235, 0
  br i1 %236, label %237, label %241

237:                                              ; preds = %233
  %238 = load ptr, ptr %13, align 8, !tbaa !5
  %239 = load i64, ptr %20, align 8, !tbaa !11
  %240 = call i32 @BIO_wait(ptr noundef %238, i64 noundef %239, i32 noundef 100)
  store i32 %240, ptr %11, align 4, !tbaa !9
  store i32 7, ptr %22, align 4
  br label %257, !llvm.loop !16

241:                                              ; preds = %233
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %242 = load ptr, ptr %14, align 8, !tbaa !5
  %243 = load i32, ptr %26, align 4, !tbaa !9
  %244 = call i32 @SSL_get_error(ptr noundef %242, i32 noundef %243)
  store i32 %244, ptr %27, align 4, !tbaa !9
  %245 = load i32, ptr %27, align 4, !tbaa !9
  %246 = icmp eq i32 %245, 6
  br i1 %246, label %247, label %248

247:                                              ; preds = %241
  store i32 8, ptr %22, align 4
  br label %256

248:                                              ; preds = %241
  %249 = load ptr, ptr %9, align 8, !tbaa !5
  %250 = icmp ne ptr %249, null
  br i1 %250, label %251, label %255

251:                                              ; preds = %248
  %252 = load ptr, ptr %9, align 8, !tbaa !5
  %253 = load i32, ptr %27, align 4, !tbaa !9
  %254 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %252, ptr noundef @.str.19, i32 noundef %253) #7
  br label %255

255:                                              ; preds = %251, %248
  store i32 2, ptr %22, align 4
  br label %256

256:                                              ; preds = %255, %247
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  br label %257

257:                                              ; preds = %256, %237, %227
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  %258 = load i32, ptr %22, align 4
  switch i32 %258, label %288 [
    i32 7, label %216
    i32 8, label %259
    i32 2, label %262
  ]

259:                                              ; preds = %257, %216
  %260 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  %261 = load ptr, ptr %13, align 8, !tbaa !5
  call void @BIO_ssl_shutdown(ptr noundef %261)
  br label %263

262:                                              ; preds = %257, %211, %165, %124, %65
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %263

263:                                              ; preds = %262, %259
  %264 = load ptr, ptr %13, align 8, !tbaa !5
  %265 = icmp ne ptr %264, null
  br i1 %265, label %266, label %268

266:                                              ; preds = %263
  %267 = load ptr, ptr %13, align 8, !tbaa !5
  call void @BIO_free_all(ptr noundef %267)
  br label %268

268:                                              ; preds = %266, %263
  %269 = load ptr, ptr %12, align 8, !tbaa !5
  %270 = icmp ne ptr %269, null
  br i1 %270, label %271, label %273

271:                                              ; preds = %268
  %272 = load ptr, ptr %12, align 8, !tbaa !5
  call void @SSL_CTX_free(ptr noundef %272)
  br label %273

273:                                              ; preds = %271, %268
  %274 = load ptr, ptr %17, align 8, !tbaa !5
  call void @free(ptr noundef %274) #7
  %275 = load ptr, ptr %16, align 8, !tbaa !5
  call void @free(ptr noundef %275) #7
  %276 = call i64 @ERR_peek_error()
  %277 = icmp ne i64 %276, 0
  br i1 %277, label %278, label %286

278:                                              ; preds = %273
  store i32 1, ptr %10, align 4, !tbaa !9
  %279 = load ptr, ptr %9, align 8, !tbaa !5
  %280 = icmp ne ptr %279, null
  br i1 %280, label %281, label %285

281:                                              ; preds = %278
  %282 = load ptr, ptr %9, align 8, !tbaa !5
  %283 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %282, ptr noundef @.str.21) #7
  %284 = load ptr, ptr %9, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %284)
  br label %285

285:                                              ; preds = %281, %278
  call void @ERR_clear_error()
  br label %286

286:                                              ; preds = %285, %273
  %287 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %287, ptr %5, align 4
  store i32 1, ptr %22, align 4
  br label %288

288:                                              ; preds = %286, %257, %211
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %289 = load i32, ptr %5, align 4
  ret i32 %289

290:                                              ; preds = %151
  unreachable
}

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

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

declare void @ERR_clear_error() #5

declare ptr @SSL_CTX_new(ptr noundef) #5

declare ptr @TLS_client_method() #5

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

declare i32 @SSL_CTX_set_default_verify_paths(ptr noundef) #5

declare void @SSL_CTX_set_verify(ptr noundef, i32 noundef, ptr noundef) #5

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

declare ptr @BIO_new_ssl_connect(ptr noundef) #5

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

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

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

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #1

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

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

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #1

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

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

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

declare i32 @SSL_get_shutdown(ptr noundef) #5

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

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

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

declare void @BIO_ssl_shutdown(ptr noundef) #5

declare void @BIO_free_all(ptr noundef) #5

declare void @SSL_CTX_free(ptr noundef) #5

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

declare i64 @ERR_peek_error() #5

declare void @ERR_print_errors_fp(ptr noundef) #5

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [126 x i8], align 1
@__PRETTY_FUNCTION__.run_tls_client = external hidden unnamed_addr constant [69 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [32 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [38 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @run_tls_client(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  store ptr null, ptr %5, align 8, !tbaa !5
  %6 = tail call noalias dereferenceable_or_null(16384) ptr @malloc(i64 noundef 16384) #10
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %7, label %8

7:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 49, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_client) #11
  unreachable

8:                                                ; preds = %4
  %9 = tail call noalias dereferenceable_or_null(16384) ptr @malloc(i64 noundef 16384) #10
  %.not112 = icmp eq ptr %9, null
  br i1 %.not112, label %10, label %11

10:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.4, i32 noundef 51, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_client) #11
  unreachable

11:                                               ; preds = %8
  tail call void @ERR_clear_error() #9
  %12 = tail call ptr @TLS_client_method() #9
  %13 = tail call ptr @SSL_CTX_new(ptr noundef %12) #9
  %.not113 = icmp eq ptr %13, null
  br i1 %.not113, label %14, label %15

14:                                               ; preds = %11
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.4, i32 noundef 56, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_client) #11
  unreachable

15:                                               ; preds = %11
  %.not114 = icmp eq ptr %2, null
  br i1 %.not114, label %18, label %16

16:                                               ; preds = %15
  %17 = tail call i32 @SSL_CTX_load_verify_locations(ptr noundef nonnull %13, ptr noundef nonnull %2, ptr noundef null) #9
  br label %20

18:                                               ; preds = %15
  %19 = tail call i32 @SSL_CTX_set_default_verify_paths(ptr noundef nonnull %13) #9
  br label %20

20:                                               ; preds = %18, %16
  %.087 = phi i32 [ %17, %16 ], [ %19, %18 ]
  %21 = icmp slt i32 %.087, 1
  br i1 %21, label %22, label %25

22:                                               ; preds = %20
  %.not126 = icmp eq ptr %3, null
  br i1 %.not126, label %.thread142, label %23

23:                                               ; preds = %22
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.7) #9
  br label %.thread142

25:                                               ; preds = %20
  tail call void @SSL_CTX_set_verify(ptr noundef nonnull %13, i32 noundef 1, ptr noundef null) #9
  %26 = tail call i64 @SSL_CTX_ctrl(ptr noundef nonnull %13, i32 noundef 33, i64 noundef 4, ptr noundef null) #9
  %27 = tail call ptr @BIO_new_ssl_connect(ptr noundef nonnull %13) #9
  %.not115 = icmp eq ptr %27, null
  br i1 %.not115, label %28, label %29

28:                                               ; preds = %25
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.4, i32 noundef 72, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_client) #11
  unreachable

29:                                               ; preds = %25
  %30 = tail call i64 @BIO_ctrl(ptr noundef nonnull %27, i32 noundef 100, i64 noundef 0, ptr noundef %0) #9
  %31 = tail call i64 @BIO_ctrl(ptr noundef nonnull %27, i32 noundef 100, i64 noundef 1, ptr noundef %1) #9
  %32 = call i64 @BIO_ctrl(ptr noundef nonnull %27, i32 noundef 110, i64 noundef 0, ptr noundef nonnull %5) #9
  %33 = and i64 %32, 4294967295
  %34 = icmp eq i64 %33, 1
  br i1 %34, label %36, label %35

35:                                               ; preds = %29
  call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.4, i32 noundef 78, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_client) #11
  unreachable

36:                                               ; preds = %29
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %.not116 = icmp eq ptr %37, null
  br i1 %.not116, label %38, label %39

38:                                               ; preds = %36
  call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.4, i32 noundef 79, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_client) #11
  unreachable

39:                                               ; preds = %36
  %40 = call i64 @SSL_ctrl(ptr noundef nonnull %37, i32 noundef 55, i64 noundef 0, ptr noundef %0) #9
  %41 = and i64 %40, 4294967295
  %42 = icmp eq i64 %41, 1
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.4, i32 noundef 82, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_client) #11
  unreachable

44:                                               ; preds = %39
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = call i32 @SSL_set1_host(ptr noundef %45, ptr noundef %0) #9
  %47 = icmp eq i32 %46, 1
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.4, i32 noundef 85, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_client) #11
  unreachable

49:                                               ; preds = %44
  %50 = call i64 @BIO_ctrl(ptr noundef nonnull %27, i32 noundef 102, i64 noundef 1, ptr noundef null) #9
  %51 = trunc i64 %50 to i32
  %52 = icmp slt i32 %51, 1
  br i1 %52, label %53, label %56

53:                                               ; preds = %49
  %.not125 = icmp eq ptr %3, null
  br i1 %.not125, label %.thread148, label %54

54:                                               ; preds = %53
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.11) #9
  br label %.thread148

56:                                               ; preds = %49
  %57 = call i64 @time(ptr noundef null) #9
  %58 = add nsw i64 %57, 10
  %59 = call i64 @BIO_ctrl(ptr noundef nonnull %27, i32 noundef 101, i64 noundef 0, ptr noundef null) #9
  %.188154 = trunc i64 %59 to i32
  %60 = icmp slt i32 %.188154, 1
  br i1 %60, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %56, %64
  %61 = call i32 @BIO_test_flags(ptr noundef nonnull %27, i32 noundef 8) #9
  %.not117 = icmp eq i32 %61, 0
  br i1 %.not117, label %.thread, label %62

62:                                               ; preds = %.lr.ph
  %63 = call i32 @BIO_wait(ptr noundef nonnull %27, i64 noundef %58, i32 noundef 100) #9
  %.not118 = icmp eq i32 %63, 1
  br i1 %.not118, label %64, label %.thread

64:                                               ; preds = %62
  %65 = call i64 @BIO_ctrl(ptr noundef nonnull %27, i32 noundef 101, i64 noundef 0, ptr noundef null) #9
  %.188 = trunc i64 %65 to i32
  %66 = icmp slt i32 %.188, 1
  br i1 %66, label %.lr.ph, label %.critedge

.thread:                                          ; preds = %62, %.lr.ph
  %.not124 = icmp eq ptr %3, null
  br i1 %.not124, label %.thread148, label %67

67:                                               ; preds = %.thread
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.12, ptr noundef %0, ptr noundef %1) #9
  br label %.thread148

.critedge:                                        ; preds = %64, %56
  %69 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %9, i64 noundef 16384, ptr noundef nonnull @.str.13, ptr noundef %0) #9
  %70 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %9) #12
  %71 = trunc i64 %70 to i32
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef nonnull %9)
  %74 = icmp sgt i32 %71, 0
  br i1 %74, label %.lr.ph156, label %._crit_edge

.lr.ph156:                                        ; preds = %.critedge, %89
  %.089155 = phi i32 [ %.190, %89 ], [ 0, %.critedge ]
  %75 = zext nneg i32 %.089155 to i64
  %76 = getelementptr inbounds i8, ptr %9, i64 %75
  %77 = sub nsw i32 %71, %.089155
  %78 = call i32 @BIO_write(ptr noundef nonnull %27, ptr noundef nonnull %76, i32 noundef %77) #9
  %79 = icmp sgt i32 %78, 0
  br i1 %79, label %80, label %82

80:                                               ; preds = %.lr.ph156
  %81 = add nuw nsw i32 %78, %.089155
  br label %89, !llvm.loop !9

82:                                               ; preds = %.lr.ph156
  %83 = call i32 @BIO_test_flags(ptr noundef nonnull %27, i32 noundef 8) #9
  %.not122 = icmp eq i32 %83, 0
  br i1 %.not122, label %86, label %84

84:                                               ; preds = %82
  %85 = call i32 @BIO_wait(ptr noundef nonnull %27, i64 noundef %58, i32 noundef 100) #9
  br label %89, !llvm.loop !9

86:                                               ; preds = %82
  %.not123 = icmp eq ptr %3, null
  br i1 %.not123, label %.thread148, label %87

87:                                               ; preds = %86
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.16) #9
  br label %.thread148

89:                                               ; preds = %84, %80
  %.190 = phi i32 [ %81, %80 ], [ %.089155, %84 ]
  %90 = icmp slt i32 %.190, %71
  br i1 %90, label %.lr.ph156, label %._crit_edge

._crit_edge:                                      ; preds = %89, %.critedge
  %91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  %92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = call i32 @SSL_get_shutdown(ptr noundef %93) #9
  %95 = and i32 %94, 2
  %.not119.not157 = icmp eq i32 %95, 0
  br i1 %.not119.not157, label %.lr.ph159, label %.thread139

.lr.ph159:                                        ; preds = %._crit_edge, %113
  %96 = call i32 @BIO_read(ptr noundef nonnull %27, ptr noundef nonnull %6, i32 noundef 16384) #9
  %97 = icmp sgt i32 %96, 0
  br i1 %97, label %98, label %102

98:                                               ; preds = %.lr.ph159
  %99 = zext nneg i32 %96 to i64
  %100 = load ptr, ptr @stdout, align 8, !tbaa !5
  %101 = call i64 @fwrite(ptr noundef nonnull %6, i64 noundef 1, i64 noundef %99, ptr noundef %100)
  br label %113, !llvm.loop !11

102:                                              ; preds = %.lr.ph159
  %103 = call i32 @BIO_test_flags(ptr noundef nonnull %27, i32 noundef 8) #9
  %.not120 = icmp eq i32 %103, 0
  br i1 %.not120, label %106, label %104

104:                                              ; preds = %102
  %105 = call i32 @BIO_wait(ptr noundef nonnull %27, i64 noundef %58, i32 noundef 100) #9
  br label %113, !llvm.loop !11

106:                                              ; preds = %102
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = call i32 @SSL_get_error(ptr noundef %107, i32 noundef %96) #9
  %109 = icmp eq i32 %108, 6
  br i1 %109, label %.thread139, label %110

110:                                              ; preds = %106
  %.not121 = icmp eq ptr %3, null
  br i1 %.not121, label %.thread148, label %111

111:                                              ; preds = %110
  %112 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.19, i32 noundef %108) #9
  br label %.thread148

113:                                              ; preds = %104, %98
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = call i32 @SSL_get_shutdown(ptr noundef %114) #9
  %116 = and i32 %115, 2
  %.not119.not = icmp eq i32 %116, 0
  br i1 %.not119.not, label %.lr.ph159, label %.thread139

.thread139:                                       ; preds = %113, %._crit_edge, %106
  %117 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  call void @BIO_ssl_shutdown(ptr noundef nonnull %27) #9
  br label %.thread148

.thread148:                                       ; preds = %.thread139, %.thread, %67, %87, %86, %111, %110, %53, %54
  %.086153 = phi i32 [ 1, %54 ], [ 1, %53 ], [ 0, %.thread139 ], [ 1, %.thread ], [ 1, %67 ], [ 1, %87 ], [ 1, %86 ], [ 1, %111 ], [ 1, %110 ]
  call void @BIO_free_all(ptr noundef nonnull %27) #9
  br label %.thread142

.thread142:                                       ; preds = %22, %23, %.thread148
  %.086146 = phi i32 [ %.086153, %.thread148 ], [ 1, %23 ], [ 1, %22 ]
  call void @SSL_CTX_free(ptr noundef nonnull %13) #9
  call void @free(ptr noundef %9) #9
  call void @free(ptr noundef %6) #9
  %118 = call i64 @ERR_peek_error() #9
  %.not128 = icmp eq i64 %118, 0
  br i1 %.not128, label %123, label %119

119:                                              ; preds = %.thread142
  %.not129 = icmp eq ptr %3, null
  br i1 %.not129, label %122, label %120

120:                                              ; preds = %119
  %121 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.21) #9
  call void @ERR_print_errors_fp(ptr noundef nonnull %3) #9
  br label %122

122:                                              ; preds = %120, %119
  call void @ERR_clear_error() #9
  br label %123

123:                                              ; preds = %.thread142, %122
  %.0 = phi i32 [ 1, %122 ], [ %.086146, %.thread142 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  ret i32 %.0
}

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

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

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

declare void @ERR_clear_error() local_unnamed_addr #5

declare ptr @SSL_CTX_new(ptr noundef) local_unnamed_addr #5

declare ptr @TLS_client_method() local_unnamed_addr #5

declare i32 @SSL_CTX_load_verify_locations(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @SSL_CTX_set_default_verify_paths(ptr noundef) local_unnamed_addr #5

declare void @SSL_CTX_set_verify(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

declare i64 @SSL_CTX_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) local_unnamed_addr #5

declare ptr @BIO_new_ssl_connect(ptr noundef) local_unnamed_addr #5

declare i64 @BIO_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) local_unnamed_addr #5

declare i64 @SSL_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) local_unnamed_addr #5

declare i32 @SSL_set1_host(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #6

declare i32 @BIO_test_flags(ptr noundef, i32 noundef) local_unnamed_addr #5

declare i32 @BIO_wait(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

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

declare i32 @BIO_write(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

declare i32 @SSL_get_shutdown(ptr noundef) local_unnamed_addr #5

declare i32 @BIO_read(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

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

declare i32 @SSL_get_error(ptr noundef, i32 noundef) local_unnamed_addr #5

declare void @BIO_ssl_shutdown(ptr noundef) local_unnamed_addr #5

declare void @BIO_free_all(ptr noundef) local_unnamed_addr #5

declare void @SSL_CTX_free(ptr noundef) local_unnamed_addr #5

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

declare i64 @ERR_peek_error() local_unnamed_addr #5

declare void @ERR_print_errors_fp(ptr noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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 #7 = { 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 #8 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { noreturn nounwind }
attributes #12 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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