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

; 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 hidden global [10 x i32], align 16
@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 -1, ptr @colstat, align 16, !tbaa !5
  store i32 1111, ptr getelementptr inbounds ([10 x i32], ptr @colstat, i64 0, i64 1), align 4, !tbaa !5
  store i32 2222, ptr getelementptr inbounds ([10 x i32], ptr @colstat, i64 0, i64 2), align 8, !tbaa !5
  %2 = load ptr, ptr @stderr, align 8, !tbaa !9
  %3 = load i32, ptr @colstat, align 16, !tbaa !5
  %4 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @colstat, i64 0, i64 1), align 4, !tbaa !5
  %5 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @colstat, i64 0, i64 2), align 8, !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 16, !tbaa !5
  %9 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @colstat, i64 0, i64 1), align 4, !tbaa !5
  %10 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @colstat, i64 0, i64 2), align 8, !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 getelementptr inbounds ([10 x i32], ptr @colstat, i64 0, i64 1), align 4, !tbaa !5
  %13 = icmp eq i32 %12, 1111
  br i1 %13, label %14, label %19

14:                                               ; preds = %0
  %15 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @colstat, i64 0, i64 2), align 8, !tbaa !5
  %16 = icmp eq i32 %15, 2222
  br i1 %16, label %17, label %19

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

19:                                               ; preds = %14, %0
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %21

21:                                               ; preds = %19, %17
  %22 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @colstat, i64 0, i64 1), align 4, !tbaa !5
  %23 = icmp eq i32 %22, 1111
  br i1 %23, label %24, label %27

24:                                               ; preds = %21
  %25 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @colstat, i64 0, i64 2), align 8, !tbaa !5
  %26 = icmp eq i32 %25, 2222
  br label %27

27:                                               ; preds = %24, %21
  %28 = phi i1 [ false, %21 ], [ %26, %24 ]
  %29 = zext i1 %28 to i64
  %30 = select i1 %28, i32 0, i32 1
  ret i32 %30
}

; 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 hidden local_unnamed_addr global [10 x i32], align 16
@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 -1, ptr @colstat, align 16, !tbaa !5
  store i32 1111, ptr getelementptr inbounds (i8, ptr @colstat, i64 4), align 4, !tbaa !5
  store i32 2222, ptr getelementptr inbounds (i8, ptr @colstat, i64 8), align 8, !tbaa !5
  %1 = load ptr, ptr @stderr, align 8, !tbaa !9
  %2 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %1, ptr noundef nonnull @.str, i32 noundef -1, i32 noundef 1111, i32 noundef 2222) #2
  %3 = load ptr, ptr @stderr, align 8, !tbaa !9
  %4 = load i32, ptr @colstat, align 16, !tbaa !5
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 4), align 4, !tbaa !5
  %6 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 8), align 8, !tbaa !5
  %7 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.1, i32 noundef %4, i32 noundef %5, i32 noundef %6) #2
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 4), align 4, !tbaa !5
  %9 = icmp eq i32 %8, 1111
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 8), align 8
  %11 = icmp eq i32 %10, 2222
  %or.cond = select i1 %9, i1 %11, i1 false
  %.str.2..str.3 = select i1 %or.cond, ptr @.str.2, ptr @.str.3
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3)
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 4), align 4, !tbaa !5
  %14 = icmp ne i32 %13, 1111
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @colstat, i64 8), align 8
  %16 = icmp ne i32 %15, 2222
  %.not3 = select i1 %14, i1 true, i1 %16
  %17 = zext i1 %.not3 to i32
  ret i32 %17
}

; 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