; LLVM IR from upupming/algorithm :: AdvancedLevel_C++/1118. Birds in Forest (25)  (main)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@fa = external dso_local global [10010 x i32], align 16
@cnt = external dso_local global [10010 x i32], align 16
@exist = external dso_local global [10010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z10findFatheri(i32 noundef) #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 nounwind uwtable
declare dso_local void @_Z5Unionii(i32 noundef, i32 noundef) #0

; 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
  %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
  store i32 0, ptr %1, align 4
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %26, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = icmp sle i32 %18, 10010
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %29

21:                                               ; preds = %17
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [10010 x i32], ptr @fa, i64 0, i64 %24
  store i32 %22, ptr %25, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %21
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

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

30:                                               ; preds = %57, %29
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %60

35:                                               ; preds = %30
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @k, ptr noundef %3)
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [10010 x i8], ptr @exist, i64 0, i64 %38
  store i8 1, ptr %39, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %53, %35
  %41 = load i32, ptr %7, align 4, !tbaa !5
  %42 = load i32, ptr @k, align 4, !tbaa !5
  %43 = sub nsw i32 %42, 1
  %44 = icmp slt i32 %41, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %40
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %56

46:                                               ; preds = %40
  %47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4)
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z5Unionii(i32 noundef %48, i32 noundef %49)
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [10010 x i8], ptr @exist, i64 0, i64 %51
  store i8 1, ptr %52, align 1, !tbaa !11
  br label %53

53:                                               ; preds = %46
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %7, align 4, !tbaa !5
  br label %40, !llvm.loop !13

56:                                               ; preds = %45
  br label %57

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

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

61:                                               ; preds = %82, %60
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = icmp sle i32 %62, 10010
  br i1 %63, label %65, label %64

64:                                               ; preds = %61
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %85

65:                                               ; preds = %61
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [10010 x i8], ptr @exist, i64 0, i64 %67
  %69 = load i8, ptr %68, align 1, !tbaa !11, !range !15, !noundef !16
  %70 = trunc i8 %69 to i1
  %71 = zext i1 %70 to i32
  %72 = icmp eq i32 %71, 1
  br i1 %72, label %73, label %81

73:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = call noundef i32 @_Z10findFatheri(i32 noundef %74)
  store i32 %75, ptr %9, align 4, !tbaa !5
  %76 = load i32, ptr %9, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [10010 x i32], ptr @cnt, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %78, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %81

81:                                               ; preds = %73, %65
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %8, align 4, !tbaa !5
  br label %61, !llvm.loop !17

85:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %114, %85
  %87 = load i32, ptr %12, align 4, !tbaa !5
  %88 = icmp sle i32 %87, 10010
  br i1 %88, label %90, label %89

89:                                               ; preds = %86
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %117

90:                                               ; preds = %86
  %91 = load i32, ptr %12, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [10010 x i8], ptr @exist, i64 0, i64 %92
  %94 = load i8, ptr %93, align 1, !tbaa !11, !range !15, !noundef !16
  %95 = trunc i8 %94 to i1
  %96 = zext i1 %95 to i32
  %97 = icmp eq i32 %96, 1
  br i1 %97, label %98, label %113

98:                                               ; preds = %90
  %99 = load i32, ptr %12, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [10010 x i32], ptr @cnt, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %113

104:                                              ; preds = %98
  %105 = load i32, ptr %10, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %10, align 4, !tbaa !5
  %107 = load i32, ptr %12, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [10010 x i32], ptr @cnt, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = load i32, ptr %11, align 4, !tbaa !5
  %112 = add nsw i32 %111, %110
  store i32 %112, ptr %11, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %104, %98, %90
  br label %114

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

117:                                              ; preds = %89
  %118 = load i32, ptr %10, align 4, !tbaa !5
  %119 = load i32, ptr %11, align 4, !tbaa !5
  %120 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %118, i32 noundef %119)
  %121 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %137, %117
  %123 = load i32, ptr %15, align 4, !tbaa !5
  %124 = load i32, ptr @m, align 4, !tbaa !5
  %125 = icmp slt i32 %123, %124
  br i1 %125, label %127, label %126

126:                                              ; preds = %122
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %140

127:                                              ; preds = %122
  %128 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %13, ptr noundef %14)
  %129 = load i32, ptr %13, align 4, !tbaa !5
  %130 = call noundef i32 @_Z10findFatheri(i32 noundef %129)
  %131 = load i32, ptr %14, align 4, !tbaa !5
  %132 = call noundef i32 @_Z10findFatheri(i32 noundef %131)
  %133 = icmp eq i32 %130, %132
  %134 = zext i1 %133 to i64
  %135 = select i1 %133, ptr @.str.4, ptr @.str.5
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, ptr noundef %135)
  br label %137

137:                                              ; preds = %127
  %138 = load i32, ptr %15, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %15, align 4, !tbaa !5
  br label %122, !llvm.loop !19

140:                                              ; preds = %126
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  %141 = load i32, ptr %1, align 4
  ret i32 %141
}

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@fa = external dso_local local_unnamed_addr global [10010 x i32], align 16
@cnt = external dso_local local_unnamed_addr global [10010 x i32], align 16
@exist = external dso_local local_unnamed_addr global [10010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
vector.ph:
  %0 = alloca i32, align 4
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.2, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next.2, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %offset.idx = or disjoint i64 %index, 1
  %5 = getelementptr inbounds [10010 x i32], ptr @fa, i64 0, i64 %offset.idx
  %6 = getelementptr inbounds i8, ptr %5, i64 16
  store <4 x i32> %vec.ind, ptr %5, align 4, !tbaa !5
  store <4 x i32> %step.add, ptr %6, align 4, !tbaa !5
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %step.add.1 = add <4 x i32> %vec.ind, <i32 12, i32 12, i32 12, i32 12>
  %offset.idx.1 = add nuw nsw i64 %index, 9
  %7 = getelementptr inbounds [10010 x i32], ptr @fa, i64 0, i64 %offset.idx.1
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  store <4 x i32> %vec.ind.next, ptr %7, align 4, !tbaa !5
  store <4 x i32> %step.add.1, ptr %8, align 4, !tbaa !5
  %vec.ind.next.1 = add <4 x i32> %vec.ind, <i32 16, i32 16, i32 16, i32 16>
  %step.add.2 = add <4 x i32> %vec.ind, <i32 20, i32 20, i32 20, i32 20>
  %offset.idx.2 = add nuw nsw i64 %index, 17
  %9 = getelementptr inbounds [10010 x i32], ptr @fa, i64 0, i64 %offset.idx.2
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  store <4 x i32> %vec.ind.next.1, ptr %9, align 4, !tbaa !5
  store <4 x i32> %step.add.2, ptr %10, align 4, !tbaa !5
  %index.next.2 = add nuw nsw i64 %index, 24
  %vec.ind.next.2 = add <4 x i32> %vec.ind, <i32 24, i32 24, i32 24, i32 24>
  %11 = icmp eq i64 %index.next.2, 10008
  br i1 %11, label %scalar.ph, label %vector.body, !llvm.loop !9

.preheader34.preheader:                           ; preds = %._crit_edge, %scalar.ph
  br label %.preheader34

scalar.ph:                                        ; preds = %vector.body
  store i32 10009, ptr getelementptr inbounds (i8, ptr @fa, i64 40036), align 4, !tbaa !5
  store i32 10010, ptr getelementptr inbounds (i8, ptr @fa, i64 40040), align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph39, label %.preheader34.preheader

.lr.ph39:                                         ; preds = %scalar.ph, %._crit_edge
  %.03137 = phi i32 [ %20, %._crit_edge ], [ 0, %scalar.ph ]
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @k, ptr noundef nonnull %0)
  %15 = load i32, ptr %0, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [10010 x i8], ptr @exist, i64 0, i64 %16
  store i8 1, ptr %17, align 1, !tbaa !13
  %18 = load i32, ptr @k, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 1
  br i1 %19, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph39
  %20 = add nuw nsw i32 %.03137, 1
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %.lr.ph39, label %.preheader34.preheader, !llvm.loop !15

.lr.ph:                                           ; preds = %.lr.ph39, %.lr.ph
  %.03036 = phi i32 [ %29, %.lr.ph ], [ 0, %.lr.ph39 ]
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %24 = load i32, ptr %0, align 4, !tbaa !5
  %25 = load i32, ptr %1, align 4, !tbaa !5
  call void @_Z5Unionii(i32 noundef %24, i32 noundef %25)
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [10010 x i8], ptr @exist, i64 0, i64 %27
  store i8 1, ptr %28, align 1, !tbaa !13
  %29 = add nuw nsw i32 %.03036, 1
  %30 = load i32, ptr @k, align 4, !tbaa !5
  %31 = add nsw i32 %30, -1
  %32 = icmp slt i32 %29, %31
  br i1 %32, label %.lr.ph, label %._crit_edge, !llvm.loop !16

.preheader34:                                     ; preds = %.preheader34.preheader, %43
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %43 ], [ 1, %.preheader34.preheader ]
  %33 = getelementptr inbounds [10010 x i8], ptr @exist, i64 0, i64 %indvars.iv49
  %34 = load i8, ptr %33, align 1, !tbaa !13, !range !17, !noundef !18
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %36, label %43

36:                                               ; preds = %.preheader34
  %37 = trunc nuw nsw i64 %indvars.iv49 to i32
  %38 = call noundef i32 @_Z10findFatheri(i32 noundef %37)
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [10010 x i32], ptr @cnt, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %.preheader34, %36
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond52.not = icmp eq i64 %indvars.iv.next50, 10011
  br i1 %exitcond52.not, label %.preheader, label %.preheader34, !llvm.loop !19

44:                                               ; preds = %67
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.128.1, i32 noundef %.1.1)
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %47 = load i32, ptr @m, align 4, !tbaa !5
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %.lr.ph46, label %._crit_edge47

.preheader:                                       ; preds = %43, %67
  %indvars.iv53 = phi i64 [ %indvars.iv.next54.1, %67 ], [ 1, %43 ]
  %.02642 = phi i32 [ %.1.1, %67 ], [ 0, %43 ]
  %.02741 = phi i32 [ %.128.1, %67 ], [ 0, %43 ]
  %49 = getelementptr inbounds [10010 x i8], ptr @exist, i64 0, i64 %indvars.iv53
  %50 = load i8, ptr %49, align 1, !tbaa !13, !range !17, !noundef !18
  %51 = trunc nuw i8 %50 to i1
  br i1 %51, label %52, label %.preheader.1

52:                                               ; preds = %.preheader
  %53 = getelementptr inbounds [10010 x i32], ptr @cnt, i64 0, i64 %indvars.iv53
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %.not = icmp eq i32 %54, 0
  br i1 %.not, label %.preheader.1, label %55

55:                                               ; preds = %52
  %56 = add nsw i32 %.02741, 1
  %57 = add nsw i32 %54, %.02642
  br label %.preheader.1

.preheader.1:                                     ; preds = %.preheader, %52, %55
  %.128 = phi i32 [ %56, %55 ], [ %.02741, %52 ], [ %.02741, %.preheader ]
  %.1 = phi i32 [ %57, %55 ], [ %.02642, %52 ], [ %.02642, %.preheader ]
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %58 = getelementptr inbounds [10010 x i8], ptr @exist, i64 0, i64 %indvars.iv.next54
  %59 = load i8, ptr %58, align 1, !tbaa !13, !range !17, !noundef !18
  %60 = trunc nuw i8 %59 to i1
  br i1 %60, label %61, label %67

61:                                               ; preds = %.preheader.1
  %62 = getelementptr inbounds [10010 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next54
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %.not.1 = icmp eq i32 %63, 0
  br i1 %.not.1, label %67, label %64

64:                                               ; preds = %61
  %65 = add nsw i32 %.128, 1
  %66 = add nsw i32 %63, %.1
  br label %67

67:                                               ; preds = %64, %61, %.preheader.1
  %.128.1 = phi i32 [ %65, %64 ], [ %.128, %61 ], [ %.128, %.preheader.1 ]
  %.1.1 = phi i32 [ %66, %64 ], [ %.1, %61 ], [ %.1, %.preheader.1 ]
  %indvars.iv.next54.1 = add nuw nsw i64 %indvars.iv53, 2
  %exitcond56.not.1 = icmp eq i64 %indvars.iv.next54.1, 10011
  br i1 %exitcond56.not.1, label %44, label %.preheader, !llvm.loop !20

._crit_edge47:                                    ; preds = %.lr.ph46, %44
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #4
  ret i32 0

.lr.ph46:                                         ; preds = %44, %.lr.ph46
  %.044 = phi i32 [ %76, %.lr.ph46 ], [ 0, %44 ]
  %68 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %70 = call noundef i32 @_Z10findFatheri(i32 noundef %69)
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = call noundef i32 @_Z10findFatheri(i32 noundef %71)
  %73 = icmp eq i32 %70, %72
  %74 = select i1 %73, ptr @.str.4, ptr @.str.5
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %74)
  %76 = add nuw nsw i32 %.044, 1
  %77 = load i32, ptr @m, align 4, !tbaa !5
  %78 = icmp slt i32 %76, %77
  br i1 %78, label %.lr.ph46, label %._crit_edge47, !llvm.loop !21
}

; 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

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

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

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


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