program red_scarf
  implicit none
  integer :: n, a(200000) = 0, i, x = 0
  read(*,*) n
  read(*,*) a(1:n)
  do i = 1, n
    x = xor(x, a(i))
  end do
  write(*,'(i0)',advance='no') xor(x, a(1))
  do i = 2, n
    write(*,'(x,i0)',advance='no') xor(x, a(i))
  end do
  write(*,*)
end program red_scarf
; 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"

@_QFEa = internal global [200000 x i32] zeroinitializer
@_QFEx = internal unnamed_addr global i32 0
@_QQcl.9ba795803431db4b79bea513acda98c1 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1138/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQcl.6E6F = linkonce constant [2 x i8] c"no"
@_QQcl.28782C693029 = linkonce constant [6 x i8] c"(x,i0)"
@_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 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9ba795803431db4b79bea513acda98c1, i32 4)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9ba795803431db4b79bea513acda98c1, i32 5)
  %7 = load i32, ptr %2, align 4, !tbaa !3
  %8 = call i32 @llvm.smax.i32(i32 %7, i32 0)
  %9 = zext i32 %8 to i64
  store ptr @_QFEa, 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 %9, 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
  %10 = call i1 @_FortranAioInputDescriptor(ptr %6, ptr nonnull %1)
  %11 = call i32 @_FortranAioEndIoStatement(ptr %6)
  %12 = load i32, ptr %2, align 4, !tbaa !3
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph.preheader, label %27

.lr.ph.preheader:                                 ; preds = %0
  %_QFEx.promoted = load i32, ptr @_QFEx, align 4, !tbaa !3
  %14 = zext i32 %12 to i64
  %min.iters.check = icmp ult i32 %12, 8
  br i1 %min.iters.check, label %.lr.ph.preheader15, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %14, 4294967288
  %ind.end = or i64 %n.vec, 1
  %15 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %_QFEx.promoted, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %15, %vector.ph ], [ %18, %vector.body ]
  %vec.phi13 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
  %16 = getelementptr [200000 x i32], ptr @_QFEa, i64 0, i64 %index
  %wide.load = load <4 x i32>, ptr %16, align 16, !tbaa !3
  %17 = getelementptr i32, ptr %16, i64 4
  %wide.load14 = load <4 x i32>, ptr %17, align 16, !tbaa !3
  %18 = xor <4 x i32> %wide.load, %vec.phi
  %19 = xor <4 x i32> %wide.load14, %vec.phi13
  %index.next = add nuw i64 %index, 8
  %20 = icmp eq i64 %index.next, %n.vec
  br i1 %20, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = xor <4 x i32> %19, %18
  %21 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %14
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader15

.lr.ph.preheader15:                               ; preds = %.lr.ph.preheader, %middle.block
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  %.ph = phi i32 [ %_QFEx.promoted, %.lr.ph.preheader ], [ %21, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader15, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader15 ]
  %22 = phi i32 [ %26, %.lr.ph ], [ %.ph, %.lr.ph.preheader15 ]
  %23 = add nsw i64 %indvars.iv, -1
  %24 = getelementptr [200000 x i32], ptr @_QFEa, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !3
  %26 = xor i32 %25, %22
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %14
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %.lcssa = phi i32 [ %21, %middle.block ], [ %26, %.lr.ph ]
  store i32 %.lcssa, ptr @_QFEx, align 4, !tbaa !3
  br label %27

27:                                               ; preds = %._crit_edge, %0
  %28 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.9ba795803431db4b79bea513acda98c1, i32 9)
  %29 = call i1 @_FortranAioSetAdvance(ptr %28, ptr nonnull @_QQcl.6E6F, i64 2)
  %30 = load i32, ptr @_QFEx, align 4, !tbaa !3
  %31 = load i32, ptr @_QFEa, align 16, !tbaa !3
  %32 = xor i32 %31, %30
  %33 = call i1 @_FortranAioOutputInteger32(ptr %28, i32 %32)
  %34 = call i32 @_FortranAioEndIoStatement(ptr %28)
  %35 = load i32, ptr %2, align 4, !tbaa !3
  %36 = icmp sgt i32 %35, 1
  br i1 %36, label %.lr.ph6.preheader, label %._crit_edge7

.lr.ph6.preheader:                                ; preds = %27
  %37 = zext i32 %35 to i64
  br label %.lr.ph6

.lr.ph6:                                          ; preds = %.lr.ph6.preheader, %.lr.ph6
  %indvars.iv9 = phi i64 [ 2, %.lr.ph6.preheader ], [ %indvars.iv.next10, %.lr.ph6 ]
  %38 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28782C693029, i64 6, ptr null, i32 -1, ptr nonnull @_QQcl.9ba795803431db4b79bea513acda98c1, i32 11)
  %39 = call i1 @_FortranAioSetAdvance(ptr %38, ptr nonnull @_QQcl.6E6F, i64 2)
  %40 = load i32, ptr @_QFEx, align 4, !tbaa !3
  %41 = add nsw i64 %indvars.iv9, -1
  %42 = getelementptr [200000 x i32], ptr @_QFEa, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !3
  %44 = xor i32 %43, %40
  %45 = call i1 @_FortranAioOutputInteger32(ptr %38, i32 %44)
  %46 = call i32 @_FortranAioEndIoStatement(ptr %38)
  %indvars.iv.next10 = add nuw nsw i64 %indvars.iv9, 1
  %exitcond12.not = icmp eq i64 %indvars.iv9, %37
  br i1 %exitcond12.not, label %._crit_edge7, label %.lr.ph6

._crit_edge7:                                     ; preds = %.lr.ph6, %27
  %47 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.9ba795803431db4b79bea513acda98c1, i32 13)
  %48 = call i32 @_FortranAioEndIoStatement(ptr %47)
  ret void
}

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 @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.xor.v4i32(<4 x i32>) #1

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nosync nounwind 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, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
