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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_md_hmac_starts(ptr noundef %0, ptr noundef %1, i64 noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca [64 x i8], align 16
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 64, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %25, label %15

15:                                               ; preds = %3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = icmp eq ptr %18, null
  br i1 %19, label %25, label %20

20:                                               ; preds = %15
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %21, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %26

25:                                               ; preds = %20, %15, %3
  store i32 -20736, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %161

26:                                               ; preds = %20
  %27 = load i64, ptr %7, align 8, !tbaa !9
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %30, i32 0, i32 3
  %32 = load i32, ptr %31, align 4, !tbaa !14
  %33 = sext i32 %32 to i64
  %34 = icmp ugt i64 %27, %33
  br i1 %34, label %35, label %70

35:                                               ; preds = %26
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %38, i32 0, i32 4
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %41, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !18
  call void %40(ptr noundef %43)
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %46, i32 0, i32 5
  %48 = load ptr, ptr %47, align 8, !tbaa !19
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %49, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !18
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load i64, ptr %7, align 8, !tbaa !9
  call void %48(ptr noundef %51, ptr noundef %52, i64 noundef %53)
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !11
  %57 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %56, i32 0, i32 6
  %58 = load ptr, ptr %57, align 8, !tbaa !20
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %59, i32 0, i32 1
  %61 = load ptr, ptr %60, align 8, !tbaa !18
  %62 = getelementptr inbounds [64 x i8], ptr %8, i64 0, i64 0
  call void %58(ptr noundef %61, ptr noundef %62)
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  %66 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %65, i32 0, i32 2
  %67 = load i32, ptr %66, align 8, !tbaa !21
  %68 = sext i32 %67 to i64
  store i64 %68, ptr %7, align 8, !tbaa !9
  %69 = getelementptr inbounds [64 x i8], ptr %8, i64 0, i64 0
  store ptr %69, ptr %6, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %35, %26
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %71, i32 0, i32 2
  %73 = load ptr, ptr %72, align 8, !tbaa !13
  store ptr %73, ptr %9, align 8, !tbaa !5
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %74, i32 0, i32 2
  %76 = load ptr, ptr %75, align 8, !tbaa !13
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !11
  %80 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %79, i32 0, i32 3
  %81 = load i32, ptr %80, align 4, !tbaa !14
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i8, ptr %76, i64 %82
  store ptr %83, ptr %10, align 8, !tbaa !5
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !11
  %88 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %87, i32 0, i32 3
  %89 = load i32, ptr %88, align 4, !tbaa !14
  %90 = sext i32 %89 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %84, i8 54, i64 %90, i1 false)
  %91 = load ptr, ptr %10, align 8, !tbaa !5
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %92, i32 0, i32 0
  %94 = load ptr, ptr %93, align 8, !tbaa !11
  %95 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %94, i32 0, i32 3
  %96 = load i32, ptr %95, align 4, !tbaa !14
  %97 = sext i32 %96 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %91, i8 92, i64 %97, i1 false)
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %98

98:                                               ; preds = %133, %70
  %99 = load i64, ptr %11, align 8, !tbaa !9
  %100 = load i64, ptr %7, align 8, !tbaa !9
  %101 = icmp ult i64 %99, %100
  br i1 %101, label %102, label %136

102:                                              ; preds = %98
  %103 = load ptr, ptr %9, align 8, !tbaa !5
  %104 = load i64, ptr %11, align 8, !tbaa !9
  %105 = getelementptr inbounds i8, ptr %103, i64 %104
  %106 = load i8, ptr %105, align 1, !tbaa !22
  %107 = zext i8 %106 to i32
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = load i64, ptr %11, align 8, !tbaa !9
  %110 = getelementptr inbounds i8, ptr %108, i64 %109
  %111 = load i8, ptr %110, align 1, !tbaa !22
  %112 = zext i8 %111 to i32
  %113 = xor i32 %107, %112
  %114 = trunc i32 %113 to i8
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = load i64, ptr %11, align 8, !tbaa !9
  %117 = getelementptr inbounds i8, ptr %115, i64 %116
  store i8 %114, ptr %117, align 1, !tbaa !22
  %118 = load ptr, ptr %10, align 8, !tbaa !5
  %119 = load i64, ptr %11, align 8, !tbaa !9
  %120 = getelementptr inbounds i8, ptr %118, i64 %119
  %121 = load i8, ptr %120, align 1, !tbaa !22
  %122 = zext i8 %121 to i32
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = load i64, ptr %11, align 8, !tbaa !9
  %125 = getelementptr inbounds i8, ptr %123, i64 %124
  %126 = load i8, ptr %125, align 1, !tbaa !22
  %127 = zext i8 %126 to i32
  %128 = xor i32 %122, %127
  %129 = trunc i32 %128 to i8
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = load i64, ptr %11, align 8, !tbaa !9
  %132 = getelementptr inbounds i8, ptr %130, i64 %131
  store i8 %129, ptr %132, align 1, !tbaa !22
  br label %133

133:                                              ; preds = %102
  %134 = load i64, ptr %11, align 8, !tbaa !9
  %135 = add i64 %134, 1
  store i64 %135, ptr %11, align 8, !tbaa !9
  br label %98, !llvm.loop !23

136:                                              ; preds = %98
  %137 = getelementptr inbounds [64 x i8], ptr %8, i64 0, i64 0
  call void @mbedtls_zeroize(ptr noundef %137, i64 noundef 64)
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %138, i32 0, i32 0
  %140 = load ptr, ptr %139, align 8, !tbaa !11
  %141 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %140, i32 0, i32 4
  %142 = load ptr, ptr %141, align 8, !tbaa !17
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %143, i32 0, i32 1
  %145 = load ptr, ptr %144, align 8, !tbaa !18
  call void %142(ptr noundef %145)
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %146, i32 0, i32 0
  %148 = load ptr, ptr %147, align 8, !tbaa !11
  %149 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %148, i32 0, i32 5
  %150 = load ptr, ptr %149, align 8, !tbaa !19
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %151, i32 0, i32 1
  %153 = load ptr, ptr %152, align 8, !tbaa !18
  %154 = load ptr, ptr %9, align 8, !tbaa !5
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.mbedtls_md_context_t, ptr %155, i32 0, i32 0
  %157 = load ptr, ptr %156, align 8, !tbaa !11
  %158 = getelementptr inbounds %struct.mbedtls_md_info_t, ptr %157, i32 0, i32 3
  %159 = load i32, ptr %158, align 4, !tbaa !14
  %160 = sext i32 %159 to i64
  call void %150(ptr noundef %153, ptr noundef %154, i64 noundef %160)
  store i32 0, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %161

161:                                              ; preds = %136, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr %8) #3
  %162 = load i32, ptr %4, align 4
  ret i32 %162
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 0}
!12 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!12, !6, i64 16}
!14 = !{!15, !16, i64 20}
!15 = !{!"mbedtls_md_info_t", !16, i64 0, !6, i64 8, !16, i64 16, !16, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!16 = !{!"int", !7, i64 0}
!17 = !{!15, !6, i64 24}
!18 = !{!12, !6, i64 8}
!19 = !{!15, !6, i64 32}
!20 = !{!15, !6, i64 40}
!21 = !{!15, !16, i64 16}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"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"

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -20736, 1) i32 @mbedtls_md_hmac_starts(ptr noundef readonly %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #1 {
  %4 = alloca [64 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #3
  %5 = icmp eq ptr %0, null
  br i1 %5, label %103, label %6

6:                                                ; preds = %3
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %103, label %9

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !10
  %12 = icmp eq ptr %11, null
  br i1 %12, label %103, label %13

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %7, i64 20
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = sext i32 %15 to i64
  %17 = icmp ult i64 %16, %2
  br i1 %17, label %18, label %35

18:                                               ; preds = %13
  %19 = getelementptr inbounds i8, ptr %7, i64 24
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  tail call void %20(ptr noundef %22) #3
  %23 = load ptr, ptr %0, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 32
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  %26 = load ptr, ptr %21, align 8, !tbaa !15
  tail call void %25(ptr noundef %26, ptr noundef %1, i64 noundef %2) #3
  %27 = load ptr, ptr %0, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i64 40
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  %30 = load ptr, ptr %21, align 8, !tbaa !15
  call void %29(ptr noundef %30, ptr noundef nonnull %4) #3
  %31 = load ptr, ptr %0, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  %33 = load i32, ptr %32, align 8, !tbaa !18
  %34 = sext i32 %33 to i64
  %.pre = load ptr, ptr %10, align 8, !tbaa !10
  %.phi.trans.insert = getelementptr inbounds i8, ptr %31, i64 20
  %.pre49 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !11
  %.pre50 = sext i32 %.pre49 to i64
  br label %35

35:                                               ; preds = %18, %13
  %.pre-phi = phi i64 [ %.pre50, %18 ], [ %16, %13 ]
  %36 = phi ptr [ %.pre, %18 ], [ %11, %13 ]
  %.044 = phi i64 [ %34, %18 ], [ %2, %13 ]
  %.043 = phi ptr [ %4, %18 ], [ %1, %13 ]
  %37 = getelementptr i8, ptr %36, i64 %.pre-phi
  call void @llvm.memset.p0.i64(ptr align 1 %36, i8 54, i64 %.pre-phi, i1 false)
  %38 = load ptr, ptr %0, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 20
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %37, i8 92, i64 %41, i1 false)
  %.not = icmp eq i64 %.044, 0
  br i1 %.not, label %._crit_edge, label %iter.check

iter.check:                                       ; preds = %35
  %min.iters.check = icmp ult i64 %.044, 8
  br i1 %min.iters.check, label %.lr.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %iter.check
  %scevgep = getelementptr i8, ptr %36, i64 %.044
  %42 = add i64 %.pre-phi, %.044
  %scevgep51 = getelementptr i8, ptr %36, i64 %42
  %scevgep52 = getelementptr i8, ptr %.043, i64 %.044
  %bound0 = icmp ult ptr %36, %scevgep51
  %bound1 = icmp ult ptr %37, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  %bound053 = icmp ult ptr %36, %scevgep52
  %bound154 = icmp ult ptr %.043, %scevgep
  %found.conflict55 = and i1 %bound053, %bound154
  %conflict.rdx = or i1 %found.conflict, %found.conflict55
  %bound056 = icmp ult ptr %37, %scevgep52
  %bound157 = icmp ult ptr %.043, %scevgep51
  %found.conflict58 = and i1 %bound056, %bound157
  %conflict.rdx59 = or i1 %conflict.rdx, %found.conflict58
  br i1 %conflict.rdx59, label %.lr.ph.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %vector.memcheck
  %min.iters.check60 = icmp ult i64 %.044, 32
  br i1 %min.iters.check60, label %vec.epilog.ph, label %vector.ph

vector.ph:                                        ; preds = %vector.main.loop.iter.check
  %n.vec = and i64 %.044, -32
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %43 = getelementptr inbounds i8, ptr %36, i64 %index
  %44 = getelementptr inbounds i8, ptr %43, i64 16
  %wide.load = load <16 x i8>, ptr %43, align 1, !tbaa !19, !alias.scope !20, !noalias !23
  %wide.load61 = load <16 x i8>, ptr %44, align 1, !tbaa !19, !alias.scope !20, !noalias !23
  %45 = getelementptr inbounds i8, ptr %.043, i64 %index
  %46 = getelementptr inbounds i8, ptr %45, i64 16
  %wide.load62 = load <16 x i8>, ptr %45, align 1, !tbaa !19, !alias.scope !26
  %wide.load63 = load <16 x i8>, ptr %46, align 1, !tbaa !19, !alias.scope !26
  %47 = xor <16 x i8> %wide.load62, %wide.load
  %48 = xor <16 x i8> %wide.load63, %wide.load61
  store <16 x i8> %47, ptr %43, align 1, !tbaa !19, !alias.scope !20, !noalias !23
  store <16 x i8> %48, ptr %44, align 1, !tbaa !19, !alias.scope !20, !noalias !23
  %49 = getelementptr inbounds i8, ptr %37, i64 %index
  %50 = getelementptr inbounds i8, ptr %49, i64 16
  %wide.load64 = load <16 x i8>, ptr %49, align 1, !tbaa !19, !alias.scope !27, !noalias !26
  %wide.load65 = load <16 x i8>, ptr %50, align 1, !tbaa !19, !alias.scope !27, !noalias !26
  %wide.load66 = load <16 x i8>, ptr %45, align 1, !tbaa !19, !alias.scope !26
  %wide.load67 = load <16 x i8>, ptr %46, align 1, !tbaa !19, !alias.scope !26
  %51 = xor <16 x i8> %wide.load66, %wide.load64
  %52 = xor <16 x i8> %wide.load67, %wide.load65
  store <16 x i8> %51, ptr %49, align 1, !tbaa !19, !alias.scope !27, !noalias !26
  store <16 x i8> %52, ptr %50, align 1, !tbaa !19, !alias.scope !27, !noalias !26
  %index.next = add nuw i64 %index, 32
  %53 = icmp eq i64 %index.next, %n.vec
  br i1 %53, label %middle.block, label %vector.body, !llvm.loop !28

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %.044, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  %n.vec.remaining = and i64 %.044, 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

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %n.vec69 = and i64 %.044, -8
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index70 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next75, %vec.epilog.vector.body ]
  %54 = getelementptr inbounds i8, ptr %36, i64 %index70
  %wide.load71 = load <8 x i8>, ptr %54, align 1, !tbaa !19, !alias.scope !32, !noalias !35
  %55 = getelementptr inbounds i8, ptr %.043, i64 %index70
  %wide.load72 = load <8 x i8>, ptr %55, align 1, !tbaa !19, !alias.scope !38
  %56 = xor <8 x i8> %wide.load72, %wide.load71
  store <8 x i8> %56, ptr %54, align 1, !tbaa !19, !alias.scope !32, !noalias !35
  %57 = getelementptr inbounds i8, ptr %37, i64 %index70
  %wide.load73 = load <8 x i8>, ptr %57, align 1, !tbaa !19, !alias.scope !39, !noalias !38
  %58 = xor <8 x i8> %wide.load72, %wide.load73
  store <8 x i8> %58, ptr %57, align 1, !tbaa !19, !alias.scope !39, !noalias !38
  %index.next75 = add nuw i64 %index70, 8
  %59 = icmp eq i64 %index.next75, %n.vec69
  br i1 %59, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !40

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %cmp.n76 = icmp eq i64 %.044, %n.vec69
  br i1 %cmp.n76, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %vec.epilog.middle.block, %vector.memcheck, %iter.check, %vec.epilog.iter.check
  %.048.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.memcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec69, %vec.epilog.middle.block ]
  %.neg = or disjoint i64 %.048.ph, 1
  %xtraiter = and i64 %.044, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader
  %60 = getelementptr inbounds i8, ptr %36, i64 %.048.ph
  %61 = load i8, ptr %60, align 1, !tbaa !19
  %62 = getelementptr inbounds i8, ptr %.043, i64 %.048.ph
  %63 = load i8, ptr %62, align 1, !tbaa !19
  %64 = xor i8 %63, %61
  store i8 %64, ptr %60, align 1, !tbaa !19
  %65 = getelementptr inbounds i8, ptr %37, i64 %.048.ph
  %66 = load i8, ptr %65, align 1, !tbaa !19
  %67 = load i8, ptr %62, align 1, !tbaa !19
  %68 = xor i8 %67, %66
  store i8 %68, ptr %65, align 1, !tbaa !19
  %69 = or disjoint i64 %.048.ph, 1
  br label %.lr.ph.prol.loopexit

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader
  %.048.unr = phi i64 [ %.048.ph, %.lr.ph.preheader ], [ %69, %.lr.ph.prol ]
  %70 = icmp eq i64 %.044, %.neg
  br i1 %70, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %.048 = phi i64 [ %90, %.lr.ph ], [ %.048.unr, %.lr.ph.prol.loopexit ]
  %71 = getelementptr inbounds i8, ptr %36, i64 %.048
  %72 = load i8, ptr %71, align 1, !tbaa !19
  %73 = getelementptr inbounds i8, ptr %.043, i64 %.048
  %74 = load i8, ptr %73, align 1, !tbaa !19
  %75 = xor i8 %74, %72
  store i8 %75, ptr %71, align 1, !tbaa !19
  %76 = getelementptr inbounds i8, ptr %37, i64 %.048
  %77 = load i8, ptr %76, align 1, !tbaa !19
  %78 = load i8, ptr %73, align 1, !tbaa !19
  %79 = xor i8 %78, %77
  store i8 %79, ptr %76, align 1, !tbaa !19
  %80 = add nuw i64 %.048, 1
  %81 = getelementptr inbounds i8, ptr %36, i64 %80
  %82 = load i8, ptr %81, align 1, !tbaa !19
  %83 = getelementptr inbounds i8, ptr %.043, i64 %80
  %84 = load i8, ptr %83, align 1, !tbaa !19
  %85 = xor i8 %84, %82
  store i8 %85, ptr %81, align 1, !tbaa !19
  %86 = getelementptr inbounds i8, ptr %37, i64 %80
  %87 = load i8, ptr %86, align 1, !tbaa !19
  %88 = load i8, ptr %83, align 1, !tbaa !19
  %89 = xor i8 %88, %87
  store i8 %89, ptr %86, align 1, !tbaa !19
  %90 = add nuw i64 %.048, 2
  %exitcond.not.1 = icmp eq i64 %90, %.044
  br i1 %exitcond.not.1, label %._crit_edge, label %.lr.ph, !llvm.loop !41

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %vec.epilog.middle.block, %35
  call void @mbedtls_zeroize(ptr noundef nonnull %4, i64 noundef 64)
  %91 = load ptr, ptr %0, align 8, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %91, i64 24
  %93 = load ptr, ptr %92, align 8, !tbaa !14
  %94 = getelementptr inbounds i8, ptr %0, i64 8
  %95 = load ptr, ptr %94, align 8, !tbaa !15
  call void %93(ptr noundef %95) #3
  %96 = load ptr, ptr %0, align 8, !tbaa !5
  %97 = getelementptr inbounds i8, ptr %96, i64 32
  %98 = load ptr, ptr %97, align 8, !tbaa !16
  %99 = load ptr, ptr %94, align 8, !tbaa !15
  %100 = getelementptr inbounds i8, ptr %96, i64 20
  %101 = load i32, ptr %100, align 4, !tbaa !11
  %102 = sext i32 %101 to i64
  call void %98(ptr noundef %99, ptr noundef %36, i64 noundef %102) #3
  br label %103

103:                                              ; preds = %3, %6, %9, %._crit_edge
  %.042 = phi i32 [ 0, %._crit_edge ], [ -20736, %9 ], [ -20736, %6 ], [ -20736, %3 ]
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #3
  ret i32 %.042
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 16}
!11 = !{!12, !13, i64 20}
!12 = !{!"mbedtls_md_info_t", !13, i64 0, !7, i64 8, !13, i64 16, !13, i64 20, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80}
!13 = !{!"int", !8, i64 0}
!14 = !{!12, !7, i64 24}
!15 = !{!6, !7, i64 8}
!16 = !{!12, !7, i64 32}
!17 = !{!12, !7, i64 40}
!18 = !{!12, !13, i64 16}
!19 = !{!8, !8, i64 0}
!20 = !{!21}
!21 = distinct !{!21, !22}
!22 = distinct !{!22, !"LVerDomain"}
!23 = !{!24, !25}
!24 = distinct !{!24, !22}
!25 = distinct !{!25, !22}
!26 = !{!25}
!27 = !{!24}
!28 = distinct !{!28, !29, !30, !31}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!"llvm.loop.isvectorized", i32 1}
!31 = !{!"llvm.loop.unroll.runtime.disable"}
!32 = !{!33}
!33 = distinct !{!33, !34}
!34 = distinct !{!34, !"LVerDomain"}
!35 = !{!36, !37}
!36 = distinct !{!36, !34}
!37 = distinct !{!37, !34}
!38 = !{!37}
!39 = !{!36}
!40 = distinct !{!40, !29, !30, !31}
!41 = distinct !{!41, !29, !30}


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