; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/World Cup 2016/World Cup/Problem E/E.ll (Z6atedgeii)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z7inrangeii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z6atedgeii(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  store i32 0, ptr %5, align 4, !tbaa !5
  %6 = load i32, ptr %3, align 4, !tbaa !5
  %7 = sub nsw i32 %6, 1
  %8 = load i32, ptr %4, align 4, !tbaa !5
  %9 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %7, i32 noundef %8)
  br i1 %9, label %10, label %13

10:                                               ; preds = %2
  %11 = load i32, ptr %5, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr %5, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %10, %2
  %14 = load i32, ptr %3, align 4, !tbaa !5
  %15 = sub nsw i32 %14, 1
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = add nsw i32 %16, 1
  %18 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %15, i32 noundef %17)
  br i1 %18, label %19, label %22

19:                                               ; preds = %13
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %5, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %19, %13
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = sub nsw i32 %23, 1
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = sub nsw i32 %25, 1
  %27 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %24, i32 noundef %26)
  br i1 %27, label %28, label %31

28:                                               ; preds = %22
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %5, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %28, %22
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %33, i32 noundef %34)
  br i1 %35, label %36, label %39

36:                                               ; preds = %31
  %37 = load i32, ptr %5, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %5, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %36, %31
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  %44 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %41, i32 noundef %43)
  br i1 %44, label %45, label %48

45:                                               ; preds = %39
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %5, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %45, %39
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sub nsw i32 %51, 1
  %53 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %50, i32 noundef %52)
  br i1 %53, label %54, label %57

54:                                               ; preds = %48
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %5, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %54, %48
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = sub nsw i32 %59, 1
  %61 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %58, i32 noundef %60)
  br i1 %61, label %62, label %65

62:                                               ; preds = %57
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %5, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %62, %57
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  %69 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %66, i32 noundef %68)
  br i1 %69, label %70, label %73

70:                                               ; preds = %65
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %5, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %70, %65
  %74 = load i32, ptr %5, align 4, !tbaa !5
  %75 = icmp sge i32 %74, 5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret i1 %75
}

; 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

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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"}


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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z7inrangeii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z6atedgeii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = add nsw i32 %0, -1
  %4 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %3, i32 noundef %1)
  %spec.select = zext i1 %4 to i32
  %5 = add nsw i32 %1, 1
  %6 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %3, i32 noundef %5)
  %7 = select i1 %4, i32 2, i32 1
  %.1 = select i1 %6, i32 %7, i32 %spec.select
  %8 = add nsw i32 %1, -1
  %9 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %3, i32 noundef %8)
  %10 = zext i1 %9 to i32
  %.2 = add nuw nsw i32 %.1, %10
  %11 = add nsw i32 %0, 1
  %12 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %11, i32 noundef %1)
  %13 = zext i1 %12 to i32
  %.3 = add nuw nsw i32 %.2, %13
  %14 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %11, i32 noundef %5)
  %15 = zext i1 %14 to i32
  %.4 = add nuw nsw i32 %.3, %15
  %16 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %11, i32 noundef %8)
  %17 = zext i1 %16 to i32
  %.5 = add nuw nsw i32 %.4, %17
  %18 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %0, i32 noundef %8)
  %19 = zext i1 %18 to i32
  %.6 = add nuw nsw i32 %.5, %19
  %20 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %0, i32 noundef %5)
  %21 = zext i1 %20 to i32
  %.7 = add nuw nsw i32 %.6, %21
  %22 = icmp ugt i32 %.7, 4
  ret i1 %22
}

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)"}


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