; LLVM IR from ARMmbed/mbed-crypto :: library (ccm)

; 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.mbedtls_ccm_context = type { %struct.mbedtls_cipher_context_t }
%struct.mbedtls_cipher_context_t = type { ptr, i32, i32, ptr, ptr, [16 x i8], i64, [16 x i8], i64, ptr, ptr }

@key_test_data = external hidden constant [16 x i8], align 16
@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [16 x i8], align 1
@msg_test_data = external hidden constant [24 x i8], align 16
@msg_len_test_data = external hidden constant [3 x i64], align 16
@iv_test_data = external hidden constant [12 x i8], align 1
@iv_len_test_data = external hidden constant [3 x i64], align 16
@ad_test_data = external hidden constant [20 x i8], align 16
@add_len_test_data = external hidden constant [3 x i64], align 16
@tag_len_test_data = external hidden constant [3 x i64], align 16
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@res_test_data = external hidden constant <{ <{ [8 x i8], [24 x i8] }>, <{ [22 x i8], [10 x i8] }>, [32 x i8] }>, align 16

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_ccm_setkey(ptr noundef, i32 noundef, ptr noundef, i32 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 void @mbedtls_ccm_free(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_ccm_self_test(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.mbedtls_ccm_context, align 8
  %5 = alloca [24 x i8], align 16
  %6 = alloca [32 x i8], align 16
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 96, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 -110, ptr %8, align 4, !tbaa !5
  call void @mbedtls_ccm_init(ptr noundef %4)
  %10 = call i32 @mbedtls_ccm_setkey(ptr noundef %4, i32 noundef 2, ptr noundef @key_test_data, i32 noundef 128)
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %12, label %18

12:                                               ; preds = %1
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %17

15:                                               ; preds = %12
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  br label %17

17:                                               ; preds = %15, %12
  store i32 1, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %131

18:                                               ; preds = %1
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %122, %18
  %20 = load i64, ptr %7, align 8, !tbaa !9
  %21 = icmp ult i64 %20, 3
  br i1 %21, label %22, label %125

22:                                               ; preds = %19
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %30

25:                                               ; preds = %22
  %26 = load i64, ptr %7, align 8, !tbaa !9
  %27 = trunc i64 %26 to i32
  %28 = add i32 %27, 1
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %28)
  br label %30

30:                                               ; preds = %25, %22
  %31 = getelementptr inbounds [24 x i8], ptr %5, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %31, i8 0, i64 24, i1 false)
  %32 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %32, i8 0, i64 32, i1 false)
  %33 = getelementptr inbounds [24 x i8], ptr %5, i64 0, i64 0
  %34 = load i64, ptr %7, align 8, !tbaa !9
  %35 = getelementptr inbounds [3 x i64], ptr @msg_len_test_data, i64 0, i64 %34
  %36 = load i64, ptr %35, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %33, ptr align 16 @msg_test_data, i64 %36, i1 false)
  %37 = load i64, ptr %7, align 8, !tbaa !9
  %38 = getelementptr inbounds [3 x i64], ptr @msg_len_test_data, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = load i64, ptr %7, align 8, !tbaa !9
  %41 = getelementptr inbounds [3 x i64], ptr @iv_len_test_data, i64 0, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !9
  %43 = load i64, ptr %7, align 8, !tbaa !9
  %44 = getelementptr inbounds [3 x i64], ptr @add_len_test_data, i64 0, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !9
  %46 = getelementptr inbounds [24 x i8], ptr %5, i64 0, i64 0
  %47 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  %48 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  %49 = load i64, ptr %7, align 8, !tbaa !9
  %50 = getelementptr inbounds [3 x i64], ptr @msg_len_test_data, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = getelementptr inbounds i8, ptr %48, i64 %51
  %53 = load i64, ptr %7, align 8, !tbaa !9
  %54 = getelementptr inbounds [3 x i64], ptr @tag_len_test_data, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !9
  %56 = call i32 @mbedtls_ccm_encrypt_and_tag(ptr noundef %4, i64 noundef %39, ptr noundef @iv_test_data, i64 noundef %42, ptr noundef @ad_test_data, i64 noundef %45, ptr noundef %46, ptr noundef %47, ptr noundef %52, i64 noundef %55)
  store i32 %56, ptr %8, align 4, !tbaa !5
  %57 = load i32, ptr %8, align 4, !tbaa !5
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %73, label %59

59:                                               ; preds = %30
  %60 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  %61 = load i64, ptr %7, align 8, !tbaa !9
  %62 = getelementptr inbounds [3 x [32 x i8]], ptr @res_test_data, i64 0, i64 %61
  %63 = getelementptr inbounds [32 x i8], ptr %62, i64 0, i64 0
  %64 = load i64, ptr %7, align 8, !tbaa !9
  %65 = getelementptr inbounds [3 x i64], ptr @msg_len_test_data, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !9
  %67 = load i64, ptr %7, align 8, !tbaa !9
  %68 = getelementptr inbounds [3 x i64], ptr @tag_len_test_data, i64 0, i64 %67
  %69 = load i64, ptr %68, align 8, !tbaa !9
  %70 = add i64 %66, %69
  %71 = call i32 @memcmp(ptr noundef %60, ptr noundef %63, i64 noundef %70) #7
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %79

73:                                               ; preds = %59, %30
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %78

76:                                               ; preds = %73
  %77 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %78

78:                                               ; preds = %76, %73
  store i32 1, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %131

79:                                               ; preds = %59
  %80 = getelementptr inbounds [24 x i8], ptr %5, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %80, i8 0, i64 24, i1 false)
  %81 = load i64, ptr %7, align 8, !tbaa !9
  %82 = getelementptr inbounds [3 x i64], ptr @msg_len_test_data, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !9
  %84 = load i64, ptr %7, align 8, !tbaa !9
  %85 = getelementptr inbounds [3 x i64], ptr @iv_len_test_data, i64 0, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !9
  %87 = load i64, ptr %7, align 8, !tbaa !9
  %88 = getelementptr inbounds [3 x i64], ptr @add_len_test_data, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !9
  %90 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  %91 = getelementptr inbounds [24 x i8], ptr %5, i64 0, i64 0
  %92 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  %93 = load i64, ptr %7, align 8, !tbaa !9
  %94 = getelementptr inbounds [3 x i64], ptr @msg_len_test_data, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !9
  %96 = getelementptr inbounds i8, ptr %92, i64 %95
  %97 = load i64, ptr %7, align 8, !tbaa !9
  %98 = getelementptr inbounds [3 x i64], ptr @tag_len_test_data, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !9
  %100 = call i32 @mbedtls_ccm_auth_decrypt(ptr noundef %4, i64 noundef %83, ptr noundef @iv_test_data, i64 noundef %86, ptr noundef @ad_test_data, i64 noundef %89, ptr noundef %90, ptr noundef %91, ptr noundef %96, i64 noundef %99)
  store i32 %100, ptr %8, align 4, !tbaa !5
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %110, label %103

103:                                              ; preds = %79
  %104 = getelementptr inbounds [24 x i8], ptr %5, i64 0, i64 0
  %105 = load i64, ptr %7, align 8, !tbaa !9
  %106 = getelementptr inbounds [3 x i64], ptr @msg_len_test_data, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !9
  %108 = call i32 @memcmp(ptr noundef %104, ptr noundef @msg_test_data, i64 noundef %107) #7
  %109 = icmp ne i32 %108, 0
  br i1 %109, label %110, label %116

110:                                              ; preds = %103, %79
  %111 = load i32, ptr %3, align 4, !tbaa !5
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %113, label %115

113:                                              ; preds = %110
  %114 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %115

115:                                              ; preds = %113, %110
  store i32 1, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %131

116:                                              ; preds = %103
  %117 = load i32, ptr %3, align 4, !tbaa !5
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %119, label %121

119:                                              ; preds = %116
  %120 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %121

121:                                              ; preds = %119, %116
  br label %122

122:                                              ; preds = %121
  %123 = load i64, ptr %7, align 8, !tbaa !9
  %124 = add i64 %123, 1
  store i64 %124, ptr %7, align 8, !tbaa !9
  br label %19, !llvm.loop !11

125:                                              ; preds = %19
  call void @mbedtls_ccm_free(ptr noundef %4)
  %126 = load i32, ptr %3, align 4, !tbaa !5
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %128, label %130

128:                                              ; preds = %125
  %129 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  br label %130

130:                                              ; preds = %128, %125
  store i32 0, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %131

131:                                              ; preds = %130, %115, %78, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 96, ptr %4) #6
  %132 = load i32, ptr %2, align 4
  ret i32 %132
}

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #5

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

%struct.mbedtls_ccm_context = type { %struct.mbedtls_cipher_context_t }
%struct.mbedtls_cipher_context_t = type { ptr, i32, i32, ptr, ptr, [16 x i8], i64, [16 x i8], i64, ptr, ptr }

@key_test_data = external hidden constant [16 x i8], align 16
@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [16 x i8], align 1
@msg_test_data = external hidden constant [24 x i8], align 16
@msg_len_test_data = external hidden local_unnamed_addr constant [3 x i64], align 16
@iv_test_data = external hidden constant [12 x i8], align 1
@iv_len_test_data = external hidden local_unnamed_addr constant [3 x i64], align 16
@ad_test_data = external hidden constant [20 x i8], align 16
@add_len_test_data = external hidden local_unnamed_addr constant [3 x i64], align 16
@tag_len_test_data = external hidden local_unnamed_addr constant [3 x i64], align 16
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@res_test_data = external hidden constant <{ <{ [8 x i8], [24 x i8] }>, <{ [22 x i8], [10 x i8] }>, [32 x i8] }>, align 16

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_ccm_setkey(ptr noundef, i32 noundef, ptr noundef, i32 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 void @mbedtls_ccm_free(ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @mbedtls_ccm_self_test(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.mbedtls_ccm_context, align 8
  %3 = alloca [24 x i8], align 16
  %4 = alloca [32 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #6
  call void @mbedtls_ccm_init(ptr noundef nonnull %2)
  %5 = call i32 @mbedtls_ccm_setkey(ptr noundef nonnull %2, i32 noundef 2, ptr noundef nonnull @key_test_data, i32 noundef 128)
  %.not = icmp eq i32 %5, 0
  %.not29 = icmp eq i32 %0, 0
  br i1 %.not, label %.preheader, label %6

.preheader:                                       ; preds = %1
  br i1 %.not29, label %11, label %9

6:                                                ; preds = %1
  br i1 %.not29, label %63, label %7

7:                                                ; preds = %6
  %8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %63

9:                                                ; preds = %.preheader
  %10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 1)
  br label %11

11:                                               ; preds = %9, %.preheader
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %4, i8 0, i64 32, i1 false)
  %12 = load i64, ptr @msg_len_test_data, align 16, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %3, ptr nonnull align 16 @msg_test_data, i64 %12, i1 false)
  %13 = load i64, ptr @iv_len_test_data, align 16, !tbaa !5
  %14 = load i64, ptr @add_len_test_data, align 16, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %4, i64 %12
  %16 = load i64, ptr @tag_len_test_data, align 16, !tbaa !5
  %17 = call i32 @mbedtls_ccm_encrypt_and_tag(ptr noundef nonnull %2, i64 noundef %12, ptr noundef nonnull @iv_test_data, i64 noundef %13, ptr noundef nonnull @ad_test_data, i64 noundef %14, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %15, i64 noundef %16)
  %.not30 = icmp eq i32 %17, 0
  br i1 %.not30, label %18, label %20

18:                                               ; preds = %11
  %19 = add i64 %16, %12
  %bcmp = call i32 @bcmp(ptr nonnull %4, ptr nonnull @res_test_data, i64 %19)
  %.not31 = icmp eq i32 %bcmp, 0
  br i1 %.not31, label %23, label %20

20:                                               ; preds = %54, %.thread38, %39, %.thread, %18, %11
  br i1 %.not29, label %63, label %21

21:                                               ; preds = %20
  %22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %63

23:                                               ; preds = %18
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  %24 = call i32 @mbedtls_ccm_auth_decrypt(ptr noundef nonnull %2, i64 noundef %12, ptr noundef nonnull @iv_test_data, i64 noundef %13, ptr noundef nonnull @ad_test_data, i64 noundef %14, ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef nonnull %15, i64 noundef %16)
  %.not32 = icmp eq i32 %24, 0
  br i1 %.not32, label %25, label %26

25:                                               ; preds = %23
  %bcmp33 = call i32 @bcmp(ptr nonnull %3, ptr nonnull @msg_test_data, i64 %12)
  %.not34 = icmp eq i32 %bcmp33, 0
  br i1 %.not34, label %29, label %26

26:                                               ; preds = %58, %56, %43, %41, %25, %23
  br i1 %.not29, label %63, label %27

27:                                               ; preds = %26
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %63

29:                                               ; preds = %25
  br i1 %.not29, label %.thread, label %30

30:                                               ; preds = %29
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 2)
  br label %.thread

.thread:                                          ; preds = %29, %30
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %4, i8 0, i64 32, i1 false)
  %33 = load i64, ptr getelementptr inbounds (i8, ptr @msg_len_test_data, i64 8), align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %3, ptr nonnull align 16 @msg_test_data, i64 %33, i1 false)
  %34 = load i64, ptr getelementptr inbounds (i8, ptr @iv_len_test_data, i64 8), align 8, !tbaa !5
  %35 = load i64, ptr getelementptr inbounds (i8, ptr @add_len_test_data, i64 8), align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %4, i64 %33
  %37 = load i64, ptr getelementptr inbounds (i8, ptr @tag_len_test_data, i64 8), align 8, !tbaa !5
  %38 = call i32 @mbedtls_ccm_encrypt_and_tag(ptr noundef nonnull %2, i64 noundef %33, ptr noundef nonnull @iv_test_data, i64 noundef %34, ptr noundef nonnull @ad_test_data, i64 noundef %35, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %36, i64 noundef %37)
  %.not30.1 = icmp eq i32 %38, 0
  br i1 %.not30.1, label %39, label %20

39:                                               ; preds = %.thread
  %40 = add i64 %37, %33
  %bcmp.1 = call i32 @bcmp(ptr nonnull %4, ptr nonnull getelementptr inbounds (i8, ptr @res_test_data, i64 32), i64 %40)
  %.not31.1 = icmp eq i32 %bcmp.1, 0
  br i1 %.not31.1, label %41, label %20

41:                                               ; preds = %39
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  %42 = call i32 @mbedtls_ccm_auth_decrypt(ptr noundef nonnull %2, i64 noundef %33, ptr noundef nonnull @iv_test_data, i64 noundef %34, ptr noundef nonnull @ad_test_data, i64 noundef %35, ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef nonnull %36, i64 noundef %37)
  %.not32.1 = icmp eq i32 %42, 0
  br i1 %.not32.1, label %43, label %26

43:                                               ; preds = %41
  %bcmp33.1 = call i32 @bcmp(ptr nonnull %3, ptr nonnull @msg_test_data, i64 %33)
  %.not34.1 = icmp eq i32 %bcmp33.1, 0
  br i1 %.not34.1, label %44, label %26

44:                                               ; preds = %43
  br i1 %.not29, label %.thread38, label %45

45:                                               ; preds = %44
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 3)
  br label %.thread38

.thread38:                                        ; preds = %44, %45
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %4, i8 0, i64 32, i1 false)
  %48 = load i64, ptr getelementptr inbounds (i8, ptr @msg_len_test_data, i64 16), align 16, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %3, ptr nonnull align 16 @msg_test_data, i64 %48, i1 false)
  %49 = load i64, ptr getelementptr inbounds (i8, ptr @iv_len_test_data, i64 16), align 16, !tbaa !5
  %50 = load i64, ptr getelementptr inbounds (i8, ptr @add_len_test_data, i64 16), align 16, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %4, i64 %48
  %52 = load i64, ptr getelementptr inbounds (i8, ptr @tag_len_test_data, i64 16), align 16, !tbaa !5
  %53 = call i32 @mbedtls_ccm_encrypt_and_tag(ptr noundef nonnull %2, i64 noundef %48, ptr noundef nonnull @iv_test_data, i64 noundef %49, ptr noundef nonnull @ad_test_data, i64 noundef %50, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %51, i64 noundef %52)
  %.not30.2 = icmp eq i32 %53, 0
  br i1 %.not30.2, label %54, label %20

54:                                               ; preds = %.thread38
  %55 = add i64 %52, %48
  %bcmp.2 = call i32 @bcmp(ptr nonnull %4, ptr nonnull getelementptr inbounds (i8, ptr @res_test_data, i64 64), i64 %55)
  %.not31.2 = icmp eq i32 %bcmp.2, 0
  br i1 %.not31.2, label %56, label %20

56:                                               ; preds = %54
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  %57 = call i32 @mbedtls_ccm_auth_decrypt(ptr noundef nonnull %2, i64 noundef %48, ptr noundef nonnull @iv_test_data, i64 noundef %49, ptr noundef nonnull @ad_test_data, i64 noundef %50, ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef nonnull %51, i64 noundef %52)
  %.not32.2 = icmp eq i32 %57, 0
  br i1 %.not32.2, label %58, label %26

58:                                               ; preds = %56
  %bcmp33.2 = call i32 @bcmp(ptr nonnull %3, ptr nonnull @msg_test_data, i64 %48)
  %.not34.2 = icmp eq i32 %bcmp33.2, 0
  br i1 %.not34.2, label %59, label %26

59:                                               ; preds = %58
  br i1 %.not29, label %.thread39, label %60

.thread39:                                        ; preds = %59
  call void @mbedtls_ccm_free(ptr noundef nonnull %2)
  br label %63

60:                                               ; preds = %59
  %61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  call void @mbedtls_ccm_free(ptr noundef nonnull %2)
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %63

63:                                               ; preds = %.thread39, %60, %26, %27, %20, %21, %6, %7
  %.027 = phi i32 [ 1, %7 ], [ 1, %6 ], [ 1, %21 ], [ 1, %20 ], [ 1, %27 ], [ 1, %26 ], [ 0, %60 ], [ 0, %.thread39 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %2) #6
  ret i32 %.027
}

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

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SROAPass,SimplifyCFGPass