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

; 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
@s = external dso_local global [100001 x i32], align 16
@tot = external dso_local global i32, align 4
@p = external dso_local global [100001 x i32], align 16
@bit = external dso_local global [100001 x i32], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4)) #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 nounwind uwtable
declare dso_local void @_Z3addi(i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sumi(i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3idxx(i64 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %28, %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = icmp sle i32 %10, %11
  br i1 %12, label %14, label %13

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

14:                                               ; preds = %9
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %16
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %17)
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sub nsw i32 %18, 1
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = add nsw i32 %26, %22
  store i32 %27, ptr %25, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %14
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %2, align 4, !tbaa !5
  br label %9, !llvm.loop !9

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

32:                                               ; preds = %129, %31
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = shl i32 1, %33
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp sle i32 %34, %38
  br i1 %39, label %41, label %40

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

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

42:                                               ; preds = %60, %41
  %43 = load i32, ptr %6, 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 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %63

47:                                               ; preds = %42
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  %54 = shl i32 1, %53
  %55 = sub nsw i32 %54, 1
  %56 = and i32 %51, %55
  %57 = load i32, ptr %6, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100001 x i32], ptr @p, i64 0, i64 %58
  store i32 %56, ptr %59, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %47
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %6, align 4, !tbaa !5
  br label %42, !llvm.loop !11

63:                                               ; preds = %46
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i32, ptr @p, i64 %65
  %67 = getelementptr inbounds i32, ptr %66, i64 1
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @p, ptr noundef %67)
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds i32, ptr @p, i64 %69
  %71 = getelementptr inbounds i32, ptr %70, i64 1
  %72 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @p, ptr noundef %71)
  %73 = ptrtoint ptr %72 to i64
  %74 = sub i64 %73, ptrtoint (ptr @p to i64)
  %75 = sdiv exact i64 %74, 4
  %76 = trunc i64 %75 to i32
  store i32 %76, ptr @tot, align 4, !tbaa !5
  %77 = load i32, ptr @tot, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = mul i64 %78, 4
  call void @llvm.memset.p0.i64(ptr align 16 @bit, i8 0, i64 %79, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %120, %63
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = load i32, ptr @n, align 4, !tbaa !5
  %83 = icmp sle i32 %81, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %80
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %123

85:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  %92 = shl i32 1, %91
  %93 = sub nsw i32 %92, 1
  %94 = and i32 %89, %93
  store i32 %94, ptr %8, align 4, !tbaa !5
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = call noundef i32 @_Z3idxx(i64 noundef %96)
  call void @_Z3addi(i32 noundef %97)
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = load i32, ptr %3, align 4, !tbaa !5
  %100 = shl i32 1, %99
  %101 = sub nsw i32 %98, %100
  %102 = sext i32 %101 to i64
  %103 = call noundef i32 @_Z3idxx(i64 noundef %102)
  %104 = call noundef i32 @_Z3sumi(i32 noundef %103)
  %105 = load i32, ptr %8, align 4, !tbaa !5
  %106 = load i32, ptr %3, align 4, !tbaa !5
  %107 = shl i32 1, %106
  %108 = add nsw i32 %105, %107
  %109 = sext i32 %108 to i64
  %110 = call noundef i32 @_Z3idxx(i64 noundef %109)
  %111 = call noundef i32 @_Z3sumi(i32 noundef %110)
  %112 = xor i32 %104, %111
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = call noundef i32 @_Z3idxx(i64 noundef %114)
  %116 = call noundef i32 @_Z3sumi(i32 noundef %115)
  %117 = xor i32 %112, %116
  %118 = load i32, ptr %5, align 4, !tbaa !5
  %119 = xor i32 %118, %117
  store i32 %119, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %120

120:                                              ; preds = %85
  %121 = load i32, ptr %7, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %7, align 4, !tbaa !5
  br label %80, !llvm.loop !12

123:                                              ; preds = %84
  %124 = load i32, ptr %5, align 4, !tbaa !5
  %125 = load i32, ptr %3, align 4, !tbaa !5
  %126 = shl i32 %124, %125
  %127 = load i32, ptr @ans, align 4, !tbaa !5
  %128 = or i32 %127, %126
  store i32 %128, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %129

129:                                              ; preds = %123
  %130 = load i32, ptr %3, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %3, align 4, !tbaa !5
  br label %32, !llvm.loop !13

132:                                              ; preds = %40
  %133 = load i32, ptr @ans, align 4, !tbaa !5
  %134 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %133)
  ret i32 0
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #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 nounwind willreturn memory(argmem: write) }
attributes #6 = { "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 #7 = { 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}


; 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
@s = external dso_local global [100001 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@p = external dso_local global [100001 x i32], align 16
@bit = external dso_local local_unnamed_addr global [100001 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addi(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3idxx(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  tail call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  %1 = load i32, ptr @n, align 4, !tbaa !5
  %.not35 = icmp slt i32 %1, 1
  br i1 %.not35, label %..preheader34_crit_edge, label %.lr.ph

..preheader34_crit_edge:                          ; preds = %0
  %.pre57 = sext i32 %1 to i64
  br label %.preheader34

.preheader34:                                     ; preds = %.lr.ph, %..preheader34_crit_edge
  %.pre-phi = phi i64 [ %.pre57, %..preheader34_crit_edge ], [ %12, %.lr.ph ]
  %2 = phi i32 [ %1, %..preheader34_crit_edge ], [ %11, %.lr.ph ]
  %3 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %.pre-phi
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %.not3147 = icmp slt i32 %4, 1
  br i1 %.not3147, label %.preheader34.._crit_edge49_crit_edge, label %.preheader

.preheader34.._crit_edge49_crit_edge:             ; preds = %.preheader34
  %.pre = load i32, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge49

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %5 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %indvars.iv
  tail call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %5)
  %6 = add nsw i64 %indvars.iv, -1
  %7 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %6
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %9 = load i32, ptr %5, align 4, !tbaa !5
  %10 = add nsw i32 %9, %8
  store i32 %10, ptr %5, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %.not.not = icmp slt i64 %indvars.iv, %12
  br i1 %.not.not, label %.lr.ph, label %.preheader34, !llvm.loop !9

.preheader:                                       ; preds = %.preheader34, %._crit_edge45
  %13 = phi i64 [ %.pre-phi61, %._crit_edge45 ], [ %.pre-phi, %.preheader34 ]
  %14 = phi i32 [ %43, %._crit_edge45 ], [ %2, %.preheader34 ]
  %15 = phi i32 [ %.pre58, %._crit_edge45 ], [ 1, %.preheader34 ]
  %.02848 = phi i32 [ %47, %._crit_edge45 ], [ 0, %.preheader34 ]
  %.not3237 = icmp slt i32 %14, 0
  br i1 %.not3237, label %._crit_edge, label %.lr.ph39

.lr.ph39:                                         ; preds = %.preheader
  %16 = shl nuw i32 2, %.02848
  %17 = add nsw i32 %16, -1
  %18 = add nuw i32 %14, 1
  %wide.trip.count = zext i32 %18 to i64
  %min.iters.check = icmp ult i32 %14, 7
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph39
  %indvars.iv51.ph = phi i64 [ 0, %.lr.ph39 ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph39
  %n.vec = and i64 %wide.trip.count, 4294967288
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %17, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %19 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %index
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  %wide.load = load <4 x i32>, ptr %19, align 16, !tbaa !5
  %wide.load72 = load <4 x i32>, ptr %20, align 16, !tbaa !5
  %21 = and <4 x i32> %wide.load, %broadcast.splat
  %22 = and <4 x i32> %wide.load72, %broadcast.splat
  %23 = getelementptr inbounds [100001 x i32], ptr @p, i64 0, i64 %index
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  store <4 x i32> %21, ptr %23, align 16, !tbaa !5
  store <4 x i32> %22, ptr %24, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %25 = icmp eq i64 %index.next, %n.vec
  br i1 %25, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge49:                                    ; preds = %._crit_edge45, %.preheader34.._crit_edge49_crit_edge
  %26 = phi i32 [ %.pre, %.preheader34.._crit_edge49_crit_edge ], [ %46, %._crit_edge45 ]
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %26)
  ret i32 0

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %.preheader
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @p, i64 4), i64 %13
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @p, ptr noundef nonnull %gep)
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %gep46 = getelementptr i32, ptr getelementptr inbounds (i8, ptr @p, i64 4), i64 %29
  %30 = tail call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @p, ptr noundef nonnull %gep46)
  %31 = ptrtoint ptr %30 to i64
  %32 = sub i64 %31, ptrtoint (ptr @p to i64)
  %33 = lshr exact i64 %32, 2
  %34 = trunc i64 %33 to i32
  store i32 %34, ptr @tot, align 4, !tbaa !5
  %sext = shl i64 %32, 30
  %35 = ashr exact i64 %sext, 30
  %36 = and i64 %35, -4
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @bit, i8 0, i64 %36, i1 false)
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %.not3340 = icmp slt i32 %37, 0
  %.pre58 = shl nuw i32 2, %.02848
  br i1 %.not3340, label %._crit_edge.._crit_edge45_crit_edge, label %.lr.ph44

._crit_edge.._crit_edge45_crit_edge:              ; preds = %._crit_edge
  %.pre60 = sext i32 %37 to i64
  br label %._crit_edge45

.lr.ph44:                                         ; preds = %._crit_edge
  %38 = add nsw i32 %.pre58, -1
  br label %50

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %scalar.ph ], [ %indvars.iv51.ph, %scalar.ph.preheader ]
  %39 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %indvars.iv51
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = and i32 %40, %17
  %42 = getelementptr inbounds [100001 x i32], ptr @p, i64 0, i64 %indvars.iv51
  store i32 %41, ptr %42, align 4, !tbaa !5
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !14

._crit_edge45:                                    ; preds = %50, %._crit_edge.._crit_edge45_crit_edge
  %.pre-phi61 = phi i64 [ %.pre60, %._crit_edge.._crit_edge45_crit_edge ], [ %70, %50 ]
  %43 = phi i32 [ %37, %._crit_edge.._crit_edge45_crit_edge ], [ %69, %50 ]
  %.027.lcssa = phi i32 [ 0, %._crit_edge.._crit_edge45_crit_edge ], [ %68, %50 ]
  %44 = shl i32 %.027.lcssa, %.02848
  %45 = load i32, ptr @ans, align 4, !tbaa !5
  %46 = or i32 %45, %44
  store i32 %46, ptr @ans, align 4, !tbaa !5
  %47 = add nuw nsw i32 %.02848, 1
  %48 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %.pre-phi61
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %.not31 = icmp sgt i32 %.pre58, %49
  br i1 %.not31, label %._crit_edge49, label %.preheader, !llvm.loop !15

50:                                               ; preds = %.lr.ph44, %50
  %indvars.iv54 = phi i64 [ 0, %.lr.ph44 ], [ %indvars.iv.next55, %50 ]
  %.02741 = phi i32 [ 0, %.lr.ph44 ], [ %68, %50 ]
  %51 = getelementptr inbounds [100001 x i32], ptr @s, i64 0, i64 %indvars.iv54
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = and i32 %52, %38
  %54 = sext i32 %53 to i64
  %55 = tail call noundef i32 @_Z3idxx(i64 noundef %54)
  tail call void @_Z3addi(i32 noundef %55)
  %56 = sub nsw i32 %53, %15
  %57 = sext i32 %56 to i64
  %58 = tail call noundef i32 @_Z3idxx(i64 noundef %57)
  %59 = tail call noundef i32 @_Z3sumi(i32 noundef %58)
  %60 = add nsw i32 %53, %15
  %61 = sext i32 %60 to i64
  %62 = tail call noundef i32 @_Z3idxx(i64 noundef %61)
  %63 = tail call noundef i32 @_Z3sumi(i32 noundef %62)
  %64 = tail call noundef i32 @_Z3idxx(i64 noundef %54)
  %65 = tail call noundef i32 @_Z3sumi(i32 noundef %64)
  %66 = xor i32 %59, %.02741
  %67 = xor i32 %66, %63
  %68 = xor i32 %67, %65
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %69 = load i32, ptr @n, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %.not33.not = icmp slt i64 %indvars.iv54, %70
  br i1 %.not33.not, label %50, label %._crit_edge45, !llvm.loop !16
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

attributes #0 = { 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 #1 = { 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 #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 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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" }

!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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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