program main
  read (*, '(b3)') i
  write (*, *) sum([(ibits(i, j, 1), j = 0, 2)])
end

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

@_QQcl.28623329 = linkonce constant [4 x i8] c"(b3)"
@_QQcl.b352ac37f0b9a4a39920063767fc3b16 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6574/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: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

define void @_QQmain() local_unnamed_addr {
.lr.ph.i.preheader:
  %0 = alloca i32, align 4
  %1 = tail call ptr @_FortranAioBeginExternalFormattedInput(ptr nonnull @_QQcl.28623329, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.b352ac37f0b9a4a39920063767fc3b16, i32 2)
  %2 = call i1 @_FortranAioInputInteger(ptr %1, ptr nonnull %0, i32 4)
  %3 = call i32 @_FortranAioEndIoStatement(ptr %1)
  %4 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.b352ac37f0b9a4a39920063767fc3b16, i32 3)
  %5 = call dereferenceable_or_null(12) ptr @malloc(i64 12)
  %6 = load i32, ptr %0, align 4, !tbaa !3
  %7 = and i32 %6, 1
  store i32 %7, ptr %5, align 4, !tbaa !3
  %8 = lshr i32 %6, 1
  %9 = and i32 %8, 1
  %10 = getelementptr [3 x i32], ptr %5, i64 0, i64 1
  store i32 %9, ptr %10, align 4, !tbaa !3
  %11 = call dereferenceable_or_null(24) ptr @realloc(ptr nonnull %5, i64 24)
  %12 = lshr i32 %6, 2
  %13 = and i32 %12, 1
  %14 = load i32, ptr %11, align 4, !tbaa !3
  %15 = getelementptr i32, ptr %11, i64 1
  %16 = load i32, ptr %15, align 4, !tbaa !3
  %17 = add i32 %16, %14
  %18 = add i32 %13, %17
  %19 = call i1 @_FortranAioOutputInteger32(ptr %4, i32 %18)
  call void @free(ptr %11)
  %20 = call i32 @_FortranAioEndIoStatement(ptr %4)
  ret void
}

declare ptr @_FortranAioBeginExternalFormattedInput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

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

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture, i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #2 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }

!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"}
