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

; 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
@a = external dso_local global [20 x i32], align 16
@op = external dso_local global [20 x i32], align 16
@b = external dso_local global [20 x i32], align 16
@aop = external dso_local global [20 x i32], align 16
@st = external dso_local global i32, align 4
@all = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4calci(i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %31, %0
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = icmp sle i32 %7, %8
  br i1 %9, label %10, label %34

10:                                               ; preds = %6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %27, %10
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = icmp sle i32 %12, %13
  br i1 %14, label %15, label %30

15:                                               ; preds = %11
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %4)
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [20 x i32], ptr @a, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = shl i32 %20, 1
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = add nsw i32 %21, %22
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [20 x i32], ptr @a, i64 0, i64 %25
  store i32 %23, ptr %26, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %15
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %3, align 4, !tbaa !5
  br label %11, !llvm.loop !9

30:                                               ; preds = %11
  br label %31

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

34:                                               ; preds = %6
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = shl i32 1, %35
  %37 = sub nsw i32 %36, 1
  store i32 %37, ptr @all, align 4, !tbaa !5
  store i32 0, ptr @st, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %128, %34
  %39 = load i32, ptr @st, align 4, !tbaa !5
  %40 = load i32, ptr @all, align 4, !tbaa !5
  %41 = icmp sle i32 %39, %40
  br i1 %41, label %42, label %131

42:                                               ; preds = %38
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @b, ptr align 16 @a, i64 80, i1 false)
  store i32 1, ptr %3, align 4, !tbaa !5
  %43 = load i32, ptr @st, align 4, !tbaa !5
  store i32 %43, ptr getelementptr inbounds ([20 x i32], ptr @op, i64 0, i64 1), align 4, !tbaa !5
  %44 = load i32, ptr @st, align 4, !tbaa !5
  %45 = call noundef i32 @_Z4calci(i32 noundef %44)
  store i32 %45, ptr @cnt, align 4, !tbaa !5
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [20 x i32], ptr @b, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = xor i32 %54, %49
  store i32 %55, ptr %53, align 4, !tbaa !5
  store i32 2, ptr %3, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %111, %42
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  %60 = icmp sle i32 %57, %59
  br i1 %60, label %61, label %114

61:                                               ; preds = %56
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = sub nsw i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [20 x i32], ptr @b, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sub nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = xor i32 %66, %71
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sub nsw i32 %73, 1
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = ashr i32 %77, 1
  %79 = xor i32 %72, %78
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %81 = sub nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = shl i32 %84, 1
  %86 = load i32, ptr @all, align 4, !tbaa !5
  %87 = and i32 %85, %86
  %88 = xor i32 %79, %87
  %89 = load i32, ptr @all, align 4, !tbaa !5
  %90 = and i32 %88, %89
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %92
  store i32 %90, ptr %93, align 4, !tbaa !5
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = load i32, ptr %3, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [20 x i32], ptr @b, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = xor i32 %102, %97
  store i32 %103, ptr %101, align 4, !tbaa !5
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = call noundef i32 @_Z4calci(i32 noundef %107)
  %109 = load i32, ptr @cnt, align 4, !tbaa !5
  %110 = add nsw i32 %109, %108
  store i32 %110, ptr @cnt, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %61
  %112 = load i32, ptr %3, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %3, align 4, !tbaa !5
  br label %56, !llvm.loop !12

114:                                              ; preds = %56
  %115 = load i32, ptr @n, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %127, label %121

121:                                              ; preds = %114
  %122 = load i32, ptr @cnt, align 4, !tbaa !5
  %123 = load i32, ptr @ans, align 4, !tbaa !5
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %125, label %127

125:                                              ; preds = %121
  %126 = load i32, ptr @cnt, align 4, !tbaa !5
  store i32 %126, ptr @ans, align 4, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @aop, ptr align 16 @op, i64 80, i1 false)
  br label %127

127:                                              ; preds = %125, %121, %114
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr @st, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr @st, align 4, !tbaa !5
  br label %38, !llvm.loop !13

131:                                              ; preds = %38
  %132 = load i32, ptr @ans, align 4, !tbaa !5
  %133 = icmp eq i32 %132, 2147483647
  br i1 %133, label %134, label %136

134:                                              ; preds = %131
  %135 = call i32 @puts(ptr noundef @.str.2)
  br label %170

136:                                              ; preds = %131
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %166, %136
  %138 = load i32, ptr %2, align 4, !tbaa !5
  %139 = load i32, ptr @n, align 4, !tbaa !5
  %140 = icmp sle i32 %138, %139
  br i1 %140, label %141, label %169

141:                                              ; preds = %137
  %142 = load i32, ptr @m, align 4, !tbaa !5
  %143 = sub nsw i32 %142, 1
  store i32 %143, ptr %3, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %156, %141
  %145 = load i32, ptr %3, align 4, !tbaa !5
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %159

147:                                              ; preds = %144
  %148 = load i32, ptr %2, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [20 x i32], ptr @aop, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = load i32, ptr %3, align 4, !tbaa !5
  %153 = ashr i32 %151, %152
  %154 = and i32 %153, 1
  %155 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %154)
  br label %156

156:                                              ; preds = %147
  %157 = load i32, ptr %3, align 4, !tbaa !5
  %158 = add nsw i32 %157, -1
  store i32 %158, ptr %3, align 4, !tbaa !5
  br label %144, !llvm.loop !14

159:                                              ; preds = %144
  %160 = load i32, ptr %2, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [20 x i32], ptr @aop, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = and i32 %163, 1
  %165 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %164)
  br label %166

166:                                              ; preds = %159
  %167 = load i32, ptr %2, align 4, !tbaa !5
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %2, align 4, !tbaa !5
  br label %137, !llvm.loop !15

169:                                              ; preds = %137
  br label %170

170:                                              ; preds = %169, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare i32 @puts(ptr noundef) #3

declare i32 @printf(ptr noundef, ...) #3

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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: readwrite) }
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 = distinct !{!15, !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 global i32, align 4
@a = external dso_local local_unnamed_addr global [20 x i32], align 16
@op = external dso_local local_unnamed_addr global [20 x i32], align 16
@b = external dso_local local_unnamed_addr global [20 x i32], align 16
@aop = external dso_local local_unnamed_addr global [20 x i32], align 16
@st = external dso_local local_unnamed_addr global i32, align 4
@all = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4calci(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %.not38 = icmp slt i32 %3, 1
  %.pre69 = load i32, ptr @m, align 4, !tbaa !5
  %4 = icmp slt i32 %.pre69, 1
  %or.cond = select i1 %.not38, i1 true, i1 %4
  br i1 %or.cond, label %.lr.ph49.preheader, label %.preheader35

.preheader35:                                     ; preds = %0, %._crit_edge
  %5 = phi i32 [ %16, %._crit_edge ], [ %3, %0 ]
  %6 = phi i32 [ %17, %._crit_edge ], [ %.pre69, %0 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 1, %0 ]
  %.not3436 = icmp slt i32 %6, 1
  br i1 %.not3436, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader35
  %7 = getelementptr inbounds [20 x i32], ptr @a, i64 0, i64 %indvars.iv
  br label %8

8:                                                ; preds = %.lr.ph, %8
  %.037 = phi i32 [ 1, %.lr.ph ], [ %14, %8 ]
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  %10 = load i32, ptr %7, align 4, !tbaa !5
  %11 = shl i32 %10, 1
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = add nsw i32 %11, %12
  store i32 %13, ptr %7, align 4, !tbaa !5
  %14 = add nuw nsw i32 %.037, 1
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %.not34.not = icmp slt i32 %.037, %15
  br i1 %.not34.not, label %8, label %._crit_edge.loopexit, !llvm.loop !9

._crit_edge.loopexit:                             ; preds = %8
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader35
  %16 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %5, %.preheader35 ]
  %17 = phi i32 [ %15, %._crit_edge.loopexit ], [ %6, %.preheader35 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = sext i32 %16 to i64
  %.not.not = icmp slt i64 %indvars.iv, %18
  br i1 %.not.not, label %.preheader35, label %.lr.ph49.preheader, !llvm.loop !11

.lr.ph49.preheader:                               ; preds = %._crit_edge, %0
  %19 = phi i32 [ %.pre69, %0 ], [ %17, %._crit_edge ]
  %notmask = shl nsw i32 -1, %19
  %20 = xor i32 %notmask, -1
  store i32 %20, ptr @all, align 4, !tbaa !5
  store i32 0, ptr @st, align 4, !tbaa !5
  br label %.lr.ph49

.lr.ph49:                                         ; preds = %.lr.ph49.preheader, %54
  %storemerge47 = phi i32 [ %56, %54 ], [ 0, %.lr.ph49.preheader ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(80) @b, ptr noundef nonnull align 16 dereferenceable(80) @a, i64 80, i1 false)
  store i32 %storemerge47, ptr getelementptr inbounds (i8, ptr @op, i64 4), align 4, !tbaa !5
  %21 = call noundef i32 @_Z4calci(i32 noundef %storemerge47)
  store i32 %21, ptr @cnt, align 4, !tbaa !5
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @op, i64 4), align 4, !tbaa !5
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 8), align 8, !tbaa !5
  %24 = xor i32 %23, %22
  store i32 %24, ptr getelementptr inbounds (i8, ptr @b, i64 8), align 8, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %.not3241 = icmp slt i32 %25, 1
  br i1 %.not3241, label %._crit_edge45, label %.lr.ph44

.lr.ph44:                                         ; preds = %.lr.ph49, %.lr.ph44
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %.lr.ph44 ], [ 2, %.lr.ph49 ]
  %26 = add nsw i64 %indvars.iv63, -1
  %27 = getelementptr inbounds [20 x i32], ptr @b, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %26
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = ashr i32 %30, 1
  %32 = shl i32 %30, 1
  %33 = load i32, ptr @all, align 4, !tbaa !5
  %34 = xor i32 %28, %31
  %35 = xor i32 %34, %32
  %36 = xor i32 %35, %30
  %37 = and i32 %36, %33
  %38 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %indvars.iv63
  store i32 %37, ptr %38, align 4, !tbaa !5
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %39 = getelementptr inbounds [20 x i32], ptr @b, i64 0, i64 %indvars.iv.next64
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = xor i32 %37, %40
  store i32 %41, ptr %39, align 4, !tbaa !5
  %42 = call noundef i32 @_Z4calci(i32 noundef %37)
  %43 = load i32, ptr @cnt, align 4, !tbaa !5
  %44 = add nsw i32 %43, %42
  store i32 %44, ptr @cnt, align 4, !tbaa !5
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %.not32 = icmp sgt i64 %indvars.iv63, %46
  br i1 %.not32, label %._crit_edge45, label %.lr.ph44, !llvm.loop !13

._crit_edge45:                                    ; preds = %.lr.ph44, %.lr.ph49
  %47 = phi i32 [ %21, %.lr.ph49 ], [ %44, %.lr.ph44 ]
  %.lcssa.in = phi i32 [ %25, %.lr.ph49 ], [ %45, %.lr.ph44 ]
  %.lcssa = add nsw i32 %.lcssa.in, 1
  %48 = sext i32 %.lcssa to i64
  %49 = getelementptr inbounds [20 x i32], ptr @op, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %.not33 = icmp eq i32 %50, 0
  %51 = load i32, ptr @ans, align 4
  %52 = icmp slt i32 %47, %51
  %or.cond75 = select i1 %.not33, i1 %52, i1 false
  br i1 %or.cond75, label %53, label %54

53:                                               ; preds = %._crit_edge45
  store i32 %47, ptr @ans, align 4, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(80) @aop, ptr noundef nonnull align 16 dereferenceable(80) @op, i64 80, i1 false)
  br label %54

54:                                               ; preds = %._crit_edge45, %53
  %55 = load i32, ptr @st, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr @st, align 4, !tbaa !5
  %57 = load i32, ptr @all, align 4, !tbaa !5
  %.not29.not = icmp slt i32 %55, %57
  br i1 %.not29.not, label %.lr.ph49, label %._crit_edge50, !llvm.loop !14

._crit_edge50:                                    ; preds = %54
  %58 = load i32, ptr @ans, align 4, !tbaa !5
  %59 = icmp eq i32 %58, 2147483647
  br i1 %59, label %60, label %.preheader

.preheader:                                       ; preds = %._crit_edge50
  %.not3057 = icmp slt i32 %.lcssa.in, 1
  br i1 %.not3057, label %.loopexit, label %.lr.ph59

60:                                               ; preds = %._crit_edge50
  %61 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %.loopexit

.lr.ph59:                                         ; preds = %.preheader, %._crit_edge56
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %._crit_edge56 ], [ 1, %.preheader ]
  %62 = load i32, ptr @m, align 4, !tbaa !5
  %.251 = add nsw i32 %62, -1
  %.not3152 = icmp eq i32 %.251, 0
  br i1 %.not3152, label %._crit_edge56, label %.lr.ph55

.lr.ph55:                                         ; preds = %.lr.ph59
  %63 = getelementptr inbounds [20 x i32], ptr @aop, i64 0, i64 %indvars.iv66
  br label %64

64:                                               ; preds = %.lr.ph55, %64
  %.253 = phi i32 [ %.251, %.lr.ph55 ], [ %.2, %64 ]
  %65 = load i32, ptr %63, align 4, !tbaa !5
  %66 = lshr i32 %65, %.253
  %67 = and i32 %66, 1
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %67)
  %.2 = add nsw i32 %.253, -1
  %.not31 = icmp eq i32 %.2, 0
  br i1 %.not31, label %._crit_edge56, label %64, !llvm.loop !15

._crit_edge56:                                    ; preds = %64, %.lr.ph59
  %69 = getelementptr inbounds [20 x i32], ptr @aop, i64 0, i64 %indvars.iv66
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = and i32 %70, 1
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %71)
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %.not30.not = icmp slt i64 %indvars.iv66, %74
  br i1 %.not30.not, label %.lr.ph59, label %.loopexit, !llvm.loop !16

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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