; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/301 Division 2/Problem C (C)

; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@grid = external dso_local global [502 x [502 x i32]], align 16
@visited = external dso_local global [502 x [502 x i32]], align 16
@r1 = external dso_local global i32, align 4
@c1 = external dso_local global i32, align 4
@r2 = external dso_local global i32, align 4
@c2 = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %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
  store i32 0, ptr %1, align 4
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %41, %0
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp slt i32 %9, %10
  br i1 %11, label %13, label %12

12:                                               ; preds = %8
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %44

13:                                               ; preds = %8
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %37, %13
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = load i32, ptr @m, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %40

20:                                               ; preds = %15
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %22)
  %24 = load i8, ptr %23, align 1, !tbaa !9
  %25 = sext i8 %24 to i32
  %26 = icmp eq i32 %25, 88
  br i1 %26, label %27, label %36

27:                                               ; preds = %20
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [502 x [502 x i32]], ptr @grid, i64 0, i64 %30
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [502 x i32], ptr %31, i64 0, i64 %34
  store i32 1, ptr %35, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %27, %20
  br label %37

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

40:                                               ; preds = %19
  br label %41

41:                                               ; preds = %40
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %2, align 4, !tbaa !5
  br label %8, !llvm.loop !12

44:                                               ; preds = %12
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @r1, ptr noundef @c1)
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @r2, ptr noundef @c2)
  %47 = load i32, ptr @r1, align 4, !tbaa !5
  %48 = load i32, ptr @r2, align 4, !tbaa !5
  %49 = icmp eq i32 %47, %48
  br i1 %49, label %50, label %62

50:                                               ; preds = %44
  %51 = load i32, ptr @c1, align 4, !tbaa !5
  %52 = load i32, ptr @c2, align 4, !tbaa !5
  %53 = icmp eq i32 %51, %52
  br i1 %53, label %54, label %62

54:                                               ; preds = %50
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = icmp eq i32 %55, 1
  br i1 %56, label %57, label %62

57:                                               ; preds = %54
  %58 = load i32, ptr @m, align 4, !tbaa !5
  %59 = icmp eq i32 %58, 1
  br i1 %59, label %60, label %62

60:                                               ; preds = %57
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  br label %132

62:                                               ; preds = %57, %54, %50, %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %63 = load i32, ptr @r1, align 4, !tbaa !5
  store i32 %63, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %64 = load i32, ptr @c1, align 4, !tbaa !5
  store i32 %64, ptr %6, align 4, !tbaa !5
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = call noundef i32 @_Z8inrange2ii(i32 noundef %66, i32 noundef %67)
  %69 = icmp eq i32 %68, 1
  br i1 %69, label %70, label %80

70:                                               ; preds = %62
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = load i32, ptr %5, align 4, !tbaa !5
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = call noundef i32 @_Z3bfsiiii(i32 noundef %72, i32 noundef %73, i32 noundef %74, i32 noundef %75)
  %77 = icmp eq i32 %76, 1
  br i1 %77, label %78, label %80

78:                                               ; preds = %70
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %131

80:                                               ; preds = %70, %62
  call void @llvm.memset.p0.i64(ptr align 16 @visited, i8 0, i64 1008016, i1 false)
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = sub nsw i32 %81, 1
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = call noundef i32 @_Z8inrange2ii(i32 noundef %82, i32 noundef %83)
  %85 = icmp eq i32 %84, 1
  br i1 %85, label %86, label %96

86:                                               ; preds = %80
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = sub nsw i32 %87, 1
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = call noundef i32 @_Z3bfsiiii(i32 noundef %88, i32 noundef %89, i32 noundef %90, i32 noundef %91)
  %93 = icmp eq i32 %92, 1
  br i1 %93, label %94, label %96

94:                                               ; preds = %86
  %95 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %131

96:                                               ; preds = %86, %80
  call void @llvm.memset.p0.i64(ptr align 16 @visited, i8 0, i64 1008016, i1 false)
  %97 = load i32, ptr %5, align 4, !tbaa !5
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  %100 = call noundef i32 @_Z8inrange2ii(i32 noundef %97, i32 noundef %99)
  %101 = icmp eq i32 %100, 1
  br i1 %101, label %102, label %112

102:                                              ; preds = %96
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = call noundef i32 @_Z3bfsiiii(i32 noundef %103, i32 noundef %105, i32 noundef %106, i32 noundef %107)
  %109 = icmp eq i32 %108, 1
  br i1 %109, label %110, label %112

110:                                              ; preds = %102
  %111 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %131

112:                                              ; preds = %102, %96
  call void @llvm.memset.p0.i64(ptr align 16 @visited, i8 0, i64 1008016, i1 false)
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = load i32, ptr %6, align 4, !tbaa !5
  %115 = sub nsw i32 %114, 1
  %116 = call noundef i32 @_Z8inrange2ii(i32 noundef %113, i32 noundef %115)
  %117 = icmp eq i32 %116, 1
  br i1 %117, label %118, label %128

118:                                              ; preds = %112
  %119 = load i32, ptr %5, align 4, !tbaa !5
  %120 = load i32, ptr %6, align 4, !tbaa !5
  %121 = sub nsw i32 %120, 1
  %122 = load i32, ptr %5, align 4, !tbaa !5
  %123 = load i32, ptr %6, align 4, !tbaa !5
  %124 = call noundef i32 @_Z3bfsiiii(i32 noundef %119, i32 noundef %121, i32 noundef %122, i32 noundef %123)
  %125 = icmp eq i32 %124, 1
  br i1 %125, label %126, label %128

126:                                              ; preds = %118
  %127 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %131

128:                                              ; preds = %118, %112
  %129 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %130

130:                                              ; preds = %128
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %131

131:                                              ; preds = %130, %126, %110, %94, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %132

132:                                              ; preds = %131, %60
  %133 = load i32, ptr %1, align 4
  ret i32 %133
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4

declare i32 @printf(ptr noundef, ...) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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


; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@grid = external dso_local local_unnamed_addr global [502 x [502 x i32]], align 16
@visited = external dso_local local_unnamed_addr global [502 x [502 x i32]], align 16
@r1 = external dso_local global i32, align 4
@c1 = external dso_local global i32, align 4
@r2 = external dso_local global i32, align 4
@c2 = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph40, label %._crit_edge41

._crit_edge41:                                    ; preds = %._crit_edge, %0
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @r1, ptr noundef nonnull @c1)
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @r2, ptr noundef nonnull @c2)
  %6 = load i32, ptr @r1, align 4, !tbaa !5
  %7 = load i32, ptr @r2, align 4, !tbaa !5
  %8 = icmp eq i32 %6, %7
  %.pre = load i32, ptr @c1, align 4, !tbaa !5
  br i1 %8, label %25, label %32

.lr.ph40:                                         ; preds = %0, %._crit_edge
  %indvars.iv43 = phi i64 [ %12, %._crit_edge ], [ 0, %0 ]
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  %10 = load i32, ptr @m, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  %12 = add nuw nsw i64 %indvars.iv43, 1
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge46, %.lr.ph40
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %12, %14
  br i1 %15, label %.lr.ph40, label %._crit_edge41, !llvm.loop !9

.lr.ph:                                           ; preds = %.lr.ph40, %._crit_edge46
  %indvars.iv = phi i64 [ %19, %._crit_edge46 ], [ 0, %.lr.ph40 ]
  %16 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv)
  %17 = load i8, ptr %16, align 1, !tbaa !11
  %18 = icmp eq i8 %17, 88
  %19 = add nuw nsw i64 %indvars.iv, 1
  br i1 %18, label %20, label %._crit_edge46

20:                                               ; preds = %.lr.ph
  %21 = getelementptr inbounds [502 x [502 x i32]], ptr @grid, i64 0, i64 %12, i64 %19
  store i32 1, ptr %21, align 4, !tbaa !5
  br label %._crit_edge46

._crit_edge46:                                    ; preds = %.lr.ph, %20
  %22 = load i32, ptr @m, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = icmp slt i64 %19, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !12

25:                                               ; preds = %._crit_edge41
  %26 = load i32, ptr @c2, align 4, !tbaa !5
  %27 = icmp eq i32 %.pre, %26
  %28 = load i32, ptr @n, align 4
  %29 = icmp eq i32 %28, 1
  %or.cond = select i1 %27, i1 %29, i1 false
  %30 = load i32, ptr @m, align 4
  %31 = icmp eq i32 %30, 1
  %or.cond3 = select i1 %or.cond, i1 %31, i1 false
  br i1 %or.cond3, label %61, label %32

32:                                               ; preds = %25, %._crit_edge41
  %33 = add nsw i32 %6, 1
  %34 = tail call noundef i32 @_Z8inrange2ii(i32 noundef %33, i32 noundef %.pre)
  %35 = icmp eq i32 %34, 1
  br i1 %35, label %36, label %39

36:                                               ; preds = %32
  %37 = tail call noundef i32 @_Z3bfsiiii(i32 noundef %33, i32 noundef %.pre, i32 noundef %6, i32 noundef %.pre)
  %38 = icmp eq i32 %37, 1
  br i1 %38, label %61, label %39

39:                                               ; preds = %36, %32
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1008016) @visited, i8 0, i64 1008016, i1 false)
  %40 = add nsw i32 %6, -1
  %41 = tail call noundef i32 @_Z8inrange2ii(i32 noundef %40, i32 noundef %.pre)
  %42 = icmp eq i32 %41, 1
  br i1 %42, label %43, label %46

43:                                               ; preds = %39
  %44 = tail call noundef i32 @_Z3bfsiiii(i32 noundef %40, i32 noundef %.pre, i32 noundef %6, i32 noundef %.pre)
  %45 = icmp eq i32 %44, 1
  br i1 %45, label %61, label %46

46:                                               ; preds = %43, %39
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1008016) @visited, i8 0, i64 1008016, i1 false)
  %47 = add nsw i32 %.pre, 1
  %48 = tail call noundef i32 @_Z8inrange2ii(i32 noundef %6, i32 noundef %47)
  %49 = icmp eq i32 %48, 1
  br i1 %49, label %50, label %53

50:                                               ; preds = %46
  %51 = tail call noundef i32 @_Z3bfsiiii(i32 noundef %6, i32 noundef %47, i32 noundef %6, i32 noundef %.pre)
  %52 = icmp eq i32 %51, 1
  br i1 %52, label %61, label %53

53:                                               ; preds = %50, %46
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1008016) @visited, i8 0, i64 1008016, i1 false)
  %54 = add nsw i32 %.pre, -1
  %55 = tail call noundef i32 @_Z8inrange2ii(i32 noundef %6, i32 noundef %54)
  %56 = icmp eq i32 %55, 1
  br i1 %56, label %57, label %60

57:                                               ; preds = %53
  %58 = tail call noundef i32 @_Z3bfsiiii(i32 noundef %6, i32 noundef %54, i32 noundef %6, i32 noundef %.pre)
  %59 = icmp eq i32 %58, 1
  br i1 %59, label %61, label %60

60:                                               ; preds = %57, %53
  br label %61

61:                                               ; preds = %57, %50, %43, %36, %25, %60
  %.str.3.sink = phi ptr [ @.str.2, %60 ], [ @.str.2, %25 ], [ @.str.3, %36 ], [ @.str.3, %43 ], [ @.str.3, %50 ], [ @.str.3, %57 ]
  %62 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

; 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}


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