; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (1180)

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

%struct.node = type { i32, i32, i32 }
%"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
@map = external dso_local global [200 x [200 x i8]], align 16
@mark = external dso_local global [200 x [200 x i32]], align 16
@st = external dso_local global %struct.node, align 4
@ed = external dso_local global %struct.node, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

; Function Attrs: mustprogress 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
  br label %7

7:                                                ; preds = %102, %0
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr %9, i64 %12
  %14 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %13)
  br i1 %14, label %15, label %21

15:                                               ; preds = %7
  %16 = load i32, ptr @n, align 4, !tbaa !8
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %21

18:                                               ; preds = %15
  %19 = load i32, ptr @m, align 4, !tbaa !8
  %20 = icmp ne i32 %19, 0
  br label %21

21:                                               ; preds = %18, %15, %7
  %22 = phi i1 [ false, %15 ], [ false, %7 ], [ %20, %18 ]
  br i1 %22, label %23, label %103

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %24

24:                                               ; preds = %44, %23
  %25 = load i32, ptr %2, align 4, !tbaa !8
  %26 = icmp slt i32 %25, 100
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %47

28:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !8
  br label %29

29:                                               ; preds = %40, %28
  %30 = load i32, ptr %4, align 4, !tbaa !8
  %31 = icmp slt i32 %30, 100
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  store i32 7, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %43

33:                                               ; preds = %29
  %34 = load i32, ptr %2, align 4, !tbaa !8
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %35
  %37 = load i32, ptr %4, align 4, !tbaa !8
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [200 x i32], ptr %36, i64 0, i64 %38
  store i32 1000000, ptr %39, align 4, !tbaa !8
  br label %40

40:                                               ; preds = %33
  %41 = load i32, ptr %4, align 4, !tbaa !8
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %4, align 4, !tbaa !8
  br label %29, !llvm.loop !11

43:                                               ; preds = %32
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %2, align 4, !tbaa !8
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %2, align 4, !tbaa !8
  br label %24, !llvm.loop !13

47:                                               ; preds = %27
  %48 = call i32 @getchar()
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !8
  br label %49

49:                                               ; preds = %99, %47
  %50 = load i32, ptr %5, align 4, !tbaa !8
  %51 = load i32, ptr @n, align 4, !tbaa !8
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %102

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

55:                                               ; preds = %94, %54
  %56 = load i32, ptr %6, align 4, !tbaa !8
  %57 = load i32, ptr @m, align 4, !tbaa !8
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %60, label %59

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

60:                                               ; preds = %55
  %61 = load i32, ptr %5, align 4, !tbaa !8
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [200 x [200 x i8]], ptr @map, i64 0, i64 %62
  %64 = load i32, ptr %6, align 4, !tbaa !8
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [200 x i8], ptr %63, i64 0, i64 %65
  %67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %66)
  %68 = load i32, ptr %5, align 4, !tbaa !8
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [200 x [200 x i8]], ptr @map, i64 0, i64 %69
  %71 = load i32, ptr %6, align 4, !tbaa !8
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [200 x i8], ptr %70, i64 0, i64 %72
  %74 = load i8, ptr %73, align 1, !tbaa !14
  %75 = sext i8 %74 to i32
  %76 = icmp eq i32 %75, 83
  br i1 %76, label %77, label %80

77:                                               ; preds = %60
  %78 = load i32, ptr %5, align 4, !tbaa !8
  store i32 %78, ptr @st, align 4, !tbaa !15
  %79 = load i32, ptr %6, align 4, !tbaa !8
  store i32 %79, ptr getelementptr inbounds (%struct.node, ptr @st, i32 0, i32 1), align 4, !tbaa !17
  br label %80

80:                                               ; preds = %77, %60
  %81 = load i32, ptr %5, align 4, !tbaa !8
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [200 x [200 x i8]], ptr @map, i64 0, i64 %82
  %84 = load i32, ptr %6, align 4, !tbaa !8
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [200 x i8], ptr %83, i64 0, i64 %85
  %87 = load i8, ptr %86, align 1, !tbaa !14
  %88 = sext i8 %87 to i32
  %89 = icmp eq i32 %88, 84
  br i1 %89, label %90, label %93

90:                                               ; preds = %80
  %91 = load i32, ptr %5, align 4, !tbaa !8
  store i32 %91, ptr @ed, align 4, !tbaa !15
  %92 = load i32, ptr %6, align 4, !tbaa !8
  store i32 %92, ptr getelementptr inbounds (%struct.node, ptr @ed, i32 0, i32 1), align 4, !tbaa !17
  br label %93

93:                                               ; preds = %90, %80
  br label %94

94:                                               ; preds = %93
  %95 = load i32, ptr %6, align 4, !tbaa !8
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %6, align 4, !tbaa !8
  br label %55, !llvm.loop !18

97:                                               ; preds = %59
  %98 = call i32 @getchar()
  br label %99

99:                                               ; preds = %97
  %100 = load i32, ptr %5, align 4, !tbaa !8
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %5, align 4, !tbaa !8
  br label %49, !llvm.loop !19

102:                                              ; preds = %53
  store i32 0, ptr getelementptr inbounds (%struct.node, ptr @st, i32 0, i32 2), align 4, !tbaa !20
  call void @_Z3bfsv()
  br label %7, !llvm.loop !21

103:                                              ; preds = %21
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @getchar() #4

declare i32 @__isoc99_scanf(ptr noundef, ...) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!10, !10, i64 0}
!15 = !{!16, !9, i64 0}
!16 = !{!"_ZTS4node", !9, i64 0, !9, i64 4, !9, i64 8}
!17 = !{!16, !9, i64 4}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = !{!16, !9, i64 8}
!21 = distinct !{!21, !12}


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

%struct.node = type { i32, i32, i32 }
%"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
@map = external dso_local global [200 x [200 x i8]], align 16
@mark = external dso_local local_unnamed_addr global [200 x [200 x i32]], align 16
@st = external dso_local local_unnamed_addr global %struct.node, align 4
@ed = external dso_local local_unnamed_addr global %struct.node, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  br label %1

1:                                                ; preds = %._crit_edge32, %0
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr i8, ptr %4, i64 -24
  %6 = load i64, ptr %5, align 8
  %7 = getelementptr inbounds i8, ptr %3, i64 %6
  %8 = tail call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %7)
  %9 = load i32, ptr @n, align 4
  %10 = icmp ne i32 %9, 0
  %or.cond = select i1 %8, i1 %10, i1 false
  %11 = load i32, ptr @m, align 4
  %12 = icmp ne i32 %11, 0
  %or.cond3 = select i1 %or.cond, i1 %12, i1 false
  br i1 %or.cond3, label %vector.ph, label %.critedge

vector.ph:                                        ; preds = %1, %vector.ph
  %indvars.iv34 = phi i64 [ %indvars.iv.next35, %vector.ph ], [ 0, %1 ]
  %13 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 0
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %13, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %14, align 16, !tbaa !8
  %15 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 8
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %15, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %16, align 16, !tbaa !8
  %17 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 16
  %18 = getelementptr inbounds i8, ptr %17, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %17, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %18, align 16, !tbaa !8
  %19 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 24
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %19, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %20, align 16, !tbaa !8
  %21 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 32
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %21, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %22, align 16, !tbaa !8
  %23 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 40
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %23, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %24, align 16, !tbaa !8
  %25 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 48
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %25, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %26, align 16, !tbaa !8
  %27 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 56
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %27, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %28, align 16, !tbaa !8
  %29 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 64
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %29, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %30, align 16, !tbaa !8
  %31 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 72
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %31, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %32, align 16, !tbaa !8
  %33 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 80
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %33, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %34, align 16, !tbaa !8
  %35 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 88
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %35, align 16, !tbaa !8
  store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %36, align 16, !tbaa !8
  %37 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 96
  store i32 1000000, ptr %37, align 16, !tbaa !8
  %38 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 97
  store i32 1000000, ptr %38, align 4, !tbaa !8
  %39 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 98
  store i32 1000000, ptr %39, align 8, !tbaa !8
  %40 = getelementptr inbounds [200 x [200 x i32]], ptr @mark, i64 0, i64 %indvars.iv34, i64 99
  store i32 1000000, ptr %40, align 4, !tbaa !8
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %exitcond37.not = icmp eq i64 %indvars.iv.next35, 100
  br i1 %exitcond37.not, label %41, label %vector.ph, !llvm.loop !11

41:                                               ; preds = %vector.ph
  %42 = tail call i32 @getchar()
  %43 = load i32, ptr @n, align 4, !tbaa !8
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.preheader, label %._crit_edge32

.preheader:                                       ; preds = %41, %._crit_edge
  %indvars.iv41 = phi i64 [ %indvars.iv.next42, %._crit_edge ], [ 0, %41 ]
  %45 = load i32, ptr @m, align 4, !tbaa !8
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %47 = trunc nuw nsw i64 %indvars.iv41 to i32
  %48 = trunc nuw nsw i64 %indvars.iv41 to i32
  br label %53

._crit_edge32:                                    ; preds = %._crit_edge, %41
  store i32 0, ptr getelementptr inbounds (i8, ptr @st, i64 8), align 4, !tbaa !13
  tail call void @_Z3bfsv()
  br label %1, !llvm.loop !15

._crit_edge:                                      ; preds = %59, %.preheader
  %49 = tail call i32 @getchar()
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %50 = load i32, ptr @n, align 4, !tbaa !8
  %51 = sext i32 %50 to i64
  %52 = icmp slt i64 %indvars.iv.next42, %51
  br i1 %52, label %.preheader, label %._crit_edge32, !llvm.loop !16

53:                                               ; preds = %.lr.ph, %59
  %indvars.iv38 = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next39, %59 ]
  %54 = getelementptr inbounds [200 x [200 x i8]], ptr @map, i64 0, i64 %indvars.iv41, i64 %indvars.iv38
  %55 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %54)
  %56 = load i8, ptr %54, align 1, !tbaa !17
  switch i8 %56, label %59 [
    i8 83, label %.thread
    i8 84, label %57
  ]

.thread:                                          ; preds = %53
  store i32 %48, ptr @st, align 4, !tbaa !18
  br label %.sink.split

57:                                               ; preds = %53
  store i32 %47, ptr @ed, align 4, !tbaa !18
  br label %.sink.split

.sink.split:                                      ; preds = %57, %.thread
  %.sink44 = phi ptr [ getelementptr inbounds (i8, ptr @st, i64 4), %.thread ], [ getelementptr inbounds (i8, ptr @ed, i64 4), %57 ]
  %58 = trunc nuw nsw i64 %indvars.iv38 to i32
  store i32 %58, ptr %.sink44, align 4, !tbaa !19
  br label %59

59:                                               ; preds = %.sink.split, %53
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %60 = load i32, ptr @m, align 4, !tbaa !8
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next39, %61
  br i1 %62, label %53, label %._crit_edge, !llvm.loop !20

.critedge:                                        ; preds = %1
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @getchar() local_unnamed_addr #3

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

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 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nofree 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 = { 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" }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !9, i64 8}
!14 = !{!"_ZTS4node", !9, i64 0, !9, i64 4, !9, i64 8}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = !{!10, !10, i64 0}
!18 = !{!14, !9, i64 0}
!19 = !{!14, !9, i64 4}
!20 = distinct !{!20, !12}


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