; LLVM IR from tangjz/acm-icpc :: hdu (5782)

; 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 { [157 x i64] }

@n = external dso_local global i32, align 4
@f = external dso_local global [10001 x i32], align 16
@g = external dso_local global [10001 x i32], align 16
@ord = external dso_local global [10001 x i32], align 16
@s = external dso_local global [10001 x i8], align 16
@t = external dso_local global [10001 x i8], align 16
@msk = external dso_local global [10001 x %"class.std::bitset"], align 16
@cur = external dso_local global { [157 x i64] }, align 8
@ans = external dso_local global { [157 x i64] }, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

8:                                                ; preds = %26, %0
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = icmp slt i32 %9, 10001
  br i1 %10, label %12, label %11

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

12:                                               ; preds = %8
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = sub nsw i32 %13, 1
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [10001 x %"class.std::bitset"], ptr @msk, i64 0, i64 %15
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [10001 x %"class.std::bitset"], ptr @msk, i64 0, i64 %18
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %16, i64 1256, i1 false)
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [10001 x %"class.std::bitset"], ptr @msk, i64 0, i64 %21
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) %22, i64 noundef %24, i1 noundef zeroext true)
  br label %26

26:                                               ; preds = %12
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %2, align 4, !tbaa !5
  br label %8, !llvm.loop !9

29:                                               ; preds = %11
  br label %30

30:                                               ; preds = %123, %29
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @s, ptr noundef @t)
  %32 = icmp eq i32 %31, 2
  br i1 %32, label %33, label %125

33:                                               ; preds = %30
  %34 = call i64 @strlen(ptr noundef @s) #10
  %35 = trunc i64 %34 to i32
  store i32 %35, ptr @n, align 4, !tbaa !5
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z4getFiPciS_Pi(i32 noundef %36, ptr noundef @t, i32 noundef %37, ptr noundef @s, ptr noundef @f)
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z4getFiPciS_Pi(i32 noundef %38, ptr noundef @s, i32 noundef %39, ptr noundef @t, ptr noundef @g)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %50, %33
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %53

45:                                               ; preds = %40
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [10001 x i32], ptr @ord, i64 0, i64 %48
  store i32 %46, ptr %49, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %45
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %3, align 4, !tbaa !5
  br label %40, !llvm.loop !11

53:                                               ; preds = %44
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr @ord, i64 %55
  %57 = getelementptr inbounds i32, ptr %56, i64 1
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef @ord, ptr noundef %57, ptr noundef @_Z3cmpRKiS0_)
  %58 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256) @cur) #9
  %59 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256) @ans) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  %60 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %60, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %100, %53
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = icmp sge i32 %62, 0
  br i1 %63, label %65, label %64

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

65:                                               ; preds = %61
  br label %66

66:                                               ; preds = %83, %65
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = icmp sle i32 %67, %68
  br i1 %69, label %70, label %80

70:                                               ; preds = %66
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [10001 x i32], ptr @ord, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [10001 x i32], ptr @g, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = icmp sge i32 %77, %78
  br label %80

80:                                               ; preds = %70, %66
  %81 = phi i1 [ false, %66 ], [ %79, %70 ]
  br i1 %81, label %82, label %91

82:                                               ; preds = %80
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %5, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %5, align 4, !tbaa !5
  %86 = sext i32 %84 to i64
  %87 = getelementptr inbounds [10001 x i32], ptr @ord, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) @cur, i64 noundef %89, i1 noundef zeroext true)
  br label %66, !llvm.loop !12

91:                                               ; preds = %80
  %92 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EElSEm(ptr noundef nonnull align 8 dereferenceable(1256) @ans, i64 noundef 1) #9
  call void @llvm.lifetime.start.p0(i64 1256, ptr %6) #9
  %93 = load i32, ptr %4, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [10001 x %"class.std::bitset"], ptr @msk, i64 0, i64 %97
  call void @_ZStanILm10001EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind writable sret(%"class.std::bitset") align 8 %6, ptr noundef nonnull align 8 dereferenceable(1256) @cur, ptr noundef nonnull align 8 dereferenceable(1256) %98) #9
  %99 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256) @ans, ptr noundef nonnull align 8 dereferenceable(1256) %6) #9
  call void @llvm.lifetime.end.p0(i64 1256, ptr %6) #9
  br label %100

100:                                              ; preds = %91
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = add nsw i32 %101, -1
  store i32 %102, ptr %4, align 4, !tbaa !5
  br label %61, !llvm.loop !13

103:                                              ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %120, %103
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = load i32, ptr @n, align 4, !tbaa !5
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %109, label %108

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

109:                                              ; preds = %104
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = call noundef zeroext i1 @_ZNKSt6bitsetILm10001EE4testEm(ptr noundef nonnull align 8 dereferenceable(1256) @ans, i64 noundef %111)
  %113 = zext i1 %112 to i32
  %114 = add nsw i32 48, %113
  %115 = trunc i32 %114 to i8
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = sub nsw i32 %116, 1
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [10001 x i8], ptr @s, i64 0, i64 %118
  store i8 %115, ptr %119, align 1, !tbaa !14
  br label %120

120:                                              ; preds = %109
  %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 %104, !llvm.loop !15

123:                                              ; preds = %108
  %124 = call i32 @puts(ptr noundef @s)
  br label %30, !llvm.loop !16

125:                                              ; preds = %30
  ret i32 0
}

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef, i1 noundef zeroext) #4 align 2

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4getFiPciS_Pi(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) #7

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EElSEm(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZStanILm10001EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(1256), ptr noundef nonnull align 8 dereferenceable(1256)) #8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256), ptr noundef nonnull align 8 dereferenceable(1256)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm10001EE4testEm(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef) #4 align 2

declare i32 @puts(ptr noundef) #5

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { "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 = { nounwind willreturn memory(read) "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 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }

!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 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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 { [157 x i64] }

@n = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local global [10001 x i32], align 16
@g = external dso_local global [10001 x i32], align 16
@ord = external dso_local global [10001 x i32], align 16
@s = external dso_local global [10001 x i8], align 16
@t = external dso_local global [10001 x i8], align 16
@msk = external dso_local global [10001 x %"class.std::bitset"], align 16
@cur = external dso_local global { [157 x i64] }, align 8
@ans = external dso_local global { [157 x i64] }, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %"class.std::bitset", align 8
  br label %4

.preheader30:                                     ; preds = %4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s, ptr noundef nonnull @t)
  %3 = icmp eq i32 %2, 2
  br i1 %3, label %.lr.ph46, label %._crit_edge47

4:                                                ; preds = %0, %4
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next, %4 ]
  %5 = add nsw i64 %indvars.iv, -1
  %6 = getelementptr inbounds [10001 x %"class.std::bitset"], ptr @msk, i64 0, i64 %5
  %7 = getelementptr inbounds [10001 x %"class.std::bitset"], ptr @msk, i64 0, i64 %indvars.iv
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(1256) %7, ptr noundef nonnull align 8 dereferenceable(1256) %6, i64 1256, i1 false)
  %8 = tail call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) %7, i64 noundef %indvars.iv, i1 noundef zeroext true)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 10001
  br i1 %exitcond.not, label %.preheader30, label %4, !llvm.loop !5

.lr.ph46:                                         ; preds = %.preheader30, %._crit_edge45
  %9 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @s) #9
  %10 = trunc i64 %9 to i32
  store i32 %10, ptr @n, align 4, !tbaa !7
  call void @_Z4getFiPciS_Pi(i32 noundef %10, ptr noundef nonnull @t, i32 noundef %10, ptr noundef nonnull @s, ptr noundef nonnull @f)
  %11 = load i32, ptr @n, align 4, !tbaa !7
  call void @_Z4getFiPciS_Pi(i32 noundef %11, ptr noundef nonnull @s, i32 noundef %11, ptr noundef nonnull @t, ptr noundef nonnull @g)
  %12 = load i32, ptr @n, align 4, !tbaa !7
  %.not32 = icmp slt i32 %12, 0
  br i1 %.not32, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph46
  %13 = add nuw i32 %12, 1
  %wide.trip.count = zext i32 %13 to i64
  %min.iters.check = icmp ult i32 %12, 7
  br i1 %min.iters.check, label %.lr.ph.preheader66, label %vector.ph

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

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 4294967288
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %14 = getelementptr inbounds [10001 x i32], ptr @ord, i64 0, i64 %index
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  store <4 x i32> %vec.ind, ptr %14, align 16, !tbaa !7
  store <4 x i32> %step.add, ptr %15, align 16, !tbaa !7
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %16 = icmp eq i64 %index.next, %n.vec
  br i1 %16, 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 %.lr.ph.preheader66

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %.lr.ph46
  %17 = sext i32 %12 to i64
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @ord, i64 4), i64 %17
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef nonnull @ord, ptr noundef nonnull %gep, ptr noundef nonnull @_Z3cmpRKiS0_)
  %18 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256) @cur) #10
  %19 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256) @ans) #10
  %20 = load i32, ptr @n, align 4, !tbaa !7
  %21 = icmp sgt i32 %20, -1
  br i1 %21, label %.preheader.preheader, label %._crit_edge45

.preheader.preheader:                             ; preds = %._crit_edge
  %22 = zext nneg i32 %20 to i64
  br label %.preheader

.lr.ph:                                           ; preds = %.lr.ph.preheader66, %.lr.ph
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %.lr.ph ], [ %indvars.iv49.ph, %.lr.ph.preheader66 ]
  %23 = getelementptr inbounds [10001 x i32], ptr @ord, i64 0, i64 %indvars.iv49
  %24 = trunc nuw nsw i64 %indvars.iv49 to i32
  store i32 %24, ptr %23, align 4, !tbaa !7
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond52.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count
  br i1 %exitcond52.not, label %._crit_edge, label %.lr.ph, !llvm.loop !14

.preheader29:                                     ; preds = %.critedge
  %.pre = load i32, ptr @n, align 4, !tbaa !7
  %.not2642 = icmp slt i32 %.pre, 1
  br i1 %.not2642, label %._crit_edge45, label %.lr.ph44

.preheader:                                       ; preds = %.preheader.preheader, %.critedge
  %indvars.iv56 = phi i64 [ %22, %.preheader.preheader ], [ %indvars.iv.next57, %.critedge ]
  %.02141 = phi i32 [ 0, %.preheader.preheader ], [ %.1.lcssa, %.critedge ]
  %25 = load i32, ptr @n, align 4, !tbaa !7
  %.not2734 = icmp sgt i32 %.02141, %25
  br i1 %.not2734, label %.critedge, label %.lr.ph36.preheader

.lr.ph36.preheader:                               ; preds = %.preheader
  %26 = sext i32 %.02141 to i64
  br label %.lr.ph36

.lr.ph36:                                         ; preds = %.lr.ph36.preheader, %33
  %indvars.iv53 = phi i64 [ %26, %.lr.ph36.preheader ], [ %indvars.iv.next54, %33 ]
  %27 = getelementptr inbounds [10001 x i32], ptr @ord, i64 0, i64 %indvars.iv53
  %28 = load i32, ptr %27, align 4, !tbaa !7
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [10001 x i32], ptr @g, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !7
  %32 = sext i32 %31 to i64
  %.not28 = icmp sgt i64 %indvars.iv56, %32
  br i1 %.not28, label %.critedge.loopexit, label %33

33:                                               ; preds = %.lr.ph36
  %indvars.iv.next54 = add nsw i64 %indvars.iv53, 1
  %34 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) @cur, i64 noundef %29, i1 noundef zeroext true)
  %35 = load i32, ptr @n, align 4, !tbaa !7
  %36 = sext i32 %35 to i64
  %.not27.not = icmp slt i64 %indvars.iv53, %36
  br i1 %.not27.not, label %.lr.ph36, label %.critedge.loopexit, !llvm.loop !15

.critedge.loopexit:                               ; preds = %33, %.lr.ph36
  %.1.lcssa.ph.in = phi i64 [ %indvars.iv53, %.lr.ph36 ], [ %indvars.iv.next54, %33 ]
  %.1.lcssa.ph = trunc i64 %.1.lcssa.ph.in to i32
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.preheader
  %.1.lcssa = phi i32 [ %.02141, %.preheader ], [ %.1.lcssa.ph, %.critedge.loopexit ]
  %37 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EElSEm(ptr noundef nonnull align 8 dereferenceable(1256) @ans, i64 noundef 1) #10
  call void @llvm.lifetime.start.p0(i64 1256, ptr nonnull %1) #10
  %38 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %indvars.iv56
  %39 = load i32, ptr %38, align 4, !tbaa !7
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [10001 x %"class.std::bitset"], ptr @msk, i64 0, i64 %40
  call void @_ZStanILm10001EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset") align 8 %1, ptr noundef nonnull align 8 dereferenceable(1256) @cur, ptr noundef nonnull align 8 dereferenceable(1256) %41) #10
  %42 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256) @ans, ptr noundef nonnull align 8 dereferenceable(1256) %1) #10
  call void @llvm.lifetime.end.p0(i64 1256, ptr nonnull %1) #10
  %indvars.iv.next57 = add nsw i64 %indvars.iv56, -1
  %43 = icmp sgt i64 %indvars.iv56, 0
  br i1 %43, label %.preheader, label %.preheader29, !llvm.loop !16

._crit_edge45:                                    ; preds = %.lr.ph44, %._crit_edge, %.preheader29
  %44 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @s)
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s, ptr noundef nonnull @t)
  %46 = icmp eq i32 %45, 2
  br i1 %46, label %.lr.ph46, label %._crit_edge47, !llvm.loop !17

.lr.ph44:                                         ; preds = %.preheader29, %.lr.ph44
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %.lr.ph44 ], [ 1, %.preheader29 ]
  %47 = call noundef zeroext i1 @_ZNKSt6bitsetILm10001EE4testEm(ptr noundef nonnull align 8 dereferenceable(1256) @ans, i64 noundef %indvars.iv60)
  %48 = select i1 %47, i8 49, i8 48
  %49 = add nsw i64 %indvars.iv60, -1
  %50 = getelementptr inbounds [10001 x i8], ptr @s, i64 0, i64 %49
  store i8 %48, ptr %50, align 1, !tbaa !18
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %51 = load i32, ptr @n, align 4, !tbaa !7
  %52 = sext i32 %51 to i64
  %.not26.not = icmp slt i64 %indvars.iv60, %52
  br i1 %.not26.not, label %.lr.ph44, label %._crit_edge45, !llvm.loop !19

._crit_edge47:                                    ; preds = %._crit_edge45, %.preheader30
  ret i32 0
}

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef, i1 noundef zeroext) local_unnamed_addr #4 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4getFiPciS_Pi(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #7

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EElSEm(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZStanILm10001EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(1256), ptr noundef nonnull align 8 dereferenceable(1256)) local_unnamed_addr #8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256), ptr noundef nonnull align 8 dereferenceable(1256)) local_unnamed_addr #0 align 2

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { 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 #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { 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 #8 = { 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 #9 = { nounwind willreturn memory(read) }
attributes #10 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !6, !13, !12}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = !{!9, !9, i64 0}
!19 = distinct !{!19, !6}


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