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

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

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

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

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

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

declare ptr @mbedtls_md_info_from_type(i32 noundef) #2

declare zeroext i8 @mbedtls_md_get_size(ptr noundef) #2

declare i32 @mbedtls_md(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #2

; 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

declare void @mbedtls_md_init(ptr noundef) #2

declare i32 @mbedtls_md_setup(ptr noundef, ptr noundef, i32 noundef) #2

declare void @mbedtls_md_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @mgf_mask(ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_rsa_rsaes_oaep_decrypt(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i64 noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, i64 noundef %9) #1 {
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i64, align 8
  %22 = alloca i32, align 4
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca ptr, align 8
  %27 = alloca i8, align 1
  %28 = alloca i8, align 1
  %29 = alloca [1024 x i8], align 16
  %30 = alloca [64 x i8], align 16
  %31 = alloca i32, align 4
  %32 = alloca ptr, align 8
  %33 = alloca %struct.mbedtls_md_context_t, align 8
  %34 = alloca i32, align 4
  store ptr %0, ptr %12, align 8, !tbaa !5
  store ptr %1, ptr %13, align 8, !tbaa !5
  store ptr %2, ptr %14, align 8, !tbaa !5
  store i32 %3, ptr %15, align 4, !tbaa !9
  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 ptr %7, ptr %19, align 8, !tbaa !5
  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 4, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %27) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %28) #4
  call void @llvm.lifetime.start.p0(i64 1024, ptr %29) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr %30) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %33) #4
  %35 = load i32, ptr %15, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 1
  br i1 %36, label %37, label %43

37:                                               ; preds = %10
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.mbedtls_rsa_context, ptr %38, i32 0, i32 15
  %40 = load i32, ptr %39, align 8, !tbaa !13
  %41 = icmp ne i32 %40, 1
  br i1 %41, label %42, label %43

42:                                               ; preds = %37
  store i32 -16512, ptr %11, align 4
  store i32 1, ptr %34, align 4
  br label %247

43:                                               ; preds = %37, %10
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.mbedtls_rsa_context, ptr %44, i32 0, i32 1
  %46 = load i64, ptr %45, align 8, !tbaa !16
  store i64 %46, ptr %23, align 8, !tbaa !11
  %47 = load i64, ptr %23, align 8, !tbaa !11
  %48 = icmp ult i64 %47, 16
  br i1 %48, label %52, label %49

49:                                               ; preds = %43
  %50 = load i64, ptr %23, align 8, !tbaa !11
  %51 = icmp ugt i64 %50, 1024
  br i1 %51, label %52, label %53

52:                                               ; preds = %49, %43
  store i32 -16512, ptr %11, align 4
  store i32 1, ptr %34, align 4
  br label %247

53:                                               ; preds = %49
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.mbedtls_rsa_context, ptr %54, i32 0, i32 16
  %56 = load i32, ptr %55, align 4, !tbaa !17
  %57 = call ptr @mbedtls_md_info_from_type(i32 noundef %56)
  store ptr %57, ptr %32, align 8, !tbaa !5
  %58 = load ptr, ptr %32, align 8, !tbaa !5
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %61

60:                                               ; preds = %53
  store i32 -16512, ptr %11, align 4
  store i32 1, ptr %34, align 4
  br label %247

61:                                               ; preds = %53
  %62 = load ptr, ptr %32, align 8, !tbaa !5
  %63 = call zeroext i8 @mbedtls_md_get_size(ptr noundef %62)
  %64 = zext i8 %63 to i32
  store i32 %64, ptr %31, align 4, !tbaa !9
  %65 = load i32, ptr %31, align 4, !tbaa !9
  %66 = mul i32 2, %65
  %67 = add i32 %66, 2
  %68 = zext i32 %67 to i64
  %69 = load i64, ptr %23, align 8, !tbaa !11
  %70 = icmp ugt i64 %68, %69
  br i1 %70, label %71, label %72

71:                                               ; preds = %61
  store i32 -16512, ptr %11, align 4
  store i32 1, ptr %34, align 4
  br label %247

72:                                               ; preds = %61
  %73 = load i32, ptr %15, align 4, !tbaa !9
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %80

75:                                               ; preds = %72
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = load ptr, ptr %19, align 8, !tbaa !5
  %78 = getelementptr inbounds [1024 x i8], ptr %29, i64 0, i64 0
  %79 = call i32 @mbedtls_rsa_public(ptr noundef %76, ptr noundef %77, ptr noundef %78)
  br label %87

80:                                               ; preds = %72
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = load ptr, ptr %19, align 8, !tbaa !5
  %85 = getelementptr inbounds [1024 x i8], ptr %29, i64 0, i64 0
  %86 = call i32 @mbedtls_rsa_private(ptr noundef %81, ptr noundef %82, ptr noundef %83, ptr noundef %84, ptr noundef %85)
  br label %87

87:                                               ; preds = %80, %75
  %88 = phi i32 [ %79, %75 ], [ %86, %80 ]
  store i32 %88, ptr %22, align 4, !tbaa !9
  %89 = load i32, ptr %22, align 4, !tbaa !9
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %91, label %92

91:                                               ; preds = %87
  br label %243

92:                                               ; preds = %87
  call void @mbedtls_md_init(ptr noundef %33)
  %93 = load ptr, ptr %32, align 8, !tbaa !5
  %94 = call i32 @mbedtls_md_setup(ptr noundef %33, ptr noundef %93, i32 noundef 0)
  store i32 %94, ptr %22, align 4, !tbaa !9
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %97

96:                                               ; preds = %92
  call void @mbedtls_md_free(ptr noundef %33)
  br label %243

97:                                               ; preds = %92
  %98 = load ptr, ptr %32, align 8, !tbaa !5
  %99 = load ptr, ptr %16, align 8, !tbaa !5
  %100 = load i64, ptr %17, align 8, !tbaa !11
  %101 = getelementptr inbounds [64 x i8], ptr %30, i64 0, i64 0
  %102 = call i32 @mbedtls_md(ptr noundef %98, ptr noundef %99, i64 noundef %100, ptr noundef %101)
  %103 = getelementptr inbounds [1024 x i8], ptr %29, i64 0, i64 0
  %104 = getelementptr inbounds i8, ptr %103, i64 1
  %105 = load i32, ptr %31, align 4, !tbaa !9
  %106 = zext i32 %105 to i64
  %107 = getelementptr inbounds [1024 x i8], ptr %29, i64 0, i64 0
  %108 = load i32, ptr %31, align 4, !tbaa !9
  %109 = zext i32 %108 to i64
  %110 = getelementptr inbounds i8, ptr %107, i64 %109
  %111 = getelementptr inbounds i8, ptr %110, i64 1
  %112 = load i64, ptr %23, align 8, !tbaa !11
  %113 = load i32, ptr %31, align 4, !tbaa !9
  %114 = zext i32 %113 to i64
  %115 = sub i64 %112, %114
  %116 = sub i64 %115, 1
  call void @mgf_mask(ptr noundef %104, i64 noundef %106, ptr noundef %111, i64 noundef %116, ptr noundef %33)
  %117 = getelementptr inbounds [1024 x i8], ptr %29, i64 0, i64 0
  %118 = load i32, ptr %31, align 4, !tbaa !9
  %119 = zext i32 %118 to i64
  %120 = getelementptr inbounds i8, ptr %117, i64 %119
  %121 = getelementptr inbounds i8, ptr %120, i64 1
  %122 = load i64, ptr %23, align 8, !tbaa !11
  %123 = load i32, ptr %31, align 4, !tbaa !9
  %124 = zext i32 %123 to i64
  %125 = sub i64 %122, %124
  %126 = sub i64 %125, 1
  %127 = getelementptr inbounds [1024 x i8], ptr %29, i64 0, i64 0
  %128 = getelementptr inbounds i8, ptr %127, i64 1
  %129 = load i32, ptr %31, align 4, !tbaa !9
  %130 = zext i32 %129 to i64
  call void @mgf_mask(ptr noundef %121, i64 noundef %126, ptr noundef %128, i64 noundef %130, ptr noundef %33)
  call void @mbedtls_md_free(ptr noundef %33)
  %131 = getelementptr inbounds [1024 x i8], ptr %29, i64 0, i64 0
  store ptr %131, ptr %26, align 8, !tbaa !5
  store i8 0, ptr %27, align 1, !tbaa !18
  %132 = load ptr, ptr %26, align 8, !tbaa !5
  %133 = getelementptr inbounds i8, ptr %132, i32 1
  store ptr %133, ptr %26, align 8, !tbaa !5
  %134 = load i8, ptr %132, align 1, !tbaa !18
  %135 = zext i8 %134 to i32
  %136 = load i8, ptr %27, align 1, !tbaa !18
  %137 = zext i8 %136 to i32
  %138 = or i32 %137, %135
  %139 = trunc i32 %138 to i8
  store i8 %139, ptr %27, align 1, !tbaa !18
  %140 = load i32, ptr %31, align 4, !tbaa !9
  %141 = load ptr, ptr %26, align 8, !tbaa !5
  %142 = zext i32 %140 to i64
  %143 = getelementptr inbounds i8, ptr %141, i64 %142
  store ptr %143, ptr %26, align 8, !tbaa !5
  store i64 0, ptr %24, align 8, !tbaa !11
  br label %144

144:                                              ; preds = %163, %97
  %145 = load i64, ptr %24, align 8, !tbaa !11
  %146 = load i32, ptr %31, align 4, !tbaa !9
  %147 = zext i32 %146 to i64
  %148 = icmp ult i64 %145, %147
  br i1 %148, label %149, label %166

149:                                              ; preds = %144
  %150 = load i64, ptr %24, align 8, !tbaa !11
  %151 = getelementptr inbounds [64 x i8], ptr %30, i64 0, i64 %150
  %152 = load i8, ptr %151, align 1, !tbaa !18
  %153 = zext i8 %152 to i32
  %154 = load ptr, ptr %26, align 8, !tbaa !5
  %155 = getelementptr inbounds i8, ptr %154, i32 1
  store ptr %155, ptr %26, align 8, !tbaa !5
  %156 = load i8, ptr %154, align 1, !tbaa !18
  %157 = zext i8 %156 to i32
  %158 = xor i32 %153, %157
  %159 = load i8, ptr %27, align 1, !tbaa !18
  %160 = zext i8 %159 to i32
  %161 = or i32 %160, %158
  %162 = trunc i32 %161 to i8
  store i8 %162, ptr %27, align 1, !tbaa !18
  br label %163

163:                                              ; preds = %149
  %164 = load i64, ptr %24, align 8, !tbaa !11
  %165 = add i64 %164, 1
  store i64 %165, ptr %24, align 8, !tbaa !11
  br label %144, !llvm.loop !19

166:                                              ; preds = %144
  store i64 0, ptr %25, align 8, !tbaa !11
  store i8 0, ptr %28, align 1, !tbaa !18
  store i64 0, ptr %24, align 8, !tbaa !11
  br label %167

167:                                              ; preds = %199, %166
  %168 = load i64, ptr %24, align 8, !tbaa !11
  %169 = load i64, ptr %23, align 8, !tbaa !11
  %170 = load i32, ptr %31, align 4, !tbaa !9
  %171 = mul i32 2, %170
  %172 = zext i32 %171 to i64
  %173 = sub i64 %169, %172
  %174 = sub i64 %173, 2
  %175 = icmp ult i64 %168, %174
  br i1 %175, label %176, label %202

176:                                              ; preds = %167
  %177 = load ptr, ptr %26, align 8, !tbaa !5
  %178 = load i64, ptr %24, align 8, !tbaa !11
  %179 = getelementptr inbounds i8, ptr %177, i64 %178
  %180 = load i8, ptr %179, align 1, !tbaa !18
  %181 = zext i8 %180 to i32
  %182 = load i8, ptr %28, align 1, !tbaa !18
  %183 = zext i8 %182 to i32
  %184 = or i32 %183, %181
  %185 = trunc i32 %184 to i8
  store i8 %185, ptr %28, align 1, !tbaa !18
  %186 = load i8, ptr %28, align 1, !tbaa !18
  %187 = zext i8 %186 to i32
  %188 = load i8, ptr %28, align 1, !tbaa !18
  %189 = zext i8 %188 to i32
  %190 = sub nsw i32 0, %189
  %191 = trunc i32 %190 to i8
  %192 = zext i8 %191 to i32
  %193 = or i32 %187, %192
  %194 = ashr i32 %193, 7
  %195 = xor i32 %194, 1
  %196 = sext i32 %195 to i64
  %197 = load i64, ptr %25, align 8, !tbaa !11
  %198 = add i64 %197, %196
  store i64 %198, ptr %25, align 8, !tbaa !11
  br label %199

199:                                              ; preds = %176
  %200 = load i64, ptr %24, align 8, !tbaa !11
  %201 = add i64 %200, 1
  store i64 %201, ptr %24, align 8, !tbaa !11
  br label %167, !llvm.loop !21

202:                                              ; preds = %167
  %203 = load i64, ptr %25, align 8, !tbaa !11
  %204 = load ptr, ptr %26, align 8, !tbaa !5
  %205 = getelementptr inbounds i8, ptr %204, i64 %203
  store ptr %205, ptr %26, align 8, !tbaa !5
  %206 = load ptr, ptr %26, align 8, !tbaa !5
  %207 = getelementptr inbounds i8, ptr %206, i32 1
  store ptr %207, ptr %26, align 8, !tbaa !5
  %208 = load i8, ptr %206, align 1, !tbaa !18
  %209 = zext i8 %208 to i32
  %210 = xor i32 %209, 1
  %211 = load i8, ptr %27, align 1, !tbaa !18
  %212 = zext i8 %211 to i32
  %213 = or i32 %212, %210
  %214 = trunc i32 %213 to i8
  store i8 %214, ptr %27, align 1, !tbaa !18
  %215 = load i8, ptr %27, align 1, !tbaa !18
  %216 = zext i8 %215 to i32
  %217 = icmp ne i32 %216, 0
  br i1 %217, label %218, label %219

218:                                              ; preds = %202
  store i32 -16640, ptr %22, align 4, !tbaa !9
  br label %243

219:                                              ; preds = %202
  %220 = load i64, ptr %23, align 8, !tbaa !11
  %221 = load ptr, ptr %26, align 8, !tbaa !5
  %222 = getelementptr inbounds [1024 x i8], ptr %29, i64 0, i64 0
  %223 = ptrtoint ptr %221 to i64
  %224 = ptrtoint ptr %222 to i64
  %225 = sub i64 %223, %224
  %226 = sub i64 %220, %225
  %227 = load i64, ptr %21, align 8, !tbaa !11
  %228 = icmp ugt i64 %226, %227
  br i1 %228, label %229, label %230

229:                                              ; preds = %219
  store i32 -17408, ptr %22, align 4, !tbaa !9
  br label %243

230:                                              ; preds = %219
  %231 = load i64, ptr %23, align 8, !tbaa !11
  %232 = load ptr, ptr %26, align 8, !tbaa !5
  %233 = getelementptr inbounds [1024 x i8], ptr %29, i64 0, i64 0
  %234 = ptrtoint ptr %232 to i64
  %235 = ptrtoint ptr %233 to i64
  %236 = sub i64 %234, %235
  %237 = sub i64 %231, %236
  %238 = load ptr, ptr %18, align 8, !tbaa !5
  store i64 %237, ptr %238, align 8, !tbaa !11
  %239 = load ptr, ptr %20, align 8, !tbaa !5
  %240 = load ptr, ptr %26, align 8, !tbaa !5
  %241 = load ptr, ptr %18, align 8, !tbaa !5
  %242 = load i64, ptr %241, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %239, ptr align 1 %240, i64 %242, i1 false)
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %243

243:                                              ; preds = %230, %229, %218, %96, %91
  %244 = getelementptr inbounds [1024 x i8], ptr %29, i64 0, i64 0
  call void @mbedtls_zeroize(ptr noundef %244, i64 noundef 1024)
  %245 = getelementptr inbounds [64 x i8], ptr %30, i64 0, i64 0
  call void @mbedtls_zeroize(ptr noundef %245, i64 noundef 64)
  %246 = load i32, ptr %22, align 4, !tbaa !9
  store i32 %246, ptr %11, align 4
  store i32 1, ptr %34, align 4
  br label %247

247:                                              ; preds = %243, %71, %60, %52, %42
  call void @llvm.lifetime.end.p0(i64 24, ptr %33) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %30) #4
  call void @llvm.lifetime.end.p0(i64 1024, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  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 4, ptr %22) #4
  %248 = load i32, ptr %11, align 4
  ret i32 %248
}

; Function Attrs: nounwind uwtable
declare hidden void @mbedtls_zeroize(ptr noundef, i64 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 328}
!14 = !{!"", !10, i64 0, !12, i64 8, !15, i64 16, !15, i64 40, !15, i64 64, !15, i64 88, !15, i64 112, !15, i64 136, !15, i64 160, !15, i64 184, !15, i64 208, !15, i64 232, !15, i64 256, !15, i64 280, !15, i64 304, !10, i64 328, !10, i64 332}
!15 = !{!"", !10, i64 0, !12, i64 8, !6, i64 16}
!16 = !{!14, !12, i64 8}
!17 = !{!14, !10, i64 332}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


; 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_md_context_t = type { ptr, ptr, ptr }

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

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

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

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

declare ptr @mbedtls_md_info_from_type(i32 noundef) local_unnamed_addr #2

declare zeroext i8 @mbedtls_md_get_size(ptr noundef) local_unnamed_addr #2

declare i32 @mbedtls_md(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; 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

declare void @mbedtls_md_init(ptr noundef) local_unnamed_addr #2

declare i32 @mbedtls_md_setup(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @mbedtls_md_free(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @mgf_mask(ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_rsa_rsaes_oaep_decrypt(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i64 noundef %5, ptr nocapture noundef writeonly %6, ptr noundef %7, ptr nocapture noundef writeonly %8, i64 noundef %9) local_unnamed_addr #1 {
  %11 = alloca [1024 x i8], align 16
  %12 = alloca [64 x i8], align 16
  %13 = alloca %struct.mbedtls_md_context_t, align 8
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %11) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %12) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %13) #5
  %14 = icmp eq i32 %3, 1
  br i1 %14, label %15, label %18

15:                                               ; preds = %10
  %16 = getelementptr inbounds i8, ptr %0, i64 328
  %17 = load i32, ptr %16, align 8, !tbaa !5
  %.not = icmp eq i32 %17, 1
  br i1 %.not, label %18, label %176

18:                                               ; preds = %15, %10
  %19 = getelementptr inbounds i8, ptr %0, i64 8
  %20 = load i64, ptr %19, align 8, !tbaa !13
  %21 = add i64 %20, -1025
  %or.cond = icmp ult i64 %21, -1009
  br i1 %or.cond, label %176, label %22

22:                                               ; preds = %18
  %23 = getelementptr inbounds i8, ptr %0, i64 332
  %24 = load i32, ptr %23, align 4, !tbaa !14
  %25 = tail call ptr @mbedtls_md_info_from_type(i32 noundef %24) #5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %176, label %27

27:                                               ; preds = %22
  %28 = tail call zeroext i8 @mbedtls_md_get_size(ptr noundef nonnull %25) #5
  %29 = zext i8 %28 to i32
  %30 = shl nuw nsw i32 %29, 1
  %31 = add nuw nsw i32 %30, 2
  %32 = zext nneg i32 %31 to i64
  %33 = icmp ult i64 %20, %32
  br i1 %33, label %176, label %34

34:                                               ; preds = %27
  %35 = icmp eq i32 %3, 0
  br i1 %35, label %36, label %38

36:                                               ; preds = %34
  %37 = call i32 @mbedtls_rsa_public(ptr noundef nonnull %0, ptr noundef %7, ptr noundef nonnull %11)
  br label %40

38:                                               ; preds = %34
  %39 = call i32 @mbedtls_rsa_private(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2, ptr noundef %7, ptr noundef nonnull %11)
  br label %40

40:                                               ; preds = %38, %36
  %41 = phi i32 [ %37, %36 ], [ %39, %38 ]
  %.not77 = icmp eq i32 %41, 0
  br i1 %.not77, label %42, label %175

42:                                               ; preds = %40
  call void @mbedtls_md_init(ptr noundef nonnull %13) #5
  %43 = call i32 @mbedtls_md_setup(ptr noundef nonnull %13, ptr noundef nonnull %25, i32 noundef 0) #5
  %.not78 = icmp eq i32 %43, 0
  br i1 %.not78, label %45, label %44

44:                                               ; preds = %42
  call void @mbedtls_md_free(ptr noundef nonnull %13) #5
  br label %175

45:                                               ; preds = %42
  %46 = call i32 @mbedtls_md(ptr noundef nonnull %25, ptr noundef %4, i64 noundef %5, ptr noundef nonnull %12) #5
  %47 = getelementptr inbounds i8, ptr %11, i64 1
  %48 = zext i8 %28 to i64
  %49 = getelementptr inbounds i8, ptr %11, i64 %48
  %50 = getelementptr inbounds i8, ptr %49, i64 1
  %51 = xor i64 %48, -1
  %52 = add nsw i64 %20, %51
  call void @mgf_mask(ptr noundef nonnull %47, i64 noundef %48, ptr noundef nonnull %50, i64 noundef %52, ptr noundef nonnull %13)
  call void @mgf_mask(ptr noundef nonnull %50, i64 noundef %52, ptr noundef nonnull %47, i64 noundef %48, ptr noundef nonnull %13)
  call void @mbedtls_md_free(ptr noundef nonnull %13) #5
  %53 = load i8, ptr %11, align 16, !tbaa !15
  %54 = getelementptr inbounds i8, ptr %47, i64 %48
  %.not90 = icmp eq i8 %28, 0
  br i1 %.not90, label %.preheader, label %iter.check

iter.check:                                       ; preds = %45
  %55 = shl nuw nsw i64 %48, 1
  %56 = or disjoint i64 %55, 1
  %min.iters.check = icmp ult i8 %28, 8
  br i1 %min.iters.check, label %.lr.ph.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %iter.check
  %min.iters.check97 = icmp ult i8 %28, 32
  br i1 %min.iters.check97, label %vec.epilog.ph, label %vector.ph

vector.ph:                                        ; preds = %vector.main.loop.iter.check
  %n.vec = and i64 %48, 224
  %57 = insertelement <16 x i8> <i8 poison, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, i8 %53, i64 0
  %58 = getelementptr inbounds i8, ptr %12, i64 16
  %wide.load = load <16 x i8>, ptr %12, align 16, !tbaa !15
  %wide.load100 = load <16 x i8>, ptr %58, align 16, !tbaa !15
  %59 = getelementptr i8, ptr %54, i64 16
  %wide.load101 = load <16 x i8>, ptr %54, align 1, !tbaa !15
  %wide.load102 = load <16 x i8>, ptr %59, align 1, !tbaa !15
  %60 = xor <16 x i8> %wide.load101, %wide.load
  %61 = xor <16 x i8> %wide.load102, %wide.load100
  %62 = or <16 x i8> %60, %57
  %63 = icmp eq i64 %n.vec, 32
  br i1 %63, label %middle.block, label %vector.body.1, !llvm.loop !16

vector.body.1:                                    ; preds = %vector.ph
  %next.gep.1 = getelementptr i8, ptr %54, i64 32
  %64 = getelementptr inbounds i8, ptr %12, i64 32
  %65 = getelementptr inbounds i8, ptr %12, i64 48
  %wide.load.1 = load <16 x i8>, ptr %64, align 16, !tbaa !15
  %wide.load100.1 = load <16 x i8>, ptr %65, align 16, !tbaa !15
  %66 = getelementptr i8, ptr %54, i64 48
  %wide.load101.1 = load <16 x i8>, ptr %next.gep.1, align 1, !tbaa !15
  %wide.load102.1 = load <16 x i8>, ptr %66, align 1, !tbaa !15
  %67 = xor <16 x i8> %wide.load101.1, %wide.load.1
  %68 = xor <16 x i8> %wide.load102.1, %wide.load100.1
  %69 = or <16 x i8> %67, %62
  %70 = or <16 x i8> %68, %61
  %71 = icmp eq i64 %n.vec, 64
  br i1 %71, label %middle.block, label %vector.body.2, !llvm.loop !16

vector.body.2:                                    ; preds = %vector.body.1
  %next.gep.2 = getelementptr i8, ptr %54, i64 64
  %72 = getelementptr inbounds i8, ptr %12, i64 64
  %73 = getelementptr inbounds i8, ptr %12, i64 80
  %wide.load.2 = load <16 x i8>, ptr %72, align 16, !tbaa !15
  %wide.load100.2 = load <16 x i8>, ptr %73, align 16, !tbaa !15
  %74 = getelementptr i8, ptr %54, i64 80
  %wide.load101.2 = load <16 x i8>, ptr %next.gep.2, align 1, !tbaa !15
  %wide.load102.2 = load <16 x i8>, ptr %74, align 1, !tbaa !15
  %75 = xor <16 x i8> %wide.load101.2, %wide.load.2
  %76 = xor <16 x i8> %wide.load102.2, %wide.load100.2
  %77 = or <16 x i8> %75, %69
  %78 = or <16 x i8> %76, %70
  %79 = icmp eq i64 %n.vec, 96
  br i1 %79, label %middle.block, label %vector.body.3, !llvm.loop !16

vector.body.3:                                    ; preds = %vector.body.2
  %next.gep.3 = getelementptr i8, ptr %54, i64 96
  %80 = getelementptr inbounds i8, ptr %12, i64 96
  %81 = getelementptr inbounds i8, ptr %12, i64 112
  %wide.load.3 = load <16 x i8>, ptr %80, align 16, !tbaa !15
  %wide.load100.3 = load <16 x i8>, ptr %81, align 16, !tbaa !15
  %82 = getelementptr i8, ptr %54, i64 112
  %wide.load101.3 = load <16 x i8>, ptr %next.gep.3, align 1, !tbaa !15
  %wide.load102.3 = load <16 x i8>, ptr %82, align 1, !tbaa !15
  %83 = xor <16 x i8> %wide.load101.3, %wide.load.3
  %84 = xor <16 x i8> %wide.load102.3, %wide.load100.3
  %85 = or <16 x i8> %83, %77
  %86 = or <16 x i8> %84, %78
  %87 = icmp eq i64 %n.vec, 128
  br i1 %87, label %middle.block, label %vector.body.4, !llvm.loop !16

vector.body.4:                                    ; preds = %vector.body.3
  %next.gep.4 = getelementptr i8, ptr %54, i64 128
  %88 = getelementptr inbounds i8, ptr %12, i64 128
  %89 = getelementptr inbounds i8, ptr %12, i64 144
  %wide.load.4 = load <16 x i8>, ptr %88, align 16, !tbaa !15
  %wide.load100.4 = load <16 x i8>, ptr %89, align 16, !tbaa !15
  %90 = getelementptr i8, ptr %54, i64 144
  %wide.load101.4 = load <16 x i8>, ptr %next.gep.4, align 1, !tbaa !15
  %wide.load102.4 = load <16 x i8>, ptr %90, align 1, !tbaa !15
  %91 = xor <16 x i8> %wide.load101.4, %wide.load.4
  %92 = xor <16 x i8> %wide.load102.4, %wide.load100.4
  %93 = or <16 x i8> %91, %85
  %94 = or <16 x i8> %92, %86
  %95 = icmp eq i64 %n.vec, 160
  br i1 %95, label %middle.block, label %vector.body.5, !llvm.loop !16

vector.body.5:                                    ; preds = %vector.body.4
  %next.gep.5 = getelementptr i8, ptr %54, i64 160
  %96 = getelementptr inbounds i8, ptr %12, i64 160
  %97 = getelementptr inbounds i8, ptr %12, i64 176
  %wide.load.5 = load <16 x i8>, ptr %96, align 16, !tbaa !15
  %wide.load100.5 = load <16 x i8>, ptr %97, align 16, !tbaa !15
  %98 = getelementptr i8, ptr %54, i64 176
  %wide.load101.5 = load <16 x i8>, ptr %next.gep.5, align 1, !tbaa !15
  %wide.load102.5 = load <16 x i8>, ptr %98, align 1, !tbaa !15
  %99 = xor <16 x i8> %wide.load101.5, %wide.load.5
  %100 = xor <16 x i8> %wide.load102.5, %wide.load100.5
  %101 = or <16 x i8> %99, %93
  %102 = or <16 x i8> %100, %94
  %103 = icmp eq i64 %n.vec, 192
  br i1 %103, label %middle.block, label %vector.body.6, !llvm.loop !16

vector.body.6:                                    ; preds = %vector.body.5
  %next.gep.6 = getelementptr i8, ptr %54, i64 192
  %104 = getelementptr inbounds i8, ptr %12, i64 192
  %105 = getelementptr inbounds i8, ptr %12, i64 208
  %wide.load.6 = load <16 x i8>, ptr %104, align 16, !tbaa !15
  %wide.load100.6 = load <16 x i8>, ptr %105, align 16, !tbaa !15
  %106 = getelementptr i8, ptr %54, i64 208
  %wide.load101.6 = load <16 x i8>, ptr %next.gep.6, align 1, !tbaa !15
  %wide.load102.6 = load <16 x i8>, ptr %106, align 1, !tbaa !15
  %107 = xor <16 x i8> %wide.load101.6, %wide.load.6
  %108 = xor <16 x i8> %wide.load102.6, %wide.load100.6
  %109 = or <16 x i8> %107, %101
  %110 = or <16 x i8> %108, %102
  br label %middle.block

middle.block:                                     ; preds = %vector.body.6, %vector.body.5, %vector.body.4, %vector.body.3, %vector.body.2, %vector.body.1, %vector.ph
  %.lcssa118 = phi <16 x i8> [ %62, %vector.ph ], [ %69, %vector.body.1 ], [ %77, %vector.body.2 ], [ %85, %vector.body.3 ], [ %93, %vector.body.4 ], [ %101, %vector.body.5 ], [ %109, %vector.body.6 ]
  %.lcssa117 = phi <16 x i8> [ %61, %vector.ph ], [ %70, %vector.body.1 ], [ %78, %vector.body.2 ], [ %86, %vector.body.3 ], [ %94, %vector.body.4 ], [ %102, %vector.body.5 ], [ %110, %vector.body.6 ]
  %bin.rdx = or <16 x i8> %.lcssa117, %.lcssa118
  %111 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %48
  br i1 %cmp.n, label %.preheader.loopexit, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  %ind.end105 = getelementptr i8, ptr %54, i64 %n.vec
  %n.vec.remaining = and i64 %48, 24
  %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
  br i1 %min.epilog.iters.check, label %.lr.ph.preheader, label %vec.epilog.ph

.lr.ph.preheader:                                 ; preds = %vec.epilog.middle.block, %iter.check, %vec.epilog.iter.check
  %.06883.ph = phi i8 [ %53, %iter.check ], [ %111, %vec.epilog.iter.check ], [ %117, %vec.epilog.middle.block ]
  %.06982.ph = phi ptr [ %54, %iter.check ], [ %ind.end105, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
  %.07181.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec104, %vec.epilog.middle.block ]
  br label %.lr.ph

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %bc.merge.rdx = phi i8 [ %111, %vec.epilog.iter.check ], [ %53, %vector.main.loop.iter.check ]
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %n.vec104 = and i64 %48, 248
  %ind.end = getelementptr i8, ptr %54, i64 %n.vec104
  %112 = insertelement <8 x i8> <i8 poison, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, i8 %bc.merge.rdx, i64 0
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index107 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next112, %vec.epilog.vector.body ]
  %vec.phi108 = phi <8 x i8> [ %112, %vec.epilog.ph ], [ %115, %vec.epilog.vector.body ]
  %next.gep109 = getelementptr i8, ptr %54, i64 %index107
  %113 = getelementptr inbounds [64 x i8], ptr %12, i64 0, i64 %index107
  %wide.load110 = load <8 x i8>, ptr %113, align 8, !tbaa !15
  %wide.load111 = load <8 x i8>, ptr %next.gep109, align 1, !tbaa !15
  %114 = xor <8 x i8> %wide.load111, %wide.load110
  %115 = or <8 x i8> %114, %vec.phi108
  %index.next112 = add nuw i64 %index107, 8
  %116 = icmp eq i64 %index.next112, %n.vec104
  br i1 %116, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !20

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %117 = call i8 @llvm.vector.reduce.or.v8i8(<8 x i8> %115)
  %cmp.n113 = icmp eq i64 %n.vec104, %48
  br i1 %cmp.n113, label %.preheader.loopexit, label %.lr.ph.preheader

.preheader.loopexit:                              ; preds = %.lr.ph, %vec.epilog.middle.block, %middle.block
  %.lcssa96 = phi i8 [ %111, %middle.block ], [ %117, %vec.epilog.middle.block ], [ %127, %.lr.ph ]
  %scevgep = getelementptr i8, ptr %11, i64 %56
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %45
  %.069.lcssa = phi ptr [ %54, %45 ], [ %scevgep, %.preheader.loopexit ]
  %.068.lcssa = phi i8 [ %53, %45 ], [ %.lcssa96, %.preheader.loopexit ]
  %118 = zext nneg i32 %30 to i64
  %119 = add nsw i64 %20, -2
  %.not91 = icmp eq i64 %119, %118
  br i1 %.not91, label %._crit_edge, label %.lr.ph88.preheader

.lr.ph88.preheader:                               ; preds = %.preheader
  %120 = sub nsw i64 %119, %118
  %umax = call i64 @llvm.umax.i64(i64 %120, i64 1)
  %xtraiter = and i64 %umax, 1
  %121 = icmp ult i64 %120, 2
  br i1 %121, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph88.preheader.new

.lr.ph88.preheader.new:                           ; preds = %.lr.ph88.preheader
  %unroll_iter = and i64 %umax, -2
  br label %.lr.ph88

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.06883 = phi i8 [ %127, %.lr.ph ], [ %.06883.ph, %.lr.ph.preheader ]
  %.06982 = phi ptr [ %124, %.lr.ph ], [ %.06982.ph, %.lr.ph.preheader ]
  %.07181 = phi i64 [ %128, %.lr.ph ], [ %.07181.ph, %.lr.ph.preheader ]
  %122 = getelementptr inbounds [64 x i8], ptr %12, i64 0, i64 %.07181
  %123 = load i8, ptr %122, align 1, !tbaa !15
  %124 = getelementptr inbounds i8, ptr %.06982, i64 1
  %125 = load i8, ptr %.06982, align 1, !tbaa !15
  %126 = xor i8 %125, %123
  %127 = or i8 %126, %.06883
  %128 = add nuw nsw i64 %.07181, 1
  %exitcond.not = icmp eq i64 %128, %48
  br i1 %exitcond.not, label %.preheader.loopexit, label %.lr.ph, !llvm.loop !21

.lr.ph88:                                         ; preds = %.lr.ph88, %.lr.ph88.preheader.new
  %.06787 = phi i32 [ 0, %.lr.ph88.preheader.new ], [ %144, %.lr.ph88 ]
  %.07086 = phi i64 [ 0, %.lr.ph88.preheader.new ], [ %151, %.lr.ph88 ]
  %.185 = phi i64 [ 0, %.lr.ph88.preheader.new ], [ %152, %.lr.ph88 ]
  %niter = phi i64 [ 0, %.lr.ph88.preheader.new ], [ %niter.next.1, %.lr.ph88 ]
  %129 = getelementptr inbounds i8, ptr %.069.lcssa, i64 %.185
  %130 = load i8, ptr %129, align 1, !tbaa !15
  %131 = zext i8 %130 to i32
  %132 = or i32 %.06787, %131
  %133 = sub nsw i32 0, %132
  %134 = and i32 %133, 128
  %135 = or i32 %134, %132
  %136 = lshr i32 %135, 7
  %137 = xor i32 %136, 1
  %138 = zext nneg i32 %137 to i64
  %139 = add i64 %.07086, %138
  %140 = or disjoint i64 %.185, 1
  %141 = getelementptr inbounds i8, ptr %.069.lcssa, i64 %140
  %142 = load i8, ptr %141, align 1, !tbaa !15
  %143 = zext i8 %142 to i32
  %144 = or i32 %132, %143
  %145 = sub nsw i32 0, %144
  %146 = and i32 %145, 128
  %147 = or i32 %146, %144
  %148 = lshr i32 %147, 7
  %149 = xor i32 %148, 1
  %150 = zext nneg i32 %149 to i64
  %151 = add i64 %139, %150
  %152 = add nuw i64 %.185, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph88, !llvm.loop !22

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph88, %.lr.ph88.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph88.preheader ], [ %151, %.lr.ph88 ]
  %.06787.unr = phi i32 [ 0, %.lr.ph88.preheader ], [ %144, %.lr.ph88 ]
  %.07086.unr = phi i64 [ 0, %.lr.ph88.preheader ], [ %151, %.lr.ph88 ]
  %.185.unr = phi i64 [ 0, %.lr.ph88.preheader ], [ %152, %.lr.ph88 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph88.epil

.lr.ph88.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa
  %153 = getelementptr inbounds i8, ptr %.069.lcssa, i64 %.185.unr
  %154 = load i8, ptr %153, align 1, !tbaa !15
  %155 = zext i8 %154 to i32
  %156 = or i32 %.06787.unr, %155
  %157 = sub nsw i32 0, %156
  %158 = and i32 %157, 128
  %159 = or i32 %158, %156
  %160 = lshr i32 %159, 7
  %161 = xor i32 %160, 1
  %162 = zext nneg i32 %161 to i64
  %163 = add i64 %.07086.unr, %162
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph88.epil, %._crit_edge.loopexit.unr-lcssa, %.preheader
  %.070.lcssa = phi i64 [ 0, %.preheader ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %163, %.lr.ph88.epil ]
  %164 = getelementptr inbounds i8, ptr %.069.lcssa, i64 %.070.lcssa
  %165 = getelementptr inbounds i8, ptr %164, i64 1
  %166 = load i8, ptr %164, align 1, !tbaa !15
  %167 = xor i8 %166, 1
  %168 = or i8 %167, %.068.lcssa
  %.not79 = icmp eq i8 %168, 0
  br i1 %.not79, label %169, label %175

169:                                              ; preds = %._crit_edge
  %170 = ptrtoint ptr %165 to i64
  %171 = ptrtoint ptr %11 to i64
  %.neg = sub i64 %171, %170
  %172 = add i64 %.neg, %20
  %173 = icmp ugt i64 %172, %9
  br i1 %173, label %175, label %174

174:                                              ; preds = %169
  store i64 %172, ptr %6, align 8, !tbaa !23
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %8, ptr nonnull align 1 %165, i64 %172, i1 false)
  br label %175

175:                                              ; preds = %169, %._crit_edge, %40, %174, %44
  %.066 = phi i32 [ %41, %40 ], [ %43, %44 ], [ 0, %174 ], [ -16640, %._crit_edge ], [ -17408, %169 ]
  call void @mbedtls_zeroize(ptr noundef nonnull %11, i64 noundef 1024)
  call void @mbedtls_zeroize(ptr noundef nonnull %12, i64 noundef 64)
  br label %176

176:                                              ; preds = %27, %22, %18, %15, %175
  %.0 = phi i32 [ %.066, %175 ], [ -16512, %15 ], [ -16512, %18 ], [ -16512, %22 ], [ -16512, %27 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %11) #5
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden void @mbedtls_zeroize(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.vector.reduce.or.v16i8(<16 x i8>) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.vector.reduce.or.v8i8(<8 x i8>) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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, !7, i64 328}
!6 = !{!"", !7, i64 0, !10, i64 8, !11, i64 16, !11, i64 40, !11, i64 64, !11, i64 88, !11, i64 112, !11, i64 136, !11, i64 160, !11, i64 184, !11, i64 208, !11, i64 232, !11, i64 256, !11, i64 280, !11, i64 304, !7, i64 328, !7, i64 332}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"", !7, i64 0, !10, i64 8, !12, i64 16}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !10, i64 8}
!14 = !{!6, !7, i64 332}
!15 = !{!8, !8, i64 0}
!16 = distinct !{!16, !17, !18, !19}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !17, !18, !19}
!21 = distinct !{!21, !17, !19, !18}
!22 = distinct !{!22, !17}
!23 = !{!10, !10, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass