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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [100 x i32], align 16
  %3 = alloca [100 x i32], align 16
  %4 = alloca i64, align 8
  %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 400, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 400, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store i64 0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %8

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

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

12:                                               ; preds = %8
  %13 = load i32, ptr %5, align 4, !tbaa !9
  %14 = add nsw i32 %13, 1
  %15 = load i32, ptr %5, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [100 x i32], ptr %2, i64 0, i64 %16
  store i32 %14, ptr %17, align 4, !tbaa !9
  br label %18

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

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

22:                                               ; preds = %39, %21
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = icmp slt i32 %23, 100
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %22
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100 x i32], ptr %2, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = load i64, ptr %4, align 8, !tbaa !5
  %33 = add nsw i64 %32, %31
  store i64 %33, ptr %4, align 8, !tbaa !5
  %34 = load i64, ptr %4, align 8, !tbaa !5
  %35 = trunc i64 %34 to i32
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 %37
  store i32 %35, ptr %38, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %26
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %6, align 4, !tbaa !9
  br label %22, !llvm.loop !13

42:                                               ; preds = %25
  %43 = load i64, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 0
  %45 = load i32, ptr %44, align 16, !tbaa !9
  %46 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 1
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 2
  %49 = load i32, ptr %48, align 8, !tbaa !9
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str, i64 noundef %43, i32 noundef %45, i32 noundef %47, i32 noundef %49)
  %51 = load i64, ptr %4, align 8, !tbaa !5
  %52 = icmp ne i64 %51, 5050
  br i1 %52, label %65, label %53

53:                                               ; preds = %42
  %54 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 0
  %55 = load i32, ptr %54, align 16, !tbaa !9
  %56 = icmp ne i32 %55, 1
  br i1 %56, label %65, label %57

57:                                               ; preds = %53
  %58 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 1
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = icmp ne i32 %59, 3
  br i1 %60, label %65, label %61

61:                                               ; preds = %57
  %62 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 2
  %63 = load i32, ptr %62, align 8, !tbaa !9
  %64 = icmp ne i32 %63, 6
  br i1 %64, label %65, label %67

65:                                               ; preds = %61, %57, %53, %42
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %69

67:                                               ; preds = %61
  %68 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %69

69:                                               ; preds = %67, %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 400, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 400, ptr %2) #3
  %70 = load i32, ptr %1, align 4
  ret i32 %70
}

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

; 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, ...) #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 = { 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 = { 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 = !{!"long long", !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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !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 [33 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local range(i32 0, 2) i32 @main() local_unnamed_addr #0 {
vector.ph:
  %0 = alloca [100 x i32], align 16
  %1 = alloca [100 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %0) #3
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %1) #3
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %0, align 16, !tbaa !5
  store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, ptr %2, align 16, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = getelementptr inbounds i8, ptr %0, i64 48
  store <4 x i32> <i32 9, i32 10, i32 11, i32 12>, ptr %3, align 16, !tbaa !5
  store <4 x i32> <i32 13, i32 14, i32 15, i32 16>, ptr %4, align 16, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 64
  %6 = getelementptr inbounds i8, ptr %0, i64 80
  store <4 x i32> <i32 17, i32 18, i32 19, i32 20>, ptr %5, align 16, !tbaa !5
  store <4 x i32> <i32 21, i32 22, i32 23, i32 24>, ptr %6, align 16, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 96
  %8 = getelementptr inbounds i8, ptr %0, i64 112
  store <4 x i32> <i32 25, i32 26, i32 27, i32 28>, ptr %7, align 16, !tbaa !5
  store <4 x i32> <i32 29, i32 30, i32 31, i32 32>, ptr %8, align 16, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 128
  %10 = getelementptr inbounds i8, ptr %0, i64 144
  store <4 x i32> <i32 33, i32 34, i32 35, i32 36>, ptr %9, align 16, !tbaa !5
  store <4 x i32> <i32 37, i32 38, i32 39, i32 40>, ptr %10, align 16, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 160
  %12 = getelementptr inbounds i8, ptr %0, i64 176
  store <4 x i32> <i32 41, i32 42, i32 43, i32 44>, ptr %11, align 16, !tbaa !5
  store <4 x i32> <i32 45, i32 46, i32 47, i32 48>, ptr %12, align 16, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 192
  %14 = getelementptr inbounds i8, ptr %0, i64 208
  store <4 x i32> <i32 49, i32 50, i32 51, i32 52>, ptr %13, align 16, !tbaa !5
  store <4 x i32> <i32 53, i32 54, i32 55, i32 56>, ptr %14, align 16, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 224
  %16 = getelementptr inbounds i8, ptr %0, i64 240
  store <4 x i32> <i32 57, i32 58, i32 59, i32 60>, ptr %15, align 16, !tbaa !5
  store <4 x i32> <i32 61, i32 62, i32 63, i32 64>, ptr %16, align 16, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 256
  %18 = getelementptr inbounds i8, ptr %0, i64 272
  store <4 x i32> <i32 65, i32 66, i32 67, i32 68>, ptr %17, align 16, !tbaa !5
  store <4 x i32> <i32 69, i32 70, i32 71, i32 72>, ptr %18, align 16, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %0, i64 288
  %20 = getelementptr inbounds i8, ptr %0, i64 304
  store <4 x i32> <i32 73, i32 74, i32 75, i32 76>, ptr %19, align 16, !tbaa !5
  store <4 x i32> <i32 77, i32 78, i32 79, i32 80>, ptr %20, align 16, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 320
  %22 = getelementptr inbounds i8, ptr %0, i64 336
  store <4 x i32> <i32 81, i32 82, i32 83, i32 84>, ptr %21, align 16, !tbaa !5
  store <4 x i32> <i32 85, i32 86, i32 87, i32 88>, ptr %22, align 16, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %0, i64 352
  %24 = getelementptr inbounds i8, ptr %0, i64 368
  store <4 x i32> <i32 89, i32 90, i32 91, i32 92>, ptr %23, align 16, !tbaa !5
  store <4 x i32> <i32 93, i32 94, i32 95, i32 96>, ptr %24, align 16, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %0, i64 384
  store i32 97, ptr %25, align 16, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %0, i64 388
  store i32 98, ptr %26, align 4, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %0, i64 392
  store i32 99, ptr %27, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %0, i64 396
  store i32 100, ptr %28, align 4, !tbaa !5
  br label %.preheader

29:                                               ; preds = %.preheader
  %30 = load i32, ptr %1, align 16
  %31 = getelementptr inbounds i8, ptr %1, i64 4
  %32 = load i32, ptr %31, align 4
  %33 = getelementptr inbounds i8, ptr %1, i64 8
  %34 = load i32, ptr %33, align 8
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %68, i32 noundef %30, i32 noundef %32, i32 noundef %34)
  %36 = icmp ne i64 %68, 5050
  %37 = icmp ne i32 %30, 1
  %or.cond = or i1 %36, %37
  %38 = icmp ne i32 %32, 3
  %or.cond5 = or i1 %or.cond, %38
  %39 = icmp ne i32 %34, 6
  %or.cond8 = or i1 %or.cond5, %39
  %.str.1..str.2 = select i1 %or.cond8, ptr @.str.1, ptr @.str.2
  %. = zext i1 %or.cond8 to i32
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %1) #3
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %0) #3
  ret i32 %.

.preheader:                                       ; preds = %.preheader, %vector.ph
  %indvars.iv28 = phi i64 [ 0, %vector.ph ], [ %indvars.iv.next29.4, %.preheader ]
  %.02225 = phi i64 [ 0, %vector.ph ], [ %68, %.preheader ]
  %41 = getelementptr inbounds [100 x i32], ptr %0, i64 0, i64 %indvars.iv28
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = add nsw i64 %.02225, %43
  %45 = trunc i64 %44 to i32
  %46 = getelementptr inbounds [100 x i32], ptr %1, i64 0, i64 %indvars.iv28
  store i32 %45, ptr %46, align 4, !tbaa !5
  %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
  %47 = getelementptr inbounds [100 x i32], ptr %0, i64 0, i64 %indvars.iv.next29
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = add nsw i64 %44, %49
  %51 = trunc i64 %50 to i32
  %52 = getelementptr inbounds [100 x i32], ptr %1, i64 0, i64 %indvars.iv.next29
  store i32 %51, ptr %52, align 4, !tbaa !5
  %indvars.iv.next29.1 = add nuw nsw i64 %indvars.iv28, 2
  %53 = getelementptr inbounds [100 x i32], ptr %0, i64 0, i64 %indvars.iv.next29.1
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = add nsw i64 %50, %55
  %57 = trunc i64 %56 to i32
  %58 = getelementptr inbounds [100 x i32], ptr %1, i64 0, i64 %indvars.iv.next29.1
  store i32 %57, ptr %58, align 4, !tbaa !5
  %indvars.iv.next29.2 = add nuw nsw i64 %indvars.iv28, 3
  %59 = getelementptr inbounds [100 x i32], ptr %0, i64 0, i64 %indvars.iv.next29.2
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = add nsw i64 %56, %61
  %63 = trunc i64 %62 to i32
  %64 = getelementptr inbounds [100 x i32], ptr %1, i64 0, i64 %indvars.iv.next29.2
  store i32 %63, ptr %64, align 4, !tbaa !5
  %indvars.iv.next29.3 = add nuw nsw i64 %indvars.iv28, 4
  %65 = getelementptr inbounds [100 x i32], ptr %0, i64 0, i64 %indvars.iv.next29.3
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = add nsw i64 %62, %67
  %69 = trunc i64 %68 to i32
  %70 = getelementptr inbounds [100 x i32], ptr %1, i64 0, i64 %indvars.iv.next29.3
  store i32 %69, ptr %70, align 4, !tbaa !5
  %indvars.iv.next29.4 = add nuw nsw i64 %indvars.iv28, 5
  %exitcond31.not.4 = icmp eq i64 %indvars.iv.next29.4, 100
  br i1 %exitcond31.not.4, label %29, label %.preheader, !llvm.loop !9
}

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

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

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

attributes #0 = { nofree 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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"}


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