program Bingo
    implicit none
    integer(4):: bng(3,3), num
    integer(4):: i,j,k, n
    logical:: is_open(3,3) = .false.

    do i=1, 3
        read*, bng(:,i)
    end do

    read*, n

    do i=1, n
        read*, num

        do j=1,3
            do k=1,3
                if (bng(k,j) == num) is_open(k,j) = .true.  
            end do
        end do
    end do

    if (check_bingo(is_open)) then
        print*, 'Yes'
    else
        print*, 'No'
    end if

    contains
    function check_bingo(is_open) result(is_bingo)
        integer(4):: i,j
        logical:: is_open(3,3), is_bingo

        is_bingo = .false.

        do i=1, 3
            if (is_open(1,i) .and. is_open(2,i) .and. is_open(3,i)) is_bingo = .true.
            if (is_open(i,1) .and. is_open(i,2) .and. is_open(i,3)) is_bingo = .true.
        end do

        if (is_open(1,1) .and. is_open(2,2) .and. is_open(3,3)) is_bingo = .true.
        if (is_open(1,3) .and. is_open(2,2) .and. is_open(3,1)) is_bingo = .true.
        
    end function
end program Bingo
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEbng = internal global [3 x [3 x i32]] undef
@_QFEis_open.0 = internal unnamed_addr global i1 false
@_QFEis_open.1 = internal unnamed_addr global i1 false
@_QFEis_open.2 = internal unnamed_addr global i1 false
@_QFEis_open.3 = internal unnamed_addr global i1 false
@_QFEis_open.4 = internal unnamed_addr global i1 false
@_QFEis_open.5 = internal unnamed_addr global i1 false
@_QFEis_open.6 = internal unnamed_addr global i1 false
@_QFEis_open.7 = internal unnamed_addr global i1 false
@_QFEis_open.8 = internal unnamed_addr global i1 false
@_QQcl.7b06fc10d080da0d7f34f5857ad353f4 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_2269/source.f\00"
@_QQcl.596573 = linkonce constant [3 x i8] c"Yes"
@_QQcl.4E6F = linkonce constant [2 x i8] c"No"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.7b06fc10d080da0d7f34f5857ad353f4, i32 8)
  store ptr @_QFEbng, ptr %1, align 8, !tbaa !3
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !3
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !3
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !3
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !3
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !3
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !3
  store i64 3, ptr %.fca.7.0.1.gep, align 8, !tbaa !3
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !3
  %5 = call i1 @_FortranAioInputDescriptor(ptr %4, ptr nonnull %1)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %7 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.7b06fc10d080da0d7f34f5857ad353f4, i32 8)
  store ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEbng, i64 0, i64 1, i64 0), ptr %1, align 8, !tbaa !3
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !3
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !3
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !3
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !3
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !3
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !3
  store i64 3, ptr %.fca.7.0.1.gep, align 8, !tbaa !3
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !3
  %8 = call i1 @_FortranAioInputDescriptor(ptr %7, ptr nonnull %1)
  %9 = call i32 @_FortranAioEndIoStatement(ptr %7)
  %10 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.7b06fc10d080da0d7f34f5857ad353f4, i32 8)
  store ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEbng, i64 0, i64 2, i64 0), ptr %1, align 8, !tbaa !3
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !3
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !3
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !3
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !3
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !3
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !3
  store i64 3, ptr %.fca.7.0.1.gep, align 8, !tbaa !3
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !3
  %11 = call i1 @_FortranAioInputDescriptor(ptr %10, ptr nonnull %1)
  %12 = call i32 @_FortranAioEndIoStatement(ptr %10)
  %13 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.7b06fc10d080da0d7f34f5857ad353f4, i32 11)
  %14 = call i1 @_FortranAioInputInteger(ptr %13, ptr nonnull %2, i32 4)
  %15 = call i32 @_FortranAioEndIoStatement(ptr %13)
  %16 = load i32, ptr %2, align 4, !tbaa !7
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %18 = zext i32 %16 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %57
  %19 = phi i64 [ %58, %57 ], [ %18, %.lr.ph.preheader ]
  %20 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.7b06fc10d080da0d7f34f5857ad353f4, i32 14)
  %21 = call i1 @_FortranAioInputInteger(ptr %20, ptr nonnull %3, i32 4)
  %22 = call i32 @_FortranAioEndIoStatement(ptr %20)
  %23 = load i32, ptr %3, align 4, !tbaa !7
  %24 = load i32, ptr @_QFEbng, align 16, !tbaa !7
  %25 = icmp eq i32 %24, %23
  br i1 %25, label %26, label %27

26:                                               ; preds = %.lr.ph
  store i1 true, ptr @_QFEis_open.0, align 1
  br label %27

27:                                               ; preds = %26, %.lr.ph
  %28 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEbng, i64 0, i64 0, i64 1), align 4, !tbaa !7
  %29 = icmp eq i32 %28, %23
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  store i1 true, ptr @_QFEis_open.1, align 1
  br label %31

31:                                               ; preds = %30, %27
  %32 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEbng, i64 0, i64 0, i64 2), align 8, !tbaa !7
  %33 = icmp eq i32 %32, %23
  br i1 %33, label %34, label %.preheader.1

34:                                               ; preds = %31
  store i1 true, ptr @_QFEis_open.2, align 1
  br label %.preheader.1

.preheader.1:                                     ; preds = %34, %31
  %35 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEbng, i64 0, i64 1, i64 0), align 4, !tbaa !7
  %36 = icmp eq i32 %35, %23
  br i1 %36, label %37, label %38

37:                                               ; preds = %.preheader.1
  store i1 true, ptr @_QFEis_open.3, align 1
  br label %38

38:                                               ; preds = %37, %.preheader.1
  %39 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEbng, i64 0, i64 1, i64 1), align 16, !tbaa !7
  %40 = icmp eq i32 %39, %23
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  store i1 true, ptr @_QFEis_open.4, align 1
  br label %42

42:                                               ; preds = %41, %38
  %43 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEbng, i64 0, i64 1, i64 2), align 4, !tbaa !7
  %44 = icmp eq i32 %43, %23
  br i1 %44, label %45, label %.preheader.2

45:                                               ; preds = %42
  store i1 true, ptr @_QFEis_open.5, align 1
  br label %.preheader.2

.preheader.2:                                     ; preds = %45, %42
  %46 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEbng, i64 0, i64 2, i64 0), align 8, !tbaa !7
  %47 = icmp eq i32 %46, %23
  br i1 %47, label %48, label %49

48:                                               ; preds = %.preheader.2
  store i1 true, ptr @_QFEis_open.6, align 1
  br label %49

49:                                               ; preds = %48, %.preheader.2
  %50 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEbng, i64 0, i64 2, i64 1), align 4, !tbaa !7
  %51 = icmp eq i32 %50, %23
  br i1 %51, label %52, label %53

52:                                               ; preds = %49
  store i1 true, ptr @_QFEis_open.7, align 1
  br label %53

53:                                               ; preds = %52, %49
  %54 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEbng, i64 0, i64 2, i64 2), align 16, !tbaa !7
  %55 = icmp eq i32 %54, %23
  br i1 %55, label %56, label %57

56:                                               ; preds = %53
  store i1 true, ptr @_QFEis_open.8, align 1
  br label %57

57:                                               ; preds = %56, %53
  %58 = add nsw i64 %19, -1
  %59 = icmp sgt i64 %19, 1
  br i1 %59, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %57, %0
  %.b = load i1, ptr @_QFEis_open.0, align 1
  %.b15 = load i1, ptr @_QFEis_open.1, align 1
  %60 = and i1 %.b, %.b15
  %.b16 = load i1, ptr @_QFEis_open.2, align 1
  %61 = and i1 %60, %.b16
  %.b17 = load i1, ptr @_QFEis_open.3, align 1
  %62 = and i1 %.b, %.b17
  %.b20 = load i1, ptr @_QFEis_open.6, align 1
  %63 = and i1 %62, %.b20
  %.b18 = load i1, ptr @_QFEis_open.4, align 1
  %64 = and i1 %.b17, %.b18
  %.b19 = load i1, ptr @_QFEis_open.5, align 1
  %65 = and i1 %64, %.b19
  %66 = and i1 %.b15, %.b18
  %.b21 = load i1, ptr @_QFEis_open.7, align 1
  %67 = and i1 %66, %.b21
  %68 = and i1 %.b20, %.b21
  %.b22 = load i1, ptr @_QFEis_open.8, align 1
  %69 = and i1 %.b16, %.b19
  %70 = select i1 %69, i1 true, i1 %68
  %71 = and i1 %.b22, %70
  %72 = and i1 %.b, %.b22
  %73 = and i1 %.b16, %.b20
  %74 = select i1 %73, i1 true, i1 %72
  %75 = and i1 %.b18, %74
  %76 = select i1 %75, i1 true, i1 %71
  %77 = select i1 %76, i1 true, i1 %67
  %78 = select i1 %77, i1 true, i1 %65
  %79 = select i1 %78, i1 true, i1 %63
  %narrow.i = select i1 %79, i1 true, i1 %61
  br i1 %narrow.i, label %80, label %83

80:                                               ; preds = %._crit_edge
  %81 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.7b06fc10d080da0d7f34f5857ad353f4, i32 24)
  %82 = call i1 @_FortranAioOutputAscii(ptr %81, ptr nonnull @_QQcl.596573, i64 3)
  br label %86

83:                                               ; preds = %._crit_edge
  %84 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.7b06fc10d080da0d7f34f5857ad353f4, i32 26)
  %85 = call i1 @_FortranAioOutputAscii(ptr %84, ptr nonnull @_QQcl.4E6F, i64 2)
  br label %86

86:                                               ; preds = %80, %83
  %.sink = phi ptr [ %81, %80 ], [ %84, %83 ]
  %87 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read)
define i32 @_QFPcheck_bingo(ptr nocapture readonly %0) local_unnamed_addr #0 {
  %2 = load i32, ptr %0, align 4, !tbaa !7
  %3 = getelementptr [3 x [3 x i32]], ptr %0, i64 0, i64 0, i64 1
  %4 = load i32, ptr %3, align 4, !tbaa !7
  %5 = icmp ne i32 %2, 0
  %6 = icmp ne i32 %4, 0
  %7 = and i1 %5, %6
  %8 = getelementptr [3 x [3 x i32]], ptr %0, i64 0, i64 0, i64 2
  %9 = load i32, ptr %8, align 4, !tbaa !7
  %10 = icmp ne i32 %9, 0
  %11 = and i1 %7, %10
  %12 = getelementptr [3 x [3 x i32]], ptr %0, i64 0, i64 1, i64 0
  %13 = load i32, ptr %12, align 4, !tbaa !7
  %14 = icmp ne i32 %13, 0
  %15 = and i1 %5, %14
  %16 = getelementptr [3 x [3 x i32]], ptr %0, i64 0, i64 2, i64 0
  %17 = load i32, ptr %16, align 4, !tbaa !7
  %18 = icmp ne i32 %17, 0
  %19 = and i1 %15, %18
  %20 = getelementptr [3 x [3 x i32]], ptr %0, i64 0, i64 1, i64 1
  %21 = load i32, ptr %20, align 4, !tbaa !7
  %22 = icmp ne i32 %21, 0
  %23 = and i1 %14, %22
  %24 = getelementptr [3 x [3 x i32]], ptr %0, i64 0, i64 1, i64 2
  %25 = load i32, ptr %24, align 4, !tbaa !7
  %26 = icmp ne i32 %25, 0
  %27 = and i1 %23, %26
  %28 = and i1 %6, %22
  %29 = getelementptr [3 x [3 x i32]], ptr %0, i64 0, i64 2, i64 1
  %30 = load i32, ptr %29, align 4, !tbaa !7
  %31 = icmp ne i32 %30, 0
  %32 = and i1 %28, %31
  %33 = and i1 %18, %31
  %34 = getelementptr [3 x [3 x i32]], ptr %0, i64 0, i64 2, i64 2
  %35 = load i32, ptr %34, align 4, !tbaa !7
  %36 = icmp ne i32 %35, 0
  %37 = and i1 %10, %26
  %38 = select i1 %37, i1 true, i1 %33
  %39 = and i1 %36, %38
  %40 = and i1 %5, %36
  %41 = and i1 %18, %10
  %42 = select i1 %41, i1 true, i1 %40
  %43 = and i1 %22, %42
  %44 = select i1 %43, i1 true, i1 %39
  %45 = select i1 %44, i1 true, i1 %32
  %46 = select i1 %45, i1 true, i1 %27
  %47 = select i1 %46, i1 true, i1 %19
  %narrow = select i1 %47, i1 true, i1 %11
  %.4 = zext i1 %narrow to i32
  ret i32 %.4
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) }

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

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"descriptor member", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any data access", !5, i64 0}
