; 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_set_handshake_client_hello = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @tls_uint8_to_bytes(i8 noundef zeroext, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @tls_uint16_to_bytes(i16 noundef zeroext, ptr noundef, ptr noundef) #0

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

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

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

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

; 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

declare ptr @tls_protocol_name(i32 noundef) #3

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

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

29:                                               ; preds = %10
  %30 = load ptr, ptr %13, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %41

32:                                               ; preds = %29
  %33 = load ptr, ptr %15, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %41

35:                                               ; preds = %32
  %36 = load ptr, ptr %18, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %41

38:                                               ; preds = %35
  %39 = load i64, ptr %19, align 8, !tbaa !11
  %40 = icmp ne i64 %39, 0
  br i1 %40, label %47, label %41

41:                                               ; preds = %38, %35, %32, %29, %10
  br label %42

42:                                               ; preds = %41
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 699, ptr noundef @__FUNCTION__.tls_record_set_handshake_client_hello) #4
  br label %45

45:                                               ; preds = %42
  br label %46

46:                                               ; preds = %45
  store i32 -1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %175

47:                                               ; preds = %38
  %48 = load ptr, ptr %16, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %66

50:                                               ; preds = %47
  %51 = load i64, ptr %17, align 8, !tbaa !11
  %52 = icmp ne i64 %51, 0
  br i1 %52, label %53, label %59

53:                                               ; preds = %50
  %54 = load i64, ptr %17, align 8, !tbaa !11
  %55 = icmp ult i64 %54, 32
  br i1 %55, label %59, label %56

56:                                               ; preds = %53
  %57 = load i64, ptr %17, align 8, !tbaa !11
  %58 = icmp ugt i64 %57, 32
  br i1 %58, label %59, label %65

59:                                               ; preds = %56, %53, %50
  br label %60

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

63:                                               ; preds = %60
  br label %64

64:                                               ; preds = %63
  store i32 -1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %175

65:                                               ; preds = %56
  br label %66

66:                                               ; preds = %65, %47
  %67 = load i64, ptr %19, align 8, !tbaa !11
  %68 = icmp ugt i64 %67, 64
  br i1 %68, label %69, label %75

69:                                               ; preds = %66
  br label %70

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

73:                                               ; preds = %70
  br label %74

74:                                               ; preds = %73
  store i32 -1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %175

75:                                               ; preds = %66
  %76 = load ptr, ptr %20, align 8, !tbaa !5
  %77 = icmp ne ptr %76, null
  br i1 %77, label %78, label %87

78:                                               ; preds = %75
  %79 = load i64, ptr %21, align 8, !tbaa !11
  %80 = icmp ne i64 %79, 0
  br i1 %80, label %87, label %81

81:                                               ; preds = %78
  br label %82

82:                                               ; preds = %81
  %83 = load ptr, ptr @stderr, align 8, !tbaa !5
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %83, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 715, ptr noundef @__FUNCTION__.tls_record_set_handshake_client_hello) #4
  br label %85

85:                                               ; preds = %82
  br label %86

86:                                               ; preds = %85
  store i32 -1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %175

87:                                               ; preds = %78, %75
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %88, i64 5
  %90 = getelementptr inbounds i8, ptr %89, i64 4
  store ptr %90, ptr %23, align 8, !tbaa !5
  store i64 0, ptr %24, align 8, !tbaa !11
  %91 = load i32, ptr %14, align 4, !tbaa !9
  %92 = call ptr @tls_protocol_name(i32 noundef %91)
  %93 = icmp ne ptr %92, null
  br i1 %93, label %100, label %94

94:                                               ; preds = %87
  br label %95

95:                                               ; preds = %94
  %96 = load ptr, ptr @stderr, align 8, !tbaa !5
  %97 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 724, ptr noundef @__FUNCTION__.tls_record_set_handshake_client_hello) #4
  br label %98

98:                                               ; preds = %95
  br label %99

99:                                               ; preds = %98
  store i32 -1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %175

100:                                              ; preds = %87
  %101 = load i32, ptr %14, align 4, !tbaa !9
  %102 = trunc i32 %101 to i16
  call void @tls_uint16_to_bytes(i16 noundef zeroext %102, ptr noundef %23, ptr noundef %24)
  %103 = load ptr, ptr %15, align 8, !tbaa !5
  call void @tls_array_to_bytes(ptr noundef %103, i64 noundef 32, ptr noundef %23, ptr noundef %24)
  %104 = load ptr, ptr %16, align 8, !tbaa !5
  %105 = load i64, ptr %17, align 8, !tbaa !11
  call void @tls_uint8array_to_bytes(ptr noundef %104, i64 noundef %105, ptr noundef %23, ptr noundef %24)
  %106 = load i64, ptr %19, align 8, !tbaa !11
  %107 = mul i64 %106, 2
  %108 = trunc i64 %107 to i16
  call void @tls_uint16_to_bytes(i16 noundef zeroext %108, ptr noundef %23, ptr noundef %24)
  br label %109

109:                                              ; preds = %124, %100
  %110 = load i64, ptr %19, align 8, !tbaa !11
  %111 = add i64 %110, -1
  store i64 %111, ptr %19, align 8, !tbaa !11
  %112 = icmp ne i64 %110, 0
  br i1 %112, label %113, label %130

113:                                              ; preds = %109
  %114 = load ptr, ptr %18, align 8, !tbaa !5
  %115 = load i32, ptr %114, align 4, !tbaa !9
  %116 = call ptr @tls_cipher_suite_name(i32 noundef %115)
  %117 = icmp ne ptr %116, null
  br i1 %117, label %124, label %118

118:                                              ; preds = %113
  br label %119

119:                                              ; preds = %118
  %120 = load ptr, ptr @stderr, align 8, !tbaa !5
  %121 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %120, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 733, ptr noundef @__FUNCTION__.tls_record_set_handshake_client_hello) #4
  br label %122

122:                                              ; preds = %119
  br label %123

123:                                              ; preds = %122
  store i32 -1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %175

124:                                              ; preds = %113
  %125 = load ptr, ptr %18, align 8, !tbaa !5
  %126 = load i32, ptr %125, align 4, !tbaa !9
  %127 = trunc i32 %126 to i16
  call void @tls_uint16_to_bytes(i16 noundef zeroext %127, ptr noundef %23, ptr noundef %24)
  %128 = load ptr, ptr %18, align 8, !tbaa !5
  %129 = getelementptr inbounds i32, ptr %128, i32 1
  store ptr %129, ptr %18, align 8, !tbaa !5
  br label %109, !llvm.loop !14

130:                                              ; preds = %109
  call void @tls_uint8_to_bytes(i8 noundef zeroext 1, ptr noundef %23, ptr noundef %24)
  call void @tls_uint8_to_bytes(i8 noundef zeroext 0, ptr noundef %23, ptr noundef %24)
  %131 = load ptr, ptr %20, align 8, !tbaa !5
  %132 = icmp ne ptr %131, null
  br i1 %132, label %133, label %160

133:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  %134 = load i64, ptr %24, align 8, !tbaa !11
  store i64 %134, ptr %26, align 8, !tbaa !11
  %135 = load i32, ptr %14, align 4, !tbaa !9
  %136 = icmp slt i32 %135, 771
  br i1 %136, label %137, label %143

137:                                              ; preds = %133
  br label %138

138:                                              ; preds = %137
  %139 = load ptr, ptr @stderr, align 8, !tbaa !5
  %140 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %139, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 744, ptr noundef @__FUNCTION__.tls_record_set_handshake_client_hello) #4
  br label %141

141:                                              ; preds = %138
  br label %142

142:                                              ; preds = %141
  store i32 -1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %157

143:                                              ; preds = %133
  %144 = load ptr, ptr %20, align 8, !tbaa !5
  %145 = load i64, ptr %21, align 8, !tbaa !11
  call void @tls_uint16array_to_bytes(ptr noundef %144, i64 noundef %145, ptr noundef null, ptr noundef %26)
  %146 = load i64, ptr %26, align 8, !tbaa !11
  %147 = icmp ugt i64 %146, 16380
  br i1 %147, label %148, label %154

148:                                              ; preds = %143
  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 749, ptr noundef @__FUNCTION__.tls_record_set_handshake_client_hello) #4
  br label %152

152:                                              ; preds = %149
  br label %153

153:                                              ; preds = %152
  store i32 -1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %157

154:                                              ; preds = %143
  %155 = load ptr, ptr %20, align 8, !tbaa !5
  %156 = load i64, ptr %21, align 8, !tbaa !11
  call void @tls_uint16array_to_bytes(ptr noundef %155, i64 noundef %156, ptr noundef %23, ptr noundef %24)
  store i32 0, ptr %25, align 4
  br label %157

157:                                              ; preds = %154, %153, %142
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  %158 = load i32, ptr %25, align 4
  switch i32 %158, label %175 [
    i32 0, label %159
  ]

159:                                              ; preds = %157
  br label %160

160:                                              ; preds = %159, %130
  %161 = load ptr, ptr %12, align 8, !tbaa !5
  %162 = load ptr, ptr %13, align 8, !tbaa !5
  %163 = load i8, ptr %22, align 1, !tbaa !13
  %164 = zext i8 %163 to i32
  %165 = load i64, ptr %24, align 8, !tbaa !11
  %166 = call i32 @tls_record_set_handshake(ptr noundef %161, ptr noundef %162, i32 noundef %164, ptr noundef null, i64 noundef %165)
  %167 = icmp ne i32 %166, 1
  br i1 %167, label %168, label %174

168:                                              ; preds = %160
  br label %169

169:                                              ; preds = %168
  %170 = load ptr, ptr @stderr, align 8, !tbaa !5
  %171 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %170, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 755, ptr noundef @__FUNCTION__.tls_record_set_handshake_client_hello) #4
  br label %172

172:                                              ; preds = %169
  br label %173

173:                                              ; preds = %172
  store i32 -1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %175

174:                                              ; preds = %160
  store i32 1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %175

175:                                              ; preds = %174, %173, %157, %123, %99, %86, %74, %64, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #4
  %176 = load i32, ptr %11, align 4
  ret i32 %176
}

declare ptr @tls_cipher_suite_name(i32 noundef) #3

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 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; 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_set_handshake_client_hello = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @tls_uint8_to_bytes(i8 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @tls_uint16_to_bytes(i16 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @tls_uint16array_to_bytes(ptr noundef, i64 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: 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

declare ptr @tls_protocol_name(i32 noundef) local_unnamed_addr #3

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

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

22:                                               ; preds = %10
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 699, ptr noundef nonnull @__FUNCTION__.tls_record_set_handshake_client_hello) #5
  br label %76

25:                                               ; preds = %10
  %.not = icmp eq ptr %4, null
  %or.cond11.not = icmp eq i64 %5, 32
  %or.cond60 = or i1 %.not, %or.cond11.not
  br i1 %or.cond60, label %29, label %26

26:                                               ; preds = %25
  %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 706, ptr noundef nonnull @__FUNCTION__.tls_record_set_handshake_client_hello) #5
  br label %76

29:                                               ; preds = %25
  %30 = icmp ugt i64 %7, 64
  br i1 %30, label %31, label %34

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

34:                                               ; preds = %29
  %35 = icmp eq ptr %8, null
  %36 = icmp ne i64 %9, 0
  %or.cond13 = or i1 %35, %36
  br i1 %or.cond13, label %40, label %37

37:                                               ; preds = %34
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 715, ptr noundef nonnull @__FUNCTION__.tls_record_set_handshake_client_hello) #5
  br label %76

40:                                               ; preds = %34
  %41 = getelementptr inbounds i8, ptr %0, i64 9
  store ptr %41, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %12, align 8, !tbaa !9
  %42 = tail call ptr @tls_protocol_name(i32 noundef %2) #4
  %.not55 = icmp eq ptr %42, null
  br i1 %.not55, label %43, label %46

43:                                               ; preds = %40
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 724, ptr noundef nonnull @__FUNCTION__.tls_record_set_handshake_client_hello) #5
  br label %76

46:                                               ; preds = %40
  %47 = trunc i32 %2 to i16
  call void @tls_uint16_to_bytes(i16 noundef zeroext %47, ptr noundef nonnull %11, ptr noundef nonnull %12)
  call void @tls_array_to_bytes(ptr noundef nonnull %3, i64 noundef 32, ptr noundef nonnull %11, ptr noundef nonnull %12)
  call void @tls_uint8array_to_bytes(ptr noundef %4, i64 noundef %5, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %.tr = trunc nuw i64 %7 to i16
  %48 = shl nuw nsw i16 %.tr, 1
  call void @tls_uint16_to_bytes(i16 noundef zeroext %48, ptr noundef nonnull %11, ptr noundef nonnull %12)
  br label %49

49:                                               ; preds = %46, %55
  %.in = phi i64 [ %7, %46 ], [ %56, %55 ]
  %.04761 = phi ptr [ %6, %46 ], [ %59, %55 ]
  %50 = load i32, ptr %.04761, align 4, !tbaa !11
  %51 = call ptr @tls_cipher_suite_name(i32 noundef %50) #4
  %.not59 = icmp eq ptr %51, null
  br i1 %.not59, label %52, label %55

52:                                               ; preds = %49
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 733, ptr noundef nonnull @__FUNCTION__.tls_record_set_handshake_client_hello) #5
  br label %76

55:                                               ; preds = %49
  %56 = add i64 %.in, -1
  %57 = load i32, ptr %.04761, align 4, !tbaa !11
  %58 = trunc i32 %57 to i16
  call void @tls_uint16_to_bytes(i16 noundef zeroext %58, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %59 = getelementptr inbounds i8, ptr %.04761, i64 4
  %.not56 = icmp eq i64 %56, 0
  br i1 %.not56, label %60, label %49, !llvm.loop !13

60:                                               ; preds = %55
  call void @tls_uint8_to_bytes(i8 noundef zeroext 1, ptr noundef nonnull %11, ptr noundef nonnull %12)
  call void @tls_uint8_to_bytes(i8 noundef zeroext 0, ptr noundef nonnull %11, ptr noundef nonnull %12)
  br i1 %35, label %68, label %61

61:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #4
  %62 = load i64, ptr %12, align 8, !tbaa !9
  store i64 %62, ptr %13, align 8, !tbaa !9
  %63 = icmp slt i32 %2, 771
  br i1 %63, label %.critedge, label %64

64:                                               ; preds = %61
  call void @tls_uint16array_to_bytes(ptr noundef nonnull %8, i64 noundef %9, ptr noundef null, ptr noundef nonnull %13)
  %65 = load i64, ptr %13, align 8, !tbaa !9
  %66 = icmp ugt i64 %65, 16380
  br i1 %66, label %.critedge, label %67

67:                                               ; preds = %64
  call void @tls_uint16array_to_bytes(ptr noundef nonnull %8, i64 noundef %9, ptr noundef nonnull %11, ptr noundef nonnull %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #4
  br label %68

68:                                               ; preds = %67, %60
  %69 = load i64, ptr %12, align 8, !tbaa !9
  %70 = call i32 @tls_record_set_handshake(ptr noundef nonnull %0, ptr noundef nonnull %1, i32 noundef 1, ptr noundef null, i64 noundef %69)
  %.not58 = icmp eq i32 %70, 1
  br i1 %.not58, label %76, label %71

71:                                               ; preds = %68
  %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 755, ptr noundef nonnull @__FUNCTION__.tls_record_set_handshake_client_hello) #5
  br label %76

.critedge:                                        ; preds = %64, %61
  %.sink62 = phi i32 [ 744, %61 ], [ 749, %64 ]
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef %.sink62, ptr noundef nonnull @__FUNCTION__.tls_record_set_handshake_client_hello) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #4
  br label %76

76:                                               ; preds = %68, %.critedge, %71, %52, %43, %37, %31, %26, %22
  %.1 = phi i32 [ -1, %26 ], [ -1, %31 ], [ -1, %52 ], [ -1, %71 ], [ -1, %43 ], [ -1, %37 ], [ -1, %22 ], [ -1, %.critedge ], [ 1, %68 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  ret i32 %.1
}

declare ptr @tls_cipher_suite_name(i32 noundef) local_unnamed_addr #3

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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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