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

; 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.ccm_ctx = type { [2 x i64], [2 x i64], [2 x i64], [1 x %struct.aes_crypt_ctx], i64, i64, i64, i64, i64, i32, i32, i32, [12 x i8] }
%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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ccm_compute_tag(ptr noundef %0, i64 noundef %1, ptr noundef %2) #3 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.ccm_ctx, ptr %13, i32 0, i32 11
  %15 = load i32, ptr %14, align 16, !tbaa !11
  %16 = icmp slt i32 %15, 0
  br i1 %16, label %17, label %21

17:                                               ; preds = %3
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ccm_ctx, ptr %18, i32 0, i32 11
  %20 = load i32, ptr %19, align 16, !tbaa !11
  store i32 %20, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %196

21:                                               ; preds = %3
  %22 = load i64, ptr %6, align 8, !tbaa !9
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ccm_ctx, ptr %23, i32 0, i32 10
  %25 = load i32, ptr %24, align 4, !tbaa !14
  %26 = zext i32 %25 to i64
  %27 = icmp ne i64 %22, %26
  br i1 %27, label %43, label %28

28:                                               ; preds = %21
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ccm_ctx, ptr %29, i32 0, i32 11
  %31 = load i32, ptr %30, align 16, !tbaa !11
  %32 = icmp eq i32 %31, 10
  br i1 %32, label %33, label %38

33:                                               ; preds = %28
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ccm_ctx, ptr %34, i32 0, i32 6
  %36 = load i64, ptr %35, align 16, !tbaa !15
  %37 = icmp ne i64 %36, 0
  br i1 %37, label %43, label %38

38:                                               ; preds = %33, %28
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ccm_ctx, ptr %39, i32 0, i32 11
  %41 = load i32, ptr %40, align 16, !tbaa !11
  %42 = icmp eq i32 %41, 11
  br i1 %42, label %43, label %46

43:                                               ; preds = %38, %33, %21
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.ccm_ctx, ptr %44, i32 0, i32 11
  store i32 -6, ptr %45, align 16, !tbaa !11
  store i32 -6, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %196

46:                                               ; preds = %38
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ccm_ctx, ptr %47, i32 0, i32 8
  %49 = load i64, ptr %48, align 16, !tbaa !16
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ccm_ctx, ptr %50, i32 0, i32 7
  %52 = load i64, ptr %51, align 8, !tbaa !17
  %53 = icmp ne i64 %49, %52
  br i1 %53, label %54, label %60

54:                                               ; preds = %46
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.ccm_ctx, ptr %55, i32 0, i32 7
  %57 = load i64, ptr %56, align 8, !tbaa !17
  %58 = icmp ugt i64 %57, 0
  br i1 %58, label %59, label %60

59:                                               ; preds = %54
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %196

60:                                               ; preds = %54, %46
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.ccm_ctx, ptr %61, i32 0, i32 7
  %63 = load i64, ptr %62, align 8, !tbaa !17
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.ccm_ctx, ptr %64, i32 0, i32 5
  %66 = load i64, ptr %65, align 8, !tbaa !18
  %67 = icmp ult i64 %63, %66
  br i1 %67, label %83, label %68

68:                                               ; preds = %60
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.ccm_ctx, ptr %69, i32 0, i32 7
  %71 = load i64, ptr %70, align 8, !tbaa !17
  %72 = load i64, ptr %6, align 8, !tbaa !9
  %73 = add i64 %71, %72
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.ccm_ctx, ptr %74, i32 0, i32 5
  %76 = load i64, ptr %75, align 8, !tbaa !18
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ccm_ctx, ptr %77, i32 0, i32 10
  %79 = load i32, ptr %78, align 4, !tbaa !14
  %80 = zext i32 %79 to i64
  %81 = add i64 %76, %80
  %82 = icmp ugt i64 %73, %81
  br i1 %82, label %83, label %86

83:                                               ; preds = %68, %60
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.ccm_ctx, ptr %84, i32 0, i32 11
  store i32 -7, ptr %85, align 16, !tbaa !11
  store i32 -7, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %196

86:                                               ; preds = %68
  %87 = load i64, ptr %6, align 8, !tbaa !9
  %88 = icmp ugt i64 %87, 0
  br i1 %88, label %89, label %155

89:                                               ; preds = %86
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.ccm_ctx, ptr %90, i32 0, i32 7
  %92 = load i64, ptr %91, align 8, !tbaa !17
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.ccm_ctx, ptr %93, i32 0, i32 5
  %95 = load i64, ptr %94, align 8, !tbaa !18
  %96 = icmp eq i64 %92, %95
  br i1 %96, label %97, label %155

97:                                               ; preds = %89
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.ccm_ctx, ptr %98, i32 0, i32 7
  %100 = load i64, ptr %99, align 8, !tbaa !17
  %101 = and i64 %100, 15
  %102 = icmp ne i64 %101, 0
  br i1 %102, label %103, label %114

103:                                              ; preds = %97
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.ccm_ctx, ptr %104, i32 0, i32 2
  %106 = getelementptr inbounds [2 x i64], ptr %105, i64 0, i64 0
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.ccm_ctx, ptr %107, i32 0, i32 2
  %109 = getelementptr inbounds [2 x i64], ptr %108, i64 0, i64 0
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.ccm_ctx, ptr %110, i32 0, i32 3
  %112 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %111, i64 0, i64 0
  %113 = call i32 @aes_encrypt(ptr noundef %106, ptr noundef %109, ptr noundef %112)
  br label %114

114:                                              ; preds = %103, %97
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.ccm_ctx, ptr %115, i32 0, i32 1
  %117 = getelementptr inbounds [2 x i64], ptr %116, i64 0, i64 0
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.ccm_ctx, ptr %118, i32 0, i32 0
  %120 = getelementptr inbounds [2 x i64], ptr %119, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %117, ptr align 16 %120, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.ccm_ctx, ptr %121, i32 0, i32 1
  %123 = getelementptr inbounds [2 x i64], ptr %122, i64 0, i64 0
  %124 = getelementptr inbounds i8, ptr %123, i64 16
  store ptr %124, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i64 0, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.ccm_ctx, ptr %125, i32 0, i32 1
  %127 = getelementptr inbounds [2 x i64], ptr %126, i64 0, i64 0
  %128 = load i8, ptr %127, align 16, !tbaa !19
  %129 = zext i8 %128 to i32
  %130 = and i32 %129, 7
  %131 = add nsw i32 %130, 1
  %132 = sext i32 %131 to i64
  store i64 %132, ptr %12, align 8, !tbaa !9
  br label %133

133:                                              ; preds = %140, %114
  %134 = load i64, ptr %11, align 8, !tbaa !9
  %135 = trunc i64 %134 to i8
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  %137 = getelementptr inbounds i8, ptr %136, i32 -1
  store ptr %137, ptr %10, align 8, !tbaa !5
  store i8 %135, ptr %137, align 1, !tbaa !19
  %138 = load i64, ptr %11, align 8, !tbaa !9
  %139 = lshr i64 %138, 8
  store i64 %139, ptr %11, align 8, !tbaa !9
  br label %140

140:                                              ; preds = %133
  %141 = load i64, ptr %12, align 8, !tbaa !9
  %142 = add i64 %141, -1
  store i64 %142, ptr %12, align 8, !tbaa !9
  %143 = icmp ne i64 %142, 0
  br i1 %143, label %133, label %144, !llvm.loop !20

144:                                              ; preds = %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %145 = load ptr, ptr %7, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.ccm_ctx, ptr %145, i32 0, i32 1
  %147 = getelementptr inbounds [2 x i64], ptr %146, i64 0, i64 0
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.ccm_ctx, ptr %148, i32 0, i32 1
  %150 = getelementptr inbounds [2 x i64], ptr %149, i64 0, i64 0
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.ccm_ctx, ptr %151, i32 0, i32 3
  %153 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %152, i64 0, i64 0
  %154 = call i32 @aes_encrypt(ptr noundef %147, ptr noundef %150, ptr noundef %153)
  br label %155

155:                                              ; preds = %144, %89, %86
  store i32 0, ptr %8, align 4, !tbaa !22
  br label %156

156:                                              ; preds = %161, %155
  %157 = load i32, ptr %8, align 4, !tbaa !22
  %158 = zext i32 %157 to i64
  %159 = load i64, ptr %6, align 8, !tbaa !9
  %160 = icmp ult i64 %158, %159
  br i1 %160, label %161, label %186

161:                                              ; preds = %156
  %162 = load ptr, ptr %7, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.ccm_ctx, ptr %162, i32 0, i32 2
  %164 = getelementptr inbounds [2 x i64], ptr %163, i64 0, i64 0
  %165 = load i32, ptr %8, align 4, !tbaa !22
  %166 = zext i32 %165 to i64
  %167 = getelementptr inbounds i8, ptr %164, i64 %166
  %168 = load i8, ptr %167, align 1, !tbaa !19
  %169 = zext i8 %168 to i32
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.ccm_ctx, ptr %170, i32 0, i32 1
  %172 = getelementptr inbounds [2 x i64], ptr %171, i64 0, i64 0
  %173 = load i32, ptr %8, align 4, !tbaa !22
  %174 = zext i32 %173 to i64
  %175 = getelementptr inbounds i8, ptr %172, i64 %174
  %176 = load i8, ptr %175, align 1, !tbaa !19
  %177 = zext i8 %176 to i32
  %178 = xor i32 %169, %177
  %179 = trunc i32 %178 to i8
  %180 = load ptr, ptr %5, align 8, !tbaa !5
  %181 = load i32, ptr %8, align 4, !tbaa !22
  %182 = zext i32 %181 to i64
  %183 = getelementptr inbounds i8, ptr %180, i64 %182
  store i8 %179, ptr %183, align 1, !tbaa !19
  %184 = load i32, ptr %8, align 4, !tbaa !22
  %185 = add i32 %184, 1
  store i32 %185, ptr %8, align 4, !tbaa !22
  br label %156, !llvm.loop !23

186:                                              ; preds = %156
  %187 = load ptr, ptr %7, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.ccm_ctx, ptr %187, i32 0, i32 7
  %189 = load i64, ptr %188, align 8, !tbaa !17
  %190 = load ptr, ptr %7, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.ccm_ctx, ptr %190, i32 0, i32 8
  %192 = load i64, ptr %191, align 16, !tbaa !16
  %193 = icmp eq i64 %189, %192
  %194 = zext i1 %193 to i64
  %195 = select i1 %193, i32 0, i32 1
  store i32 %195, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %196

196:                                              ; preds = %186, %83, %59, %43, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %197 = load i32, ptr %4, align 4
  ret i32 %197
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 352}
!12 = !{!"", !7, i64 0, !7, i64 16, !7, i64 32, !7, i64 48, !10, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !13, i64 344, !13, i64 348, !13, i64 352}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 348}
!15 = !{!12, !10, i64 320}
!16 = !{!12, !10, i64 336}
!17 = !{!12, !10, i64 328}
!18 = !{!12, !10, i64 312}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!13, !13, i64 0}
!23 = distinct !{!23, !21}


; 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -2147483648, 2) i32 @ccm_compute_tag(ptr nocapture noundef writeonly %0, i64 noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = getelementptr inbounds i8, ptr %2, i64 352
  %5 = load i32, ptr %4, align 16, !tbaa !5
  %6 = icmp slt i32 %5, 0
  br i1 %6, label %83, label %7

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %2, i64 348
  %9 = load i32, ptr %8, align 4, !tbaa !11
  %10 = zext i32 %9 to i64
  %.not = icmp eq i64 %10, %1
  br i1 %.not, label %11, label %15

11:                                               ; preds = %7
  switch i32 %5, label %.thread [
    i32 10, label %12
    i32 11, label %15
  ]

12:                                               ; preds = %11
  %13 = getelementptr inbounds i8, ptr %2, i64 320
  %14 = load i64, ptr %13, align 16, !tbaa !12
  %.not57 = icmp eq i64 %14, 0
  br i1 %.not57, label %.thread, label %15

15:                                               ; preds = %11, %12, %7
  store i32 -6, ptr %4, align 16, !tbaa !5
  br label %83

.thread:                                          ; preds = %11, %12
  %16 = getelementptr inbounds i8, ptr %2, i64 336
  %17 = load i64, ptr %16, align 16, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %2, i64 328
  %19 = load i64, ptr %18, align 8, !tbaa !14
  %.not58 = icmp eq i64 %17, %19
  %.not59 = icmp eq i64 %19, 0
  %or.cond = or i1 %.not58, %.not59
  br i1 %or.cond, label %20, label %83

20:                                               ; preds = %.thread
  %21 = getelementptr inbounds i8, ptr %2, i64 312
  %22 = load i64, ptr %21, align 8, !tbaa !15
  %23 = icmp ult i64 %19, %22
  br i1 %23, label %28, label %24

24:                                               ; preds = %20
  %25 = add i64 %19, %1
  %26 = add i64 %22, %1
  %27 = icmp ugt i64 %25, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %24, %20
  store i32 -7, ptr %4, align 16, !tbaa !5
  br label %83

29:                                               ; preds = %24
  %.not60 = icmp ne i64 %1, 0
  %30 = icmp eq i64 %19, %22
  %or.cond63 = and i1 %.not60, %30
  br i1 %or.cond63, label %31, label %46

31:                                               ; preds = %29
  %32 = and i64 %19, 15
  %.not61 = icmp eq i64 %32, 0
  br i1 %.not61, label %.thread66, label %33

33:                                               ; preds = %31
  %34 = getelementptr inbounds i8, ptr %2, i64 32
  %35 = getelementptr inbounds i8, ptr %2, i64 48
  %36 = tail call i32 @aes_encrypt(ptr noundef nonnull %34, ptr noundef nonnull %34, ptr noundef nonnull %35) #5
  br label %.thread66

.thread66:                                        ; preds = %31, %33
  %37 = getelementptr inbounds i8, ptr %2, i64 16
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %37, ptr noundef nonnull align 16 dereferenceable(16) %2, i64 16, i1 false)
  %38 = load i8, ptr %37, align 16, !tbaa !16
  %39 = and i8 %38, 7
  %narrow = add nuw nsw i8 %39, 1
  %40 = zext nneg i8 %narrow to i64
  %41 = and i8 %38, 7
  %42 = xor i8 %41, 31
  %43 = zext nneg i8 %42 to i64
  %scevgep = getelementptr i8, ptr %2, i64 %43
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep, i8 0, i64 %40, i1 false), !tbaa !16
  %44 = getelementptr inbounds i8, ptr %2, i64 48
  %45 = tail call i32 @aes_encrypt(ptr noundef nonnull %37, ptr noundef nonnull %37, ptr noundef nonnull %44) #5
  br label %iter.check

46:                                               ; preds = %29
  %.not65 = icmp eq i64 %1, 0
  br i1 %.not65, label %._crit_edge, label %iter.check

iter.check:                                       ; preds = %.thread66, %46
  %47 = getelementptr inbounds i8, ptr %2, i64 32
  %48 = getelementptr inbounds i8, ptr %2, i64 16
  %umax71 = tail call i64 @llvm.umax.i64(i64 %1, i64 1)
  %min.iters.check = icmp ult i64 %1, 8
  br i1 %min.iters.check, label %vec.epilog.scalar.ph.preheader, label %vector.scevcheck

vector.scevcheck:                                 ; preds = %iter.check
  %49 = add i64 %1, -1
  %50 = and i64 %49, 4294967295
  %51 = icmp eq i64 %50, 4294967295
  %52 = icmp ugt i64 %49, 4294967295
  %53 = or i1 %51, %52
  br i1 %53, label %vec.epilog.scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %vector.scevcheck
  %umax68 = tail call i64 @llvm.umax.i64(i64 %1, i64 1)
  %scevgep69 = getelementptr i8, ptr %0, i64 %umax68
  %54 = getelementptr i8, ptr %2, i64 %umax68
  %scevgep70 = getelementptr i8, ptr %54, i64 32
  %bound0 = icmp ugt ptr %scevgep70, %0
  %bound1 = icmp ult ptr %48, %scevgep69
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %vec.epilog.scalar.ph.preheader, label %vector.main.loop.iter.check

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

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

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %55 = getelementptr inbounds i8, ptr %47, i64 %index
  %56 = getelementptr inbounds i8, ptr %55, i64 16
  %wide.load = load <16 x i8>, ptr %55, align 1, !tbaa !16, !alias.scope !17
  %wide.load73 = load <16 x i8>, ptr %56, align 1, !tbaa !16, !alias.scope !17
  %57 = getelementptr inbounds i8, ptr %48, i64 %index
  %58 = getelementptr inbounds i8, ptr %57, i64 16
  %wide.load74 = load <16 x i8>, ptr %57, align 1, !tbaa !16, !alias.scope !17
  %wide.load75 = load <16 x i8>, ptr %58, align 1, !tbaa !16, !alias.scope !17
  %59 = xor <16 x i8> %wide.load74, %wide.load
  %60 = xor <16 x i8> %wide.load75, %wide.load73
  %61 = getelementptr inbounds i8, ptr %0, i64 %index
  %62 = getelementptr inbounds i8, ptr %61, i64 16
  store <16 x i8> %59, ptr %61, align 1, !tbaa !16, !alias.scope !20, !noalias !17
  store <16 x i8> %60, ptr %62, align 1, !tbaa !16, !alias.scope !20, !noalias !17
  %index.next = add nuw i64 %index, 32
  %63 = icmp eq i64 %index.next, %n.vec
  br i1 %63, label %middle.block, label %vector.body, !llvm.loop !22

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

vec.epilog.iter.check:                            ; preds = %middle.block
  %ind.end78 = trunc i64 %n.vec to i32
  %n.vec.remaining = and i64 %umax71, 24
  %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
  br i1 %min.epilog.iters.check, label %vec.epilog.scalar.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.vec77 = and i64 %umax71, 8589934584
  %ind.end = trunc i64 %n.vec77 to i32
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index80 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next83, %vec.epilog.vector.body ]
  %64 = getelementptr inbounds i8, ptr %47, i64 %index80
  %wide.load81 = load <8 x i8>, ptr %64, align 1, !tbaa !16, !alias.scope !26
  %65 = getelementptr inbounds i8, ptr %48, i64 %index80
  %wide.load82 = load <8 x i8>, ptr %65, align 1, !tbaa !16, !alias.scope !26
  %66 = xor <8 x i8> %wide.load82, %wide.load81
  %67 = getelementptr inbounds i8, ptr %0, i64 %index80
  store <8 x i8> %66, ptr %67, align 1, !tbaa !16, !alias.scope !29, !noalias !26
  %index.next83 = add nuw i64 %index80, 8
  %68 = icmp eq i64 %index.next83, %n.vec77
  br i1 %68, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !31

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %cmp.n84 = icmp eq i64 %n.vec77, %1
  br i1 %cmp.n84, label %._crit_edge, label %vec.epilog.scalar.ph.preheader

vec.epilog.scalar.ph.preheader:                   ; preds = %vec.epilog.middle.block, %vector.memcheck, %vector.scevcheck, %iter.check, %vec.epilog.iter.check
  %.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.memcheck ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec77, %vec.epilog.middle.block ]
  %.04964.ph = phi i32 [ 0, %iter.check ], [ 0, %vector.memcheck ], [ 0, %vector.scevcheck ], [ %ind.end78, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
  br label %vec.epilog.scalar.ph

vec.epilog.scalar.ph:                             ; preds = %vec.epilog.scalar.ph.preheader, %vec.epilog.scalar.ph
  %69 = phi i64 [ %77, %vec.epilog.scalar.ph ], [ %.ph, %vec.epilog.scalar.ph.preheader ]
  %.04964 = phi i32 [ %76, %vec.epilog.scalar.ph ], [ %.04964.ph, %vec.epilog.scalar.ph.preheader ]
  %70 = getelementptr inbounds i8, ptr %47, i64 %69
  %71 = load i8, ptr %70, align 1, !tbaa !16
  %72 = getelementptr inbounds i8, ptr %48, i64 %69
  %73 = load i8, ptr %72, align 1, !tbaa !16
  %74 = xor i8 %73, %71
  %75 = getelementptr inbounds i8, ptr %0, i64 %69
  store i8 %74, ptr %75, align 1, !tbaa !16
  %76 = add i32 %.04964, 1
  %77 = zext i32 %76 to i64
  %78 = icmp ult i64 %77, %1
  br i1 %78, label %vec.epilog.scalar.ph, label %._crit_edge, !llvm.loop !32

._crit_edge:                                      ; preds = %vec.epilog.scalar.ph, %middle.block, %vec.epilog.middle.block, %46
  %79 = load i64, ptr %18, align 8, !tbaa !14
  %80 = load i64, ptr %16, align 16, !tbaa !13
  %81 = icmp ne i64 %79, %80
  %82 = zext i1 %81 to i32
  br label %83

83:                                               ; preds = %.thread, %3, %._crit_edge, %28, %15
  %.050 = phi i32 [ -6, %15 ], [ -7, %28 ], [ %82, %._crit_edge ], [ %5, %3 ], [ -1, %.thread ]
  ret i32 %.050
}

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

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !10, i64 352}
!6 = !{!"", !7, i64 0, !7, i64 16, !7, i64 32, !7, i64 48, !9, i64 304, !9, i64 312, !9, i64 320, !9, i64 328, !9, i64 336, !10, i64 344, !10, i64 348, !10, i64 352}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"long", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!6, !10, i64 348}
!12 = !{!6, !9, i64 320}
!13 = !{!6, !9, i64 336}
!14 = !{!6, !9, i64 328}
!15 = !{!6, !9, i64 312}
!16 = !{!7, !7, i64 0}
!17 = !{!18}
!18 = distinct !{!18, !19}
!19 = distinct !{!19, !"LVerDomain"}
!20 = !{!21}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !23, !24, !25}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!"llvm.loop.isvectorized", i32 1}
!25 = !{!"llvm.loop.unroll.runtime.disable"}
!26 = !{!27}
!27 = distinct !{!27, !28}
!28 = distinct !{!28, !"LVerDomain"}
!29 = !{!30}
!30 = distinct !{!30, !28}
!31 = distinct !{!31, !23, !24, !25}
!32 = distinct !{!32, !23, !24}


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