; LLVM IR from VastoLorde95/Competitive-Programming :: Codejam/APAC 2017/Round A/Problem D/D.ll (Z5solvev)

; 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::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@k = external dso_local global [13 x i32], align 16
@l = external dso_local global [13 x i32], align 16
@a = external dso_local global [13 x [13 x i64]], align 16
@c = external dso_local global [13 x [13 x i64]], align 16
@m = external dso_local global i64, align 8
@n = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5solveRSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(24)) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #1 personality ptr @__gxx_personality_v0 {
  %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 i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::vector.0", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  store i32 1, ptr %1, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %113, %0
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = load i64, ptr @n, align 8, !tbaa !9
  %20 = icmp sle i64 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %16
  store i32 2, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  br label %116

22:                                               ; preds = %16
  %23 = load i32, ptr %1, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [13 x i32], ptr @k, i64 0, i64 %24
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [13 x i32], ptr @l, i64 0, i64 %27
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %25, ptr noundef %28)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %46, %22
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = load i32, ptr %1, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [13 x i32], ptr @k, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = icmp sle i32 %31, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %30
  %39 = load i32, ptr %1, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [13 x [13 x i64]], ptr @a, i64 0, i64 %40
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [13 x i64], ptr %41, i64 0, i64 %43
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %44)
  br label %46

46:                                               ; preds = %38
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %3, align 4, !tbaa !5
  br label %30, !llvm.loop !11

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

50:                                               ; preds = %66, %49
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = load i32, ptr %1, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [13 x i32], ptr @k, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = icmp sle i32 %51, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %50
  store i32 8, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %69

58:                                               ; preds = %50
  %59 = load i32, ptr %1, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %60
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [13 x i64], ptr %61, i64 0, i64 %63
  %65 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %64)
  br label %66

66:                                               ; preds = %58
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %4, align 4, !tbaa !5
  br label %50, !llvm.loop !13

69:                                               ; preds = %57
  %70 = load i32, ptr %1, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %71
  %73 = load i32, ptr %1, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [13 x i32], ptr @l, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [13 x i64], ptr %72, i64 0, i64 %77
  store i64 0, ptr %78, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %79 = load i32, ptr %1, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [13 x i32], ptr @l, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %5, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %109, %69
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = load i32, ptr %1, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [13 x i32], ptr @k, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = icmp sle i32 %85, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %84
  store i32 11, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %112

92:                                               ; preds = %84
  %93 = load i32, ptr %1, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %94
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [13 x i64], ptr %95, i64 0, i64 %98
  %100 = load i64, ptr %99, align 8, !tbaa !9
  %101 = load i32, ptr %1, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %102
  %104 = load i32, ptr %5, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [13 x i64], ptr %103, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !9
  %108 = add nsw i64 %107, %100
  store i64 %108, ptr %106, align 8, !tbaa !9
  br label %109

109:                                              ; preds = %92
  %110 = load i32, ptr %5, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %5, align 4, !tbaa !5
  br label %84, !llvm.loop !14

112:                                              ; preds = %91
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %1, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %1, align 4, !tbaa !5
  br label %16, !llvm.loop !15

116:                                              ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %164, %116
  %118 = load i32, ptr %7, align 4, !tbaa !5
  %119 = load i64, ptr @n, align 8, !tbaa !9
  %120 = trunc i64 %119 to i32
  %121 = shl i32 1, %120
  %122 = icmp slt i32 %118, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %117
  store i32 14, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %172

124:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %125 = load i32, ptr %7, align 4, !tbaa !5
  %126 = call i32 @llvm.ctpop.i32(i32 %125)
  store i32 %126, ptr %8, align 4, !tbaa !5
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = icmp ne i32 %127, 8
  br i1 %128, label %129, label %130

129:                                              ; preds = %124
  store i32 16, ptr %2, align 4
  br label %161

130:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %152, %130
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = load i64, ptr @n, align 8, !tbaa !9
  %135 = icmp slt i64 %133, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %131
  store i32 17, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %155

137:                                              ; preds = %131
  %138 = load i32, ptr %7, align 4, !tbaa !5
  %139 = load i32, ptr %10, align 4, !tbaa !5
  %140 = shl i32 1, %139
  %141 = and i32 %138, %140
  %142 = icmp ne i32 %141, 0
  br i1 %142, label %143, label %151

143:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %144 = load i32, ptr %10, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %11, align 4, !tbaa !5
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %146 unwind label %147

146:                                              ; preds = %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %151

147:                                              ; preds = %143
  %148 = landingpad { ptr, i32 }
          cleanup
  %149 = extractvalue { ptr, i32 } %148, 0
  store ptr %149, ptr %12, align 8
  %150 = extractvalue { ptr, i32 } %148, 1
  store i32 %150, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %171

151:                                              ; preds = %146, %137
  br label %152

152:                                              ; preds = %151
  %153 = load i32, ptr %10, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %10, align 4, !tbaa !5
  br label %131, !llvm.loop !16

155:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %156 = invoke noundef i64 @_Z5solveRSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %157 unwind label %167

157:                                              ; preds = %155
  store i64 %156, ptr %14, align 8, !tbaa !9
  %158 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %159 unwind label %167

159:                                              ; preds = %157
  %160 = load i64, ptr %158, align 8, !tbaa !9
  store i64 %160, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  store i32 0, ptr %2, align 4
  br label %161

161:                                              ; preds = %159, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %162 = load i32, ptr %2, align 4
  switch i32 %162, label %180 [
    i32 0, label %163
    i32 16, label %164
  ]

163:                                              ; preds = %161
  br label %164

164:                                              ; preds = %163, %161
  %165 = load i32, ptr %7, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %7, align 4, !tbaa !5
  br label %117, !llvm.loop !17

167:                                              ; preds = %157, %155
  %168 = landingpad { ptr, i32 }
          cleanup
  %169 = extractvalue { ptr, i32 } %168, 0
  store ptr %169, ptr %12, align 8
  %170 = extractvalue { ptr, i32 } %168, 1
  store i32 %170, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %171

171:                                              ; preds = %167, %147
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %175

172:                                              ; preds = %123
  %173 = load i64, ptr %6, align 8, !tbaa !9
  %174 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %173)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  ret void

175:                                              ; preds = %171
  %176 = load ptr, ptr %12, align 8
  %177 = load i32, ptr %13, align 4
  %178 = insertvalue { ptr, i32 } poison, ptr %176, 0
  %179 = insertvalue { ptr, i32 } %178, i32 %177, 1
  resume { ptr, i32 } %179

180:                                              ; preds = %161
  unreachable
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress 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 #3 = { inlinehint mustprogress 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 #4 = { "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) }
attributes #6 = { 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; 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::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@k = external dso_local global [13 x i32], align 16
@l = external dso_local global [13 x i32], align 16
@a = external dso_local global [13 x [13 x i64]], align 16
@c = external dso_local global [13 x [13 x i64]], align 16
@m = external dso_local global i64, align 8
@n = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5solveRSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca %"class.std::vector.0", align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m, ptr noundef nonnull @n)
  %6 = load i64, ptr @n, align 8, !tbaa !5
  %.not58 = icmp slt i64 %6, 1
  br i1 %.not58, label %._crit_edge62, label %.lr.ph61

._crit_edge62:                                    ; preds = %._crit_edge57, %0
  %7 = phi i64 [ %6, %0 ], [ %31, %._crit_edge57 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  store i64 0, ptr %1, align 8, !tbaa !5
  %8 = and i64 %7, 4294967295
  %.not71 = icmp eq i64 %8, 31
  br i1 %.not71, label %._crit_edge70, label %.lr.ph69

.lr.ph61:                                         ; preds = %0, %._crit_edge57
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %._crit_edge57 ], [ 1, %0 ]
  %9 = getelementptr inbounds [13 x i32], ptr @k, i64 0, i64 %indvars.iv80
  %10 = getelementptr inbounds [13 x i32], ptr @l, i64 0, i64 %indvars.iv80
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %12 = load i32, ptr %9, align 4, !tbaa !9
  %.not4548 = icmp slt i32 %12, 1
  br i1 %.not4548, label %._crit_edge, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph
  %.not4650 = icmp slt i32 %15, 2
  br i1 %.not4650, label %._crit_edge, label %.lr.ph52

.lr.ph:                                           ; preds = %.lr.ph61, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph61 ]
  %13 = getelementptr inbounds [13 x [13 x i64]], ptr @a, i64 0, i64 %indvars.iv80, i64 %indvars.iv
  %14 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %13)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr %9, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %.not45.not = icmp slt i64 %indvars.iv, %16
  br i1 %.not45.not, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph52, %.lr.ph61, %.preheader
  %.lcssa = phi i32 [ %15, %.preheader ], [ %12, %.lr.ph61 ], [ %25, %.lr.ph52 ]
  %17 = load i32, ptr %10, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %indvars.iv80, i64 %18
  store i64 0, ptr %19, align 8, !tbaa !5
  %.not47.not53 = icmp slt i32 %17, %.lcssa
  br i1 %.not47.not53, label %.lr.ph56.preheader, label %._crit_edge57

.lr.ph56.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = sext i32 %.lcssa to i64
  %20 = sub nsw i64 %wide.trip.count, %18
  %xtraiter = and i64 %20, 3
  %21 = sub nsw i64 %18, %wide.trip.count
  %22 = icmp ugt i64 %21, -4
  br i1 %22, label %._crit_edge57.loopexit.unr-lcssa, label %.lr.ph56.preheader.new

.lr.ph56.preheader.new:                           ; preds = %.lr.ph56.preheader
  %unroll_iter = and i64 %20, -4
  br label %.lr.ph56

.lr.ph52:                                         ; preds = %.preheader, %.lr.ph52
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %.lr.ph52 ], [ 2, %.preheader ]
  %23 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %indvars.iv80, i64 %indvars.iv74
  %24 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %23)
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %.not46.not = icmp slt i64 %indvars.iv74, %26
  br i1 %.not46.not, label %.lr.ph52, label %._crit_edge, !llvm.loop !13

._crit_edge57.loopexit.unr-lcssa:                 ; preds = %.lr.ph56, %.lr.ph56.preheader
  %.unr = phi i64 [ 0, %.lr.ph56.preheader ], [ %44, %.lr.ph56 ]
  %indvars.iv77.unr = phi i64 [ %18, %.lr.ph56.preheader ], [ %indvars.iv.next78.3, %.lr.ph56 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge57, label %.lr.ph56.epil

.lr.ph56.epil:                                    ; preds = %._crit_edge57.loopexit.unr-lcssa, %.lr.ph56.epil
  %27 = phi i64 [ %30, %.lr.ph56.epil ], [ %.unr, %._crit_edge57.loopexit.unr-lcssa ]
  %indvars.iv77.epil = phi i64 [ %indvars.iv.next78.epil, %.lr.ph56.epil ], [ %indvars.iv77.unr, %._crit_edge57.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph56.epil ], [ 0, %._crit_edge57.loopexit.unr-lcssa ]
  %indvars.iv.next78.epil = add nsw i64 %indvars.iv77.epil, 1
  %28 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %indvars.iv80, i64 %indvars.iv.next78.epil
  %29 = load i64, ptr %28, align 8, !tbaa !5
  %30 = add nsw i64 %29, %27
  store i64 %30, ptr %28, align 8, !tbaa !5
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge57, label %.lr.ph56.epil, !llvm.loop !14

._crit_edge57:                                    ; preds = %._crit_edge57.loopexit.unr-lcssa, %.lr.ph56.epil, %._crit_edge
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %31 = load i64, ptr @n, align 8, !tbaa !5
  %.not.not = icmp sgt i64 %31, %indvars.iv80
  br i1 %.not.not, label %.lr.ph61, label %._crit_edge62, !llvm.loop !16

.lr.ph56:                                         ; preds = %.lr.ph56, %.lr.ph56.preheader.new
  %32 = phi i64 [ 0, %.lr.ph56.preheader.new ], [ %44, %.lr.ph56 ]
  %indvars.iv77 = phi i64 [ %18, %.lr.ph56.preheader.new ], [ %indvars.iv.next78.3, %.lr.ph56 ]
  %niter = phi i64 [ 0, %.lr.ph56.preheader.new ], [ %niter.next.3, %.lr.ph56 ]
  %indvars.iv.next78 = add nsw i64 %indvars.iv77, 1
  %33 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %indvars.iv80, i64 %indvars.iv.next78
  %34 = load i64, ptr %33, align 8, !tbaa !5
  %35 = add nsw i64 %34, %32
  store i64 %35, ptr %33, align 8, !tbaa !5
  %indvars.iv.next78.1 = add nsw i64 %indvars.iv77, 2
  %36 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %indvars.iv80, i64 %indvars.iv.next78.1
  %37 = load i64, ptr %36, align 8, !tbaa !5
  %38 = add nsw i64 %37, %35
  store i64 %38, ptr %36, align 8, !tbaa !5
  %indvars.iv.next78.2 = add nsw i64 %indvars.iv77, 3
  %39 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %indvars.iv80, i64 %indvars.iv.next78.2
  %40 = load i64, ptr %39, align 8, !tbaa !5
  %41 = add nsw i64 %40, %38
  store i64 %41, ptr %39, align 8, !tbaa !5
  %indvars.iv.next78.3 = add nsw i64 %indvars.iv77, 4
  %42 = getelementptr inbounds [13 x [13 x i64]], ptr @c, i64 0, i64 %indvars.iv80, i64 %indvars.iv.next78.3
  %43 = load i64, ptr %42, align 8, !tbaa !5
  %44 = add nsw i64 %43, %41
  store i64 %44, ptr %42, align 8, !tbaa !5
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge57.loopexit.unr-lcssa, label %.lr.ph56, !llvm.loop !17

._crit_edge70.loopexit:                           ; preds = %69
  %.pre87 = load i64, ptr %1, align 8, !tbaa !5
  br label %._crit_edge70

._crit_edge70:                                    ; preds = %._crit_edge70.loopexit, %._crit_edge62
  %45 = phi i64 [ %.pre87, %._crit_edge70.loopexit ], [ 0, %._crit_edge62 ]
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %45)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret void

.lr.ph69:                                         ; preds = %._crit_edge62, %69
  %47 = phi i64 [ %70, %69 ], [ %7, %._crit_edge62 ]
  %.03767 = phi i32 [ %71, %69 ], [ 0, %._crit_edge62 ]
  %48 = call range(i32 0, 32) i32 @llvm.ctpop.i32(i32 %.03767)
  %.not42 = icmp eq i32 %48, 8
  br i1 %.not42, label %49, label %69

49:                                               ; preds = %.lr.ph69
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  %50 = load i64, ptr @n, align 8, !tbaa !5
  %51 = icmp sgt i64 %50, 0
  br i1 %51, label %.lr.ph65, label %._crit_edge66

._crit_edge66:                                    ; preds = %63, %49
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %52 = invoke noundef i64 @_Z5solveRSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %66 unwind label %75

.lr.ph65:                                         ; preds = %49, %63
  %53 = phi i64 [ %64, %63 ], [ %50, %49 ]
  %indvars.iv83 = phi i64 [ %indvars.iv.next84.pre-phi, %63 ], [ 0, %49 ]
  %54 = trunc nuw nsw i64 %indvars.iv83 to i32
  %55 = shl nuw i32 1, %54
  %56 = and i32 %55, %.03767
  %.not43 = icmp eq i32 %56, 0
  br i1 %.not43, label %.lr.ph65._crit_edge, label %57

.lr.ph65._crit_edge:                              ; preds = %.lr.ph65
  %.pre88 = add nuw nsw i64 %indvars.iv83, 1
  br label %63

57:                                               ; preds = %.lr.ph65
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %58 = add nuw nsw i64 %indvars.iv83, 1
  %59 = trunc nuw i64 %58 to i32
  store i32 %59, ptr %3, align 4, !tbaa !9
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %60 unwind label %61

60:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %.pre = load i64, ptr @n, align 8, !tbaa !5
  br label %63

61:                                               ; preds = %57
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %77

63:                                               ; preds = %.lr.ph65._crit_edge, %60
  %indvars.iv.next84.pre-phi = phi i64 [ %.pre88, %.lr.ph65._crit_edge ], [ %58, %60 ]
  %64 = phi i64 [ %53, %.lr.ph65._crit_edge ], [ %.pre, %60 ]
  %65 = icmp sgt i64 %64, %indvars.iv.next84.pre-phi
  br i1 %65, label %.lr.ph65, label %._crit_edge66, !llvm.loop !18

66:                                               ; preds = %._crit_edge66
  store i64 %52, ptr %4, align 8, !tbaa !5
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %68 = load i64, ptr %67, align 8, !tbaa !5
  store i64 %68, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  %.pre86 = load i64, ptr @n, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %.lr.ph69, %66
  %70 = phi i64 [ %47, %.lr.ph69 ], [ %.pre86, %66 ]
  %71 = add nuw nsw i32 %.03767, 1
  %72 = trunc i64 %70 to i32
  %73 = shl nuw i32 1, %72
  %74 = icmp slt i32 %71, %73
  br i1 %74, label %.lr.ph69, label %._crit_edge70.loopexit, !llvm.loop !19

75:                                               ; preds = %._crit_edge66
  %76 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %77

77:                                               ; preds = %75, %61
  %.pn = phi { ptr, i32 } [ %62, %61 ], [ %76, %75 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress 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 #3 = { inlinehint mustprogress 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 #4 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass