; LLVM IR from ROCm/aomp :: test/smoke-fails/target-map-from-fail-class (map-from-into-const-global-class)

; 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"

%class.Val_t = type { double }
%class.Val_c = type { double, double }

@_ZL1A = external hidden global [128 x %class.Val_t], align 16
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %class.Val_t, align 8
  %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 %class.Val_c, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  %15 = getelementptr inbounds %class.Val_t, ptr %6, i32 0, i32 0
  store double 1.000000e+00, ptr %15, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %24, %2
  %17 = load i32, ptr %9, align 4, !tbaa !5
  %18 = icmp slt i32 %17, 128
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %27

20:                                               ; preds = %16
  %21 = load i32, ptr %7, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %7, align 4, !tbaa !5
  %23 = getelementptr inbounds %class.Val_t, ptr %6, i32 0, i32 0
  store double 4.200000e+01, ptr %23, align 8, !tbaa !11
  br label %24

24:                                               ; preds = %20
  %25 = load i32, ptr %9, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %9, align 4, !tbaa !5
  br label %16, !llvm.loop !14

27:                                               ; preds = %19
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = sub nsw i32 128, %28
  store i32 %29, ptr %8, align 4, !tbaa !5
  %30 = load i32, ptr %8, align 4, !tbaa !5
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %27
  %33 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %33, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %139

34:                                               ; preds = %27
  %35 = getelementptr inbounds %class.Val_t, ptr %6, i32 0, i32 0
  %36 = load double, ptr %35, align 8, !tbaa !11
  %37 = fsub double 4.200000e+01, %36
  %38 = fptosi double %37 to i32
  store i32 %38, ptr %8, align 4, !tbaa !5
  %39 = load i32, ptr %8, align 4, !tbaa !5
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %43

41:                                               ; preds = %34
  %42 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %42, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %139

43:                                               ; preds = %34
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %60, %43
  %45 = load i32, ptr %11, align 4, !tbaa !5
  %46 = icmp slt i32 %45, 128
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %63

48:                                               ; preds = %44
  %49 = load i32, ptr %11, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [128 x %class.Val_t], ptr @_ZL1A, i64 0, i64 %50
  %52 = getelementptr inbounds %class.Val_t, ptr %51, i32 0, i32 0
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = fadd double %53, 1.000000e+00
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = sitofp i32 %55 to double
  %57 = fadd double %56, %54
  %58 = fptosi double %57 to i32
  store i32 %58, ptr %7, align 4, !tbaa !5
  %59 = getelementptr inbounds %class.Val_t, ptr %6, i32 0, i32 0
  store double 2.100000e+01, ptr %59, align 8, !tbaa !11
  br label %60

60:                                               ; preds = %48
  %61 = load i32, ptr %11, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %11, align 4, !tbaa !5
  br label %44, !llvm.loop !16

63:                                               ; preds = %47
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = sub nsw i32 128, %64
  store i32 %65, ptr %8, align 4, !tbaa !5
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %70

68:                                               ; preds = %63
  %69 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %69, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %139

70:                                               ; preds = %63
  %71 = getelementptr inbounds %class.Val_t, ptr %6, i32 0, i32 0
  %72 = load double, ptr %71, align 8, !tbaa !11
  %73 = fsub double 4.200000e+01, %72
  %74 = fptosi double %73 to i32
  store i32 %74, ptr %8, align 4, !tbaa !5
  %75 = load i32, ptr %8, align 4, !tbaa !5
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %79

77:                                               ; preds = %70
  %78 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %78, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %139

79:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #4
  call void @_ZN5Val_cC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12)
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %88, %79
  %81 = load i32, ptr %13, align 4, !tbaa !5
  %82 = icmp slt i32 %81, 128
  br i1 %82, label %84, label %83

83:                                               ; preds = %80
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %91

84:                                               ; preds = %80
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %7, align 4, !tbaa !5
  %87 = getelementptr inbounds %class.Val_c, ptr %12, i32 0, i32 0
  store double 4.200000e+01, ptr %87, align 8, !tbaa !17
  br label %88

88:                                               ; preds = %84
  %89 = load i32, ptr %13, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %13, align 4, !tbaa !5
  br label %80, !llvm.loop !19

91:                                               ; preds = %83
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = sub nsw i32 128, %92
  store i32 %93, ptr %8, align 4, !tbaa !5
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %98

96:                                               ; preds = %91
  %97 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %97, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %138

98:                                               ; preds = %91
  %99 = getelementptr inbounds %class.Val_c, ptr %12, i32 0, i32 0
  %100 = load double, ptr %99, align 8, !tbaa !17
  %101 = fsub double 4.200000e+01, %100
  %102 = fptosi double %101 to i32
  store i32 %102, ptr %8, align 4, !tbaa !5
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %105, label %107

105:                                              ; preds = %98
  %106 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %106, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %138

107:                                              ; preds = %98
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %116, %107
  %109 = load i32, ptr %14, align 4, !tbaa !5
  %110 = icmp slt i32 %109, 128
  br i1 %110, label %112, label %111

111:                                              ; preds = %108
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %119

112:                                              ; preds = %108
  %113 = load i32, ptr %7, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %7, align 4, !tbaa !5
  %115 = getelementptr inbounds %class.Val_c, ptr %12, i32 0, i32 0
  store double 2.100000e+01, ptr %115, align 8, !tbaa !17
  br label %116

116:                                              ; preds = %112
  %117 = load i32, ptr %14, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %14, align 4, !tbaa !5
  br label %108, !llvm.loop !20

119:                                              ; preds = %111
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = sub nsw i32 128, %120
  store i32 %121, ptr %8, align 4, !tbaa !5
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %126

124:                                              ; preds = %119
  %125 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %125, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %138

126:                                              ; preds = %119
  %127 = getelementptr inbounds %class.Val_c, ptr %12, i32 0, i32 0
  %128 = load double, ptr %127, align 8, !tbaa !17
  %129 = fsub double 4.200000e+01, %128
  %130 = fptosi double %129 to i32
  store i32 %130, ptr %8, align 4, !tbaa !5
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %135

133:                                              ; preds = %126
  %134 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %134, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %138

135:                                              ; preds = %126
  %136 = load ptr, ptr @stderr, align 8, !tbaa !9
  %137 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %136, ptr noundef @.str) #4
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %138

138:                                              ; preds = %135, %133, %124, %105, %96
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #4
  br label %139

139:                                              ; preds = %138, %77, %68, %41, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %140 = load i32, ptr %3, align 4
  ret i32 %140
}

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5Val_cC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

attributes #0 = { mustprogress norecurse 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 = { mustprogress 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 = { 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 }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS5Val_t", !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !13, i64 0}
!18 = !{!"_ZTS5Val_c", !13, i64 0, !13, i64 8}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}


; 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"

%class.Val_t = type { double }

@_ZL1A = external hidden local_unnamed_addr global [128 x %class.Val_t], align 16

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
.preheader56.preheader:
  br label %.preheader56

2:                                                ; preds = %.preheader56
  %.not50 = icmp eq i32 %27, 128
  %3 = sub nsw i32 128, %27
  %spec.select = select i1 %.not50, i32 21, i32 %3
  ret i32 %spec.select

.preheader56:                                     ; preds = %.preheader56, %.preheader56.preheader
  %indvars.iv = phi i64 [ 0, %.preheader56.preheader ], [ %indvars.iv.next.3, %.preheader56 ]
  %.159 = phi i32 [ 0, %.preheader56.preheader ], [ %27, %.preheader56 ]
  %4 = getelementptr inbounds [128 x %class.Val_t], ptr @_ZL1A, i64 0, i64 %indvars.iv
  %5 = load double, ptr %4, align 16, !tbaa !5
  %6 = fadd double %5, 1.000000e+00
  %7 = sitofp i32 %.159 to double
  %8 = fadd double %6, %7
  %9 = fptosi double %8 to i32
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %10 = getelementptr inbounds [128 x %class.Val_t], ptr @_ZL1A, i64 0, i64 %indvars.iv.next
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = fadd double %11, 1.000000e+00
  %13 = sitofp i32 %9 to double
  %14 = fadd double %12, %13
  %15 = fptosi double %14 to i32
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %16 = getelementptr inbounds [128 x %class.Val_t], ptr @_ZL1A, i64 0, i64 %indvars.iv.next.1
  %17 = load double, ptr %16, align 16, !tbaa !5
  %18 = fadd double %17, 1.000000e+00
  %19 = sitofp i32 %15 to double
  %20 = fadd double %18, %19
  %21 = fptosi double %20 to i32
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %22 = getelementptr inbounds [128 x %class.Val_t], ptr @_ZL1A, i64 0, i64 %indvars.iv.next.2
  %23 = load double, ptr %22, align 8, !tbaa !5
  %24 = fadd double %23, 1.000000e+00
  %25 = sitofp i32 %21 to double
  %26 = fadd double %24, %25
  %27 = fptosi double %26 to i32
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 128
  br i1 %exitcond.not.3, label %2, label %.preheader56, !llvm.loop !10
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) 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" }

!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, !7, i64 0}
!6 = !{!"_ZTS5Val_t", !7, i64 0}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass