; LLVM IR from Tunghohin/Competitive_Coding :: Codeforces/cf1676_G.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" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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 }
%"class.std::basic_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@s = external dso_local global [4010 x i32], align 16
@dfn = external dso_local global [4010 x i32], align 16
@timestamp = external dso_local global i32, align 4
@L = external dso_local global [4010 x i32], align 16
@R = external dso_local global [4010 x i32], align 16
@val = external dso_local global [4010 x i32], align 16
@G = external dso_local global [4010 x %"class.std::vector"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #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 i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i32 0, ptr @timestamp, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %22, %0
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = load i32, ptr %1, align 4, !tbaa !5
  %16 = icmp sle i32 %14, %15
  br i1 %16, label %18, label %17

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

18:                                               ; preds = %13
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [4010 x %"class.std::vector"], ptr @G, i64 0, i64 %20
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %21) #5
  br label %22

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

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

26:                                               ; preds = %39, %25
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = load i32, ptr %1, align 4, !tbaa !5
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

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

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [4010 x %"class.std::vector"], ptr @G, i64 0, i64 %34
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %35, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [4010 x %"class.std::vector"], ptr @G, i64 0, i64 %37
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %38, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %39

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

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

43:                                               ; preds = %62, %42
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = load i32, ptr %1, align 4, !tbaa !5
  %46 = icmp sle i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %65

48:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %6)
  %50 = load i8, ptr %6, align 1, !tbaa !12
  %51 = sext i8 %50 to i32
  %52 = icmp eq i32 %51, 87
  br i1 %52, label %53, label %57

53:                                               ; preds = %48
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [4010 x i32], ptr @val, i64 0, i64 %55
  store i32 1, ptr %56, align 4, !tbaa !5
  br label %61

57:                                               ; preds = %48
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [4010 x i32], ptr @val, i64 0, i64 %59
  store i32 0, ptr %60, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %57, %53
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  br label %62

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

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

66:                                               ; preds = %88, %65
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = load i32, ptr %1, align 4, !tbaa !5
  %69 = icmp sle i32 %67, %68
  br i1 %69, label %71, label %70

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

71:                                               ; preds = %66
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [4010 x i32], ptr @dfn, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [4010 x i32], ptr @val, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = add nsw i32 %76, %83
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %86
  store i32 %84, ptr %87, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %71
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %7, align 4, !tbaa !5
  br label %66, !llvm.loop !14

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

92:                                               ; preds = %132, %91
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = load i32, ptr %1, align 4, !tbaa !5
  %95 = icmp sle i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %135

97:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %98 = load i32, ptr %9, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [4010 x i32], ptr @R, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [4010 x i32], ptr @L, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sub nsw i32 %101, %105
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [4010 x i32], ptr @R, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = load i32, ptr %9, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [4010 x i32], ptr @L, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sub nsw i32 %118, 1
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sub nsw i32 %114, %122
  store i32 %123, ptr %11, align 4, !tbaa !5
  %124 = load i32, ptr %11, align 4, !tbaa !5
  %125 = mul nsw i32 %124, 2
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = icmp eq i32 %125, %126
  br i1 %127, label %128, label %131

128:                                              ; preds = %97
  %129 = load i64, ptr %8, align 8, !tbaa !15
  %130 = add nsw i64 %129, 1
  store i64 %130, ptr %8, align 8, !tbaa !15
  br label %131

131:                                              ; preds = %128, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %9, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %9, align 4, !tbaa !5
  br label %92, !llvm.loop !17

135:                                              ; preds = %96
  %136 = load i64, ptr %8, align 8, !tbaa !15
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %136)
  %138 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %137, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret void
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #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) #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { 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 #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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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 }
%"class.std::basic_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@s = external dso_local local_unnamed_addr global [4010 x i32], align 16
@dfn = external dso_local local_unnamed_addr global [4010 x i32], align 16
@timestamp = external dso_local local_unnamed_addr global i32, align 4
@L = external dso_local local_unnamed_addr global [4010 x i32], align 16
@R = external dso_local local_unnamed_addr global [4010 x i32], align 16
@val = external dso_local local_unnamed_addr global [4010 x i32], align 16
@G = external dso_local global [4010 x %"class.std::vector"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i32 0, ptr @timestamp, align 4, !tbaa !5
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %.not30 = icmp slt i32 %6, 1
  br i1 %.not30, label %._crit_edge40, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 2, ptr %2, align 4, !tbaa !5
  %.not2632 = icmp slt i32 %8, 2
  br i1 %.not2632, label %._crit_edge35, label %.lr.ph34

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %7 = getelementptr inbounds [4010 x %"class.std::vector"], ptr @G, i64 0, i64 %indvars.iv
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %.not.not = icmp slt i64 %indvars.iv, %9
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge35:                                    ; preds = %.lr.ph34, %._crit_edge
  %10 = phi i32 [ %8, %._crit_edge ], [ %20, %.lr.ph34 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %.not2736 = icmp slt i32 %10, 1
  br i1 %.not2736, label %._crit_edge40, label %.lr.ph39

.lr.ph34:                                         ; preds = %._crit_edge, %.lr.ph34
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [4010 x %"class.std::vector"], ptr @G, i64 0, i64 %13
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [4010 x %"class.std::vector"], ptr @G, i64 0, i64 %16
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %.not26.not = icmp slt i32 %18, %20
  br i1 %.not26.not, label %.lr.ph34, label %._crit_edge35, !llvm.loop !11

._crit_edge40:                                    ; preds = %.lr.ph39, %0, %._crit_edge35
  call void @_Z3dfsii(i32 noundef 1, i32 noundef 0)
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %.not2841 = icmp slt i32 %21, 1
  br i1 %.not2841, label %._crit_edge49, label %.lr.ph44.preheader

.lr.ph44.preheader:                               ; preds = %._crit_edge40
  %.pre = load i32, ptr @s, align 16, !tbaa !5
  %22 = zext nneg i32 %21 to i64
  %xtraiter = and i64 %22, 3
  %23 = icmp ult i32 %21, 4
  br i1 %23, label %.preheader.unr-lcssa, label %.lr.ph44.preheader.new

.lr.ph44.preheader.new:                           ; preds = %.lr.ph44.preheader
  %unroll_iter = and i64 %22, 2147483644
  br label %.lr.ph44

.lr.ph39:                                         ; preds = %._crit_edge35, %.lr.ph39
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %.lr.ph39 ], [ 1, %._crit_edge35 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %4)
  %25 = load i8, ptr %4, align 1, !tbaa !12
  %26 = icmp eq i8 %25, 87
  %spec.select66 = zext i1 %26 to i32
  %27 = getelementptr inbounds [4010 x i32], ptr @val, i64 0, i64 %indvars.iv52
  store i32 %spec.select66, ptr %27, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %28 = load i32, ptr %1, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %.not27.not = icmp slt i64 %indvars.iv52, %29
  br i1 %.not27.not, label %.lr.ph39, label %._crit_edge40, !llvm.loop !13

.preheader.unr-lcssa:                             ; preds = %.lr.ph44, %.lr.ph44.preheader
  %.unr = phi i32 [ %.pre, %.lr.ph44.preheader ], [ %66, %.lr.ph44 ]
  %indvars.iv55.unr = phi i64 [ 1, %.lr.ph44.preheader ], [ %indvars.iv.next56.3, %.lr.ph44 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph44.epil

.lr.ph44.epil:                                    ; preds = %.preheader.unr-lcssa, %.lr.ph44.epil
  %30 = phi i32 [ %36, %.lr.ph44.epil ], [ %.unr, %.preheader.unr-lcssa ]
  %indvars.iv55.epil = phi i64 [ %indvars.iv.next56.epil, %.lr.ph44.epil ], [ %indvars.iv55.unr, %.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph44.epil ], [ 0, %.preheader.unr-lcssa ]
  %31 = getelementptr inbounds [4010 x i32], ptr @dfn, i64 0, i64 %indvars.iv55.epil
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [4010 x i32], ptr @val, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = add nsw i32 %35, %30
  %37 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %indvars.iv55.epil
  store i32 %36, ptr %37, align 4, !tbaa !5
  %indvars.iv.next56.epil = add nuw nsw i64 %indvars.iv55.epil, 1
  %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 %.preheader, label %.lr.ph44.epil, !llvm.loop !14

.preheader:                                       ; preds = %.lr.ph44.epil, %.preheader.unr-lcssa
  br i1 %.not2841, label %._crit_edge49, label %.lr.ph48.preheader

.lr.ph48.preheader:                               ; preds = %.preheader
  %38 = add nuw i32 %21, 1
  %wide.trip.count61 = zext i32 %38 to i64
  br label %.lr.ph48

.lr.ph44:                                         ; preds = %.lr.ph44, %.lr.ph44.preheader.new
  %39 = phi i32 [ %.pre, %.lr.ph44.preheader.new ], [ %66, %.lr.ph44 ]
  %indvars.iv55 = phi i64 [ 1, %.lr.ph44.preheader.new ], [ %indvars.iv.next56.3, %.lr.ph44 ]
  %niter = phi i64 [ 0, %.lr.ph44.preheader.new ], [ %niter.next.3, %.lr.ph44 ]
  %40 = getelementptr inbounds [4010 x i32], ptr @dfn, i64 0, i64 %indvars.iv55
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [4010 x i32], ptr @val, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = add nsw i32 %44, %39
  %46 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %indvars.iv55
  store i32 %45, ptr %46, align 4, !tbaa !5
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %47 = getelementptr inbounds [4010 x i32], ptr @dfn, i64 0, i64 %indvars.iv.next56
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [4010 x i32], ptr @val, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, %45
  %53 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %indvars.iv.next56
  store i32 %52, ptr %53, align 4, !tbaa !5
  %indvars.iv.next56.1 = add nuw nsw i64 %indvars.iv55, 2
  %54 = getelementptr inbounds [4010 x i32], ptr @dfn, i64 0, i64 %indvars.iv.next56.1
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [4010 x i32], ptr @val, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = add nsw i32 %58, %52
  %60 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %indvars.iv.next56.1
  store i32 %59, ptr %60, align 4, !tbaa !5
  %indvars.iv.next56.2 = add nuw nsw i64 %indvars.iv55, 3
  %61 = getelementptr inbounds [4010 x i32], ptr @dfn, i64 0, i64 %indvars.iv.next56.2
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [4010 x i32], ptr @val, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add nsw i32 %65, %59
  %67 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %indvars.iv.next56.2
  store i32 %66, ptr %67, align 4, !tbaa !5
  %indvars.iv.next56.3 = add nuw nsw i64 %indvars.iv55, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader.unr-lcssa, label %.lr.ph44, !llvm.loop !16

._crit_edge49:                                    ; preds = %.lr.ph48, %._crit_edge40, %.preheader
  %.024.lcssa = phi i64 [ 0, %.preheader ], [ 0, %._crit_edge40 ], [ %spec.select, %.lr.ph48 ]
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.024.lcssa)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %68, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret void

.lr.ph48:                                         ; preds = %.lr.ph48.preheader, %.lr.ph48
  %indvars.iv58 = phi i64 [ 1, %.lr.ph48.preheader ], [ %indvars.iv.next59, %.lr.ph48 ]
  %.02446 = phi i64 [ 0, %.lr.ph48.preheader ], [ %spec.select, %.lr.ph48 ]
  %70 = getelementptr inbounds [4010 x i32], ptr @R, i64 0, i64 %indvars.iv58
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = getelementptr inbounds [4010 x i32], ptr @L, i64 0, i64 %indvars.iv58
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = add i32 %71, 1
  %75 = sub i32 %74, %73
  %76 = sext i32 %71 to i64
  %77 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = add nsw i32 %73, -1
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [4010 x i32], ptr @s, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = sub nsw i32 %78, %82
  %84 = shl nsw i32 %83, 1
  %85 = icmp eq i32 %84, %75
  %86 = zext i1 %85 to i64
  %spec.select = add nuw nsw i64 %.02446, %86
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %exitcond62.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count61
  br i1 %exitcond62.not, label %._crit_edge49, label %.lr.ph48, !llvm.loop !17
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #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 #4

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { 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 #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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MergedLoadStoreMotionPass,ReassociatePass,SROAPass,SimplifyCFGPass