; LLVM IR from eyangch/competitive-programming :: USACOcontests/silver/2015.02 (superbull)

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

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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %18 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %19 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %21
  %23 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  %24 = load ptr, ptr @stdin, align 8, !tbaa !8
  %25 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %24)
  %26 = load ptr, ptr @stdout, align 8, !tbaa !8
  %27 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %26)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %29 = load i32, ptr %2, align 4, !tbaa !11
  %30 = zext i32 %29 to i64
  %31 = call ptr @llvm.stacksave.p0()
  store ptr %31, ptr %3, align 8
  %32 = alloca i64, i64 %30, align 16
  store i64 %30, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %33

33:                                               ; preds = %43, %0
  %34 = load i32, ptr %5, align 4, !tbaa !11
  %35 = load i32, ptr %2, align 4, !tbaa !11
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  %39 = load i32, ptr %5, align 4, !tbaa !11
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i64, ptr %32, i64 %40
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %41)
  br label %43

43:                                               ; preds = %38
  %44 = load i32, ptr %5, align 4, !tbaa !11
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %5, align 4, !tbaa !11
  br label %33, !llvm.loop !13

46:                                               ; preds = %37
  %47 = load i32, ptr %2, align 4, !tbaa !11
  %48 = zext i32 %47 to i64
  %49 = alloca i64, i64 %48, align 16
  store i64 %48, ptr %6, align 8
  %50 = load i32, ptr %2, align 4, !tbaa !11
  %51 = zext i32 %50 to i64
  %52 = alloca i8, i64 %51, align 16
  store i64 %51, ptr %7, align 8
  %53 = load i32, ptr %2, align 4, !tbaa !11
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i8, ptr %52, i64 %54
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #8
  store i8 0, ptr %8, align 1, !tbaa !15
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef %52, ptr noundef %55, ptr noundef nonnull align 1 dereferenceable(1) %8)
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #8
  %56 = load i32, ptr %2, align 4, !tbaa !11
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i64, ptr %49, i64 %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 -1, ptr %9, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef %49, ptr noundef %58, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  %59 = getelementptr inbounds i64, ptr %49, i64 0
  store i64 0, ptr %59, align 16, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store i64 0, ptr %10, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %60

60:                                               ; preds = %127, %46
  %61 = load i32, ptr %11, align 4, !tbaa !11
  %62 = load i32, ptr %2, align 4, !tbaa !11
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 5, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %130

65:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store i64 -1, ptr %13, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  store i64 0, ptr %14, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %92, %65
  %67 = load i32, ptr %15, align 4, !tbaa !11
  %68 = load i32, ptr %2, align 4, !tbaa !11
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %95

71:                                               ; preds = %66
  %72 = load i32, ptr %15, align 4, !tbaa !11
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds i64, ptr %49, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !17
  %76 = load i64, ptr %13, align 8, !tbaa !17
  %77 = icmp sgt i64 %75, %76
  br i1 %77, label %78, label %91

78:                                               ; preds = %71
  %79 = load i32, ptr %15, align 4, !tbaa !11
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i8, ptr %52, i64 %80
  %82 = load i8, ptr %81, align 1, !tbaa !15, !range !19, !noundef !20
  %83 = trunc i8 %82 to i1
  br i1 %83, label %91, label %84

84:                                               ; preds = %78
  %85 = load i32, ptr %15, align 4, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i64, ptr %49, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !17
  store i64 %88, ptr %13, align 8, !tbaa !17
  %89 = load i32, ptr %15, align 4, !tbaa !11
  %90 = sext i32 %89 to i64
  store i64 %90, ptr %14, align 8, !tbaa !17
  br label %91

91:                                               ; preds = %84, %78, %71
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %15, align 4, !tbaa !11
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %15, align 4, !tbaa !11
  br label %66, !llvm.loop !21

95:                                               ; preds = %70
  %96 = load i64, ptr %14, align 8, !tbaa !17
  %97 = getelementptr inbounds i8, ptr %52, i64 %96
  store i8 1, ptr %97, align 1, !tbaa !15
  %98 = load i64, ptr %13, align 8, !tbaa !17
  %99 = load i64, ptr %10, align 8, !tbaa !17
  %100 = add nsw i64 %99, %98
  store i64 %100, ptr %10, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %101

101:                                              ; preds = %123, %95
  %102 = load i32, ptr %16, align 4, !tbaa !11
  %103 = load i32, ptr %2, align 4, !tbaa !11
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  store i32 11, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %126

106:                                              ; preds = %101
  %107 = load i32, ptr %16, align 4, !tbaa !11
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i64, ptr %49, i64 %108
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %110 = load i64, ptr %14, align 8, !tbaa !17
  %111 = getelementptr inbounds i64, ptr %32, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !17
  %113 = load i32, ptr %16, align 4, !tbaa !11
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i64, ptr %32, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !17
  %117 = xor i64 %112, %116
  store i64 %117, ptr %17, align 8, !tbaa !17
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %119 = load i64, ptr %118, align 8, !tbaa !17
  %120 = load i32, ptr %16, align 4, !tbaa !11
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i64, ptr %49, i64 %121
  store i64 %119, ptr %122, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %123

123:                                              ; preds = %106
  %124 = load i32, ptr %16, align 4, !tbaa !11
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %16, align 4, !tbaa !11
  br label %101, !llvm.loop !22

126:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %11, align 4, !tbaa !11
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %11, align 4, !tbaa !11
  br label %60, !llvm.loop !23

130:                                              ; preds = %64
  %131 = load i64, ptr %10, align 8, !tbaa !17
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %131)
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %132, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %134 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %134)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %135 = load i32, ptr %1, align 4
  ret i32 %135
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #7

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #5 align 2

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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

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

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


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

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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i8, align 1
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = load ptr, ptr @stdin, align 8, !tbaa !8
  %12 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %11)
  %13 = load ptr, ptr @stdout, align 8, !tbaa !8
  %14 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %13)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %16 = load i32, ptr %1, align 4, !tbaa !11
  %17 = zext i32 %16 to i64
  %18 = call ptr @llvm.stacksave.p0()
  %19 = alloca i64, i64 %17, align 16
  %20 = load i32, ptr %1, align 4, !tbaa !11
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph, label %.._crit_edge_crit_edge

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

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %34, %.lr.ph ]
  %.lcssa = phi i32 [ %20, %.._crit_edge_crit_edge ], [ %33, %.lr.ph ]
  %22 = zext i32 %.lcssa to i64
  %23 = alloca i64, i64 %22, align 16
  %24 = alloca i8, i64 %22, align 16
  %25 = getelementptr inbounds i8, ptr %24, i64 %.pre-phi
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #8
  store i8 0, ptr %2, align 1, !tbaa !13
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef nonnull %24, ptr noundef nonnull %25, ptr noundef nonnull align 1 dereferenceable(1) %2)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #8
  %26 = load i32, ptr %1, align 4, !tbaa !11
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i64, ptr %23, i64 %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 -1, ptr %3, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull %23, ptr noundef nonnull %28, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  store i64 0, ptr %23, align 16, !tbaa !15
  %29 = load i32, ptr %1, align 4, !tbaa !11
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.preheader, label %._crit_edge47

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %31 = getelementptr inbounds i64, ptr %19, i64 %indvars.iv
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %31)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = load i32, ptr %1, align 4, !tbaa !11
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next, %34
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !17

.preheader:                                       ; preds = %._crit_edge, %._crit_edge44
  %36 = phi i32 [ %68, %._crit_edge44 ], [ %29, %._crit_edge ]
  %.02746 = phi i32 [ %69, %._crit_edge44 ], [ 0, %._crit_edge ]
  %.02845 = phi i64 [ %67, %._crit_edge44 ], [ 0, %._crit_edge ]
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph37.preheader, label %._crit_edge38.thread

._crit_edge38.thread:                             ; preds = %.preheader
  store i8 1, ptr %24, align 16, !tbaa !13
  %38 = add nsw i64 %.02845, -1
  br label %._crit_edge44

.lr.ph37.preheader:                               ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %36 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %39 = icmp eq i32 %36, 1
  br i1 %39, label %._crit_edge38.unr-lcssa, label %.lr.ph37.preheader.new

.lr.ph37.preheader.new:                           ; preds = %.lr.ph37.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph37

._crit_edge47:                                    ; preds = %._crit_edge44, %._crit_edge
  %.028.lcssa = phi i64 [ 0, %._crit_edge ], [ %67, %._crit_edge44 ]
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.028.lcssa)
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %18)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

._crit_edge38.unr-lcssa:                          ; preds = %66, %.lr.ph37.preheader
  %.126.lcssa.ph = phi i64 [ poison, %.lr.ph37.preheader ], [ %.126.1, %66 ]
  %.1.lcssa.ph = phi i64 [ poison, %.lr.ph37.preheader ], [ %.1.1, %66 ]
  %indvars.iv52.unr = phi i64 [ 0, %.lr.ph37.preheader ], [ %indvars.iv.next53.1, %66 ]
  %.02435.unr = phi i64 [ 0, %.lr.ph37.preheader ], [ %.1.1, %66 ]
  %.02534.unr = phi i64 [ -1, %.lr.ph37.preheader ], [ %.126.1, %66 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge38, label %.lr.ph37.epil

.lr.ph37.epil:                                    ; preds = %._crit_edge38.unr-lcssa
  %42 = getelementptr inbounds i64, ptr %23, i64 %indvars.iv52.unr
  %43 = load i64, ptr %42, align 8, !tbaa !15
  %44 = icmp sgt i64 %43, %.02534.unr
  br i1 %44, label %45, label %._crit_edge38

45:                                               ; preds = %.lr.ph37.epil
  %46 = getelementptr inbounds i8, ptr %24, i64 %indvars.iv52.unr
  %47 = load i8, ptr %46, align 1, !tbaa !13, !range !19, !noundef !20
  %48 = trunc nuw i8 %47 to i1
  %spec.select.epil = select i1 %48, i64 %.02534.unr, i64 %43
  %spec.select32.epil = select i1 %48, i64 %.02435.unr, i64 %indvars.iv52.unr
  br label %._crit_edge38

._crit_edge38:                                    ; preds = %.lr.ph37.epil, %45, %._crit_edge38.unr-lcssa
  %.126.lcssa = phi i64 [ %.126.lcssa.ph, %._crit_edge38.unr-lcssa ], [ %.02534.unr, %.lr.ph37.epil ], [ %spec.select.epil, %45 ]
  %.1.lcssa = phi i64 [ %.1.lcssa.ph, %._crit_edge38.unr-lcssa ], [ %.02435.unr, %.lr.ph37.epil ], [ %spec.select32.epil, %45 ]
  %49 = getelementptr inbounds i8, ptr %24, i64 %.1.lcssa
  store i8 1, ptr %49, align 1, !tbaa !13
  %50 = add nsw i64 %.126.lcssa, %.02845
  br i1 %37, label %.lr.ph43, label %._crit_edge44

.lr.ph43:                                         ; preds = %._crit_edge38
  %51 = getelementptr inbounds i64, ptr %19, i64 %.1.lcssa
  br label %71

.lr.ph37:                                         ; preds = %66, %.lr.ph37.preheader.new
  %indvars.iv52 = phi i64 [ 0, %.lr.ph37.preheader.new ], [ %indvars.iv.next53.1, %66 ]
  %.02435 = phi i64 [ 0, %.lr.ph37.preheader.new ], [ %.1.1, %66 ]
  %.02534 = phi i64 [ -1, %.lr.ph37.preheader.new ], [ %.126.1, %66 ]
  %niter = phi i64 [ 0, %.lr.ph37.preheader.new ], [ %niter.next.1, %66 ]
  %52 = getelementptr inbounds i64, ptr %23, i64 %indvars.iv52
  %53 = load i64, ptr %52, align 16, !tbaa !15
  %54 = icmp sgt i64 %53, %.02534
  br i1 %54, label %55, label %.lr.ph37.1

55:                                               ; preds = %.lr.ph37
  %56 = getelementptr inbounds i8, ptr %24, i64 %indvars.iv52
  %57 = load i8, ptr %56, align 2, !tbaa !13, !range !19, !noundef !20
  %58 = trunc nuw i8 %57 to i1
  %spec.select = select i1 %58, i64 %.02534, i64 %53
  %spec.select32 = select i1 %58, i64 %.02435, i64 %indvars.iv52
  br label %.lr.ph37.1

.lr.ph37.1:                                       ; preds = %55, %.lr.ph37
  %.126 = phi i64 [ %.02534, %.lr.ph37 ], [ %spec.select, %55 ]
  %.1 = phi i64 [ %.02435, %.lr.ph37 ], [ %spec.select32, %55 ]
  %indvars.iv.next53 = or disjoint i64 %indvars.iv52, 1
  %59 = getelementptr inbounds i64, ptr %23, i64 %indvars.iv.next53
  %60 = load i64, ptr %59, align 8, !tbaa !15
  %61 = icmp sgt i64 %60, %.126
  br i1 %61, label %62, label %66

62:                                               ; preds = %.lr.ph37.1
  %63 = getelementptr inbounds i8, ptr %24, i64 %indvars.iv.next53
  %64 = load i8, ptr %63, align 1, !tbaa !13, !range !19, !noundef !20
  %65 = trunc nuw i8 %64 to i1
  %spec.select.1 = select i1 %65, i64 %.126, i64 %60
  %spec.select32.1 = select i1 %65, i64 %.1, i64 %indvars.iv.next53
  br label %66

66:                                               ; preds = %62, %.lr.ph37.1
  %.126.1 = phi i64 [ %.126, %.lr.ph37.1 ], [ %spec.select.1, %62 ]
  %.1.1 = phi i64 [ %.1, %.lr.ph37.1 ], [ %spec.select32.1, %62 ]
  %indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge38.unr-lcssa, label %.lr.ph37, !llvm.loop !21

._crit_edge44:                                    ; preds = %71, %._crit_edge38.thread, %._crit_edge38
  %67 = phi i64 [ %50, %._crit_edge38 ], [ %38, %._crit_edge38.thread ], [ %50, %71 ]
  %68 = phi i32 [ %36, %._crit_edge38 ], [ %36, %._crit_edge38.thread ], [ %79, %71 ]
  %69 = add nuw nsw i32 %.02746, 1
  %70 = icmp slt i32 %69, %68
  br i1 %70, label %.preheader, label %._crit_edge47, !llvm.loop !22

71:                                               ; preds = %.lr.ph43, %71
  %indvars.iv55 = phi i64 [ 0, %.lr.ph43 ], [ %indvars.iv.next56, %71 ]
  %72 = getelementptr inbounds i64, ptr %23, i64 %indvars.iv55
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %73 = load i64, ptr %51, align 8, !tbaa !15
  %74 = getelementptr inbounds i64, ptr %19, i64 %indvars.iv55
  %75 = load i64, ptr %74, align 8, !tbaa !15
  %76 = xor i64 %75, %73
  store i64 %76, ptr %4, align 8, !tbaa !15
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %72, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %78 = load i64, ptr %77, align 8, !tbaa !15
  store i64 %78, ptr %72, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %79 = load i32, ptr %1, align 4, !tbaa !11
  %80 = sext i32 %79 to i64
  %81 = icmp slt i64 %indvars.iv.next56, %80
  br i1 %81, label %71, label %._crit_edge44, !llvm.loop !23
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) 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) #3

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #7

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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

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

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


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