; LLVM IR from upupming/algorithm :: AdvancedLevel_C++/1091. Acute Stroke (30) .ll (Z5judgeiii)

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

@m = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@l = external dso_local global i32, align 4
@arr = external dso_local global [1300 x [130 x [80 x i32]]], align 16
@visit = external dso_local global [1300 x [130 x [80 x i8]]], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z5judgeiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) #0 {
  %4 = alloca i1, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !5
  %8 = load i32, ptr %5, align 4, !tbaa !5
  %9 = icmp slt i32 %8, 0
  br i1 %9, label %28, label %10

10:                                               ; preds = %3
  %11 = load i32, ptr %5, align 4, !tbaa !5
  %12 = load i32, ptr @m, align 4, !tbaa !5
  %13 = icmp sge i32 %11, %12
  br i1 %13, label %28, label %14

14:                                               ; preds = %10
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 0
  br i1 %16, label %28, label %17

17:                                               ; preds = %14
  %18 = load i32, ptr %6, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp sge i32 %18, %19
  br i1 %20, label %28, label %21

21:                                               ; preds = %17
  %22 = load i32, ptr %7, align 4, !tbaa !5
  %23 = icmp slt i32 %22, 0
  br i1 %23, label %28, label %24

24:                                               ; preds = %21
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = load i32, ptr @l, align 4, !tbaa !5
  %27 = icmp sge i32 %25, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %24, %21, %17, %14, %10, %3
  store i1 false, ptr %4, align 1
  br label %57

29:                                               ; preds = %24
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1300 x [130 x [80 x i32]]], ptr @arr, i64 0, i64 %31
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [130 x [80 x i32]], ptr %32, i64 0, i64 %34
  %36 = load i32, ptr %7, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [80 x i32], ptr %35, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %55, label %41

41:                                               ; preds = %29
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1300 x [130 x [80 x i8]]], ptr @visit, i64 0, i64 %43
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [130 x [80 x i8]], ptr %44, i64 0, i64 %46
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [80 x i8], ptr %47, i64 0, i64 %49
  %51 = load i8, ptr %50, align 1, !tbaa !9, !range !11, !noundef !12
  %52 = trunc i8 %51 to i1
  %53 = zext i1 %52 to i32
  %54 = icmp eq i32 %53, 1
  br i1 %54, label %55, label %56

55:                                               ; preds = %41, %29
  store i1 false, ptr %4, align 1
  br label %57

56:                                               ; preds = %41
  store i1 true, ptr %4, align 1
  br label %57

57:                                               ; preds = %56, %55, %28
  %58 = load i1, ptr %4, align 1
  ret i1 %58
}

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

!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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


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

@m = external dso_local local_unnamed_addr global i32, align 4
@n = external dso_local local_unnamed_addr global i32, align 4
@l = external dso_local local_unnamed_addr global i32, align 4
@arr = external dso_local local_unnamed_addr global [1300 x [130 x [80 x i32]]], align 16
@visit = external dso_local local_unnamed_addr global [1300 x [130 x [80 x i8]]], align 16

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local noundef zeroext i1 @_Z5judgeiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = icmp slt i32 %0, 0
  br i1 %4, label %25, label %5

5:                                                ; preds = %3
  %6 = load i32, ptr @m, align 4, !tbaa !5
  %7 = icmp sle i32 %6, %0
  %8 = icmp slt i32 %1, 0
  %or.cond = or i1 %8, %7
  br i1 %or.cond, label %25, label %9

9:                                                ; preds = %5
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, %1
  %12 = icmp sgt i32 %2, -1
  %or.cond3.not21 = and i1 %12, %11
  %13 = load i32, ptr @l, align 4
  %.not = icmp sgt i32 %13, %2
  %or.cond18 = select i1 %or.cond3.not21, i1 %.not, i1 false
  br i1 %or.cond18, label %14, label %25

14:                                               ; preds = %9
  %15 = zext nneg i32 %0 to i64
  %16 = zext nneg i32 %1 to i64
  %17 = zext nneg i32 %2 to i64
  %18 = getelementptr inbounds [1300 x [130 x [80 x i32]]], ptr @arr, i64 0, i64 %15, i64 %16, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %25, label %21

21:                                               ; preds = %14
  %22 = getelementptr inbounds [1300 x [130 x [80 x i8]]], ptr @visit, i64 0, i64 %15, i64 %16, i64 %17
  %23 = load i8, ptr %22, align 1, !tbaa !9, !range !11, !noundef !12
  %24 = trunc nuw i8 %23 to i1
  %not. = xor i1 %24, true
  br label %25

25:                                               ; preds = %21, %14, %3, %5, %9
  %.0 = phi i1 [ false, %9 ], [ false, %5 ], [ false, %3 ], [ false, %14 ], [ %not., %21 ]
  ret i1 %.0
}

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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


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