; LLVM IR from ROCm/aomp :: test/smoke/stacked-block-size-config (stacked_block_size_config)

; 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 [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [16 x i8], align 1

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

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

13:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %22

14:                                               ; preds = %10
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds double, ptr %15, i64 %17
  store double 1.000000e+00, ptr %18, align 8, !tbaa !11
  br label %19

19:                                               ; preds = %14
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %4, align 4, !tbaa !9
  br label %10, !llvm.loop !13

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

23:                                               ; preds = %32, %22
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = icmp slt i32 %24, 1000000
  br i1 %25, label %27, label %26

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

27:                                               ; preds = %23
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds double, ptr %28, i64 %30
  store double 5.000000e+00, ptr %31, align 8, !tbaa !11
  br label %32

32:                                               ; preds = %27
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %5, align 4, !tbaa !9
  br label %23, !llvm.loop !15

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

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

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

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 double, ptr %41, i64 %43
  %45 = load double, ptr %44, align 8, !tbaa !11
  %46 = fadd double %45, 3.000000e+00
  store double %46, ptr %44, align 8, !tbaa !11
  br label %47

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

50:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %62, %50
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = icmp slt i32 %52, 1000000
  br i1 %53, label %55, label %54

54:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %65

55:                                               ; preds = %51
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds double, ptr %56, i64 %58
  %60 = load double, ptr %59, align 8, !tbaa !11
  %61 = fadd double %60, 3.000000e+00
  store double %61, ptr %59, align 8, !tbaa !11
  br label %62

62:                                               ; preds = %55
  %63 = load i32, ptr %7, align 4, !tbaa !9
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %7, align 4, !tbaa !9
  br label %51, !llvm.loop !17

65:                                               ; preds = %54
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds double, ptr %66, i64 3
  %68 = load double, ptr %67, align 8, !tbaa !11
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str, double noundef %68)
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds double, ptr %70, i64 500000
  %72 = load double, ptr %71, align 8, !tbaa !11
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %72)
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %74) #5
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %75) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  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: nounwind allocsize(0)
declare noalias ptr @malloc(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

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

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 = { nounwind 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 "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 #5 = { nounwind }
attributes #6 = { nounwind 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !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 [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
vector.ph:
  %0 = tail call noalias dereferenceable_or_null(120000) ptr @malloc(i64 noundef 120000) #4
  %1 = tail call noalias dereferenceable_or_null(8000000) ptr @malloc(i64 noundef 8000000) #4
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.5, %vector.body ]
  %2 = getelementptr inbounds double, ptr %0, i64 %index
  %3 = getelementptr inbounds i8, ptr %2, i64 16
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %2, align 8, !tbaa !5
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %3, align 8, !tbaa !5
  %index.next = or disjoint i64 %index, 4
  %4 = getelementptr inbounds double, ptr %0, i64 %index.next
  %5 = getelementptr inbounds i8, ptr %4, i64 16
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %4, align 8, !tbaa !5
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds double, ptr %0, i64 %index
  %7 = getelementptr inbounds i8, ptr %6, i64 64
  %8 = getelementptr inbounds i8, ptr %6, i64 80
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %7, align 8, !tbaa !5
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %8, align 8, !tbaa !5
  %9 = getelementptr inbounds double, ptr %0, i64 %index
  %10 = getelementptr inbounds i8, ptr %9, i64 96
  %11 = getelementptr inbounds i8, ptr %9, i64 112
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %10, align 8, !tbaa !5
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds double, ptr %0, i64 %index
  %13 = getelementptr inbounds i8, ptr %12, i64 128
  %14 = getelementptr inbounds i8, ptr %12, i64 144
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %13, align 8, !tbaa !5
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %14, align 8, !tbaa !5
  %15 = getelementptr inbounds double, ptr %0, i64 %index
  %16 = getelementptr inbounds i8, ptr %15, i64 160
  %17 = getelementptr inbounds i8, ptr %15, i64 176
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %16, align 8, !tbaa !5
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %17, align 8, !tbaa !5
  %index.next.5 = add nuw nsw i64 %index, 24
  %18 = icmp eq i64 %index.next.5, 15000
  br i1 %18, label %vector.body45, label %vector.body, !llvm.loop !9

vector.body45:                                    ; preds = %vector.body, %vector.body45
  %index46 = phi i64 [ %index.next47.4, %vector.body45 ], [ 0, %vector.body ]
  %19 = getelementptr inbounds double, ptr %1, i64 %index46
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  store <2 x double> <double 5.000000e+00, double 5.000000e+00>, ptr %19, align 8, !tbaa !5
  store <2 x double> <double 5.000000e+00, double 5.000000e+00>, ptr %20, align 8, !tbaa !5
  %21 = getelementptr inbounds double, ptr %1, i64 %index46
  %22 = getelementptr inbounds i8, ptr %21, i64 32
  %23 = getelementptr inbounds i8, ptr %21, i64 48
  store <2 x double> <double 5.000000e+00, double 5.000000e+00>, ptr %22, align 8, !tbaa !5
  store <2 x double> <double 5.000000e+00, double 5.000000e+00>, ptr %23, align 8, !tbaa !5
  %24 = getelementptr inbounds double, ptr %1, i64 %index46
  %25 = getelementptr inbounds i8, ptr %24, i64 64
  %26 = getelementptr inbounds i8, ptr %24, i64 80
  store <2 x double> <double 5.000000e+00, double 5.000000e+00>, ptr %25, align 8, !tbaa !5
  store <2 x double> <double 5.000000e+00, double 5.000000e+00>, ptr %26, align 8, !tbaa !5
  %27 = getelementptr inbounds double, ptr %1, i64 %index46
  %28 = getelementptr inbounds i8, ptr %27, i64 96
  %29 = getelementptr inbounds i8, ptr %27, i64 112
  store <2 x double> <double 5.000000e+00, double 5.000000e+00>, ptr %28, align 8, !tbaa !5
  store <2 x double> <double 5.000000e+00, double 5.000000e+00>, ptr %29, align 8, !tbaa !5
  %30 = getelementptr inbounds double, ptr %1, i64 %index46
  %31 = getelementptr inbounds i8, ptr %30, i64 128
  %32 = getelementptr inbounds i8, ptr %30, i64 144
  store <2 x double> <double 5.000000e+00, double 5.000000e+00>, ptr %31, align 8, !tbaa !5
  store <2 x double> <double 5.000000e+00, double 5.000000e+00>, ptr %32, align 8, !tbaa !5
  %index.next47.4 = add nuw nsw i64 %index46, 20
  %33 = icmp eq i64 %index.next47.4, 1000000
  br i1 %33, label %vector.body52, label %vector.body45, !llvm.loop !13

vector.body52:                                    ; preds = %vector.body45, %vector.body52
  %index53 = phi i64 [ %index.next55.2, %vector.body52 ], [ 0, %vector.body45 ]
  %34 = getelementptr inbounds double, ptr %0, i64 %index53
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  %wide.load = load <2 x double>, ptr %34, align 8, !tbaa !5
  %wide.load54 = load <2 x double>, ptr %35, align 8, !tbaa !5
  %36 = fadd <2 x double> %wide.load, <double 3.000000e+00, double 3.000000e+00>
  %37 = fadd <2 x double> %wide.load54, <double 3.000000e+00, double 3.000000e+00>
  store <2 x double> %36, ptr %34, align 8, !tbaa !5
  store <2 x double> %37, ptr %35, align 8, !tbaa !5
  %38 = getelementptr inbounds double, ptr %0, i64 %index53
  %39 = getelementptr inbounds i8, ptr %38, i64 32
  %40 = getelementptr inbounds i8, ptr %38, i64 48
  %wide.load.1 = load <2 x double>, ptr %39, align 8, !tbaa !5
  %wide.load54.1 = load <2 x double>, ptr %40, align 8, !tbaa !5
  %41 = fadd <2 x double> %wide.load.1, <double 3.000000e+00, double 3.000000e+00>
  %42 = fadd <2 x double> %wide.load54.1, <double 3.000000e+00, double 3.000000e+00>
  store <2 x double> %41, ptr %39, align 8, !tbaa !5
  store <2 x double> %42, ptr %40, align 8, !tbaa !5
  %43 = getelementptr inbounds double, ptr %0, i64 %index53
  %44 = getelementptr inbounds i8, ptr %43, i64 64
  %45 = getelementptr inbounds i8, ptr %43, i64 80
  %wide.load.2 = load <2 x double>, ptr %44, align 8, !tbaa !5
  %wide.load54.2 = load <2 x double>, ptr %45, align 8, !tbaa !5
  %46 = fadd <2 x double> %wide.load.2, <double 3.000000e+00, double 3.000000e+00>
  %47 = fadd <2 x double> %wide.load54.2, <double 3.000000e+00, double 3.000000e+00>
  store <2 x double> %46, ptr %44, align 8, !tbaa !5
  store <2 x double> %47, ptr %45, align 8, !tbaa !5
  %index.next55.2 = add nuw nsw i64 %index53, 12
  %48 = icmp eq i64 %index.next55.2, 15000
  br i1 %48, label %vector.body60, label %vector.body52, !llvm.loop !14

vector.body60:                                    ; preds = %vector.body52, %vector.body60
  %index61 = phi i64 [ %index.next64.1, %vector.body60 ], [ 0, %vector.body52 ]
  %49 = getelementptr inbounds double, ptr %1, i64 %index61
  %50 = getelementptr inbounds i8, ptr %49, i64 16
  %wide.load62 = load <2 x double>, ptr %49, align 8, !tbaa !5
  %wide.load63 = load <2 x double>, ptr %50, align 8, !tbaa !5
  %51 = fadd <2 x double> %wide.load62, <double 3.000000e+00, double 3.000000e+00>
  %52 = fadd <2 x double> %wide.load63, <double 3.000000e+00, double 3.000000e+00>
  store <2 x double> %51, ptr %49, align 8, !tbaa !5
  store <2 x double> %52, ptr %50, align 8, !tbaa !5
  %index.next64 = or disjoint i64 %index61, 4
  %53 = getelementptr inbounds double, ptr %1, i64 %index.next64
  %54 = getelementptr inbounds i8, ptr %53, i64 16
  %wide.load62.1 = load <2 x double>, ptr %53, align 8, !tbaa !5
  %wide.load63.1 = load <2 x double>, ptr %54, align 8, !tbaa !5
  %55 = fadd <2 x double> %wide.load62.1, <double 3.000000e+00, double 3.000000e+00>
  %56 = fadd <2 x double> %wide.load63.1, <double 3.000000e+00, double 3.000000e+00>
  store <2 x double> %55, ptr %53, align 8, !tbaa !5
  store <2 x double> %56, ptr %54, align 8, !tbaa !5
  %index.next64.1 = add nuw nsw i64 %index61, 8
  %57 = icmp eq i64 %index.next64.1, 1000000
  br i1 %57, label %middle.block56, label %vector.body60, !llvm.loop !15

middle.block56:                                   ; preds = %vector.body60
  %58 = getelementptr inbounds i8, ptr %0, i64 24
  %59 = load double, ptr %58, align 8, !tbaa !5
  %60 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %59)
  %61 = getelementptr inbounds i8, ptr %1, i64 4000000
  %62 = load double, ptr %61, align 8, !tbaa !5
  %63 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %62)
  tail call void @free(ptr noundef %0) #5
  tail call void @free(ptr noundef nonnull %1) #5
  ret i32 0
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 allocsize(0) }
attributes #5 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/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}
!15 = distinct !{!15, !10, !11, !12}


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