; LLVM IR from tangjz/acm-icpc :: codeforces/gym (100959F)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@L = external dso_local global [21 x i32], align 16
@R = external dso_local global [21 x i32], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %30, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr @L, i64 %24
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i32, ptr @R, i64 %27
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %25, ptr noundef %28)
  br label %30

30:                                               ; preds = %22
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

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

34:                                               ; preds = %105, %33
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  store i32 5, ptr %4, align 4
  br label %108

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  store i32 %43, ptr %5, align 4, !tbaa !5
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [21 x i32], ptr @L, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = load i32, ptr @m, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [21 x i32], ptr @L, i64 0, i64 %49
  store i32 %47, ptr %50, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %67, %39
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %56, label %64

56:                                               ; preds = %51
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = icmp eq i32 %61, %62
  br label %64

64:                                               ; preds = %56, %51
  %65 = phi i1 [ false, %51 ], [ %63, %56 ]
  br i1 %65, label %66, label %70

66:                                               ; preds = %64
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %3, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %3, align 4, !tbaa !5
  br label %51, !llvm.loop !11

70:                                               ; preds = %64
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [21 x i32], ptr @L, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = load i32, ptr @m, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr @m, align 4, !tbaa !5
  %77 = sext i32 %75 to i64
  %78 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %77
  store i32 %74, ptr %78, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %6, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %96, %70
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 11, ptr %4, align 4
  br label %99

86:                                               ; preds = %81
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = load i32, ptr %5, align 4, !tbaa !5
  %92 = icmp eq i32 %90, %91
  br i1 %92, label %93, label %95

93:                                               ; preds = %86
  %94 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %99

95:                                               ; preds = %86
  br label %96

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

99:                                               ; preds = %93, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %100 = load i32, ptr %4, align 4
  switch i32 %100, label %102 [
    i32 11, label %101
  ]

101:                                              ; preds = %99
  store i32 0, ptr %4, align 4
  br label %102

102:                                              ; preds = %101, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  %103 = load i32, ptr %4, align 4
  switch i32 %103, label %108 [
    i32 0, label %104
  ]

104:                                              ; preds = %102
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %3, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %3, align 4, !tbaa !5
  br label %34, !llvm.loop !13

108:                                              ; preds = %102, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  %109 = load i32, ptr %4, align 4
  switch i32 %109, label %208 [
    i32 5, label %110
    i32 1, label %206
  ]

110:                                              ; preds = %108
  %111 = load i32, ptr @m, align 4, !tbaa !5
  %112 = icmp eq i32 %111, 1
  br i1 %112, label %113, label %115

113:                                              ; preds = %110
  %114 = call i32 @puts(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  br label %206

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

116:                                              ; preds = %200, %115
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = load i32, ptr getelementptr inbounds ([21 x i32], ptr @L, i64 0, i64 1), align 4, !tbaa !5
  %119 = icmp slt i32 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %203

121:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  store i8 1, ptr %9, align 1, !tbaa !14
  %122 = load i32, ptr getelementptr inbounds ([21 x i32], ptr @L, i64 0, i64 1), align 4, !tbaa !5
  store i32 %122, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 -1, ptr %13, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %185, %121
  %124 = load i32, ptr %10, align 4, !tbaa !5
  %125 = load i32, ptr @m, align 4, !tbaa !5
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %123
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %189

128:                                              ; preds = %123
  %129 = load i32, ptr %10, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [21 x i32], ptr @L, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = sub nsw i32 %132, 1
  %134 = load i32, ptr %7, align 4, !tbaa !5
  %135 = sdiv i32 %133, %134
  store i32 %135, ptr %11, align 4, !tbaa !5
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = sub nsw i32 %139, 1
  %141 = load i32, ptr %7, align 4, !tbaa !5
  %142 = sdiv i32 %140, %141
  store i32 %142, ptr %12, align 4, !tbaa !5
  %143 = load i32, ptr %13, align 4, !tbaa !5
  %144 = load i32, ptr %11, align 4, !tbaa !5
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %146, label %150

146:                                              ; preds = %128
  %147 = load i32, ptr %11, align 4, !tbaa !5
  %148 = load i32, ptr %12, align 4, !tbaa !5
  %149 = icmp eq i32 %147, %148
  br label %150

150:                                              ; preds = %146, %128
  %151 = phi i1 [ false, %128 ], [ %149, %146 ]
  %152 = zext i1 %151 to i32
  %153 = load i8, ptr %9, align 1, !tbaa !14, !range !16, !noundef !17
  %154 = trunc i8 %153 to i1
  %155 = zext i1 %154 to i32
  %156 = and i32 %155, %152
  %157 = icmp ne i32 %156, 0
  %158 = zext i1 %157 to i8
  store i8 %158, ptr %9, align 1, !tbaa !14
  %159 = load i32, ptr %11, align 4, !tbaa !5
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %161, label %171

161:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %162 = load i32, ptr %10, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [21 x i32], ptr @L, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = sub nsw i32 %165, 1
  %167 = load i32, ptr %11, align 4, !tbaa !5
  %168 = sdiv i32 %166, %167
  store i32 %168, ptr %14, align 4, !tbaa !5
  %169 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %170 = load i32, ptr %169, align 4, !tbaa !5
  store i32 %170, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %171

171:                                              ; preds = %161, %150
  %172 = load i32, ptr %12, align 4, !tbaa !5
  %173 = icmp ne i32 %172, 0
  br i1 %173, label %174, label %184

174:                                              ; preds = %171
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %175 = load i32, ptr %10, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = sub nsw i32 %178, 1
  %180 = load i32, ptr %12, align 4, !tbaa !5
  %181 = sdiv i32 %179, %180
  store i32 %181, ptr %15, align 4, !tbaa !5
  %182 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %183 = load i32, ptr %182, align 4, !tbaa !5
  store i32 %183, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %184

184:                                              ; preds = %174, %171
  br label %185

185:                                              ; preds = %184
  %186 = load i32, ptr %10, align 4, !tbaa !5
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %10, align 4, !tbaa !5
  %188 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %188, ptr %13, align 4, !tbaa !5
  br label %123, !llvm.loop !18

189:                                              ; preds = %127
  %190 = load i8, ptr %9, align 1, !tbaa !14, !range !16, !noundef !17
  %191 = trunc i8 %190 to i1
  br i1 %191, label %192, label %199

192:                                              ; preds = %189
  %193 = load i32, ptr %8, align 4, !tbaa !5
  %194 = load i32, ptr %7, align 4, !tbaa !5
  %195 = sub nsw i32 %193, %194
  %196 = add nsw i32 %195, 1
  %197 = load i32, ptr @ans, align 4, !tbaa !5
  %198 = add nsw i32 %197, %196
  store i32 %198, ptr @ans, align 4, !tbaa !5
  br label %199

199:                                              ; preds = %192, %189
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  br label %200

200:                                              ; preds = %199
  %201 = load i32, ptr %8, align 4, !tbaa !5
  %202 = add nsw i32 %201, 1
  store i32 %202, ptr %7, align 4, !tbaa !5
  br label %116, !llvm.loop !19

203:                                              ; preds = %120
  %204 = load i32, ptr @ans, align 4, !tbaa !5
  %205 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %204)
  store i32 0, ptr %1, align 4
  br label %206

206:                                              ; preds = %203, %113, %108
  %207 = load i32, ptr %1, align 4
  ret i32 %207

208:                                              ; preds = %108
  unreachable
}

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

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

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

declare i32 @puts(ptr noundef) #1

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

declare i32 @printf(ptr 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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"

@n = external dso_local global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@L = external dso_local global [21 x i32], align 16
@R = external dso_local global [21 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

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

.preheader.thread:                                ; preds = %0
  %m.promoted106 = load i32, ptr @m, align 4, !tbaa !5
  br label %48

.preheader:                                       ; preds = %.lr.ph
  %m.promoted = load i32, ptr @m, align 4, !tbaa !5
  %7 = icmp sgt i32 %13, 0
  br i1 %7, label %.lr.ph70.preheader, label %48

.lr.ph70.preheader:                               ; preds = %.preheader
  %8 = zext nneg i32 %13 to i64
  %9 = sext i32 %m.promoted to i64
  br label %.lr.ph70

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %10 = getelementptr inbounds i32, ptr @L, i64 %indvars.iv
  %11 = getelementptr inbounds i32, ptr @R, i64 %indvars.iv
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %indvars.iv.next, %14
  br i1 %15, label %.lr.ph, label %.preheader, !llvm.loop !9

.loopexit:                                        ; preds = %40
  br i1 %.not66, label %.lr.ph70, label %._crit_edge

.lr.ph70:                                         ; preds = %.lr.ph70.preheader, %.loopexit
  %indvars.iv98 = phi i64 [ %9, %.lr.ph70.preheader ], [ %indvars.iv.next99, %.loopexit ]
  %.05069 = phi i32 [ 0, %.lr.ph70.preheader ], [ %34, %.loopexit ]
  %16 = sext i32 %.05069 to i64
  %17 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = getelementptr inbounds [21 x i32], ptr @L, i64 0, i64 %16
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = getelementptr inbounds [21 x i32], ptr @L, i64 0, i64 %indvars.iv98
  store i32 %20, ptr %21, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %30, %.lr.ph70
  %indvars.iv92 = phi i64 [ %indvars.iv.next93, %30 ], [ %16, %.lr.ph70 ]
  %indvars.iv.next93 = add nsw i64 %indvars.iv92, 1
  %23 = icmp slt i64 %indvars.iv.next93, %8
  br i1 %23, label %30, label %.critedge.thread

.critedge.thread:                                 ; preds = %22
  %24 = add nsw i32 %.05069, 1
  %smax.le = tail call i32 @llvm.smax.i32(i32 %13, i32 %24)
  %25 = add nsw i32 %smax.le, -1
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [21 x i32], ptr @L, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %indvars.iv.next99109 = add nsw i64 %indvars.iv98, 1
  %29 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %indvars.iv98
  store i32 %28, ptr %29, align 4, !tbaa !5
  br label %._crit_edge

30:                                               ; preds = %22
  %31 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %indvars.iv.next93
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = icmp eq i32 %32, %18
  br i1 %33, label %22, label %.critedge, !llvm.loop !11

.critedge:                                        ; preds = %30
  %34 = trunc nsw i64 %indvars.iv.next93 to i32
  %sext = shl i64 %indvars.iv92, 32
  %35 = ashr exact i64 %sext, 32
  %36 = getelementptr inbounds [21 x i32], ptr @L, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %indvars.iv.next99 = add nsw i64 %indvars.iv98, 1
  %38 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %indvars.iv98
  store i32 %37, ptr %38, align 4, !tbaa !5
  %.not66 = icmp sgt i32 %13, %34
  br i1 %.not66, label %.lr.ph68.preheader, label %._crit_edge

.lr.ph68.preheader:                               ; preds = %.critedge
  %sext126 = shl i64 %indvars.iv.next93, 32
  %39 = ashr exact i64 %sext126, 32
  br label %.lr.ph68

40:                                               ; preds = %.lr.ph68
  %indvars.iv.next96 = add nsw i64 %indvars.iv95, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next96 to i32
  %exitcond.not = icmp eq i32 %13, %lftr.wideiv
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph68, !llvm.loop !12

.lr.ph68:                                         ; preds = %.lr.ph68.preheader, %40
  %indvars.iv95 = phi i64 [ %39, %.lr.ph68.preheader ], [ %indvars.iv.next96, %40 ]
  %41 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %indvars.iv95
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = icmp eq i32 %42, %18
  br i1 %43, label %44, label %40

44:                                               ; preds = %.lr.ph68
  %45 = trunc nsw i64 %indvars.iv.next99 to i32
  store i32 %45, ptr @m, align 4, !tbaa !5
  %46 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %104

._crit_edge:                                      ; preds = %.critedge, %.loopexit, %.critedge.thread
  %indvars.iv.next99111 = phi i64 [ %indvars.iv.next99109, %.critedge.thread ], [ %indvars.iv.next99, %.loopexit ], [ %indvars.iv.next99, %.critedge ]
  %47 = trunc nsw i64 %indvars.iv.next99111 to i32
  store i32 %47, ptr @m, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %.preheader.thread, %._crit_edge, %.preheader
  %49 = phi i32 [ %47, %._crit_edge ], [ %m.promoted, %.preheader ], [ %m.promoted106, %.preheader.thread ]
  %50 = icmp eq i32 %49, 1
  br i1 %50, label %51, label %53

51:                                               ; preds = %48
  %52 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %104

53:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @L, i64 4), align 4, !tbaa !5
  %55 = icmp sgt i32 %54, 1
  br i1 %55, label %.lr.ph81, label %._crit_edge82

.lr.ph81:                                         ; preds = %53
  %56 = icmp sgt i32 %49, 0
  br i1 %56, label %.lr.ph81.split, label %._crit_edge82.split.us

._crit_edge82.split.us:                           ; preds = %.lr.ph81
  %ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
  %57 = add nsw i32 %54, %ans.promoted
  store i32 %57, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge82

._crit_edge82:                                    ; preds = %98, %._crit_edge82.split.us, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %58 = load i32, ptr @ans, align 4, !tbaa !5
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %58)
  br label %104

.lr.ph81.split:                                   ; preds = %.lr.ph81, %98
  %60 = phi i32 [ %100, %98 ], [ %49, %.lr.ph81 ]
  %61 = phi i32 [ %102, %98 ], [ %54, %.lr.ph81 ]
  %.04879 = phi i32 [ %101, %98 ], [ 1, %.lr.ph81 ]
  store i32 %61, ptr %1, align 4, !tbaa !5
  %62 = icmp sgt i32 %60, 0
  br i1 %62, label %.lr.ph77, label %.critedge85

._crit_edge78:                                    ; preds = %88
  br i1 %75, label %.critedge85, label %98

.lr.ph77:                                         ; preds = %.lr.ph81.split, %88
  %63 = phi i32 [ %89, %88 ], [ %61, %.lr.ph81.split ]
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %88 ], [ 0, %.lr.ph81.split ]
  %.075 = phi i32 [ %71, %88 ], [ -1, %.lr.ph81.split ]
  %.04773 = phi i1 [ %75, %88 ], [ true, %.lr.ph81.split ]
  %64 = getelementptr inbounds [21 x i32], ptr @L, i64 0, i64 %indvars.iv104
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add nsw i32 %65, -1
  %67 = sdiv i32 %66, %.04879
  %68 = getelementptr inbounds [21 x i32], ptr @R, i64 0, i64 %indvars.iv104
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = add nsw i32 %69, -1
  %71 = sdiv i32 %70, %.04879
  %72 = icmp slt i32 %.075, %67
  %73 = icmp eq i32 %67, %71
  %74 = select i1 %72, i1 %73, i1 false
  %75 = and i1 %.04773, %74
  %.not58 = icmp eq i32 %67, 0
  br i1 %.not58, label %80, label %76

76:                                               ; preds = %.lr.ph77
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %77 = sdiv i32 %66, %67
  store i32 %77, ptr %2, align 4, !tbaa !5
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %79 = load i32, ptr %78, align 4, !tbaa !5
  store i32 %79, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  br label %80

80:                                               ; preds = %76, %.lr.ph77
  %81 = phi i32 [ %79, %76 ], [ %63, %.lr.ph77 ]
  %.not59 = icmp eq i32 %71, 0
  br i1 %.not59, label %88, label %82

82:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %83 = load i32, ptr %68, align 4, !tbaa !5
  %84 = add nsw i32 %83, -1
  %85 = sdiv i32 %84, %71
  store i32 %85, ptr %3, align 4, !tbaa !5
  %86 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %87 = load i32, ptr %86, align 4, !tbaa !5
  store i32 %87, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  br label %88

88:                                               ; preds = %80, %82
  %89 = phi i32 [ %81, %80 ], [ %87, %82 ]
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %90 = load i32, ptr @m, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = icmp slt i64 %indvars.iv.next105, %91
  br i1 %92, label %.lr.ph77, label %._crit_edge78, !llvm.loop !13

.critedge85:                                      ; preds = %.lr.ph81.split, %._crit_edge78
  %93 = phi i32 [ %61, %.lr.ph81.split ], [ %89, %._crit_edge78 ]
  %94 = phi i32 [ %60, %.lr.ph81.split ], [ %90, %._crit_edge78 ]
  %95 = load i32, ptr @ans, align 4, !tbaa !5
  %reass.sub = sub i32 %93, %.04879
  %96 = add i32 %reass.sub, 1
  %97 = add nsw i32 %96, %95
  store i32 %97, ptr @ans, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %.critedge85, %._crit_edge78
  %99 = phi i32 [ %93, %.critedge85 ], [ %89, %._crit_edge78 ]
  %100 = phi i32 [ %94, %.critedge85 ], [ %90, %._crit_edge78 ]
  %101 = add nsw i32 %99, 1
  %102 = load i32, ptr getelementptr inbounds (i8, ptr @L, i64 4), align 4, !tbaa !5
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %.lr.ph81.split, label %._crit_edge82, !llvm.loop !14

104:                                              ; preds = %44, %._crit_edge82, %51
  ret i32 0
}

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

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

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

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

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

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

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

attributes #0 = { mustprogress norecurse 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 #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}


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