; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2014.12 (guard)

; 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"

%struct.cow = type { i64, i64, i64 }
%"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" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.0" = type { i8 }

@N = external dso_local global i64, align 8
@H = external dso_local global i64, align 8
@c = external dso_local global [20 x %struct.cow], align 16
@dp = external dso_local global [1048576 x i64], align 16
@.str = external hidden unnamed_addr constant [9 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 [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dpfv() #0

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca double, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca %"class.std::allocator.0", align 1
  %11 = alloca i1, align 1
  %12 = alloca i1, align 1
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %15 = load ptr, ptr @stdin, align 8, !tbaa !5
  %16 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %15)
  %17 = load ptr, ptr @stdout, align 8, !tbaa !5
  %18 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %17)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(8) @H)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !9
  br label %21

21:                                               ; preds = %39, %0
  %22 = load i64, ptr %2, align 8, !tbaa !9
  %23 = load i64, ptr @N, align 8, !tbaa !9
  %24 = icmp slt i64 %22, %23
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %21
  %27 = load i64, ptr %2, align 8, !tbaa !9
  %28 = getelementptr inbounds [20 x %struct.cow], ptr @c, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.cow, ptr %28, i32 0, i32 0
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %31 = load i64, ptr %2, align 8, !tbaa !9
  %32 = getelementptr inbounds [20 x %struct.cow], ptr @c, i64 0, i64 %31
  %33 = getelementptr inbounds %struct.cow, ptr %32, i32 0, i32 1
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 8 dereferenceable(8) %33)
  %35 = load i64, ptr %2, align 8, !tbaa !9
  %36 = getelementptr inbounds [20 x %struct.cow], ptr @c, i64 0, i64 %35
  %37 = getelementptr inbounds %struct.cow, ptr %36, i32 0, i32 2
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef nonnull align 8 dereferenceable(8) %37)
  br label %39

39:                                               ; preds = %26
  %40 = load i64, ptr %2, align 8, !tbaa !9
  %41 = add nsw i64 %40, 1
  store i64 %41, ptr %2, align 8, !tbaa !9
  br label %21, !llvm.loop !11

42:                                               ; preds = %25
  %43 = load i64, ptr @N, align 8, !tbaa !9
  %44 = trunc i64 %43 to i32
  %45 = shl i32 1, %44
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i64, ptr @dp, i64 %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store double -1.000000e+09, ptr %3, align 8, !tbaa !13
  call void @_ZSt4fillIPxdEvT_S1_RKT0_(ptr noundef @dp, ptr noundef %47, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  store i64 1000000000, ptr @dp, align 16, !tbaa !9
  call void @_Z3dpfv()
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store i64 -1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 1, ptr %5, align 8, !tbaa !9
  br label %48

48:                                               ; preds = %98, %42
  %49 = load i64, ptr %5, align 8, !tbaa !9
  %50 = load i64, ptr @N, align 8, !tbaa !9
  %51 = trunc i64 %50 to i32
  %52 = shl i32 1, %51
  %53 = sext i32 %52 to i64
  %54 = icmp slt i64 %49, %53
  br i1 %54, label %56, label %55

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

56:                                               ; preds = %48
  %57 = load i64, ptr %5, align 8, !tbaa !9
  %58 = getelementptr inbounds [1048576 x i64], ptr @dp, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !9
  %60 = sitofp i64 %59 to double
  %61 = fcmp ogt double %60, -1.000000e+09
  br i1 %61, label %62, label %97

62:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %63

63:                                               ; preds = %84, %62
  %64 = load i64, ptr %8, align 8, !tbaa !9
  %65 = load i64, ptr @N, align 8, !tbaa !9
  %66 = icmp slt i64 %64, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %87

68:                                               ; preds = %63
  %69 = load i64, ptr %5, align 8, !tbaa !9
  %70 = load i64, ptr %8, align 8, !tbaa !9
  %71 = trunc i64 %70 to i32
  %72 = shl i32 1, %71
  %73 = sext i32 %72 to i64
  %74 = and i64 %69, %73
  %75 = icmp ne i64 %74, 0
  br i1 %75, label %76, label %83

76:                                               ; preds = %68
  %77 = load i64, ptr %8, align 8, !tbaa !9
  %78 = getelementptr inbounds [20 x %struct.cow], ptr @c, i64 0, i64 %77
  %79 = getelementptr inbounds %struct.cow, ptr %78, i32 0, i32 0
  %80 = load i64, ptr %79, align 8, !tbaa !15
  %81 = load i64, ptr %7, align 8, !tbaa !9
  %82 = add nsw i64 %81, %80
  store i64 %82, ptr %7, align 8, !tbaa !9
  br label %83

83:                                               ; preds = %76, %68
  br label %84

84:                                               ; preds = %83
  %85 = load i64, ptr %8, align 8, !tbaa !9
  %86 = add nsw i64 %85, 1
  store i64 %86, ptr %8, align 8, !tbaa !9
  br label %63, !llvm.loop !17

87:                                               ; preds = %67
  %88 = load i64, ptr %7, align 8, !tbaa !9
  %89 = load i64, ptr @H, align 8, !tbaa !9
  %90 = icmp sge i64 %88, %89
  br i1 %90, label %91, label %96

91:                                               ; preds = %87
  %92 = load i64, ptr %5, align 8, !tbaa !9
  %93 = getelementptr inbounds [1048576 x i64], ptr @dp, i64 0, i64 %92
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %93)
  %95 = load i64, ptr %94, align 8, !tbaa !9
  store i64 %95, ptr %4, align 8, !tbaa !9
  br label %96

96:                                               ; preds = %91, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %97

97:                                               ; preds = %96, %56
  br label %98

98:                                               ; preds = %97
  %99 = load i64, ptr %5, align 8, !tbaa !9
  %100 = add nsw i64 %99, 1
  store i64 %100, ptr %5, align 8, !tbaa !9
  br label %48, !llvm.loop !18

101:                                              ; preds = %55
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #7
  %102 = load i64, ptr %4, align 8, !tbaa !9
  %103 = icmp sge i64 %102, 0
  store i1 false, ptr %11, align 1
  store i1 false, ptr %12, align 1
  br i1 %103, label %104, label %106

104:                                              ; preds = %101
  %105 = load i64, ptr %4, align 8, !tbaa !9
  call void @_ZNSt7__cxx119to_stringEx(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %9, i64 noundef %105)
  br label %108

106:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #7
  store i1 true, ptr %11, align 1
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  store i1 true, ptr %12, align 1
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef @.str.4, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %107 unwind label %120

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107, %104
  %109 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %110 unwind label %124

110:                                              ; preds = %108
  %111 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %112 unwind label %124

112:                                              ; preds = %110
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  %113 = load i1, ptr %12, align 1
  br i1 %113, label %114, label %115

114:                                              ; preds = %112
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  br label %115

115:                                              ; preds = %114, %112
  %116 = load i1, ptr %11, align 1
  br i1 %116, label %117, label %118

117:                                              ; preds = %115
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #7
  br label %118

118:                                              ; preds = %117, %115
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  %119 = load i32, ptr %1, align 4
  ret i32 %119

120:                                              ; preds = %106
  %121 = landingpad { ptr, i32 }
          cleanup
  %122 = extractvalue { ptr, i32 } %121, 0
  store ptr %122, ptr %13, align 8
  %123 = extractvalue { ptr, i32 } %121, 1
  store i32 %123, ptr %14, align 4
  br label %128

124:                                              ; preds = %110, %108
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %13, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %14, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  br label %128

128:                                              ; preds = %124, %120
  %129 = load i1, ptr %12, align 1
  br i1 %129, label %130, label %131

130:                                              ; preds = %128
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  br label %131

131:                                              ; preds = %130, %128
  %132 = load i1, ptr %11, align 1
  br i1 %132, label %133, label %134

133:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #7
  br label %134

134:                                              ; preds = %133, %131
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %135

135:                                              ; preds = %134
  %136 = load ptr, ptr %13, align 8
  %137 = load i32, ptr %14, align 4
  %138 = insertvalue { ptr, i32 } poison, ptr %136, 0
  %139 = insertvalue { ptr, i32 } %138, i32 %137, 1
  resume { ptr, i32 } %139
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt7__cxx119to_stringEx(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, i64 noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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) #0 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)) #5

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #6 align 2

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


; 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"

%struct.cow = type { i64, i64, i64 }
%"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" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.0" = type { i8 }

@N = external dso_local global i64, align 8
@H = external dso_local global i64, align 8
@c = external dso_local global [20 x %struct.cow], align 16
@dp = external dso_local global [1048576 x i64], align 16
@.str = external hidden unnamed_addr constant [9 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 [10 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
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dpfv() local_unnamed_addr #0

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

declare i32 @__gxx_personality_v0(...)

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

; 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 #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca double, align 8
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::allocator.0", align 1
  %5 = load ptr, ptr @stdin, align 8, !tbaa !5
  %6 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %5)
  %7 = load ptr, ptr @stdout, align 8, !tbaa !5
  %8 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %7)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) @H)
  %11 = load i64, ptr @N, align 8, !tbaa !9
  %12 = icmp sgt i64 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa = phi i64 [ %11, %0 ], [ %28, %.lr.ph ]
  %13 = trunc i64 %.lcssa to i32
  %14 = shl nuw i32 1, %13
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds i64, ptr @dp, i64 %15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  store double -1.000000e+09, ptr %1, align 8, !tbaa !11
  call void @_ZSt4fillIPxdEvT_S1_RKT0_(ptr noundef nonnull @dp, ptr noundef nonnull %16, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  store i64 1000000000, ptr @dp, align 16, !tbaa !9
  call void @_Z3dpfv()
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  store i64 -1, ptr %2, align 8, !tbaa !9
  %17 = load i64, ptr @N, align 8, !tbaa !9
  %18 = trunc i64 %17 to i32
  %19 = shl nuw i32 1, %18
  %20 = icmp sgt i32 %19, 1
  br i1 %20, label %.lr.ph50, label %._crit_edge51.thread

._crit_edge51.thread:                             ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #7
  br label %78

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03041 = phi i64 [ %27, %.lr.ph ], [ 0, %0 ]
  %21 = getelementptr inbounds [20 x %struct.cow], ptr @c, i64 0, i64 %.03041
  %22 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %23 = getelementptr inbounds i8, ptr %21, i64 8
  %24 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %25 = getelementptr inbounds i8, ptr %21, i64 16
  %26 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) %25)
  %27 = add nuw nsw i64 %.03041, 1
  %28 = load i64, ptr @N, align 8, !tbaa !9
  %29 = icmp slt i64 %27, %28
  br i1 %29, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge51:                                    ; preds = %69
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #7
  %30 = icmp slt i64 %70, 0
  br i1 %30, label %78, label %77

.lr.ph50:                                         ; preds = %._crit_edge, %69
  %31 = phi i64 [ %70, %69 ], [ -1, %._crit_edge ]
  %32 = phi i64 [ %71, %69 ], [ %17, %._crit_edge ]
  %.02947 = phi i64 [ %72, %69 ], [ 1, %._crit_edge ]
  %33 = getelementptr inbounds [1048576 x i64], ptr @dp, i64 0, i64 %.02947
  %34 = load i64, ptr %33, align 8, !tbaa !9
  %35 = icmp sgt i64 %34, -1000000000
  br i1 %35, label %.preheader, label %69

.preheader:                                       ; preds = %.lr.ph50
  %36 = icmp sgt i64 %32, 0
  br i1 %36, label %.lr.ph44.preheader, label %._crit_edge45

.lr.ph44.preheader:                               ; preds = %.preheader
  %xtraiter = and i64 %32, 1
  %37 = icmp eq i64 %32, 1
  br i1 %37, label %._crit_edge45.loopexit.unr-lcssa, label %.lr.ph44.preheader.new

.lr.ph44.preheader.new:                           ; preds = %.lr.ph44.preheader
  %unroll_iter = and i64 %32, 9223372036854775806
  br label %.lr.ph44

._crit_edge45.loopexit.unr-lcssa:                 ; preds = %64, %.lr.ph44.preheader
  %.128.lcssa.ph = phi i64 [ poison, %.lr.ph44.preheader ], [ %.128.1, %64 ]
  %.02643.unr = phi i64 [ 0, %.lr.ph44.preheader ], [ %65, %64 ]
  %.02742.unr = phi i64 [ 0, %.lr.ph44.preheader ], [ %.128.1, %64 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge45, label %.lr.ph44.epil

.lr.ph44.epil:                                    ; preds = %._crit_edge45.loopexit.unr-lcssa
  %38 = trunc i64 %.02643.unr to i32
  %39 = shl nuw i32 1, %38
  %40 = sext i32 %39 to i64
  %41 = and i64 %.02947, %40
  %.not34.epil = icmp eq i64 %41, 0
  br i1 %.not34.epil, label %._crit_edge45, label %42

42:                                               ; preds = %.lr.ph44.epil
  %43 = getelementptr inbounds [20 x %struct.cow], ptr @c, i64 0, i64 %.02643.unr
  %44 = load i64, ptr %43, align 8, !tbaa !15
  %45 = add nsw i64 %44, %.02742.unr
  br label %._crit_edge45

._crit_edge45:                                    ; preds = %._crit_edge45.loopexit.unr-lcssa, %42, %.lr.ph44.epil, %.preheader
  %.027.lcssa = phi i64 [ 0, %.preheader ], [ %.128.lcssa.ph, %._crit_edge45.loopexit.unr-lcssa ], [ %45, %42 ], [ %.02742.unr, %.lr.ph44.epil ]
  %46 = load i64, ptr @H, align 8, !tbaa !9
  %.not = icmp slt i64 %.027.lcssa, %46
  br i1 %.not, label %69, label %66

.lr.ph44:                                         ; preds = %64, %.lr.ph44.preheader.new
  %.02643 = phi i64 [ 0, %.lr.ph44.preheader.new ], [ %65, %64 ]
  %.02742 = phi i64 [ 0, %.lr.ph44.preheader.new ], [ %.128.1, %64 ]
  %niter = phi i64 [ 0, %.lr.ph44.preheader.new ], [ %niter.next.1, %64 ]
  %47 = trunc i64 %.02643 to i32
  %48 = shl nuw i32 1, %47
  %49 = zext nneg i32 %48 to i64
  %50 = and i64 %.02947, %49
  %.not34 = icmp eq i64 %50, 0
  br i1 %.not34, label %.lr.ph44.1, label %51

51:                                               ; preds = %.lr.ph44
  %52 = getelementptr inbounds [20 x %struct.cow], ptr @c, i64 0, i64 %.02643
  %53 = load i64, ptr %52, align 16, !tbaa !15
  %54 = add nsw i64 %53, %.02742
  br label %.lr.ph44.1

.lr.ph44.1:                                       ; preds = %.lr.ph44, %51
  %.128 = phi i64 [ %54, %51 ], [ %.02742, %.lr.ph44 ]
  %55 = or disjoint i64 %.02643, 1
  %56 = trunc i64 %55 to i32
  %57 = shl nuw i32 1, %56
  %58 = sext i32 %57 to i64
  %59 = and i64 %.02947, %58
  %.not34.1 = icmp eq i64 %59, 0
  br i1 %.not34.1, label %64, label %60

60:                                               ; preds = %.lr.ph44.1
  %61 = getelementptr inbounds [20 x %struct.cow], ptr @c, i64 0, i64 %55
  %62 = load i64, ptr %61, align 8, !tbaa !15
  %63 = add nsw i64 %62, %.128
  br label %64

64:                                               ; preds = %60, %.lr.ph44.1
  %.128.1 = phi i64 [ %63, %60 ], [ %.128, %.lr.ph44.1 ]
  %65 = add nuw nsw i64 %.02643, 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_edge45.loopexit.unr-lcssa, label %.lr.ph44, !llvm.loop !17

66:                                               ; preds = %._crit_edge45
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %33)
  %68 = load i64, ptr %67, align 8, !tbaa !9
  store i64 %68, ptr %2, align 8, !tbaa !9
  %.pre = load i64, ptr @N, align 8, !tbaa !9
  br label %69

69:                                               ; preds = %._crit_edge45, %66, %.lr.ph50
  %70 = phi i64 [ %31, %._crit_edge45 ], [ %68, %66 ], [ %31, %.lr.ph50 ]
  %71 = phi i64 [ %32, %._crit_edge45 ], [ %.pre, %66 ], [ %32, %.lr.ph50 ]
  %72 = add nuw nsw i64 %.02947, 1
  %73 = trunc i64 %71 to i32
  %74 = shl nuw i32 1, %73
  %75 = sext i32 %74 to i64
  %76 = icmp slt i64 %72, %75
  br i1 %76, label %.lr.ph50, label %._crit_edge51, !llvm.loop !18

77:                                               ; preds = %._crit_edge51
  call void @_ZNSt7__cxx119to_stringEx(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %3, i64 noundef %70)
  br label %79

78:                                               ; preds = %._crit_edge51.thread, %._crit_edge51
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull @.str.4, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %79 unwind label %.thread

79:                                               ; preds = %78, %77
  %80 = phi i1 [ true, %78 ], [ false, %77 ]
  %81 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %82 unwind label %87

82:                                               ; preds = %79
  %83 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %81, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %84 unwind label %87

84:                                               ; preds = %82
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  br i1 %80, label %85, label %.critedge

85:                                               ; preds = %84
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  br label %.critedge

.critedge:                                        ; preds = %84, %85
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  ret i32 0

.thread:                                          ; preds = %78
  %86 = landingpad { ptr, i32 }
          cleanup
  br label %89

87:                                               ; preds = %79, %82
  %88 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  br i1 %80, label %89, label %.critedge36

89:                                               ; preds = %.thread, %87
  %.pn40 = phi { ptr, i32 } [ %86, %.thread ], [ %88, %87 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  br label %.critedge36

.critedge36:                                      ; preds = %87, %89
  %.pn39 = phi { ptr, i32 } [ %88, %87 ], [ %.pn40, %89 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  resume { ptr, i32 } %.pn39
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #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 #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt7__cxx119to_stringEx(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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 #0 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)) #5

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #6 align 2

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


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