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

; 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.libxsmm_generated_code = type { ptr, i32, i32, i32, i32, i32, i32 }

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

declare i32 @libxsmm_cpuid_vlen32(i32 noundef) #1

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

declare void @libxsmm_aarch64_instruction_sve_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

declare void @libxsmm_aarch64_instruction_asimd_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_generator_load_prng_state_aarch64_asimd(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) #2 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !9
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %15, i32 0, i32 6
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = icmp uge i32 %17, 2201
  br i1 %18, label %19, label %49

19:                                               ; preds = %6
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %20, i32 0, i32 6
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = icmp ule i32 %22, 2999
  br i1 %23, label %24, label %49

24:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %25, i32 0, i32 6
  %27 = load i32, ptr %26, align 4, !tbaa !11
  %28 = call i32 @libxsmm_cpuid_vlen32(i32 noundef %27)
  %29 = mul nsw i32 4, %28
  store i32 %29, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %30 = load i32, ptr %13, align 4, !tbaa !9
  %31 = udiv i32 64, %30
  store i32 %31, ptr %14, align 4, !tbaa !9
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = load i32, ptr %9, align 4, !tbaa !9
  call void @libxsmm_aarch64_instruction_sve_move(ptr noundef %32, i32 noundef -2055192570, i32 noundef %33, i32 noundef 127, i32 noundef 0, i32 noundef %34, i32 noundef 0)
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = load i32, ptr %14, align 4, !tbaa !9
  %38 = load i32, ptr %10, align 4, !tbaa !9
  call void @libxsmm_aarch64_instruction_sve_move(ptr noundef %35, i32 noundef -2055192570, i32 noundef %36, i32 noundef 127, i32 noundef %37, i32 noundef %38, i32 noundef 0)
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = load i32, ptr %8, align 4, !tbaa !9
  %41 = load i32, ptr %14, align 4, !tbaa !9
  %42 = mul i32 2, %41
  %43 = load i32, ptr %11, align 4, !tbaa !9
  call void @libxsmm_aarch64_instruction_sve_move(ptr noundef %39, i32 noundef -2055192570, i32 noundef %40, i32 noundef 127, i32 noundef %42, i32 noundef %43, i32 noundef 0)
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = load i32, ptr %14, align 4, !tbaa !9
  %47 = mul i32 3, %46
  %48 = load i32, ptr %12, align 4, !tbaa !9
  call void @libxsmm_aarch64_instruction_sve_move(ptr noundef %44, i32 noundef -2055192570, i32 noundef %45, i32 noundef 127, i32 noundef %47, i32 noundef %48, i32 noundef 0)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  br label %62

49:                                               ; preds = %19, %6
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = load i32, ptr %9, align 4, !tbaa !9
  call void @libxsmm_aarch64_instruction_asimd_move(ptr noundef %50, i32 noundef 1027604486, i32 noundef %51, i32 noundef 127, i32 noundef 0, i32 noundef %52, i32 noundef 1)
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = load i32, ptr %10, align 4, !tbaa !9
  call void @libxsmm_aarch64_instruction_asimd_move(ptr noundef %53, i32 noundef 1027604486, i32 noundef %54, i32 noundef 127, i32 noundef 64, i32 noundef %55, i32 noundef 1)
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = load i32, ptr %8, align 4, !tbaa !9
  %58 = load i32, ptr %11, align 4, !tbaa !9
  call void @libxsmm_aarch64_instruction_asimd_move(ptr noundef %56, i32 noundef 1027604486, i32 noundef %57, i32 noundef 127, i32 noundef 128, i32 noundef %58, i32 noundef 1)
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = load i32, ptr %8, align 4, !tbaa !9
  %61 = load i32, ptr %12, align 4, !tbaa !9
  call void @libxsmm_aarch64_instruction_asimd_move(ptr noundef %59, i32 noundef 1027604486, i32 noundef %60, i32 noundef 127, i32 noundef 192, i32 noundef %61, i32 noundef 1)
  br label %62

62:                                               ; preds = %49, %24
  ret void
}

attributes #0 = { nocallback nofree nosync 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 = { 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 = !{!12, !10, i64 28}
!12 = !{!"libxsmm_generated_code", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}


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

declare i32 @libxsmm_cpuid_vlen32(i32 noundef) local_unnamed_addr #0

declare void @libxsmm_aarch64_instruction_sve_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @libxsmm_aarch64_instruction_asimd_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_generator_load_prng_state_aarch64_asimd(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #1 {
  %7 = getelementptr inbounds i8, ptr %0, i64 28
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %9 = add i32 %8, -2201
  %or.cond = icmp ult i32 %9, 799
  br i1 %or.cond, label %10, label %16

10:                                               ; preds = %6
  %11 = tail call i32 @libxsmm_cpuid_vlen32(i32 noundef %8) #2
  %12 = shl nsw i32 %11, 2
  %13 = udiv i32 64, %12
  tail call void @libxsmm_aarch64_instruction_sve_move(ptr noundef nonnull %0, i32 noundef -2055192570, i32 noundef %1, i32 noundef 127, i32 noundef 0, i32 noundef %2, i32 noundef 0) #2
  tail call void @libxsmm_aarch64_instruction_sve_move(ptr noundef nonnull %0, i32 noundef -2055192570, i32 noundef %1, i32 noundef 127, i32 noundef %13, i32 noundef %3, i32 noundef 0) #2
  %14 = shl nuw nsw i32 %13, 1
  tail call void @libxsmm_aarch64_instruction_sve_move(ptr noundef nonnull %0, i32 noundef -2055192570, i32 noundef %1, i32 noundef 127, i32 noundef %14, i32 noundef %4, i32 noundef 0) #2
  %15 = mul nuw nsw i32 %13, 3
  tail call void @libxsmm_aarch64_instruction_sve_move(ptr noundef nonnull %0, i32 noundef -2055192570, i32 noundef %1, i32 noundef 127, i32 noundef %15, i32 noundef %5, i32 noundef 0) #2
  br label %17

16:                                               ; preds = %6
  tail call void @libxsmm_aarch64_instruction_asimd_move(ptr noundef nonnull %0, i32 noundef 1027604486, i32 noundef %1, i32 noundef 127, i32 noundef 0, i32 noundef %2, i32 noundef 1) #2
  tail call void @libxsmm_aarch64_instruction_asimd_move(ptr noundef nonnull %0, i32 noundef 1027604486, i32 noundef %1, i32 noundef 127, i32 noundef 64, i32 noundef %3, i32 noundef 1) #2
  tail call void @libxsmm_aarch64_instruction_asimd_move(ptr noundef nonnull %0, i32 noundef 1027604486, i32 noundef %1, i32 noundef 127, i32 noundef 128, i32 noundef %4, i32 noundef 1) #2
  tail call void @libxsmm_aarch64_instruction_asimd_move(ptr noundef nonnull %0, i32 noundef 1027604486, i32 noundef %1, i32 noundef 127, i32 noundef 192, i32 noundef %5, i32 noundef 1) #2
  br label %17

17:                                               ; preds = %16, %10
  ret void
}

attributes #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 = { 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, !10, i64 28}
!6 = !{!"libxsmm_generated_code", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}


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