; LLVM IR from eyangch/competitive-programming :: Codeforces/1411/d.ll (Z4calcx)

; 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] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@x = external dso_local global i64, align 8
@y = external dso_local global i64, align 8
@val = external dso_local global i64, align 8
@BIT = external dso_local global [2 x [300000 x i64]], align 16
@q = external dso_local global %"class.std::vector", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updxxx(i64 noundef, i64 noundef, i64 noundef) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3qryxx(i64 noundef, i64 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z4calcx(i64 noundef %0) #2 {
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  store i64 %0, ptr %2, align 8, !tbaa !5
  store i64 0, ptr @val, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !9
  %13 = call noundef ptr @_ZSt6fill_nIPxiiET_S1_T0_RKT1_(ptr noundef @BIT, i32 noundef 600000, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store i64 0, ptr %4, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %55, %1
  %15 = load i64, ptr %4, align 8, !tbaa !5
  %16 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #5
  %17 = icmp slt i64 %15, %16
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !5
  %20 = load i64, ptr %4, align 8, !tbaa !5
  %21 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %20)
  %22 = load i8, ptr %21, align 1, !tbaa !11
  %23 = sext i8 %22 to i32
  %24 = icmp eq i32 %23, 63
  br i1 %24, label %25, label %27

25:                                               ; preds = %19
  %26 = load i64, ptr %2, align 8, !tbaa !5
  store i64 %26, ptr %5, align 8, !tbaa !5
  br label %34

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

34:                                               ; preds = %27, %25
  %35 = load i64, ptr %5, align 8, !tbaa !5
  %36 = icmp ne i64 %35, 0
  br i1 %36, label %37, label %44

37:                                               ; preds = %34
  %38 = load i64, ptr %4, align 8, !tbaa !5
  %39 = call noundef i64 @_Z3qryxx(i64 noundef 0, i64 noundef %38)
  %40 = load i64, ptr @x, align 8, !tbaa !5
  %41 = mul nsw i64 %39, %40
  %42 = load i64, ptr @val, align 8, !tbaa !5
  %43 = add nsw i64 %42, %41
  store i64 %43, ptr @val, align 8, !tbaa !5
  br label %51

44:                                               ; preds = %34
  %45 = load i64, ptr %4, align 8, !tbaa !5
  %46 = call noundef i64 @_Z3qryxx(i64 noundef 1, i64 noundef %45)
  %47 = load i64, ptr @y, align 8, !tbaa !5
  %48 = mul nsw i64 %46, %47
  %49 = load i64, ptr @val, align 8, !tbaa !5
  %50 = add nsw i64 %49, %48
  store i64 %50, ptr @val, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %44, %37
  %52 = load i64, ptr %5, align 8, !tbaa !5
  %53 = load i64, ptr %4, align 8, !tbaa !5
  %54 = add nsw i64 %53, 1
  call void @_Z3updxxx(i64 noundef %52, i64 noundef %54, i64 noundef 1)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %55

55:                                               ; preds = %51
  %56 = load i64, ptr %4, align 8, !tbaa !5
  %57 = add nsw i64 %56, 1
  store i64 %57, ptr %4, align 8, !tbaa !5
  br label %14, !llvm.loop !12

58:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %59 = load i64, ptr @val, align 8, !tbaa !5
  store i64 %59, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr @q, ptr %7, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %60 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @q) #5
  %61 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %60, ptr %61, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %62 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @q) #5
  %63 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %62, ptr %63, align 8
  br label %64

64:                                               ; preds = %129, %58
  %65 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  br i1 %65, label %67, label %66

66:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %131

67:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  %69 = load i64, ptr %68, align 8, !tbaa !5
  store i64 %69, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %70 = load i64, ptr %10, align 8, !tbaa !5
  %71 = call noundef i64 @_Z3qryxx(i64 noundef 1, i64 noundef %70)
  %72 = load i64, ptr @y, align 8, !tbaa !5
  %73 = mul nsw i64 %71, %72
  %74 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #5
  %75 = call noundef i64 @_Z3qryxx(i64 noundef 1, i64 noundef %74)
  %76 = load i64, ptr %10, align 8, !tbaa !5
  %77 = add nsw i64 %76, 1
  %78 = call noundef i64 @_Z3qryxx(i64 noundef 1, i64 noundef %77)
  %79 = sub nsw i64 %75, %78
  %80 = load i64, ptr @x, align 8, !tbaa !5
  %81 = mul nsw i64 %79, %80
  %82 = add nsw i64 %73, %81
  store i64 %82, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %83 = load i64, ptr %10, align 8, !tbaa !5
  %84 = call noundef i64 @_Z3qryxx(i64 noundef 0, i64 noundef %83)
  %85 = load i64, ptr @x, align 8, !tbaa !5
  %86 = mul nsw i64 %84, %85
  %87 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #5
  %88 = call noundef i64 @_Z3qryxx(i64 noundef 0, i64 noundef %87)
  %89 = load i64, ptr %10, align 8, !tbaa !5
  %90 = add nsw i64 %89, 1
  %91 = call noundef i64 @_Z3qryxx(i64 noundef 0, i64 noundef %90)
  %92 = sub nsw i64 %88, %91
  %93 = load i64, ptr @y, align 8, !tbaa !5
  %94 = mul nsw i64 %92, %93
  %95 = add nsw i64 %86, %94
  store i64 %95, ptr %12, align 8, !tbaa !5
  %96 = load i64, ptr %2, align 8, !tbaa !5
  %97 = icmp ne i64 %96, 0
  br i1 %97, label %102, label %98

98:                                               ; preds = %67
  %99 = load i64, ptr %11, align 8, !tbaa !5
  %100 = load i64, ptr @val, align 8, !tbaa !5
  %101 = sub nsw i64 %100, %99
  store i64 %101, ptr @val, align 8, !tbaa !5
  br label %106

102:                                              ; preds = %67
  %103 = load i64, ptr %12, align 8, !tbaa !5
  %104 = load i64, ptr @val, align 8, !tbaa !5
  %105 = sub nsw i64 %104, %103
  store i64 %105, ptr @val, align 8, !tbaa !5
  br label %106

106:                                              ; preds = %102, %98
  %107 = load i64, ptr %2, align 8, !tbaa !5
  %108 = icmp ne i64 %107, 0
  br i1 %108, label %113, label %109

109:                                              ; preds = %106
  %110 = load i64, ptr %12, align 8, !tbaa !5
  %111 = load i64, ptr @val, align 8, !tbaa !5
  %112 = add nsw i64 %111, %110
  store i64 %112, ptr @val, align 8, !tbaa !5
  br label %117

113:                                              ; preds = %106
  %114 = load i64, ptr %11, align 8, !tbaa !5
  %115 = load i64, ptr @val, align 8, !tbaa !5
  %116 = add nsw i64 %115, %114
  store i64 %116, ptr @val, align 8, !tbaa !5
  br label %117

117:                                              ; preds = %113, %109
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) @val)
  %119 = load i64, ptr %118, align 8, !tbaa !5
  store i64 %119, ptr %6, align 8, !tbaa !5
  %120 = load i64, ptr %2, align 8, !tbaa !5
  %121 = load i64, ptr %10, align 8, !tbaa !5
  %122 = add nsw i64 %121, 1
  call void @_Z3updxxx(i64 noundef %120, i64 noundef %122, i64 noundef -1)
  %123 = load i64, ptr %2, align 8, !tbaa !5
  %124 = icmp ne i64 %123, 0
  %125 = xor i1 %124, true
  %126 = zext i1 %125 to i64
  %127 = load i64, ptr %10, align 8, !tbaa !5
  %128 = add nsw i64 %127, 1
  call void @_Z3updxxx(i64 noundef %126, i64 noundef %128, i64 noundef 1)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %129

129:                                              ; preds = %117
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  br label %64

131:                                              ; preds = %66
  %132 = load i64, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  ret i64 %132
}

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

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

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

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

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

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

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

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

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


; 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] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@x = external dso_local local_unnamed_addr global i64, align 8
@y = external dso_local local_unnamed_addr global i64, align 8
@val = external dso_local global i64, align 8
@BIT = external dso_local global [2 x [300000 x i64]], align 16
@q = external dso_local global %"class.std::vector", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updxxx(i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3qryxx(i64 noundef, i64 noundef) 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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z4calcx(i64 noundef %0) local_unnamed_addr #2 {
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store i64 0, ptr @val, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 0, ptr %2, align 4, !tbaa !9
  %6 = call noundef ptr @_ZSt6fill_nIPxiiET_S1_T0_RKT1_(ptr noundef nonnull @BIT, i32 noundef 600000, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %7 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #5
  %8 = icmp sgt i64 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %22, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %9 = load i64, ptr @val, align 8, !tbaa !5
  store i64 %9, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %10 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @q) #5
  store ptr %10, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %11 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @q) #5
  store ptr %11, ptr %5, align 8
  %12 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  br i1 %12, label %.lr.ph30, label %._crit_edge31

.lr.ph30:                                         ; preds = %._crit_edge
  %.not = icmp eq i64 %0, 0
  %13 = zext i1 %.not to i64
  br label %32

.lr.ph:                                           ; preds = %1, %22
  %.028 = phi i64 [ %28, %22 ], [ 0, %1 ]
  %14 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %.028)
  %15 = load i8, ptr %14, align 1, !tbaa !11
  %16 = icmp eq i8 %15, 63
  br i1 %16, label %22, label %17

17:                                               ; preds = %.lr.ph
  %18 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %.028)
  %19 = load i8, ptr %18, align 1, !tbaa !11
  %20 = sext i8 %19 to i64
  %21 = add nsw i64 %20, -48
  br label %22

22:                                               ; preds = %.lr.ph, %17
  %.024 = phi i64 [ %21, %17 ], [ %0, %.lr.ph ]
  %.not26 = icmp eq i64 %.024, 0
  %. = zext i1 %.not26 to i64
  %23 = call noundef i64 @_Z3qryxx(i64 noundef %., i64 noundef %.028)
  %y.val = load i64, ptr @y, align 8
  %x.val = load i64, ptr @x, align 8
  %24 = select i1 %.not26, i64 %y.val, i64 %x.val
  %25 = mul nsw i64 %24, %23
  %26 = load i64, ptr @val, align 8, !tbaa !5
  %27 = add nsw i64 %26, %25
  store i64 %27, ptr @val, align 8, !tbaa !5
  %28 = add nuw nsw i64 %.028, 1
  call void @_Z3updxxx(i64 noundef %.024, i64 noundef %28, i64 noundef 1)
  %29 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #5
  %30 = icmp slt i64 %28, %29
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !12

._crit_edge31.loopexit:                           ; preds = %32
  %.pre = load i64, ptr %3, align 8, !tbaa !5
  br label %._crit_edge31

._crit_edge31:                                    ; preds = %._crit_edge31.loopexit, %._crit_edge
  %31 = phi i64 [ %.pre, %._crit_edge31.loopexit ], [ %9, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret i64 %31

32:                                               ; preds = %.lr.ph30, %32
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %34 = load i64, ptr %33, align 8, !tbaa !5
  %35 = call noundef i64 @_Z3qryxx(i64 noundef 1, i64 noundef %34)
  %36 = load i64, ptr @y, align 8, !tbaa !5
  %37 = mul nsw i64 %36, %35
  %38 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #5
  %39 = call noundef i64 @_Z3qryxx(i64 noundef 1, i64 noundef %38)
  %40 = add nsw i64 %34, 1
  %41 = call noundef i64 @_Z3qryxx(i64 noundef 1, i64 noundef %40)
  %42 = sub nsw i64 %39, %41
  %43 = load i64, ptr @x, align 8, !tbaa !5
  %44 = mul nsw i64 %42, %43
  %45 = add nsw i64 %44, %37
  %46 = call noundef i64 @_Z3qryxx(i64 noundef 0, i64 noundef %34)
  %47 = load i64, ptr @x, align 8, !tbaa !5
  %48 = mul nsw i64 %47, %46
  %49 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #5
  %50 = call noundef i64 @_Z3qryxx(i64 noundef 0, i64 noundef %49)
  %51 = call noundef i64 @_Z3qryxx(i64 noundef 0, i64 noundef %40)
  %52 = sub nsw i64 %50, %51
  %53 = load i64, ptr @y, align 8, !tbaa !5
  %54 = mul nsw i64 %52, %53
  %55 = add nsw i64 %54, %48
  %56 = load i64, ptr @val, align 8
  %storemerge.v = select i1 %.not, i64 %45, i64 %55
  %storemerge = sub i64 %56, %storemerge.v
  %storemerge25.v = select i1 %.not, i64 %55, i64 %45
  %storemerge25 = add nsw i64 %storemerge, %storemerge25.v
  store i64 %storemerge25, ptr @val, align 8, !tbaa !5
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) @val)
  %58 = load i64, ptr %57, align 8, !tbaa !5
  store i64 %58, ptr %3, align 8, !tbaa !5
  call void @_Z3updxxx(i64 noundef %0, i64 noundef %40, i64 noundef -1)
  call void @_Z3updxxx(i64 noundef %13, i64 noundef %40, i64 noundef 1)
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %60 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  br i1 %60, label %32, label %._crit_edge31.loopexit
}

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

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

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

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

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

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

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

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass