; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/4 Beta/Problem B (B)

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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@d = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@t = external dso_local global [30 x [2 x i32]], align 16
@s1 = external dso_local global i32, align 4
@s2 = external dso_local global i32, align 4
@res = external dso_local global [30 x i32], align 16
@s3 = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 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 i32, align 4
  %5 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @d, ptr noundef @s)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %36, %0
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = load i32, ptr @d, align 4, !tbaa !5
  %10 = icmp slt i32 %8, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %39

12:                                               ; preds = %7
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %14
  %16 = getelementptr inbounds [2 x i32], ptr %15, i64 0, i64 0
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %18
  %20 = getelementptr inbounds [2 x i32], ptr %19, i64 0, i64 1
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %16, ptr noundef %20)
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %23
  %25 = getelementptr inbounds [2 x i32], ptr %24, i64 0, i64 0
  %26 = load i32, ptr %25, align 8, !tbaa !5
  %27 = load i32, ptr @s1, align 4, !tbaa !5
  %28 = add nsw i32 %27, %26
  store i32 %28, ptr @s1, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %30
  %32 = getelementptr inbounds [2 x i32], ptr %31, i64 0, i64 1
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = load i32, ptr @s2, align 4, !tbaa !5
  %35 = add nsw i32 %34, %33
  store i32 %35, ptr @s2, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %12
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %2, align 4, !tbaa !5
  br label %7, !llvm.loop !9

39:                                               ; preds = %11
  %40 = load i32, ptr @s1, align 4, !tbaa !5
  %41 = load i32, ptr @s, align 4, !tbaa !5
  %42 = icmp sgt i32 %40, %41
  br i1 %42, label %47, label %43

43:                                               ; preds = %39
  %44 = load i32, ptr @s2, align 4, !tbaa !5
  %45 = load i32, ptr @s, align 4, !tbaa !5
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %47, label %49

47:                                               ; preds = %43, %39
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  store i32 0, ptr %1, align 4
  br label %139

49:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %63, %49
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = load i32, ptr @d, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %66

55:                                               ; preds = %50
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %57
  %59 = getelementptr inbounds [2 x i32], ptr %58, i64 0, i64 0
  %60 = load i32, ptr %59, align 8, !tbaa !5
  %61 = load i32, ptr @s3, align 4, !tbaa !5
  %62 = add nsw i32 %61, %60
  store i32 %62, ptr @s3, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %55
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %3, align 4, !tbaa !5
  br label %50, !llvm.loop !11

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

67:                                               ; preds = %103, %66
  %68 = load i32, ptr @s3, align 4, !tbaa !5
  %69 = load i32, ptr @s, align 4, !tbaa !5
  %70 = icmp ne i32 %68, %69
  br i1 %70, label %71, label %104

71:                                               ; preds = %67
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %73
  %75 = getelementptr inbounds [2 x i32], ptr %74, i64 0, i64 0
  %76 = load i32, ptr %75, align 8, !tbaa !5
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %78
  %80 = getelementptr inbounds [2 x i32], ptr %79, i64 0, i64 1
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = icmp slt i32 %76, %81
  br i1 %82, label %83, label %92

83:                                               ; preds = %71
  %84 = load i32, ptr @s3, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr @s3, align 4, !tbaa !5
  %86 = load i32, ptr %4, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %87
  %89 = getelementptr inbounds [2 x i32], ptr %88, i64 0, i64 0
  %90 = load i32, ptr %89, align 8, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %89, align 8, !tbaa !5
  br label %103

92:                                               ; preds = %71
  %93 = load i32, ptr %4, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %94
  %96 = getelementptr inbounds [2 x i32], ptr %95, i64 0, i64 0
  %97 = load i32, ptr %96, align 8, !tbaa !5
  %98 = load i32, ptr %4, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [30 x i32], ptr @res, i64 0, i64 %99
  store i32 %97, ptr %100, align 4, !tbaa !5
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %4, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %92, %83
  br label %67, !llvm.loop !12

104:                                              ; preds = %67
  br label %105

105:                                              ; preds = %109, %104
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = load i32, ptr @d, align 4, !tbaa !5
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %109, label %120

109:                                              ; preds = %105
  %110 = load i32, ptr %4, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %111
  %113 = getelementptr inbounds [2 x i32], ptr %112, i64 0, i64 0
  %114 = load i32, ptr %113, align 8, !tbaa !5
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [30 x i32], ptr @res, i64 0, i64 %116
  store i32 %114, ptr %117, align 4, !tbaa !5
  %118 = load i32, ptr %4, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %4, align 4, !tbaa !5
  br label %105, !llvm.loop !13

120:                                              ; preds = %105
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %134, %120
  %123 = load i32, ptr %5, align 4, !tbaa !5
  %124 = load i32, ptr @d, align 4, !tbaa !5
  %125 = icmp slt i32 %123, %124
  br i1 %125, label %127, label %126

126:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %137

127:                                              ; preds = %122
  %128 = load i32, ptr %5, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [30 x i32], ptr @res, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %131)
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %132, ptr noundef @.str.3)
  br label %134

134:                                              ; preds = %127
  %135 = load i32, ptr %5, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %5, align 4, !tbaa !5
  br label %122, !llvm.loop !14

137:                                              ; preds = %126
  %138 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %139

139:                                              ; preds = %137, %47
  %140 = load i32, ptr %1, align 4
  ret i32 %140
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 = { "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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress 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 #4 = { mustprogress 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 #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"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !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"

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@d = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@t = external dso_local global [30 x [2 x i32]], align 16
@s1 = external dso_local local_unnamed_addr global i32, align 4
@s2 = external dso_local local_unnamed_addr global i32, align 4
@res = external dso_local local_unnamed_addr global [30 x i32], align 16
@s3 = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @d, ptr noundef nonnull @s)
  %2 = load i32, ptr @d, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = load i32, ptr @s1, align 4, !tbaa !5
  %.pre63 = load i32, ptr @s2, align 4
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %4 = phi i32 [ %.pre63, %.._crit_edge_crit_edge ], [ %28, %.lr.ph ]
  %5 = phi i32 [ %.pre, %.._crit_edge_crit_edge ], [ %25, %.lr.ph ]
  %.lcssa = phi i32 [ %2, %.._crit_edge_crit_edge ], [ %29, %.lr.ph ]
  %6 = load i32, ptr @s, align 4, !tbaa !5
  %7 = icmp sgt i32 %5, %6
  %8 = icmp slt i32 %4, %6
  %or.cond = select i1 %7, i1 true, i1 %8
  br i1 %or.cond, label %32, label %.preheader32

.preheader32:                                     ; preds = %._crit_edge
  %s3.promoted = load i32, ptr @s3, align 4, !tbaa !5
  %9 = icmp sgt i32 %.lcssa, 0
  br i1 %9, label %.lr.ph35.preheader, label %.preheader31

.lr.ph35.preheader:                               ; preds = %.preheader32
  %wide.trip.count = zext nneg i32 %.lcssa to i64
  %min.iters.check = icmp ult i32 %.lcssa, 9
  br i1 %min.iters.check, label %.lr.ph35.preheader91, label %vector.ph

.lr.ph35.preheader91:                             ; preds = %middle.block, %.lr.ph35.preheader
  %indvars.iv52.ph = phi i64 [ 0, %.lr.ph35.preheader ], [ %n.vec, %middle.block ]
  %.ph = phi i32 [ %s3.promoted, %.lr.ph35.preheader ], [ %19, %middle.block ]
  br label %.lr.ph35

vector.ph:                                        ; preds = %.lr.ph35.preheader
  %n.mod.vf = and i64 %wide.trip.count, 7
  %10 = icmp eq i64 %n.mod.vf, 0
  %11 = select i1 %10, i64 8, i64 %n.mod.vf
  %n.vec = sub nsw i64 %wide.trip.count, %11
  %12 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %s3.promoted, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %12, %vector.ph ], [ %16, %vector.body ]
  %vec.phi73 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
  %13 = or disjoint i64 %index, 4
  %14 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %index
  %15 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %13
  %wide.vec = load <8 x i32>, ptr %14, align 16, !tbaa !5
  %wide.vec74 = load <8 x i32>, ptr %15, align 16, !tbaa !5
  %strided.vec = shufflevector <8 x i32> %wide.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %strided.vec75 = shufflevector <8 x i32> %wide.vec74, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %16 = add <4 x i32> %vec.phi, %strided.vec
  %17 = add <4 x i32> %vec.phi73, %strided.vec75
  %index.next = add nuw i64 %index, 8
  %18 = icmp eq i64 %index.next, %n.vec
  br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %17, %16
  %19 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br label %.lr.ph35.preheader91

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %20 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %indvars.iv
  %21 = getelementptr inbounds i8, ptr %20, i64 4
  %22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %20, ptr noundef nonnull %21)
  %23 = load i32, ptr %20, align 8, !tbaa !5
  %24 = load i32, ptr @s1, align 4, !tbaa !5
  %25 = add nsw i32 %24, %23
  store i32 %25, ptr @s1, align 4, !tbaa !5
  %26 = load i32, ptr %21, align 4, !tbaa !5
  %27 = load i32, ptr @s2, align 4, !tbaa !5
  %28 = add nsw i32 %27, %26
  store i32 %28, ptr @s2, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr @d, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next, %30
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !13

32:                                               ; preds = %._crit_edge
  %33 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.1)
  br label %78

..preheader31_crit_edge:                          ; preds = %.lr.ph35
  store i32 %37, ptr @s3, align 4, !tbaa !5
  br label %.preheader31

.preheader31:                                     ; preds = %..preheader31_crit_edge, %.preheader32
  %s3.promoted37 = phi i32 [ %37, %..preheader31_crit_edge ], [ %s3.promoted, %.preheader32 ]
  %.not38 = icmp eq i32 %s3.promoted37, %6
  br i1 %.not38, label %.preheader, label %.lr.ph40

.lr.ph35:                                         ; preds = %.lr.ph35.preheader91, %.lr.ph35
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %.lr.ph35 ], [ %indvars.iv52.ph, %.lr.ph35.preheader91 ]
  %34 = phi i32 [ %37, %.lr.ph35 ], [ %.ph, %.lr.ph35.preheader91 ]
  %35 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %indvars.iv52
  %36 = load i32, ptr %35, align 8, !tbaa !5
  %37 = add nsw i32 %34, %36
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count
  br i1 %exitcond.not, label %..preheader31_crit_edge, label %.lr.ph35, !llvm.loop !14

.preheader:                                       ; preds = %62, %.preheader31
  %.023.lcssa = phi i32 [ 0, %.preheader31 ], [ %.1, %62 ]
  %38 = icmp slt i32 %.023.lcssa, %.lcssa
  br i1 %38, label %.lr.ph43.preheader, label %._crit_edge44

.lr.ph43.preheader:                               ; preds = %.preheader
  %39 = sext i32 %.023.lcssa to i64
  %wide.trip.count58 = sext i32 %.lcssa to i64
  %40 = sub nsw i64 %wide.trip.count58, %39
  %min.iters.check78 = icmp ult i64 %40, 9
  br i1 %min.iters.check78, label %.lr.ph43.preheader90, label %vector.ph79

.lr.ph43.preheader90:                             ; preds = %vector.body83, %.lr.ph43.preheader
  %indvars.iv55.ph = phi i64 [ %39, %.lr.ph43.preheader ], [ %ind.end, %vector.body83 ]
  br label %.lr.ph43

vector.ph79:                                      ; preds = %.lr.ph43.preheader
  %n.mod.vf80 = and i64 %40, 7
  %41 = icmp eq i64 %n.mod.vf80, 0
  %42 = select i1 %41, i64 8, i64 %n.mod.vf80
  %n.vec81 = sub nsw i64 %40, %42
  %ind.end = add nsw i64 %n.vec81, %39
  br label %vector.body83

vector.body83:                                    ; preds = %vector.body83, %vector.ph79
  %index84 = phi i64 [ 0, %vector.ph79 ], [ %index.next89, %vector.body83 ]
  %offset.idx = add i64 %index84, %39
  %43 = add i64 %offset.idx, 4
  %44 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %offset.idx
  %45 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %43
  %wide.vec85 = load <8 x i32>, ptr %44, align 8, !tbaa !5
  %wide.vec86 = load <8 x i32>, ptr %45, align 8, !tbaa !5
  %strided.vec87 = shufflevector <8 x i32> %wide.vec85, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %strided.vec88 = shufflevector <8 x i32> %wide.vec86, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
  %46 = getelementptr inbounds [30 x i32], ptr @res, i64 0, i64 %offset.idx
  %47 = getelementptr inbounds i8, ptr %46, i64 16
  store <4 x i32> %strided.vec87, ptr %46, align 4, !tbaa !5
  store <4 x i32> %strided.vec88, ptr %47, align 4, !tbaa !5
  %index.next89 = add nuw i64 %index84, 8
  %48 = icmp eq i64 %index.next89, %n.vec81
  br i1 %48, label %.lr.ph43.preheader90, label %vector.body83, !llvm.loop !15

.lr.ph40:                                         ; preds = %.preheader31, %62
  %.02339 = phi i32 [ %.1, %62 ], [ 0, %.preheader31 ]
  %49 = phi i32 [ %63, %62 ], [ %s3.promoted37, %.preheader31 ]
  %50 = sext i32 %.02339 to i64
  %51 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %50
  %52 = load i32, ptr %51, align 8, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %51, i64 4
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp slt i32 %52, %54
  br i1 %55, label %56, label %59

56:                                               ; preds = %.lr.ph40
  %57 = add nsw i32 %49, 1
  store i32 %57, ptr @s3, align 4, !tbaa !5
  %58 = add nsw i32 %52, 1
  store i32 %58, ptr %51, align 8, !tbaa !5
  br label %62

59:                                               ; preds = %.lr.ph40
  %60 = getelementptr inbounds [30 x i32], ptr @res, i64 0, i64 %50
  store i32 %52, ptr %60, align 4, !tbaa !5
  %61 = add nsw i32 %.02339, 1
  br label %62

62:                                               ; preds = %59, %56
  %63 = phi i32 [ %57, %56 ], [ %49, %59 ]
  %.1 = phi i32 [ %.02339, %56 ], [ %61, %59 ]
  %.not = icmp eq i32 %63, %6
  br i1 %.not, label %.preheader, label %.lr.ph40, !llvm.loop !16

.lr.ph43:                                         ; preds = %.lr.ph43.preheader90, %.lr.ph43
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %.lr.ph43 ], [ %indvars.iv55.ph, %.lr.ph43.preheader90 ]
  %64 = getelementptr inbounds [30 x [2 x i32]], ptr @t, i64 0, i64 %indvars.iv55
  %65 = load i32, ptr %64, align 8, !tbaa !5
  %66 = getelementptr inbounds [30 x i32], ptr @res, i64 0, i64 %indvars.iv55
  store i32 %65, ptr %66, align 4, !tbaa !5
  %indvars.iv.next56 = add nsw i64 %indvars.iv55, 1
  %exitcond59.not = icmp eq i64 %indvars.iv.next56, %wide.trip.count58
  br i1 %exitcond59.not, label %._crit_edge44, label %.lr.ph43, !llvm.loop !17

._crit_edge44:                                    ; preds = %.lr.ph43, %.preheader
  %67 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.2)
  %68 = load i32, ptr @d, align 4, !tbaa !5
  %69 = icmp sgt i32 %68, 0
  br i1 %69, label %.lr.ph47, label %._crit_edge48

._crit_edge48:                                    ; preds = %.lr.ph47, %._crit_edge44
  %70 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %78

.lr.ph47:                                         ; preds = %._crit_edge44, %.lr.ph47
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %.lr.ph47 ], [ 0, %._crit_edge44 ]
  %71 = getelementptr inbounds [30 x i32], ptr @res, i64 0, i64 %indvars.iv60
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %72)
  %74 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull @.str.3)
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %75 = load i32, ptr @d, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = icmp slt i64 %indvars.iv.next61, %76
  br i1 %77, label %.lr.ph47, label %._crit_edge48, !llvm.loop !18

78:                                               ; preds = %._crit_edge48, %32
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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 = { 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 #2 = { inlinehint mustprogress 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 #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 = { mustprogress 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass,TailCallElimPass