; LLVM IR from kazunetakahashi/atcoder :: 201610_12/1203_DDCC2016_final/C2.ll (Z5countv)

; 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::__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] }

@A = external dso_local global i64, align 8
@B = external dso_local global i64, align 8
@C = external dso_local global i64, align 8
@_Z1TB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@cntl = external dso_local global [200010 x i32], align 16
@cntr = external dso_local global [200010 x i32], align 16
@cnt = external dso_local global [200010 x i64], align 16
@cost = external dso_local global [200010 x i64], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5countv() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i8, align 1
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @cntr, ptr noundef getelementptr inbounds (i32, ptr @cntr, i64 200010), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @cntl, ptr noundef getelementptr inbounds (i32, ptr @cntl, i64 200010), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  %10 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef 0)
  %11 = load i8, ptr %10, align 1, !tbaa !9
  store i8 %11, ptr %3, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %35, %0
  %13 = load i32, ptr %5, align 4, !tbaa !5
  %14 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %15 = trunc i64 %14 to i32
  %16 = icmp slt i32 %13, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %38

18:                                               ; preds = %12
  %19 = load i8, ptr %3, align 1, !tbaa !9
  %20 = sext i8 %19 to i32
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef %22)
  %24 = load i8, ptr %23, align 1, !tbaa !9
  %25 = sext i8 %24 to i32
  %26 = icmp ne i32 %20, %25
  br i1 %26, label %27, label %34

27:                                               ; preds = %18
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %4, align 4, !tbaa !5
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef %31)
  %33 = load i8, ptr %32, align 1, !tbaa !9
  store i8 %33, ptr %3, align 1, !tbaa !9
  br label %34

34:                                               ; preds = %27, %18
  br label %35

35:                                               ; preds = %34
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %5, align 4, !tbaa !5
  br label %12, !llvm.loop !10

38:                                               ; preds = %17
  %39 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %39, ptr @cntr, align 16, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  %40 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef 0)
  %41 = load i8, ptr %40, align 1, !tbaa !9
  store i8 %41, ptr %3, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %85, %38
  %43 = load i32, ptr %6, align 4, !tbaa !5
  %44 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %45 = trunc i64 %44 to i32
  %46 = icmp slt i32 %43, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %88

48:                                               ; preds = %42
  %49 = load i8, ptr %3, align 1, !tbaa !9
  %50 = sext i8 %49 to i32
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef %52)
  %54 = load i8, ptr %53, align 1, !tbaa !9
  %55 = sext i8 %54 to i32
  %56 = icmp ne i32 %50, %55
  br i1 %56, label %57, label %69

57:                                               ; preds = %48
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %4, align 4, !tbaa !5
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef %61)
  %63 = load i8, ptr %62, align 1, !tbaa !9
  store i8 %63, ptr %3, align 1, !tbaa !9
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add nsw i32 %67, -1
  store i32 %68, ptr %66, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %57, %48
  %70 = load i32, ptr @cntr, align 16, !tbaa !5
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = sub nsw i32 %70, %71
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [200010 x i32], ptr @cntr, i64 0, i64 %74
  store i32 %72, ptr %75, align 4, !tbaa !5
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = add nsw i32 %79, %80
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %83
  store i32 %81, ptr %84, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %69
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %6, align 4, !tbaa !5
  br label %42, !llvm.loop !12

88:                                               ; preds = %47
  %89 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %90 = trunc i64 %89 to i32
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [200010 x i32], ptr @cntr, i64 0, i64 %91
  store i32 0, ptr %92, align 4, !tbaa !5
  %93 = load i32, ptr @cntr, align 16, !tbaa !5
  %94 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %95 = trunc i64 %94 to i32
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %96
  store i32 %93, ptr %97, align 4, !tbaa !5
  %98 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %99 = trunc i64 %98 to i32
  %100 = sub nsw i32 %99, 1
  %101 = sext i32 %100 to i64
  %102 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef %101)
  %103 = load i8, ptr %102, align 1, !tbaa !9
  %104 = sext i8 %103 to i32
  %105 = icmp eq i32 %104, 48
  br i1 %105, label %106, label %123

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

107:                                              ; preds = %119, %106
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %110 = trunc i64 %109 to i32
  %111 = icmp slt i32 %108, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %122

113:                                              ; preds = %107
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [200010 x i32], ptr @cntr, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %116, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %113
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %7, align 4, !tbaa !5
  br label %107, !llvm.loop !13

122:                                              ; preds = %112
  br label %123

123:                                              ; preds = %122, %88
  %124 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef 0)
  %125 = load i8, ptr %124, align 1, !tbaa !9
  %126 = sext i8 %125 to i32
  %127 = icmp eq i32 %126, 49
  br i1 %127, label %128, label %145

128:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %141, %128
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %132 = trunc i64 %131 to i32
  %133 = icmp sle i32 %130, %132
  br i1 %133, label %135, label %134

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

135:                                              ; preds = %129
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %138, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %135
  %142 = load i32, ptr %8, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %8, align 4, !tbaa !5
  br label %129, !llvm.loop !14

144:                                              ; preds = %134
  br label %145

145:                                              ; preds = %144, %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 0, ptr %9, align 8, !tbaa !15
  br label %146

146:                                              ; preds = %178, %145
  %147 = load i64, ptr %9, align 8, !tbaa !15
  %148 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %149 = icmp sle i64 %147, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %181

151:                                              ; preds = %146
  %152 = load i64, ptr %9, align 8, !tbaa !15
  %153 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %152
  %154 = load i64, ptr %9, align 8, !tbaa !15
  %155 = getelementptr inbounds [200010 x i32], ptr @cntr, i64 0, i64 %154
  %156 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %153, ptr noundef nonnull align 4 dereferenceable(4) %155)
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = load i64, ptr %9, align 8, !tbaa !15
  %160 = getelementptr inbounds [200010 x i64], ptr @cnt, i64 0, i64 %159
  store i64 %158, ptr %160, align 8, !tbaa !15
  %161 = load i64, ptr %9, align 8, !tbaa !15
  %162 = load i64, ptr @A, align 8, !tbaa !15
  %163 = mul nsw i64 %161, %162
  %164 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %165 = load i64, ptr %9, align 8, !tbaa !15
  %166 = sub i64 %164, %165
  %167 = load i64, ptr @B, align 8, !tbaa !15
  %168 = mul i64 %166, %167
  %169 = add i64 %163, %168
  %170 = load i64, ptr %9, align 8, !tbaa !15
  %171 = getelementptr inbounds [200010 x i64], ptr @cnt, i64 0, i64 %170
  %172 = load i64, ptr %171, align 8, !tbaa !15
  %173 = load i64, ptr @C, align 8, !tbaa !15
  %174 = mul nsw i64 %172, %173
  %175 = add i64 %169, %174
  %176 = load i64, ptr %9, align 8, !tbaa !15
  %177 = getelementptr inbounds [200010 x i64], ptr @cost, i64 0, i64 %176
  store i64 %175, ptr %177, align 8, !tbaa !15
  br label %178

178:                                              ; preds = %151
  %179 = load i64, ptr %9, align 8, !tbaa !15
  %180 = add nsw i64 %179, 1
  store i64 %180, ptr %9, align 8, !tbaa !15
  br label %146, !llvm.loop !17

181:                                              ; preds = %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  ret void
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

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

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

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


; 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::__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] }

@A = external dso_local local_unnamed_addr global i64, align 8
@B = external dso_local local_unnamed_addr global i64, align 8
@C = external dso_local local_unnamed_addr global i64, align 8
@_Z1TB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@cntl = external dso_local global [200010 x i32], align 16
@cntr = external dso_local global [200010 x i32], align 16
@cnt = external dso_local local_unnamed_addr global [200010 x i64], align 16
@cost = external dso_local local_unnamed_addr global [200010 x i64], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5countv() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @cntr, ptr noundef nonnull getelementptr inbounds (i8, ptr @cntr, i64 800040), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @cntl, ptr noundef nonnull getelementptr inbounds (i8, ptr @cntl, i64 800040), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %3 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef 0)
  %4 = load i8, ptr %3, align 1, !tbaa !9
  %5 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %6 = trunc i64 %5 to i32
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %19, %0
  %.038.lcssa = phi i32 [ 0, %0 ], [ %.1, %19 ]
  store i32 %.038.lcssa, ptr @cntr, align 16, !tbaa !5
  %8 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef 0)
  %9 = load i8, ptr %8, align 1, !tbaa !9
  %10 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %11 = trunc i64 %10 to i32
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph57, label %._crit_edge58

.lr.ph:                                           ; preds = %0, %19
  %indvars.iv = phi i64 [ %indvars.iv.next, %19 ], [ 0, %0 ]
  %.03851 = phi i32 [ %.1, %19 ], [ 0, %0 ]
  %.03950 = phi i8 [ %.140, %19 ], [ %4, %0 ]
  %13 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef %indvars.iv)
  %14 = load i8, ptr %13, align 1, !tbaa !9
  %.not47 = icmp eq i8 %.03950, %14
  br i1 %.not47, label %19, label %15

15:                                               ; preds = %.lr.ph
  %16 = add nsw i32 %.03851, 1
  %17 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef %indvars.iv)
  %18 = load i8, ptr %17, align 1, !tbaa !9
  br label %19

19:                                               ; preds = %.lr.ph, %15
  %.140 = phi i8 [ %18, %15 ], [ %.03950, %.lr.ph ]
  %.1 = phi i32 [ %16, %15 ], [ %.03851, %.lr.ph ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %sext77 = shl i64 %20, 32
  %21 = ashr exact i64 %sext77, 32
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %._crit_edge, !llvm.loop !10

._crit_edge58:                                    ; preds = %48, %._crit_edge
  %23 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %sext = shl i64 %23, 32
  %24 = ashr exact i64 %sext, 32
  %25 = getelementptr inbounds [200010 x i32], ptr @cntr, i64 0, i64 %24
  store i32 0, ptr %25, align 4, !tbaa !5
  %26 = load i32, ptr @cntr, align 16, !tbaa !5
  %27 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %sext43 = shl i64 %27, 32
  %28 = ashr exact i64 %sext43, 32
  %29 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %28
  store i32 %26, ptr %29, align 4, !tbaa !5
  %30 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %31 = shl i64 %30, 32
  %sext44 = add i64 %31, -4294967296
  %32 = ashr exact i64 %sext44, 32
  %33 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef %32)
  %34 = load i8, ptr %33, align 1, !tbaa !9
  %35 = icmp eq i8 %34, 48
  br i1 %35, label %.preheader48, label %.loopexit49

.preheader48:                                     ; preds = %._crit_edge58
  %36 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %37 = trunc i64 %36 to i32
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph60, label %.loopexit49

.lr.ph57:                                         ; preds = %._crit_edge, %48
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %48 ], [ 0, %._crit_edge ]
  %.254 = phi i32 [ %.3, %48 ], [ 0, %._crit_edge ]
  %.24153 = phi i8 [ %.342, %48 ], [ %9, %._crit_edge ]
  %39 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef %indvars.iv69)
  %40 = load i8, ptr %39, align 1, !tbaa !9
  %.not46 = icmp eq i8 %.24153, %40
  br i1 %.not46, label %.lr.ph57._crit_edge, label %41

.lr.ph57._crit_edge:                              ; preds = %.lr.ph57
  %.phi.trans.insert = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %indvars.iv69
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  br label %48

41:                                               ; preds = %.lr.ph57
  %42 = add nsw i32 %.254, 1
  %43 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef %indvars.iv69)
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %indvars.iv69
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = add nsw i32 %46, -1
  br label %48

48:                                               ; preds = %.lr.ph57._crit_edge, %41
  %49 = phi i32 [ %47, %41 ], [ %.pre, %.lr.ph57._crit_edge ]
  %.342 = phi i8 [ %44, %41 ], [ %.24153, %.lr.ph57._crit_edge ]
  %.3 = phi i32 [ %42, %41 ], [ %.254, %.lr.ph57._crit_edge ]
  %50 = load i32, ptr @cntr, align 16, !tbaa !5
  %51 = sub nsw i32 %50, %.3
  %52 = getelementptr inbounds [200010 x i32], ptr @cntr, i64 0, i64 %indvars.iv69
  store i32 %51, ptr %52, align 4, !tbaa !5
  %53 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %indvars.iv69
  %54 = add nsw i32 %49, %.3
  store i32 %54, ptr %53, align 4, !tbaa !5
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %55 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %sext78 = shl i64 %55, 32
  %56 = ashr exact i64 %sext78, 32
  %57 = icmp slt i64 %indvars.iv.next70, %56
  br i1 %57, label %.lr.ph57, label %._crit_edge58, !llvm.loop !12

.lr.ph60:                                         ; preds = %.preheader48, %.lr.ph60
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %.lr.ph60 ], [ 0, %.preheader48 ]
  %58 = getelementptr inbounds [200010 x i32], ptr @cntr, i64 0, i64 %indvars.iv71
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %58, align 4, !tbaa !5
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %61 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %sext79 = shl i64 %61, 32
  %62 = ashr exact i64 %sext79, 32
  %63 = icmp slt i64 %indvars.iv.next72, %62
  br i1 %63, label %.lr.ph60, label %.loopexit49, !llvm.loop !13

.loopexit49:                                      ; preds = %.lr.ph60, %.preheader48, %._crit_edge58
  %64 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11, i64 noundef 0)
  %65 = load i8, ptr %64, align 1, !tbaa !9
  %66 = icmp eq i8 %65, 49
  br i1 %66, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %.loopexit49
  %67 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %68 = trunc i64 %67 to i32
  %.not61 = icmp slt i32 %68, 1
  br i1 %.not61, label %.loopexit, label %.lr.ph63

.lr.ph63:                                         ; preds = %.preheader, %.lr.ph63
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %.lr.ph63 ], [ 1, %.preheader ]
  %69 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %indvars.iv74
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %69, align 4, !tbaa !5
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %72 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %sext80 = shl i64 %72, 32
  %73 = ashr exact i64 %sext80, 32
  %.not.not = icmp slt i64 %indvars.iv74, %73
  br i1 %.not.not, label %.lr.ph63, label %.loopexit, !llvm.loop !14

.loopexit:                                        ; preds = %.lr.ph63, %.preheader, %.loopexit49
  %74 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %.not4564 = icmp slt i64 %74, 0
  br i1 %.not4564, label %._crit_edge68, label %.lr.ph67

._crit_edge68:                                    ; preds = %.lr.ph67, %.loopexit
  ret void

.lr.ph67:                                         ; preds = %.loopexit, %.lr.ph67
  %.065 = phi i64 [ %93, %.lr.ph67 ], [ 0, %.loopexit ]
  %75 = getelementptr inbounds [200010 x i32], ptr @cntl, i64 0, i64 %.065
  %76 = getelementptr inbounds [200010 x i32], ptr @cntr, i64 0, i64 %.065
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %75, ptr noundef nonnull align 4 dereferenceable(4) %76)
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [200010 x i64], ptr @cnt, i64 0, i64 %.065
  store i64 %79, ptr %80, align 8, !tbaa !15
  %81 = load i64, ptr @A, align 8, !tbaa !15
  %82 = mul nsw i64 %81, %.065
  %83 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %84 = sub i64 %83, %.065
  %85 = load i64, ptr @B, align 8, !tbaa !15
  %86 = mul i64 %84, %85
  %87 = add i64 %86, %82
  %88 = load i64, ptr %80, align 8, !tbaa !15
  %89 = load i64, ptr @C, align 8, !tbaa !15
  %90 = mul nsw i64 %89, %88
  %91 = add i64 %87, %90
  %92 = getelementptr inbounds [200010 x i64], ptr @cost, i64 0, i64 %.065
  store i64 %91, ptr %92, align 8, !tbaa !15
  %93 = add nuw nsw i64 %.065, 1
  %94 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1TB5cxx11) #5
  %.not45.not = icmp slt i64 %.065, %94
  br i1 %.not45.not, label %.lr.ph67, label %._crit_edge68, !llvm.loop !17
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

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

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

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


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