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

; 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_120_to_88(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

; 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 void @HURDLE_dec_cts(ptr noundef, ptr noundef, ptr noundef) #3

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

17:                                               ; preds = %39, %6
  %18 = load i32, ptr %16, align 4, !tbaa !9
  %19 = icmp slt i32 %18, 16
  br i1 %19, label %20, label %42

20:                                               ; preds = %17
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = load i32, ptr %16, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i8, ptr %21, i64 %23
  %25 = load i8, ptr %24, align 1, !tbaa !11
  %26 = zext i8 %25 to i32
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = load i32, ptr %16, align 4, !tbaa !9
  %29 = and i32 %28, 1
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i8, ptr %27, i64 %30
  %32 = load i8, ptr %31, align 1, !tbaa !11
  %33 = zext i8 %32 to i32
  %34 = xor i32 %26, %33
  %35 = trunc i32 %34 to i8
  %36 = load i32, ptr %16, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 %37
  store i8 %35, ptr %38, align 1, !tbaa !11
  br label %39

39:                                               ; preds = %20
  %40 = load i32, ptr %16, align 4, !tbaa !9
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %16, align 4, !tbaa !9
  br label %17, !llvm.loop !12

42:                                               ; preds = %17
  %43 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 0
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  call void @HURDLE_dec_cts(ptr noundef %43, ptr noundef %44, ptr noundef %45)
  %46 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 0
  %47 = getelementptr inbounds [11 x i8], ptr %15, i64 0, i64 0
  call void @transform_120_to_88(ptr noundef %46, ptr noundef %47)
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = getelementptr inbounds [11 x i8], ptr %15, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %48, ptr align 1 %49, i64 10, i1 false)
  %50 = getelementptr inbounds [11 x i8], ptr %15, i64 0, i64 10
  %51 = load i8, ptr %50, align 1, !tbaa !11
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  store i8 %51, ptr %52, align 1, !tbaa !11
  %53 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 0
  %54 = load i8, ptr %53, align 1, !tbaa !11
  %55 = zext i8 %54 to i32
  %56 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 1
  %57 = load i8, ptr %56, align 1, !tbaa !11
  %58 = zext i8 %57 to i32
  %59 = xor i32 %55, %58
  %60 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 2
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = zext i8 %61 to i32
  %63 = icmp ne i32 %59, %62
  br i1 %63, label %118, label %64

64:                                               ; preds = %42
  %65 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 3
  %66 = load i8, ptr %65, align 1, !tbaa !11
  %67 = zext i8 %66 to i32
  %68 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 4
  %69 = load i8, ptr %68, align 1, !tbaa !11
  %70 = zext i8 %69 to i32
  %71 = xor i32 %67, %70
  %72 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 5
  %73 = load i8, ptr %72, align 1, !tbaa !11
  %74 = zext i8 %73 to i32
  %75 = xor i32 %71, %74
  %76 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 6
  %77 = load i8, ptr %76, align 1, !tbaa !11
  %78 = zext i8 %77 to i32
  %79 = icmp ne i32 %75, %78
  br i1 %79, label %118, label %80

80:                                               ; preds = %64
  %81 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 7
  %82 = load i8, ptr %81, align 1, !tbaa !11
  %83 = zext i8 %82 to i32
  %84 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 8
  %85 = load i8, ptr %84, align 1, !tbaa !11
  %86 = zext i8 %85 to i32
  %87 = xor i32 %83, %86
  %88 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 9
  %89 = load i8, ptr %88, align 1, !tbaa !11
  %90 = zext i8 %89 to i32
  %91 = xor i32 %87, %90
  %92 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 10
  %93 = load i8, ptr %92, align 1, !tbaa !11
  %94 = zext i8 %93 to i32
  %95 = icmp ne i32 %91, %94
  br i1 %95, label %118, label %96

96:                                               ; preds = %80
  %97 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 11
  %98 = load i8, ptr %97, align 1, !tbaa !11
  %99 = zext i8 %98 to i32
  %100 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 12
  %101 = load i8, ptr %100, align 1, !tbaa !11
  %102 = zext i8 %101 to i32
  %103 = xor i32 %99, %102
  %104 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 13
  %105 = load i8, ptr %104, align 1, !tbaa !11
  %106 = zext i8 %105 to i32
  %107 = xor i32 %103, %106
  %108 = getelementptr inbounds [15 x i8], ptr %14, i64 0, i64 14
  %109 = load i8, ptr %108, align 1, !tbaa !11
  %110 = zext i8 %109 to i32
  %111 = icmp ne i32 %107, %110
  br i1 %111, label %118, label %112

112:                                              ; preds = %96
  %113 = getelementptr inbounds [11 x i8], ptr %15, i64 0, i64 10
  %114 = load i8, ptr %113, align 1, !tbaa !11
  %115 = zext i8 %114 to i32
  %116 = and i32 %115, 224
  %117 = icmp ne i32 %116, 0
  br label %118

118:                                              ; preds = %112, %96, %80, %64, %42
  %119 = phi i1 [ true, %96 ], [ true, %80 ], [ true, %64 ], [ true, %42 ], [ %117, %112 ]
  %120 = zext i1 %119 to i32
  %121 = trunc i32 %120 to i8
  %122 = load ptr, ptr %11, align 8, !tbaa !5
  store i8 %121, ptr %122, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 11, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 15, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #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 = { 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 }

!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_120_to_88(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

; 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 void @HURDLE_dec_cts(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @ta52(ptr noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5) local_unnamed_addr #0 {
  %7 = alloca [16 x i8], align 16
  %8 = alloca [15 x i8], align 1
  %9 = alloca [11 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %9) #4
  %10 = load <2 x i8>, ptr %2, align 1, !tbaa !5
  %11 = shufflevector <2 x i8> %10, <2 x i8> poison, <16 x i32> <i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1>
  %12 = load <16 x i8>, ptr %1, align 1, !tbaa !5
  %13 = xor <16 x i8> %11, %12
  store <16 x i8> %13, ptr %7, align 16, !tbaa !5
  call void @HURDLE_dec_cts(ptr noundef nonnull %8, ptr noundef %0, ptr noundef nonnull %7) #4
  call void @transform_120_to_88(ptr noundef nonnull %8, ptr noundef nonnull %9)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(10) %3, ptr noundef nonnull align 1 dereferenceable(10) %9, i64 10, i1 false)
  %14 = getelementptr inbounds i8, ptr %9, i64 10
  %15 = load i8, ptr %14, align 1, !tbaa !5
  store i8 %15, ptr %5, align 1, !tbaa !5
  %16 = load i8, ptr %8, align 1, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %8, i64 1
  %18 = load i8, ptr %17, align 1, !tbaa !5
  %19 = xor i8 %18, %16
  %20 = getelementptr inbounds i8, ptr %8, i64 2
  %21 = load i8, ptr %20, align 1, !tbaa !5
  %.not = icmp eq i8 %19, %21
  br i1 %.not, label %22, label %58

22:                                               ; preds = %6
  %23 = getelementptr inbounds i8, ptr %8, i64 3
  %24 = load i8, ptr %23, align 1, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %8, i64 4
  %26 = load i8, ptr %25, align 1, !tbaa !5
  %27 = xor i8 %26, %24
  %28 = getelementptr inbounds i8, ptr %8, i64 5
  %29 = load i8, ptr %28, align 1, !tbaa !5
  %30 = xor i8 %27, %29
  %31 = getelementptr inbounds i8, ptr %8, i64 6
  %32 = load i8, ptr %31, align 1, !tbaa !5
  %.not10 = icmp eq i8 %30, %32
  br i1 %.not10, label %33, label %58

33:                                               ; preds = %22
  %34 = getelementptr inbounds i8, ptr %8, i64 7
  %35 = load i8, ptr %34, align 1, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %8, i64 8
  %37 = load i8, ptr %36, align 1, !tbaa !5
  %38 = xor i8 %37, %35
  %39 = getelementptr inbounds i8, ptr %8, i64 9
  %40 = load i8, ptr %39, align 1, !tbaa !5
  %41 = xor i8 %38, %40
  %42 = getelementptr inbounds i8, ptr %8, i64 10
  %43 = load i8, ptr %42, align 1, !tbaa !5
  %.not11 = icmp eq i8 %41, %43
  br i1 %.not11, label %44, label %58

44:                                               ; preds = %33
  %45 = getelementptr inbounds i8, ptr %8, i64 11
  %46 = load i8, ptr %45, align 1, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %8, i64 12
  %48 = load i8, ptr %47, align 1, !tbaa !5
  %49 = xor i8 %48, %46
  %50 = getelementptr inbounds i8, ptr %8, i64 13
  %51 = load i8, ptr %50, align 1, !tbaa !5
  %52 = xor i8 %49, %51
  %53 = getelementptr inbounds i8, ptr %8, i64 14
  %54 = load i8, ptr %53, align 1, !tbaa !5
  %.not12 = icmp eq i8 %52, %54
  br i1 %.not12, label %55, label %58

55:                                               ; preds = %44
  %56 = icmp ugt i8 %15, 31
  %57 = zext i1 %56 to i8
  br label %58

58:                                               ; preds = %55, %44, %33, %22, %6
  %59 = phi i8 [ 1, %44 ], [ 1, %33 ], [ 1, %22 ], [ 1, %6 ], [ %57, %55 ]
  store i8 %59, ptr %4, align 1, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }

!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