; LLVM IR from tangjz/acm-icpc :: codeforces/complete (938F)

; 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
@buf = external dso_local global [5001 x i8], align 16
@out = external dso_local global [5001 x i8], align 16
@f = external dso_local global [5001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 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
  store i32 0, ptr %1, align 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @buf)
  %10 = call i64 @strlen(ptr noundef @buf) #5
  %11 = trunc i64 %10 to i32
  store i32 %11, ptr @n, align 4, !tbaa !5
  store i32 0, ptr @m, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %18, %0
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = shl i32 2, %13
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = icmp sle i32 %14, %15
  br i1 %16, label %17, label %21

17:                                               ; preds = %12
  br label %18

18:                                               ; preds = %17
  %19 = load i32, ptr @m, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr @m, align 4, !tbaa !5
  br label %12, !llvm.loop !9

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

22:                                               ; preds = %32, %21
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = load i32, ptr @m, align 4, !tbaa !5
  %25 = shl i32 1, %24
  %26 = icmp slt i32 %23, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %35

28:                                               ; preds = %22
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %30
  store i8 1, ptr %31, align 1, !tbaa !11
  br label %32

32:                                               ; preds = %28
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %22, !llvm.loop !13

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

36:                                               ; preds = %160, %35
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = load i32, ptr @m, align 4, !tbaa !5
  %40 = shl i32 1, %39
  %41 = sub nsw i32 %38, %40
  %42 = icmp sle i32 %37, %41
  br i1 %42, label %44, label %43

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

44:                                               ; preds = %36
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [5001 x i8], ptr @out, i64 0, i64 %46
  store i8 122, ptr %47, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %75, %44
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = load i32, ptr @m, align 4, !tbaa !5
  %51 = shl i32 1, %50
  %52 = icmp slt i32 %49, %51
  br i1 %52, label %54, label %53

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

54:                                               ; preds = %48
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %56
  %58 = load i8, ptr %57, align 1, !tbaa !11, !range !15, !noundef !16
  %59 = trunc i8 %58 to i1
  br i1 %59, label %60, label %74

60:                                               ; preds = %54
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [5001 x i8], ptr @out, i64 0, i64 %62
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = add nsw i32 %64, %65
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [5001 x i8], ptr @buf, i64 0, i64 %67
  %69 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3minIcERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %63, ptr noundef nonnull align 1 dereferenceable(1) %68)
  %70 = load i8, ptr %69, align 1, !tbaa !14
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [5001 x i8], ptr @out, i64 0, i64 %72
  store i8 %70, ptr %73, align 1, !tbaa !14
  br label %74

74:                                               ; preds = %60, %54
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %5, align 4, !tbaa !5
  br label %48, !llvm.loop !17

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

79:                                               ; preds = %111, %78
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = load i32, ptr @m, align 4, !tbaa !5
  %82 = shl i32 1, %81
  %83 = icmp slt i32 %80, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %79
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %114

85:                                               ; preds = %79
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %87
  %89 = load i8, ptr %88, align 1, !tbaa !11, !range !15, !noundef !16
  %90 = trunc i8 %89 to i1
  br i1 %90, label %91, label %105

91:                                               ; preds = %85
  %92 = load i32, ptr %3, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [5001 x i8], ptr @out, i64 0, i64 %93
  %95 = load i8, ptr %94, align 1, !tbaa !14
  %96 = sext i8 %95 to i32
  %97 = load i32, ptr %3, align 4, !tbaa !5
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = add nsw i32 %97, %98
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [5001 x i8], ptr @buf, i64 0, i64 %100
  %102 = load i8, ptr %101, align 1, !tbaa !14
  %103 = sext i8 %102 to i32
  %104 = icmp eq i32 %96, %103
  br label %105

105:                                              ; preds = %91, %85
  %106 = phi i1 [ false, %85 ], [ %104, %91 ]
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %108
  %110 = zext i1 %106 to i8
  store i8 %110, ptr %109, align 1, !tbaa !11
  br label %111

111:                                              ; preds = %105
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %6, align 4, !tbaa !5
  br label %79, !llvm.loop !18

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

115:                                              ; preds = %156, %114
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = load i32, ptr @m, align 4, !tbaa !5
  %118 = shl i32 1, %117
  %119 = icmp slt i32 %116, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %115
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %159

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

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

127:                                              ; preds = %122
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %155

128:                                              ; preds = %122
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = load i32, ptr %7, align 4, !tbaa !5
  %131 = and i32 %129, %130
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %151

133:                                              ; preds = %128
  %134 = load i32, ptr %8, align 4, !tbaa !5
  %135 = load i32, ptr %7, align 4, !tbaa !5
  %136 = xor i32 %134, %135
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %137
  %139 = load i8, ptr %138, align 1, !tbaa !11, !range !15, !noundef !16
  %140 = trunc i8 %139 to i1
  %141 = zext i1 %140 to i32
  %142 = load i32, ptr %8, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %143
  %145 = load i8, ptr %144, align 1, !tbaa !11, !range !15, !noundef !16
  %146 = trunc i8 %145 to i1
  %147 = zext i1 %146 to i32
  %148 = or i32 %147, %141
  %149 = icmp ne i32 %148, 0
  %150 = zext i1 %149 to i8
  store i8 %150, ptr %144, align 1, !tbaa !11
  br label %151

151:                                              ; preds = %133, %128
  br label %152

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

155:                                              ; preds = %127
  br label %156

156:                                              ; preds = %155
  %157 = load i32, ptr %7, align 4, !tbaa !5
  %158 = shl i32 %157, 1
  store i32 %158, ptr %7, align 4, !tbaa !5
  br label %115, !llvm.loop !20

159:                                              ; preds = %120
  br label %160

160:                                              ; preds = %159
  %161 = load i32, ptr %3, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %3, align 4, !tbaa !5
  br label %36, !llvm.loop !21

163:                                              ; preds = %43
  %164 = load i32, ptr @n, align 4, !tbaa !5
  %165 = load i32, ptr @m, align 4, !tbaa !5
  %166 = shl i32 1, %165
  %167 = sub nsw i32 %164, %166
  %168 = add nsw i32 %167, 1
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [5001 x i8], ptr @out, i64 0, i64 %169
  store i8 0, ptr %170, align 1, !tbaa !14
  %171 = call i32 @puts(ptr noundef @out)
  ret i32 0
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

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

; 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 nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3minIcERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) #4

declare i32 @puts(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 = { nounwind willreturn memory(read) "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 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 #5 = { nounwind willreturn memory(read) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{!7, !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !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 local_unnamed_addr global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@buf = external dso_local global [5001 x i8], align 16
@out = external dso_local global [5001 x i8], align 16
@f = external dso_local local_unnamed_addr global [5001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @buf)
  %2 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @buf) #5
  %3 = trunc i64 %2 to i32
  store i32 %3, ptr @n, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %4, %0
  %5 = phi i32 [ 0, %0 ], [ %7, %4 ]
  %6 = shl i32 2, %5
  %.not = icmp sgt i32 %6, %3
  %7 = add nuw nsw i32 %5, 1
  br i1 %.not, label %.preheader40, label %4, !llvm.loop !9

.preheader40:                                     ; preds = %4
  store i32 %5, ptr @m, align 4, !tbaa !5
  %.not57 = icmp eq i32 %5, 31
  br i1 %.not57, label %.preheader39, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader40
  %8 = shl nuw nsw i32 1, %5
  %9 = zext nneg i32 %8 to i64
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @f, i8 1, i64 %9, i1 false), !tbaa !11
  br label %.preheader39

.preheader39:                                     ; preds = %.lr.ph.preheader, %.preheader40
  %.neg52 = shl nsw i32 -1, %5
  %10 = add i32 %.neg52, %3
  %.not3553 = icmp slt i32 %10, 0
  br i1 %.not3553, label %._crit_edge, label %.lr.ph55

._crit_edge:                                      ; preds = %._crit_edge51.split.us, %.preheader39
  %.lcssa41 = phi i32 [ %10, %.preheader39 ], [ %106, %._crit_edge51.split.us ]
  %11 = add nsw i32 %.lcssa41, 1
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [5001 x i8], ptr @out, i64 0, i64 %12
  store i8 0, ptr %13, align 1, !tbaa !13
  %14 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @out)
  ret i32 0

.lr.ph55:                                         ; preds = %.preheader39, %._crit_edge51.split.us
  %15 = phi i32 [ %104, %._crit_edge51.split.us ], [ %5, %.preheader39 ]
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %._crit_edge51.split.us ], [ 0, %.preheader39 ]
  %16 = getelementptr inbounds [5001 x i8], ptr @out, i64 0, i64 %indvars.iv71
  store i8 122, ptr %16, align 1, !tbaa !13
  %.not58 = icmp eq i32 %15, 31
  br i1 %.not58, label %._crit_edge51.split.us, label %.lr.ph45

.preheader38:                                     ; preds = %30
  %.not81 = icmp eq i32 %33, 31
  br i1 %.not81, label %._crit_edge51.split.us, label %.lr.ph47.preheader

.lr.ph47.preheader:                               ; preds = %.preheader38
  %wide.trip.count = zext i32 %34 to i64
  %17 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %wide.trip.count, 1
  %18 = icmp eq i64 %17, 0
  br i1 %18, label %.preheader37.unr-lcssa, label %.lr.ph47.preheader.new

.lr.ph47.preheader.new:                           ; preds = %.lr.ph47.preheader
  %unroll_iter = and i64 %wide.trip.count, 4294967294
  br label %.lr.ph47

.lr.ph45:                                         ; preds = %.lr.ph55, %30
  %19 = phi i32 [ %31, %30 ], [ %15, %.lr.ph55 ]
  %20 = phi i8 [ %32, %30 ], [ 122, %.lr.ph55 ]
  %21 = phi i32 [ %33, %30 ], [ %15, %.lr.ph55 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %30 ], [ 0, %.lr.ph55 ]
  %22 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %indvars.iv
  %23 = load i8, ptr %22, align 1, !tbaa !11, !range !14, !noundef !15
  %24 = trunc nuw i8 %23 to i1
  br i1 %24, label %25, label %30

25:                                               ; preds = %.lr.ph45
  %26 = add nuw nsw i64 %indvars.iv, %indvars.iv71
  %27 = getelementptr inbounds [5001 x i8], ptr @buf, i64 0, i64 %26
  %28 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZSt3minIcERKT_S2_S2_(ptr noundef nonnull align 1 dereferenceable(1) %16, ptr noundef nonnull align 1 dereferenceable(1) %27)
  %29 = load i8, ptr %28, align 1, !tbaa !13
  store i8 %29, ptr %16, align 1, !tbaa !13
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %.lr.ph45, %25
  %31 = phi i32 [ %19, %.lr.ph45 ], [ %.pre, %25 ]
  %32 = phi i8 [ %20, %.lr.ph45 ], [ %29, %25 ]
  %33 = phi i32 [ %21, %.lr.ph45 ], [ %.pre, %25 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = shl nuw i32 1, %33
  %35 = sext i32 %34 to i64
  %36 = icmp slt i64 %indvars.iv.next, %35
  br i1 %36, label %.lr.ph45, label %.preheader38, !llvm.loop !16

.preheader37.unr-lcssa:                           ; preds = %101, %.lr.ph47.preheader
  %indvars.iv63.unr = phi i64 [ 0, %.lr.ph47.preheader ], [ %indvars.iv.next64.1, %101 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader37, label %.lr.ph47.epil

.lr.ph47.epil:                                    ; preds = %.preheader37.unr-lcssa
  %37 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %indvars.iv63.unr
  %38 = load i8, ptr %37, align 1, !tbaa !11, !range !14, !noundef !15
  %39 = trunc nuw i8 %38 to i1
  br i1 %39, label %40, label %.preheader37.epilog-lcssa

40:                                               ; preds = %.lr.ph47.epil
  %41 = add nuw nsw i64 %indvars.iv63.unr, %indvars.iv71
  %42 = getelementptr inbounds [5001 x i8], ptr @buf, i64 0, i64 %41
  %43 = load i8, ptr %42, align 1, !tbaa !13
  %44 = icmp eq i8 %32, %43
  br label %.preheader37.epilog-lcssa

.preheader37.epilog-lcssa:                        ; preds = %40, %.lr.ph47.epil
  %45 = phi i1 [ false, %.lr.ph47.epil ], [ %44, %40 ]
  %46 = zext i1 %45 to i8
  store i8 %46, ptr %37, align 1, !tbaa !11
  br label %.preheader37

.preheader37:                                     ; preds = %.preheader37.unr-lcssa, %.preheader37.epilog-lcssa
  %47 = icmp sgt i32 %34, 1
  br i1 %47, label %.preheader.us.preheader, label %._crit_edge51.split.us

.preheader.us.preheader:                          ; preds = %.preheader37
  %xtraiter92 = and i64 %wide.trip.count, 1
  %48 = icmp eq i64 %17, 0
  %unroll_iter94 = and i64 %wide.trip.count, 2147483646
  %lcmp.mod93.not = icmp eq i64 %xtraiter92, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %.02950.us = phi i32 [ %81, %._crit_edge.us ], [ 1, %.preheader.us.preheader ]
  br i1 %48, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %70
  %indvars.iv66 = phi i64 [ %indvars.iv.next67.1, %70 ], [ 0, %.preheader.us ]
  %niter95 = phi i64 [ %niter95.next.1, %70 ], [ 0, %.preheader.us ]
  %49 = trunc nuw nsw i64 %indvars.iv66 to i32
  %50 = and i32 %.02950.us, %49
  %.not36.us = icmp eq i32 %50, 0
  br i1 %.not36.us, label %59, label %51

51:                                               ; preds = %.preheader.us.new
  %52 = xor i32 %.02950.us, %49
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %53
  %55 = load i8, ptr %54, align 1, !tbaa !11, !range !14, !noundef !15
  %56 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %indvars.iv66
  %57 = load i8, ptr %56, align 2, !tbaa !11, !range !14, !noundef !15
  %58 = or i8 %57, %55
  store i8 %58, ptr %56, align 2, !tbaa !11
  br label %59

59:                                               ; preds = %51, %.preheader.us.new
  %indvars.iv.next67 = or disjoint i64 %indvars.iv66, 1
  %60 = trunc nuw nsw i64 %indvars.iv.next67 to i32
  %61 = and i32 %.02950.us, %60
  %.not36.us.1 = icmp eq i32 %61, 0
  br i1 %.not36.us.1, label %70, label %62

62:                                               ; preds = %59
  %63 = xor i32 %.02950.us, %60
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %64
  %66 = load i8, ptr %65, align 1, !tbaa !11, !range !14, !noundef !15
  %67 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %indvars.iv.next67
  %68 = load i8, ptr %67, align 1, !tbaa !11, !range !14, !noundef !15
  %69 = or i8 %68, %66
  store i8 %69, ptr %67, align 1, !tbaa !11
  br label %70

70:                                               ; preds = %62, %59
  %indvars.iv.next67.1 = add nuw nsw i64 %indvars.iv66, 2
  %niter95.next.1 = add i64 %niter95, 2
  %niter95.ncmp.1 = icmp eq i64 %niter95.next.1, %unroll_iter94
  br i1 %niter95.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new, !llvm.loop !17

._crit_edge.us.unr-lcssa:                         ; preds = %70, %.preheader.us
  %indvars.iv66.unr = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next67.1, %70 ]
  br i1 %lcmp.mod93.not, label %._crit_edge.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.us.unr-lcssa
  %71 = trunc nuw nsw i64 %indvars.iv66.unr to i32
  %72 = and i32 %.02950.us, %71
  %.not36.us.epil = icmp eq i32 %72, 0
  br i1 %.not36.us.epil, label %._crit_edge.us, label %73

73:                                               ; preds = %.epil.preheader
  %74 = xor i32 %.02950.us, %71
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %75
  %77 = load i8, ptr %76, align 1, !tbaa !11, !range !14, !noundef !15
  %78 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %indvars.iv66.unr
  %79 = load i8, ptr %78, align 1, !tbaa !11, !range !14, !noundef !15
  %80 = or i8 %79, %77
  store i8 %80, ptr %78, align 1, !tbaa !11
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %.epil.preheader, %73, %._crit_edge.us.unr-lcssa
  %81 = shl i32 %.02950.us, 1
  %82 = icmp slt i32 %81, %34
  br i1 %82, label %.preheader.us, label %._crit_edge51.split.us, !llvm.loop !18

.lr.ph47:                                         ; preds = %101, %.lr.ph47.preheader.new
  %indvars.iv63 = phi i64 [ 0, %.lr.ph47.preheader.new ], [ %indvars.iv.next64.1, %101 ]
  %niter = phi i64 [ 0, %.lr.ph47.preheader.new ], [ %niter.next.1, %101 ]
  %83 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %indvars.iv63
  %84 = load i8, ptr %83, align 2, !tbaa !11, !range !14, !noundef !15
  %85 = trunc nuw i8 %84 to i1
  br i1 %85, label %86, label %.lr.ph47.1

86:                                               ; preds = %.lr.ph47
  %87 = add nuw nsw i64 %indvars.iv63, %indvars.iv71
  %88 = getelementptr inbounds [5001 x i8], ptr @buf, i64 0, i64 %87
  %89 = load i8, ptr %88, align 1, !tbaa !13
  %90 = icmp eq i8 %32, %89
  br label %.lr.ph47.1

.lr.ph47.1:                                       ; preds = %86, %.lr.ph47
  %91 = phi i1 [ false, %.lr.ph47 ], [ %90, %86 ]
  %92 = zext i1 %91 to i8
  store i8 %92, ptr %83, align 2, !tbaa !11
  %indvars.iv.next64 = or disjoint i64 %indvars.iv63, 1
  %93 = getelementptr inbounds [5001 x i8], ptr @f, i64 0, i64 %indvars.iv.next64
  %94 = load i8, ptr %93, align 1, !tbaa !11, !range !14, !noundef !15
  %95 = trunc nuw i8 %94 to i1
  br i1 %95, label %96, label %101

96:                                               ; preds = %.lr.ph47.1
  %97 = add nuw nsw i64 %indvars.iv.next64, %indvars.iv71
  %98 = getelementptr inbounds [5001 x i8], ptr @buf, i64 0, i64 %97
  %99 = load i8, ptr %98, align 1, !tbaa !13
  %100 = icmp eq i8 %32, %99
  br label %101

101:                                              ; preds = %96, %.lr.ph47.1
  %102 = phi i1 [ false, %.lr.ph47.1 ], [ %100, %96 ]
  %103 = zext i1 %102 to i8
  store i8 %103, ptr %93, align 1, !tbaa !11
  %indvars.iv.next64.1 = add nuw nsw i64 %indvars.iv63, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader37.unr-lcssa, label %.lr.ph47, !llvm.loop !19

._crit_edge51.split.us:                           ; preds = %._crit_edge.us, %.lr.ph55, %.preheader38, %.preheader37
  %104 = phi i32 [ %31, %.preheader37 ], [ %31, %.preheader38 ], [ 31, %.lr.ph55 ], [ %31, %._crit_edge.us ]
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %105 = load i32, ptr @n, align 4, !tbaa !5
  %.neg = shl nsw i32 -1, %104
  %106 = add i32 %.neg, %105
  %107 = sext i32 %106 to i64
  %.not35.not = icmp slt i64 %indvars.iv71, %107
  br i1 %.not35.not, label %.lr.ph55, label %._crit_edge, !llvm.loop !20
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind willreturn memory(read) }

!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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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