; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/337 Division 2/Problem C (C)

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

@k = external dso_local global i32, align 4
@res = external dso_local global [600 x [600 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.1 = 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
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @k)
  %15 = load i32, ptr @k, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %20

17:                                               ; preds = %0
  %18 = 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)
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  br label %180

20:                                               ; preds = %0
  store i32 1, ptr @res, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %140, %20
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr @k, align 4, !tbaa !5
  %24 = icmp sle i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %143

26:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sub nsw i32 %27, 1
  %29 = shl i32 1, %28
  store i32 %29, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %61, %26
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %64

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

36:                                               ; preds = %57, %35
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %60

41:                                               ; preds = %36
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %43
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [600 x i32], ptr %44, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = add nsw i32 %49, %50
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %52
  %54 = load i32, ptr %6, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [600 x i32], ptr %53, i64 0, i64 %55
  store i32 %48, ptr %56, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %41
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %6, align 4, !tbaa !5
  br label %36, !llvm.loop !9

60:                                               ; preds = %40
  br label %61

61:                                               ; preds = %60
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %5, align 4, !tbaa !5
  br label %30, !llvm.loop !11

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

65:                                               ; preds = %99, %64
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %70, label %69

69:                                               ; preds = %65
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %102

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

71:                                               ; preds = %95, %70
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %98

76:                                               ; preds = %71
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = add nsw i32 %77, %78
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %80
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [600 x i32], ptr %81, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sub nsw i32 1, %85
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %88
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = add nsw i32 %90, %91
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [600 x i32], ptr %89, i64 0, i64 %93
  store i32 %86, ptr %94, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %76
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %8, align 4, !tbaa !5
  br label %71, !llvm.loop !12

98:                                               ; preds = %75
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %7, align 4, !tbaa !5
  br label %65, !llvm.loop !13

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

103:                                              ; preds = %136, %102
  %104 = load i32, ptr %9, align 4, !tbaa !5
  %105 = load i32, ptr %4, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %139

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

109:                                              ; preds = %132, %108
  %110 = load i32, ptr %10, align 4, !tbaa !5
  %111 = load i32, ptr %4, align 4, !tbaa !5
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %135

114:                                              ; preds = %109
  %115 = load i32, ptr %9, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %116
  %118 = load i32, ptr %10, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [600 x i32], ptr %117, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = load i32, ptr %4, align 4, !tbaa !5
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = add nsw i32 %122, %123
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %125
  %127 = load i32, ptr %4, align 4, !tbaa !5
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = add nsw i32 %127, %128
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [600 x i32], ptr %126, i64 0, i64 %130
  store i32 %121, ptr %131, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %114
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %10, align 4, !tbaa !5
  br label %109, !llvm.loop !14

135:                                              ; preds = %113
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %9, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %9, align 4, !tbaa !5
  br label %103, !llvm.loop !15

139:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %2, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %2, align 4, !tbaa !5
  br label %21, !llvm.loop !16

143:                                              ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %144 = load i32, ptr @k, align 4, !tbaa !5
  %145 = shl i32 1, %144
  store i32 %145, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %146

146:                                              ; preds = %176, %143
  %147 = load i32, ptr %12, align 4, !tbaa !5
  %148 = load i32, ptr %11, align 4, !tbaa !5
  %149 = icmp slt i32 %147, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %146
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %179

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

152:                                              ; preds = %171, %151
  %153 = load i32, ptr %13, align 4, !tbaa !5
  %154 = load i32, ptr %11, align 4, !tbaa !5
  %155 = icmp slt i32 %153, %154
  br i1 %155, label %157, label %156

156:                                              ; preds = %152
  store i32 26, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %174

157:                                              ; preds = %152
  %158 = load i32, ptr %12, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %159
  %161 = load i32, ptr %13, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [600 x i32], ptr %160, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !5
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %168

166:                                              ; preds = %157
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 43)
  br label %170

168:                                              ; preds = %157
  %169 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 42)
  br label %170

170:                                              ; preds = %168, %166
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %13, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %13, align 4, !tbaa !5
  br label %152, !llvm.loop !17

174:                                              ; preds = %156
  %175 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  br label %176

176:                                              ; preds = %174
  %177 = load i32, ptr %12, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %12, align 4, !tbaa !5
  br label %146, !llvm.loop !18

179:                                              ; preds = %150
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %180

180:                                              ; preds = %179, %17
  %181 = load i32, ptr %1, align 4
  ret i32 %181
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #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) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #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 = { "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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !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 }

@k = external dso_local global i32, align 4
@res = external dso_local local_unnamed_addr global [600 x [600 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.1 = 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 @k)
  %2 = load i32, ptr @k, align 4, !tbaa !5
  %3 = icmp eq i32 %2, 0
  br i1 %3, label %4, label %7

4:                                                ; preds = %0
  %5 = 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)
  %6 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %.loopexit

7:                                                ; preds = %0
  store i32 1, ptr @res, align 16, !tbaa !5
  %.not74 = icmp slt i32 %2, 1
  br i1 %.not74, label %.preheader.us.preheader, label %.lr.ph

._crit_edge:                                      ; preds = %._crit_edge72.split.us
  %.not = icmp eq i32 %2, 31
  br i1 %.not, label %.loopexit, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %7, %._crit_edge
  %8 = shl nuw nsw i32 1, %2
  %wide.trip.count123 = zext nneg i32 %8 to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge78.us
  %indvars.iv120 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next121, %._crit_edge78.us ]
  br label %9

9:                                                ; preds = %.preheader.us, %9
  %indvars.iv114 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next115, %9 ]
  %10 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv120, i64 %indvars.iv114
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %.not59.us = icmp eq i32 %11, 0
  %. = select i1 %.not59.us, i8 42, i8 43
  %12 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %.)
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %exitcond119.not = icmp eq i64 %indvars.iv.next115, %wide.trip.count123
  br i1 %exitcond119.not, label %._crit_edge78.us, label %9, !llvm.loop !9

._crit_edge78.us:                                 ; preds = %9
  %13 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %exitcond124.not = icmp eq i64 %indvars.iv.next121, %wide.trip.count123
  br i1 %exitcond124.not, label %.loopexit, label %.preheader.us, !llvm.loop !11

.lr.ph:                                           ; preds = %7, %._crit_edge72.split.us
  %.05575 = phi i32 [ %94, %._crit_edge72.split.us ], [ 1, %7 ]
  %14 = add nsw i32 %.05575, -1
  %15 = shl nuw i32 1, %14
  %.not80 = icmp eq i32 %14, 31
  br i1 %.not80, label %._crit_edge72.split.us, label %.preheader62.us.preheader

.preheader62.us.preheader:                        ; preds = %.lr.ph
  %smax = tail call i32 @llvm.smax.i32(i32 %15, i32 1)
  %16 = sext i32 %15 to i64
  %wide.trip.count88 = zext nneg i32 %smax to i64
  %min.iters.check146 = icmp slt i32 %15, 8
  %n.vec149 = and i64 %wide.trip.count88, 2147483640
  %exitcond.not = icmp slt i32 %15, 2
  %exitcond.not.1 = icmp eq i32 %14, 1
  %exitcond.not.3 = icmp eq i32 %14, 2
  br label %.preheader62.us

.preheader62.us:                                  ; preds = %.preheader62.us.preheader, %._crit_edge.us
  %indvars.iv85 = phi i64 [ 0, %.preheader62.us.preheader ], [ %indvars.iv.next86, %._crit_edge.us ]
  %17 = add nuw nsw i64 %indvars.iv85, %16
  br i1 %min.iters.check146, label %scalar.ph145, label %vector.body151

vector.body151:                                   ; preds = %.preheader62.us, %vector.body151
  %index152 = phi i64 [ %index.next155, %vector.body151 ], [ 0, %.preheader62.us ]
  %18 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv85, i64 %index152
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  %wide.load153 = load <4 x i32>, ptr %18, align 16, !tbaa !5
  %wide.load154 = load <4 x i32>, ptr %19, align 16, !tbaa !5
  %20 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %17, i64 %index152
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  store <4 x i32> %wide.load153, ptr %20, align 16, !tbaa !5
  store <4 x i32> %wide.load154, ptr %21, align 16, !tbaa !5
  %index.next155 = add nuw i64 %index152, 8
  %22 = icmp eq i64 %index.next155, %n.vec149
  br i1 %22, label %._crit_edge.us, label %vector.body151, !llvm.loop !12

scalar.ph145:                                     ; preds = %.preheader62.us
  %23 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv85, i64 0
  %24 = load i32, ptr %23, align 16, !tbaa !5
  %25 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %17, i64 0
  store i32 %24, ptr %25, align 16, !tbaa !5
  br i1 %exitcond.not, label %._crit_edge.us, label %scalar.ph145.1, !llvm.loop !15

scalar.ph145.1:                                   ; preds = %scalar.ph145
  %26 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv85, i64 1
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %17, i64 1
  store i32 %27, ptr %28, align 4, !tbaa !5
  br i1 %exitcond.not.1, label %._crit_edge.us, label %scalar.ph145.2, !llvm.loop !15

scalar.ph145.2:                                   ; preds = %scalar.ph145.1
  %29 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv85, i64 2
  %30 = load i32, ptr %29, align 8, !tbaa !5
  %31 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %17, i64 2
  store i32 %30, ptr %31, align 8, !tbaa !5
  %32 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv85, i64 3
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %17, i64 3
  store i32 %33, ptr %34, align 4, !tbaa !5
  br i1 %exitcond.not.3, label %._crit_edge.us, label %scalar.ph145.4, !llvm.loop !15

scalar.ph145.4:                                   ; preds = %scalar.ph145.2
  %35 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv85, i64 4
  %36 = load i32, ptr %35, align 16, !tbaa !5
  %37 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %17, i64 4
  store i32 %36, ptr %37, align 16, !tbaa !5
  %38 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv85, i64 5
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %17, i64 5
  store i32 %39, ptr %40, align 4, !tbaa !5
  %41 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv85, i64 6
  %42 = load i32, ptr %41, align 8, !tbaa !5
  %43 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %17, i64 6
  store i32 %42, ptr %43, align 8, !tbaa !5
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %vector.body151, %scalar.ph145, %scalar.ph145.1, %scalar.ph145.2, %scalar.ph145.4
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %exitcond89.not = icmp eq i64 %indvars.iv.next86, %wide.trip.count88
  br i1 %exitcond89.not, label %.preheader64, label %.preheader62.us, !llvm.loop !16

.preheader64:                                     ; preds = %._crit_edge.us
  br i1 %.not80, label %._crit_edge72.split.us, label %.preheader61.us.preheader

.preheader61.us.preheader:                        ; preds = %.preheader64
  %44 = sext i32 %15 to i64
  %smax93 = tail call i32 @llvm.smax.i32(i32 %15, i32 1)
  %wide.trip.count99 = zext nneg i32 %smax93 to i64
  %45 = mul nsw i64 %44, -2396
  %46 = add nsw i64 %wide.trip.count88, -1
  %min.iters.check131 = icmp slt i32 %15, 8
  %diff.check128 = icmp ult i64 %45, 32
  %or.cond = select i1 %min.iters.check131, i1 true, i1 %diff.check128
  %n.vec134 = and i64 %wide.trip.count88, 2147483640
  %xtraiter = and i64 %wide.trip.count88, 1
  %47 = icmp eq i64 %46, 0
  %unroll_iter = and i64 %wide.trip.count88, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader61.us

.preheader61.us:                                  ; preds = %.preheader61.us.preheader, %._crit_edge.us69
  %indvars.iv96 = phi i64 [ 0, %.preheader61.us.preheader ], [ %indvars.iv.next97, %._crit_edge.us69 ]
  %48 = add nuw nsw i64 %indvars.iv96, %44
  br i1 %or.cond, label %scalar.ph130.preheader, label %vector.body136

scalar.ph130.preheader:                           ; preds = %.preheader61.us
  br i1 %47, label %._crit_edge.us69.loopexit.unr-lcssa, label %scalar.ph130

vector.body136:                                   ; preds = %.preheader61.us, %vector.body136
  %index137 = phi i64 [ %index.next140, %vector.body136 ], [ 0, %.preheader61.us ]
  %49 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %48, i64 %index137
  %50 = getelementptr inbounds i8, ptr %49, i64 16
  %wide.load138 = load <4 x i32>, ptr %49, align 16, !tbaa !5
  %wide.load139 = load <4 x i32>, ptr %50, align 16, !tbaa !5
  %51 = sub nsw <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %wide.load138
  %52 = sub nsw <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %wide.load139
  %53 = add nuw nsw i64 %index137, %44
  %54 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv96, i64 %53
  %55 = getelementptr inbounds i8, ptr %54, i64 16
  store <4 x i32> %51, ptr %54, align 4, !tbaa !5
  store <4 x i32> %52, ptr %55, align 4, !tbaa !5
  %index.next140 = add nuw i64 %index137, 8
  %56 = icmp eq i64 %index.next140, %n.vec134
  br i1 %56, label %._crit_edge.us69, label %vector.body136, !llvm.loop !17

scalar.ph130:                                     ; preds = %scalar.ph130.preheader, %scalar.ph130
  %indvars.iv90 = phi i64 [ %indvars.iv.next91.1, %scalar.ph130 ], [ 0, %scalar.ph130.preheader ]
  %niter = phi i64 [ %niter.next.1, %scalar.ph130 ], [ 0, %scalar.ph130.preheader ]
  %57 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %48, i64 %indvars.iv90
  %58 = load i32, ptr %57, align 8, !tbaa !5
  %59 = sub nsw i32 1, %58
  %60 = add nuw nsw i64 %indvars.iv90, %44
  %61 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv96, i64 %60
  store i32 %59, ptr %61, align 4, !tbaa !5
  %indvars.iv.next91 = or disjoint i64 %indvars.iv90, 1
  %62 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %48, i64 %indvars.iv.next91
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sub nsw i32 1, %63
  %65 = add nuw nsw i64 %indvars.iv.next91, %44
  %66 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv96, i64 %65
  store i32 %64, ptr %66, align 4, !tbaa !5
  %indvars.iv.next91.1 = add nuw nsw i64 %indvars.iv90, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us69.loopexit.unr-lcssa, label %scalar.ph130, !llvm.loop !18

._crit_edge.us69.loopexit.unr-lcssa:              ; preds = %scalar.ph130, %scalar.ph130.preheader
  %indvars.iv90.unr = phi i64 [ 0, %scalar.ph130.preheader ], [ %indvars.iv.next91.1, %scalar.ph130 ]
  br i1 %lcmp.mod.not, label %._crit_edge.us69, label %scalar.ph130.epil

scalar.ph130.epil:                                ; preds = %._crit_edge.us69.loopexit.unr-lcssa
  %67 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %48, i64 %indvars.iv90.unr
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sub nsw i32 1, %68
  %70 = add nuw nsw i64 %indvars.iv90.unr, %44
  %71 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv96, i64 %70
  store i32 %69, ptr %71, align 4, !tbaa !5
  br label %._crit_edge.us69

._crit_edge.us69:                                 ; preds = %vector.body136, %scalar.ph130.epil, %._crit_edge.us69.loopexit.unr-lcssa
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %exitcond100.not = icmp eq i64 %indvars.iv.next97, %wide.trip.count99
  br i1 %exitcond100.not, label %.preheader63, label %.preheader61.us, !llvm.loop !19

.preheader63:                                     ; preds = %._crit_edge.us69
  br i1 %.not80, label %._crit_edge72.split.us, label %.preheader60.us.preheader

.preheader60.us.preheader:                        ; preds = %.preheader63
  %72 = sext i32 %15 to i64
  %smax105 = tail call i32 @llvm.smax.i32(i32 %15, i32 1)
  %wide.trip.count111 = zext nneg i32 %smax105 to i64
  %73 = mul nsw i64 %72, 2404
  %min.iters.check = icmp slt i32 %15, 8
  %diff.check = icmp ult i64 %73, 32
  %or.cond157 = select i1 %min.iters.check, i1 true, i1 %diff.check
  %n.vec = and i64 %wide.trip.count88, 2147483640
  %xtraiter161 = and i64 %wide.trip.count88, 1
  %74 = icmp eq i64 %46, 0
  %unroll_iter163 = and i64 %wide.trip.count88, 2147483646
  %lcmp.mod162.not = icmp eq i64 %xtraiter161, 0
  br label %.preheader60.us

.preheader60.us:                                  ; preds = %.preheader60.us.preheader, %._crit_edge.us73
  %indvars.iv108 = phi i64 [ 0, %.preheader60.us.preheader ], [ %indvars.iv.next109, %._crit_edge.us73 ]
  %75 = add nuw nsw i64 %indvars.iv108, %72
  br i1 %or.cond157, label %scalar.ph.preheader, label %vector.body

scalar.ph.preheader:                              ; preds = %.preheader60.us
  br i1 %74, label %._crit_edge.us73.loopexit.unr-lcssa, label %scalar.ph

vector.body:                                      ; preds = %.preheader60.us, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader60.us ]
  %76 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv108, i64 %index
  %77 = getelementptr inbounds i8, ptr %76, i64 16
  %wide.load = load <4 x i32>, ptr %76, align 16, !tbaa !5
  %wide.load126 = load <4 x i32>, ptr %77, align 16, !tbaa !5
  %78 = add nuw nsw i64 %index, %72
  %79 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %75, i64 %78
  %80 = getelementptr inbounds i8, ptr %79, i64 16
  store <4 x i32> %wide.load, ptr %79, align 4, !tbaa !5
  store <4 x i32> %wide.load126, ptr %80, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %81 = icmp eq i64 %index.next, %n.vec
  br i1 %81, label %._crit_edge.us73, label %vector.body, !llvm.loop !20

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv102 = phi i64 [ %indvars.iv.next103.1, %scalar.ph ], [ 0, %scalar.ph.preheader ]
  %niter164 = phi i64 [ %niter164.next.1, %scalar.ph ], [ 0, %scalar.ph.preheader ]
  %82 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv108, i64 %indvars.iv102
  %83 = load i32, ptr %82, align 8, !tbaa !5
  %84 = add nuw nsw i64 %indvars.iv102, %72
  %85 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %75, i64 %84
  store i32 %83, ptr %85, align 4, !tbaa !5
  %indvars.iv.next103 = or disjoint i64 %indvars.iv102, 1
  %86 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv108, i64 %indvars.iv.next103
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = add nuw nsw i64 %indvars.iv.next103, %72
  %89 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %75, i64 %88
  store i32 %87, ptr %89, align 4, !tbaa !5
  %indvars.iv.next103.1 = add nuw nsw i64 %indvars.iv102, 2
  %niter164.next.1 = add i64 %niter164, 2
  %niter164.ncmp.1 = icmp eq i64 %niter164.next.1, %unroll_iter163
  br i1 %niter164.ncmp.1, label %._crit_edge.us73.loopexit.unr-lcssa, label %scalar.ph, !llvm.loop !21

._crit_edge.us73.loopexit.unr-lcssa:              ; preds = %scalar.ph, %scalar.ph.preheader
  %indvars.iv102.unr = phi i64 [ 0, %scalar.ph.preheader ], [ %indvars.iv.next103.1, %scalar.ph ]
  br i1 %lcmp.mod162.not, label %._crit_edge.us73, label %scalar.ph.epil

scalar.ph.epil:                                   ; preds = %._crit_edge.us73.loopexit.unr-lcssa
  %90 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %indvars.iv108, i64 %indvars.iv102.unr
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = add nuw nsw i64 %indvars.iv102.unr, %72
  %93 = getelementptr inbounds [600 x [600 x i32]], ptr @res, i64 0, i64 %75, i64 %92
  store i32 %91, ptr %93, align 4, !tbaa !5
  br label %._crit_edge.us73

._crit_edge.us73:                                 ; preds = %vector.body, %scalar.ph.epil, %._crit_edge.us73.loopexit.unr-lcssa
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %exitcond112.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count111
  br i1 %exitcond112.not, label %._crit_edge72.split.us, label %.preheader60.us, !llvm.loop !22

._crit_edge72.split.us:                           ; preds = %._crit_edge.us73, %.lr.ph, %.preheader64, %.preheader63
  %94 = add nuw i32 %.05575, 1
  %exitcond113.not = icmp eq i32 %.05575, %2
  br i1 %exitcond113.not, label %._crit_edge, label %.lr.ph, !llvm.loop !23

.loopexit:                                        ; preds = %._crit_edge78.us, %._crit_edge, %4
  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

; 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 #3 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #2

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass