; LLVM IR from tangjz/acm-icpc :: lydsy (1612)

; 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
@ans = external dso_local global i32, align 4
@g = external dso_local global [101 x [101 x i8]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = 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 i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  br label %13

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

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

18:                                               ; preds = %13
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3, ptr noundef %4)
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %21
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [101 x i8], ptr %22, i64 0, i64 %24
  store i8 1, ptr %25, align 1, !tbaa !9
  br label %26

26:                                               ; preds = %18
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %2, align 4, !tbaa !5
  br label %13, !llvm.loop !11

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

30:                                               ; preds = %87, %29
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = icmp sle i32 %31, %32
  br i1 %33, label %35, label %34

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

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

36:                                               ; preds = %83, %35
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = icmp sle i32 %37, %38
  br i1 %39, label %41, label %40

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

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

42:                                               ; preds = %79, %41
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = icmp sle i32 %43, %44
  br i1 %45, label %47, label %46

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

47:                                               ; preds = %42
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %49
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [101 x i8], ptr %50, i64 0, i64 %52
  %54 = load i8, ptr %53, align 1, !tbaa !9, !range !13, !noundef !14
  %55 = trunc i8 %54 to i1
  %56 = zext i1 %55 to i32
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %58
  %60 = load i32, ptr %8, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [101 x i8], ptr %59, i64 0, i64 %61
  %63 = load i8, ptr %62, align 1, !tbaa !9, !range !13, !noundef !14
  %64 = trunc i8 %63 to i1
  %65 = zext i1 %64 to i32
  %66 = and i32 %56, %65
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %68
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [101 x i8], ptr %69, i64 0, i64 %71
  %73 = load i8, ptr %72, align 1, !tbaa !9, !range !13, !noundef !14
  %74 = trunc i8 %73 to i1
  %75 = zext i1 %74 to i32
  %76 = or i32 %75, %66
  %77 = icmp ne i32 %76, 0
  %78 = zext i1 %77 to i8
  store i8 %78, ptr %72, align 1, !tbaa !9
  br label %79

79:                                               ; preds = %47
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %8, align 4, !tbaa !5
  br label %42, !llvm.loop !15

82:                                               ; preds = %46
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %7, align 4, !tbaa !5
  br label %36, !llvm.loop !16

86:                                               ; preds = %40
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %5, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %5, align 4, !tbaa !5
  br label %30, !llvm.loop !17

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

91:                                               ; preds = %136, %90
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = load i32, ptr @n, align 4, !tbaa !5
  %94 = icmp sle i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %139

96:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %124, %96
  %98 = load i32, ptr %11, align 4, !tbaa !5
  %99 = load i32, ptr @n, align 4, !tbaa !5
  %100 = icmp sle i32 %98, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %127

102:                                              ; preds = %97
  %103 = load i32, ptr %9, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %104
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [101 x i8], ptr %105, i64 0, i64 %107
  %109 = load i8, ptr %108, align 1, !tbaa !9, !range !13, !noundef !14
  %110 = trunc i8 %109 to i1
  %111 = zext i1 %110 to i32
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %113
  %115 = load i32, ptr %9, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [101 x i8], ptr %114, i64 0, i64 %116
  %118 = load i8, ptr %117, align 1, !tbaa !9, !range !13, !noundef !14
  %119 = trunc i8 %118 to i1
  %120 = zext i1 %119 to i32
  %121 = or i32 %111, %120
  %122 = load i32, ptr %10, align 4, !tbaa !5
  %123 = add nsw i32 %122, %121
  store i32 %123, ptr %10, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %102
  %125 = load i32, ptr %11, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %11, align 4, !tbaa !5
  br label %97, !llvm.loop !18

127:                                              ; preds = %101
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = load i32, ptr @n, align 4, !tbaa !5
  %130 = sub nsw i32 %129, 1
  %131 = icmp eq i32 %128, %130
  br i1 %131, label %132, label %135

132:                                              ; preds = %127
  %133 = load i32, ptr @ans, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr @ans, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %132, %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %9, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %9, align 4, !tbaa !5
  br label %91, !llvm.loop !19

139:                                              ; preds = %95
  %140 = load i32, ptr @ans, align 4, !tbaa !5
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %140)
  ret i32 0
}

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 @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 = { nounwind }

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

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@g = external dso_local local_unnamed_addr global [101 x [101 x i8]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not46 = icmp slt i32 %6, 1
  br i1 %.not46, label %.preheader35.._crit_edge56_crit_edge, label %.preheader37.preheader

.preheader37.preheader:                           ; preds = %._crit_edge
  %7 = add nuw i32 %6, 1
  %wide.trip.count67 = zext i32 %7 to i64
  %8 = mul nuw nsw i64 %wide.trip.count67, 102
  %9 = getelementptr i8, ptr @g, i64 %8
  %scevgep = getelementptr i8, ptr %9, i64 -101
  %10 = mul nuw nsw i64 %wide.trip.count67, 101
  %11 = zext nneg i32 %6 to i64
  %12 = zext nneg i32 %6 to i64
  %13 = getelementptr i8, ptr @g, i64 %10
  %14 = getelementptr i8, ptr %13, i64 -99
  %15 = getelementptr i8, ptr @g, i64 %wide.trip.count67
  %16 = getelementptr i8, ptr %15, i64 101
  %min.iters.check = icmp ult i32 %6, 8
  %min.iters.check88 = icmp ult i32 %6, 32
  %n.vec = and i64 %11, 2147483616
  %cmp.n = icmp eq i64 %n.vec, %11
  %ind.end96 = or disjoint i64 %n.vec, 1
  %n.vec.remaining = and i64 %11, 24
  %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
  %n.vec95 = and i64 %11, 2147483640
  %ind.end = or disjoint i64 %n.vec95, 1
  %cmp.n102 = icmp eq i64 %n.vec95, %11
  %17 = and i32 %6, 1
  %lcmp.mod.not = icmp eq i32 %17, 0
  br label %.preheader37

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.02938 = phi i32 [ %24, %.lr.ph ], [ 0, %0 ]
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %20, i64 %22
  store i8 1, ptr %23, align 1, !tbaa !9
  %24 = add nuw nsw i32 %.02938, 1
  %25 = load i32, ptr @m, align 4, !tbaa !5
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader37:                                     ; preds = %.preheader37.preheader, %._crit_edge45.split
  %indvar = phi i64 [ 0, %.preheader37.preheader ], [ %indvar.next, %._crit_edge45.split ]
  %indvars.iv64 = phi i64 [ 1, %.preheader37.preheader ], [ %indvars.iv.next65, %._crit_edge45.split ]
  %gep = getelementptr i8, ptr getelementptr (i8, ptr @g, i64 102), i64 %indvar
  %scevgep82 = getelementptr i8, ptr %14, i64 %indvar
  %27 = mul nuw nsw i64 %indvar, 101
  %gep126 = getelementptr i8, ptr getelementptr (i8, ptr @g, i64 102), i64 %27
  %scevgep84 = getelementptr i8, ptr %16, i64 %27
  %bound0 = icmp ugt ptr %scevgep82, getelementptr inbounds (i8, ptr @g, i64 102)
  %bound1 = icmp ult ptr %gep, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  %bound085 = icmp ugt ptr %scevgep84, getelementptr inbounds (i8, ptr @g, i64 102)
  %bound186 = icmp ult ptr %gep126, %scevgep
  %found.conflict87 = and i1 %bound085, %bound186
  %conflict.rdx = or i1 %found.conflict, %found.conflict87
  br label %iter.check

.preheader35:                                     ; preds = %._crit_edge45.split
  br i1 %.not46, label %.preheader35.._crit_edge56_crit_edge, label %.preheader.lr.ph

.preheader35.._crit_edge56_crit_edge:             ; preds = %._crit_edge, %.preheader35
  %.pre = load i32, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge56

.preheader.lr.ph:                                 ; preds = %.preheader35
  %ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
  %28 = add nsw i32 %6, -1
  %29 = add nuw i32 %6, 1
  %wide.trip.count77 = zext i32 %29 to i64
  %30 = zext nneg i32 %6 to i64
  %min.iters.check104 = icmp ult i32 %6, 8
  %n.vec107 = and i64 %30, 2147483640
  %ind.end108 = or disjoint i64 %n.vec107, 1
  %cmp.n117 = icmp eq i64 %n.vec107, %30
  br label %.preheader

iter.check:                                       ; preds = %.preheader37, %._crit_edge42
  %indvars.iv59 = phi i64 [ 1, %.preheader37 ], [ %indvars.iv.next60, %._crit_edge42 ]
  %31 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv59, i64 %indvars.iv64
  %brmerge = select i1 %min.iters.check, i1 true, i1 %conflict.rdx
  br i1 %brmerge, label %vec.epilog.scalar.ph.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %iter.check
  br i1 %min.iters.check88, label %vec.epilog.ph, label %vector.ph

vector.ph:                                        ; preds = %vector.main.loop.iter.check
  %32 = load i8, ptr %31, align 1, !tbaa !9, !range !13, !alias.scope !14, !noundef !17
  %broadcast.splatinsert90 = insertelement <16 x i8> poison, i8 %32, i64 0
  %broadcast.splat91 = shufflevector <16 x i8> %broadcast.splatinsert90, <16 x i8> poison, <16 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %33 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv64, i64 %offset.idx
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  %wide.load = load <16 x i8>, ptr %33, align 1, !tbaa !9, !alias.scope !18
  %wide.load89 = load <16 x i8>, ptr %34, align 1, !tbaa !9, !alias.scope !18
  %35 = and <16 x i8> %wide.load, %broadcast.splat91
  %36 = and <16 x i8> %wide.load89, %broadcast.splat91
  %37 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv59, i64 %offset.idx
  %38 = getelementptr inbounds i8, ptr %37, i64 16
  %wide.load92 = load <16 x i8>, ptr %37, align 1, !tbaa !9, !alias.scope !20, !noalias !22
  %wide.load93 = load <16 x i8>, ptr %38, align 1, !tbaa !9, !alias.scope !20, !noalias !22
  %39 = or <16 x i8> %wide.load92, %35
  %40 = or <16 x i8> %wide.load93, %36
  store <16 x i8> %39, ptr %37, align 1, !tbaa !9, !alias.scope !20, !noalias !22
  store <16 x i8> %40, ptr %38, align 1, !tbaa !9, !alias.scope !20, !noalias !22
  %index.next = add nuw i64 %index, 32
  %41 = icmp eq i64 %index.next, %n.vec
  br i1 %41, label %middle.block, label %vector.body, !llvm.loop !23

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge42, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  br i1 %min.epilog.iters.check, label %vec.epilog.scalar.ph.preheader, label %vec.epilog.ph

vec.epilog.scalar.ph.preheader:                   ; preds = %iter.check, %vec.epilog.middle.block, %vec.epilog.iter.check
  %indvars.iv.ph = phi i64 [ 1, %iter.check ], [ %ind.end96, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
  br i1 %lcmp.mod.not, label %vec.epilog.scalar.ph.prol.loopexit, label %vec.epilog.scalar.ph.prol

vec.epilog.scalar.ph.prol:                        ; preds = %vec.epilog.scalar.ph.preheader
  %42 = load i8, ptr %31, align 1, !tbaa !9, !range !13, !noundef !17
  %43 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv64, i64 %indvars.iv.ph
  %44 = load i8, ptr %43, align 1, !tbaa !9, !range !13, !noundef !17
  %45 = and i8 %44, %42
  %46 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv59, i64 %indvars.iv.ph
  %47 = load i8, ptr %46, align 1, !tbaa !9, !range !13, !noundef !17
  %48 = or i8 %47, %45
  store i8 %48, ptr %46, align 1, !tbaa !9
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.ph, 1
  br label %vec.epilog.scalar.ph.prol.loopexit

vec.epilog.scalar.ph.prol.loopexit:               ; preds = %vec.epilog.scalar.ph.prol, %vec.epilog.scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %vec.epilog.scalar.ph.preheader ], [ %indvars.iv.next.prol, %vec.epilog.scalar.ph.prol ]
  %49 = icmp eq i64 %indvars.iv.ph, %12
  br i1 %49, label %._crit_edge42, label %vec.epilog.scalar.ph

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %50 = load i8, ptr %31, align 1, !tbaa !9, !range !13, !alias.scope !26, !noundef !17
  %broadcast.splatinsert = insertelement <8 x i8> poison, i8 %50, i64 0
  %broadcast.splat = shufflevector <8 x i8> %broadcast.splatinsert, <8 x i8> poison, <8 x i32> zeroinitializer
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index97 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next101, %vec.epilog.vector.body ]
  %offset.idx98 = or disjoint i64 %index97, 1
  %51 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv64, i64 %offset.idx98
  %wide.load99 = load <8 x i8>, ptr %51, align 1, !tbaa !9, !alias.scope !29
  %52 = and <8 x i8> %wide.load99, %broadcast.splat
  %53 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv59, i64 %offset.idx98
  %wide.load100 = load <8 x i8>, ptr %53, align 1, !tbaa !9, !alias.scope !31, !noalias !33
  %54 = or <8 x i8> %wide.load100, %52
  store <8 x i8> %54, ptr %53, align 1, !tbaa !9, !alias.scope !31, !noalias !33
  %index.next101 = add nuw i64 %index97, 8
  %55 = icmp eq i64 %index.next101, %n.vec95
  br i1 %55, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !34

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  br i1 %cmp.n102, label %._crit_edge42, label %vec.epilog.scalar.ph.preheader

._crit_edge45.split:                              ; preds = %._crit_edge42
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %exitcond68.not = icmp eq i64 %indvars.iv.next65, %wide.trip.count67
  %indvar.next = add i64 %indvar, 1
  br i1 %exitcond68.not, label %.preheader35, label %.preheader37, !llvm.loop !35

._crit_edge42:                                    ; preds = %vec.epilog.scalar.ph.prol.loopexit, %vec.epilog.scalar.ph, %vec.epilog.middle.block, %middle.block
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %exitcond63.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count67
  br i1 %exitcond63.not, label %._crit_edge45.split, label %iter.check, !llvm.loop !36

vec.epilog.scalar.ph:                             ; preds = %vec.epilog.scalar.ph.prol.loopexit, %vec.epilog.scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %vec.epilog.scalar.ph ], [ %indvars.iv.unr, %vec.epilog.scalar.ph.prol.loopexit ]
  %56 = load i8, ptr %31, align 1, !tbaa !9, !range !13, !noundef !17
  %57 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv64, i64 %indvars.iv
  %58 = load i8, ptr %57, align 1, !tbaa !9, !range !13, !noundef !17
  %59 = and i8 %58, %56
  %60 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv59, i64 %indvars.iv
  %61 = load i8, ptr %60, align 1, !tbaa !9, !range !13, !noundef !17
  %62 = or i8 %61, %59
  store i8 %62, ptr %60, align 1, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %63 = load i8, ptr %31, align 1, !tbaa !9, !range !13, !noundef !17
  %64 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv64, i64 %indvars.iv.next
  %65 = load i8, ptr %64, align 1, !tbaa !9, !range !13, !noundef !17
  %66 = and i8 %65, %63
  %67 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv59, i64 %indvars.iv.next
  %68 = load i8, ptr %67, align 1, !tbaa !9, !range !13, !noundef !17
  %69 = or i8 %68, %66
  store i8 %69, ptr %67, align 1, !tbaa !9
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count67
  br i1 %exitcond.not.1, label %._crit_edge42, label %vec.epilog.scalar.ph, !llvm.loop !37

.preheader:                                       ; preds = %.preheader.lr.ph, %124
  %indvars.iv74 = phi i64 [ 1, %.preheader.lr.ph ], [ %indvars.iv.next75, %124 ]
  %70 = phi i32 [ %ans.promoted, %.preheader.lr.ph ], [ %125, %124 ]
  br i1 %min.iters.check104, label %scalar.ph.preheader, label %vector.body110

scalar.ph.preheader:                              ; preds = %middle.block103, %.preheader
  %indvars.iv69.ph = phi i64 [ 1, %.preheader ], [ %ind.end108, %middle.block103 ]
  %.02449.ph = phi i32 [ 0, %.preheader ], [ %111, %middle.block103 ]
  br label %scalar.ph

vector.body110:                                   ; preds = %.preheader, %vector.body110
  %index111 = phi i64 [ %index.next116, %vector.body110 ], [ 0, %.preheader ]
  %vec.phi = phi <4 x i32> [ %108, %vector.body110 ], [ zeroinitializer, %.preheader ]
  %vec.phi112 = phi <4 x i32> [ %109, %vector.body110 ], [ zeroinitializer, %.preheader ]
  %offset.idx113 = or disjoint i64 %index111, 1
  %71 = or disjoint i64 %index111, 2
  %72 = or disjoint i64 %index111, 3
  %73 = or disjoint i64 %index111, 4
  %74 = or disjoint i64 %index111, 5
  %75 = or disjoint i64 %index111, 6
  %76 = or disjoint i64 %index111, 7
  %77 = add i64 %index111, 8
  %78 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv74, i64 %offset.idx113
  %79 = getelementptr inbounds i8, ptr %78, i64 4
  %wide.load114 = load <4 x i8>, ptr %78, align 1, !tbaa !9
  %wide.load115 = load <4 x i8>, ptr %79, align 1, !tbaa !9
  %80 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %offset.idx113, i64 %indvars.iv74
  %81 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %71, i64 %indvars.iv74
  %82 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %72, i64 %indvars.iv74
  %83 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %73, i64 %indvars.iv74
  %84 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %74, i64 %indvars.iv74
  %85 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %75, i64 %indvars.iv74
  %86 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %76, i64 %indvars.iv74
  %87 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %77, i64 %indvars.iv74
  %88 = load i8, ptr %80, align 1, !tbaa !9, !range !13, !noundef !17
  %89 = load i8, ptr %81, align 1, !tbaa !9, !range !13, !noundef !17
  %90 = load i8, ptr %82, align 1, !tbaa !9, !range !13, !noundef !17
  %91 = load i8, ptr %83, align 1, !tbaa !9, !range !13, !noundef !17
  %92 = insertelement <4 x i8> poison, i8 %88, i64 0
  %93 = insertelement <4 x i8> %92, i8 %89, i64 1
  %94 = insertelement <4 x i8> %93, i8 %90, i64 2
  %95 = insertelement <4 x i8> %94, i8 %91, i64 3
  %96 = load i8, ptr %84, align 1, !tbaa !9, !range !13, !noundef !17
  %97 = load i8, ptr %85, align 1, !tbaa !9, !range !13, !noundef !17
  %98 = load i8, ptr %86, align 1, !tbaa !9, !range !13, !noundef !17
  %99 = load i8, ptr %87, align 1, !tbaa !9, !range !13, !noundef !17
  %100 = insertelement <4 x i8> poison, i8 %96, i64 0
  %101 = insertelement <4 x i8> %100, i8 %97, i64 1
  %102 = insertelement <4 x i8> %101, i8 %98, i64 2
  %103 = insertelement <4 x i8> %102, i8 %99, i64 3
  %104 = or <4 x i8> %95, %wide.load114
  %105 = or <4 x i8> %103, %wide.load115
  %106 = zext <4 x i8> %104 to <4 x i32>
  %107 = zext <4 x i8> %105 to <4 x i32>
  %108 = add <4 x i32> %vec.phi, %106
  %109 = add <4 x i32> %vec.phi112, %107
  %index.next116 = add nuw i64 %index111, 8
  %110 = icmp eq i64 %index.next116, %n.vec107
  br i1 %110, label %middle.block103, label %vector.body110, !llvm.loop !38

middle.block103:                                  ; preds = %vector.body110
  %bin.rdx = add <4 x i32> %109, %108
  %111 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br i1 %cmp.n117, label %._crit_edge52, label %scalar.ph.preheader

._crit_edge56:                                    ; preds = %124, %.preheader35.._crit_edge56_crit_edge
  %112 = phi i32 [ %.pre, %.preheader35.._crit_edge56_crit_edge ], [ %125, %124 ]
  %113 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %112)
  ret i32 0

._crit_edge52:                                    ; preds = %scalar.ph, %middle.block103
  %.lcssa = phi i32 [ %111, %middle.block103 ], [ %121, %scalar.ph ]
  %114 = icmp eq i32 %.lcssa, %28
  br i1 %114, label %122, label %124

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %scalar.ph ], [ %indvars.iv69.ph, %scalar.ph.preheader ]
  %.02449 = phi i32 [ %121, %scalar.ph ], [ %.02449.ph, %scalar.ph.preheader ]
  %115 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv74, i64 %indvars.iv69
  %116 = load i8, ptr %115, align 1, !tbaa !9, !range !13, !noundef !17
  %117 = getelementptr inbounds [101 x [101 x i8]], ptr @g, i64 0, i64 %indvars.iv69, i64 %indvars.iv74
  %118 = load i8, ptr %117, align 1, !tbaa !9, !range !13, !noundef !17
  %119 = or i8 %118, %116
  %120 = zext nneg i8 %119 to i32
  %121 = add nuw nsw i32 %.02449, %120
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %exitcond73.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count77
  br i1 %exitcond73.not, label %._crit_edge52, label %scalar.ph, !llvm.loop !39

122:                                              ; preds = %._crit_edge52
  %123 = add nsw i32 %70, 1
  store i32 %123, ptr @ans, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %122, %._crit_edge52
  %125 = phi i32 [ %123, %122 ], [ %70, %._crit_edge52 ]
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %exitcond78.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count77
  br i1 %exitcond78.not, label %._crit_edge56, label %.preheader, !llvm.loop !40
}

; 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3

attributes #0 = { mustprogress nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i8 0, i8 2}
!14 = !{!15}
!15 = distinct !{!15, !16}
!16 = distinct !{!16, !"LVerDomain"}
!17 = !{}
!18 = !{!19}
!19 = distinct !{!19, !16}
!20 = !{!21}
!21 = distinct !{!21, !16}
!22 = !{!15, !19}
!23 = distinct !{!23, !12, !24, !25}
!24 = !{!"llvm.loop.isvectorized", i32 1}
!25 = !{!"llvm.loop.unroll.runtime.disable"}
!26 = !{!27}
!27 = distinct !{!27, !28}
!28 = distinct !{!28, !"LVerDomain"}
!29 = !{!30}
!30 = distinct !{!30, !28}
!31 = !{!32}
!32 = distinct !{!32, !28}
!33 = !{!27, !30}
!34 = distinct !{!34, !12, !24, !25}
!35 = distinct !{!35, !12}
!36 = distinct !{!36, !12}
!37 = distinct !{!37, !12, !24}
!38 = distinct !{!38, !12, !24, !25}
!39 = distinct !{!39, !12, !25, !24}
!40 = distinct !{!40, !12}


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