; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 6/1552. Brainfuck.ll (Z5vosstiiii)

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

@ans = external dso_local global [53 x [53 x [53 x [53 x i32]]]], align 16
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@n = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4maxiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4gposii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5gdistic(i32 noundef, i8 noundef signext) #0

; 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: mustprogress uwtable
declare dso_local noundef i32 @_Z2dpiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8move_posii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8move_ptrii(i32 noundef, i32 noundef) #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5vosstiiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #0 {
  %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !5
  call void @_Z3putv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = load i32, ptr %6, align 4, !tbaa !5
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = load i32, ptr %8, align 4, !tbaa !5
  %21 = call noundef i32 @_Z4maxiiiii(i32 noundef %17, i32 noundef %18, i32 noundef %19, i32 noundef %20)
  store i32 %21, ptr %9, align 4, !tbaa !5
  %22 = load i32, ptr %9, align 4, !tbaa !5
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = icmp eq i32 %22, %23
  br i1 %24, label %25, label %26

25:                                               ; preds = %4
  store i32 1, ptr %10, align 4
  br label %173

26:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 0, ptr %11, align 4, !tbaa !5
  %27 = load i32, ptr %9, align 4, !tbaa !5
  %28 = load i32, ptr %6, align 4, !tbaa !5
  %29 = icmp eq i32 %27, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %30, %26
  %32 = load i32, ptr %9, align 4, !tbaa !5
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = icmp eq i32 %32, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %31
  store i32 2, ptr %11, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %35, %31
  %37 = load i32, ptr %9, align 4, !tbaa !5
  %38 = load i32, ptr %8, align 4, !tbaa !5
  %39 = icmp eq i32 %37, %38
  br i1 %39, label %40, label %41

40:                                               ; preds = %36
  store i32 3, ptr %11, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %40, %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %42 = load i32, ptr %11, align 4, !tbaa !5
  %43 = call noundef i32 @_Z4gposii(i32 noundef %42, i32 noundef 0)
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = load i32, ptr %9, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %46)
  %48 = load i8, ptr %47, align 1, !tbaa !9
  %49 = call noundef i32 @_Z5gdistic(i32 noundef %44, i8 noundef signext %48)
  %50 = add nsw i32 %43, %49
  %51 = add nsw i32 %50, 1
  %52 = load i32, ptr %9, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  %54 = load i32, ptr %6, align 4, !tbaa !5
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = load i32, ptr %8, align 4, !tbaa !5
  %57 = call noundef i32 @_Z2dpiiii(i32 noundef %53, i32 noundef %54, i32 noundef %55, i32 noundef %56)
  %58 = add nsw i32 %51, %57
  store i32 %58, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %59 = load i32, ptr %11, align 4, !tbaa !5
  %60 = call noundef i32 @_Z4gposii(i32 noundef %59, i32 noundef 1)
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %63)
  %65 = load i8, ptr %64, align 1, !tbaa !9
  %66 = call noundef i32 @_Z5gdistic(i32 noundef %61, i8 noundef signext %65)
  %67 = add nsw i32 %60, %66
  %68 = add nsw i32 %67, 1
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = load i32, ptr %9, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = call noundef i32 @_Z2dpiiii(i32 noundef %69, i32 noundef %71, i32 noundef %72, i32 noundef %73)
  %75 = add nsw i32 %68, %74
  store i32 %75, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %76 = load i32, ptr %11, align 4, !tbaa !5
  %77 = call noundef i32 @_Z4gposii(i32 noundef %76, i32 noundef 2)
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = load i32, ptr %9, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %80)
  %82 = load i8, ptr %81, align 1, !tbaa !9
  %83 = call noundef i32 @_Z5gdistic(i32 noundef %78, i8 noundef signext %82)
  %84 = add nsw i32 %77, %83
  %85 = add nsw i32 %84, 1
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = call noundef i32 @_Z2dpiiii(i32 noundef %86, i32 noundef %87, i32 noundef %89, i32 noundef %90)
  %92 = add nsw i32 %85, %91
  store i32 %92, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %93 = load i32, ptr %11, align 4, !tbaa !5
  %94 = call noundef i32 @_Z4gposii(i32 noundef %93, i32 noundef 3)
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %97)
  %99 = load i8, ptr %98, align 1, !tbaa !9
  %100 = call noundef i32 @_Z5gdistic(i32 noundef %95, i8 noundef signext %99)
  %101 = add nsw i32 %94, %100
  %102 = add nsw i32 %101, 1
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = load i32, ptr %9, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  %108 = call noundef i32 @_Z2dpiiii(i32 noundef %103, i32 noundef %104, i32 noundef %105, i32 noundef %107)
  %109 = add nsw i32 %102, %108
  store i32 %109, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %110 = load i32, ptr %5, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [53 x [53 x [53 x [53 x i32]]]], ptr @ans, i64 0, i64 %111
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [53 x [53 x [53 x i32]]], ptr %112, i64 0, i64 %114
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [53 x [53 x i32]], ptr %115, i64 0, i64 %117
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [53 x i32], ptr %118, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  store i32 %122, ptr %16, align 4, !tbaa !5
  %123 = load i32, ptr %16, align 4, !tbaa !5
  %124 = load i32, ptr %12, align 4, !tbaa !5
  %125 = icmp eq i32 %123, %124
  br i1 %125, label %126, label %135

126:                                              ; preds = %41
  %127 = load i32, ptr %11, align 4, !tbaa !5
  call void @_Z8move_posii(i32 noundef %127, i32 noundef 0)
  %128 = load i32, ptr %5, align 4, !tbaa !5
  %129 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z8move_ptrii(i32 noundef %128, i32 noundef %129)
  %130 = load i32, ptr %9, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  %132 = load i32, ptr %6, align 4, !tbaa !5
  %133 = load i32, ptr %7, align 4, !tbaa !5
  %134 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z5vosstiiii(i32 noundef %131, i32 noundef %132, i32 noundef %133, i32 noundef %134)
  br label %172

135:                                              ; preds = %41
  %136 = load i32, ptr %16, align 4, !tbaa !5
  %137 = load i32, ptr %13, align 4, !tbaa !5
  %138 = icmp eq i32 %136, %137
  br i1 %138, label %139, label %148

139:                                              ; preds = %135
  %140 = load i32, ptr %11, align 4, !tbaa !5
  call void @_Z8move_posii(i32 noundef %140, i32 noundef 1)
  %141 = load i32, ptr %6, align 4, !tbaa !5
  %142 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z8move_ptrii(i32 noundef %141, i32 noundef %142)
  %143 = load i32, ptr %5, align 4, !tbaa !5
  %144 = load i32, ptr %9, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  %146 = load i32, ptr %7, align 4, !tbaa !5
  %147 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z5vosstiiii(i32 noundef %143, i32 noundef %145, i32 noundef %146, i32 noundef %147)
  br label %171

148:                                              ; preds = %135
  %149 = load i32, ptr %16, align 4, !tbaa !5
  %150 = load i32, ptr %14, align 4, !tbaa !5
  %151 = icmp eq i32 %149, %150
  br i1 %151, label %152, label %161

152:                                              ; preds = %148
  %153 = load i32, ptr %11, align 4, !tbaa !5
  call void @_Z8move_posii(i32 noundef %153, i32 noundef 2)
  %154 = load i32, ptr %7, align 4, !tbaa !5
  %155 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z8move_ptrii(i32 noundef %154, i32 noundef %155)
  %156 = load i32, ptr %5, align 4, !tbaa !5
  %157 = load i32, ptr %6, align 4, !tbaa !5
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  %160 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z5vosstiiii(i32 noundef %156, i32 noundef %157, i32 noundef %159, i32 noundef %160)
  br label %170

161:                                              ; preds = %148
  %162 = load i32, ptr %11, align 4, !tbaa !5
  call void @_Z8move_posii(i32 noundef %162, i32 noundef 3)
  %163 = load i32, ptr %8, align 4, !tbaa !5
  %164 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z8move_ptrii(i32 noundef %163, i32 noundef %164)
  %165 = load i32, ptr %5, align 4, !tbaa !5
  %166 = load i32, ptr %6, align 4, !tbaa !5
  %167 = load i32, ptr %7, align 4, !tbaa !5
  %168 = load i32, ptr %9, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  call void @_Z5vosstiiii(i32 noundef %165, i32 noundef %166, i32 noundef %167, i32 noundef %169)
  br label %170

170:                                              ; preds = %161, %152
  br label %171

171:                                              ; preds = %170, %139
  br label %172

172:                                              ; preds = %171, %126
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  store i32 0, ptr %10, align 4
  br label %173

173:                                              ; preds = %172, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  %174 = load i32, ptr %10, align 4
  switch i32 %174, label %176 [
    i32 0, label %175
    i32 1, label %175
  ]

175:                                              ; preds = %173, %173
  ret void

176:                                              ; preds = %173
  unreachable
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!7, !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] }

@ans = external dso_local local_unnamed_addr global [53 x [53 x [53 x [53 x i32]]]], align 16
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@n = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4maxiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4gposii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5gdistic(i32 noundef, i8 noundef signext) local_unnamed_addr #0

; 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: mustprogress uwtable
declare dso_local noundef i32 @_Z2dpiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8move_posii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8move_ptrii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5vosstiiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  tail call void @_Z3putv()
  %5 = tail call noundef i32 @_Z4maxiiiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp eq i32 %5, %6
  br i1 %7, label %tailrecurse.outer87._crit_edge, label %.lr.ph.lr.ph.lr.ph

.lr.ph.lr.ph.lr.ph:                               ; preds = %4, %tailrecurse.outer
  %8 = phi i32 [ %51, %tailrecurse.outer ], [ %5, %4 ]
  %.tr82.ph113 = phi i32 [ %.tr82104, %tailrecurse.outer ], [ %3, %4 ]
  %.tr81.ph112 = phi i32 [ %.tr81.ph88105, %tailrecurse.outer ], [ %2, %4 ]
  %.tr80.ph111 = phi i32 [ %.tr80.ph84107, %tailrecurse.outer ], [ %1, %4 ]
  %.tr.ph110 = phi i32 [ %24, %tailrecurse.outer ], [ %0, %4 ]
  %9 = sext i32 %.tr.ph110 to i64
  br label %.lr.ph.lr.ph

.lr.ph.lr.ph:                                     ; preds = %.lr.ph.lr.ph.lr.ph, %tailrecurse.outer83
  %10 = phi i32 [ %8, %.lr.ph.lr.ph.lr.ph ], [ %59, %tailrecurse.outer83 ]
  %.tr82.ph86109 = phi i32 [ %.tr82.ph113, %.lr.ph.lr.ph.lr.ph ], [ %.tr82104, %tailrecurse.outer83 ]
  %.tr81.ph85108 = phi i32 [ %.tr81.ph112, %.lr.ph.lr.ph.lr.ph ], [ %.tr81.ph88105, %tailrecurse.outer83 ]
  %.tr80.ph84107 = phi i32 [ %.tr80.ph111, %.lr.ph.lr.ph.lr.ph ], [ %24, %tailrecurse.outer83 ]
  %11 = sext i32 %.tr80.ph84107 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.lr.ph, %tailrecurse.outer87
  %12 = phi i32 [ %10, %.lr.ph.lr.ph ], [ %64, %tailrecurse.outer87 ]
  %.tr82.ph89106 = phi i32 [ %.tr82.ph86109, %.lr.ph.lr.ph ], [ %.tr82104, %tailrecurse.outer87 ]
  %.tr81.ph88105 = phi i32 [ %.tr81.ph85108, %.lr.ph.lr.ph ], [ %24, %tailrecurse.outer87 ]
  %13 = sext i32 %.tr81.ph88105 to i64
  br label %14

14:                                               ; preds = %.lr.ph, %tailrecurse
  %15 = phi i32 [ %12, %.lr.ph ], [ %67, %tailrecurse ]
  %.tr82104 = phi i32 [ %.tr82.ph89106, %.lr.ph ], [ %24, %tailrecurse ]
  %16 = icmp eq i32 %15, %.tr80.ph84107
  %spec.store.select = zext i1 %16 to i32
  %17 = icmp eq i32 %15, %.tr81.ph88105
  %spec.store.select1 = select i1 %17, i32 2, i32 %spec.store.select
  %18 = icmp eq i32 %15, %.tr82104
  %spec.store.select2 = select i1 %18, i32 3, i32 %spec.store.select1
  %19 = tail call noundef i32 @_Z4gposii(i32 noundef %spec.store.select2, i32 noundef 0)
  %20 = sext i32 %15 to i64
  %21 = tail 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 !9
  %23 = tail call noundef i32 @_Z5gdistic(i32 noundef %.tr.ph110, i8 noundef signext %22)
  %24 = add nsw i32 %15, 1
  %25 = tail call noundef i32 @_Z2dpiiii(i32 noundef %24, i32 noundef %.tr80.ph84107, i32 noundef %.tr81.ph88105, i32 noundef %.tr82104)
  %26 = add i32 %19, 1
  %27 = add i32 %26, %23
  %28 = add nsw i32 %27, %25
  %29 = tail call noundef i32 @_Z4gposii(i32 noundef %spec.store.select2, i32 noundef 1)
  %30 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %20)
  %31 = load i8, ptr %30, align 1, !tbaa !9
  %32 = tail call noundef i32 @_Z5gdistic(i32 noundef %.tr80.ph84107, i8 noundef signext %31)
  %33 = tail call noundef i32 @_Z2dpiiii(i32 noundef %.tr.ph110, i32 noundef %24, i32 noundef %.tr81.ph88105, i32 noundef %.tr82104)
  %34 = tail call noundef i32 @_Z4gposii(i32 noundef %spec.store.select2, i32 noundef 2)
  %35 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %20)
  %36 = load i8, ptr %35, align 1, !tbaa !9
  %37 = tail call noundef i32 @_Z5gdistic(i32 noundef %.tr81.ph88105, i8 noundef signext %36)
  %38 = tail call noundef i32 @_Z2dpiiii(i32 noundef %.tr.ph110, i32 noundef %.tr80.ph84107, i32 noundef %24, i32 noundef %.tr82104)
  %39 = add i32 %34, 1
  %40 = add i32 %39, %37
  %41 = add nsw i32 %40, %38
  %42 = tail call noundef i32 @_Z4gposii(i32 noundef %spec.store.select2, i32 noundef 3)
  %43 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %20)
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = tail call noundef i32 @_Z5gdistic(i32 noundef %.tr82104, i8 noundef signext %44)
  %46 = tail call noundef i32 @_Z2dpiiii(i32 noundef %.tr.ph110, i32 noundef %.tr80.ph84107, i32 noundef %.tr81.ph88105, i32 noundef %24)
  %47 = sext i32 %.tr82104 to i64
  %48 = getelementptr inbounds [53 x [53 x [53 x [53 x i32]]]], ptr @ans, i64 0, i64 %9, i64 %11, i64 %13, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = icmp eq i32 %49, %28
  br i1 %50, label %tailrecurse.outer, label %54

tailrecurse.outer:                                ; preds = %14
  tail call void @_Z8move_posii(i32 noundef %spec.store.select2, i32 noundef 0)
  tail call void @_Z8move_ptrii(i32 noundef %.tr.ph110, i32 noundef %15)
  tail call void @_Z3putv()
  %51 = tail call noundef i32 @_Z4maxiiiii(i32 noundef %24, i32 noundef %.tr80.ph84107, i32 noundef %.tr81.ph88105, i32 noundef %.tr82104)
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = icmp eq i32 %51, %52
  br i1 %53, label %tailrecurse.outer87._crit_edge, label %.lr.ph.lr.ph.lr.ph

54:                                               ; preds = %14
  %55 = add i32 %29, 1
  %56 = add i32 %55, %32
  %57 = add nsw i32 %56, %33
  %58 = icmp eq i32 %49, %57
  br i1 %58, label %tailrecurse.outer83, label %62

tailrecurse.outer83:                              ; preds = %54
  tail call void @_Z8move_posii(i32 noundef %spec.store.select2, i32 noundef 1)
  tail call void @_Z8move_ptrii(i32 noundef %.tr80.ph84107, i32 noundef %15)
  tail call void @_Z3putv()
  %59 = tail call noundef i32 @_Z4maxiiiii(i32 noundef %.tr.ph110, i32 noundef %24, i32 noundef %.tr81.ph88105, i32 noundef %.tr82104)
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = icmp eq i32 %59, %60
  br i1 %61, label %tailrecurse.outer87._crit_edge, label %.lr.ph.lr.ph

62:                                               ; preds = %54
  %63 = icmp eq i32 %49, %41
  br i1 %63, label %tailrecurse.outer87, label %tailrecurse

tailrecurse.outer87:                              ; preds = %62
  tail call void @_Z8move_posii(i32 noundef %spec.store.select2, i32 noundef 2)
  tail call void @_Z8move_ptrii(i32 noundef %.tr81.ph88105, i32 noundef %15)
  tail call void @_Z3putv()
  %64 = tail call noundef i32 @_Z4maxiiiii(i32 noundef %.tr.ph110, i32 noundef %.tr80.ph84107, i32 noundef %24, i32 noundef %.tr82104)
  %65 = load i32, ptr @n, align 4, !tbaa !5
  %66 = icmp eq i32 %64, %65
  br i1 %66, label %tailrecurse.outer87._crit_edge, label %.lr.ph

tailrecurse:                                      ; preds = %62
  tail call void @_Z8move_posii(i32 noundef %spec.store.select2, i32 noundef 3)
  tail call void @_Z8move_ptrii(i32 noundef %.tr82104, i32 noundef %15)
  tail call void @_Z3putv()
  %67 = tail call noundef i32 @_Z4maxiiiii(i32 noundef %.tr.ph110, i32 noundef %.tr80.ph84107, i32 noundef %.tr81.ph88105, i32 noundef %24)
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = icmp eq i32 %67, %68
  br i1 %69, label %tailrecurse.outer87._crit_edge, label %14

tailrecurse.outer87._crit_edge:                   ; preds = %tailrecurse.outer, %tailrecurse.outer83, %tailrecurse.outer87, %tailrecurse, %4
  ret void
}

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

!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}


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