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

; 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::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [2 x i64] }
%"class.std::bitset<101>::reference" = type { ptr, i64 }

@n = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@x = external dso_local global [101 x i32], align 16
@y = external dso_local global [101 x i32], align 16
@ord = external dso_local global [101 x i32], align 16
@e = external dso_local global [101 x %"class.std::bitset"], align 16
@msk = external dso_local global { [2 x i64] }, align 8
@ans = external dso_local global { [2 x i64] }, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = 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 %"class.std::bitset<101>::reference", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::bitset<101>::reference", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::bitset<101>::reference", align 8
  store i32 0, ptr %1, align 4
  br label %13

13:                                               ; preds = %172, %0
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @d)
  %15 = icmp eq i32 %14, 2
  br i1 %15, label %16, label %174

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

17:                                               ; preds = %34, %16
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr @x, i64 %24
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i32, ptr @y, i64 %27
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %25, ptr noundef %28)
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %32
  store i32 %30, ptr %33, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %22
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

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

38:                                               ; preds = %84, %37
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 7, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %87

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

44:                                               ; preds = %80, %43
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %44
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [101 x i32], ptr @x, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [101 x i32], ptr @x, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sub nsw i32 %53, %57
  %59 = call noundef i32 @_Z3sqri(i32 noundef %58)
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [101 x i32], ptr @y, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [101 x i32], ptr @y, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sub nsw i32 %63, %67
  %69 = call noundef i32 @_Z3sqri(i32 noundef %68)
  %70 = add nsw i32 %59, %69
  %71 = load i32, ptr @d, align 4, !tbaa !5
  %72 = call noundef i32 @_Z3sqri(i32 noundef %71)
  %73 = icmp sle i32 %70, %72
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #7
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [101 x %"class.std::bitset"], ptr @e, i64 0, i64 %75
  %77 = load i32, ptr %5, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  call void @_ZNSt6bitsetILm101EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<101>::reference") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %76, i64 noundef %78)
  %79 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm101EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %6, i1 noundef zeroext %73) #7
  call void @_ZNSt6bitsetILm101EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #7
  br label %80

80:                                               ; preds = %49
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %5, align 4, !tbaa !5
  br label %44, !llvm.loop !11

83:                                               ; preds = %48
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %3, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %3, align 4, !tbaa !5
  br label %38, !llvm.loop !12

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

88:                                               ; preds = %148, %87
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = icmp slt i32 %89, 1001
  br i1 %90, label %92, label %91

91:                                               ; preds = %88
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %151

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

93:                                               ; preds = %111, %92
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = load i32, ptr @n, align 4, !tbaa !5
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  store i32 16, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %114

98:                                               ; preds = %93
  %99 = load i32, ptr %8, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %100
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = call i32 @rand() #7
  %104 = load i32, ptr @n, align 4, !tbaa !5
  %105 = load i32, ptr %8, align 4, !tbaa !5
  %106 = sub nsw i32 %104, %105
  %107 = srem i32 %103, %106
  %108 = add nsw i32 %102, %107
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %109
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %101, ptr noundef nonnull align 4 dereferenceable(4) %110) #7
  br label %111

111:                                              ; preds = %98
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %8, align 4, !tbaa !5
  br label %93, !llvm.loop !13

114:                                              ; preds = %97
  %115 = load i32, ptr @ord, align 16, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [101 x %"class.std::bitset"], ptr @e, i64 0, i64 %116
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @msk, ptr align 16 %117, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %139, %114
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = load i32, ptr @n, align 4, !tbaa !5
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  store i32 19, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %142

123:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #7
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  call void @_ZNSt6bitsetILm101EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<101>::reference") align 8 %10, ptr noundef nonnull align 8 dereferenceable(16) @msk, i64 noundef %128)
  %129 = call noundef zeroext i1 @_ZNKSt6bitsetILm101EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %10) #7
  call void @_ZNSt6bitsetILm101EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  br i1 %129, label %130, label %138

130:                                              ; preds = %123
  %131 = load i32, ptr %9, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [101 x %"class.std::bitset"], ptr @e, i64 0, i64 %135
  %137 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm101EEaNERKS0_(ptr noundef nonnull align 8 dereferenceable(16) @msk, ptr noundef nonnull align 8 dereferenceable(16) %136) #7
  br label %138

138:                                              ; preds = %130, %123
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %9, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %9, align 4, !tbaa !5
  br label %118, !llvm.loop !14

142:                                              ; preds = %122
  %143 = call noundef i64 @_ZNKSt6bitsetILm101EE5countEv(ptr noundef nonnull align 8 dereferenceable(16) @ans) #7
  %144 = call noundef i64 @_ZNKSt6bitsetILm101EE5countEv(ptr noundef nonnull align 8 dereferenceable(16) @msk) #7
  %145 = icmp ult i64 %143, %144
  br i1 %145, label %146, label %147

146:                                              ; preds = %142
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @ans, ptr align 8 @msk, i64 16, i1 false)
  br label %147

147:                                              ; preds = %146, %142
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %7, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %7, align 4, !tbaa !5
  br label %88, !llvm.loop !15

151:                                              ; preds = %91
  %152 = call noundef i64 @_ZNKSt6bitsetILm101EE5countEv(ptr noundef nonnull align 8 dereferenceable(16) @ans) #7
  %153 = trunc i64 %152 to i32
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %153)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %169, %151
  %156 = load i32, ptr %11, align 4, !tbaa !5
  %157 = load i32, ptr @n, align 4, !tbaa !5
  %158 = icmp slt i32 %156, %157
  br i1 %158, label %160, label %159

159:                                              ; preds = %155
  store i32 22, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %172

160:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %161 = load i32, ptr %11, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  call void @_ZNSt6bitsetILm101EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<101>::reference") align 8 %12, ptr noundef nonnull align 8 dereferenceable(16) @ans, i64 noundef %162)
  %163 = call noundef zeroext i1 @_ZNKSt6bitsetILm101EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %12) #7
  call void @_ZNSt6bitsetILm101EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  br i1 %163, label %164, label %168

164:                                              ; preds = %160
  %165 = load i32, ptr %11, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  %167 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %166)
  br label %168

168:                                              ; preds = %164, %160
  br label %169

169:                                              ; preds = %168
  %170 = load i32, ptr %11, align 4, !tbaa !5
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr %11, align 4, !tbaa !5
  br label %155, !llvm.loop !16

172:                                              ; preds = %159
  %173 = call i32 @puts(ptr noundef @.str.3)
  br label %13, !llvm.loop !17

174:                                              ; preds = %13
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sqri(i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm101EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<101>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm101EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm101EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

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

; Function Attrs: nounwind
declare i32 @rand() #5

; 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) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm101EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm101EEaNERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6bitsetILm101EE5countEv(ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { 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 #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [2 x i64] }
%"class.std::bitset<101>::reference" = type { ptr, i64 }

@n = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@x = external dso_local global [101 x i32], align 16
@y = external dso_local global [101 x i32], align 16
@ord = external dso_local global [101 x i32], align 16
@e = external dso_local global [101 x %"class.std::bitset"], align 16
@msk = external dso_local global { [2 x i64] }, align 8
@ans = external dso_local global { [2 x i64] }, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"class.std::bitset<101>::reference", align 8
  %2 = alloca %"class.std::bitset<101>::reference", align 8
  %3 = alloca %"class.std::bitset<101>::reference", align 8
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @d)
  %5 = icmp eq i32 %4, 2
  br i1 %5, label %.preheader40, label %._crit_edge57

.preheader40:                                     ; preds = %0, %._crit_edge56
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %.preheader.preheader

.preheader39:                                     ; preds = %.lr.ph
  %8 = icmp sgt i32 %14, 0
  br i1 %8, label %.preheader37, label %.preheader.preheader

.preheader.preheader:                             ; preds = %._crit_edge, %.preheader40, %.preheader39
  br label %.preheader

.lr.ph:                                           ; preds = %.preheader40, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader40 ]
  %9 = getelementptr inbounds i32, ptr @x, i64 %indvars.iv
  %10 = getelementptr inbounds i32, ptr @y, i64 %indvars.iv
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %12 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %indvars.iv
  %13 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %13, ptr %12, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next, %15
  br i1 %16, label %.lr.ph, label %.preheader39, !llvm.loop !9

.preheader37:                                     ; preds = %.preheader39, %._crit_edge
  %17 = phi i32 [ %22, %._crit_edge ], [ %14, %.preheader39 ]
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %._crit_edge ], [ 0, %.preheader39 ]
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph43, label %.preheader37.._crit_edge_crit_edge

.preheader37.._crit_edge_crit_edge:               ; preds = %.preheader37
  %.pre = sext i32 %17 to i64
  br label %._crit_edge

.lr.ph43:                                         ; preds = %.preheader37
  %19 = getelementptr inbounds [101 x i32], ptr @x, i64 0, i64 %indvars.iv63
  %20 = getelementptr inbounds [101 x i32], ptr @y, i64 0, i64 %indvars.iv63
  %21 = getelementptr inbounds [101 x %"class.std::bitset"], ptr @e, i64 0, i64 %indvars.iv63
  br label %24

._crit_edge:                                      ; preds = %24, %.preheader37.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader37.._crit_edge_crit_edge ], [ %41, %24 ]
  %22 = phi i32 [ %17, %.preheader37.._crit_edge_crit_edge ], [ %40, %24 ]
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %23 = icmp slt i64 %indvars.iv.next64, %.pre-phi
  br i1 %23, label %.preheader37, label %.preheader.preheader, !llvm.loop !11

24:                                               ; preds = %.lr.ph43, %24
  %indvars.iv60 = phi i64 [ 0, %.lr.ph43 ], [ %indvars.iv.next61, %24 ]
  %25 = load i32, ptr %19, align 4, !tbaa !5
  %26 = getelementptr inbounds [101 x i32], ptr @x, i64 0, i64 %indvars.iv60
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = sub nsw i32 %25, %27
  %29 = call noundef i32 @_Z3sqri(i32 noundef %28)
  %30 = load i32, ptr %20, align 4, !tbaa !5
  %31 = getelementptr inbounds [101 x i32], ptr @y, i64 0, i64 %indvars.iv60
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sub nsw i32 %30, %32
  %34 = call noundef i32 @_Z3sqri(i32 noundef %33)
  %35 = add nsw i32 %34, %29
  %36 = load i32, ptr @d, align 4, !tbaa !5
  %37 = call noundef i32 @_Z3sqri(i32 noundef %36)
  %38 = icmp sle i32 %35, %37
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #7
  call void @_ZNSt6bitsetILm101EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<101>::reference") align 8 %1, ptr noundef nonnull align 8 dereferenceable(16) %21, i64 noundef %indvars.iv60)
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm101EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %1, i1 noundef zeroext %38) #7
  call void @_ZNSt6bitsetILm101EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %1) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #7
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next61, %41
  br i1 %42, label %24, label %._crit_edge, !llvm.loop !13

.preheader:                                       ; preds = %.preheader.preheader, %87
  %.03352 = phi i32 [ %88, %87 ], [ 0, %.preheader.preheader ]
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.lr.ph46, label %._crit_edge47.thread

._crit_edge47.thread:                             ; preds = %.preheader
  %45 = load i32, ptr @ord, align 16, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [101 x %"class.std::bitset"], ptr @e, i64 0, i64 %46
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) @msk, ptr noundef nonnull align 16 dereferenceable(16) %47, i64 16, i1 false)
  br label %._crit_edge51

48:                                               ; preds = %87
  %49 = call noundef i64 @_ZNKSt6bitsetILm101EE5countEv(ptr noundef nonnull align 8 dereferenceable(16) @ans) #7
  %50 = trunc i64 %49 to i32
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %50)
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %.lr.ph55, label %._crit_edge56

._crit_edge47:                                    ; preds = %.lr.ph46
  %54 = load i32, ptr @ord, align 16, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [101 x %"class.std::bitset"], ptr @e, i64 0, i64 %55
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) @msk, ptr noundef nonnull align 16 dereferenceable(16) %56, i64 16, i1 false)
  %57 = icmp sgt i32 %67, 1
  br i1 %57, label %.lr.ph50, label %._crit_edge51

.lr.ph46:                                         ; preds = %.preheader, %.lr.ph46
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %.lr.ph46 ], [ 0, %.preheader ]
  %58 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %indvars.iv66
  %59 = call i32 @rand() #7
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = trunc nuw nsw i64 %indvars.iv66 to i32
  %62 = sub nsw i32 %60, %61
  %63 = srem i32 %59, %62
  %64 = add nsw i32 %63, %61
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %65
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %58, ptr noundef nonnull align 4 dereferenceable(4) %66) #7
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %67 = load i32, ptr @n, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = icmp slt i64 %indvars.iv.next67, %68
  br i1 %69, label %.lr.ph46, label %._crit_edge47, !llvm.loop !14

._crit_edge51:                                    ; preds = %82, %._crit_edge47.thread, %._crit_edge47
  %70 = call noundef i64 @_ZNKSt6bitsetILm101EE5countEv(ptr noundef nonnull align 8 dereferenceable(16) @ans) #7
  %71 = call noundef i64 @_ZNKSt6bitsetILm101EE5countEv(ptr noundef nonnull align 8 dereferenceable(16) @msk) #7
  %72 = icmp ult i64 %70, %71
  br i1 %72, label %86, label %87

.lr.ph50:                                         ; preds = %._crit_edge47, %82
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %82 ], [ 1, %._crit_edge47 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #7
  %73 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %indvars.iv69
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  call void @_ZNSt6bitsetILm101EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<101>::reference") align 8 %2, ptr noundef nonnull align 8 dereferenceable(16) @msk, i64 noundef %75)
  %76 = call noundef zeroext i1 @_ZNKSt6bitsetILm101EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %2) #7
  call void @_ZNSt6bitsetILm101EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #7
  br i1 %76, label %77, label %82

77:                                               ; preds = %.lr.ph50
  %78 = load i32, ptr %73, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [101 x %"class.std::bitset"], ptr @e, i64 0, i64 %79
  %81 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm101EEaNERKS0_(ptr noundef nonnull align 8 dereferenceable(16) @msk, ptr noundef nonnull align 8 dereferenceable(16) %80) #7
  br label %82

82:                                               ; preds = %.lr.ph50, %77
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = icmp slt i64 %indvars.iv.next70, %84
  br i1 %85, label %.lr.ph50, label %._crit_edge51, !llvm.loop !15

86:                                               ; preds = %._crit_edge51
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) @ans, ptr noundef nonnull align 8 dereferenceable(16) @msk, i64 16, i1 false)
  br label %87

87:                                               ; preds = %._crit_edge51, %86
  %88 = add nuw nsw i32 %.03352, 1
  %exitcond.not = icmp eq i32 %88, 1001
  br i1 %exitcond.not, label %48, label %.preheader, !llvm.loop !16

._crit_edge56:                                    ; preds = %.lr.ph55._crit_edge, %48
  %89 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  %90 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @d)
  %91 = icmp eq i32 %90, 2
  br i1 %91, label %.preheader40, label %._crit_edge57, !llvm.loop !17

.lr.ph55:                                         ; preds = %48, %.lr.ph55._crit_edge
  %indvars.iv72 = phi i64 [ %93, %.lr.ph55._crit_edge ], [ 0, %48 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  call void @_ZNSt6bitsetILm101EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<101>::reference") align 8 %3, ptr noundef nonnull align 8 dereferenceable(16) @ans, i64 noundef %indvars.iv72)
  %92 = call noundef zeroext i1 @_ZNKSt6bitsetILm101EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @_ZNSt6bitsetILm101EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  %93 = add nuw nsw i64 %indvars.iv72, 1
  br i1 %92, label %94, label %.lr.ph55._crit_edge

94:                                               ; preds = %.lr.ph55
  %95 = trunc nuw nsw i64 %93 to i32
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %95)
  br label %.lr.ph55._crit_edge

.lr.ph55._crit_edge:                              ; preds = %.lr.ph55, %94
  %97 = load i32, ptr @n, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = icmp slt i64 %93, %98
  br i1 %99, label %.lr.ph55, label %._crit_edge56, !llvm.loop !18

._crit_edge57:                                    ; preds = %._crit_edge56, %0
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sqri(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm101EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<101>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm101EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm101EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

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

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #5

; 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) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm101EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm101EEaNERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6bitsetILm101EE5countEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

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

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

attributes #0 = { 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 #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { 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 #5 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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