; LLVM IR from DionysiosB/CodeForces :: 0200-0299 (232A-Cycles)

; 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 [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [1 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 [107 x [107 x i64]], align 16
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  store i64 107, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 91592, ptr %3) #4
  call void @llvm.memset.p0.i64(ptr align 16 %3, i8 0, i64 91592, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %53, %0
  %13 = load i64, ptr %6, align 8, !tbaa !5
  %14 = icmp slt i64 %13, 107
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  store i32 2, ptr %7, align 4
  br label %56

16:                                               ; preds = %12
  %17 = load i64, ptr %4, align 8, !tbaa !5
  %18 = icmp sle i64 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %16
  store i32 2, ptr %7, align 4
  br label %56

20:                                               ; preds = %16
  %21 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %21, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %48, %20
  %23 = load i64, ptr %8, align 8, !tbaa !5
  %24 = load i64, ptr %6, align 8, !tbaa !5
  %25 = icmp slt i64 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 5, ptr %7, align 4
  br label %51

27:                                               ; preds = %22
  %28 = load i64, ptr %4, align 8, !tbaa !5
  %29 = load i64, ptr %8, align 8, !tbaa !5
  %30 = icmp slt i64 %28, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  store i32 5, ptr %7, align 4
  br label %51

32:                                               ; preds = %27
  %33 = load i64, ptr %8, align 8, !tbaa !5
  %34 = getelementptr inbounds [107 x [107 x i64]], ptr %3, i64 0, i64 %33
  %35 = load i64, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds [107 x i64], ptr %34, i64 0, i64 %35
  store i64 1, ptr %36, align 8, !tbaa !5
  %37 = load i64, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds [107 x [107 x i64]], ptr %3, i64 0, i64 %37
  %39 = load i64, ptr %8, align 8, !tbaa !5
  %40 = getelementptr inbounds [107 x i64], ptr %38, i64 0, i64 %39
  store i64 1, ptr %40, align 8, !tbaa !5
  %41 = load i64, ptr %8, align 8, !tbaa !5
  %42 = load i64, ptr %4, align 8, !tbaa !5
  %43 = sub nsw i64 %42, %41
  store i64 %43, ptr %4, align 8, !tbaa !5
  %44 = load i64, ptr %4, align 8, !tbaa !5
  %45 = icmp sle i64 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %32
  store i32 5, ptr %7, align 4
  br label %51

47:                                               ; preds = %32
  br label %48

48:                                               ; preds = %47
  %49 = load i64, ptr %8, align 8, !tbaa !5
  %50 = add nsw i64 %49, 1
  store i64 %50, ptr %8, align 8, !tbaa !5
  br label %22, !llvm.loop !9

51:                                               ; preds = %46, %31, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  %54 = load i64, ptr %6, align 8, !tbaa !5
  %55 = add nsw i64 %54, 1
  store i64 %55, ptr %6, align 8, !tbaa !5
  br label %12, !llvm.loop !11

56:                                               ; preds = %19, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %57

57:                                               ; preds = %56
  %58 = load i64, ptr %5, align 8, !tbaa !5
  %59 = add nsw i64 %58, 1
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %59)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 0, ptr %9, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %84, %57
  %62 = load i64, ptr %9, align 8, !tbaa !5
  %63 = load i64, ptr %5, align 8, !tbaa !5
  %64 = icmp sle i64 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %87

66:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store i64 0, ptr %10, align 8, !tbaa !5
  br label %67

67:                                               ; preds = %79, %66
  %68 = load i64, ptr %10, align 8, !tbaa !5
  %69 = load i64, ptr %5, align 8, !tbaa !5
  %70 = icmp sle i64 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %82

72:                                               ; preds = %67
  %73 = load i64, ptr %9, align 8, !tbaa !5
  %74 = getelementptr inbounds [107 x [107 x i64]], ptr %3, i64 0, i64 %73
  %75 = load i64, ptr %10, align 8, !tbaa !5
  %76 = getelementptr inbounds [107 x i64], ptr %74, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !5
  %78 = call i32 (ptr, ...) @printf(ptr noundef @.str, i64 noundef %77)
  br label %79

79:                                               ; preds = %72
  %80 = load i64, ptr %10, align 8, !tbaa !5
  %81 = add nsw i64 %80, 1
  store i64 %81, ptr %10, align 8, !tbaa !5
  br label %67, !llvm.loop !12

82:                                               ; preds = %71
  %83 = call i32 @puts(ptr noundef @.str.2)
  br label %84

84:                                               ; preds = %82
  %85 = load i64, ptr %9, align 8, !tbaa !5
  %86 = add nsw i64 %85, 1
  store i64 %86, ptr %9, align 8, !tbaa !5
  br label %61, !llvm.loop !13

87:                                               ; preds = %65
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 91592, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  %88 = load i32, ptr %1, align 4
  ret i32 %88
}

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; 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, ...) #3

declare i32 @puts(ptr noundef) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "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 #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 = distinct !{!12, !10}
!13 = distinct !{!13, !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 [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [107 x [107 x i64]], align 16
  %2 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 91592, ptr nonnull %1) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(91592) %1, i8 0, i64 91592, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %.promoted35 = load i64, ptr %2, align 8
  %4 = icmp slt i64 %.promoted35, 1
  br i1 %4, label %._crit_edge40, label %.preheader30

.preheader30:                                     ; preds = %0, %15
  %.02439 = phi i64 [ %16, %15 ], [ 0, %0 ]
  %.lcssa343738 = phi i64 [ %.lcssa3436, %15 ], [ %.promoted35, %0 ]
  %5 = icmp eq i64 %.02439, 0
  br i1 %5, label %15, label %.lr.ph

6:                                                ; preds = %.lr.ph
  %7 = add nuw nsw i64 %.02332, 1
  %8 = icmp uge i64 %7, %.02439
  %9 = icmp sle i64 %13, %.02332
  %or.cond29 = or i1 %8, %9
  br i1 %or.cond29, label %._crit_edge33, label %.lr.ph, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader30, %6
  %.02332 = phi i64 [ %7, %6 ], [ 0, %.preheader30 ]
  %10 = phi i64 [ %13, %6 ], [ %.lcssa343738, %.preheader30 ]
  %11 = getelementptr inbounds [107 x [107 x i64]], ptr %1, i64 0, i64 %.02332, i64 %.02439
  store i64 1, ptr %11, align 8, !tbaa !7
  %12 = getelementptr inbounds [107 x [107 x i64]], ptr %1, i64 0, i64 %.02439, i64 %.02332
  store i64 1, ptr %12, align 8, !tbaa !7
  %13 = sub nsw i64 %10, %.02332
  %14 = icmp slt i64 %13, 1
  br i1 %14, label %.thread, label %6

.thread:                                          ; preds = %.lr.ph
  store i64 %13, ptr %2, align 8, !tbaa !7
  br label %._crit_edge40.loopexit

._crit_edge33:                                    ; preds = %6
  store i64 %13, ptr %2, align 8, !tbaa !7
  br label %15

15:                                               ; preds = %._crit_edge33, %.preheader30
  %.lcssa3436 = phi i64 [ %13, %._crit_edge33 ], [ %.lcssa343738, %.preheader30 ]
  %16 = add nuw nsw i64 %.02439, 1
  %17 = icmp ugt i64 %.02439, 105
  %18 = icmp slt i64 %.lcssa3436, 1
  %or.cond = select i1 %17, i1 true, i1 %18
  br i1 %or.cond, label %._crit_edge40.loopexit, label %.preheader30, !llvm.loop !11

._crit_edge40.loopexit:                           ; preds = %15, %.thread
  %19 = add nuw nsw i64 %.02439, 1
  br label %._crit_edge40

._crit_edge40:                                    ; preds = %0, %._crit_edge40.loopexit
  %.025.lcssa = phi i64 [ %19, %._crit_edge40.loopexit ], [ 1, %0 ]
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.025.lcssa)
  br label %.preheader

.preheader:                                       ; preds = %._crit_edge40, %22
  %.02242 = phi i64 [ 0, %._crit_edge40 ], [ %24, %22 ]
  br label %25

21:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 91592, ptr nonnull %1) #4
  ret i32 0

22:                                               ; preds = %25
  %23 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  %24 = add nuw nsw i64 %.02242, 1
  %exitcond44.not = icmp eq i64 %24, %.025.lcssa
  br i1 %exitcond44.not, label %21, label %.preheader, !llvm.loop !12

25:                                               ; preds = %.preheader, %25
  %.041 = phi i64 [ 0, %.preheader ], [ %29, %25 ]
  %26 = getelementptr inbounds [107 x [107 x i64]], ptr %1, i64 0, i64 %.02242, i64 %.041
  %27 = load i64, ptr %26, align 8, !tbaa !7
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %27)
  %29 = add nuw nsw i64 %.041, 1
  %exitcond.not = icmp eq i64 %29, %.025.lcssa
  br i1 %exitcond.not, label %22, label %25, !llvm.loop !13
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; 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 #3

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}


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