; LLVM IR from rweather/lightweight-crypto :: src/combined (internal-sliscp-light)

; 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: 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: nounwind uwtable
define dso_local void @sliscp_light256_swap_spix(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 12
  %9 = getelementptr inbounds i8, ptr %8, i64 3
  %10 = load i8, ptr %9, align 1, !tbaa !9
  %11 = zext i8 %10 to i32
  %12 = shl i32 %11, 24
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 12
  %15 = getelementptr inbounds i8, ptr %14, i64 2
  %16 = load i8, ptr %15, align 1, !tbaa !9
  %17 = zext i8 %16 to i32
  %18 = shl i32 %17, 16
  %19 = or i32 %12, %18
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 12
  %22 = getelementptr inbounds i8, ptr %21, i64 1
  %23 = load i8, ptr %22, align 1, !tbaa !9
  %24 = zext i8 %23 to i32
  %25 = shl i32 %24, 8
  %26 = or i32 %19, %25
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i64 12
  %29 = getelementptr inbounds i8, ptr %28, i64 0
  %30 = load i8, ptr %29, align 1, !tbaa !9
  %31 = zext i8 %30 to i32
  %32 = or i32 %26, %31
  store i32 %32, ptr %3, align 4, !tbaa !10
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 24
  %35 = getelementptr inbounds i8, ptr %34, i64 3
  %36 = load i8, ptr %35, align 1, !tbaa !9
  %37 = zext i8 %36 to i32
  %38 = shl i32 %37, 24
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 24
  %41 = getelementptr inbounds i8, ptr %40, i64 2
  %42 = load i8, ptr %41, align 1, !tbaa !9
  %43 = zext i8 %42 to i32
  %44 = shl i32 %43, 16
  %45 = or i32 %38, %44
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 24
  %48 = getelementptr inbounds i8, ptr %47, i64 1
  %49 = load i8, ptr %48, align 1, !tbaa !9
  %50 = zext i8 %49 to i32
  %51 = shl i32 %50, 8
  %52 = or i32 %45, %51
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %53, i64 24
  %55 = getelementptr inbounds i8, ptr %54, i64 0
  %56 = load i8, ptr %55, align 1, !tbaa !9
  %57 = zext i8 %56 to i32
  %58 = or i32 %52, %57
  store i32 %58, ptr %4, align 4, !tbaa !10
  br label %59

59:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  %60 = load i32, ptr %3, align 4, !tbaa !10
  store i32 %60, ptr %5, align 4, !tbaa !10
  %61 = load i32, ptr %5, align 4, !tbaa !10
  %62 = trunc i32 %61 to i8
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %63, i64 24
  %65 = getelementptr inbounds i8, ptr %64, i64 0
  store i8 %62, ptr %65, align 1, !tbaa !9
  %66 = load i32, ptr %5, align 4, !tbaa !10
  %67 = lshr i32 %66, 8
  %68 = trunc i32 %67 to i8
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %69, i64 24
  %71 = getelementptr inbounds i8, ptr %70, i64 1
  store i8 %68, ptr %71, align 1, !tbaa !9
  %72 = load i32, ptr %5, align 4, !tbaa !10
  %73 = lshr i32 %72, 16
  %74 = trunc i32 %73 to i8
  %75 = load ptr, ptr %2, align 8, !tbaa !5
  %76 = getelementptr inbounds i8, ptr %75, i64 24
  %77 = getelementptr inbounds i8, ptr %76, i64 2
  store i8 %74, ptr %77, align 1, !tbaa !9
  %78 = load i32, ptr %5, align 4, !tbaa !10
  %79 = lshr i32 %78, 24
  %80 = trunc i32 %79 to i8
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds i8, ptr %81, i64 24
  %83 = getelementptr inbounds i8, ptr %82, i64 3
  store i8 %80, ptr %83, align 1, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  br label %84

84:                                               ; preds = %59
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %87 = load i32, ptr %4, align 4, !tbaa !10
  store i32 %87, ptr %6, align 4, !tbaa !10
  %88 = load i32, ptr %6, align 4, !tbaa !10
  %89 = trunc i32 %88 to i8
  %90 = load ptr, ptr %2, align 8, !tbaa !5
  %91 = getelementptr inbounds i8, ptr %90, i64 12
  %92 = getelementptr inbounds i8, ptr %91, i64 0
  store i8 %89, ptr %92, align 1, !tbaa !9
  %93 = load i32, ptr %6, align 4, !tbaa !10
  %94 = lshr i32 %93, 8
  %95 = trunc i32 %94 to i8
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  %97 = getelementptr inbounds i8, ptr %96, i64 12
  %98 = getelementptr inbounds i8, ptr %97, i64 1
  store i8 %95, ptr %98, align 1, !tbaa !9
  %99 = load i32, ptr %6, align 4, !tbaa !10
  %100 = lshr i32 %99, 16
  %101 = trunc i32 %100 to i8
  %102 = load ptr, ptr %2, align 8, !tbaa !5
  %103 = getelementptr inbounds i8, ptr %102, i64 12
  %104 = getelementptr inbounds i8, ptr %103, i64 2
  store i8 %101, ptr %104, align 1, !tbaa !9
  %105 = load i32, ptr %6, align 4, !tbaa !10
  %106 = lshr i32 %105, 24
  %107 = trunc i32 %106 to i8
  %108 = load ptr, ptr %2, align 8, !tbaa !5
  %109 = getelementptr inbounds i8, ptr %108, i64 12
  %110 = getelementptr inbounds i8, ptr %109, i64 3
  store i8 %107, ptr %110, align 1, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  br label %111

111:                                              ; preds = %86
  br label %112

112:                                              ; preds = %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @sliscp_light256_swap_spix(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 12
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load <4 x i8>, ptr %3, align 1, !tbaa !5
  %5 = load <4 x i8>, ptr %2, align 1, !tbaa !5
  store <4 x i8> %5, ptr %3, align 1, !tbaa !5
  store <4 x i8> %4, ptr %2, align 1, !tbaa !5
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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" }

!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,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass