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

; 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 [27 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @c_print_results(ptr noundef %0, i8 noundef signext %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, double noundef %6, double noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef %10, ptr noundef %11, ptr noundef %12, ptr noundef %13, ptr noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %17) #0 {
  %19 = alloca ptr, align 8
  %20 = alloca i8, align 1
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca double, align 8
  %26 = alloca double, align 8
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca ptr, align 8
  %32 = alloca ptr, align 8
  %33 = alloca ptr, align 8
  %34 = alloca ptr, align 8
  %35 = alloca ptr, align 8
  %36 = alloca ptr, align 8
  %37 = alloca i64, align 8
  store ptr %0, ptr %19, align 8, !tbaa !5
  store i8 %1, ptr %20, align 1, !tbaa !9
  store i32 %2, ptr %21, align 4, !tbaa !10
  store i32 %3, ptr %22, align 4, !tbaa !10
  store i32 %4, ptr %23, align 4, !tbaa !10
  store i32 %5, ptr %24, align 4, !tbaa !10
  store double %6, ptr %25, align 8, !tbaa !12
  store double %7, ptr %26, align 8, !tbaa !12
  store ptr %8, ptr %27, align 8, !tbaa !5
  store i32 %9, ptr %28, align 4, !tbaa !10
  store ptr %10, ptr %29, align 8, !tbaa !5
  store ptr %11, ptr %30, align 8, !tbaa !5
  store ptr %12, ptr %31, align 8, !tbaa !5
  store ptr %13, ptr %32, align 8, !tbaa !5
  store ptr %14, ptr %33, align 8, !tbaa !5
  store ptr %15, ptr %34, align 8, !tbaa !5
  store ptr %16, ptr %35, align 8, !tbaa !5
  store ptr %17, ptr %36, align 8, !tbaa !5
  %38 = load ptr, ptr %19, align 8, !tbaa !5
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %38)
  %40 = load i8, ptr %20, align 1, !tbaa !9
  %41 = sext i8 %40 to i32
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %41)
  %43 = load i32, ptr %23, align 4, !tbaa !10
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %45, label %58

45:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #3
  %46 = load i32, ptr %21, align 4, !tbaa !10
  %47 = sext i32 %46 to i64
  store i64 %47, ptr %37, align 8, !tbaa !14
  %48 = load i32, ptr %22, align 4, !tbaa !10
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %55

50:                                               ; preds = %45
  %51 = load i32, ptr %22, align 4, !tbaa !10
  %52 = sext i32 %51 to i64
  %53 = load i64, ptr %37, align 8, !tbaa !14
  %54 = mul nsw i64 %53, %52
  store i64 %54, ptr %37, align 8, !tbaa !14
  br label %55

55:                                               ; preds = %50, %45
  %56 = load i64, ptr %37, align 8, !tbaa !14
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %56)
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #3
  br label %63

58:                                               ; preds = %18
  %59 = load i32, ptr %21, align 4, !tbaa !10
  %60 = load i32, ptr %22, align 4, !tbaa !10
  %61 = load i32, ptr %23, align 4, !tbaa !10
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %59, i32 noundef %60, i32 noundef %61)
  br label %63

63:                                               ; preds = %58, %55
  %64 = load i32, ptr %24, align 4, !tbaa !10
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %64)
  %66 = load double, ptr %25, align 8, !tbaa !12
  %67 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, double noundef %66)
  %68 = load double, ptr %26, align 8, !tbaa !12
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, double noundef %68)
  %70 = load ptr, ptr %27, align 8, !tbaa !5
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, ptr noundef %70)
  %72 = load i32, ptr %28, align 4, !tbaa !10
  %73 = icmp slt i32 %72, 0
  br i1 %73, label %74, label %76

74:                                               ; preds = %63
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  br label %84

76:                                               ; preds = %63
  %77 = load i32, ptr %28, align 4, !tbaa !10
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %81

79:                                               ; preds = %76
  %80 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %83

81:                                               ; preds = %76
  %82 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  br label %83

83:                                               ; preds = %81, %79
  br label %84

84:                                               ; preds = %83, %74
  %85 = load ptr, ptr %29, align 8, !tbaa !5
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, ptr noundef %85)
  %87 = load ptr, ptr %30, align 8, !tbaa !5
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, ptr noundef %87)
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  %90 = load ptr, ptr %31, align 8, !tbaa !5
  %91 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, ptr noundef %90)
  %92 = load ptr, ptr %32, align 8, !tbaa !5
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, ptr noundef %92)
  %94 = load ptr, ptr %33, align 8, !tbaa !5
  %95 = call i32 (ptr, ...) @printf(ptr noundef @.str.16, ptr noundef %94)
  %96 = load ptr, ptr %34, align 8, !tbaa !5
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, ptr noundef %96)
  %98 = load ptr, ptr %35, align 8, !tbaa !5
  %99 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, ptr noundef %98)
  %100 = load ptr, ptr %36, align 8, !tbaa !5
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, ptr noundef %100)
  %102 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  %103 = call i32 (ptr, ...) @printf(ptr noundef @.str.21)
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.22)
  %105 = call i32 (ptr, ...) @printf(ptr noundef @.str.23)
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !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 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local void @c_print_results(ptr noundef %0, i8 noundef signext %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, double noundef %6, double noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef %10, ptr noundef %11, ptr noundef %12, ptr noundef %13, ptr noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %17) local_unnamed_addr #0 {
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %0)
  %20 = sext i8 %1 to i32
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %20)
  %22 = icmp eq i32 %4, 0
  br i1 %22, label %23, label %27

23:                                               ; preds = %18
  %24 = sext i32 %2 to i64
  %narrow = tail call i32 @llvm.umax.i32(i32 %3, i32 1)
  %25 = sext i32 %narrow to i64
  %.0 = mul nsw i64 %25, %24
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.0)
  br label %29

27:                                               ; preds = %18
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %2, i32 noundef %3, i32 noundef %4)
  br label %29

29:                                               ; preds = %27, %23
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %5)
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, double noundef %6)
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, double noundef %7)
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, ptr noundef %8)
  %34 = icmp slt i32 %9, 0
  %.not27 = icmp eq i32 %9, 0
  %.str.10..str.9 = select i1 %.not27, ptr @.str.10, ptr @.str.9
  %.str.9.sink = select i1 %34, ptr @.str.8, ptr %.str.10..str.9
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.9.sink)
  %36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, ptr noundef %10)
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef %11)
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, ptr noundef %12)
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef %13)
  %41 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16, ptr noundef %14)
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, ptr noundef %15)
  %43 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, ptr noundef %16)
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, ptr noundef %17)
  %45 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  %46 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21)
  %47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22)
  %48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.23)
  ret void
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #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 = { 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 nosync nounwind speculatable willreturn memory(none) }

!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: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass