; LLVM IR from square/subzero :: core/external-crypto/modes (xts)

; 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.xts_ctx = type { [1 x %struct.aes_crypt_ctx], [1 x %struct.aes_crypt_ctx], [1 x %struct.aes_crypt_ctx] }
%struct.aes_crypt_ctx = type { [60 x i32], %union.aes_inf, [12 x i8] }
%union.aes_inf = type { i32 }

; 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: inlinehint nounwind uwtable
declare hidden void @xor_block_aligned(ptr noundef, ptr noundef, ptr noundef) #1

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

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

declare i32 @aes_encrypt(ptr noundef, ptr noundef, ptr noundef) #3

declare void @gf_mulx(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @xts_decrypt(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #4 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca [4 x i32], align 16
  %11 = alloca [4 x i32], align 16
  %12 = alloca i8, align 1
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i8, align 1
  %21 = alloca i8, align 1
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #5
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = and i32 %22, 7
  %24 = trunc i32 %23 to i8
  store i8 %24, ptr %12, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %25, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %26 = load ptr, ptr %13, align 8, !tbaa !5
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = add i32 %27, 7
  %29 = lshr i32 %28, 3
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds i8, ptr %26, i64 %30
  store ptr %31, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %32 = load ptr, ptr %13, align 8, !tbaa !5
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = lshr i32 %33, 3
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %32, i64 %35
  store ptr %36, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = ptrtoint ptr %37 to i64
  %39 = and i64 %38, 3
  %40 = icmp ne i64 %39, 0
  %41 = xor i1 %40, true
  %42 = zext i1 %41 to i64
  %43 = select i1 %41, ptr @xor_block_aligned, ptr @xor_block
  store ptr %43, ptr %16, align 8, !tbaa !5
  %44 = load i32, ptr %7, align 4, !tbaa !9
  %45 = icmp ult i32 %44, 128
  br i1 %45, label %46, label %47

46:                                               ; preds = %4
  store i32 1, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %168

47:                                               ; preds = %4
  %48 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %48, ptr align 1 %49, i64 16, i1 false)
  %50 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  %51 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.xts_ctx, ptr %52, i32 0, i32 0
  %54 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %53, i64 0, i64 0
  %55 = call i32 @aes_encrypt(ptr noundef %50, ptr noundef %51, ptr noundef %54)
  br label %56

56:                                               ; preds = %75, %47
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i64 16
  %59 = load ptr, ptr %15, align 8, !tbaa !5
  %60 = icmp ule ptr %58, %59
  br i1 %60, label %61, label %93

61:                                               ; preds = %56
  %62 = load ptr, ptr %13, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i64 32
  %64 = load ptr, ptr %15, align 8, !tbaa !5
  %65 = icmp ugt ptr %63, %64
  br i1 %65, label %66, label %75

66:                                               ; preds = %61
  %67 = load ptr, ptr %13, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 16
  %69 = load ptr, ptr %14, align 8, !tbaa !5
  %70 = icmp ult ptr %68, %69
  br i1 %70, label %71, label %75

71:                                               ; preds = %66
  %72 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 0
  %73 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %72, ptr align 16 %73, i64 16, i1 false)
  %74 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  call void @gf_mulx(ptr noundef %74)
  br label %75

75:                                               ; preds = %71, %66, %61
  %76 = load ptr, ptr %16, align 8, !tbaa !5
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  call void %76(ptr noundef %77, ptr noundef %78, ptr noundef %79)
  %80 = load ptr, ptr %13, align 8, !tbaa !5
  %81 = load ptr, ptr %13, align 8, !tbaa !5
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.xts_ctx, ptr %82, i32 0, i32 2
  %84 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %83, i64 0, i64 0
  %85 = call i32 @aes_decrypt(ptr noundef %80, ptr noundef %81, ptr noundef %84)
  %86 = load ptr, ptr %16, align 8, !tbaa !5
  %87 = load ptr, ptr %13, align 8, !tbaa !5
  %88 = load ptr, ptr %13, align 8, !tbaa !5
  %89 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  call void %86(ptr noundef %87, ptr noundef %88, ptr noundef %89)
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  %91 = getelementptr inbounds i8, ptr %90, i64 16
  store ptr %91, ptr %13, align 8, !tbaa !5
  %92 = getelementptr inbounds [4 x i32], ptr %10, i64 0, i64 0
  call void @gf_mulx(ptr noundef %92)
  br label %56, !llvm.loop !12

93:                                               ; preds = %56
  %94 = load ptr, ptr %13, align 8, !tbaa !5
  %95 = load ptr, ptr %14, align 8, !tbaa !5
  %96 = icmp ult ptr %94, %95
  br i1 %96, label %97, label %167

97:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %98 = load ptr, ptr %13, align 8, !tbaa !5
  %99 = getelementptr inbounds i8, ptr %98, i64 -16
  store ptr %99, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %100 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %100, ptr %19, align 8, !tbaa !5
  br label %101

101:                                              ; preds = %105, %97
  %102 = load ptr, ptr %13, align 8, !tbaa !5
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = icmp ult ptr %102, %103
  br i1 %104, label %105, label %115

105:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #5
  %106 = load ptr, ptr %18, align 8, !tbaa !5
  %107 = load i8, ptr %106, align 1, !tbaa !11
  store i8 %107, ptr %20, align 1, !tbaa !11
  %108 = load ptr, ptr %13, align 8, !tbaa !5
  %109 = load i8, ptr %108, align 1, !tbaa !11
  %110 = load ptr, ptr %18, align 8, !tbaa !5
  %111 = getelementptr inbounds i8, ptr %110, i32 1
  store ptr %111, ptr %18, align 8, !tbaa !5
  store i8 %109, ptr %110, align 1, !tbaa !11
  %112 = load i8, ptr %20, align 1, !tbaa !11
  %113 = load ptr, ptr %13, align 8, !tbaa !5
  %114 = getelementptr inbounds i8, ptr %113, i32 1
  store ptr %114, ptr %13, align 8, !tbaa !5
  store i8 %112, ptr %113, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #5
  br label %101, !llvm.loop !14

115:                                              ; preds = %101
  %116 = load i8, ptr %12, align 1, !tbaa !11
  %117 = icmp ne i8 %116, 0
  br i1 %117, label %118, label %152

118:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #5
  %119 = load i8, ptr %12, align 1, !tbaa !11
  %120 = zext i8 %119 to i32
  %121 = ashr i32 255, %120
  %122 = xor i32 %121, -1
  %123 = trunc i32 %122 to i8
  store i8 %123, ptr %21, align 1, !tbaa !11
  %124 = load i8, ptr %21, align 1, !tbaa !11
  %125 = zext i8 %124 to i32
  %126 = load ptr, ptr %18, align 8, !tbaa !5
  %127 = getelementptr inbounds i8, ptr %126, i32 -1
  store ptr %127, ptr %18, align 8, !tbaa !5
  %128 = load i8, ptr %127, align 1, !tbaa !11
  %129 = zext i8 %128 to i32
  %130 = and i32 %129, %125
  %131 = trunc i32 %130 to i8
  store i8 %131, ptr %127, align 1, !tbaa !11
  %132 = load ptr, ptr %13, align 8, !tbaa !5
  %133 = getelementptr inbounds i8, ptr %132, i32 -1
  store ptr %133, ptr %13, align 8, !tbaa !5
  %134 = load i8, ptr %133, align 1, !tbaa !11
  %135 = zext i8 %134 to i32
  %136 = load i8, ptr %21, align 1, !tbaa !11
  %137 = zext i8 %136 to i32
  %138 = xor i32 %137, -1
  %139 = and i32 %135, %138
  %140 = load ptr, ptr %18, align 8, !tbaa !5
  %141 = load i8, ptr %140, align 1, !tbaa !11
  %142 = zext i8 %141 to i32
  %143 = or i32 %142, %139
  %144 = trunc i32 %143 to i8
  store i8 %144, ptr %140, align 1, !tbaa !11
  %145 = load i8, ptr %21, align 1, !tbaa !11
  %146 = zext i8 %145 to i32
  %147 = load ptr, ptr %13, align 8, !tbaa !5
  %148 = load i8, ptr %147, align 1, !tbaa !11
  %149 = zext i8 %148 to i32
  %150 = and i32 %149, %146
  %151 = trunc i32 %150 to i8
  store i8 %151, ptr %147, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #5
  br label %152

152:                                              ; preds = %118, %115
  %153 = load ptr, ptr %16, align 8, !tbaa !5
  %154 = load ptr, ptr %19, align 8, !tbaa !5
  %155 = load ptr, ptr %19, align 8, !tbaa !5
  %156 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 0
  call void %153(ptr noundef %154, ptr noundef %155, ptr noundef %156)
  %157 = load ptr, ptr %19, align 8, !tbaa !5
  %158 = load ptr, ptr %19, align 8, !tbaa !5
  %159 = load ptr, ptr %9, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.xts_ctx, ptr %159, i32 0, i32 2
  %161 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %160, i64 0, i64 0
  %162 = call i32 @aes_decrypt(ptr noundef %157, ptr noundef %158, ptr noundef %161)
  %163 = load ptr, ptr %16, align 8, !tbaa !5
  %164 = load ptr, ptr %19, align 8, !tbaa !5
  %165 = load ptr, ptr %19, align 8, !tbaa !5
  %166 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 0
  call void %163(ptr noundef %164, ptr noundef %165, ptr noundef %166)
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %167

167:                                              ; preds = %152, %93
  store i32 0, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %168

168:                                              ; preds = %167, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  %169 = load i32, ptr %5, align 4
  ret i32 %169
}

declare i32 @aes_decrypt(ptr noundef, ptr noundef, ptr noundef) #3

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


; 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 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: inlinehint nounwind uwtable
declare hidden void @xor_block_aligned(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

declare i32 @aes_encrypt(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @gf_mulx(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @xts_decrypt(ptr noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2, ptr noundef %3) local_unnamed_addr #4 {
  %5 = alloca [4 x i32], align 16
  %6 = alloca [4 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #5
  %7 = add i32 %1, 7
  %8 = lshr i32 %7, 3
  %9 = zext nneg i32 %8 to i64
  %10 = getelementptr inbounds i8, ptr %0, i64 %9
  %11 = lshr i32 %1, 3
  %12 = zext nneg i32 %11 to i64
  %13 = getelementptr inbounds i8, ptr %0, i64 %12
  %14 = ptrtoint ptr %0 to i64
  %15 = and i64 %14, 3
  %.not = icmp eq i64 %15, 0
  %16 = select i1 %.not, ptr @xor_block_aligned, ptr @xor_block
  %17 = icmp ult i32 %1, 128
  br i1 %17, label %58, label %.lr.ph

.lr.ph:                                           ; preds = %4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %5, ptr noundef nonnull align 1 dereferenceable(16) %2, i64 16, i1 false)
  %18 = call i32 @aes_encrypt(ptr noundef nonnull %5, ptr noundef nonnull %5, ptr noundef %3) #5
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  %20 = getelementptr inbounds i8, ptr %3, i64 512
  br label %21

21:                                               ; preds = %.lr.ph, %27
  %indvar = phi i64 [ 0, %.lr.ph ], [ %indvar.next, %27 ]
  %22 = phi ptr [ %19, %.lr.ph ], [ %29, %27 ]
  %.05564 = phi ptr [ %0, %.lr.ph ], [ %22, %27 ]
  %23 = getelementptr inbounds i8, ptr %.05564, i64 32
  %24 = icmp ugt ptr %23, %13
  %25 = icmp ult ptr %22, %10
  %or.cond = select i1 %24, i1 %25, i1 false
  br i1 %or.cond, label %26, label %27

26:                                               ; preds = %21
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %6, ptr noundef nonnull align 16 dereferenceable(16) %5, i64 16, i1 false)
  call void @gf_mulx(ptr noundef nonnull %5) #5
  br label %27

27:                                               ; preds = %26, %21
  call void %16(ptr noundef %.05564, ptr noundef %.05564, ptr noundef nonnull %5) #5, !callees !5
  %28 = call i32 @aes_decrypt(ptr noundef %.05564, ptr noundef %.05564, ptr noundef nonnull %20) #5
  call void %16(ptr noundef %.05564, ptr noundef %.05564, ptr noundef nonnull %5) #5, !callees !5
  call void @gf_mulx(ptr noundef nonnull %5) #5
  %29 = getelementptr inbounds i8, ptr %22, i64 16
  %.not61 = icmp ugt ptr %29, %13
  %indvar.next = add i64 %indvar, 1
  br i1 %.not61, label %._crit_edge, label %21, !llvm.loop !6

._crit_edge:                                      ; preds = %27
  %30 = icmp ult ptr %22, %10
  br i1 %30, label %31, label %58

31:                                               ; preds = %._crit_edge
  %32 = getelementptr i8, ptr %22, i64 -16
  %33 = add nsw i64 %9, -16
  %34 = shl i64 %indvar, 4
  %35 = sub i64 %33, %34
  %min.iters.check = icmp ult i64 %35, 16
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %31
  %n.mod.vf = and i64 %9, 15
  %n.vec = sub i64 %35, %n.mod.vf
  %ind.end = getelementptr i8, ptr %22, i64 %n.vec
  %ind.end71 = getelementptr i8, ptr %32, i64 %n.vec
  %load_initial = load <16 x i8>, ptr %32, align 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %next.gep = getelementptr i8, ptr %22, i64 %index
  %next.gep73 = getelementptr i8, ptr %32, i64 %index
  %wide.load74 = load <16 x i8>, ptr %next.gep, align 1, !tbaa !8
  store <16 x i8> %wide.load74, ptr %next.gep73, align 1, !tbaa !8
  store <16 x i8> %load_initial, ptr %next.gep, align 1, !tbaa !8
  %index.next = add nuw i64 %index, 16
  %36 = icmp eq i64 %index.next, %n.vec
  br i1 %36, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %37 = extractelement <16 x i8> %wide.load74, i64 15
  %38 = extractelement <16 x i8> %load_initial, i64 15
  %cmp.n = icmp eq i64 %n.mod.vf, 0
  %cmo = add i64 %n.vec, -1
  %ind.escape = getelementptr i8, ptr %22, i64 %cmo
  %39 = getelementptr i8, ptr %32, i64 %n.vec
  %ind.escape76 = getelementptr i8, ptr %39, i64 -1
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %31
  %.166.ph = phi ptr [ %22, %31 ], [ %ind.end, %middle.block ]
  %.05665.ph = phi ptr [ %32, %31 ], [ %ind.end71, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.166 = phi ptr [ %43, %scalar.ph ], [ %.166.ph, %scalar.ph.preheader ]
  %.05665 = phi ptr [ %42, %scalar.ph ], [ %.05665.ph, %scalar.ph.preheader ]
  %40 = load i8, ptr %.05665, align 1, !tbaa !8
  %41 = load i8, ptr %.166, align 1, !tbaa !8
  %42 = getelementptr inbounds i8, ptr %.05665, i64 1
  store i8 %41, ptr %.05665, align 1, !tbaa !8
  %43 = getelementptr inbounds i8, ptr %.166, i64 1
  store i8 %40, ptr %.166, align 1, !tbaa !8
  %44 = icmp ult ptr %43, %10
  br i1 %44, label %scalar.ph, label %.loopexit, !llvm.loop !14

.loopexit:                                        ; preds = %scalar.ph, %middle.block
  %.166.lcssa = phi ptr [ %ind.escape, %middle.block ], [ %.166, %scalar.ph ]
  %.05665.lcssa = phi ptr [ %ind.escape76, %middle.block ], [ %.05665, %scalar.ph ]
  %.lcssa69 = phi i8 [ %38, %middle.block ], [ %40, %scalar.ph ]
  %.lcssa = phi i8 [ %37, %middle.block ], [ %41, %scalar.ph ]
  %45 = and i32 %1, 7
  %.not62 = icmp eq i32 %45, 0
  br i1 %.not62, label %55, label %46

46:                                               ; preds = %.loopexit
  %47 = ashr exact i32 -256, %45
  %48 = trunc i32 %47 to i8
  %49 = and i8 %.lcssa, %48
  %50 = lshr i32 255, %45
  %51 = trunc nuw nsw i32 %50 to i8
  %52 = and i8 %.lcssa69, %51
  %53 = or i8 %52, %49
  store i8 %53, ptr %.05665.lcssa, align 1, !tbaa !8
  %54 = and i8 %.lcssa69, %48
  store i8 %54, ptr %.166.lcssa, align 1, !tbaa !8
  br label %55

55:                                               ; preds = %46, %.loopexit
  call void %16(ptr noundef nonnull %32, ptr noundef nonnull %32, ptr noundef nonnull %6) #5, !callees !5
  %56 = getelementptr inbounds i8, ptr %3, i64 512
  %57 = call i32 @aes_decrypt(ptr noundef nonnull %32, ptr noundef nonnull %32, ptr noundef nonnull %56) #5
  call void %16(ptr noundef nonnull %32, ptr noundef nonnull %32, ptr noundef nonnull %6) #5, !callees !5
  br label %58

58:                                               ; preds = %._crit_edge, %55, %4
  %.0 = phi i32 [ 1, %4 ], [ 0, %55 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  ret i32 %.0
}

declare i32 @aes_decrypt(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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


; Effective O3 passes: CalledValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass