; LLVM IR from kazunetakahashi/atcoder :: 2017/0312_AGC011 (B)

; 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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i32, align 4
@A = external dso_local global [100010 x i64], align 16
@sum = external dso_local global [100010 x i64], align 16
@ok = external dso_local global [100010 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %20, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @N, align 4, !tbaa !5
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %15, label %14

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

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %17
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %18)
  br label %20

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !9

23:                                               ; preds = %14
  %24 = load i32, ptr @N, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i64, ptr @A, i64 %25
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @A, ptr noundef %26)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @sum, ptr noundef getelementptr inbounds (i64, ptr @sum, i64 100010), ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %27 = load i64, ptr @A, align 16, !tbaa !11
  store i64 %27, ptr @sum, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %47, %23
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = load i32, ptr @N, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %50

33:                                               ; preds = %28
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %35
  %37 = load i64, ptr %36, align 8, !tbaa !11
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sub nsw i32 %38, 1
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !11
  %43 = add nsw i64 %37, %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %45
  store i64 %43, ptr %46, align 8, !tbaa !11
  br label %47

47:                                               ; preds = %33
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %4, align 4, !tbaa !5
  br label %28, !llvm.loop !13

50:                                               ; preds = %32
  %51 = load i32, ptr @N, align 4, !tbaa !5
  %52 = sub nsw i32 %51, 1
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %53
  store i8 1, ptr %54, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %77, %50
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = load i32, ptr @N, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %80

60:                                               ; preds = %55
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sub nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !11
  %66 = mul nsw i64 %65, 2
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !11
  %71 = icmp sge i64 %66, %70
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %74
  %76 = zext i1 %71 to i8
  store i8 %76, ptr %75, align 1, !tbaa !14
  br label %77

77:                                               ; preds = %60
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %5, align 4, !tbaa !5
  br label %55, !llvm.loop !16

80:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %81 = load i32, ptr @N, align 4, !tbaa !5
  %82 = sub nsw i32 %81, 1
  store i32 %82, ptr %6, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %99, %80
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = icmp sge i32 %84, 1
  br i1 %85, label %87, label %86

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

87:                                               ; preds = %83
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %89
  %91 = load i8, ptr %90, align 1, !tbaa !14, !range !17, !noundef !18
  %92 = trunc i8 %91 to i1
  br i1 %92, label %98, label %93

93:                                               ; preds = %87
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = sub nsw i32 %94, 1
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %96
  store i8 0, ptr %97, align 1, !tbaa !14
  br label %98

98:                                               ; preds = %93, %87
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = add nsw i32 %100, -1
  store i32 %101, ptr %6, align 4, !tbaa !5
  br label %83, !llvm.loop !19

102:                                              ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %118, %102
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = load i32, ptr @N, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %121

108:                                              ; preds = %103
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !14, !range !17, !noundef !18
  %113 = trunc i8 %112 to i1
  br i1 %113, label %114, label %117

114:                                              ; preds = %108
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %7, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %114, %108
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %8, align 4, !tbaa !5
  br label %103, !llvm.loop !20

121:                                              ; preds = %107
  %122 = load i32, ptr %7, align 4, !tbaa !5
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %122)
  %124 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %123, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  %125 = load i32, ptr %1, align 4
  ret i32 %125
}

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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #4

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

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

%"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i32, align 4
@A = external dso_local global [100010 x i64], align 16
@sum = external dso_local global [100010 x i64], align 16
@ok = external dso_local local_unnamed_addr global [100010 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = 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)
  %3 = load i32, ptr @N, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %3 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %18, %.lr.ph ]
  %5 = getelementptr inbounds i64, ptr @A, i64 %.pre-phi
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @A, ptr noundef nonnull %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @sum, ptr noundef nonnull getelementptr inbounds (i8, ptr @sum, i64 800080), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %6 = load i64, ptr @A, align 16, !tbaa !9
  store i64 %6, ptr @sum, align 16, !tbaa !9
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 1
  br i1 %8, label %.lr.ph36.preheader, label %._crit_edge37.thread

._crit_edge37.thread:                             ; preds = %._crit_edge
  %9 = add nsw i32 %7, -1
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %10
  store i8 1, ptr %11, align 1, !tbaa !11
  br label %.preheader

.lr.ph36.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %7 to i64
  %12 = add nsw i64 %wide.trip.count, -1
  %13 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %12, 3
  %14 = icmp ult i64 %13, 3
  br i1 %14, label %._crit_edge37.unr-lcssa, label %.lr.ph36.preheader.new

.lr.ph36.preheader.new:                           ; preds = %.lr.ph36.preheader
  %unroll_iter = and i64 %12, -4
  br label %.lr.ph36

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %15 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %indvars.iv
  %16 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @N, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge37.unr-lcssa:                          ; preds = %.lr.ph36, %.lr.ph36.preheader
  %.unr = phi i64 [ %6, %.lr.ph36.preheader ], [ %57, %.lr.ph36 ]
  %indvars.iv52.unr = phi i64 [ 1, %.lr.ph36.preheader ], [ %indvars.iv.next53.3, %.lr.ph36 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge37, label %.lr.ph36.epil

.lr.ph36.epil:                                    ; preds = %._crit_edge37.unr-lcssa, %.lr.ph36.epil
  %20 = phi i64 [ %23, %.lr.ph36.epil ], [ %.unr, %._crit_edge37.unr-lcssa ]
  %indvars.iv52.epil = phi i64 [ %indvars.iv.next53.epil, %.lr.ph36.epil ], [ %indvars.iv52.unr, %._crit_edge37.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph36.epil ], [ 0, %._crit_edge37.unr-lcssa ]
  %21 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %indvars.iv52.epil
  %22 = load i64, ptr %21, align 8, !tbaa !9
  %23 = add nsw i64 %20, %22
  %24 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %indvars.iv52.epil
  store i64 %23, ptr %24, align 8, !tbaa !9
  %indvars.iv.next53.epil = add nuw nsw i64 %indvars.iv52.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge37, label %.lr.ph36.epil, !llvm.loop !15

._crit_edge37:                                    ; preds = %.lr.ph36.epil, %._crit_edge37.unr-lcssa
  %25 = add nsw i32 %7, -1
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %26
  store i8 1, ptr %27, align 1, !tbaa !11
  br i1 %8, label %.lr.ph41.preheader, label %.preheader

.lr.ph41.preheader:                               ; preds = %._crit_edge37
  %wide.trip.count58 = zext nneg i32 %7 to i64
  %28 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i32 %7, 5
  br i1 %min.iters.check, label %.lr.ph41.preheader87, label %vector.ph

.lr.ph41.preheader87:                             ; preds = %middle.block, %.lr.ph41.preheader
  %indvars.iv55.ph = phi i64 [ 1, %.lr.ph41.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph41

vector.ph:                                        ; preds = %.lr.ph41.preheader
  %n.vec = and i64 %28, -4
  %ind.end = or disjoint i64 %n.vec, 1
  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
  %29 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %index
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  %wide.load = load <2 x i64>, ptr %29, align 16, !tbaa !9
  %wide.load68 = load <2 x i64>, ptr %30, align 16, !tbaa !9
  %31 = shl nsw <2 x i64> %wide.load, <i64 1, i64 1>
  %32 = shl nsw <2 x i64> %wide.load68, <i64 1, i64 1>
  %33 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %offset.idx
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  %wide.load69 = load <2 x i64>, ptr %33, align 8, !tbaa !9
  %wide.load70 = load <2 x i64>, ptr %34, align 8, !tbaa !9
  %35 = icmp sge <2 x i64> %31, %wide.load69
  %36 = icmp sge <2 x i64> %32, %wide.load70
  %37 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %index
  %38 = zext <2 x i1> %35 to <2 x i8>
  %39 = zext <2 x i1> %36 to <2 x i8>
  %40 = getelementptr inbounds i8, ptr %37, i64 2
  store <2 x i8> %38, ptr %37, align 4, !tbaa !11
  store <2 x i8> %39, ptr %40, align 2, !tbaa !11
  %index.next = add nuw i64 %index, 4
  %41 = icmp eq i64 %index.next, %n.vec
  br i1 %41, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %28, %n.vec
  br i1 %cmp.n, label %.preheader31, label %.lr.ph41.preheader87

.lr.ph36:                                         ; preds = %.lr.ph36, %.lr.ph36.preheader.new
  %42 = phi i64 [ %6, %.lr.ph36.preheader.new ], [ %57, %.lr.ph36 ]
  %indvars.iv52 = phi i64 [ 1, %.lr.ph36.preheader.new ], [ %indvars.iv.next53.3, %.lr.ph36 ]
  %niter = phi i64 [ 0, %.lr.ph36.preheader.new ], [ %niter.next.3, %.lr.ph36 ]
  %43 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %indvars.iv52
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = add nsw i64 %42, %44
  %46 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %indvars.iv52
  store i64 %45, ptr %46, align 8, !tbaa !9
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %47 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %indvars.iv.next53
  %48 = load i64, ptr %47, align 8, !tbaa !9
  %49 = add nsw i64 %45, %48
  %50 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %indvars.iv.next53
  store i64 %49, ptr %50, align 8, !tbaa !9
  %indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 2
  %51 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %indvars.iv.next53.1
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = add nsw i64 %49, %52
  %54 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %indvars.iv.next53.1
  store i64 %53, ptr %54, align 8, !tbaa !9
  %indvars.iv.next53.2 = add nuw nsw i64 %indvars.iv52, 3
  %55 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %indvars.iv.next53.2
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = add nsw i64 %53, %56
  %58 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %indvars.iv.next53.2
  store i64 %57, ptr %58, align 8, !tbaa !9
  %indvars.iv.next53.3 = add nuw nsw i64 %indvars.iv52, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge37.unr-lcssa, label %.lr.ph36, !llvm.loop !20

.preheader31:                                     ; preds = %.lr.ph41, %middle.block
  br i1 %8, label %.lr.ph45.preheader, label %.preheader

.lr.ph45.preheader:                               ; preds = %.preheader31
  %59 = zext nneg i32 %7 to i64
  br label %.lr.ph45

.lr.ph41:                                         ; preds = %.lr.ph41.preheader87, %.lr.ph41
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %.lr.ph41 ], [ %indvars.iv55.ph, %.lr.ph41.preheader87 ]
  %60 = add nsw i64 %indvars.iv55, -1
  %61 = getelementptr inbounds [100010 x i64], ptr @sum, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !9
  %63 = shl nsw i64 %62, 1
  %64 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %indvars.iv55
  %65 = load i64, ptr %64, align 8, !tbaa !9
  %66 = icmp sge i64 %63, %65
  %67 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %60
  %68 = zext i1 %66 to i8
  store i8 %68, ptr %67, align 1, !tbaa !11
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %exitcond59.not = icmp eq i64 %indvars.iv.next56, %wide.trip.count58
  br i1 %exitcond59.not, label %.preheader31, label %.lr.ph41, !llvm.loop !21

.preheader:                                       ; preds = %84, %._crit_edge37, %._crit_edge37.thread, %.preheader31
  %69 = icmp sgt i32 %7, 0
  br i1 %69, label %.lr.ph48.preheader, label %._crit_edge49

.lr.ph48.preheader:                               ; preds = %.preheader
  %wide.trip.count66 = zext nneg i32 %7 to i64
  %min.iters.check73 = icmp ult i32 %7, 8
  br i1 %min.iters.check73, label %.lr.ph48.preheader85, label %vector.ph74

.lr.ph48.preheader85:                             ; preds = %middle.block71, %.lr.ph48.preheader
  %indvars.iv63.ph = phi i64 [ 0, %.lr.ph48.preheader ], [ %n.vec76, %middle.block71 ]
  %.02346.ph = phi i32 [ 0, %.lr.ph48.preheader ], [ %77, %middle.block71 ]
  br label %.lr.ph48

vector.ph74:                                      ; preds = %.lr.ph48.preheader
  %n.vec76 = and i64 %wide.trip.count66, 2147483640
  br label %vector.body78

vector.body78:                                    ; preds = %vector.body78, %vector.ph74
  %index79 = phi i64 [ 0, %vector.ph74 ], [ %index.next83, %vector.body78 ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph74 ], [ %74, %vector.body78 ]
  %vec.phi80 = phi <4 x i32> [ zeroinitializer, %vector.ph74 ], [ %75, %vector.body78 ]
  %70 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %index79
  %71 = getelementptr inbounds i8, ptr %70, i64 4
  %wide.load81 = load <4 x i8>, ptr %70, align 8, !tbaa !11
  %wide.load82 = load <4 x i8>, ptr %71, align 4, !tbaa !11
  %72 = zext <4 x i8> %wide.load81 to <4 x i32>
  %73 = zext <4 x i8> %wide.load82 to <4 x i32>
  %74 = add <4 x i32> %vec.phi, %72
  %75 = add <4 x i32> %vec.phi80, %73
  %index.next83 = add nuw i64 %index79, 8
  %76 = icmp eq i64 %index.next83, %n.vec76
  br i1 %76, label %middle.block71, label %vector.body78, !llvm.loop !22

middle.block71:                                   ; preds = %vector.body78
  %bin.rdx = add <4 x i32> %75, %74
  %77 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n84 = icmp eq i64 %n.vec76, %wide.trip.count66
  br i1 %cmp.n84, label %._crit_edge49, label %.lr.ph48.preheader85

.lr.ph45:                                         ; preds = %.lr.ph45.preheader, %84
  %indvars.iv60 = phi i64 [ %59, %.lr.ph45.preheader ], [ %indvars.iv.next61, %84 ]
  %indvars.iv.next61 = add nsw i64 %indvars.iv60, -1
  %78 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %indvars.iv.next61
  %79 = load i8, ptr %78, align 1, !tbaa !11, !range !23, !noundef !24
  %80 = trunc nuw i8 %79 to i1
  br i1 %80, label %84, label %81

81:                                               ; preds = %.lr.ph45
  %82 = add nsw i64 %indvars.iv60, -2
  %83 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %82
  store i8 0, ptr %83, align 1, !tbaa !11
  br label %84

84:                                               ; preds = %.lr.ph45, %81
  %85 = icmp ugt i64 %indvars.iv60, 2
  br i1 %85, label %.lr.ph45, label %.preheader, !llvm.loop !25

._crit_edge49:                                    ; preds = %.lr.ph48, %middle.block71, %.preheader
  %.023.lcssa = phi i32 [ 0, %.preheader ], [ %77, %middle.block71 ], [ %spec.select, %.lr.ph48 ]
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.023.lcssa)
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %86, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph48:                                         ; preds = %.lr.ph48.preheader85, %.lr.ph48
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %.lr.ph48 ], [ %indvars.iv63.ph, %.lr.ph48.preheader85 ]
  %.02346 = phi i32 [ %spec.select, %.lr.ph48 ], [ %.02346.ph, %.lr.ph48.preheader85 ]
  %88 = getelementptr inbounds [100010 x i8], ptr @ok, i64 0, i64 %indvars.iv63
  %89 = load i8, ptr %88, align 1, !tbaa !11, !range !23, !noundef !24
  %90 = zext nneg i8 %89 to i32
  %spec.select = add nuw nsw i32 %.02346, %90
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %exitcond67.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count66
  br i1 %exitcond67.not, label %._crit_edge49, label %.lr.ph48, !llvm.loop !26
}

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #4

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !14, !18, !19}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14, !19, !18}
!22 = distinct !{!22, !14, !18, !19}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !14, !19, !18}


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