; LLVM IR from libxsmm/libxsmm :: src (libxsmm_memory)

; 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: alwaysinline nounwind uwtable
declare hidden <2 x i64> @_mm_set1_epi32(i32 noundef) #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden <2 x i64> @_mm_loadu_si128(ptr noundef) #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @_mm_movemask_epi8(<2 x i64> noundef) #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden <2 x i64> @_mm_cmpeq_epi8(<2 x i64> noundef, <2 x i64> noundef) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @libxsmm_diff_48(ptr noundef %0, ptr noundef %1, ...) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca <2 x i64>, align 16
  %6 = alloca <2 x i64>, align 16
  %7 = alloca <2 x i64>, align 16
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #3
  %8 = call <2 x i64> @_mm_set1_epi32(i32 noundef 0)
  store <2 x i64> %8, ptr %5, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #3
  %9 = call <2 x i64> @_mm_set1_epi32(i32 noundef 0)
  store <2 x i64> %9, ptr %6, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #3
  %10 = call <2 x i64> @_mm_set1_epi32(i32 noundef 0)
  store <2 x i64> %10, ptr %7, align 16, !tbaa !9
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = call <2 x i64> @_mm_loadu_si128(ptr noundef %11)
  store <2 x i64> %12, ptr %5, align 16, !tbaa !9
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds i64, ptr %13, i64 2
  %15 = call <2 x i64> @_mm_loadu_si128(ptr noundef %14)
  store <2 x i64> %15, ptr %6, align 16, !tbaa !9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds i64, ptr %16, i64 2
  %18 = getelementptr inbounds i64, ptr %17, i64 2
  %19 = call <2 x i64> @_mm_loadu_si128(ptr noundef %18)
  store <2 x i64> %19, ptr %7, align 16, !tbaa !9
  %20 = load <2 x i64>, ptr %5, align 16, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = call <2 x i64> @_mm_loadu_si128(ptr noundef %21)
  %23 = call <2 x i64> @_mm_cmpeq_epi8(<2 x i64> noundef %20, <2 x i64> noundef %22)
  %24 = call i32 @_mm_movemask_epi8(<2 x i64> noundef %23)
  %25 = icmp ne i32 65535, %24
  %26 = zext i1 %25 to i32
  %27 = trunc i32 %26 to i8
  %28 = zext i8 %27 to i32
  %29 = icmp ne i32 0, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %2
  br label %60

31:                                               ; preds = %2
  %32 = load <2 x i64>, ptr %6, align 16, !tbaa !9
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds i64, ptr %33, i64 2
  %35 = call <2 x i64> @_mm_loadu_si128(ptr noundef %34)
  %36 = call <2 x i64> @_mm_cmpeq_epi8(<2 x i64> noundef %32, <2 x i64> noundef %35)
  %37 = call i32 @_mm_movemask_epi8(<2 x i64> noundef %36)
  %38 = icmp ne i32 65535, %37
  %39 = zext i1 %38 to i32
  %40 = trunc i32 %39 to i8
  %41 = zext i8 %40 to i32
  %42 = icmp ne i32 0, %41
  br i1 %42, label %43, label %44

43:                                               ; preds = %31
  br label %56

44:                                               ; preds = %31
  %45 = load <2 x i64>, ptr %7, align 16, !tbaa !9
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds i64, ptr %46, i64 2
  %48 = getelementptr inbounds i64, ptr %47, i64 2
  %49 = call <2 x i64> @_mm_loadu_si128(ptr noundef %48)
  %50 = call <2 x i64> @_mm_cmpeq_epi8(<2 x i64> noundef %45, <2 x i64> noundef %49)
  %51 = call i32 @_mm_movemask_epi8(<2 x i64> noundef %50)
  %52 = icmp ne i32 65535, %51
  %53 = zext i1 %52 to i32
  %54 = trunc i32 %53 to i8
  %55 = zext i8 %54 to i32
  br label %56

56:                                               ; preds = %44, %43
  %57 = phi i32 [ 1, %43 ], [ %55, %44 ]
  %58 = trunc i32 %57 to i8
  %59 = zext i8 %58 to i32
  br label %60

60:                                               ; preds = %56, %30
  %61 = phi i32 [ 1, %30 ], [ %59, %56 ]
  %62 = trunc i32 %61 to i8
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #3
  ret i8 %62
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { alwaysinline nounwind uwtable "min-legal-vector-width"="128" "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"="128" "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 }

!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}


; 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: alwaysinline nounwind uwtable
declare hidden <2 x i64> @_mm_set1_epi32(i32 noundef) local_unnamed_addr #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden <2 x i64> @_mm_loadu_si128(ptr noundef) local_unnamed_addr #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @_mm_movemask_epi8(<2 x i64> noundef) local_unnamed_addr #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden <2 x i64> @_mm_cmpeq_epi8(<2 x i64> noundef, <2 x i64> noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 2) i8 @libxsmm_diff_48(ptr noundef %0, ptr noundef %1, ...) local_unnamed_addr #1 {
  %3 = tail call <2 x i64> @_mm_set1_epi32(i32 noundef 0)
  %4 = tail call <2 x i64> @_mm_set1_epi32(i32 noundef 0)
  %5 = tail call <2 x i64> @_mm_set1_epi32(i32 noundef 0)
  %6 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef %0)
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %7)
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %9)
  %11 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef %1)
  %12 = tail call <2 x i64> @_mm_cmpeq_epi8(<2 x i64> noundef %6, <2 x i64> noundef %11)
  %13 = tail call i32 @_mm_movemask_epi8(<2 x i64> noundef %12)
  %.not = icmp eq i32 %13, 65535
  br i1 %.not, label %14, label %26

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %1, i64 16
  %16 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %15)
  %17 = tail call <2 x i64> @_mm_cmpeq_epi8(<2 x i64> noundef %8, <2 x i64> noundef %16)
  %18 = tail call i32 @_mm_movemask_epi8(<2 x i64> noundef %17)
  %.not8 = icmp eq i32 %18, 65535
  br i1 %.not8, label %19, label %26

19:                                               ; preds = %14
  %20 = getelementptr inbounds i8, ptr %1, i64 32
  %21 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %20)
  %22 = tail call <2 x i64> @_mm_cmpeq_epi8(<2 x i64> noundef %10, <2 x i64> noundef %21)
  %23 = tail call i32 @_mm_movemask_epi8(<2 x i64> noundef %22)
  %24 = icmp ne i32 %23, 65535
  %25 = zext i1 %24 to i8
  br label %26

26:                                               ; preds = %19, %14, %2
  %27 = phi i8 [ 1, %2 ], [ %25, %19 ], [ 1, %14 ]
  ret i8 %27
}

attributes #0 = { alwaysinline nounwind uwtable "min-legal-vector-width"="128" "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 = { nounwind uwtable "min-legal-vector-width"="128" "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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass