; LLVM IR from ROCm/aomp :: test/smoke-fails/flang-314750/NPB_FT/sys (setparams)

; 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.47 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.78 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind uwtable
define dso_local void @write_mg_info(ptr noundef %0, i8 noundef signext %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i8 %1, ptr %4, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %13 = load i8, ptr %4, align 1, !tbaa !9
  %14 = sext i8 %13 to i32
  %15 = icmp eq i32 %14, 83
  br i1 %15, label %16, label %17

16:                                               ; preds = %2
  store i32 32, ptr %5, align 4, !tbaa !10
  store i32 4, ptr %6, align 4, !tbaa !10
  br label %63

17:                                               ; preds = %2
  %18 = load i8, ptr %4, align 1, !tbaa !9
  %19 = sext i8 %18 to i32
  %20 = icmp eq i32 %19, 87
  br i1 %20, label %21, label %22

21:                                               ; preds = %17
  store i32 128, ptr %5, align 4, !tbaa !10
  store i32 4, ptr %6, align 4, !tbaa !10
  br label %62

22:                                               ; preds = %17
  %23 = load i8, ptr %4, align 1, !tbaa !9
  %24 = sext i8 %23 to i32
  %25 = icmp eq i32 %24, 65
  br i1 %25, label %26, label %27

26:                                               ; preds = %22
  store i32 256, ptr %5, align 4, !tbaa !10
  store i32 4, ptr %6, align 4, !tbaa !10
  br label %61

27:                                               ; preds = %22
  %28 = load i8, ptr %4, align 1, !tbaa !9
  %29 = sext i8 %28 to i32
  %30 = icmp eq i32 %29, 66
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  store i32 256, ptr %5, align 4, !tbaa !10
  store i32 20, ptr %6, align 4, !tbaa !10
  br label %60

32:                                               ; preds = %27
  %33 = load i8, ptr %4, align 1, !tbaa !9
  %34 = sext i8 %33 to i32
  %35 = icmp eq i32 %34, 67
  br i1 %35, label %36, label %37

36:                                               ; preds = %32
  store i32 512, ptr %5, align 4, !tbaa !10
  store i32 20, ptr %6, align 4, !tbaa !10
  br label %59

37:                                               ; preds = %32
  %38 = load i8, ptr %4, align 1, !tbaa !9
  %39 = sext i8 %38 to i32
  %40 = icmp eq i32 %39, 68
  br i1 %40, label %41, label %42

41:                                               ; preds = %37
  store i32 1024, ptr %5, align 4, !tbaa !10
  store i32 50, ptr %6, align 4, !tbaa !10
  br label %58

42:                                               ; preds = %37
  %43 = load i8, ptr %4, align 1, !tbaa !9
  %44 = sext i8 %43 to i32
  %45 = icmp eq i32 %44, 69
  br i1 %45, label %46, label %47

46:                                               ; preds = %42
  store i32 2048, ptr %5, align 4, !tbaa !10
  store i32 50, ptr %6, align 4, !tbaa !10
  br label %57

47:                                               ; preds = %42
  %48 = load i8, ptr %4, align 1, !tbaa !9
  %49 = sext i8 %48 to i32
  %50 = icmp eq i32 %49, 70
  br i1 %50, label %51, label %52

51:                                               ; preds = %47
  store i32 4096, ptr %5, align 4, !tbaa !10
  store i32 50, ptr %6, align 4, !tbaa !10
  br label %56

52:                                               ; preds = %47
  %53 = load i8, ptr %4, align 1, !tbaa !9
  %54 = sext i8 %53 to i32
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.69, i32 noundef %54)
  call void @exit(i32 noundef 1) #6
  unreachable

56:                                               ; preds = %51
  br label %57

57:                                               ; preds = %56, %46
  br label %58

58:                                               ; preds = %57, %41
  br label %59

59:                                               ; preds = %58, %36
  br label %60

60:                                               ; preds = %59, %31
  br label %61

61:                                               ; preds = %60, %26
  br label %62

62:                                               ; preds = %61, %21
  br label %63

63:                                               ; preds = %62, %16
  %64 = load i32, ptr %5, align 4, !tbaa !10
  %65 = call i32 @ilog2(i32 noundef %64)
  store i32 %65, ptr %7, align 4, !tbaa !10
  %66 = load i32, ptr %7, align 4, !tbaa !10
  store i32 %66, ptr %8, align 4, !tbaa !10
  %67 = load i32, ptr %7, align 4, !tbaa !10
  store i32 %67, ptr %9, align 4, !tbaa !10
  %68 = load i32, ptr %9, align 4, !tbaa !10
  store i32 %68, ptr %10, align 4, !tbaa !10
  %69 = load i32, ptr %7, align 4, !tbaa !10
  store i32 %69, ptr %12, align 4, !tbaa !10
  %70 = load i32, ptr %7, align 4, !tbaa !10
  store i32 %70, ptr %11, align 4, !tbaa !10
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef @.str.70, ptr noundef @.str.47) #5
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = load i32, ptr %5, align 4, !tbaa !10
  %75 = load i32, ptr %5, align 4, !tbaa !10
  %76 = load i32, ptr %5, align 4, !tbaa !10
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef @.str.71, ptr noundef @.str.47, i32 noundef %74, i32 noundef %75, i32 noundef %76) #5
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef @.str.72, ptr noundef @.str.47) #5
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = load i32, ptr %6, align 4, !tbaa !10
  %82 = load i32, ptr %9, align 4, !tbaa !10
  %83 = load i32, ptr %8, align 4, !tbaa !10
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef @.str.73, ptr noundef @.str.47, i32 noundef %81, i32 noundef %82, i32 noundef %83) #5
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef @.str.74, ptr noundef @.str.47) #5
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %87, ptr noundef @.str.75, ptr noundef @.str.47, i32 noundef 0) #5
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef @.str.76, ptr noundef @.str.47) #5
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = load i32, ptr %10, align 4, !tbaa !10
  %93 = load i32, ptr %11, align 4, !tbaa !10
  %94 = load i32, ptr %12, align 4, !tbaa !10
  %95 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef @.str.77, ptr noundef @.str.47, i32 noundef %92, i32 noundef %93, i32 noundef %94) #5
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef @.str.78, ptr noundef @.str.47) #5
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = load i32, ptr %5, align 4, !tbaa !10
  %100 = icmp sgt i32 %99, 1024
  %101 = zext i1 %100 to i64
  %102 = select i1 %100, ptr @.str.80, ptr @.str.81
  %103 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef @.str.79, ptr noundef @.str.47, ptr noundef %102) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @ilog2(i32 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { noreturn 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 "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 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 #5 = { nounwind }
attributes #6 = { noreturn 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}


; 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.47 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.78 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @write_mg_info(ptr nocapture noundef %0, i8 noundef signext %1) local_unnamed_addr #2 {
  switch i8 %1, label %10 [
    i8 83, label %13
    i8 87, label %3
    i8 65, label %4
    i8 66, label %5
    i8 67, label %6
    i8 68, label %7
    i8 69, label %8
    i8 70, label %9
  ]

3:                                                ; preds = %2
  br label %13

4:                                                ; preds = %2
  br label %13

5:                                                ; preds = %2
  br label %13

6:                                                ; preds = %2
  br label %13

7:                                                ; preds = %2
  br label %13

8:                                                ; preds = %2
  br label %13

9:                                                ; preds = %2
  br label %13

10:                                               ; preds = %2
  %11 = sext i8 %1 to i32
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.69, i32 noundef %11)
  tail call void @exit(i32 noundef 1) #3
  unreachable

13:                                               ; preds = %2, %3, %5, %7, %9, %8, %6, %4
  %.034 = phi i32 [ 4, %3 ], [ 4, %4 ], [ 20, %5 ], [ 20, %6 ], [ 50, %7 ], [ 50, %8 ], [ 50, %9 ], [ 4, %2 ]
  %14 = phi ptr [ @.str.81, %3 ], [ @.str.81, %4 ], [ @.str.81, %5 ], [ @.str.81, %6 ], [ @.str.81, %7 ], [ @.str.80, %8 ], [ @.str.80, %9 ], [ @.str.81, %2 ]
  %.0 = phi i32 [ 128, %3 ], [ 256, %4 ], [ 256, %5 ], [ 512, %6 ], [ 1024, %7 ], [ 2048, %8 ], [ 4096, %9 ], [ 32, %2 ]
  %15 = tail call i32 @ilog2(i32 noundef %.0)
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.70, ptr noundef nonnull @.str.47) #4
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.71, ptr noundef nonnull @.str.47, i32 noundef %.0, i32 noundef %.0, i32 noundef %.0) #4
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.72, ptr noundef nonnull @.str.47) #4
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.73, ptr noundef nonnull @.str.47, i32 noundef %.034, i32 noundef %15, i32 noundef %15) #4
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.74, ptr noundef nonnull @.str.47) #4
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.75, ptr noundef nonnull @.str.47, i32 noundef 0) #4
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.76, ptr noundef nonnull @.str.47) #4
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.77, ptr noundef nonnull @.str.47, i32 noundef %15, i32 noundef %15, i32 noundef %15) #4
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.78, ptr noundef nonnull @.str.47) #4
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.79, ptr noundef nonnull @.str.47, ptr noundef nonnull %14) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @ilog2(i32 noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { noreturn 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 = { 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 #3 = { noreturn nounwind }
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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass