; LLVM IR from guanzhi/GmSSL :: src (tls)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [57 x i8], align 1
@__FUNCTION__.tls_record_get_handshake_server_hello = external hidden unnamed_addr constant [38 x i8], align 1

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

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

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

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

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

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

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

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

declare ptr @tls_protocol_name(i32 noundef) #3

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

declare ptr @tls_cipher_suite_name(i32 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @tls_record_get_handshake_server_hello(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #0 {
  %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 ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca i16, align 2
  %22 = alloca i16, align 2
  %23 = alloca i8, align 1
  %24 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store ptr %3, ptr %13, align 8, !tbaa !5
  store ptr %4, ptr %14, align 8, !tbaa !5
  store ptr %5, ptr %15, align 8, !tbaa !5
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #4
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %48

27:                                               ; preds = %8
  %28 = load ptr, ptr %11, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %48

30:                                               ; preds = %27
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %48

33:                                               ; preds = %30
  %34 = load ptr, ptr %13, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %48

36:                                               ; preds = %33
  %37 = load ptr, ptr %14, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %48

39:                                               ; preds = %36
  %40 = load ptr, ptr %15, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %48

42:                                               ; preds = %39
  %43 = load ptr, ptr %16, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %48

45:                                               ; preds = %42
  %46 = load ptr, ptr %17, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %54, label %48

48:                                               ; preds = %45, %42, %39, %36, %33, %30, %27, %8
  br label %49

49:                                               ; preds = %48
  %50 = load ptr, ptr @stderr, align 8, !tbaa !5
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 907, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %52

52:                                               ; preds = %49
  br label %53

53:                                               ; preds = %52
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

54:                                               ; preds = %45
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = call i32 @tls_record_get_handshake(ptr noundef %55, ptr noundef %18, ptr noundef %19, ptr noundef %20)
  %57 = icmp ne i32 %56, 1
  br i1 %57, label %58, label %64

58:                                               ; preds = %54
  br label %59

59:                                               ; preds = %58
  %60 = load ptr, ptr @stderr, align 8, !tbaa !5
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 911, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %62

62:                                               ; preds = %59
  br label %63

63:                                               ; preds = %62
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

64:                                               ; preds = %54
  %65 = load i32, ptr %18, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 2
  br i1 %66, label %67, label %73

67:                                               ; preds = %64
  br label %68

68:                                               ; preds = %67
  %69 = load ptr, ptr @stderr, align 8, !tbaa !5
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %69, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 915, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %71

71:                                               ; preds = %68
  br label %72

72:                                               ; preds = %71
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

73:                                               ; preds = %64
  %74 = call i32 @tls_uint16_from_bytes(ptr noundef %21, ptr noundef %19, ptr noundef %20)
  %75 = icmp ne i32 %74, 1
  br i1 %75, label %91, label %76

76:                                               ; preds = %73
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  %78 = call i32 @tls_array_from_bytes(ptr noundef %77, i64 noundef 32, ptr noundef %19, ptr noundef %20)
  %79 = icmp ne i32 %78, 1
  br i1 %79, label %91, label %80

80:                                               ; preds = %76
  %81 = load ptr, ptr %13, align 8, !tbaa !5
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = call i32 @tls_uint8array_from_bytes(ptr noundef %81, ptr noundef %82, ptr noundef %19, ptr noundef %20)
  %84 = icmp ne i32 %83, 1
  br i1 %84, label %91, label %85

85:                                               ; preds = %80
  %86 = call i32 @tls_uint16_from_bytes(ptr noundef %22, ptr noundef %19, ptr noundef %20)
  %87 = icmp ne i32 %86, 1
  br i1 %87, label %91, label %88

88:                                               ; preds = %85
  %89 = call i32 @tls_uint8_from_bytes(ptr noundef %23, ptr noundef %19, ptr noundef %20)
  %90 = icmp ne i32 %89, 1
  br i1 %90, label %91, label %97

91:                                               ; preds = %88, %85, %80, %76, %73
  br label %92

92:                                               ; preds = %91
  %93 = load ptr, ptr @stderr, align 8, !tbaa !5
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 923, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %95

95:                                               ; preds = %92
  br label %96

96:                                               ; preds = %95
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

97:                                               ; preds = %88
  %98 = load i16, ptr %21, align 2, !tbaa !11
  %99 = zext i16 %98 to i32
  %100 = call ptr @tls_protocol_name(i32 noundef %99)
  %101 = icmp ne ptr %100, null
  br i1 %101, label %108, label %102

102:                                              ; preds = %97
  br label %103

103:                                              ; preds = %102
  %104 = load ptr, ptr @stderr, align 8, !tbaa !5
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %104, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 928, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %106

106:                                              ; preds = %103
  br label %107

107:                                              ; preds = %106
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

108:                                              ; preds = %97
  %109 = load i16, ptr %21, align 2, !tbaa !11
  %110 = zext i16 %109 to i32
  %111 = load ptr, ptr %10, align 8, !tbaa !5
  %112 = getelementptr inbounds i8, ptr %111, i64 1
  %113 = load i8, ptr %112, align 1, !tbaa !13
  %114 = zext i8 %113 to i16
  %115 = zext i16 %114 to i32
  %116 = shl i32 %115, 8
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  %118 = getelementptr inbounds i8, ptr %117, i64 2
  %119 = load i8, ptr %118, align 1, !tbaa !13
  %120 = zext i8 %119 to i32
  %121 = or i32 %116, %120
  %122 = icmp slt i32 %110, %121
  br i1 %122, label %123, label %129

123:                                              ; preds = %108
  br label %124

124:                                              ; preds = %123
  %125 = load ptr, ptr @stderr, align 8, !tbaa !5
  %126 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %125, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 932, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %127

127:                                              ; preds = %124
  br label %128

128:                                              ; preds = %127
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

129:                                              ; preds = %108
  %130 = load i16, ptr %21, align 2, !tbaa !11
  %131 = zext i16 %130 to i32
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %131, ptr %132, align 4, !tbaa !9
  %133 = load ptr, ptr %13, align 8, !tbaa !5
  %134 = load ptr, ptr %133, align 8, !tbaa !5
  %135 = icmp ne ptr %134, null
  br i1 %135, label %136, label %155

136:                                              ; preds = %129
  %137 = load ptr, ptr %13, align 8, !tbaa !5
  %138 = load ptr, ptr %137, align 8, !tbaa !5
  %139 = icmp eq ptr %138, null
  br i1 %139, label %148, label %140

140:                                              ; preds = %136
  %141 = load ptr, ptr %14, align 8, !tbaa !5
  %142 = load i64, ptr %141, align 8, !tbaa !14
  %143 = icmp ult i64 %142, 0
  br i1 %143, label %148, label %144

144:                                              ; preds = %140
  %145 = load ptr, ptr %14, align 8, !tbaa !5
  %146 = load i64, ptr %145, align 8, !tbaa !14
  %147 = icmp ugt i64 %146, 32
  br i1 %147, label %148, label %154

148:                                              ; preds = %144, %140, %136
  br label %149

149:                                              ; preds = %148
  %150 = load ptr, ptr @stderr, align 8, !tbaa !5
  %151 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %150, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 941, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %152

152:                                              ; preds = %149
  br label %153

153:                                              ; preds = %152
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

154:                                              ; preds = %144
  br label %155

155:                                              ; preds = %154, %129
  %156 = load i16, ptr %22, align 2, !tbaa !11
  %157 = zext i16 %156 to i32
  %158 = call ptr @tls_cipher_suite_name(i32 noundef %157)
  %159 = icmp ne ptr %158, null
  br i1 %159, label %166, label %160

160:                                              ; preds = %155
  br label %161

161:                                              ; preds = %160
  %162 = load ptr, ptr @stderr, align 8, !tbaa !5
  %163 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %162, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 947, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %164

164:                                              ; preds = %161
  br label %165

165:                                              ; preds = %164
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

166:                                              ; preds = %155
  %167 = load i16, ptr %22, align 2, !tbaa !11
  %168 = zext i16 %167 to i32
  %169 = load ptr, ptr %15, align 8, !tbaa !5
  store i32 %168, ptr %169, align 4, !tbaa !9
  %170 = load i8, ptr %23, align 1, !tbaa !13
  %171 = zext i8 %170 to i32
  %172 = icmp ne i32 %171, 0
  br i1 %172, label %173, label %179

173:                                              ; preds = %166
  br label %174

174:                                              ; preds = %173
  %175 = load ptr, ptr @stderr, align 8, !tbaa !5
  %176 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %175, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 953, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %177

177:                                              ; preds = %174
  br label %178

178:                                              ; preds = %177
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

179:                                              ; preds = %166
  %180 = load i64, ptr %20, align 8, !tbaa !14
  %181 = icmp ne i64 %180, 0
  br i1 %181, label %182, label %204

182:                                              ; preds = %179
  %183 = load ptr, ptr %16, align 8, !tbaa !5
  %184 = load ptr, ptr %17, align 8, !tbaa !5
  %185 = call i32 @tls_uint16array_from_bytes(ptr noundef %183, ptr noundef %184, ptr noundef %19, ptr noundef %20)
  %186 = icmp ne i32 %185, 1
  br i1 %186, label %187, label %193

187:                                              ; preds = %182
  br label %188

188:                                              ; preds = %187
  %189 = load ptr, ptr @stderr, align 8, !tbaa !5
  %190 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %189, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 959, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %191

191:                                              ; preds = %188
  br label %192

192:                                              ; preds = %191
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

193:                                              ; preds = %182
  %194 = load ptr, ptr %16, align 8, !tbaa !5
  %195 = load ptr, ptr %194, align 8, !tbaa !5
  %196 = icmp eq ptr %195, null
  br i1 %196, label %197, label %203

197:                                              ; preds = %193
  br label %198

198:                                              ; preds = %197
  %199 = load ptr, ptr @stderr, align 8, !tbaa !5
  %200 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %199, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 963, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %201

201:                                              ; preds = %198
  br label %202

202:                                              ; preds = %201
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

203:                                              ; preds = %193
  br label %207

204:                                              ; preds = %179
  %205 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr null, ptr %205, align 8, !tbaa !5
  %206 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 0, ptr %206, align 8, !tbaa !14
  br label %207

207:                                              ; preds = %204, %203
  %208 = load i64, ptr %20, align 8, !tbaa !14
  %209 = icmp ne i64 %208, 0
  br i1 %209, label %210, label %216

210:                                              ; preds = %207
  br label %211

211:                                              ; preds = %210
  %212 = load ptr, ptr @stderr, align 8, !tbaa !5
  %213 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %212, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 971, ptr noundef @__FUNCTION__.tls_record_get_handshake_server_hello) #4
  br label %214

214:                                              ; preds = %211
  br label %215

215:                                              ; preds = %214
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

216:                                              ; preds = %207
  store i32 1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %217

217:                                              ; preds = %216, %215, %202, %192, %178, %165, %153, %128, %107, %96, %72, %63, %53
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  %218 = load i32, ptr %9, align 4
  ret i32 %218
}

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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 }

!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 = !{!"short", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [57 x i8], align 1
@__FUNCTION__.tls_record_get_handshake_server_hello = external hidden unnamed_addr constant [38 x i8], align 1

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

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

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

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

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

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

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

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

declare ptr @tls_protocol_name(i32 noundef) local_unnamed_addr #3

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

declare ptr @tls_cipher_suite_name(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 2) i32 @tls_record_get_handshake_server_hello(ptr noundef %0, ptr noundef writeonly %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef writeonly %5, ptr noundef %6, ptr noundef %7) local_unnamed_addr #0 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i16, align 2
  %13 = alloca i16, align 2
  %14 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %12) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %13) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %14) #4
  %15 = insertelement <8 x ptr> poison, ptr %0, i64 0
  %16 = insertelement <8 x ptr> %15, ptr %1, i64 1
  %17 = insertelement <8 x ptr> %16, ptr %2, i64 2
  %18 = insertelement <8 x ptr> %17, ptr %3, i64 3
  %19 = insertelement <8 x ptr> %18, ptr %4, i64 4
  %20 = insertelement <8 x ptr> %19, ptr %5, i64 5
  %21 = insertelement <8 x ptr> %20, ptr %6, i64 6
  %22 = insertelement <8 x ptr> %21, ptr %7, i64 7
  %23 = icmp eq <8 x ptr> %22, zeroinitializer
  %24 = bitcast <8 x i1> %23 to i8
  %25 = icmp eq i8 %24, 0
  br i1 %25, label %29, label %26

26:                                               ; preds = %8
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 907, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

29:                                               ; preds = %8
  %30 = call i32 @tls_record_get_handshake(ptr noundef nonnull %0, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %.not = icmp eq i32 %30, 1
  br i1 %.not, label %34, label %31

31:                                               ; preds = %29
  %32 = load ptr, ptr @stderr, align 8, !tbaa !5
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 911, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

34:                                               ; preds = %29
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %.not40 = icmp eq i32 %35, 2
  br i1 %.not40, label %39, label %36

36:                                               ; preds = %34
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 915, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

39:                                               ; preds = %34
  %40 = call i32 @tls_uint16_from_bytes(ptr noundef nonnull %12, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %.not41 = icmp eq i32 %40, 1
  br i1 %.not41, label %41, label %49

41:                                               ; preds = %39
  %42 = call i32 @tls_array_from_bytes(ptr noundef nonnull %2, i64 noundef 32, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %.not42 = icmp eq i32 %42, 1
  br i1 %.not42, label %43, label %49

43:                                               ; preds = %41
  %44 = call i32 @tls_uint8array_from_bytes(ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %.not43 = icmp eq i32 %44, 1
  br i1 %.not43, label %45, label %49

45:                                               ; preds = %43
  %46 = call i32 @tls_uint16_from_bytes(ptr noundef nonnull %13, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %.not44 = icmp eq i32 %46, 1
  br i1 %.not44, label %47, label %49

47:                                               ; preds = %45
  %48 = call i32 @tls_uint8_from_bytes(ptr noundef nonnull %14, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %.not45 = icmp eq i32 %48, 1
  br i1 %.not45, label %52, label %49

49:                                               ; preds = %39, %41, %43, %45, %47
  %50 = load ptr, ptr @stderr, align 8, !tbaa !5
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 923, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

52:                                               ; preds = %47
  %53 = load i16, ptr %12, align 2, !tbaa !11
  %54 = zext i16 %53 to i32
  %55 = call ptr @tls_protocol_name(i32 noundef %54) #4
  %.not46 = icmp eq ptr %55, null
  br i1 %.not46, label %56, label %59

56:                                               ; preds = %52
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 928, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

59:                                               ; preds = %52
  %60 = load i16, ptr %12, align 2, !tbaa !11
  %61 = zext i16 %60 to i32
  %62 = getelementptr inbounds i8, ptr %0, i64 1
  %63 = load i8, ptr %62, align 1, !tbaa !13
  %64 = zext i8 %63 to i32
  %65 = shl nuw nsw i32 %64, 8
  %66 = getelementptr inbounds i8, ptr %0, i64 2
  %67 = load i8, ptr %66, align 1, !tbaa !13
  %68 = zext i8 %67 to i32
  %69 = or disjoint i32 %65, %68
  %70 = icmp ugt i32 %69, %61
  br i1 %70, label %71, label %74

71:                                               ; preds = %59
  %72 = load ptr, ptr @stderr, align 8, !tbaa !5
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 932, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

74:                                               ; preds = %59
  store i32 %61, ptr %1, align 4, !tbaa !9
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %.not47 = icmp eq ptr %75, null
  br i1 %.not47, label %82, label %76

76:                                               ; preds = %74
  %77 = load i64, ptr %4, align 8, !tbaa !14
  %78 = icmp ugt i64 %77, 32
  br i1 %78, label %79, label %82

79:                                               ; preds = %76
  %80 = load ptr, ptr @stderr, align 8, !tbaa !5
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 941, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

82:                                               ; preds = %76, %74
  %83 = load i16, ptr %13, align 2, !tbaa !11
  %84 = zext i16 %83 to i32
  %85 = call ptr @tls_cipher_suite_name(i32 noundef %84) #4
  %.not48 = icmp eq ptr %85, null
  br i1 %.not48, label %86, label %89

86:                                               ; preds = %82
  %87 = load ptr, ptr @stderr, align 8, !tbaa !5
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %87, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 947, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

89:                                               ; preds = %82
  %90 = load i16, ptr %13, align 2, !tbaa !11
  %91 = zext i16 %90 to i32
  store i32 %91, ptr %5, align 4, !tbaa !9
  %92 = load i8, ptr %14, align 1, !tbaa !13
  %.not49 = icmp eq i8 %92, 0
  br i1 %.not49, label %96, label %93

93:                                               ; preds = %89
  %94 = load ptr, ptr @stderr, align 8, !tbaa !5
  %95 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %94, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 953, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

96:                                               ; preds = %89
  %97 = load i64, ptr %11, align 8, !tbaa !14
  %.not50 = icmp eq i64 %97, 0
  br i1 %.not50, label %.thread, label %98

98:                                               ; preds = %96
  %99 = call i32 @tls_uint16array_from_bytes(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %.not51 = icmp eq i32 %99, 1
  br i1 %.not51, label %103, label %100

100:                                              ; preds = %98
  %101 = load ptr, ptr @stderr, align 8, !tbaa !5
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 959, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

103:                                              ; preds = %98
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = icmp eq ptr %104, null
  br i1 %105, label %106, label %109

106:                                              ; preds = %103
  %107 = load ptr, ptr @stderr, align 8, !tbaa !5
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 963, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

.thread:                                          ; preds = %96
  store ptr null, ptr %6, align 8, !tbaa !5
  store i64 0, ptr %7, align 8, !tbaa !14
  br label %113

109:                                              ; preds = %103
  %.pr = load i64, ptr %11, align 8, !tbaa !14
  %.not52 = icmp eq i64 %.pr, 0
  br i1 %.not52, label %113, label %110

110:                                              ; preds = %109
  %111 = load ptr, ptr @stderr, align 8, !tbaa !5
  %112 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %111, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 971, ptr noundef nonnull @__FUNCTION__.tls_record_get_handshake_server_hello) #5
  br label %113

113:                                              ; preds = %.thread, %109, %110, %106, %100, %93, %86, %79, %71, %56, %49, %36, %31, %26
  %.0 = phi i32 [ -1, %31 ], [ -1, %36 ], [ -1, %49 ], [ -1, %71 ], [ -1, %79 ], [ -1, %93 ], [ -1, %100 ], [ -1, %106 ], [ -1, %110 ], [ -1, %86 ], [ -1, %56 ], [ -1, %26 ], [ 1, %109 ], [ 1, %.thread ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %14) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %13) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  ret i32 %.0
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass