; LLVM IR from MidnightBlueLabs/TETRA_crypto :: taa1 (ta71)

; 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"

; Function Attrs: nounwind uwtable
declare dso_local void @transform_80_to_128_alt(ptr noundef, ptr 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

declare void @HURDLE_enc_cbc(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local void @ta71(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [16 x i8], align 16
  %8 = alloca [16 x i8], align 16
  %9 = alloca [16 x i8], align 16
  %10 = alloca [10 x i8], align 1
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 10, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %33, %3
  %13 = load i32, ptr %11, align 4, !tbaa !9
  %14 = icmp slt i32 %13, 10
  br i1 %14, label %15, label %36

15:                                               ; preds = %12
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = load i32, ptr %11, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i8, ptr %16, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !11
  %21 = zext i8 %20 to i32
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load i32, ptr %11, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i8, ptr %22, i64 %24
  %26 = load i8, ptr %25, align 1, !tbaa !11
  %27 = zext i8 %26 to i32
  %28 = xor i32 %21, %27
  %29 = trunc i32 %28 to i8
  %30 = load i32, ptr %11, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [10 x i8], ptr %10, i64 0, i64 %31
  store i8 %29, ptr %32, align 1, !tbaa !11
  br label %33

33:                                               ; preds = %15
  %34 = load i32, ptr %11, align 4, !tbaa !9
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %11, align 4, !tbaa !9
  br label %12, !llvm.loop !12

36:                                               ; preds = %12
  %37 = getelementptr inbounds [10 x i8], ptr %10, i64 0, i64 0
  %38 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 0
  call void @transform_80_to_128_alt(ptr noundef %37, ptr noundef %38)
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 0
  %41 = load i8, ptr %40, align 1, !tbaa !11
  %42 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 0
  store i8 %41, ptr %42, align 16, !tbaa !11
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 1
  %45 = load i8, ptr %44, align 1, !tbaa !11
  %46 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 1
  store i8 %45, ptr %46, align 1, !tbaa !11
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 2
  %49 = load i8, ptr %48, align 1, !tbaa !11
  %50 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 2
  store i8 %49, ptr %50, align 2, !tbaa !11
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i64 3
  %53 = load i8, ptr %52, align 1, !tbaa !11
  %54 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 3
  store i8 %53, ptr %54, align 1, !tbaa !11
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i64 4
  %57 = load i8, ptr %56, align 1, !tbaa !11
  %58 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 4
  store i8 %57, ptr %58, align 4, !tbaa !11
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 5
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 5
  store i8 %61, ptr %62, align 1, !tbaa !11
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %63, i64 6
  %65 = load i8, ptr %64, align 1, !tbaa !11
  %66 = zext i8 %65 to i32
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 0
  %69 = load i8, ptr %68, align 1, !tbaa !11
  %70 = zext i8 %69 to i32
  %71 = xor i32 %66, %70
  %72 = trunc i32 %71 to i8
  %73 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 6
  store i8 %72, ptr %73, align 2, !tbaa !11
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds i8, ptr %74, i64 7
  %76 = load i8, ptr %75, align 1, !tbaa !11
  %77 = zext i8 %76 to i32
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %78, i64 1
  %80 = load i8, ptr %79, align 1, !tbaa !11
  %81 = zext i8 %80 to i32
  %82 = xor i32 %77, %81
  %83 = trunc i32 %82 to i8
  %84 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 7
  store i8 %83, ptr %84, align 1, !tbaa !11
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %85, i64 8
  %87 = load i8, ptr %86, align 1, !tbaa !11
  %88 = zext i8 %87 to i32
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds i8, ptr %89, i64 2
  %91 = load i8, ptr %90, align 1, !tbaa !11
  %92 = zext i8 %91 to i32
  %93 = xor i32 %88, %92
  %94 = trunc i32 %93 to i8
  %95 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 8
  store i8 %94, ptr %95, align 8, !tbaa !11
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds i8, ptr %96, i64 9
  %98 = load i8, ptr %97, align 1, !tbaa !11
  %99 = zext i8 %98 to i32
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds i8, ptr %100, i64 3
  %102 = load i8, ptr %101, align 1, !tbaa !11
  %103 = zext i8 %102 to i32
  %104 = xor i32 %99, %103
  %105 = trunc i32 %104 to i8
  %106 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 9
  store i8 %105, ptr %106, align 1, !tbaa !11
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = getelementptr inbounds i8, ptr %107, i64 4
  %109 = load i8, ptr %108, align 1, !tbaa !11
  %110 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 10
  store i8 %109, ptr %110, align 2, !tbaa !11
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds i8, ptr %111, i64 5
  %113 = load i8, ptr %112, align 1, !tbaa !11
  %114 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 11
  store i8 %113, ptr %114, align 1, !tbaa !11
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds i8, ptr %115, i64 6
  %117 = load i8, ptr %116, align 1, !tbaa !11
  %118 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 12
  store i8 %117, ptr %118, align 4, !tbaa !11
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = getelementptr inbounds i8, ptr %119, i64 7
  %121 = load i8, ptr %120, align 1, !tbaa !11
  %122 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 13
  store i8 %121, ptr %122, align 1, !tbaa !11
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds i8, ptr %123, i64 8
  %125 = load i8, ptr %124, align 1, !tbaa !11
  %126 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 14
  store i8 %125, ptr %126, align 2, !tbaa !11
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = getelementptr inbounds i8, ptr %127, i64 9
  %129 = load i8, ptr %128, align 1, !tbaa !11
  %130 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 15
  store i8 %129, ptr %130, align 1, !tbaa !11
  %131 = getelementptr inbounds [16 x i8], ptr %7, i64 0, i64 0
  %132 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 0
  %133 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 0
  call void @HURDLE_enc_cbc(ptr noundef %131, ptr noundef %132, ptr noundef %133)
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds [16 x i8], ptr %7, i64 0, i64 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %134, ptr align 1 %135, i64 10, i1 false)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 10, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  ret void
}

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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: nounwind uwtable
declare dso_local void @transform_80_to_128_alt(ptr noundef, ptr 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

declare void @HURDLE_enc_cbc(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local void @ta71(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 {
  %4 = alloca [16 x i8], align 16
  %5 = alloca [16 x i8], align 16
  %6 = alloca [16 x i8], align 16
  %7 = alloca [10 x i8], align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %7) #4
  %8 = getelementptr inbounds i8, ptr %0, i64 4
  %9 = getelementptr inbounds i8, ptr %1, i64 4
  %10 = getelementptr inbounds i8, ptr %0, i64 5
  %11 = getelementptr inbounds i8, ptr %0, i64 6
  %12 = load <8 x i8>, ptr %0, align 1, !tbaa !5
  %13 = load <8 x i8>, ptr %1, align 1, !tbaa !5
  %14 = xor <8 x i8> %13, %12
  store <8 x i8> %14, ptr %7, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = load i8, ptr %15, align 1, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %1, i64 8
  %18 = load i8, ptr %17, align 1, !tbaa !5
  %19 = xor i8 %18, %16
  %20 = getelementptr inbounds i8, ptr %7, i64 8
  store i8 %19, ptr %20, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 9
  %22 = load i8, ptr %21, align 1, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %1, i64 9
  %24 = load i8, ptr %23, align 1, !tbaa !5
  %25 = xor i8 %24, %22
  %26 = getelementptr inbounds i8, ptr %7, i64 9
  store i8 %25, ptr %26, align 1, !tbaa !5
  call void @transform_80_to_128_alt(ptr noundef nonnull %7, ptr noundef nonnull %6)
  %27 = load <4 x i8>, ptr %0, align 1, !tbaa !5
  store <4 x i8> %27, ptr %5, align 16, !tbaa !5
  %28 = load i8, ptr %8, align 1, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %5, i64 4
  store i8 %28, ptr %29, align 4, !tbaa !5
  %30 = load i8, ptr %10, align 1, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %5, i64 5
  store i8 %30, ptr %31, align 1, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %5, i64 6
  %33 = load <4 x i8>, ptr %11, align 1, !tbaa !5
  %34 = load <4 x i8>, ptr %1, align 1, !tbaa !5
  %35 = xor <4 x i8> %34, %33
  store <4 x i8> %35, ptr %32, align 2, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %5, i64 10
  %37 = load <4 x i8>, ptr %9, align 1, !tbaa !5
  store <4 x i8> %37, ptr %36, align 2, !tbaa !5
  %38 = load i8, ptr %17, align 1, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %5, i64 14
  store i8 %38, ptr %39, align 2, !tbaa !5
  %40 = load i8, ptr %23, align 1, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %5, i64 15
  store i8 %40, ptr %41, align 1, !tbaa !5
  call void @HURDLE_enc_cbc(ptr noundef nonnull %4, ptr noundef nonnull %6, ptr noundef nonnull %5) #4
  %42 = getelementptr inbounds i8, ptr %4, i64 3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(10) %2, ptr noundef nonnull align 1 dereferenceable(10) %42, i64 10, i1 false)
  call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  ret void
}

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass