; LLVM IR from lzyrapx/Competitive-Programming :: 百度之星/2016 Astar Contest - Round 2B (1006-中位数计数)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@a = external dso_local global [20005 x i32], align 16
@s = external dso_local global [20005 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [1 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
  store i32 0, ptr %1, align 4
  br label %10

10:                                               ; preds = %148, %0
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr %11, i64 %14
  %16 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %15)
  br i1 %16, label %17, label %150

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

18:                                               ; preds = %28, %17
  %19 = load i32, ptr %2, align 4, !tbaa !8
  %20 = load i32, ptr @n, align 4, !tbaa !8
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %18
  %24 = load i32, ptr %2, align 4, !tbaa !8
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %25
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %26)
  br label %28

28:                                               ; preds = %23
  %29 = load i32, ptr %2, align 4, !tbaa !8
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %2, align 4, !tbaa !8
  br label %18, !llvm.loop !11

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

32:                                               ; preds = %145, %31
  %33 = load i32, ptr %3, align 4, !tbaa !8
  %34 = load i32, ptr @n, align 4, !tbaa !8
  %35 = icmp sle i32 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !8
  %38 = load i32, ptr %5, align 4, !tbaa !8
  %39 = add nsw i32 8002, %38
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !8
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %41, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %44 = load i32, ptr %3, align 4, !tbaa !8
  %45 = sub nsw i32 %44, 1
  store i32 %45, ptr %7, align 4, !tbaa !8
  br label %46

46:                                               ; preds = %73, %37
  %47 = load i32, ptr %7, align 4, !tbaa !8
  %48 = icmp sge i32 %47, 1
  br i1 %48, label %50, label %49

49:                                               ; preds = %46
  store i32 10, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %76

50:                                               ; preds = %46
  %51 = load i32, ptr %7, align 4, !tbaa !8
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !8
  %55 = load i32, ptr %3, align 4, !tbaa !8
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !8
  %59 = icmp sgt i32 %54, %58
  br i1 %59, label %60, label %63

60:                                               ; preds = %50
  %61 = load i32, ptr %5, align 4, !tbaa !8
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %5, align 4, !tbaa !8
  br label %66

63:                                               ; preds = %50
  %64 = load i32, ptr %5, align 4, !tbaa !8
  %65 = add nsw i32 %64, -1
  store i32 %65, ptr %5, align 4, !tbaa !8
  br label %66

66:                                               ; preds = %63, %60
  %67 = load i32, ptr %5, align 4, !tbaa !8
  %68 = add nsw i32 8002, %67
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !8
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %70, align 4, !tbaa !8
  br label %73

73:                                               ; preds = %66
  %74 = load i32, ptr %7, align 4, !tbaa !8
  %75 = add nsw i32 %74, -1
  store i32 %75, ptr %7, align 4, !tbaa !8
  br label %46, !llvm.loop !13

76:                                               ; preds = %49
  store i32 0, ptr %5, align 4, !tbaa !8
  %77 = load i32, ptr %5, align 4, !tbaa !8
  %78 = add nsw i32 8002, %77
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !8
  %82 = load i32, ptr %6, align 4, !tbaa !8
  %83 = add nsw i32 %82, %81
  store i32 %83, ptr %6, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %84 = load i32, ptr %3, align 4, !tbaa !8
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %8, align 4, !tbaa !8
  br label %86

86:                                               ; preds = %115, %76
  %87 = load i32, ptr %8, align 4, !tbaa !8
  %88 = load i32, ptr @n, align 4, !tbaa !8
  %89 = icmp sle i32 %87, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %86
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %118

91:                                               ; preds = %86
  %92 = load i32, ptr %8, align 4, !tbaa !8
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !8
  %96 = load i32, ptr %3, align 4, !tbaa !8
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !8
  %100 = icmp sgt i32 %95, %99
  br i1 %100, label %101, label %104

101:                                              ; preds = %91
  %102 = load i32, ptr %5, align 4, !tbaa !8
  %103 = add nsw i32 %102, -1
  store i32 %103, ptr %5, align 4, !tbaa !8
  br label %107

104:                                              ; preds = %91
  %105 = load i32, ptr %5, align 4, !tbaa !8
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %5, align 4, !tbaa !8
  br label %107

107:                                              ; preds = %104, %101
  %108 = load i32, ptr %5, align 4, !tbaa !8
  %109 = add nsw i32 8002, %108
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !8
  %113 = load i32, ptr %6, align 4, !tbaa !8
  %114 = add nsw i32 %113, %112
  store i32 %114, ptr %6, align 4, !tbaa !8
  br label %115

115:                                              ; preds = %107
  %116 = load i32, ptr %8, align 4, !tbaa !8
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %8, align 4, !tbaa !8
  br label %86, !llvm.loop !14

118:                                              ; preds = %90
  %119 = load i32, ptr %6, align 4, !tbaa !8
  %120 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %119)
  %121 = load i32, ptr %3, align 4, !tbaa !8
  %122 = load i32, ptr @n, align 4, !tbaa !8
  %123 = icmp ne i32 %121, %122
  br i1 %123, label %124, label %126

124:                                              ; preds = %118
  %125 = call i32 @putchar(i32 noundef 32)
  br label %126

126:                                              ; preds = %124, %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !8
  br label %127

127:                                              ; preds = %141, %126
  %128 = load i32, ptr %9, align 4, !tbaa !8
  %129 = load i32, ptr %3, align 4, !tbaa !8
  %130 = icmp sle i32 %128, %129
  br i1 %130, label %132, label %131

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

132:                                              ; preds = %127
  %133 = load i32, ptr %9, align 4, !tbaa !8
  %134 = sub nsw i32 8002, %133
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %135
  store i32 0, ptr %136, align 4, !tbaa !8
  %137 = load i32, ptr %9, align 4, !tbaa !8
  %138 = add nsw i32 8002, %137
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %139
  store i32 0, ptr %140, align 4, !tbaa !8
  br label %141

141:                                              ; preds = %132
  %142 = load i32, ptr %9, align 4, !tbaa !8
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %9, align 4, !tbaa !8
  br label %127, !llvm.loop !15

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

145:                                              ; preds = %144
  %146 = load i32, ptr %3, align 4, !tbaa !8
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %3, align 4, !tbaa !8
  br label %32, !llvm.loop !16

148:                                              ; preds = %36
  %149 = call i32 @puts(ptr noundef @.str.1)
  br label %10, !llvm.loop !17

150:                                              ; preds = %10
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) #2 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@a = external dso_local global [20005 x i32], align 16
@s = external dso_local local_unnamed_addr global [20005 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %2 = load ptr, ptr %1, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr %1, i64 %4
  %6 = tail call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %5)
  br i1 %6, label %.preheader42, label %._crit_edge60

.preheader42:                                     ; preds = %0, %._crit_edge59
  %7 = load i32, ptr @n, align 4, !tbaa !8
  %.not43 = icmp slt i32 %7, 1
  br i1 %.not43, label %._crit_edge59, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph
  %.not3856 = icmp slt i32 %10, 1
  br i1 %.not3856, label %._crit_edge59, label %.lr.ph58

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

.loopexit.unr-lcssa:                              ; preds = %99
  %lcmp.mod97.not = icmp eq i64 %xtraiter96, 0
  br i1 %lcmp.mod97.not, label %.loopexit, label %.loopexit.epilog-lcssa

.loopexit.epilog-lcssa:                           ; preds = %.loopexit.unr-lcssa
  %12 = sub nsw i64 8002, %indvars.iv.next74.1
  %13 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %12
  store i32 0, ptr %13, align 4, !tbaa !8
  %14 = add nuw nsw i64 %indvars.iv.next74.1, 8002
  %15 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %14
  store i32 0, ptr %15, align 4, !tbaa !8
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.unr-lcssa, %.loopexit.epilog-lcssa
  %16 = load i32, ptr @n, align 4, !tbaa !8
  %17 = sext i32 %16 to i64
  %.not38.not = icmp slt i64 %indvars.iv62, %17
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %indvar.next = add i64 %indvar, 1
  br i1 %.not38.not, label %.lr.ph58, label %._crit_edge59, !llvm.loop !13

._crit_edge59:                                    ; preds = %.loopexit, %.preheader42, %.preheader
  %18 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = getelementptr i8, ptr %20, i64 -24
  %22 = load i64, ptr %21, align 8
  %23 = getelementptr inbounds i8, ptr %19, i64 %22
  %24 = tail call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %23)
  br i1 %24, label %.preheader42, label %._crit_edge60, !llvm.loop !14

.lr.ph58:                                         ; preds = %.preheader, %.loopexit
  %indvar = phi i64 [ %indvar.next, %.loopexit ], [ 0, %.preheader ]
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.loopexit ], [ 2, %.preheader ]
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %.loopexit ], [ 1, %.preheader ]
  %25 = phi i32 [ %16, %.loopexit ], [ %10, %.preheader ]
  %26 = trunc i64 %indvar to i32
  %27 = xor i32 %26, -1
  %28 = trunc i64 %indvar to i32
  %29 = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 32008), align 8, !tbaa !8
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr getelementptr inbounds (i8, ptr @s, i64 32008), align 8, !tbaa !8
  %31 = icmp ugt i64 %indvars.iv62, 1
  br i1 %31, label %.lr.ph47, label %._crit_edge

.lr.ph47:                                         ; preds = %.lr.ph58
  %32 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %indvars.iv62
  %33 = load i32, ptr %32, align 4, !tbaa !8
  %xtraiter = and i64 %indvar, 1
  %34 = icmp eq i64 %indvar, 1
  br i1 %34, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph47.new

.lr.ph47.new:                                     ; preds = %.lr.ph47
  %unroll_iter = and i64 %indvar, -2
  br label %50

._crit_edge.loopexit.unr-lcssa:                   ; preds = %50, %.lr.ph47
  %indvars.iv64.unr = phi i64 [ %indvars.iv62, %.lr.ph47 ], [ %indvars.iv.next65.1, %50 ]
  %.03545.unr = phi i32 [ 0, %.lr.ph47 ], [ %.1.1, %50 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge.loopexit, label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %._crit_edge.loopexit.unr-lcssa
  %indvars.iv.next65.epil = add i64 %indvars.iv64.unr, 4294967295
  %35 = and i64 %indvars.iv.next65.epil, 4294967295
  %36 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !8
  %38 = icmp sgt i32 %37, %33
  %.1.v.epil = select i1 %38, i32 1, i32 -1
  %.1.epil = add nsw i32 %.1.v.epil, %.03545.unr
  %39 = add nsw i32 %.1.epil, 8002
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !8
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %41, align 4, !tbaa !8
  br label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %._crit_edge.loopexit.unr-lcssa, %._crit_edge.loopexit.epilog-lcssa
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 32008), align 8, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph58
  %44 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %30, %.lr.ph58 ]
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %45 = sext i32 %25 to i64
  %.not3948.not = icmp slt i64 %indvars.iv62, %45
  br i1 %.not3948.not, label %.lr.ph53, label %._crit_edge54

.lr.ph53:                                         ; preds = %._crit_edge
  %46 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %indvars.iv62
  %47 = load i32, ptr %46, align 4, !tbaa !8
  %48 = add i32 %25, %27
  %reass.sub = sub i32 %25, %28
  %xtraiter90 = and i32 %48, 1
  %49 = icmp eq i32 %reass.sub, 2
  br i1 %49, label %._crit_edge54.loopexit.unr-lcssa, label %.lr.ph53.new

.lr.ph53.new:                                     ; preds = %.lr.ph53
  %unroll_iter93 = and i32 %48, -2
  br label %80

50:                                               ; preds = %50, %.lr.ph47.new
  %indvars.iv64 = phi i64 [ %indvars.iv62, %.lr.ph47.new ], [ %indvars.iv.next65.1, %50 ]
  %.03545 = phi i32 [ 0, %.lr.ph47.new ], [ %.1.1, %50 ]
  %niter = phi i64 [ 0, %.lr.ph47.new ], [ %niter.next.1, %50 ]
  %indvars.iv.next65 = add i64 %indvars.iv64, 4294967295
  %51 = and i64 %indvars.iv.next65, 4294967295
  %52 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !8
  %54 = icmp sgt i32 %53, %33
  %.1.v = select i1 %54, i32 1, i32 -1
  %.1 = add nsw i32 %.1.v, %.03545
  %55 = add nsw i32 %.1, 8002
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !8
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %57, align 4, !tbaa !8
  %indvars.iv.next65.1 = add nsw i64 %indvars.iv64, -2
  %60 = and i64 %indvars.iv.next65.1, 4294967295
  %61 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !8
  %63 = icmp sgt i32 %62, %33
  %.1.v.1 = select i1 %63, i32 1, i32 -1
  %.1.1 = add nsw i32 %.1.v.1, %.1
  %64 = add nsw i32 %.1.1, 8002
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !8
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %66, align 4, !tbaa !8
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1.not, label %._crit_edge.loopexit.unr-lcssa, label %50, !llvm.loop !15

._crit_edge54.loopexit.unr-lcssa:                 ; preds = %80, %.lr.ph53
  %.lcssa88.ph = phi i32 [ poison, %.lr.ph53 ], [ %96, %80 ]
  %indvars.iv69.unr = phi i64 [ %indvars.iv67, %.lr.ph53 ], [ %indvars.iv.next70.1, %80 ]
  %.03450.unr = phi i32 [ %44, %.lr.ph53 ], [ %96, %80 ]
  %.249.unr = phi i32 [ 0, %.lr.ph53 ], [ %.3.1, %80 ]
  %lcmp.mod91.not = icmp eq i32 %xtraiter90, 0
  br i1 %lcmp.mod91.not, label %._crit_edge54, label %._crit_edge54.loopexit.epilog-lcssa

._crit_edge54.loopexit.epilog-lcssa:              ; preds = %._crit_edge54.loopexit.unr-lcssa
  %69 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %indvars.iv69.unr
  %70 = load i32, ptr %69, align 4, !tbaa !8
  %71 = icmp sgt i32 %70, %47
  %.3.v.epil = select i1 %71, i32 -1, i32 1
  %.3.epil = add nsw i32 %.3.v.epil, %.249.unr
  %72 = add nsw i32 %.3.epil, 8002
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !8
  %76 = add nsw i32 %75, %.03450.unr
  br label %._crit_edge54

._crit_edge54:                                    ; preds = %._crit_edge54.loopexit.epilog-lcssa, %._crit_edge54.loopexit.unr-lcssa, %._crit_edge
  %.034.lcssa = phi i32 [ %44, %._crit_edge ], [ %.lcssa88.ph, %._crit_edge54.loopexit.unr-lcssa ], [ %76, %._crit_edge54.loopexit.epilog-lcssa ]
  %77 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.034.lcssa)
  %78 = load i32, ptr @n, align 4, !tbaa !8
  %79 = zext i32 %78 to i64
  %.not40 = icmp eq i64 %indvars.iv62, %79
  br i1 %.not40, label %.preheader87, label %97

80:                                               ; preds = %80, %.lr.ph53.new
  %indvars.iv69 = phi i64 [ %indvars.iv67, %.lr.ph53.new ], [ %indvars.iv.next70.1, %80 ]
  %.03450 = phi i32 [ %44, %.lr.ph53.new ], [ %96, %80 ]
  %.249 = phi i32 [ 0, %.lr.ph53.new ], [ %.3.1, %80 ]
  %niter94 = phi i32 [ 0, %.lr.ph53.new ], [ %niter94.next.1, %80 ]
  %81 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %indvars.iv69
  %82 = load i32, ptr %81, align 4, !tbaa !8
  %83 = icmp sgt i32 %82, %47
  %.3.v = select i1 %83, i32 -1, i32 1
  %.3 = add nsw i32 %.3.v, %.249
  %84 = add nsw i32 %.3, 8002
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !8
  %88 = add nsw i32 %87, %.03450
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %89 = getelementptr inbounds [20005 x i32], ptr @a, i64 0, i64 %indvars.iv.next70
  %90 = load i32, ptr %89, align 4, !tbaa !8
  %91 = icmp sgt i32 %90, %47
  %.3.v.1 = select i1 %91, i32 -1, i32 1
  %.3.1 = add nsw i32 %.3.v.1, %.3
  %92 = add nsw i32 %.3.1, 8002
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !8
  %96 = add nsw i32 %95, %88
  %indvars.iv.next70.1 = add nuw nsw i64 %indvars.iv69, 2
  %niter94.next.1 = add i32 %niter94, 2
  %niter94.ncmp.1 = icmp eq i32 %niter94.next.1, %unroll_iter93
  br i1 %niter94.ncmp.1, label %._crit_edge54.loopexit.unr-lcssa, label %80, !llvm.loop !16

97:                                               ; preds = %._crit_edge54
  %98 = tail call i32 @putchar(i32 noundef 32)
  br label %.preheader87

.preheader87:                                     ; preds = %97, %._crit_edge54
  %xtraiter96 = and i64 %indvars.iv67, 1
  %unroll_iter98 = and i64 %indvars.iv67, 9223372036854775806
  br label %99

99:                                               ; preds = %99, %.preheader87
  %indvars.iv73 = phi i64 [ 0, %.preheader87 ], [ %indvars.iv.next74.1, %99 ]
  %niter99 = phi i64 [ 0, %.preheader87 ], [ %niter99.next.1, %99 ]
  %100 = sub nsw i64 8002, %indvars.iv73
  %101 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %100
  store i32 0, ptr %101, align 8, !tbaa !8
  %102 = add nuw nsw i64 %indvars.iv73, 8002
  %103 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %102
  store i32 0, ptr %103, align 8, !tbaa !8
  %104 = sub nsw i64 8001, %indvars.iv73
  %105 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %104
  store i32 0, ptr %105, align 4, !tbaa !8
  %106 = add nuw nsw i64 %indvars.iv73, 8003
  %107 = getelementptr inbounds [20005 x i32], ptr @s, i64 0, i64 %106
  store i32 0, ptr %107, align 4, !tbaa !8
  %indvars.iv.next74.1 = add nuw nsw i64 %indvars.iv73, 2
  %niter99.next.1 = add i64 %niter99, 2
  %niter99.ncmp.1 = icmp eq i64 %niter99.next.1, %unroll_iter98
  br i1 %niter99.ncmp.1, label %.loopexit.unr-lcssa, label %99, !llvm.loop !17

._crit_edge60:                                    ; preds = %._crit_edge59, %0
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { inlinehint mustprogress nofree 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" }

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

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


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