; LLVM IR from tangjz/acm-icpc :: Summer_Training/2016-07-21/B - Born Slippy - tjz.ll (Z3dfsi)

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

@tot = external dso_local global i32, align 4
@idx = external dso_local global [256 x [256 x i32]], align 16
@pos = external dso_local global [16779786 x i32], align 16
@pre = external dso_local global [16779786 x i32], align 16
@w = external dso_local global [65546 x i32], align 16
@val = external dso_local global [16779786 x i32], align 16
@f = external dso_local global [65546 x i32], align 16
@e = external dso_local global [65546 x %"class.std::vector"], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsi(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %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 %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [65546 x i32], ptr @w, i64 0, i64 %12
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = ashr i32 %14, 8
  store i32 %15, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [65546 x i32], ptr @w, i64 0, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = and i32 %19, 255
  store i32 %20, ptr %4, align 4, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [65546 x i32], ptr @f, i64 0, i64 %22
  store i32 0, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %57, %1
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = icmp slt i32 %25, 256
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %60

28:                                               ; preds = %24
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %30
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [256 x i32], ptr %31, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = icmp ne i32 %35, -1
  br i1 %36, label %37, label %56

37:                                               ; preds = %28
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [65546 x i32], ptr @f, i64 0, i64 %39
  %41 = load i32, ptr %5, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [256 x i32], ptr %43, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [16779786 x i32], ptr @val, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = call noundef i32 @_Z3optjj(i32 noundef %51, i32 noundef %52)
  %54 = shl i32 %53, 8
  %55 = add i32 %50, %54
  call void @_Z3updRjj(ptr noundef nonnull align 4 dereferenceable(4) %40, i32 noundef %55)
  br label %56

56:                                               ; preds = %37, %28
  br label %57

57:                                               ; preds = %56
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %5, align 4, !tbaa !5
  br label %24, !llvm.loop !9

60:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %123, %60
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = icmp slt i32 %62, 256
  br i1 %63, label %65, label %64

64:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %126

65:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [65546 x i32], ptr @f, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = load i32, ptr %4, align 4, !tbaa !5
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = call noundef i32 @_Z3optjj(i32 noundef %70, i32 noundef %71)
  %73 = add i32 %69, %72
  store i32 %73, ptr %7, align 4, !tbaa !5
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %75
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [256 x i32], ptr %76, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = icmp eq i32 %80, -1
  br i1 %81, label %95, label %82

82:                                               ; preds = %65
  %83 = load i32, ptr %3, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %84
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [256 x i32], ptr %85, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [16779786 x i32], ptr @val, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = icmp ult i32 %92, %93
  br i1 %94, label %95, label %122

95:                                               ; preds = %82, %65
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = load i32, ptr @tot, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [16779786 x i32], ptr @val, i64 0, i64 %98
  store i32 %96, ptr %99, align 4, !tbaa !5
  %100 = load i32, ptr %2, align 4, !tbaa !5
  %101 = load i32, ptr @tot, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [16779786 x i32], ptr @pos, i64 0, i64 %102
  store i32 %100, ptr %103, align 4, !tbaa !5
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %105
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [256 x i32], ptr %106, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = load i32, ptr @tot, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [16779786 x i32], ptr @pre, i64 0, i64 %112
  store i32 %110, ptr %113, align 4, !tbaa !5
  %114 = load i32, ptr @tot, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr @tot, align 4, !tbaa !5
  %116 = load i32, ptr %3, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %117
  %119 = load i32, ptr %6, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [256 x i32], ptr %118, i64 0, i64 %120
  store i32 %114, ptr %121, align 4, !tbaa !5
  br label %122

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

123:                                              ; preds = %122
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %6, align 4, !tbaa !5
  br label %61, !llvm.loop !11

126:                                              ; preds = %64
  %127 = load i32, ptr %2, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [65546 x i32], ptr @w, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = load i32, ptr %2, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [65546 x i32], ptr @f, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = add i32 %134, %130
  store i32 %135, ptr %133, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %136 = load i32, ptr %2, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [65546 x %"class.std::vector"], ptr @e, i64 0, i64 %137
  %139 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %138) #4
  %140 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %139, ptr %140, align 8
  br label %141

141:                                              ; preds = %152, %126
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %142 = load i32, ptr %2, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [65546 x %"class.std::vector"], ptr @e, i64 0, i64 %143
  %145 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %144) #4
  %146 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %145, ptr %146, align 8
  %147 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br i1 %147, label %149, label %148

148:                                              ; preds = %141
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %154

149:                                              ; preds = %141
  %150 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  %151 = load i32, ptr %150, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef %151)
  br label %152

152:                                              ; preds = %149
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  br label %141, !llvm.loop !12

154:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %190, %154
  %156 = load i32, ptr %10, align 4, !tbaa !5
  %157 = icmp slt i32 %156, 256
  br i1 %157, label %159, label %158

158:                                              ; preds = %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %193

159:                                              ; preds = %155
  %160 = load i32, ptr %3, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %161
  %163 = load i32, ptr %10, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [256 x i32], ptr %162, i64 0, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [16779786 x i32], ptr @pos, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = load i32, ptr %2, align 4, !tbaa !5
  %171 = icmp eq i32 %169, %170
  br i1 %171, label %172, label %189

172:                                              ; preds = %159
  %173 = load i32, ptr %3, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %174
  %176 = load i32, ptr %10, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [256 x i32], ptr %175, i64 0, i64 %177
  %179 = load i32, ptr %178, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [16779786 x i32], ptr @pre, i64 0, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !5
  %183 = load i32, ptr %3, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %184
  %186 = load i32, ptr %10, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [256 x i32], ptr %185, i64 0, i64 %187
  store i32 %182, ptr %188, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %172, %159
  br label %190

190:                                              ; preds = %189
  %191 = load i32, ptr %10, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %10, align 4, !tbaa !5
  br label %155, !llvm.loop !13

193:                                              ; preds = %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret void
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3optjj(i32 noundef, i32 noundef) #2

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

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

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

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

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

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

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


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

@tot = external dso_local local_unnamed_addr global i32, align 4
@idx = external dso_local local_unnamed_addr global [256 x [256 x i32]], align 16
@pos = external dso_local local_unnamed_addr global [16779786 x i32], align 16
@pre = external dso_local local_unnamed_addr global [16779786 x i32], align 16
@w = external dso_local local_unnamed_addr global [65546 x i32], align 16
@val = external dso_local local_unnamed_addr global [16779786 x i32], align 16
@f = external dso_local global [65546 x i32], align 16
@e = external dso_local global [65546 x %"class.std::vector"], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z3dfsi(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = sext i32 %0 to i64
  %5 = getelementptr inbounds [65546 x i32], ptr @w, i64 0, i64 %4
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = ashr i32 %6, 8
  %8 = and i32 %6, 255
  %9 = getelementptr inbounds [65546 x i32], ptr @f, i64 0, i64 %4
  store i32 0, ptr %9, align 4, !tbaa !5
  %10 = zext nneg i32 %8 to i64
  br label %12

.preheader:                                       ; preds = %23
  %11 = sext i32 %7 to i64
  br label %32

12:                                               ; preds = %1, %23
  %indvars.iv = phi i64 [ 0, %1 ], [ %indvars.iv.next, %23 ]
  %13 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %indvars.iv, i64 %10
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %.not = icmp eq i32 %14, -1
  br i1 %.not, label %23, label %15

15:                                               ; preds = %12
  %16 = sext i32 %14 to i64
  %17 = getelementptr inbounds [16779786 x i32], ptr @val, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = trunc nuw nsw i64 %indvars.iv to i32
  %20 = tail call noundef i32 @_Z3optjj(i32 noundef %7, i32 noundef %19)
  %21 = shl i32 %20, 8
  %22 = add i32 %21, %18
  tail call void @_Z3updRjj(ptr noundef nonnull align 4 dereferenceable(4) %9, i32 noundef %22)
  br label %23

23:                                               ; preds = %12, %15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 256
  br i1 %exitcond.not, label %.preheader, label %12, !llvm.loop !9

24:                                               ; preds = %52
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = load i32, ptr %9, align 4, !tbaa !5
  %27 = add i32 %26, %25
  store i32 %27, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %28 = getelementptr inbounds [65546 x %"class.std::vector"], ptr @e, i64 0, i64 %4
  %29 = tail call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #3
  store ptr %29, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %30 = tail call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #3
  store ptr %30, ptr %3, align 8
  %31 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br i1 %31, label %.lr.ph, label %._crit_edge

32:                                               ; preds = %.preheader, %52
  %indvars.iv49 = phi i64 [ 0, %.preheader ], [ %indvars.iv.next50, %52 ]
  %33 = load i32, ptr %9, align 4, !tbaa !5
  %34 = trunc nuw nsw i64 %indvars.iv49 to i32
  %35 = tail call noundef i32 @_Z3optjj(i32 noundef %8, i32 noundef %34)
  %36 = add i32 %35, %33
  %37 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %11, i64 %indvars.iv49
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp eq i32 %38, -1
  br i1 %39, label %45, label %40

40:                                               ; preds = %32
  %41 = sext i32 %38 to i64
  %42 = getelementptr inbounds [16779786 x i32], ptr @val, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = icmp ult i32 %43, %36
  br i1 %44, label %45, label %52

45:                                               ; preds = %40, %32
  %46 = load i32, ptr @tot, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [16779786 x i32], ptr @val, i64 0, i64 %47
  store i32 %36, ptr %48, align 4, !tbaa !5
  %49 = getelementptr inbounds [16779786 x i32], ptr @pos, i64 0, i64 %47
  store i32 %0, ptr %49, align 4, !tbaa !5
  %50 = getelementptr inbounds [16779786 x i32], ptr @pre, i64 0, i64 %47
  store i32 %38, ptr %50, align 4, !tbaa !5
  %51 = add nsw i32 %46, 1
  store i32 %51, ptr @tot, align 4, !tbaa !5
  store i32 %46, ptr %37, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %45, %40
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond52.not = icmp eq i64 %indvars.iv.next50, 256
  br i1 %exitcond52.not, label %24, label %32, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  br label %59

.lr.ph:                                           ; preds = %24, %.lr.ph
  %53 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  %54 = load i32, ptr %53, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef %54)
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %56 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #3
  store ptr %56, ptr %3, align 8
  %57 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br i1 %57, label %.lr.ph, label %._crit_edge, !llvm.loop !12

58:                                               ; preds = %79
  ret void

59:                                               ; preds = %79, %._crit_edge
  %indvars.iv53 = phi i64 [ 0, %._crit_edge ], [ %indvars.iv.next54.1, %79 ]
  %60 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %11, i64 %indvars.iv53
  %61 = load i32, ptr %60, align 8, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [16779786 x i32], ptr @pos, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = icmp eq i32 %64, %0
  br i1 %65, label %66, label %69

66:                                               ; preds = %59
  %67 = getelementptr inbounds [16779786 x i32], ptr @pre, i64 0, i64 %62
  %68 = load i32, ptr %67, align 4, !tbaa !5
  store i32 %68, ptr %60, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %59, %66
  %indvars.iv.next54 = or disjoint i64 %indvars.iv53, 1
  %70 = getelementptr inbounds [256 x [256 x i32]], ptr @idx, i64 0, i64 %11, i64 %indvars.iv.next54
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [16779786 x i32], ptr @pos, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp eq i32 %74, %0
  br i1 %75, label %76, label %79

76:                                               ; preds = %69
  %77 = getelementptr inbounds [16779786 x i32], ptr @pre, i64 0, i64 %72
  %78 = load i32, ptr %77, align 4, !tbaa !5
  store i32 %78, ptr %70, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %76, %69
  %indvars.iv.next54.1 = add nuw nsw i64 %indvars.iv53, 2
  %exitcond56.not.1 = icmp eq i64 %indvars.iv.next54.1, 256
  br i1 %exitcond56.not.1, label %58, label %59, !llvm.loop !13
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3optjj(i32 noundef, i32 noundef) local_unnamed_addr #2

; 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 nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(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_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(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 = { 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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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