; LLVM IR from DionysiosB/CodeForces :: 1600-1699 (1695A-SubrectangleGuess)

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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %19

19:                                               ; preds = %80, %0
  %20 = load i64, ptr %2, align 8, !tbaa !5
  %21 = add nsw i64 %20, -1
  store i64 %21, ptr %2, align 8, !tbaa !5
  %22 = icmp ne i64 %20, 0
  br i1 %22, label %23, label %86

23:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %3, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store i64 -1000000007, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 -1, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i64 -1, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store i64 0, ptr %8, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %50, %23
  %26 = load i64, ptr %8, align 8, !tbaa !5
  %27 = load i64, ptr %3, align 8, !tbaa !5
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 4, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %53

30:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 0, ptr %10, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %46, %30
  %32 = load i64, ptr %10, align 8, !tbaa !5
  %33 = load i64, ptr %4, align 8, !tbaa !5
  %34 = icmp slt i64 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %49

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %11)
  %38 = load i64, ptr %5, align 8, !tbaa !5
  %39 = load i64, ptr %11, align 8, !tbaa !5
  %40 = icmp slt i64 %38, %39
  br i1 %40, label %41, label %45

41:                                               ; preds = %36
  %42 = load i64, ptr %11, align 8, !tbaa !5
  store i64 %42, ptr %5, align 8, !tbaa !5
  %43 = load i64, ptr %8, align 8, !tbaa !5
  store i64 %43, ptr %6, align 8, !tbaa !5
  %44 = load i64, ptr %10, align 8, !tbaa !5
  store i64 %44, ptr %7, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %41, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %46

46:                                               ; preds = %45
  %47 = load i64, ptr %10, align 8, !tbaa !5
  %48 = add nsw i64 %47, 1
  store i64 %48, ptr %10, align 8, !tbaa !5
  br label %31, !llvm.loop !9

49:                                               ; preds = %35
  br label %50

50:                                               ; preds = %49
  %51 = load i64, ptr %8, align 8, !tbaa !5
  %52 = add nsw i64 %51, 1
  store i64 %52, ptr %8, align 8, !tbaa !5
  br label %25, !llvm.loop !11

53:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %54 = load i64, ptr %6, align 8, !tbaa !5
  %55 = add nsw i64 %54, 1
  store i64 %55, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %56 = load i64, ptr %3, align 8, !tbaa !5
  %57 = load i64, ptr %6, align 8, !tbaa !5
  %58 = sub nsw i64 %56, %57
  store i64 %58, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %59 = load i64, ptr %12, align 8, !tbaa !5
  %60 = load i64, ptr %13, align 8, !tbaa !5
  %61 = icmp sgt i64 %59, %60
  br i1 %61, label %62, label %64

62:                                               ; preds = %53
  %63 = load i64, ptr %12, align 8, !tbaa !5
  br label %66

64:                                               ; preds = %53
  %65 = load i64, ptr %13, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %64, %62
  %67 = phi i64 [ %63, %62 ], [ %65, %64 ]
  store i64 %67, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %68 = load i64, ptr %7, align 8, !tbaa !5
  %69 = add nsw i64 %68, 1
  store i64 %69, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %70 = load i64, ptr %4, align 8, !tbaa !5
  %71 = load i64, ptr %7, align 8, !tbaa !5
  %72 = sub nsw i64 %70, %71
  store i64 %72, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %73 = load i64, ptr %15, align 8, !tbaa !5
  %74 = load i64, ptr %16, align 8, !tbaa !5
  %75 = icmp sgt i64 %73, %74
  br i1 %75, label %76, label %78

76:                                               ; preds = %66
  %77 = load i64, ptr %15, align 8, !tbaa !5
  br label %80

78:                                               ; preds = %66
  %79 = load i64, ptr %16, align 8, !tbaa !5
  br label %80

80:                                               ; preds = %78, %76
  %81 = phi i64 [ %77, %76 ], [ %79, %78 ]
  store i64 %81, ptr %17, align 8, !tbaa !5
  %82 = load i64, ptr %14, align 8, !tbaa !5
  %83 = load i64, ptr %17, align 8, !tbaa !5
  %84 = mul nsw i64 %82, %83
  %85 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %84)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %19, !llvm.loop !12

86:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  %87 = load i32, ptr %1, align 4
  ret i32 %87
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i32 @printf(ptr noundef, ...) #2

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


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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %6 = load i64, ptr %1, align 8, !tbaa !5
  %7 = add nsw i64 %6, -1
  store i64 %7, ptr %1, align 8, !tbaa !5
  %.not48 = icmp eq i64 %6, 0
  br i1 %.not48, label %._crit_edge51, label %.lr.ph50

.lr.ph50:                                         ; preds = %0, %._crit_edge42
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %9 = load i64, ptr %2, align 8, !tbaa !5
  %10 = icmp sgt i64 %9, 0
  %.pre54 = load i64, ptr %3, align 8, !tbaa !5
  %11 = icmp sgt i64 %.pre54, 0
  %or.cond = select i1 %10, i1 %11, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge42

.preheader:                                       ; preds = %.lr.ph50, %._crit_edge
  %12 = phi i64 [ %26, %._crit_edge ], [ %9, %.lr.ph50 ]
  %13 = phi i64 [ %27, %._crit_edge ], [ %.pre54, %.lr.ph50 ]
  %.041 = phi i64 [ %.1.lcssa, %._crit_edge ], [ -1000000007, %.lr.ph50 ]
  %.02240 = phi i64 [ %.123.lcssa, %._crit_edge ], [ -1, %.lr.ph50 ]
  %.02539 = phi i64 [ %.126.lcssa, %._crit_edge ], [ -1, %.lr.ph50 ]
  %.02838 = phi i64 [ %28, %._crit_edge ], [ 0, %.lr.ph50 ]
  %14 = icmp sgt i64 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

._crit_edge42:                                    ; preds = %._crit_edge, %.lr.ph50
  %15 = phi i64 [ %.pre54, %.lr.ph50 ], [ %27, %._crit_edge ]
  %.025.lcssa = phi i64 [ -1, %.lr.ph50 ], [ %.126.lcssa, %._crit_edge ]
  %.022.lcssa = phi i64 [ -1, %.lr.ph50 ], [ %.123.lcssa, %._crit_edge ]
  %.lcssa = phi i64 [ %9, %.lr.ph50 ], [ %26, %._crit_edge ]
  %16 = add nsw i64 %.022.lcssa, 1
  %17 = sub nsw i64 %.lcssa, %.022.lcssa
  %18 = call i64 @llvm.smax.i64(i64 %16, i64 %17)
  %19 = add nsw i64 %.025.lcssa, 1
  %20 = sub nsw i64 %15, %.025.lcssa
  %21 = call i64 @llvm.smax.i64(i64 %19, i64 %20)
  %22 = mul nsw i64 %21, %18
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %22)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  %24 = load i64, ptr %1, align 8, !tbaa !5
  %25 = add nsw i64 %24, -1
  store i64 %25, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %24, 0
  br i1 %.not, label %._crit_edge51, label %.lr.ph50, !llvm.loop !9

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i64, ptr %2, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %26 = phi i64 [ %12, %.preheader ], [ %.pre, %._crit_edge.loopexit ]
  %27 = phi i64 [ %13, %.preheader ], [ %34, %._crit_edge.loopexit ]
  %.126.lcssa = phi i64 [ %.02539, %.preheader ], [ %.227, %._crit_edge.loopexit ]
  %.123.lcssa = phi i64 [ %.02240, %.preheader ], [ %.224, %._crit_edge.loopexit ]
  %.1.lcssa = phi i64 [ %.041, %.preheader ], [ %.2, %._crit_edge.loopexit ]
  %28 = add nuw nsw i64 %.02838, 1
  %29 = icmp slt i64 %28, %26
  br i1 %29, label %.preheader, label %._crit_edge42, !llvm.loop !11

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.135 = phi i64 [ %.2, %.lr.ph ], [ %.041, %.preheader ]
  %.12334 = phi i64 [ %.224, %.lr.ph ], [ %.02240, %.preheader ]
  %.12633 = phi i64 [ %.227, %.lr.ph ], [ %.02539, %.preheader ]
  %.02932 = phi i64 [ %33, %.lr.ph ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %4)
  %31 = load i64, ptr %4, align 8, !tbaa !5
  %32 = icmp slt i64 %.135, %31
  %.227 = select i1 %32, i64 %.02932, i64 %.12633
  %.224 = select i1 %32, i64 %.02838, i64 %.12334
  %.2 = call i64 @llvm.smax.i64(i64 %.135, i64 %31)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  %33 = add nuw nsw i64 %.02932, 1
  %34 = load i64, ptr %3, align 8, !tbaa !5
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !13

._crit_edge51:                                    ; preds = %._crit_edge42, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3

attributes #0 = { mustprogress nofree norecurse 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}


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