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

; 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.2 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @write_index(ptr noundef, i32 noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 10, ptr %2, align 4, !tbaa !5
  %8 = call ptr @llvm.stacksave.p0()
  store ptr %8, ptr %3, align 8
  %9 = alloca i32, i64 10, align 16
  %10 = alloca i32, i64 10, align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %23, %0
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = icmp slt i32 %12, 10
  br i1 %13, label %15, label %14

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

15:                                               ; preds = %11
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr %9, i64 %17
  store i32 0, ptr %18, align 4, !tbaa !5
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr %10, i64 %21
  store i32 %19, ptr %22, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %15
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %4, align 4, !tbaa !5
  br label %11, !llvm.loop !9

26:                                               ; preds = %14
  call void @write_index(ptr noundef %9, i32 noundef 10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 -1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %59, %26
  %28 = load i32, ptr %6, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 10
  br i1 %29, label %31, label %30

30:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %62

31:                                               ; preds = %27
  %32 = load i32, ptr %6, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr %9, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr %10, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp ne i32 %35, %39
  br i1 %40, label %41, label %58

41:                                               ; preds = %31
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = icmp eq i32 %42, -1
  br i1 %43, label %44, label %56

44:                                               ; preds = %41
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds i32, ptr %9, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = load i32, ptr %6, align 4, !tbaa !5
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr %10, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %45, i32 noundef %49, i32 noundef %50, i32 noundef %54)
  br label %56

56:                                               ; preds = %44, %41
  %57 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %57, ptr %5, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %56, %31
  br label %59

59:                                               ; preds = %58
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %6, align 4, !tbaa !5
  br label %27, !llvm.loop !11

62:                                               ; preds = %30
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = icmp eq i32 %63, -1
  br i1 %64, label %65, label %67

65:                                               ; preds = %62
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %80

67:                                               ; preds = %62
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr %9, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = load i32, ptr %5, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr %10, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %68, i32 noundef %72, i32 noundef %73, i32 noundef %77)
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %80

80:                                               ; preds = %67, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  %81 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %81)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %82 = load i32, ptr %1, align 4
  ret i32 %82
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 willreturn }
attributes #4 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; 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.2 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @write_index(ptr noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main() local_unnamed_addr #0 {
  %1 = alloca [10 x i32], align 16
  %2 = alloca [10 x i32], align 16
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %1, i8 0, i64 40, i1 false), !tbaa !5
  store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, ptr %2, align 16, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %2, i64 16
  store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, ptr %3, align 16, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %2, i64 32
  store i32 8, ptr %4, align 16, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %2, i64 36
  store i32 9, ptr %5, align 4, !tbaa !5
  call void @write_index(ptr noundef nonnull %1, i32 noundef 10)
  %6 = load i32, ptr %1, align 16, !tbaa !5
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %7, label %.thread

7:                                                ; preds = %0
  %8 = getelementptr inbounds i8, ptr %1, i64 4
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %.not.1 = icmp eq i32 %9, 1
  br i1 %.not.1, label %.thread34, label %13

.thread:                                          ; preds = %0
  %10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 0, i32 noundef %6, i32 noundef 0, i32 noundef 0)
  %11 = getelementptr inbounds i8, ptr %1, i64 4
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %.not.132 = icmp ne i32 %12, 1
  %spec.select = zext i1 %.not.132 to i32
  br label %.thread33

13:                                               ; preds = %7
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1, i32 noundef %9, i32 noundef 1, i32 noundef 1)
  br label %.thread33

.thread33:                                        ; preds = %.thread, %13
  %.1.1 = phi i32 [ 1, %13 ], [ %spec.select, %.thread ]
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !5
  %.not.2 = icmp eq i32 %16, 2
  %spec.select87 = select i1 %.not.2, i32 %.1.1, i32 2
  br label %21

.thread34:                                        ; preds = %7
  %17 = getelementptr inbounds i8, ptr %1, i64 8
  %18 = load i32, ptr %17, align 8, !tbaa !5
  %.not.236 = icmp eq i32 %18, 2
  br i1 %.not.236, label %.thread40, label %19

19:                                               ; preds = %.thread34
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 2, i32 noundef %18, i32 noundef 2, i32 noundef 2)
  br label %21

21:                                               ; preds = %.thread33, %19
  %.1.2 = phi i32 [ 2, %19 ], [ %spec.select87, %.thread33 ]
  %22 = getelementptr inbounds i8, ptr %1, i64 12
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %.not.3 = icmp eq i32 %23, 3
  %spec.select88 = select i1 %.not.3, i32 %.1.2, i32 3
  br label %28

.thread40:                                        ; preds = %.thread34
  %24 = getelementptr inbounds i8, ptr %1, i64 12
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %.not.342 = icmp eq i32 %25, 3
  br i1 %.not.342, label %.thread46, label %26

26:                                               ; preds = %.thread40
  %27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 3, i32 noundef %25, i32 noundef 3, i32 noundef 3)
  br label %28

28:                                               ; preds = %21, %26
  %.1.3 = phi i32 [ 3, %26 ], [ %spec.select88, %21 ]
  %29 = getelementptr inbounds i8, ptr %1, i64 16
  %30 = load i32, ptr %29, align 16, !tbaa !5
  %.not.4 = icmp eq i32 %30, 4
  %spec.select89 = select i1 %.not.4, i32 %.1.3, i32 4
  br label %35

.thread46:                                        ; preds = %.thread40
  %31 = getelementptr inbounds i8, ptr %1, i64 16
  %32 = load i32, ptr %31, align 16, !tbaa !5
  %.not.448 = icmp eq i32 %32, 4
  br i1 %.not.448, label %.thread52, label %33

33:                                               ; preds = %.thread46
  %34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 4, i32 noundef %32, i32 noundef 4, i32 noundef 4)
  br label %35

35:                                               ; preds = %28, %33
  %.1.4 = phi i32 [ 4, %33 ], [ %spec.select89, %28 ]
  %36 = getelementptr inbounds i8, ptr %1, i64 20
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %.not.5 = icmp eq i32 %37, 5
  %spec.select90 = select i1 %.not.5, i32 %.1.4, i32 5
  br label %42

.thread52:                                        ; preds = %.thread46
  %38 = getelementptr inbounds i8, ptr %1, i64 20
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %.not.554 = icmp eq i32 %39, 5
  br i1 %.not.554, label %.thread58, label %40

40:                                               ; preds = %.thread52
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 5, i32 noundef %39, i32 noundef 5, i32 noundef 5)
  br label %42

42:                                               ; preds = %35, %40
  %.1.5 = phi i32 [ 5, %40 ], [ %spec.select90, %35 ]
  %43 = getelementptr inbounds i8, ptr %1, i64 24
  %44 = load i32, ptr %43, align 8, !tbaa !5
  %.not.6 = icmp eq i32 %44, 6
  br i1 %.not.6, label %51, label %47

.thread58:                                        ; preds = %.thread52
  %45 = getelementptr inbounds i8, ptr %1, i64 24
  %46 = load i32, ptr %45, align 8, !tbaa !5
  %.not.660 = icmp eq i32 %46, 6
  br i1 %.not.660, label %.thread64, label %.thread62

47:                                               ; preds = %42
  %48 = icmp eq i32 %.1.5, -1
  br i1 %48, label %.thread62, label %51

.thread62:                                        ; preds = %.thread58, %47
  %49 = phi i32 [ %44, %47 ], [ %46, %.thread58 ]
  %50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 6, i32 noundef %49, i32 noundef 6, i32 noundef 6)
  br label %51

51:                                               ; preds = %.thread62, %47, %42
  %.1.6 = phi i32 [ %.1.5, %42 ], [ 6, %.thread62 ], [ 6, %47 ]
  %52 = getelementptr inbounds i8, ptr %1, i64 28
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %.not.7 = icmp eq i32 %53, 7
  br i1 %.not.7, label %60, label %56

.thread64:                                        ; preds = %.thread58
  %54 = getelementptr inbounds i8, ptr %1, i64 28
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %.not.766 = icmp eq i32 %55, 7
  br i1 %.not.766, label %.thread70, label %.thread68

56:                                               ; preds = %51
  %57 = icmp eq i32 %.1.6, -1
  br i1 %57, label %.thread68, label %60

.thread68:                                        ; preds = %.thread64, %56
  %58 = phi i32 [ %53, %56 ], [ %55, %.thread64 ]
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 7, i32 noundef %58, i32 noundef 7, i32 noundef 7)
  br label %60

60:                                               ; preds = %.thread68, %56, %51
  %.1.7 = phi i32 [ %.1.6, %51 ], [ 7, %.thread68 ], [ 7, %56 ]
  %61 = getelementptr inbounds i8, ptr %1, i64 32
  %62 = load i32, ptr %61, align 16, !tbaa !5
  %.not.8 = icmp eq i32 %62, 8
  br i1 %.not.8, label %69, label %65

.thread70:                                        ; preds = %.thread64
  %63 = getelementptr inbounds i8, ptr %1, i64 32
  %64 = load i32, ptr %63, align 16, !tbaa !5
  %.not.872 = icmp eq i32 %64, 8
  br i1 %.not.872, label %.thread76, label %.thread74

65:                                               ; preds = %60
  %66 = icmp eq i32 %.1.7, -1
  br i1 %66, label %.thread74, label %69

.thread74:                                        ; preds = %.thread70, %65
  %67 = phi i32 [ %62, %65 ], [ %64, %.thread70 ]
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 8, i32 noundef %67, i32 noundef 8, i32 noundef 8)
  br label %69

69:                                               ; preds = %.thread74, %65, %60
  %.1.8 = phi i32 [ %.1.7, %60 ], [ 8, %.thread74 ], [ 8, %65 ]
  %70 = getelementptr inbounds i8, ptr %1, i64 36
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %.not.9 = icmp eq i32 %71, 9
  %72 = icmp eq i32 %.1.8, -1
  br i1 %.not.9, label %78, label %75

.thread76:                                        ; preds = %.thread70
  %73 = getelementptr inbounds i8, ptr %1, i64 36
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %.not.978 = icmp eq i32 %74, 9
  br i1 %.not.978, label %.thread85, label %.thread80

75:                                               ; preds = %69
  br i1 %72, label %.thread80, label %.thread82

.thread80:                                        ; preds = %.thread76, %75
  %76 = phi i32 [ %71, %75 ], [ %74, %.thread76 ]
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 9, i32 noundef %76, i32 noundef 9, i32 noundef 9)
  br label %.thread82

78:                                               ; preds = %69
  br i1 %72, label %.thread85, label %.thread82

.thread82:                                        ; preds = %75, %.thread80, %78
  %.1.984 = phi i32 [ %.1.8, %78 ], [ 9, %.thread80 ], [ 9, %75 ]
  %79 = zext nneg i32 %.1.984 to i64
  %80 = getelementptr inbounds i32, ptr %1, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = getelementptr inbounds i32, ptr %2, i64 %79
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %.1.984, i32 noundef %81, i32 noundef %.1.984, i32 noundef %83)
  br label %.thread85

.thread85:                                        ; preds = %78, %.thread76, %.thread82
  %.str.5.sink = phi ptr [ @.str.5, %.thread82 ], [ @.str.3, %.thread76 ], [ @.str.3, %78 ]
  %.023 = phi i32 [ 1, %.thread82 ], [ 0, %.thread76 ], [ 0, %78 ]
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.5.sink)
  ret i32 %.023
}

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

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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/C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopIdiomRecognizePass,LoopRotatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass