; LLVM IR from Tunghohin/Competitive_Coding :: Codeforces (cf1559_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_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" }

@rd = external dso_local global [10010 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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
  store i32 0, ptr %1, align 4
  %12 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %13 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %15
  %17 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  %18 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %19 = getelementptr i8, ptr %18, i64 -24
  %20 = load i64, ptr %19, align 8
  %21 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %20
  %22 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %21, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %24

24:                                               ; preds = %154, %0
  %25 = load i32, ptr %2, align 4, !tbaa !8
  %26 = add nsw i32 %25, -1
  store i32 %26, ptr %2, align 4, !tbaa !8
  %27 = icmp ne i32 %25, 0
  br i1 %27, label %28, label %155

28:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %29 = 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)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !8
  br label %30

30:                                               ; preds = %40, %28
  %31 = load i32, ptr %4, align 4, !tbaa !8
  %32 = load i32, ptr %3, align 4, !tbaa !8
  %33 = icmp sle i32 %31, %32
  br i1 %33, label %35, label %34

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

35:                                               ; preds = %30
  %36 = load i32, ptr %4, align 4, !tbaa !8
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [10010 x i32], ptr @rd, i64 0, i64 %37
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %38)
  br label %40

40:                                               ; preds = %35
  %41 = load i32, ptr %4, align 4, !tbaa !8
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %4, align 4, !tbaa !8
  br label %30, !llvm.loop !11

43:                                               ; preds = %34
  %44 = load i32, ptr getelementptr inbounds ([10010 x i32], ptr @rd, i64 0, i64 1), align 4, !tbaa !8
  %45 = icmp eq i32 %44, 1
  br i1 %45, label %46, label %67

46:                                               ; preds = %43
  %47 = load i32, ptr %3, align 4, !tbaa !8
  %48 = add nsw i32 %47, 1
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %48)
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %49, i8 noundef signext 32)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !8
  br label %51

51:                                               ; preds = %60, %46
  %52 = load i32, ptr %5, align 4, !tbaa !8
  %53 = load i32, ptr %3, align 4, !tbaa !8
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %63

56:                                               ; preds = %51
  %57 = load i32, ptr %5, align 4, !tbaa !8
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %57)
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %58, i8 noundef signext 32)
  br label %60

60:                                               ; preds = %56
  %61 = load i32, ptr %5, align 4, !tbaa !8
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %5, align 4, !tbaa !8
  br label %51, !llvm.loop !13

63:                                               ; preds = %55
  %64 = load i32, ptr %3, align 4, !tbaa !8
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %64)
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %65, i8 noundef signext 10)
  br label %154

67:                                               ; preds = %43
  %68 = load i32, ptr %3, align 4, !tbaa !8
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [10010 x i32], ptr @rd, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !8
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %91

73:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !8
  br label %74

74:                                               ; preds = %83, %73
  %75 = load i32, ptr %6, align 4, !tbaa !8
  %76 = load i32, ptr %3, align 4, !tbaa !8
  %77 = icmp sle i32 %75, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %86

79:                                               ; preds = %74
  %80 = load i32, ptr %6, align 4, !tbaa !8
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %80)
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %81, i8 noundef signext 32)
  br label %83

83:                                               ; preds = %79
  %84 = load i32, ptr %6, align 4, !tbaa !8
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %6, align 4, !tbaa !8
  br label %74, !llvm.loop !14

86:                                               ; preds = %78
  %87 = load i32, ptr %3, align 4, !tbaa !8
  %88 = add nsw i32 %87, 1
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %88)
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %89, i8 noundef signext 10)
  br label %153

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

92:                                               ; preds = %113, %91
  %93 = load i32, ptr %8, align 4, !tbaa !8
  %94 = load i32, ptr %3, align 4, !tbaa !8
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  store i32 13, ptr %9, align 4
  br label %116

97:                                               ; preds = %92
  %98 = load i32, ptr %8, align 4, !tbaa !8
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [10010 x i32], ptr @rd, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !8
  %102 = icmp eq i32 %101, 0
  br i1 %102, label %103, label %112

103:                                              ; preds = %97
  %104 = load i32, ptr %8, align 4, !tbaa !8
  %105 = add nsw i32 %104, 1
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [10010 x i32], ptr @rd, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !8
  %109 = icmp eq i32 %108, 1
  br i1 %109, label %110, label %112

110:                                              ; preds = %103
  %111 = load i32, ptr %8, align 4, !tbaa !8
  store i32 %111, ptr %7, align 4, !tbaa !8
  store i32 13, ptr %9, align 4
  br label %116

112:                                              ; preds = %103, %97
  br label %113

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

116:                                              ; preds = %110, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %117

117:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !8
  br label %118

118:                                              ; preds = %127, %117
  %119 = load i32, ptr %10, align 4, !tbaa !8
  %120 = load i32, ptr %7, align 4, !tbaa !8
  %121 = icmp sle i32 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  store i32 16, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %130

123:                                              ; preds = %118
  %124 = load i32, ptr %10, align 4, !tbaa !8
  %125 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %124)
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %125, i8 noundef signext 32)
  br label %127

127:                                              ; preds = %123
  %128 = load i32, ptr %10, align 4, !tbaa !8
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %10, align 4, !tbaa !8
  br label %118, !llvm.loop !16

130:                                              ; preds = %122
  %131 = load i32, ptr %3, align 4, !tbaa !8
  %132 = add nsw i32 %131, 1
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %132)
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %133, i8 noundef signext 32)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %135 = load i32, ptr %7, align 4, !tbaa !8
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %11, align 4, !tbaa !8
  br label %137

137:                                              ; preds = %146, %130
  %138 = load i32, ptr %11, align 4, !tbaa !8
  %139 = load i32, ptr %3, align 4, !tbaa !8
  %140 = icmp slt i32 %138, %139
  br i1 %140, label %142, label %141

141:                                              ; preds = %137
  store i32 19, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %149

142:                                              ; preds = %137
  %143 = load i32, ptr %11, align 4, !tbaa !8
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %143)
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %144, i8 noundef signext 32)
  br label %146

146:                                              ; preds = %142
  %147 = load i32, ptr %11, align 4, !tbaa !8
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %11, align 4, !tbaa !8
  br label %137, !llvm.loop !17

149:                                              ; preds = %141
  %150 = load i32, ptr %3, align 4, !tbaa !8
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %150)
  %152 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %151, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %153

153:                                              ; preds = %149, %86
  br label %154

154:                                              ; preds = %153, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %24, !llvm.loop !18

155:                                              ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %156 = load i32, ptr %1, align 4
  ret i32 %156
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

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

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

; 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

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

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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !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}
!18 = distinct !{!18, !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::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" }

@rd = external dso_local global [10010 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %4 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %5 = getelementptr i8, ptr %4, i64 -24
  %6 = load i64, ptr %5, align 8
  %7 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %6
  %8 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %7, ptr noundef null)
  %9 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %14 = 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)
  %15 = load i32, ptr %1, align 4, !tbaa !8
  %16 = add nsw i32 %15, -1
  store i32 %16, ptr %1, align 4, !tbaa !8
  %.not69 = icmp eq i32 %15, 0
  br i1 %.not69, label %._crit_edge72, label %.lr.ph71

.lr.ph71:                                         ; preds = %0, %._crit_edge67
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %18 = load i32, ptr %2, align 4, !tbaa !8
  %.not3340 = icmp slt i32 %18, 1
  br i1 %.not3340, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph71
  %19 = phi i32 [ %18, %.lr.ph71 ], [ %24, %.lr.ph ]
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @rd, i64 4), align 4, !tbaa !8
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %26, label %37

.lr.ph:                                           ; preds = %.lr.ph71, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph71 ]
  %22 = getelementptr inbounds [10010 x i32], ptr @rd, i64 0, i64 %indvars.iv
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %22)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr %2, align 4, !tbaa !8
  %25 = sext i32 %24 to i64
  %.not33.not = icmp slt i64 %indvars.iv, %25
  br i1 %.not33.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

26:                                               ; preds = %._crit_edge
  %27 = add nsw i32 %19, 1
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %27)
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %28, i8 noundef signext 32)
  %30 = load i32, ptr %2, align 4, !tbaa !8
  %31 = icmp sgt i32 %30, 1
  br i1 %31, label %.lr.ph66, label %._crit_edge67

.lr.ph66:                                         ; preds = %26, %.lr.ph66
  %.02764 = phi i32 [ %34, %.lr.ph66 ], [ 1, %26 ]
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.02764)
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %32, i8 noundef signext 32)
  %34 = add nuw nsw i32 %.02764, 1
  %35 = load i32, ptr %2, align 4, !tbaa !8
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %.lr.ph66, label %._crit_edge67, !llvm.loop !13

37:                                               ; preds = %._crit_edge
  %38 = sext i32 %19 to i64
  %39 = getelementptr inbounds [10010 x i32], ptr @rd, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !8
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %.preheader, label %.preheader36

.preheader36:                                     ; preds = %37
  %42 = icmp sgt i32 %19, 1
  br i1 %42, label %.lr.ph43.preheader, label %._crit_edge52

.lr.ph43.preheader:                               ; preds = %.preheader36
  %wide.trip.count = zext nneg i32 %19 to i64
  br label %.lr.ph43

.preheader:                                       ; preds = %37
  %.not3559 = icmp slt i32 %19, 1
  br i1 %.not3559, label %._crit_edge62, label %.lr.ph61

._crit_edge62:                                    ; preds = %.lr.ph61, %.preheader
  %.lcssa38 = phi i32 [ %19, %.preheader ], [ %47, %.lr.ph61 ]
  %43 = add nsw i32 %.lcssa38, 1
  br label %._crit_edge67

.lr.ph61:                                         ; preds = %.preheader, %.lr.ph61
  %.02660 = phi i32 [ %46, %.lr.ph61 ], [ 1, %.preheader ]
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.02660)
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %44, i8 noundef signext 32)
  %46 = add nuw nsw i32 %.02660, 1
  %47 = load i32, ptr %2, align 4, !tbaa !8
  %.not35.not = icmp slt i32 %.02660, %47
  br i1 %.not35.not, label %.lr.ph61, label %._crit_edge62, !llvm.loop !14

.lr.ph43:                                         ; preds = %.lr.ph43.preheader, %.lr.ph43._crit_edge
  %indvars.iv78 = phi i64 [ 1, %.lr.ph43.preheader ], [ %51, %.lr.ph43._crit_edge ]
  %48 = getelementptr inbounds [10010 x i32], ptr @rd, i64 0, i64 %indvars.iv78
  %49 = load i32, ptr %48, align 4, !tbaa !8
  %50 = icmp eq i32 %49, 0
  %51 = add nuw nsw i64 %indvars.iv78, 1
  br i1 %50, label %52, label %.lr.ph43._crit_edge

52:                                               ; preds = %.lr.ph43
  %53 = getelementptr inbounds [10010 x i32], ptr @rd, i64 0, i64 %51
  %54 = load i32, ptr %53, align 4, !tbaa !8
  %55 = icmp eq i32 %54, 1
  br i1 %55, label %._crit_edge44, label %.lr.ph43._crit_edge

.lr.ph43._crit_edge:                              ; preds = %.lr.ph43, %52
  %exitcond.not = icmp eq i64 %51, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge52, label %.lr.ph43, !llvm.loop !15

._crit_edge44:                                    ; preds = %52
  %56 = trunc nuw nsw i64 %indvars.iv78 to i32
  %57 = add nuw nsw i32 %56, 1
  br label %.lr.ph51

._crit_edge52.loopexit:                           ; preds = %.lr.ph51
  %.pre = load i32, ptr %2, align 4, !tbaa !8
  br label %._crit_edge52

._crit_edge52:                                    ; preds = %.lr.ph43._crit_edge, %.preheader36, %._crit_edge52.loopexit
  %.053.pre-phi = phi i32 [ %57, %._crit_edge52.loopexit ], [ 1, %.preheader36 ], [ 1, %.lr.ph43._crit_edge ]
  %58 = phi i32 [ %.pre, %._crit_edge52.loopexit ], [ %19, %.preheader36 ], [ %19, %.lr.ph43._crit_edge ]
  %59 = add nsw i32 %58, 1
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %59)
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %60, i8 noundef signext 32)
  %62 = load i32, ptr %2, align 4, !tbaa !8
  %63 = icmp slt i32 %.053.pre-phi, %62
  br i1 %63, label %.lr.ph56, label %._crit_edge67

.lr.ph51:                                         ; preds = %._crit_edge44, %.lr.ph51
  %.02349 = phi i32 [ %66, %.lr.ph51 ], [ 1, %._crit_edge44 ]
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.02349)
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %64, i8 noundef signext 32)
  %66 = add nuw nsw i32 %.02349, 1
  %exitcond81.not = icmp eq i32 %.02349, %56
  br i1 %exitcond81.not, label %._crit_edge52.loopexit, label %.lr.ph51, !llvm.loop !16

.lr.ph56:                                         ; preds = %._crit_edge52, %.lr.ph56
  %.054 = phi i32 [ %.0, %.lr.ph56 ], [ %.053.pre-phi, %._crit_edge52 ]
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.054)
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %67, i8 noundef signext 32)
  %.0 = add nuw nsw i32 %.054, 1
  %69 = load i32, ptr %2, align 4, !tbaa !8
  %70 = icmp slt i32 %.0, %69
  br i1 %70, label %.lr.ph56, label %._crit_edge67, !llvm.loop !17

._crit_edge67:                                    ; preds = %.lr.ph56, %.lr.ph66, %._crit_edge52, %26, %._crit_edge62
  %.sink91 = phi i32 [ %43, %._crit_edge62 ], [ %30, %26 ], [ %62, %._crit_edge52 ], [ %35, %.lr.ph66 ], [ %69, %.lr.ph56 ]
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.sink91)
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %71, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %73 = load i32, ptr %1, align 4, !tbaa !8
  %74 = add nsw i32 %73, -1
  store i32 %74, ptr %1, align 4, !tbaa !8
  %.not = icmp eq i32 %73, 0
  br i1 %.not, label %._crit_edge72, label %.lr.ph71, !llvm.loop !18

._crit_edge72:                                    ; preds = %._crit_edge67, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

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

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

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 #1

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

; 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

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

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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !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}
!18 = distinct !{!18, !12}


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