; LLVM IR from kazunetakahashi/atcoder :: 201411_201509/0329_UTPC2014/F.ll (Z5mandcii)

; 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.__gnu_cxx::__normal_iterator" = type { ptr }

@_Z1AB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_Z1WB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [91 x i8], align 1
@__PRETTY_FUNCTION__._Z5mandcii = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z5mandcii(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %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 i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %19 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  %20 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11, ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11)
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = icmp sge i32 %22, %23
  br i1 %24, label %25, label %26

25:                                               ; preds = %2
  store i32 0, ptr %3, align 4
  br label %184

26:                                               ; preds = %2
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = add nsw i32 %27, 2
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = icmp eq i32 %28, %29
  br i1 %30, label %31, label %53

31:                                               ; preds = %26
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %33)
  %35 = load i8, ptr %34, align 1, !tbaa !9
  %36 = sext i8 %35 to i32
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %39)
  %41 = load i8, ptr %40, align 1, !tbaa !9
  %42 = sext i8 %41 to i32
  %43 = icmp sle i32 %36, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %31
  store i32 0, ptr %3, align 4
  br label %184

45:                                               ; preds = %31
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %47)
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  %51 = sext i32 %50 to i64
  %52 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %51)
  call void @_ZSt4swapIcENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1) %48, ptr noundef nonnull align 1 dereferenceable(1) %52) #6
  store i32 1, ptr %3, align 4
  br label %184

53:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = add nsw i32 %54, %55
  %57 = sdiv i32 %56, 2
  store i32 %57, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = call noundef i32 @_Z5mandcii(i32 noundef %58, i32 noundef %59)
  store i32 %60, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = call noundef i32 @_Z5mandcii(i32 noundef %61, i32 noundef %62)
  store i32 %63, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %64 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %64, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %65 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %65, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %66 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %66, ptr %12, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %114, %53
  %68 = load i32, ptr %10, align 4, !tbaa !5
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %71, label %75

71:                                               ; preds = %67
  %72 = load i32, ptr %11, align 4, !tbaa !5
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br label %75

75:                                               ; preds = %71, %67
  %76 = phi i1 [ false, %67 ], [ %74, %71 ]
  br i1 %76, label %77, label %115

77:                                               ; preds = %75
  %78 = load i32, ptr %10, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %79)
  %81 = load i8, ptr %80, align 1, !tbaa !9
  %82 = sext i8 %81 to i32
  %83 = load i32, ptr %11, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %84)
  %86 = load i8, ptr %85, align 1, !tbaa !9
  %87 = sext i8 %86 to i32
  %88 = icmp sle i32 %82, %87
  br i1 %88, label %89, label %99

89:                                               ; preds = %77
  %90 = load i32, ptr %10, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %10, align 4, !tbaa !5
  %92 = sext i32 %90 to i64
  %93 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %92)
  %94 = load i8, ptr %93, align 1, !tbaa !9
  %95 = load i32, ptr %12, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %12, align 4, !tbaa !5
  %97 = sext i32 %95 to i64
  %98 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11, i64 noundef %97)
  store i8 %94, ptr %98, align 1, !tbaa !9
  br label %114

99:                                               ; preds = %77
  %100 = load i32, ptr %11, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %11, align 4, !tbaa !5
  %102 = sext i32 %100 to i64
  %103 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %102)
  %104 = load i8, ptr %103, align 1, !tbaa !9
  %105 = load i32, ptr %12, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %12, align 4, !tbaa !5
  %107 = sext i32 %105 to i64
  %108 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11, i64 noundef %107)
  store i8 %104, ptr %108, align 1, !tbaa !9
  %109 = load i32, ptr %6, align 4, !tbaa !5
  %110 = load i32, ptr %10, align 4, !tbaa !5
  %111 = sub nsw i32 %109, %110
  %112 = load i32, ptr %9, align 4, !tbaa !5
  %113 = add nsw i32 %112, %111
  store i32 %113, ptr %9, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %99, %89
  br label %67, !llvm.loop !10

115:                                              ; preds = %75
  br label %116

116:                                              ; preds = %120, %115
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = load i32, ptr %6, align 4, !tbaa !5
  %119 = icmp slt i32 %117, %118
  br i1 %119, label %120, label %130

120:                                              ; preds = %116
  %121 = load i32, ptr %10, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %10, align 4, !tbaa !5
  %123 = sext i32 %121 to i64
  %124 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %123)
  %125 = load i8, ptr %124, align 1, !tbaa !9
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %12, align 4, !tbaa !5
  %128 = sext i32 %126 to i64
  %129 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11, i64 noundef %128)
  store i8 %125, ptr %129, align 1, !tbaa !9
  br label %116, !llvm.loop !12

130:                                              ; preds = %116
  br label %131

131:                                              ; preds = %135, %130
  %132 = load i32, ptr %11, align 4, !tbaa !5
  %133 = load i32, ptr %5, align 4, !tbaa !5
  %134 = icmp slt i32 %132, %133
  br i1 %134, label %135, label %145

135:                                              ; preds = %131
  %136 = load i32, ptr %11, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %11, align 4, !tbaa !5
  %138 = sext i32 %136 to i64
  %139 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %138)
  %140 = load i8, ptr %139, align 1, !tbaa !9
  %141 = load i32, ptr %12, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %12, align 4, !tbaa !5
  %143 = sext i32 %141 to i64
  %144 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11, i64 noundef %143)
  store i8 %140, ptr %144, align 1, !tbaa !9
  br label %131, !llvm.loop !13

145:                                              ; preds = %131
  %146 = load i32, ptr %12, align 4, !tbaa !5
  %147 = load i32, ptr %5, align 4, !tbaa !5
  %148 = icmp eq i32 %146, %147
  br i1 %148, label %149, label %150

149:                                              ; preds = %145
  br label %152

150:                                              ; preds = %145
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.3, i32 noundef 37, ptr noundef @__PRETTY_FUNCTION__._Z5mandcii) #7
  unreachable

151:                                              ; No predecessors!
  br label %152

152:                                              ; preds = %151, %149
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %153 = call ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11) #6
  %154 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %153, ptr %154, align 8
  %155 = load i32, ptr %4, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %14, i64 noundef %156) #6
  %158 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %157, ptr %158, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %159 = call ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11) #6
  %160 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %159, ptr %160, align 8
  %161 = load i32, ptr %5, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %16, i64 noundef %162) #6
  %164 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %163, ptr %164, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %165 = call ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11) #6
  %166 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %165, ptr %166, align 8
  %167 = load i32, ptr %4, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %18, i64 noundef %168) #6
  %170 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %169, ptr %170, align 8
  %171 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  %172 = load ptr, ptr %171, align 8
  %173 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  %174 = load ptr, ptr %173, align 8
  %175 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  %176 = load ptr, ptr %175, align 8
  %177 = call ptr @_ZSt4copyIN9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEES9_ET0_T_SB_SA_(ptr %172, ptr %174, ptr %176)
  %178 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %19, i32 0, i32 0
  store ptr %177, ptr %178, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %179 = load i32, ptr %7, align 4, !tbaa !5
  %180 = load i32, ptr %8, align 4, !tbaa !5
  %181 = add nsw i32 %179, %180
  %182 = load i32, ptr %9, align 4, !tbaa !5
  %183 = add nsw i32 %181, %182
  store i32 %183, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %184

184:                                              ; preds = %152, %45, %44, %25
  %185 = load i32, ptr %3, align 4
  ret i32 %185
}

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt4copyIN9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEES9_ET0_T_SB_SA_(ptr, ptr, ptr) #5

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

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

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

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


; 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.__gnu_cxx::__normal_iterator" = type { ptr }

@_Z1AB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_Z1WB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [91 x i8], align 1
@__PRETTY_FUNCTION__._Z5mandcii = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z5mandcii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11, ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11)
  %7 = add nsw i32 %0, 1
  %.not = icmp slt i32 %7, %1
  br i1 %.not, label %8, label %81

8:                                                ; preds = %2
  %9 = add nsw i32 %0, 2
  %10 = icmp eq i32 %9, %1
  br i1 %10, label %11, label %21

11:                                               ; preds = %8
  %12 = sext i32 %0 to i64
  %13 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %12)
  %14 = load i8, ptr %13, align 1, !tbaa !5
  %15 = sext i32 %7 to i64
  %16 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %15)
  %17 = load i8, ptr %16, align 1, !tbaa !5
  %.not63 = icmp sgt i8 %14, %17
  br i1 %.not63, label %18, label %81

18:                                               ; preds = %11
  %19 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %12)
  %20 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %15)
  tail call void @_ZSt4swapIcENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1) %19, ptr noundef nonnull align 1 dereferenceable(1) %20) #6
  br label %81

21:                                               ; preds = %8
  %22 = add nsw i32 %1, %0
  %23 = sdiv i32 %22, 2
  %24 = tail call noundef i32 @_Z5mandcii(i32 noundef %0, i32 noundef %23)
  %25 = tail call noundef i32 @_Z5mandcii(i32 noundef %23, i32 noundef %1)
  %26 = icmp sgt i32 %23, %0
  %27 = icmp slt i32 %23, %1
  %28 = and i1 %26, %27
  br i1 %28, label %.lr.ph.preheader, label %.preheader64

.lr.ph.preheader:                                 ; preds = %21
  %29 = sext i32 %0 to i64
  br label %.lr.ph

.preheader64.loopexit:                            ; preds = %52
  %30 = trunc nsw i64 %indvars.iv.next to i32
  br label %.preheader64

.preheader64:                                     ; preds = %.preheader64.loopexit, %21
  %.056.lcssa = phi i32 [ %0, %21 ], [ %30, %.preheader64.loopexit ]
  %.053.lcssa = phi i32 [ %23, %21 ], [ %.154, %.preheader64.loopexit ]
  %.051.lcssa = phi i32 [ %0, %21 ], [ %.152, %.preheader64.loopexit ]
  %.050.lcssa = phi i32 [ 0, %21 ], [ %.1, %.preheader64.loopexit ]
  %31 = icmp slt i32 %.051.lcssa, %23
  br i1 %31, label %.lr.ph74.preheader, label %.preheader

.lr.ph74.preheader:                               ; preds = %.preheader64
  %32 = sext i32 %.051.lcssa to i64
  %33 = sext i32 %.056.lcssa to i64
  br label %.lr.ph74

.lr.ph:                                           ; preds = %.lr.ph.preheader, %52
  %indvars.iv = phi i64 [ %29, %.lr.ph.preheader ], [ %indvars.iv.next, %52 ]
  %.05068 = phi i32 [ 0, %.lr.ph.preheader ], [ %.1, %52 ]
  %.05167 = phi i32 [ %0, %.lr.ph.preheader ], [ %.152, %52 ]
  %.05366 = phi i32 [ %23, %.lr.ph.preheader ], [ %.154, %52 ]
  %34 = sext i32 %.05167 to i64
  %35 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %34)
  %36 = load i8, ptr %35, align 1, !tbaa !5
  %37 = sext i32 %.05366 to i64
  %38 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %37)
  %39 = load i8, ptr %38, align 1, !tbaa !5
  %.not62 = icmp sgt i8 %36, %39
  br i1 %.not62, label %45, label %40

40:                                               ; preds = %.lr.ph
  %41 = add nsw i32 %.05167, 1
  %42 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %34)
  %43 = load i8, ptr %42, align 1, !tbaa !5
  %44 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11, i64 noundef %indvars.iv)
  store i8 %43, ptr %44, align 1, !tbaa !5
  br label %52

45:                                               ; preds = %.lr.ph
  %46 = add nsw i32 %.05366, 1
  %47 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %37)
  %48 = load i8, ptr %47, align 1, !tbaa !5
  %49 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11, i64 noundef %indvars.iv)
  store i8 %48, ptr %49, align 1, !tbaa !5
  %50 = sub i32 %23, %.05167
  %51 = add nsw i32 %50, %.05068
  br label %52

52:                                               ; preds = %45, %40
  %.154 = phi i32 [ %.05366, %40 ], [ %46, %45 ]
  %.152 = phi i32 [ %41, %40 ], [ %.05167, %45 ]
  %.1 = phi i32 [ %.05068, %40 ], [ %51, %45 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %53 = icmp slt i32 %.152, %23
  %54 = icmp slt i32 %.154, %1
  %55 = select i1 %53, i1 %54, i1 false
  br i1 %55, label %.lr.ph, label %.preheader64.loopexit, !llvm.loop !8

.preheader.loopexit:                              ; preds = %.lr.ph74
  %56 = trunc nsw i64 %indvars.iv.next85 to i32
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader64
  %.258.lcssa = phi i32 [ %.056.lcssa, %.preheader64 ], [ %56, %.preheader.loopexit ]
  %57 = icmp slt i32 %.053.lcssa, %1
  br i1 %57, label %.lr.ph78.preheader, label %._crit_edge

.lr.ph78.preheader:                               ; preds = %.preheader
  %58 = sext i32 %.053.lcssa to i64
  %59 = sext i32 %.258.lcssa to i64
  br label %.lr.ph78

.lr.ph74:                                         ; preds = %.lr.ph74.preheader, %.lr.ph74
  %indvars.iv84 = phi i64 [ %33, %.lr.ph74.preheader ], [ %indvars.iv.next85, %.lr.ph74 ]
  %indvars.iv82 = phi i64 [ %32, %.lr.ph74.preheader ], [ %indvars.iv.next83, %.lr.ph74 ]
  %indvars.iv.next83 = add nsw i64 %indvars.iv82, 1
  %60 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %indvars.iv82)
  %61 = load i8, ptr %60, align 1, !tbaa !5
  %indvars.iv.next85 = add nsw i64 %indvars.iv84, 1
  %62 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11, i64 noundef %indvars.iv84)
  store i8 %61, ptr %62, align 1, !tbaa !5
  %lftr.wideiv = trunc i64 %indvars.iv.next83 to i32
  %exitcond.not = icmp eq i32 %23, %lftr.wideiv
  br i1 %exitcond.not, label %.preheader.loopexit, label %.lr.ph74, !llvm.loop !10

.lr.ph78:                                         ; preds = %.lr.ph78.preheader, %.lr.ph78
  %indvars.iv91 = phi i64 [ %59, %.lr.ph78.preheader ], [ %indvars.iv.next92, %.lr.ph78 ]
  %indvars.iv89 = phi i64 [ %58, %.lr.ph78.preheader ], [ %indvars.iv.next90, %.lr.ph78 ]
  %indvars.iv.next90 = add nsw i64 %indvars.iv89, 1
  %63 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11, i64 noundef %indvars.iv89)
  %64 = load i8, ptr %63, align 1, !tbaa !5
  %indvars.iv.next92 = add nsw i64 %indvars.iv91, 1
  %65 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11, i64 noundef %indvars.iv91)
  store i8 %64, ptr %65, align 1, !tbaa !5
  %lftr.wideiv96 = trunc i64 %indvars.iv.next90 to i32
  %exitcond97.not = icmp eq i32 %lftr.wideiv96, %1
  br i1 %exitcond97.not, label %._crit_edge.loopexit, label %.lr.ph78, !llvm.loop !11

._crit_edge.loopexit:                             ; preds = %.lr.ph78
  %66 = trunc nsw i64 %indvars.iv.next92 to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %.3.lcssa = phi i32 [ %.258.lcssa, %.preheader ], [ %66, %._crit_edge.loopexit ]
  %67 = icmp eq i32 %.3.lcssa, %1
  br i1 %67, label %69, label %68

68:                                               ; preds = %._crit_edge
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.3, i32 noundef 37, ptr noundef nonnull @__PRETTY_FUNCTION__._Z5mandcii) #7
  unreachable

69:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %70 = tail call ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11) #6
  store ptr %70, ptr %3, align 8
  %71 = sext i32 %0 to i64
  %72 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %3, i64 noundef %71) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %73 = call ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1WB5cxx11) #6
  store ptr %73, ptr %4, align 8
  %74 = sext i32 %1 to i64
  %75 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %4, i64 noundef %74) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %76 = call ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1AB5cxx11) #6
  store ptr %76, ptr %5, align 8
  %77 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %5, i64 noundef %71) #6
  %78 = call ptr @_ZSt4copyIN9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEES9_ET0_T_SB_SA_(ptr %72, ptr %75, ptr %77)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %79 = add nsw i32 %25, %24
  %80 = add nsw i32 %79, %.050.lcssa
  br label %81

81:                                               ; preds = %11, %2, %69, %18
  %.0 = phi i32 [ 1, %18 ], [ %80, %69 ], [ 0, %2 ], [ 0, %11 ]
  ret i32 %.0
}

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 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 #1 align 2

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt4copyIN9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEES9_ET0_T_SB_SA_(ptr, ptr, ptr) local_unnamed_addr #5

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

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

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

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


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