; LLVM IR from DionysiosB/CodeForces :: 0100-0199 (127B-CanvasFrames)

; 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 [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [101 x i32], align 16
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 100, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 404, ptr %4) #4
  call void @llvm.memset.p0.i64(ptr align 16 %4, i8 0, i64 404, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %22, %0
  %11 = load i32, ptr %7, align 4, !tbaa !5
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %25

15:                                               ; preds = %10
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5)
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [101 x i32], ptr %4, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %19, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %15
  %23 = load i32, ptr %7, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %7, align 4, !tbaa !5
  br label %10, !llvm.loop !9

25:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %38, %25
  %27 = load i32, ptr %8, align 4, !tbaa !5
  %28 = icmp sle i32 %27, 100
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %26
  %31 = load i32, ptr %8, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [101 x i32], ptr %4, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sdiv i32 %34, 2
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = add nsw i32 %36, %35
  store i32 %37, ptr %6, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %30
  %39 = load i32, ptr %8, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %8, align 4, !tbaa !5
  br label %26, !llvm.loop !11

41:                                               ; preds = %29
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = sdiv i32 %42, 2
  store i32 %43, ptr %6, align 4, !tbaa !5
  %44 = load i32, ptr %6, align 4, !tbaa !5
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %44)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 404, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  ret i32 0
}

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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, ...) #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !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}


; 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 [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca [101 x i32], align 16
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %2) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %2, i8 0, i64 404, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.0810 = phi i32 [ %13, %.lr.ph ], [ 0, %0 ]
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  %8 = load i32, ptr %3, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [101 x i32], ptr %2, i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr %10, align 4, !tbaa !5
  %13 = add nuw nsw i32 %.0810, 1
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %.lr.ph, label %.loopexit, !llvm.loop !9

.loopexit:                                        ; preds = %.lr.ph, %0
  %16 = getelementptr inbounds i8, ptr %2, i64 368
  %wide.load15.11 = load <4 x i32>, ptr %16, align 16, !tbaa !5
  %17 = sdiv <4 x i32> %wide.load15.11, <i32 2, i32 2, i32 2, i32 2>
  %18 = getelementptr inbounds i8, ptr %2, i64 336
  %wide.load15.10 = load <4 x i32>, ptr %18, align 16, !tbaa !5
  %19 = sdiv <4 x i32> %wide.load15.10, <i32 2, i32 2, i32 2, i32 2>
  %20 = getelementptr inbounds i8, ptr %2, i64 304
  %wide.load15.9 = load <4 x i32>, ptr %20, align 16, !tbaa !5
  %21 = sdiv <4 x i32> %wide.load15.9, <i32 2, i32 2, i32 2, i32 2>
  %22 = getelementptr inbounds i8, ptr %2, i64 272
  %wide.load15.8 = load <4 x i32>, ptr %22, align 16, !tbaa !5
  %23 = sdiv <4 x i32> %wide.load15.8, <i32 2, i32 2, i32 2, i32 2>
  %24 = getelementptr inbounds i8, ptr %2, i64 240
  %wide.load15.7 = load <4 x i32>, ptr %24, align 16, !tbaa !5
  %25 = sdiv <4 x i32> %wide.load15.7, <i32 2, i32 2, i32 2, i32 2>
  %26 = getelementptr inbounds i8, ptr %2, i64 208
  %wide.load15.6 = load <4 x i32>, ptr %26, align 16, !tbaa !5
  %27 = sdiv <4 x i32> %wide.load15.6, <i32 2, i32 2, i32 2, i32 2>
  %28 = getelementptr inbounds i8, ptr %2, i64 176
  %wide.load15.5 = load <4 x i32>, ptr %28, align 16, !tbaa !5
  %29 = sdiv <4 x i32> %wide.load15.5, <i32 2, i32 2, i32 2, i32 2>
  %30 = getelementptr inbounds i8, ptr %2, i64 144
  %wide.load15.4 = load <4 x i32>, ptr %30, align 16, !tbaa !5
  %31 = sdiv <4 x i32> %wide.load15.4, <i32 2, i32 2, i32 2, i32 2>
  %32 = getelementptr inbounds i8, ptr %2, i64 112
  %wide.load15.3 = load <4 x i32>, ptr %32, align 16, !tbaa !5
  %33 = sdiv <4 x i32> %wide.load15.3, <i32 2, i32 2, i32 2, i32 2>
  %34 = getelementptr inbounds i8, ptr %2, i64 80
  %wide.load15.2 = load <4 x i32>, ptr %34, align 16, !tbaa !5
  %35 = sdiv <4 x i32> %wide.load15.2, <i32 2, i32 2, i32 2, i32 2>
  %36 = getelementptr inbounds i8, ptr %2, i64 48
  %wide.load15.1 = load <4 x i32>, ptr %36, align 16, !tbaa !5
  %37 = sdiv <4 x i32> %wide.load15.1, <i32 2, i32 2, i32 2, i32 2>
  %38 = getelementptr inbounds i8, ptr %2, i64 16
  %wide.load15 = load <4 x i32>, ptr %38, align 16, !tbaa !5
  %39 = sdiv <4 x i32> %wide.load15, <i32 2, i32 2, i32 2, i32 2>
  %40 = add nsw <4 x i32> %37, %39
  %41 = add <4 x i32> %35, %40
  %42 = add <4 x i32> %33, %41
  %43 = add <4 x i32> %31, %42
  %44 = add <4 x i32> %29, %43
  %45 = add <4 x i32> %27, %44
  %46 = add <4 x i32> %25, %45
  %47 = add <4 x i32> %23, %46
  %48 = add <4 x i32> %21, %47
  %49 = add <4 x i32> %19, %48
  %50 = add <4 x i32> %17, %49
  %51 = getelementptr inbounds i8, ptr %2, i64 352
  %wide.load.11 = load <4 x i32>, ptr %51, align 16, !tbaa !5
  %52 = sdiv <4 x i32> %wide.load.11, <i32 2, i32 2, i32 2, i32 2>
  %53 = getelementptr inbounds i8, ptr %2, i64 320
  %wide.load.10 = load <4 x i32>, ptr %53, align 16, !tbaa !5
  %54 = sdiv <4 x i32> %wide.load.10, <i32 2, i32 2, i32 2, i32 2>
  %55 = getelementptr inbounds i8, ptr %2, i64 288
  %wide.load.9 = load <4 x i32>, ptr %55, align 16, !tbaa !5
  %56 = sdiv <4 x i32> %wide.load.9, <i32 2, i32 2, i32 2, i32 2>
  %57 = getelementptr inbounds i8, ptr %2, i64 256
  %wide.load.8 = load <4 x i32>, ptr %57, align 16, !tbaa !5
  %58 = sdiv <4 x i32> %wide.load.8, <i32 2, i32 2, i32 2, i32 2>
  %59 = getelementptr inbounds i8, ptr %2, i64 224
  %wide.load.7 = load <4 x i32>, ptr %59, align 16, !tbaa !5
  %60 = sdiv <4 x i32> %wide.load.7, <i32 2, i32 2, i32 2, i32 2>
  %61 = getelementptr inbounds i8, ptr %2, i64 192
  %wide.load.6 = load <4 x i32>, ptr %61, align 16, !tbaa !5
  %62 = sdiv <4 x i32> %wide.load.6, <i32 2, i32 2, i32 2, i32 2>
  %63 = getelementptr inbounds i8, ptr %2, i64 160
  %wide.load.5 = load <4 x i32>, ptr %63, align 16, !tbaa !5
  %64 = sdiv <4 x i32> %wide.load.5, <i32 2, i32 2, i32 2, i32 2>
  %65 = getelementptr inbounds i8, ptr %2, i64 128
  %wide.load.4 = load <4 x i32>, ptr %65, align 16, !tbaa !5
  %66 = sdiv <4 x i32> %wide.load.4, <i32 2, i32 2, i32 2, i32 2>
  %67 = getelementptr inbounds i8, ptr %2, i64 96
  %wide.load.3 = load <4 x i32>, ptr %67, align 16, !tbaa !5
  %68 = sdiv <4 x i32> %wide.load.3, <i32 2, i32 2, i32 2, i32 2>
  %69 = getelementptr inbounds i8, ptr %2, i64 64
  %wide.load.2 = load <4 x i32>, ptr %69, align 16, !tbaa !5
  %70 = sdiv <4 x i32> %wide.load.2, <i32 2, i32 2, i32 2, i32 2>
  %71 = getelementptr inbounds i8, ptr %2, i64 32
  %wide.load.1 = load <4 x i32>, ptr %71, align 16, !tbaa !5
  %72 = sdiv <4 x i32> %wide.load.1, <i32 2, i32 2, i32 2, i32 2>
  %wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5
  %73 = sdiv <4 x i32> %wide.load, <i32 2, i32 2, i32 2, i32 2>
  %74 = add nsw <4 x i32> %72, %73
  %75 = add <4 x i32> %70, %74
  %76 = add <4 x i32> %68, %75
  %77 = add <4 x i32> %66, %76
  %78 = add <4 x i32> %64, %77
  %79 = add <4 x i32> %62, %78
  %80 = add <4 x i32> %60, %79
  %81 = add <4 x i32> %58, %80
  %82 = add <4 x i32> %56, %81
  %83 = add <4 x i32> %54, %82
  %84 = add <4 x i32> %52, %83
  %bin.rdx = add <4 x i32> %50, %84
  %85 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %86 = getelementptr inbounds i8, ptr %2, i64 384
  %87 = load i32, ptr %86, align 16, !tbaa !5
  %88 = sdiv i32 %87, 2
  %89 = add nsw i32 %88, %85
  %90 = getelementptr inbounds i8, ptr %2, i64 388
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sdiv i32 %91, 2
  %93 = add nsw i32 %92, %89
  %94 = getelementptr inbounds i8, ptr %2, i64 392
  %95 = load i32, ptr %94, align 8, !tbaa !5
  %96 = sdiv i32 %95, 2
  %97 = add nsw i32 %96, %93
  %98 = getelementptr inbounds i8, ptr %2, i64 396
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sdiv i32 %99, 2
  %101 = add nsw i32 %100, %97
  %102 = getelementptr inbounds i8, ptr %2, i64 400
  %103 = load i32, ptr %102, align 16, !tbaa !5
  %104 = sdiv i32 %103, 2
  %105 = add nsw i32 %104, %101
  %106 = sdiv i32 %105, 2
  %107 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %106)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass