; LLVM IR from ROCm/aomp :: test/smoke-fails/eager_maps (eager_maps)

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

@.str = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 20480, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %10 = call noalias noundef nonnull ptr @_Znam(i64 noundef 163840) #5
  store ptr %10, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %11 = call noalias noundef nonnull ptr @_Znam(i64 noundef 163840) #5
  store ptr %11, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !11
  br label %12

12:                                               ; preds = %24, %0
  %13 = load i64, ptr %5, align 8, !tbaa !11
  %14 = icmp slt i64 %13, 20480
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %27

16:                                               ; preds = %12
  %17 = load ptr, ptr %3, align 8, !tbaa !9
  %18 = load i64, ptr %5, align 8, !tbaa !11
  %19 = getelementptr inbounds i64, ptr %17, i64 %18
  store i64 -1, ptr %19, align 8, !tbaa !11
  %20 = load i64, ptr %5, align 8, !tbaa !11
  %21 = load ptr, ptr %4, align 8, !tbaa !9
  %22 = load i64, ptr %5, align 8, !tbaa !11
  %23 = getelementptr inbounds i64, ptr %21, i64 %22
  store i64 %20, ptr %23, align 8, !tbaa !11
  br label %24

24:                                               ; preds = %16
  %25 = load i64, ptr %5, align 8, !tbaa !11
  %26 = add nsw i64 %25, 1
  store i64 %26, ptr %5, align 8, !tbaa !11
  br label %12, !llvm.loop !13

27:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !11
  br label %28

28:                                               ; preds = %42, %27
  %29 = load i64, ptr %6, align 8, !tbaa !11
  %30 = icmp slt i64 %29, 20480
  br i1 %30, label %32, label %31

31:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %45

32:                                               ; preds = %28
  %33 = load ptr, ptr %4, align 8, !tbaa !9
  %34 = load i64, ptr %6, align 8, !tbaa !11
  %35 = getelementptr inbounds i64, ptr %33, i64 %34
  %36 = load i64, ptr %35, align 8, !tbaa !11
  %37 = load ptr, ptr %3, align 8, !tbaa !9
  %38 = load i64, ptr %6, align 8, !tbaa !11
  %39 = getelementptr inbounds i64, ptr %37, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !11
  %41 = add nsw i64 %40, %36
  store i64 %41, ptr %39, align 8, !tbaa !11
  br label %42

42:                                               ; preds = %32
  %43 = load i64, ptr %6, align 8, !tbaa !11
  %44 = add nsw i64 %43, 1
  store i64 %44, ptr %6, align 8, !tbaa !11
  br label %28, !llvm.loop !15

45:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !11
  br label %46

46:                                               ; preds = %81, %45
  %47 = load i64, ptr %8, align 8, !tbaa !11
  %48 = icmp slt i64 %47, 20480
  br i1 %48, label %50, label %49

49:                                               ; preds = %46
  store i32 8, ptr %9, align 4
  br label %84

50:                                               ; preds = %46
  %51 = load ptr, ptr %3, align 8, !tbaa !9
  %52 = load i64, ptr %8, align 8, !tbaa !11
  %53 = getelementptr inbounds i64, ptr %51, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !11
  %55 = load ptr, ptr %4, align 8, !tbaa !9
  %56 = load i64, ptr %8, align 8, !tbaa !11
  %57 = getelementptr inbounds i64, ptr %55, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !11
  %59 = sub nsw i64 %58, 1
  %60 = icmp ne i64 %54, %59
  br i1 %60, label %61, label %80

61:                                               ; preds = %50
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %7, align 4, !tbaa !5
  %64 = load i64, ptr %8, align 8, !tbaa !11
  %65 = load ptr, ptr %4, align 8, !tbaa !9
  %66 = load i64, ptr %8, align 8, !tbaa !11
  %67 = getelementptr inbounds i64, ptr %65, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !11
  %69 = sub nsw i64 %68, 1
  %70 = load ptr, ptr %3, align 8, !tbaa !9
  %71 = load i64, ptr %8, align 8, !tbaa !11
  %72 = getelementptr inbounds i64, ptr %70, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !11
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str, i64 noundef %64, i64 noundef %69, i64 noundef %73)
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = icmp sgt i32 %75, 10
  br i1 %76, label %77, label %79

77:                                               ; preds = %61
  %78 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %78, ptr %1, align 4
  store i32 1, ptr %9, align 4
  br label %84

79:                                               ; preds = %61
  br label %80

80:                                               ; preds = %79, %50
  br label %81

81:                                               ; preds = %80
  %82 = load i64, ptr %8, align 8, !tbaa !11
  %83 = add nsw i64 %82, 1
  store i64 %83, ptr %8, align 8, !tbaa !11
  br label %46, !llvm.loop !16

84:                                               ; preds = %77, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %85 = load i32, ptr %9, align 4
  switch i32 %85, label %88 [
    i32 8, label %86
  ]

86:                                               ; preds = %84
  %87 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %87, ptr %1, align 4
  store i32 1, ptr %9, align 4
  br label %88

88:                                               ; preds = %86, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %89 = load i32, ptr %1, align 4
  ret i32 %89
}

; 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

declare i32 @printf(ptr noundef, ...) #3

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 = { "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 }
attributes #5 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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

@.str = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
vector.ph:
  %0 = tail call noalias noundef nonnull dereferenceable(163840) ptr @_Znam(i64 noundef 163840) #4
  %1 = tail call noalias noundef nonnull dereferenceable(163840) ptr @_Znam(i64 noundef 163840) #4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(163840) %0, i8 -1, i64 163840, i1 false), !tbaa !5
  br label %vector.body

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

vector.body51:                                    ; preds = %vector.body, %vector.body51
  %index52 = phi i64 [ %index.next56.1, %vector.body51 ], [ 0, %vector.body ]
  %11 = getelementptr inbounds i64, ptr %1, i64 %index52
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  %wide.load = load <2 x i64>, ptr %11, align 8, !tbaa !5
  %wide.load53 = load <2 x i64>, ptr %12, align 8, !tbaa !5
  %13 = getelementptr inbounds i64, ptr %0, i64 %index52
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  %wide.load54 = load <2 x i64>, ptr %13, align 8, !tbaa !5
  %wide.load55 = load <2 x i64>, ptr %14, align 8, !tbaa !5
  %15 = add nsw <2 x i64> %wide.load54, %wide.load
  %16 = add nsw <2 x i64> %wide.load55, %wide.load53
  store <2 x i64> %15, ptr %13, align 8, !tbaa !5
  store <2 x i64> %16, ptr %14, align 8, !tbaa !5
  %index.next56 = or disjoint i64 %index52, 4
  %17 = getelementptr inbounds i64, ptr %1, i64 %index.next56
  %18 = getelementptr inbounds i8, ptr %17, i64 16
  %wide.load.1 = load <2 x i64>, ptr %17, align 8, !tbaa !5
  %wide.load53.1 = load <2 x i64>, ptr %18, align 8, !tbaa !5
  %19 = getelementptr inbounds i64, ptr %0, i64 %index.next56
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  %wide.load54.1 = load <2 x i64>, ptr %19, align 8, !tbaa !5
  %wide.load55.1 = load <2 x i64>, ptr %20, align 8, !tbaa !5
  %21 = add nsw <2 x i64> %wide.load54.1, %wide.load.1
  %22 = add nsw <2 x i64> %wide.load55.1, %wide.load53.1
  store <2 x i64> %21, ptr %19, align 8, !tbaa !5
  store <2 x i64> %22, ptr %20, align 8, !tbaa !5
  %index.next56.1 = add nuw nsw i64 %index52, 8
  %23 = icmp eq i64 %index.next56.1, 20480
  br i1 %23, label %.preheader, label %vector.body51, !llvm.loop !13

.preheader:                                       ; preds = %vector.body51, %33
  %.02943 = phi i64 [ %34, %33 ], [ 0, %vector.body51 ]
  %.03042 = phi i32 [ %.1, %33 ], [ 0, %vector.body51 ]
  %24 = getelementptr inbounds i64, ptr %0, i64 %.02943
  %25 = load i64, ptr %24, align 8, !tbaa !5
  %26 = getelementptr inbounds i64, ptr %1, i64 %.02943
  %27 = load i64, ptr %26, align 8, !tbaa !5
  %28 = add nsw i64 %27, -1
  %.not = icmp eq i64 %25, %28
  br i1 %.not, label %33, label %29

29:                                               ; preds = %.preheader
  %30 = add nsw i32 %.03042, 1
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %.02943, i64 noundef %28, i64 noundef %25)
  %32 = icmp sgt i32 %.03042, 9
  br i1 %32, label %35, label %33

33:                                               ; preds = %.preheader, %29
  %.1 = phi i32 [ %30, %29 ], [ %.03042, %.preheader ]
  %34 = add nuw nsw i64 %.02943, 1
  %exitcond45 = icmp eq i64 %34, 20480
  br i1 %exitcond45, label %35, label %.preheader, !llvm.loop !14

35:                                               ; preds = %29, %33
  %spec.select = phi i32 [ %.1, %33 ], [ %30, %29 ]
  ret i32 %spec.select
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { nofree nounwind "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"long", !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 = distinct !{!14, !10}


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