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

; 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_camellia_context = type { i32, [68 x i32] }

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_camellia_setkey_dec(ptr noundef %0, ptr noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca %struct.mbedtls_camellia_context, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.start.p0(i64 276, ptr %10) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  call void @mbedtls_camellia_init(ptr noundef %10)
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = call i32 @mbedtls_camellia_setkey_enc(ptr noundef %10, ptr noundef %13, i32 noundef %14)
  store i32 %15, ptr %8, align 4, !tbaa !9
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %3
  br label %107

18:                                               ; preds = %3
  %19 = getelementptr inbounds %struct.mbedtls_camellia_context, ptr %10, i32 0, i32 0
  %20 = load i32, ptr %19, align 4, !tbaa !11
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.mbedtls_camellia_context, ptr %21, i32 0, i32 0
  store i32 %20, ptr %22, align 4, !tbaa !11
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.mbedtls_camellia_context, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 4, !tbaa !11
  %26 = icmp eq i32 %25, 4
  %27 = zext i1 %26 to i32
  store i32 %27, ptr %7, align 4, !tbaa !9
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.mbedtls_camellia_context, ptr %28, i32 0, i32 1
  %30 = getelementptr inbounds [68 x i32], ptr %29, i64 0, i64 0
  store ptr %30, ptr %11, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.mbedtls_camellia_context, ptr %10, i32 0, i32 1
  %32 = getelementptr inbounds [68 x i32], ptr %31, i64 0, i64 0
  %33 = getelementptr inbounds i32, ptr %32, i64 48
  %34 = load i32, ptr %7, align 4, !tbaa !9
  %35 = mul nsw i32 8, %34
  %36 = mul nsw i32 %35, 2
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr %33, i64 %37
  store ptr %38, ptr %12, align 8, !tbaa !5
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  %40 = getelementptr inbounds i32, ptr %39, i32 1
  store ptr %40, ptr %12, align 8, !tbaa !5
  %41 = load i32, ptr %39, align 4, !tbaa !9
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  %43 = getelementptr inbounds i32, ptr %42, i32 1
  store ptr %43, ptr %11, align 8, !tbaa !5
  store i32 %41, ptr %42, align 4, !tbaa !9
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = getelementptr inbounds i32, ptr %44, i32 1
  store ptr %45, ptr %12, align 8, !tbaa !5
  %46 = load i32, ptr %44, align 4, !tbaa !9
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = getelementptr inbounds i32, ptr %47, i32 1
  store ptr %48, ptr %11, align 8, !tbaa !5
  store i32 %46, ptr %47, align 4, !tbaa !9
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = getelementptr inbounds i32, ptr %49, i32 1
  store ptr %50, ptr %12, align 8, !tbaa !5
  %51 = load i32, ptr %49, align 4, !tbaa !9
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = getelementptr inbounds i32, ptr %52, i32 1
  store ptr %53, ptr %11, align 8, !tbaa !5
  store i32 %51, ptr %52, align 4, !tbaa !9
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = getelementptr inbounds i32, ptr %54, i32 1
  store ptr %55, ptr %12, align 8, !tbaa !5
  %56 = load i32, ptr %54, align 4, !tbaa !9
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  %58 = getelementptr inbounds i32, ptr %57, i32 1
  store ptr %58, ptr %11, align 8, !tbaa !5
  store i32 %56, ptr %57, align 4, !tbaa !9
  %59 = load i32, ptr %7, align 4, !tbaa !9
  %60 = mul nsw i32 8, %59
  %61 = add nsw i32 22, %60
  %62 = sext i32 %61 to i64
  store i64 %62, ptr %9, align 8, !tbaa !13
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  %64 = getelementptr inbounds i32, ptr %63, i64 -6
  store ptr %64, ptr %12, align 8, !tbaa !5
  br label %65

65:                                               ; preds = %79, %18
  %66 = load i64, ptr %9, align 8, !tbaa !13
  %67 = icmp ugt i64 %66, 0
  br i1 %67, label %68, label %84

68:                                               ; preds = %65
  %69 = load ptr, ptr %12, align 8, !tbaa !5
  %70 = getelementptr inbounds i32, ptr %69, i32 1
  store ptr %70, ptr %12, align 8, !tbaa !5
  %71 = load i32, ptr %69, align 4, !tbaa !9
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = getelementptr inbounds i32, ptr %72, i32 1
  store ptr %73, ptr %11, align 8, !tbaa !5
  store i32 %71, ptr %72, align 4, !tbaa !9
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = getelementptr inbounds i32, ptr %74, i32 1
  store ptr %75, ptr %12, align 8, !tbaa !5
  %76 = load i32, ptr %74, align 4, !tbaa !9
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = getelementptr inbounds i32, ptr %77, i32 1
  store ptr %78, ptr %11, align 8, !tbaa !5
  store i32 %76, ptr %77, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %68
  %80 = load i64, ptr %9, align 8, !tbaa !13
  %81 = add i64 %80, -1
  store i64 %81, ptr %9, align 8, !tbaa !13
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = getelementptr inbounds i32, ptr %82, i64 -4
  store ptr %83, ptr %12, align 8, !tbaa !5
  br label %65, !llvm.loop !15

84:                                               ; preds = %65
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = getelementptr inbounds i32, ptr %85, i64 -2
  store ptr %86, ptr %12, align 8, !tbaa !5
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = getelementptr inbounds i32, ptr %87, i32 1
  store ptr %88, ptr %12, align 8, !tbaa !5
  %89 = load i32, ptr %87, align 4, !tbaa !9
  %90 = load ptr, ptr %11, align 8, !tbaa !5
  %91 = getelementptr inbounds i32, ptr %90, i32 1
  store ptr %91, ptr %11, align 8, !tbaa !5
  store i32 %89, ptr %90, align 4, !tbaa !9
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = getelementptr inbounds i32, ptr %92, i32 1
  store ptr %93, ptr %12, align 8, !tbaa !5
  %94 = load i32, ptr %92, align 4, !tbaa !9
  %95 = load ptr, ptr %11, align 8, !tbaa !5
  %96 = getelementptr inbounds i32, ptr %95, i32 1
  store ptr %96, ptr %11, align 8, !tbaa !5
  store i32 %94, ptr %95, align 4, !tbaa !9
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = getelementptr inbounds i32, ptr %97, i32 1
  store ptr %98, ptr %12, align 8, !tbaa !5
  %99 = load i32, ptr %97, align 4, !tbaa !9
  %100 = load ptr, ptr %11, align 8, !tbaa !5
  %101 = getelementptr inbounds i32, ptr %100, i32 1
  store ptr %101, ptr %11, align 8, !tbaa !5
  store i32 %99, ptr %100, align 4, !tbaa !9
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = getelementptr inbounds i32, ptr %102, i32 1
  store ptr %103, ptr %12, align 8, !tbaa !5
  %104 = load i32, ptr %102, align 4, !tbaa !9
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = getelementptr inbounds i32, ptr %105, i32 1
  store ptr %106, ptr %11, align 8, !tbaa !5
  store i32 %104, ptr %105, align 4, !tbaa !9
  br label %107

107:                                              ; preds = %84, %17
  call void @mbedtls_camellia_free(ptr noundef %10)
  %108 = load i32, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 276, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  ret i32 %108
}

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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, !10, i64 0}
!12 = !{!"", !10, i64 0, !7, i64 4}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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

%struct.mbedtls_camellia_context = type { i32, [68 x i32] }

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_camellia_setkey_dec(ptr nocapture noundef writeonly %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca %struct.mbedtls_camellia_context, align 4
  call void @llvm.lifetime.start.p0(i64 276, ptr nonnull %4) #2
  call void @mbedtls_camellia_init(ptr noundef nonnull %4)
  %5 = call i32 @mbedtls_camellia_setkey_enc(ptr noundef nonnull %4, ptr noundef %1, i32 noundef %2)
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %vector.memcheck, label %69

vector.memcheck:                                  ; preds = %3
  %6 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %6, ptr %0, align 4, !tbaa !5
  %.not61 = icmp eq i32 %6, 4
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = getelementptr inbounds i8, ptr %4, i64 196
  %9 = select i1 %.not61, i32 8, i32 0
  %10 = shl nuw nsw i32 %9, 1
  %11 = zext nneg i32 %10 to i64
  %12 = getelementptr inbounds i32, ptr %8, i64 %11
  %13 = getelementptr i8, ptr %0, i64 20
  %14 = load <4 x i32>, ptr %12, align 4, !tbaa !10
  store <4 x i32> %14, ptr %7, align 4, !tbaa !10
  %15 = or disjoint i32 %9, 22
  %16 = zext nneg i32 %15 to i64
  %.035 = getelementptr inbounds i8, ptr %12, i64 -8
  %17 = shl nuw nsw i32 %9, 3
  %18 = zext nneg i32 %17 to i64
  %19 = getelementptr i8, ptr %0, i64 %18
  %scevgep = getelementptr i8, ptr %19, i64 196
  %scevgep40 = getelementptr inbounds i8, ptr %4, i64 20
  %bound0 = icmp ult ptr %13, %12
  %bound1 = icmp ult ptr %scevgep40, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %20 = or disjoint i32 %9, 20
  %n.vec = zext nneg i32 %20 to i64
  %21 = mul nsw i64 %n.vec, -8
  %ind.end = getelementptr i8, ptr %.035, i64 %21
  %22 = mul nsw i64 %n.vec, -8
  %ind.end41 = getelementptr i8, ptr %12, i64 %22
  %23 = shl nuw nsw i64 %n.vec, 3
  %ind.end43 = getelementptr i8, ptr %13, i64 %23
  %ind.end45 = sub nsw i64 %16, %n.vec
  %next.gep50 = getelementptr i8, ptr %0, i64 36
  %24 = getelementptr i8, ptr %12, i64 -16
  %25 = getelementptr i8, ptr %12, i64 -32
  %wide.vec = load <4 x i32>, ptr %24, align 4, !tbaa !10
  %wide.vec51 = load <4 x i32>, ptr %25, align 4, !tbaa !10
  %interleaved.vec = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec, ptr %13, align 4, !tbaa !10
  %interleaved.vec58 = shufflevector <4 x i32> %wide.vec51, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec58, ptr %next.gep50, align 4, !tbaa !10
  %next.gep49.1 = getelementptr i8, ptr %0, i64 52
  %next.gep50.1 = getelementptr i8, ptr %0, i64 68
  %26 = getelementptr i8, ptr %12, i64 -48
  %27 = getelementptr i8, ptr %12, i64 -64
  %wide.vec.1 = load <4 x i32>, ptr %26, align 4, !tbaa !10
  %wide.vec51.1 = load <4 x i32>, ptr %27, align 4, !tbaa !10
  %interleaved.vec.1 = shufflevector <4 x i32> %wide.vec.1, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec.1, ptr %next.gep49.1, align 4, !tbaa !10
  %interleaved.vec58.1 = shufflevector <4 x i32> %wide.vec51.1, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec58.1, ptr %next.gep50.1, align 4, !tbaa !10
  %next.gep49.2 = getelementptr i8, ptr %0, i64 84
  %next.gep50.2 = getelementptr i8, ptr %0, i64 100
  %28 = getelementptr i8, ptr %12, i64 -80
  %29 = getelementptr i8, ptr %12, i64 -96
  %wide.vec.2 = load <4 x i32>, ptr %28, align 4, !tbaa !10
  %wide.vec51.2 = load <4 x i32>, ptr %29, align 4, !tbaa !10
  %interleaved.vec.2 = shufflevector <4 x i32> %wide.vec.2, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec.2, ptr %next.gep49.2, align 4, !tbaa !10
  %interleaved.vec58.2 = shufflevector <4 x i32> %wide.vec51.2, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec58.2, ptr %next.gep50.2, align 4, !tbaa !10
  %next.gep49.3 = getelementptr i8, ptr %0, i64 116
  %next.gep50.3 = getelementptr i8, ptr %0, i64 132
  %30 = getelementptr i8, ptr %12, i64 -112
  %31 = getelementptr i8, ptr %12, i64 -128
  %wide.vec.3 = load <4 x i32>, ptr %30, align 4, !tbaa !10
  %wide.vec51.3 = load <4 x i32>, ptr %31, align 4, !tbaa !10
  %interleaved.vec.3 = shufflevector <4 x i32> %wide.vec.3, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec.3, ptr %next.gep49.3, align 4, !tbaa !10
  %interleaved.vec58.3 = shufflevector <4 x i32> %wide.vec51.3, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec58.3, ptr %next.gep50.3, align 4, !tbaa !10
  %next.gep49.4 = getelementptr i8, ptr %0, i64 148
  %next.gep50.4 = getelementptr i8, ptr %0, i64 164
  %32 = getelementptr i8, ptr %12, i64 -144
  %33 = getelementptr i8, ptr %12, i64 -160
  %wide.vec.4 = load <4 x i32>, ptr %32, align 4, !tbaa !10
  %wide.vec51.4 = load <4 x i32>, ptr %33, align 4, !tbaa !10
  %interleaved.vec.4 = shufflevector <4 x i32> %wide.vec.4, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec.4, ptr %next.gep49.4, align 4, !tbaa !10
  %interleaved.vec58.4 = shufflevector <4 x i32> %wide.vec51.4, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec58.4, ptr %next.gep50.4, align 4, !tbaa !10
  br i1 %.not61, label %vector.body.5, label %scalar.ph.preheader, !llvm.loop !11

vector.body.5:                                    ; preds = %vector.ph
  %next.gep49.5 = getelementptr i8, ptr %0, i64 180
  %next.gep50.5 = getelementptr i8, ptr %0, i64 196
  %34 = getelementptr i8, ptr %12, i64 -176
  %35 = getelementptr i8, ptr %12, i64 -192
  %wide.vec.5 = load <4 x i32>, ptr %34, align 4, !tbaa !10
  %wide.vec51.5 = load <4 x i32>, ptr %35, align 4, !tbaa !10
  %interleaved.vec.5 = shufflevector <4 x i32> %wide.vec.5, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec.5, ptr %next.gep49.5, align 4, !tbaa !10
  %interleaved.vec58.5 = shufflevector <4 x i32> %wide.vec51.5, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec58.5, ptr %next.gep50.5, align 4, !tbaa !10
  %next.gep49.6 = getelementptr i8, ptr %0, i64 212
  %next.gep50.6 = getelementptr i8, ptr %0, i64 228
  %36 = getelementptr i8, ptr %12, i64 -208
  %37 = getelementptr i8, ptr %12, i64 -224
  %wide.vec.6 = load <4 x i32>, ptr %36, align 4, !tbaa !10
  %wide.vec51.6 = load <4 x i32>, ptr %37, align 4, !tbaa !10
  %interleaved.vec.6 = shufflevector <4 x i32> %wide.vec.6, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec.6, ptr %next.gep49.6, align 4, !tbaa !10
  %interleaved.vec58.6 = shufflevector <4 x i32> %wide.vec51.6, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  store <4 x i32> %interleaved.vec58.6, ptr %next.gep50.6, align 4, !tbaa !10
  br label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %vector.ph, %vector.body.5, %vector.memcheck
  %.039.ph = phi ptr [ %.035, %vector.memcheck ], [ %ind.end, %vector.body.5 ], [ %ind.end, %vector.ph ]
  %.pn38.ph = phi ptr [ %12, %vector.memcheck ], [ %ind.end41, %vector.body.5 ], [ %ind.end41, %vector.ph ]
  %.03237.ph = phi ptr [ %13, %vector.memcheck ], [ %ind.end43, %vector.body.5 ], [ %ind.end43, %vector.ph ]
  %.03336.ph = phi i64 [ %16, %vector.memcheck ], [ %ind.end45, %vector.body.5 ], [ %ind.end45, %vector.ph ]
  %38 = add nsw i64 %.03336.ph, -1
  %xtraiter = and i64 %.03336.ph, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %.039.prol = phi ptr [ %.0.prol, %scalar.ph.prol ], [ %.039.ph, %scalar.ph.preheader ]
  %.pn38.prol = phi ptr [ %.039.prol, %scalar.ph.prol ], [ %.pn38.ph, %scalar.ph.preheader ]
  %.03237.prol = phi ptr [ %43, %scalar.ph.prol ], [ %.03237.ph, %scalar.ph.preheader ]
  %.03336.prol = phi i64 [ %44, %scalar.ph.prol ], [ %.03336.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %39 = getelementptr inbounds i8, ptr %.pn38.prol, i64 -4
  %40 = load i32, ptr %.039.prol, align 4, !tbaa !10
  %41 = getelementptr inbounds i8, ptr %.03237.prol, i64 4
  store i32 %40, ptr %.03237.prol, align 4, !tbaa !10
  %42 = load i32, ptr %39, align 4, !tbaa !10
  %43 = getelementptr inbounds i8, ptr %.03237.prol, i64 8
  store i32 %42, ptr %41, align 4, !tbaa !10
  %44 = add nsw i64 %.03336.prol, -1
  %.0.prol = getelementptr inbounds i8, ptr %.039.prol, i64 -8
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !15

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %.039.lcssa.unr = phi ptr [ poison, %scalar.ph.preheader ], [ %.039.prol, %scalar.ph.prol ]
  %.lcssa.unr = phi ptr [ poison, %scalar.ph.preheader ], [ %43, %scalar.ph.prol ]
  %.039.unr = phi ptr [ %.039.ph, %scalar.ph.preheader ], [ %.0.prol, %scalar.ph.prol ]
  %.pn38.unr = phi ptr [ %.pn38.ph, %scalar.ph.preheader ], [ %.039.prol, %scalar.ph.prol ]
  %.03237.unr = phi ptr [ %.03237.ph, %scalar.ph.preheader ], [ %43, %scalar.ph.prol ]
  %.03336.unr = phi i64 [ %.03336.ph, %scalar.ph.preheader ], [ %44, %scalar.ph.prol ]
  %45 = icmp ult i64 %38, 3
  br i1 %45, label %.loopexit, label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %.039 = phi ptr [ %.0.3, %scalar.ph ], [ %.039.unr, %scalar.ph.prol.loopexit ]
  %.pn38 = phi ptr [ %.0.2, %scalar.ph ], [ %.pn38.unr, %scalar.ph.prol.loopexit ]
  %.03237 = phi ptr [ %65, %scalar.ph ], [ %.03237.unr, %scalar.ph.prol.loopexit ]
  %.03336 = phi i64 [ %66, %scalar.ph ], [ %.03336.unr, %scalar.ph.prol.loopexit ]
  %46 = getelementptr inbounds i8, ptr %.pn38, i64 -4
  %47 = load i32, ptr %.039, align 4, !tbaa !10
  %48 = getelementptr inbounds i8, ptr %.03237, i64 4
  store i32 %47, ptr %.03237, align 4, !tbaa !10
  %49 = load i32, ptr %46, align 4, !tbaa !10
  %50 = getelementptr inbounds i8, ptr %.03237, i64 8
  store i32 %49, ptr %48, align 4, !tbaa !10
  %.0 = getelementptr inbounds i8, ptr %.039, i64 -8
  %51 = getelementptr inbounds i8, ptr %.039, i64 -4
  %52 = load i32, ptr %.0, align 4, !tbaa !10
  %53 = getelementptr inbounds i8, ptr %.03237, i64 12
  store i32 %52, ptr %50, align 4, !tbaa !10
  %54 = load i32, ptr %51, align 4, !tbaa !10
  %55 = getelementptr inbounds i8, ptr %.03237, i64 16
  store i32 %54, ptr %53, align 4, !tbaa !10
  %.0.1 = getelementptr inbounds i8, ptr %.039, i64 -16
  %56 = getelementptr inbounds i8, ptr %.039, i64 -12
  %57 = load i32, ptr %.0.1, align 4, !tbaa !10
  %58 = getelementptr inbounds i8, ptr %.03237, i64 20
  store i32 %57, ptr %55, align 4, !tbaa !10
  %59 = load i32, ptr %56, align 4, !tbaa !10
  %60 = getelementptr inbounds i8, ptr %.03237, i64 24
  store i32 %59, ptr %58, align 4, !tbaa !10
  %.0.2 = getelementptr inbounds i8, ptr %.039, i64 -24
  %61 = getelementptr inbounds i8, ptr %.039, i64 -20
  %62 = load i32, ptr %.0.2, align 4, !tbaa !10
  %63 = getelementptr inbounds i8, ptr %.03237, i64 28
  store i32 %62, ptr %60, align 4, !tbaa !10
  %64 = load i32, ptr %61, align 4, !tbaa !10
  %65 = getelementptr inbounds i8, ptr %.03237, i64 32
  store i32 %64, ptr %63, align 4, !tbaa !10
  %66 = add nsw i64 %.03336, -4
  %.0.3 = getelementptr inbounds i8, ptr %.039, i64 -32
  %.not34.3 = icmp eq i64 %66, 0
  br i1 %.not34.3, label %.loopexit, label %scalar.ph, !llvm.loop !17

.loopexit:                                        ; preds = %scalar.ph, %scalar.ph.prol.loopexit
  %.039.lcssa = phi ptr [ %.039.lcssa.unr, %scalar.ph.prol.loopexit ], [ %.0.2, %scalar.ph ]
  %.lcssa = phi ptr [ %.lcssa.unr, %scalar.ph.prol.loopexit ], [ %65, %scalar.ph ]
  %67 = getelementptr inbounds i8, ptr %.039.lcssa, i64 -16
  %68 = load <4 x i32>, ptr %67, align 4, !tbaa !10
  store <4 x i32> %68, ptr %.lcssa, align 4, !tbaa !10
  br label %69

69:                                               ; preds = %3, %.loopexit
  call void @mbedtls_camellia_free(ptr noundef nonnull %4)
  call void @llvm.lifetime.end.p0(i64 276, ptr nonnull %4) #2
  ret i32 %5
}

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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, !8, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !12, !13}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,VectorCombinePass