; LLVM IR from tleonhardt/practical_cryptography_engineering :: mbedtls (ecdsa)

; 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_mpi = type { i32, i64, ptr }
%struct.mbedtls_ecp_point = type { %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi }
%struct.mbedtls_ecp_group = type { i32, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_ecp_point, %struct.mbedtls_mpi, i64, i64, i32, ptr, ptr, ptr, ptr, ptr, i64 }

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

declare void @mbedtls_ecp_point_init(ptr noundef) #1

declare void @mbedtls_mpi_init(ptr noundef) #1

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

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

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

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

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

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

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

declare void @mbedtls_ecp_point_free(ptr noundef) #1

declare void @mbedtls_mpi_free(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_ecdsa_verify(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %struct.mbedtls_mpi, align 8
  %16 = alloca %struct.mbedtls_mpi, align 8
  %17 = alloca %struct.mbedtls_mpi, align 8
  %18 = alloca %struct.mbedtls_mpi, align 8
  %19 = alloca %struct.mbedtls_ecp_point, align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i64 %2, ptr %10, align 8, !tbaa !9
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 72, ptr %19) #3
  call void @mbedtls_ecp_point_init(ptr noundef %19)
  call void @mbedtls_mpi_init(ptr noundef %15)
  call void @mbedtls_mpi_init(ptr noundef %16)
  call void @mbedtls_mpi_init(ptr noundef %17)
  call void @mbedtls_mpi_init(ptr noundef %18)
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.mbedtls_ecp_group, ptr %21, i32 0, i32 5
  %23 = getelementptr inbounds %struct.mbedtls_mpi, ptr %22, i32 0, i32 2
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %6
  store i32 -20352, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %145

27:                                               ; preds = %6
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = call i32 @mbedtls_mpi_cmp_int(ptr noundef %28, i64 noundef 1)
  %30 = icmp slt i32 %29, 0
  br i1 %30, label %47, label %31

31:                                               ; preds = %27
  %32 = load ptr, ptr %12, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.mbedtls_ecp_group, ptr %33, i32 0, i32 5
  %35 = call i32 @mbedtls_mpi_cmp_mpi(ptr noundef %32, ptr noundef %34)
  %36 = icmp sge i32 %35, 0
  br i1 %36, label %47, label %37

37:                                               ; preds = %31
  %38 = load ptr, ptr %13, align 8, !tbaa !5
  %39 = call i32 @mbedtls_mpi_cmp_int(ptr noundef %38, i64 noundef 1)
  %40 = icmp slt i32 %39, 0
  br i1 %40, label %47, label %41

41:                                               ; preds = %37
  %42 = load ptr, ptr %13, align 8, !tbaa !5
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.mbedtls_ecp_group, ptr %43, i32 0, i32 5
  %45 = call i32 @mbedtls_mpi_cmp_mpi(ptr noundef %42, ptr noundef %44)
  %46 = icmp sge i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %41, %37, %31, %27
  store i32 -19968, ptr %14, align 4, !tbaa !16
  br label %143

48:                                               ; preds = %41
  br label %49

49:                                               ; preds = %48
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = call i32 @mbedtls_ecp_check_pubkey(ptr noundef %50, ptr noundef %51)
  store i32 %52, ptr %14, align 4, !tbaa !16
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %55

54:                                               ; preds = %49
  br label %143

55:                                               ; preds = %49
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = load i64, ptr %10, align 8, !tbaa !9
  %62 = call i32 @derive_mpi(ptr noundef %59, ptr noundef %15, ptr noundef %60, i64 noundef %61)
  store i32 %62, ptr %14, align 4, !tbaa !16
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %65

64:                                               ; preds = %58
  br label %143

65:                                               ; preds = %58
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67
  %69 = load ptr, ptr %13, align 8, !tbaa !5
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.mbedtls_ecp_group, ptr %70, i32 0, i32 5
  %72 = call i32 @mbedtls_mpi_inv_mod(ptr noundef %16, ptr noundef %69, ptr noundef %71)
  store i32 %72, ptr %14, align 4, !tbaa !16
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %75

74:                                               ; preds = %68
  br label %143

75:                                               ; preds = %68
  br label %76

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77
  %79 = call i32 @mbedtls_mpi_mul_mpi(ptr noundef %17, ptr noundef %15, ptr noundef %16)
  store i32 %79, ptr %14, align 4, !tbaa !16
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %82

81:                                               ; preds = %78
  br label %143

82:                                               ; preds = %78
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.mbedtls_ecp_group, ptr %86, i32 0, i32 5
  %88 = call i32 @mbedtls_mpi_mod_mpi(ptr noundef %17, ptr noundef %17, ptr noundef %87)
  store i32 %88, ptr %14, align 4, !tbaa !16
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %91

90:                                               ; preds = %85
  br label %143

91:                                               ; preds = %85
  br label %92

92:                                               ; preds = %91
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93
  %95 = load ptr, ptr %12, align 8, !tbaa !5
  %96 = call i32 @mbedtls_mpi_mul_mpi(ptr noundef %18, ptr noundef %95, ptr noundef %16)
  store i32 %96, ptr %14, align 4, !tbaa !16
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %99

98:                                               ; preds = %94
  br label %143

99:                                               ; preds = %94
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.mbedtls_ecp_group, ptr %103, i32 0, i32 5
  %105 = call i32 @mbedtls_mpi_mod_mpi(ptr noundef %18, ptr noundef %18, ptr noundef %104)
  store i32 %105, ptr %14, align 4, !tbaa !16
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %108

107:                                              ; preds = %102
  br label %143

108:                                              ; preds = %102
  br label %109

109:                                              ; preds = %108
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  %112 = load ptr, ptr %8, align 8, !tbaa !5
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.mbedtls_ecp_group, ptr %113, i32 0, i32 4
  %115 = load ptr, ptr %11, align 8, !tbaa !5
  %116 = call i32 @mbedtls_ecp_muladd(ptr noundef %112, ptr noundef %19, ptr noundef %17, ptr noundef %114, ptr noundef %18, ptr noundef %115)
  store i32 %116, ptr %14, align 4, !tbaa !16
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %118, label %119

118:                                              ; preds = %111
  br label %143

119:                                              ; preds = %111
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  %122 = call i32 @mbedtls_ecp_is_zero(ptr noundef %19)
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %125

124:                                              ; preds = %121
  store i32 -19968, ptr %14, align 4, !tbaa !16
  br label %143

125:                                              ; preds = %121
  br label %126

126:                                              ; preds = %125
  %127 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %19, i32 0, i32 0
  %128 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %19, i32 0, i32 0
  %129 = load ptr, ptr %8, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.mbedtls_ecp_group, ptr %129, i32 0, i32 5
  %131 = call i32 @mbedtls_mpi_mod_mpi(ptr noundef %127, ptr noundef %128, ptr noundef %130)
  store i32 %131, ptr %14, align 4, !tbaa !16
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %134

133:                                              ; preds = %126
  br label %143

134:                                              ; preds = %126
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135
  %137 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %19, i32 0, i32 0
  %138 = load ptr, ptr %12, align 8, !tbaa !5
  %139 = call i32 @mbedtls_mpi_cmp_mpi(ptr noundef %137, ptr noundef %138)
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %136
  store i32 -19968, ptr %14, align 4, !tbaa !16
  br label %143

142:                                              ; preds = %136
  br label %143

143:                                              ; preds = %142, %141, %133, %124, %118, %107, %98, %90, %81, %74, %64, %54, %47
  call void @mbedtls_ecp_point_free(ptr noundef %19)
  call void @mbedtls_mpi_free(ptr noundef %15)
  call void @mbedtls_mpi_free(ptr noundef %16)
  call void @mbedtls_mpi_free(ptr noundef %17)
  call void @mbedtls_mpi_free(ptr noundef %18)
  %144 = load i32, ptr %14, align 4, !tbaa !16
  store i32 %144, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %145

145:                                              ; preds = %143, %26
  call void @llvm.lifetime.end.p0(i64 72, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %146 = load i32, ptr %7, align 4
  ret i32 %146
}

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

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

declare i32 @mbedtls_ecp_is_zero(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 = { 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, !6, i64 168}
!12 = !{!"", !13, i64 0, !14, i64 8, !14, i64 32, !14, i64 56, !15, i64 80, !14, i64 152, !10, i64 176, !10, i64 184, !13, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !10, i64 240}
!13 = !{!"int", !7, i64 0}
!14 = !{!"", !13, i64 0, !10, i64 8, !6, i64 16}
!15 = !{!"", !14, i64 0, !14, i64 24, !14, i64 48}
!16 = !{!13, !13, i64 0}


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

%struct.mbedtls_mpi = type { i32, i64, ptr }
%struct.mbedtls_ecp_point = type { %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi }

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

declare void @mbedtls_ecp_point_init(ptr noundef) local_unnamed_addr #1

declare void @mbedtls_mpi_init(ptr noundef) local_unnamed_addr #1

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

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

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

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

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

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

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

declare void @mbedtls_ecp_point_free(ptr noundef) local_unnamed_addr #1

declare void @mbedtls_mpi_free(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_ecdsa_verify(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #2 {
  %7 = alloca %struct.mbedtls_mpi, align 8
  %8 = alloca %struct.mbedtls_mpi, align 8
  %9 = alloca %struct.mbedtls_mpi, align 8
  %10 = alloca %struct.mbedtls_mpi, align 8
  %11 = alloca %struct.mbedtls_ecp_point, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %11) #3
  call void @mbedtls_ecp_point_init(ptr noundef nonnull %11) #3
  call void @mbedtls_mpi_init(ptr noundef nonnull %7) #3
  call void @mbedtls_mpi_init(ptr noundef nonnull %8) #3
  call void @mbedtls_mpi_init(ptr noundef nonnull %9) #3
  call void @mbedtls_mpi_init(ptr noundef nonnull %10) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 152
  %13 = getelementptr inbounds i8, ptr %0, i64 168
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %52, label %16

16:                                               ; preds = %6
  %17 = call i32 @mbedtls_mpi_cmp_int(ptr noundef %4, i64 noundef 1) #3
  %18 = icmp slt i32 %17, 0
  br i1 %18, label %51, label %19

19:                                               ; preds = %16
  %20 = call i32 @mbedtls_mpi_cmp_mpi(ptr noundef %4, ptr noundef nonnull %12) #3
  %21 = icmp sgt i32 %20, -1
  br i1 %21, label %51, label %22

22:                                               ; preds = %19
  %23 = call i32 @mbedtls_mpi_cmp_int(ptr noundef %5, i64 noundef 1) #3
  %24 = icmp slt i32 %23, 0
  br i1 %24, label %51, label %25

25:                                               ; preds = %22
  %26 = call i32 @mbedtls_mpi_cmp_mpi(ptr noundef %5, ptr noundef nonnull %12) #3
  %27 = icmp sgt i32 %26, -1
  br i1 %27, label %51, label %28

28:                                               ; preds = %25
  %29 = call i32 @mbedtls_ecp_check_pubkey(ptr noundef nonnull %0, ptr noundef %3) #3
  %.not = icmp eq i32 %29, 0
  br i1 %.not, label %30, label %51

30:                                               ; preds = %28
  %31 = call i32 @derive_mpi(ptr noundef nonnull %0, ptr noundef nonnull %7, ptr noundef %1, i64 noundef %2)
  %.not33 = icmp eq i32 %31, 0
  br i1 %.not33, label %32, label %51

32:                                               ; preds = %30
  %33 = call i32 @mbedtls_mpi_inv_mod(ptr noundef nonnull %8, ptr noundef %5, ptr noundef nonnull %12) #3
  %.not34 = icmp eq i32 %33, 0
  br i1 %.not34, label %34, label %51

34:                                               ; preds = %32
  %35 = call i32 @mbedtls_mpi_mul_mpi(ptr noundef nonnull %9, ptr noundef nonnull %7, ptr noundef nonnull %8) #3
  %.not35 = icmp eq i32 %35, 0
  br i1 %.not35, label %36, label %51

36:                                               ; preds = %34
  %37 = call i32 @mbedtls_mpi_mod_mpi(ptr noundef nonnull %9, ptr noundef nonnull %9, ptr noundef nonnull %12) #3
  %.not36 = icmp eq i32 %37, 0
  br i1 %.not36, label %38, label %51

38:                                               ; preds = %36
  %39 = call i32 @mbedtls_mpi_mul_mpi(ptr noundef nonnull %10, ptr noundef %4, ptr noundef nonnull %8) #3
  %.not37 = icmp eq i32 %39, 0
  br i1 %.not37, label %40, label %51

40:                                               ; preds = %38
  %41 = call i32 @mbedtls_mpi_mod_mpi(ptr noundef nonnull %10, ptr noundef nonnull %10, ptr noundef nonnull %12) #3
  %.not38 = icmp eq i32 %41, 0
  br i1 %.not38, label %42, label %51

42:                                               ; preds = %40
  %43 = getelementptr inbounds i8, ptr %0, i64 80
  %44 = call i32 @mbedtls_ecp_muladd(ptr noundef nonnull %0, ptr noundef nonnull %11, ptr noundef nonnull %9, ptr noundef nonnull %43, ptr noundef nonnull %10, ptr noundef %3) #3
  %.not39 = icmp eq i32 %44, 0
  br i1 %.not39, label %45, label %51

45:                                               ; preds = %42
  %46 = call i32 @mbedtls_ecp_is_zero(ptr noundef nonnull %11) #3
  %.not40 = icmp eq i32 %46, 0
  br i1 %.not40, label %47, label %51

47:                                               ; preds = %45
  %48 = call i32 @mbedtls_mpi_mod_mpi(ptr noundef nonnull %11, ptr noundef nonnull %11, ptr noundef nonnull %12) #3
  %.not41 = icmp eq i32 %48, 0
  br i1 %.not41, label %49, label %51

49:                                               ; preds = %47
  %50 = call i32 @mbedtls_mpi_cmp_mpi(ptr noundef nonnull %11, ptr noundef %4) #3
  %.not42 = icmp eq i32 %50, 0
  %spec.select = select i1 %.not42, i32 0, i32 -19968
  br label %51

51:                                               ; preds = %49, %45, %16, %19, %22, %25, %47, %42, %40, %38, %36, %34, %32, %30, %28
  %.0 = phi i32 [ %29, %28 ], [ %31, %30 ], [ %33, %32 ], [ %35, %34 ], [ %37, %36 ], [ %39, %38 ], [ %41, %40 ], [ %44, %42 ], [ %48, %47 ], [ -19968, %25 ], [ -19968, %22 ], [ -19968, %19 ], [ -19968, %16 ], [ -19968, %45 ], [ %spec.select, %49 ]
  call void @mbedtls_ecp_point_free(ptr noundef nonnull %11) #3
  call void @mbedtls_mpi_free(ptr noundef nonnull %7) #3
  call void @mbedtls_mpi_free(ptr noundef nonnull %8) #3
  call void @mbedtls_mpi_free(ptr noundef nonnull %9) #3
  call void @mbedtls_mpi_free(ptr noundef nonnull %10) #3
  br label %52

52:                                               ; preds = %6, %51
  %.023 = phi i32 [ %.0, %51 ], [ -20352, %6 ]
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #3
  ret i32 %.023
}

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

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

declare i32 @mbedtls_ecp_is_zero(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 = { 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, !12, i64 168}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 32, !10, i64 56, !13, i64 80, !10, i64 152, !11, i64 176, !11, i64 184, !7, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !12, i64 232, !11, i64 240}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !7, i64 0, !11, i64 8, !12, i64 16}
!11 = !{!"long", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"", !10, i64 0, !10, i64 24, !10, i64 48}


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