; LLVM IR from ROCm/aomp :: test/smoke-limbo/multi-sdma (multi-sdma)

; 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: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %13 = call noalias noundef nonnull ptr @_Znam(i64 noundef 4096) #4
  store ptr %13, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %14 = call noalias noundef nonnull ptr @_Znam(i64 noundef 4096) #4
  store ptr %14, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %15 = call noalias noundef nonnull ptr @_Znam(i64 noundef 8192) #4
  store ptr %15, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %25, %2
  %17 = load i32, ptr %9, align 4, !tbaa !5
  %18 = icmp slt i32 %17, 1024
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %28

20:                                               ; preds = %16
  %21 = load ptr, ptr %6, align 8, !tbaa !9
  %22 = load i32, ptr %9, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i32, ptr %21, i64 %23
  store i32 1, ptr %24, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %20
  %26 = load i32, ptr %9, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %9, align 4, !tbaa !5
  br label %16, !llvm.loop !11

28:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %38, %28
  %30 = load i32, ptr %10, align 4, !tbaa !5
  %31 = icmp slt i32 %30, 1024
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %41

33:                                               ; preds = %29
  %34 = load ptr, ptr %7, align 8, !tbaa !9
  %35 = load i32, ptr %10, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i32, ptr %34, i64 %36
  store i32 2, ptr %37, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %33
  %39 = load i32, ptr %10, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %10, align 4, !tbaa !5
  br label %29, !llvm.loop !13

41:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %63, %41
  %43 = load i32, ptr %11, align 4, !tbaa !5
  %44 = icmp slt i32 %43, 1024
  br i1 %44, label %46, label %45

45:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %66

46:                                               ; preds = %42
  %47 = load ptr, ptr %6, align 8, !tbaa !9
  %48 = load i32, ptr %11, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %47, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = load ptr, ptr %7, align 8, !tbaa !9
  %53 = load i32, ptr %11, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr %52, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = mul nsw i32 %51, %56
  %58 = sitofp i32 %57 to double
  %59 = load ptr, ptr %8, align 8, !tbaa !9
  %60 = load i32, ptr %11, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds double, ptr %59, i64 %61
  store double %58, ptr %62, align 8, !tbaa !14
  br label %63

63:                                               ; preds = %46
  %64 = load i32, ptr %11, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %11, align 4, !tbaa !5
  br label %42, !llvm.loop !16

66:                                               ; preds = %45
  %67 = load ptr, ptr %8, align 8, !tbaa !9
  %68 = getelementptr inbounds double, ptr %67, i64 2
  %69 = load double, ptr %68, align 8, !tbaa !14
  %70 = fcmp une double %69, 2.000000e+00
  br i1 %70, label %71, label %72

71:                                               ; preds = %66
  store i32 7, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %73

72:                                               ; preds = %66
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %73

73:                                               ; preds = %72, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %74 = load i32, ptr %3, align 4
  ret i32 %74
}

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #2

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

attributes #0 = { mustprogress norecurse 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 = { nobuiltin allocsize(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 }
attributes #4 = { builtin allocsize(0) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = distinct !{!16, !12}


; 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 norecurse uwtable
define dso_local noundef range(i32 0, 8) i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
vector.ph:
  %2 = tail call noalias noundef nonnull dereferenceable(4096) ptr @_Znam(i64 noundef 4096) #2
  %3 = tail call noalias noundef nonnull dereferenceable(4096) ptr @_Znam(i64 noundef 4096) #2
  %4 = tail call noalias noundef nonnull dereferenceable(8192) ptr @_Znam(i64 noundef 8192) #2
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.3, %vector.body ]
  %5 = getelementptr inbounds i32, ptr %2, i64 %index
  %6 = getelementptr inbounds i8, ptr %5, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 4, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 4, !tbaa !5
  %index.next = or disjoint i64 %index, 8
  %7 = getelementptr inbounds i32, ptr %2, i64 %index.next
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 4, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 4, !tbaa !5
  %index.next.1 = or disjoint i64 %index, 16
  %9 = getelementptr inbounds i32, ptr %2, i64 %index.next.1
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 4, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %10, align 4, !tbaa !5
  %index.next.2 = or disjoint i64 %index, 24
  %11 = getelementptr inbounds i32, ptr %2, i64 %index.next.2
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %11, align 4, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %12, align 4, !tbaa !5
  %index.next.3 = add nuw nsw i64 %index, 32
  %13 = icmp eq i64 %index.next.3, 1024
  br i1 %13, label %vector.body37, label %vector.body, !llvm.loop !9

vector.body37:                                    ; preds = %vector.body, %vector.body37
  %index38 = phi i64 [ %index.next39.3, %vector.body37 ], [ 0, %vector.body ]
  %14 = getelementptr inbounds i32, ptr %3, i64 %index38
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr %14, align 4, !tbaa !5
  store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr %15, align 4, !tbaa !5
  %index.next39 = or disjoint i64 %index38, 8
  %16 = getelementptr inbounds i32, ptr %3, i64 %index.next39
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr %16, align 4, !tbaa !5
  store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr %17, align 4, !tbaa !5
  %index.next39.1 = or disjoint i64 %index38, 16
  %18 = getelementptr inbounds i32, ptr %3, i64 %index.next39.1
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr %18, align 4, !tbaa !5
  store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr %19, align 4, !tbaa !5
  %index.next39.2 = or disjoint i64 %index38, 24
  %20 = getelementptr inbounds i32, ptr %3, i64 %index.next39.2
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr %20, align 4, !tbaa !5
  store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr %21, align 4, !tbaa !5
  %index.next39.3 = add nuw nsw i64 %index38, 32
  %22 = icmp eq i64 %index.next39.3, 1024
  br i1 %22, label %vector.body44, label %vector.body37, !llvm.loop !13

vector.body44:                                    ; preds = %vector.body37, %vector.body44
  %index45 = phi i64 [ %index.next49, %vector.body44 ], [ 0, %vector.body37 ]
  %23 = getelementptr inbounds i32, ptr %2, i64 %index45
  %24 = getelementptr inbounds i8, ptr %23, i64 8
  %wide.load = load <2 x i32>, ptr %23, align 4, !tbaa !5
  %wide.load46 = load <2 x i32>, ptr %24, align 4, !tbaa !5
  %25 = getelementptr inbounds i32, ptr %3, i64 %index45
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %wide.load47 = load <2 x i32>, ptr %25, align 4, !tbaa !5
  %wide.load48 = load <2 x i32>, ptr %26, align 4, !tbaa !5
  %27 = mul nsw <2 x i32> %wide.load47, %wide.load
  %28 = mul nsw <2 x i32> %wide.load48, %wide.load46
  %29 = sitofp <2 x i32> %27 to <2 x double>
  %30 = sitofp <2 x i32> %28 to <2 x double>
  %31 = getelementptr inbounds double, ptr %4, i64 %index45
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  store <2 x double> %29, ptr %31, align 8, !tbaa !14
  store <2 x double> %30, ptr %32, align 8, !tbaa !14
  %index.next49 = add nuw i64 %index45, 4
  %33 = icmp eq i64 %index.next49, 1024
  br i1 %33, label %middle.block40, label %vector.body44, !llvm.loop !16

middle.block40:                                   ; preds = %vector.body44
  %34 = getelementptr inbounds i8, ptr %4, i64 16
  %35 = load double, ptr %34, align 8, !tbaa !14
  %36 = fcmp une double %35, 2.000000e+00
  %. = select i1 %36, i32 7, i32 0
  ret i32 %.
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress norecurse 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 = { nobuiltin allocsize(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 = { builtin allocsize(0) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !11, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = distinct !{!16, !10, !11, !12}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass