; LLVM IR from tangjz/acm-icpc :: usaco/Training/Chapter 2 Bigger challenges (ttwo)

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

@Fx = external dso_local global i32, align 4
@Fy = external dso_local global i32, align 4
@Fd = external dso_local global i32, align 4
@Cx = external dso_local global i32, align 4
@Cy = external dso_local global i32, align 4
@Cd = external dso_local global i32, align 4
@str = external dso_local global [10 x [11 x i8]], align 16
@vis = external dso_local global [400 x [400 x i8]], align 16
@.str = external hidden unnamed_addr constant [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6changeRiS_S_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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
  store i32 0, ptr %1, align 4
  %6 = load ptr, ptr @stdin, align 8, !tbaa !5
  %7 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %6)
  %8 = load ptr, ptr @stdout, align 8, !tbaa !5
  %9 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %8)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %56, %0
  %11 = load i32, ptr %2, align 4, !tbaa !9
  %12 = icmp slt i32 %11, 10
  br i1 %12, label %14, label %13

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

14:                                               ; preds = %10
  %15 = load i32, ptr %2, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %16
  %18 = getelementptr inbounds [11 x i8], ptr %17, i64 0, i64 0
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %18)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %52, %14
  %21 = load i32, ptr %4, align 4, !tbaa !9
  %22 = icmp slt i32 %21, 10
  br i1 %22, label %24, label %23

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

24:                                               ; preds = %20
  %25 = load i32, ptr %2, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %26
  %28 = load i32, ptr %4, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [11 x i8], ptr %27, i64 0, i64 %29
  %31 = load i8, ptr %30, align 1, !tbaa !11
  %32 = sext i8 %31 to i32
  %33 = icmp eq i32 %32, 70
  br i1 %33, label %34, label %37

34:                                               ; preds = %24
  %35 = load i32, ptr %2, align 4, !tbaa !9
  store i32 %35, ptr @Fx, align 4, !tbaa !9
  %36 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %36, ptr @Fy, align 4, !tbaa !9
  store i32 0, ptr @Fd, align 4, !tbaa !9
  br label %51

37:                                               ; preds = %24
  %38 = load i32, ptr %2, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %39
  %41 = load i32, ptr %4, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [11 x i8], ptr %40, i64 0, i64 %42
  %44 = load i8, ptr %43, align 1, !tbaa !11
  %45 = sext i8 %44 to i32
  %46 = icmp eq i32 %45, 67
  br i1 %46, label %47, label %50

47:                                               ; preds = %37
  %48 = load i32, ptr %2, align 4, !tbaa !9
  store i32 %48, ptr @Cx, align 4, !tbaa !9
  %49 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %49, ptr @Cy, align 4, !tbaa !9
  store i32 0, ptr @Cd, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %47, %37
  br label %51

51:                                               ; preds = %50, %34
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %4, align 4, !tbaa !9
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %4, align 4, !tbaa !9
  br label %20, !llvm.loop !12

55:                                               ; preds = %23
  br label %56

56:                                               ; preds = %55
  %57 = load i32, ptr %2, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %2, align 4, !tbaa !9
  br label %10, !llvm.loop !14

59:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %114, %59
  %61 = load i32, ptr @Fx, align 4, !tbaa !9
  %62 = mul nsw i32 %61, 10
  %63 = load i32, ptr @Fy, align 4, !tbaa !9
  %64 = add nsw i32 %62, %63
  %65 = shl i32 %64, 2
  %66 = load i32, ptr @Fd, align 4, !tbaa !9
  %67 = or i32 %65, %66
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [400 x [400 x i8]], ptr @vis, i64 0, i64 %68
  %70 = load i32, ptr @Cx, align 4, !tbaa !9
  %71 = mul nsw i32 %70, 10
  %72 = load i32, ptr @Cy, align 4, !tbaa !9
  %73 = add nsw i32 %71, %72
  %74 = shl i32 %73, 2
  %75 = load i32, ptr @Cd, align 4, !tbaa !9
  %76 = or i32 %74, %75
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [400 x i8], ptr %69, i64 0, i64 %77
  store i8 1, ptr %78, align 1, !tbaa !15
  call void @_Z6changeRiS_S_(ptr noundef nonnull align 4 dereferenceable(4) @Fx, ptr noundef nonnull align 4 dereferenceable(4) @Fy, ptr noundef nonnull align 4 dereferenceable(4) @Fd)
  call void @_Z6changeRiS_S_(ptr noundef nonnull align 4 dereferenceable(4) @Cx, ptr noundef nonnull align 4 dereferenceable(4) @Cy, ptr noundef nonnull align 4 dereferenceable(4) @Cd)
  %79 = load i32, ptr @Fx, align 4, !tbaa !9
  %80 = load i32, ptr @Cx, align 4, !tbaa !9
  %81 = icmp eq i32 %79, %80
  br i1 %81, label %82, label %89

82:                                               ; preds = %60
  %83 = load i32, ptr @Fy, align 4, !tbaa !9
  %84 = load i32, ptr @Cy, align 4, !tbaa !9
  %85 = icmp eq i32 %83, %84
  br i1 %85, label %86, label %89

86:                                               ; preds = %82
  %87 = load i32, ptr %5, align 4, !tbaa !9
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %87)
  store i32 8, ptr %3, align 4
  br label %117

89:                                               ; preds = %82, %60
  %90 = load i32, ptr @Fx, align 4, !tbaa !9
  %91 = mul nsw i32 %90, 10
  %92 = load i32, ptr @Fy, align 4, !tbaa !9
  %93 = add nsw i32 %91, %92
  %94 = shl i32 %93, 2
  %95 = load i32, ptr @Fd, align 4, !tbaa !9
  %96 = or i32 %94, %95
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [400 x [400 x i8]], ptr @vis, i64 0, i64 %97
  %99 = load i32, ptr @Cx, align 4, !tbaa !9
  %100 = mul nsw i32 %99, 10
  %101 = load i32, ptr @Cy, align 4, !tbaa !9
  %102 = add nsw i32 %100, %101
  %103 = shl i32 %102, 2
  %104 = load i32, ptr @Cd, align 4, !tbaa !9
  %105 = or i32 %103, %104
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [400 x i8], ptr %98, i64 0, i64 %106
  %108 = load i8, ptr %107, align 1, !tbaa !15, !range !17, !noundef !18
  %109 = trunc i8 %108 to i1
  br i1 %109, label %110, label %112

110:                                              ; preds = %89
  %111 = call i32 @puts(ptr noundef @.str.6)
  store i32 8, ptr %3, align 4
  br label %117

112:                                              ; preds = %89
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %5, align 4, !tbaa !9
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %5, align 4, !tbaa !9
  br label %60, !llvm.loop !19

117:                                              ; preds = %110, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %118

118:                                              ; preds = %117
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #3

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

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

declare i32 @puts(ptr noundef) #3

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


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

@Fx = external dso_local global i32, align 4
@Fy = external dso_local global i32, align 4
@Fd = external dso_local global i32, align 4
@Cx = external dso_local global i32, align 4
@Cy = external dso_local global i32, align 4
@Cd = external dso_local global i32, align 4
@str = external dso_local global [10 x [11 x i8]], align 16
@vis = external dso_local local_unnamed_addr global [400 x [400 x i8]], align 16
@.str = external hidden unnamed_addr constant [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6changeRiS_S_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = load ptr, ptr @stdin, align 8, !tbaa !5
  %2 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %1)
  %3 = load ptr, ptr @stdout, align 8, !tbaa !5
  %4 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %3)
  br label %5

5:                                                ; preds = %0, %56
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %56 ]
  %6 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %indvars.iv
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %6)
  %8 = load i8, ptr %6, align 1, !tbaa !9
  switch i8 %8, label %11 [
    i8 70, label %.sink.split
    i8 67, label %9
  ]

.preheader.preheader:                             ; preds = %56
  %.pre = load i32, ptr @Fx, align 4, !tbaa !10
  %.pre24 = load i32, ptr @Fy, align 4, !tbaa !10
  %.pre25 = load i32, ptr @Fd, align 4, !tbaa !10
  %.pre26 = load i32, ptr @Cx, align 4, !tbaa !10
  %.pre27 = load i32, ptr @Cy, align 4, !tbaa !10
  %.pre28 = load i32, ptr @Cd, align 4, !tbaa !10
  br label %.preheader

9:                                                ; preds = %5
  br label %.sink.split

.sink.split:                                      ; preds = %5, %9
  %Fx.sink = phi ptr [ @Cx, %9 ], [ @Fx, %5 ]
  %Fy.sink = phi ptr [ @Cy, %9 ], [ @Fy, %5 ]
  %Fd.sink = phi ptr [ @Cd, %9 ], [ @Fd, %5 ]
  %10 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %10, ptr %Fx.sink, align 4, !tbaa !10
  store i32 0, ptr %Fy.sink, align 4, !tbaa !10
  store i32 0, ptr %Fd.sink, align 4, !tbaa !10
  br label %11

11:                                               ; preds = %.sink.split, %5
  %12 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %indvars.iv, i64 1
  %13 = load i8, ptr %12, align 1, !tbaa !9
  switch i8 %13, label %16 [
    i8 70, label %14
    i8 67, label %.sink.split32
  ]

14:                                               ; preds = %11
  br label %.sink.split32

.sink.split32:                                    ; preds = %11, %14
  %Fx.sink35 = phi ptr [ @Fx, %14 ], [ @Cx, %11 ]
  %Fy.sink34 = phi ptr [ @Fy, %14 ], [ @Cy, %11 ]
  %Fd.sink33 = phi ptr [ @Fd, %14 ], [ @Cd, %11 ]
  %15 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %15, ptr %Fx.sink35, align 4, !tbaa !10
  store i32 1, ptr %Fy.sink34, align 4, !tbaa !10
  store i32 0, ptr %Fd.sink33, align 4, !tbaa !10
  br label %16

16:                                               ; preds = %.sink.split32, %11
  %17 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %indvars.iv, i64 2
  %18 = load i8, ptr %17, align 1, !tbaa !9
  switch i8 %18, label %21 [
    i8 70, label %19
    i8 67, label %.sink.split36
  ]

19:                                               ; preds = %16
  br label %.sink.split36

.sink.split36:                                    ; preds = %16, %19
  %Fx.sink39 = phi ptr [ @Fx, %19 ], [ @Cx, %16 ]
  %Fy.sink38 = phi ptr [ @Fy, %19 ], [ @Cy, %16 ]
  %Fd.sink37 = phi ptr [ @Fd, %19 ], [ @Cd, %16 ]
  %20 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %20, ptr %Fx.sink39, align 4, !tbaa !10
  store i32 2, ptr %Fy.sink38, align 4, !tbaa !10
  store i32 0, ptr %Fd.sink37, align 4, !tbaa !10
  br label %21

21:                                               ; preds = %.sink.split36, %16
  %22 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %indvars.iv, i64 3
  %23 = load i8, ptr %22, align 1, !tbaa !9
  switch i8 %23, label %26 [
    i8 70, label %24
    i8 67, label %.sink.split40
  ]

24:                                               ; preds = %21
  br label %.sink.split40

.sink.split40:                                    ; preds = %21, %24
  %Fx.sink43 = phi ptr [ @Fx, %24 ], [ @Cx, %21 ]
  %Fy.sink42 = phi ptr [ @Fy, %24 ], [ @Cy, %21 ]
  %Fd.sink41 = phi ptr [ @Fd, %24 ], [ @Cd, %21 ]
  %25 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %25, ptr %Fx.sink43, align 4, !tbaa !10
  store i32 3, ptr %Fy.sink42, align 4, !tbaa !10
  store i32 0, ptr %Fd.sink41, align 4, !tbaa !10
  br label %26

26:                                               ; preds = %.sink.split40, %21
  %27 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %indvars.iv, i64 4
  %28 = load i8, ptr %27, align 1, !tbaa !9
  switch i8 %28, label %31 [
    i8 70, label %29
    i8 67, label %.sink.split44
  ]

29:                                               ; preds = %26
  br label %.sink.split44

.sink.split44:                                    ; preds = %26, %29
  %Fx.sink47 = phi ptr [ @Fx, %29 ], [ @Cx, %26 ]
  %Fy.sink46 = phi ptr [ @Fy, %29 ], [ @Cy, %26 ]
  %Fd.sink45 = phi ptr [ @Fd, %29 ], [ @Cd, %26 ]
  %30 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %30, ptr %Fx.sink47, align 4, !tbaa !10
  store i32 4, ptr %Fy.sink46, align 4, !tbaa !10
  store i32 0, ptr %Fd.sink45, align 4, !tbaa !10
  br label %31

31:                                               ; preds = %.sink.split44, %26
  %32 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %indvars.iv, i64 5
  %33 = load i8, ptr %32, align 1, !tbaa !9
  switch i8 %33, label %36 [
    i8 70, label %34
    i8 67, label %.sink.split48
  ]

34:                                               ; preds = %31
  br label %.sink.split48

.sink.split48:                                    ; preds = %31, %34
  %Fx.sink51 = phi ptr [ @Fx, %34 ], [ @Cx, %31 ]
  %Fy.sink50 = phi ptr [ @Fy, %34 ], [ @Cy, %31 ]
  %Fd.sink49 = phi ptr [ @Fd, %34 ], [ @Cd, %31 ]
  %35 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %35, ptr %Fx.sink51, align 4, !tbaa !10
  store i32 5, ptr %Fy.sink50, align 4, !tbaa !10
  store i32 0, ptr %Fd.sink49, align 4, !tbaa !10
  br label %36

36:                                               ; preds = %.sink.split48, %31
  %37 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %indvars.iv, i64 6
  %38 = load i8, ptr %37, align 1, !tbaa !9
  switch i8 %38, label %41 [
    i8 70, label %39
    i8 67, label %.sink.split52
  ]

39:                                               ; preds = %36
  br label %.sink.split52

.sink.split52:                                    ; preds = %36, %39
  %Fx.sink55 = phi ptr [ @Fx, %39 ], [ @Cx, %36 ]
  %Fy.sink54 = phi ptr [ @Fy, %39 ], [ @Cy, %36 ]
  %Fd.sink53 = phi ptr [ @Fd, %39 ], [ @Cd, %36 ]
  %40 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %40, ptr %Fx.sink55, align 4, !tbaa !10
  store i32 6, ptr %Fy.sink54, align 4, !tbaa !10
  store i32 0, ptr %Fd.sink53, align 4, !tbaa !10
  br label %41

41:                                               ; preds = %.sink.split52, %36
  %42 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %indvars.iv, i64 7
  %43 = load i8, ptr %42, align 1, !tbaa !9
  switch i8 %43, label %46 [
    i8 70, label %44
    i8 67, label %.sink.split56
  ]

44:                                               ; preds = %41
  br label %.sink.split56

.sink.split56:                                    ; preds = %41, %44
  %Fx.sink59 = phi ptr [ @Fx, %44 ], [ @Cx, %41 ]
  %Fy.sink58 = phi ptr [ @Fy, %44 ], [ @Cy, %41 ]
  %Fd.sink57 = phi ptr [ @Fd, %44 ], [ @Cd, %41 ]
  %45 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %45, ptr %Fx.sink59, align 4, !tbaa !10
  store i32 7, ptr %Fy.sink58, align 4, !tbaa !10
  store i32 0, ptr %Fd.sink57, align 4, !tbaa !10
  br label %46

46:                                               ; preds = %.sink.split56, %41
  %47 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %indvars.iv, i64 8
  %48 = load i8, ptr %47, align 1, !tbaa !9
  switch i8 %48, label %51 [
    i8 70, label %49
    i8 67, label %.sink.split60
  ]

49:                                               ; preds = %46
  br label %.sink.split60

.sink.split60:                                    ; preds = %46, %49
  %Fx.sink63 = phi ptr [ @Fx, %49 ], [ @Cx, %46 ]
  %Fy.sink62 = phi ptr [ @Fy, %49 ], [ @Cy, %46 ]
  %Fd.sink61 = phi ptr [ @Fd, %49 ], [ @Cd, %46 ]
  %50 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %50, ptr %Fx.sink63, align 4, !tbaa !10
  store i32 8, ptr %Fy.sink62, align 4, !tbaa !10
  store i32 0, ptr %Fd.sink61, align 4, !tbaa !10
  br label %51

51:                                               ; preds = %.sink.split60, %46
  %52 = getelementptr inbounds [10 x [11 x i8]], ptr @str, i64 0, i64 %indvars.iv, i64 9
  %53 = load i8, ptr %52, align 1, !tbaa !9
  switch i8 %53, label %56 [
    i8 70, label %54
    i8 67, label %.sink.split64
  ]

54:                                               ; preds = %51
  br label %.sink.split64

.sink.split64:                                    ; preds = %51, %54
  %Fx.sink67 = phi ptr [ @Fx, %54 ], [ @Cx, %51 ]
  %Fy.sink66 = phi ptr [ @Fy, %54 ], [ @Cy, %51 ]
  %Fd.sink65 = phi ptr [ @Fd, %54 ], [ @Cd, %51 ]
  %55 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %55, ptr %Fx.sink67, align 4, !tbaa !10
  store i32 9, ptr %Fy.sink66, align 4, !tbaa !10
  store i32 0, ptr %Fd.sink65, align 4, !tbaa !10
  br label %56

56:                                               ; preds = %.sink.split64, %51
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 10
  br i1 %exitcond.not, label %.preheader.preheader, label %5, !llvm.loop !12

.preheader:                                       ; preds = %.preheader.preheader, %98
  %57 = phi i32 [ %90, %98 ], [ %.pre28, %.preheader.preheader ]
  %58 = phi i32 [ %.pre30, %98 ], [ %.pre27, %.preheader.preheader ]
  %59 = phi i32 [ %75, %98 ], [ %.pre26, %.preheader.preheader ]
  %60 = phi i32 [ %84, %98 ], [ %.pre25, %.preheader.preheader ]
  %61 = phi i32 [ %.pre29, %98 ], [ %.pre24, %.preheader.preheader ]
  %62 = phi i32 [ %74, %98 ], [ %.pre, %.preheader.preheader ]
  %.0 = phi i32 [ %99, %98 ], [ 1, %.preheader.preheader ]
  %63 = mul nsw i32 %62, 10
  %64 = add nsw i32 %63, %61
  %65 = shl i32 %64, 2
  %66 = or i32 %65, %60
  %67 = sext i32 %66 to i64
  %68 = mul nsw i32 %59, 10
  %69 = add nsw i32 %68, %58
  %70 = shl i32 %69, 2
  %71 = or i32 %70, %57
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [400 x [400 x i8]], ptr @vis, i64 0, i64 %67, i64 %72
  store i8 1, ptr %73, align 1, !tbaa !14
  tail call void @_Z6changeRiS_S_(ptr noundef nonnull align 4 dereferenceable(4) @Fx, ptr noundef nonnull align 4 dereferenceable(4) @Fy, ptr noundef nonnull align 4 dereferenceable(4) @Fd)
  tail call void @_Z6changeRiS_S_(ptr noundef nonnull align 4 dereferenceable(4) @Cx, ptr noundef nonnull align 4 dereferenceable(4) @Cy, ptr noundef nonnull align 4 dereferenceable(4) @Cd)
  %74 = load i32, ptr @Fx, align 4, !tbaa !10
  %75 = load i32, ptr @Cx, align 4, !tbaa !10
  %76 = icmp eq i32 %74, %75
  %.pre29 = load i32, ptr @Fy, align 4, !tbaa !10
  %.pre30 = load i32, ptr @Cy, align 4, !tbaa !10
  %77 = icmp eq i32 %.pre29, %.pre30
  %or.cond = select i1 %76, i1 %77, i1 false
  br i1 %or.cond, label %78, label %80

78:                                               ; preds = %.preheader
  %79 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %.0)
  br label %100

80:                                               ; preds = %.preheader
  %81 = mul nsw i32 %74, 10
  %82 = add nsw i32 %.pre29, %81
  %83 = shl i32 %82, 2
  %84 = load i32, ptr @Fd, align 4, !tbaa !10
  %85 = or i32 %83, %84
  %86 = sext i32 %85 to i64
  %87 = mul nsw i32 %75, 10
  %88 = add nsw i32 %.pre30, %87
  %89 = shl i32 %88, 2
  %90 = load i32, ptr @Cd, align 4, !tbaa !10
  %91 = or i32 %89, %90
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [400 x [400 x i8]], ptr @vis, i64 0, i64 %86, i64 %92
  %94 = load i8, ptr %93, align 1, !tbaa !14, !range !16, !noundef !17
  %95 = trunc nuw i8 %94 to i1
  br i1 %95, label %96, label %98

96:                                               ; preds = %80
  %97 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %100

98:                                               ; preds = %80
  %99 = add nuw nsw i32 %.0, 1
  br label %.preheader, !llvm.loop !18

100:                                              ; preds = %96, %78
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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

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


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