; LLVM IR from openanolis/openssl :: ssl/quic (quic_wire_pkt)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.wpacket_st = type { ptr, ptr, i64, i64, i64, ptr, i8 }
%struct.quic_pkt_hdr_st = type { i32, i32, %struct.quic_conn_id_st, %struct.quic_conn_id_st, [4 x i8], ptr, i64, i64, ptr }
%struct.quic_conn_id_st = type { i8, [20 x i8] }

@.str.3 = external hidden unnamed_addr constant [77 x i8], align 1
@__func__.ossl_quic_calculate_retry_integrity_tag = external hidden unnamed_addr constant [40 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [12 x i8], align 1
@retry_integrity_key = external hidden constant [16 x i8], align 16
@retry_integrity_nonce = external hidden constant [12 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

declare void @ERR_new() #1

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) #1

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) #1

declare ptr @EVP_CIPHER_CTX_new() #1

declare ptr @EVP_CIPHER_fetch(ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @EVP_CipherInit_ex(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

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

declare void @EVP_CIPHER_CTX_free(ptr noundef) #1

declare void @EVP_CIPHER_free(ptr noundef) #1

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

declare i32 @WPACKET_get_total_written(ptr noundef, ptr noundef) #1

declare i32 @WPACKET_put_bytes__(ptr noundef, i64 noundef, i64 noundef) #1

declare i32 @WPACKET_memcpy(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @ossl_quic_calculate_retry_integrity_tag(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.wpacket_st, align 8
  %19 = alloca [128 x i8], align 16
  %20 = alloca %struct.quic_pkt_hdr_st, align 8
  %21 = alloca i64, align 8
  %22 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store ptr null, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 56, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 128, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 88, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  store i64 0, ptr %21, align 8, !tbaa !11
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = load i32, ptr %23, align 8
  %25 = and i32 %24, 255
  %26 = icmp ne i32 %25, 4
  br i1 %26, label %54, label %27

27:                                               ; preds = %5
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.quic_pkt_hdr_st, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 4, !tbaa !13
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %54, label %32

32:                                               ; preds = %27
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.quic_pkt_hdr_st, ptr %33, i32 0, i32 7
  %35 = load i64, ptr %34, align 8, !tbaa !16
  %36 = icmp ult i64 %35, 16
  br i1 %36, label %54, label %37

37:                                               ; preds = %32
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.quic_pkt_hdr_st, ptr %38, i32 0, i32 8
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  %41 = icmp eq ptr %40, null
  br i1 %41, label %54, label %42

42:                                               ; preds = %37
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %54, label %45

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

48:                                               ; preds = %45
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.quic_conn_id_st, ptr %49, i32 0, i32 0
  %51 = load i8, ptr %50, align 1, !tbaa !18
  %52 = zext i8 %51 to i32
  %53 = icmp sgt i32 %52, 20
  br i1 %53, label %54, label %55

54:                                               ; preds = %48, %45, %42, %37, %32, %27, %5
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 850, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524550, ptr noundef null)
  br label %141

55:                                               ; preds = %48
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %56, i64 88, i1 false), !tbaa.struct !19
  %57 = getelementptr inbounds %struct.quic_pkt_hdr_st, ptr %20, i32 0, i32 7
  store i64 0, ptr %57, align 8, !tbaa !16
  %58 = getelementptr inbounds [128 x i8], ptr %19, i64 0, i64 0
  %59 = call i32 @WPACKET_init_static_len(ptr noundef %18, ptr noundef %58, i64 noundef 128, i64 noundef 0)
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %62, label %61

61:                                               ; preds = %55
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 864, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524303, ptr noundef null)
  br label %141

62:                                               ; preds = %55
  store i32 1, ptr %17, align 4, !tbaa !9
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.quic_conn_id_st, ptr %63, i32 0, i32 0
  %65 = load i8, ptr %64, align 1, !tbaa !18
  %66 = zext i8 %65 to i64
  %67 = call i32 @WPACKET_put_bytes__(ptr noundef %18, i64 noundef %66, i64 noundef 1)
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %79

69:                                               ; preds = %62
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.quic_conn_id_st, ptr %70, i32 0, i32 1
  %72 = getelementptr inbounds [20 x i8], ptr %71, i64 0, i64 0
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.quic_conn_id_st, ptr %73, i32 0, i32 0
  %75 = load i8, ptr %74, align 1, !tbaa !18
  %76 = zext i8 %75 to i64
  %77 = call i32 @WPACKET_memcpy(ptr noundef %18, ptr noundef %72, i64 noundef %76)
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %80, label %79

79:                                               ; preds = %69, %62
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 874, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524303, ptr noundef null)
  br label %141

80:                                               ; preds = %69
  %81 = getelementptr inbounds %struct.quic_pkt_hdr_st, ptr %20, i32 0, i32 2
  %82 = getelementptr inbounds %struct.quic_conn_id_st, ptr %81, i32 0, i32 0
  %83 = load i8, ptr %82, align 8, !tbaa !21
  %84 = zext i8 %83 to i64
  %85 = call i32 @ossl_quic_wire_encode_pkt_hdr(ptr noundef %18, i64 noundef %84, ptr noundef %20, ptr noundef null)
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %88, label %87

87:                                               ; preds = %80
  br label %141

88:                                               ; preds = %80
  %89 = call i32 @WPACKET_get_total_written(ptr noundef %18, ptr noundef %21)
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %92, label %91

91:                                               ; preds = %88
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 884, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524303, ptr noundef null)
  store i32 0, ptr %6, align 4
  store i32 1, ptr %22, align 4
  br label %150

92:                                               ; preds = %88
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = call ptr @EVP_CIPHER_fetch(ptr noundef %93, ptr noundef @.str.5, ptr noundef %94)
  store ptr %95, ptr %12, align 8, !tbaa !5
  %96 = icmp eq ptr %95, null
  br i1 %96, label %97, label %98

97:                                               ; preds = %92
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 891, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null)
  br label %141

98:                                               ; preds = %92
  %99 = call ptr @EVP_CIPHER_CTX_new()
  store ptr %99, ptr %13, align 8, !tbaa !5
  %100 = icmp eq ptr %99, null
  br i1 %100, label %101, label %102

101:                                              ; preds = %98
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 896, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null)
  br label %141

102:                                              ; preds = %98
  %103 = load ptr, ptr %13, align 8, !tbaa !5
  %104 = load ptr, ptr %12, align 8, !tbaa !5
  %105 = call i32 @EVP_CipherInit_ex(ptr noundef %103, ptr noundef %104, ptr noundef null, ptr noundef @retry_integrity_key, ptr noundef @retry_integrity_nonce, i32 noundef 1)
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %108, label %107

107:                                              ; preds = %102
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 902, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null)
  br label %141

108:                                              ; preds = %102
  %109 = load ptr, ptr %13, align 8, !tbaa !5
  %110 = getelementptr inbounds [128 x i8], ptr %19, i64 0, i64 0
  %111 = load i64, ptr %21, align 8, !tbaa !11
  %112 = trunc i64 %111 to i32
  %113 = call i32 @EVP_CipherUpdate(ptr noundef %109, ptr noundef null, ptr noundef %15, ptr noundef %110, i32 noundef %112)
  %114 = icmp ne i32 %113, 1
  br i1 %114, label %115, label %116

115:                                              ; preds = %108
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 908, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null)
  store i32 0, ptr %6, align 4
  store i32 1, ptr %22, align 4
  br label %150

116:                                              ; preds = %108
  %117 = load ptr, ptr %13, align 8, !tbaa !5
  %118 = load ptr, ptr %9, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.quic_pkt_hdr_st, ptr %118, i32 0, i32 8
  %120 = load ptr, ptr %119, align 8, !tbaa !17
  %121 = load ptr, ptr %9, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.quic_pkt_hdr_st, ptr %121, i32 0, i32 7
  %123 = load i64, ptr %122, align 8, !tbaa !16
  %124 = sub i64 %123, 16
  %125 = trunc i64 %124 to i32
  %126 = call i32 @EVP_CipherUpdate(ptr noundef %117, ptr noundef null, ptr noundef %15, ptr noundef %120, i32 noundef %125)
  %127 = icmp ne i32 %126, 1
  br i1 %127, label %128, label %129

128:                                              ; preds = %116
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 915, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null)
  store i32 0, ptr %6, align 4
  store i32 1, ptr %22, align 4
  br label %150

129:                                              ; preds = %116
  %130 = load ptr, ptr %13, align 8, !tbaa !5
  %131 = call i32 @EVP_CipherFinal_ex(ptr noundef %130, ptr noundef null, ptr noundef %16)
  %132 = icmp ne i32 %131, 1
  br i1 %132, label %133, label %134

133:                                              ; preds = %129
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 921, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null)
  store i32 0, ptr %6, align 4
  store i32 1, ptr %22, align 4
  br label %150

134:                                              ; preds = %129
  %135 = load ptr, ptr %13, align 8, !tbaa !5
  %136 = load ptr, ptr %11, align 8, !tbaa !5
  %137 = call i32 @EVP_CIPHER_CTX_ctrl(ptr noundef %135, i32 noundef 16, i32 noundef 16, ptr noundef %136)
  %138 = icmp ne i32 %137, 1
  br i1 %138, label %139, label %140

139:                                              ; preds = %134
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.3, i32 noundef 928, ptr noundef @__func__.ossl_quic_calculate_retry_integrity_tag)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null)
  store i32 0, ptr %6, align 4
  store i32 1, ptr %22, align 4
  br label %150

140:                                              ; preds = %134
  store i32 1, ptr %14, align 4, !tbaa !9
  br label %141

141:                                              ; preds = %140, %107, %101, %97, %87, %79, %61, %54
  %142 = load ptr, ptr %12, align 8, !tbaa !5
  call void @EVP_CIPHER_free(ptr noundef %142)
  %143 = load ptr, ptr %13, align 8, !tbaa !5
  call void @EVP_CIPHER_CTX_free(ptr noundef %143)
  %144 = load i32, ptr %17, align 4, !tbaa !9
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %148

146:                                              ; preds = %141
  %147 = call i32 @WPACKET_finish(ptr noundef %18)
  br label %148

148:                                              ; preds = %146, %141
  %149 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %149, ptr %6, align 4
  store i32 1, ptr %22, align 4
  br label %150

150:                                              ; preds = %148, %139, %133, %128, %115, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 88, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 128, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %151 = load i32, ptr %6, align 4
  ret i32 %151
}

declare i32 @WPACKET_init_static_len(ptr noundef, ptr noundef, i64 noundef, i64 noundef) #1

declare i32 @EVP_CipherUpdate(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

declare i32 @EVP_CipherFinal_ex(ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @EVP_CIPHER_CTX_ctrl(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #1

declare i32 @WPACKET_finish(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!14, !10, i64 4}
!14 = !{!"quic_pkt_hdr_st", !10, i64 0, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 2, !10, i64 2, !10, i64 4, !15, i64 8, !15, i64 29, !7, i64 50, !6, i64 56, !12, i64 64, !12, i64 72, !6, i64 80}
!15 = !{!"quic_conn_id_st", !7, i64 0, !7, i64 1}
!16 = !{!14, !12, i64 72}
!17 = !{!14, !6, i64 80}
!18 = !{!15, !7, i64 0}
!19 = !{i64 0, i64 4, !20, i64 4, i64 4, !9, i64 8, i64 1, !20, i64 9, i64 20, !20, i64 29, i64 1, !20, i64 30, i64 20, !20, i64 50, i64 4, !20, i64 56, i64 8, !5, i64 64, i64 8, !11, i64 72, i64 8, !11, i64 80, i64 8, !5}
!20 = !{!7, !7, i64 0}
!21 = !{!14, !7, i64 8}


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

%struct.wpacket_st = type { ptr, ptr, i64, i64, i64, ptr, i8 }
%struct.quic_pkt_hdr_st = type { i32, i32, %struct.quic_conn_id_st, %struct.quic_conn_id_st, [4 x i8], ptr, i64, i64, ptr }
%struct.quic_conn_id_st = type { i8, [20 x i8] }

@.str.3 = external hidden unnamed_addr constant [77 x i8], align 1
@__func__.ossl_quic_calculate_retry_integrity_tag = external hidden unnamed_addr constant [40 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [12 x i8], align 1
@retry_integrity_key = external hidden constant [16 x i8], align 16
@retry_integrity_nonce = external hidden constant [12 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

declare void @ERR_new() local_unnamed_addr #1

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

declare ptr @EVP_CIPHER_CTX_new() local_unnamed_addr #1

declare ptr @EVP_CIPHER_fetch(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @EVP_CipherInit_ex(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

declare void @EVP_CIPHER_CTX_free(ptr noundef) local_unnamed_addr #1

declare void @EVP_CIPHER_free(ptr noundef) local_unnamed_addr #1

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

declare i32 @WPACKET_get_total_written(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @WPACKET_put_bytes__(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

declare i32 @WPACKET_memcpy(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @ossl_quic_calculate_retry_integrity_tag(ptr noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.wpacket_st, align 8
  %9 = alloca [128 x i8], align 16
  %10 = alloca %struct.quic_pkt_hdr_st, align 8
  %11 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  store i64 0, ptr %11, align 8, !tbaa !9
  %12 = load i32, ptr %2, align 8
  %13 = and i32 %12, 255
  %.not = icmp eq i32 %13, 4
  br i1 %.not, label %14, label %31

14:                                               ; preds = %5
  %15 = getelementptr inbounds i8, ptr %2, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !11
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %31, label %18

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %2, i64 72
  %20 = load i64, ptr %19, align 8, !tbaa !15
  %21 = icmp ult i64 %20, 16
  br i1 %21, label %31, label %22

22:                                               ; preds = %18
  %23 = getelementptr inbounds i8, ptr %2, i64 80
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  %25 = icmp eq ptr %24, null
  %26 = icmp eq ptr %3, null
  %or.cond = or i1 %26, %25
  %27 = icmp eq ptr %4, null
  %or.cond3 = or i1 %27, %or.cond
  br i1 %or.cond3, label %31, label %28

28:                                               ; preds = %22
  %29 = load i8, ptr %3, align 1, !tbaa !17
  %30 = icmp ugt i8 %29, 20
  br i1 %30, label %31, label %32

31:                                               ; preds = %28, %22, %18, %14, %5
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 850, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524550, ptr noundef null) #4
  br label %83

32:                                               ; preds = %28
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(88) %10, ptr noundef nonnull align 8 dereferenceable(88) %2, i64 88, i1 false), !tbaa.struct !18
  %33 = getelementptr inbounds i8, ptr %10, i64 72
  store i64 0, ptr %33, align 8, !tbaa !15
  %34 = call i32 @WPACKET_init_static_len(ptr noundef nonnull %8, ptr noundef nonnull %9, i64 noundef 128, i64 noundef 0) #4
  %.not38 = icmp eq i32 %34, 0
  br i1 %.not38, label %35, label %36

35:                                               ; preds = %32
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 864, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524303, ptr noundef null) #4
  br label %83

36:                                               ; preds = %32
  %37 = load i8, ptr %3, align 1, !tbaa !17
  %38 = zext i8 %37 to i64
  %39 = call i32 @WPACKET_put_bytes__(ptr noundef nonnull %8, i64 noundef %38, i64 noundef 1) #4
  %.not39 = icmp eq i32 %39, 0
  br i1 %.not39, label %45, label %40

40:                                               ; preds = %36
  %41 = getelementptr inbounds i8, ptr %3, i64 1
  %42 = load i8, ptr %3, align 1, !tbaa !17
  %43 = zext i8 %42 to i64
  %44 = call i32 @WPACKET_memcpy(ptr noundef nonnull %8, ptr noundef nonnull %41, i64 noundef %43) #4
  %.not40 = icmp eq i32 %44, 0
  br i1 %.not40, label %45, label %46

45:                                               ; preds = %40, %36
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 874, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524303, ptr noundef null) #4
  br label %83

46:                                               ; preds = %40
  %47 = getelementptr inbounds i8, ptr %10, i64 8
  %48 = load i8, ptr %47, align 8, !tbaa !21
  %49 = zext i8 %48 to i64
  %50 = call i32 @ossl_quic_wire_encode_pkt_hdr(ptr noundef nonnull %8, i64 noundef %49, ptr noundef nonnull %10, ptr noundef null)
  %.not41 = icmp eq i32 %50, 0
  br i1 %.not41, label %83, label %51

51:                                               ; preds = %46
  %52 = call i32 @WPACKET_get_total_written(ptr noundef nonnull %8, ptr noundef nonnull %11) #4
  %.not42 = icmp eq i32 %52, 0
  br i1 %.not42, label %53, label %54

53:                                               ; preds = %51
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 884, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524303, ptr noundef null) #4
  br label %86

54:                                               ; preds = %51
  %55 = call ptr @EVP_CIPHER_fetch(ptr noundef %0, ptr noundef nonnull @.str.5, ptr noundef %1) #4
  %56 = icmp eq ptr %55, null
  br i1 %56, label %57, label %58

57:                                               ; preds = %54
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 891, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null) #4
  br label %83

58:                                               ; preds = %54
  %59 = call ptr @EVP_CIPHER_CTX_new() #4
  %60 = icmp eq ptr %59, null
  br i1 %60, label %61, label %62

61:                                               ; preds = %58
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 896, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null) #4
  br label %83

62:                                               ; preds = %58
  %63 = call i32 @EVP_CipherInit_ex(ptr noundef nonnull %59, ptr noundef nonnull %55, ptr noundef null, ptr noundef nonnull @retry_integrity_key, ptr noundef nonnull @retry_integrity_nonce, i32 noundef 1) #4
  %.not43 = icmp eq i32 %63, 0
  br i1 %.not43, label %64, label %65

64:                                               ; preds = %62
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 902, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null) #4
  br label %83

65:                                               ; preds = %62
  %66 = load i64, ptr %11, align 8, !tbaa !9
  %67 = trunc i64 %66 to i32
  %68 = call i32 @EVP_CipherUpdate(ptr noundef nonnull %59, ptr noundef null, ptr noundef nonnull %6, ptr noundef nonnull %9, i32 noundef %67) #4
  %.not44 = icmp eq i32 %68, 1
  br i1 %.not44, label %70, label %69

69:                                               ; preds = %65
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 908, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null) #4
  br label %86

70:                                               ; preds = %65
  %71 = load ptr, ptr %23, align 8, !tbaa !16
  %72 = load i64, ptr %19, align 8, !tbaa !15
  %73 = trunc i64 %72 to i32
  %74 = add i32 %73, -16
  %75 = call i32 @EVP_CipherUpdate(ptr noundef nonnull %59, ptr noundef null, ptr noundef nonnull %6, ptr noundef %71, i32 noundef %74) #4
  %.not45 = icmp eq i32 %75, 1
  br i1 %.not45, label %77, label %76

76:                                               ; preds = %70
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 915, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null) #4
  br label %86

77:                                               ; preds = %70
  %78 = call i32 @EVP_CipherFinal_ex(ptr noundef nonnull %59, ptr noundef null, ptr noundef nonnull %7) #4
  %.not46 = icmp eq i32 %78, 1
  br i1 %.not46, label %80, label %79

79:                                               ; preds = %77
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 921, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null) #4
  br label %86

80:                                               ; preds = %77
  %81 = call i32 @EVP_CIPHER_CTX_ctrl(ptr noundef nonnull %59, i32 noundef 16, i32 noundef 16, ptr noundef nonnull %4) #4
  %.not47 = icmp eq i32 %81, 1
  br i1 %.not47, label %83, label %82

82:                                               ; preds = %80
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.3, i32 noundef 928, ptr noundef nonnull @__func__.ossl_quic_calculate_retry_integrity_tag) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 20, i32 noundef 524294, ptr noundef null) #4
  br label %86

83:                                               ; preds = %80, %46, %64, %61, %57, %45, %35, %31
  %.031 = phi ptr [ null, %31 ], [ null, %57 ], [ %55, %61 ], [ %55, %64 ], [ null, %46 ], [ null, %45 ], [ null, %35 ], [ %55, %80 ]
  %.030 = phi ptr [ null, %31 ], [ null, %57 ], [ null, %61 ], [ %59, %64 ], [ null, %46 ], [ null, %45 ], [ null, %35 ], [ %59, %80 ]
  %.029 = phi i32 [ 0, %31 ], [ 0, %57 ], [ 0, %61 ], [ 0, %64 ], [ 0, %46 ], [ 0, %45 ], [ 0, %35 ], [ 1, %80 ]
  %.not48 = phi i1 [ true, %31 ], [ false, %57 ], [ false, %61 ], [ false, %64 ], [ false, %46 ], [ false, %45 ], [ true, %35 ], [ false, %80 ]
  call void @EVP_CIPHER_free(ptr noundef %.031) #4
  call void @EVP_CIPHER_CTX_free(ptr noundef %.030) #4
  br i1 %.not48, label %86, label %84

84:                                               ; preds = %83
  %85 = call i32 @WPACKET_finish(ptr noundef nonnull %8) #4
  br label %86

86:                                               ; preds = %83, %84, %82, %79, %76, %69, %53
  %.032 = phi i32 [ 0, %69 ], [ 0, %76 ], [ 0, %79 ], [ 0, %82 ], [ 0, %53 ], [ %.029, %84 ], [ %.029, %83 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  ret i32 %.032
}

declare i32 @WPACKET_init_static_len(ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

declare i32 @EVP_CipherUpdate(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @EVP_CipherFinal_ex(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @EVP_CIPHER_CTX_ctrl(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare i32 @WPACKET_finish(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !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, !6, i64 4}
!12 = !{!"quic_pkt_hdr_st", !6, i64 0, !6, i64 1, !6, i64 1, !6, i64 1, !6, i64 1, !6, i64 1, !6, i64 2, !6, i64 2, !6, i64 4, !13, i64 8, !13, i64 29, !7, i64 50, !14, i64 56, !10, i64 64, !10, i64 72, !14, i64 80}
!13 = !{!"quic_conn_id_st", !7, i64 0, !7, i64 1}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!12, !10, i64 72}
!16 = !{!12, !14, i64 80}
!17 = !{!13, !7, i64 0}
!18 = !{i64 0, i64 4, !19, i64 4, i64 4, !5, i64 8, i64 1, !19, i64 9, i64 20, !19, i64 29, i64 1, !19, i64 30, i64 20, !19, i64 50, i64 4, !19, i64 56, i64 8, !20, i64 64, i64 8, !9, i64 72, i64 8, !9, i64 80, i64 8, !20}
!19 = !{!7, !7, i64 0}
!20 = !{!14, !14, i64 0}
!21 = !{!12, !7, i64 8}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass