; LLVM IR from ROCm/aomp :: test/smoke/extern_init (extern_init)

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

@colstat = external dso_local global [3 x i32], align 4
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [32 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1111, ptr getelementptr inbounds ([3 x i32], ptr @colstat, i64 0, i64 1), align 4, !tbaa !5
  %2 = load ptr, ptr @stderr, align 8, !tbaa !9
  %3 = load i32, ptr @colstat, align 4, !tbaa !5
  %4 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @colstat, i64 0, i64 1), align 4, !tbaa !5
  %5 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @colstat, i64 0, i64 2), align 4, !tbaa !5
  %6 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %2, ptr noundef @.str, i32 noundef %3, i32 noundef %4, i32 noundef %5) #3
  %7 = load ptr, ptr @stderr, align 8, !tbaa !9
  %8 = load i32, ptr @colstat, align 4, !tbaa !5
  %9 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @colstat, i64 0, i64 1), align 4, !tbaa !5
  %10 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @colstat, i64 0, i64 2), align 4, !tbaa !5
  %11 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef @.str.1, i32 noundef %8, i32 noundef %9, i32 noundef %10) #3
  %12 = load i32, ptr @colstat, align 4, !tbaa !5
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %14, label %22

14:                                               ; preds = %0
  %15 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @colstat, i64 0, i64 1), align 4, !tbaa !5
  %16 = icmp eq i32 %15, 1111
  br i1 %16, label %17, label %22

17:                                               ; preds = %14
  %18 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @colstat, i64 0, i64 2), align 4, !tbaa !5
  %19 = icmp eq i32 %18, 3
  br i1 %19, label %20, label %22

20:                                               ; preds = %17
  %21 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %24

22:                                               ; preds = %17, %14, %0
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %24

24:                                               ; preds = %22, %20
  %25 = load i32, ptr @colstat, align 4, !tbaa !5
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %27, label %33

27:                                               ; preds = %24
  %28 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @colstat, i64 0, i64 1), align 4, !tbaa !5
  %29 = icmp eq i32 %28, 1111
  br i1 %29, label %30, label %33

30:                                               ; preds = %27
  %31 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @colstat, i64 0, i64 2), align 4, !tbaa !5
  %32 = icmp eq i32 %31, 3
  br label %33

33:                                               ; preds = %30, %27, %24
  %34 = phi i1 [ false, %27 ], [ false, %24 ], [ %32, %30 ]
  %35 = zext i1 %34 to i64
  %36 = select i1 %34, i32 0, i32 1
  ret i32 %36
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #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 = { 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 = { "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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

@colstat = external dso_local local_unnamed_addr global [3 x i32], align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [32 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local range(i32 0, 2) i32 @main() local_unnamed_addr #0 {
  store i32 1111, ptr getelementptr inbounds (i8, ptr @colstat, i64 4), align 4, !tbaa !5
  %1 = load ptr, ptr @stderr, align 8, !tbaa !9
  %2 = load i32, ptr @colstat, align 4, !tbaa !5
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 8), align 4, !tbaa !5
  %4 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %1, ptr noundef nonnull @.str, i32 noundef %2, i32 noundef 1111, i32 noundef %3) #2
  %5 = load ptr, ptr @stderr, align 8, !tbaa !9
  %6 = load i32, ptr @colstat, align 4, !tbaa !5
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 4), align 4, !tbaa !5
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 8), align 4, !tbaa !5
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str.1, i32 noundef %6, i32 noundef %7, i32 noundef %8) #2
  %10 = load i32, ptr @colstat, align 4, !tbaa !5
  %11 = icmp eq i32 %10, 1
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 4), align 4
  %13 = icmp eq i32 %12, 1111
  %or.cond = select i1 %11, i1 %13, i1 false
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 8), align 4
  %15 = icmp eq i32 %14, 3
  %or.cond3 = select i1 %or.cond, i1 %15, i1 false
  %.str.2..str.3 = select i1 %or.cond3, ptr @.str.2, ptr @.str.3
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3)
  %17 = load i32, ptr @colstat, align 4, !tbaa !5
  %18 = icmp ne i32 %17, 1
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 4), align 4
  %20 = icmp ne i32 %19, 1111
  %or.cond5.not = select i1 %18, i1 true, i1 %20
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 8), align 4
  %22 = icmp ne i32 %21, 3
  %narrow = select i1 %or.cond5.not, i1 true, i1 %22
  %not. = zext i1 %narrow to i32
  ret i32 %not.
}

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

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

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 = { cold 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


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