; LLVM IR from ROCm/aomp :: test/smoke/decl_map_targ (decl_map_targ)

; 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 [10 x i8], align 1

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

8:                                                ; preds = %17, %0
  %9 = load i32, ptr %3, align 4, !tbaa !9
  %10 = icmp slt i32 %9, 1024
  br i1 %10, label %12, label %11

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

12:                                               ; preds = %8
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = load i32, ptr %3, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds i32, ptr %13, i64 %15
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %12
  %18 = load i32, ptr %3, align 4, !tbaa !9
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %3, align 4, !tbaa !9
  br label %8, !llvm.loop !11

20:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %32, %20
  %22 = load i32, ptr %4, align 4, !tbaa !9
  %23 = icmp slt i32 %22, 1024
  br i1 %23, label %25, label %24

24:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %35

25:                                               ; preds = %21
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = load i32, ptr %4, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %26, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %29, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %25
  %33 = load i32, ptr %4, align 4, !tbaa !9
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %4, align 4, !tbaa !9
  br label %21, !llvm.loop !13

35:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %48, %35
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = icmp slt i32 %37, 1024
  br i1 %38, label %40, label %39

39:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %51

40:                                               ; preds = %36
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr %41, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = load i32, ptr %5, align 4, !tbaa !9
  %47 = add nsw i32 %46, %45
  store i32 %47, ptr %5, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %40
  %49 = load i32, ptr %6, align 4, !tbaa !9
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %6, align 4, !tbaa !9
  br label %36, !llvm.loop !14

51:                                               ; preds = %39
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %52)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  ret i32 0
}

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

@.str = external hidden unnamed_addr constant [10 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(4096) ptr @_Znam(i64 noundef 4096) #4
  br label %vector.body

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

vector.body34:                                    ; preds = %vector.body, %vector.body34
  %index35 = phi i64 [ %index.next37.1, %vector.body34 ], [ 0, %vector.body ]
  %10 = getelementptr inbounds i32, ptr %0, i64 %index35
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  %wide.load = load <4 x i32>, ptr %10, align 4, !tbaa !5
  %wide.load36 = load <4 x i32>, ptr %11, align 4, !tbaa !5
  %12 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
  %13 = add nsw <4 x i32> %wide.load36, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %12, ptr %10, align 4, !tbaa !5
  store <4 x i32> %13, ptr %11, align 4, !tbaa !5
  %index.next37 = or disjoint i64 %index35, 8
  %14 = getelementptr inbounds i32, ptr %0, i64 %index.next37
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  %wide.load.1 = load <4 x i32>, ptr %14, align 4, !tbaa !5
  %wide.load36.1 = load <4 x i32>, ptr %15, align 4, !tbaa !5
  %16 = add nsw <4 x i32> %wide.load.1, <i32 1, i32 1, i32 1, i32 1>
  %17 = add nsw <4 x i32> %wide.load36.1, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %16, ptr %14, align 4, !tbaa !5
  store <4 x i32> %17, ptr %15, align 4, !tbaa !5
  %index.next37.1 = add nuw nsw i64 %index35, 16
  %18 = icmp eq i64 %index.next37.1, 1024
  br i1 %18, label %vector.body42, label %vector.body34, !llvm.loop !13

vector.body42:                                    ; preds = %vector.body34, %vector.body42
  %index43 = phi i64 [ %index.next47.3, %vector.body42 ], [ 0, %vector.body34 ]
  %vec.phi = phi <4 x i32> [ %33, %vector.body42 ], [ zeroinitializer, %vector.body34 ]
  %vec.phi44 = phi <4 x i32> [ %34, %vector.body42 ], [ zeroinitializer, %vector.body34 ]
  %19 = getelementptr inbounds i32, ptr %0, i64 %index43
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  %wide.load45 = load <4 x i32>, ptr %19, align 4, !tbaa !5
  %wide.load46 = load <4 x i32>, ptr %20, align 4, !tbaa !5
  %21 = add <4 x i32> %wide.load45, %vec.phi
  %22 = add <4 x i32> %wide.load46, %vec.phi44
  %index.next47 = or disjoint i64 %index43, 8
  %23 = getelementptr inbounds i32, ptr %0, i64 %index.next47
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  %wide.load45.1 = load <4 x i32>, ptr %23, align 4, !tbaa !5
  %wide.load46.1 = load <4 x i32>, ptr %24, align 4, !tbaa !5
  %25 = add <4 x i32> %wide.load45.1, %21
  %26 = add <4 x i32> %wide.load46.1, %22
  %index.next47.1 = or disjoint i64 %index43, 16
  %27 = getelementptr inbounds i32, ptr %0, i64 %index.next47.1
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  %wide.load45.2 = load <4 x i32>, ptr %27, align 4, !tbaa !5
  %wide.load46.2 = load <4 x i32>, ptr %28, align 4, !tbaa !5
  %29 = add <4 x i32> %wide.load45.2, %25
  %30 = add <4 x i32> %wide.load46.2, %26
  %index.next47.2 = or disjoint i64 %index43, 24
  %31 = getelementptr inbounds i32, ptr %0, i64 %index.next47.2
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  %wide.load45.3 = load <4 x i32>, ptr %31, align 4, !tbaa !5
  %wide.load46.3 = load <4 x i32>, ptr %32, align 4, !tbaa !5
  %33 = add <4 x i32> %wide.load45.3, %29
  %34 = add <4 x i32> %wide.load46.3, %30
  %index.next47.3 = add nuw nsw i64 %index43, 32
  %35 = icmp eq i64 %index.next47.3, 1024
  br i1 %35, label %middle.block38, label %vector.body42, !llvm.loop !14

middle.block38:                                   ; preds = %vector.body42
  %bin.rdx = add <4 x i32> %34, %33
  %36 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %36)
  ret i32 0
}

; 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 nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #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 nosync nounwind speculatable willreturn memory(none) }
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 = 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, !11, !12}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass