program forth
  implicit none
  integer, allocatable :: x(:), y(:)
  integer :: n, i
  integer :: tot, even, odd

  read(*,*) n
  allocate(x(n))
  allocate(y(n))

  read(*,*) x

  tot = 3 ** n ! biは3通り

  odd = 1
  do i = 1, n
     if (mod(x(i), 2) == 0) then
        odd = odd * 2
     else
        odd = odd * 1
     end if

  end do

  even = tot - odd

  write(*,*) even

  stop
end program forth


  
  

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

@_QFEx.0 = internal unnamed_addr global ptr null
@_QFEx.8 = internal unnamed_addr global i64 0
@_QFEy = internal unnamed_addr global { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } { ptr null, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 9, i8 2, i8 0, [1 x [3 x i64]] [[3 x i64] [i64 1, i64 0, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64)]] }
@_QQcl.ec7a133c7296fb6027893ff8505cd162 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6802/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #1 {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.ec7a133c7296fb6027893ff8505cd162, i32 7)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = load i32, ptr %2, align 4, !tbaa !3
  %7 = call i32 @llvm.smax.i32(i32 %6, i32 0)
  %8 = zext i32 %7 to i64
  %9 = shl nuw nsw i64 %8, 2
  %10 = call ptr @malloc(i64 %9)
  store ptr %10, ptr @_QFEx.0, align 8, !tbaa !7
  store i64 %8, ptr @_QFEx.8, align 8, !tbaa !7
  store i64 4, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QFEy, i64 0, i32 1), align 8, !tbaa !7
  store i32 20180515, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QFEy, i64 0, i32 2), align 16, !tbaa !7
  store i8 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QFEy, i64 0, i32 3), align 4, !tbaa !7
  store i8 9, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QFEy, i64 0, i32 4), align 1, !tbaa !7
  store i8 2, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QFEy, i64 0, i32 5), align 2, !tbaa !7
  store i8 0, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QFEy, i64 0, i32 6), align 1, !tbaa !7
  store i64 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QFEy, i64 0, i32 7), align 8, !tbaa !7
  store i64 %8, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QFEy, i64 0, i32 7, i64 0, i64 1), align 16, !tbaa !7
  store i64 4, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QFEy, i64 0, i32 7, i64 0, i64 2), align 8, !tbaa !7
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.ec7a133c7296fb6027893ff8505cd162, i32 11)
  %.unpack = load ptr, ptr @_QFEx.0, align 8, !tbaa !7
  %.unpack139.unpack.unpack141 = load i64, ptr @_QFEx.8, align 8, !tbaa !7
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.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
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.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
  store i64 %.unpack139.unpack.unpack141, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.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
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %12 = call i1 @_FortranAioInputDescriptor(ptr %11, ptr nonnull %1)
  %13 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %14 = load i32, ptr %2, align 4, !tbaa !3
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %._crit_edge, label %16

16:                                               ; preds = %0
  %17 = icmp slt i32 %14, 1
  br i1 %17, label %._crit_edge, label %.preheader.i

.preheader.i:                                     ; preds = %16
  %18 = and i32 %14, 1
  %.not3.i = icmp eq i32 %18, 0
  %19 = select i1 %.not3.i, i32 1, i32 3
  %20 = icmp eq i32 %14, 1
  br i1 %20, label %.lr.ph, label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.preheader.i, %.lr.ph.i
  %spec.select4.i = phi i32 [ %spec.select.i, %.lr.ph.i ], [ %19, %.preheader.i ]
  %21 = phi i32 [ %23, %.lr.ph.i ], [ %14, %.preheader.i ]
  %22 = phi i32 [ %24, %.lr.ph.i ], [ 3, %.preheader.i ]
  %23 = lshr i32 %21, 1
  %24 = mul i32 %22, %22
  %25 = and i32 %21, 2
  %.not.i = icmp eq i32 %25, 0
  %26 = select i1 %.not.i, i32 1, i32 %24
  %spec.select.i = mul i32 %26, %spec.select4.i
  %27 = icmp ult i32 %21, 4
  br i1 %27, label %__mlir_math_ipowi_i32.exit, label %.lr.ph.i

__mlir_math_ipowi_i32.exit:                       ; preds = %.lr.ph.i
  %28 = icmp sgt i32 %14, 0
  br i1 %28, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader.i, %__mlir_math_ipowi_i32.exit
  %common.ret.op.i162 = phi i32 [ %spec.select.i, %__mlir_math_ipowi_i32.exit ], [ %19, %.preheader.i ]
  %29 = zext i32 %14 to i64
  %.unpack144 = load ptr, ptr @_QFEx.0, align 8, !tbaa !7
  %xtraiter = and i64 %29, 3
  %30 = icmp ult i32 %14, 4
  br i1 %30, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %29, 4294967292
  br label %31

31:                                               ; preds = %31, %.lr.ph.new
  %indvars.iv = phi i64 [ 1, %.lr.ph.new ], [ %indvars.iv.next.3, %31 ]
  %.0156 = phi i32 [ 1, %.lr.ph.new ], [ %.1.3, %31 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.3, %31 ]
  %32 = add nsw i64 %indvars.iv, -1
  %33 = getelementptr i32, ptr %.unpack144, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !3
  %35 = and i32 %34, 1
  %36 = xor i32 %35, 1
  %.1 = shl i32 %.0156, %36
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = getelementptr i32, ptr %.unpack144, i64 %indvars.iv
  %38 = load i32, ptr %37, align 4, !tbaa !3
  %39 = and i32 %38, 1
  %40 = xor i32 %39, 1
  %.1.1 = shl i32 %.1, %40
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %41 = getelementptr i32, ptr %.unpack144, i64 %indvars.iv.next
  %42 = load i32, ptr %41, align 4, !tbaa !3
  %43 = and i32 %42, 1
  %44 = xor i32 %43, 1
  %.1.2 = shl i32 %.1.1, %44
  %45 = getelementptr i32, ptr %.unpack144, i64 %indvars.iv.next.1
  %46 = load i32, ptr %45, align 4, !tbaa !3
  %47 = and i32 %46, 1
  %48 = xor i32 %47, 1
  %.1.3 = shl i32 %.1.2, %48
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %31

._crit_edge.loopexit.unr-lcssa:                   ; preds = %31, %.lr.ph
  %.1.lcssa.ph = phi i32 [ undef, %.lr.ph ], [ %.1.3, %31 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next.3, %31 ]
  %.0156.unr = phi i32 [ 1, %.lr.ph ], [ %.1.3, %31 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.0156.epil = phi i32 [ %.1.epil, %.epil.preheader ], [ %.0156.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %49 = add nsw i64 %indvars.iv.epil, -1
  %50 = getelementptr i32, ptr %.unpack144, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !3
  %52 = and i32 %51, 1
  %53 = xor i32 %52, 1
  %.1.epil = shl i32 %.0156.epil, %53
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !9

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader, %0, %16, %__mlir_math_ipowi_i32.exit
  %common.ret.op.i159 = phi i32 [ %spec.select.i, %__mlir_math_ipowi_i32.exit ], [ 0, %16 ], [ 1, %0 ], [ %common.ret.op.i162, %.epil.preheader ], [ %common.ret.op.i162, %._crit_edge.loopexit.unr-lcssa ]
  %.0.lcssa = phi i32 [ 1, %__mlir_math_ipowi_i32.exit ], [ 1, %16 ], [ 1, %0 ], [ %.1.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.1.epil, %.epil.preheader ]
  %54 = sub i32 %common.ret.op.i159, %.0.lcssa
  %55 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.ec7a133c7296fb6027893ff8505cd162, i32 27)
  %56 = call i1 @_FortranAioOutputInteger32(ptr %55, i32 %54)
  %57 = call i32 @_FortranAioEndIoStatement(ptr %55)
  %58 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

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

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

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { noreturn }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
