#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(int *);
scalar_t__ isdigit(char);
int *malloc(int);
scalar_t__ strlen(char *);
int *readInfo(FILE *file) {
  const int SIZE = 8;
  int *array = malloc(sizeof(int) * SIZE);
  int index = 0;
  while (!feof(file) && index < SIZE) {
    char number[] = "\0\0\0\0";
    char digit = '\0';
    int i = 0;
    while (!feof(file) && isdigit(digit = fgetc(file)))
      number[i++] = digit;
    if (strlen(number) > 0)
      array[index++] = atoi(number);
    if (digit == '\n')
      break;
  }
  if (index < SIZE) {
    free(array);
    array = NULL;
  }
  return array;
}


x86 assembly (clang, -O0):
<readInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x8,-0xc(%rbp)
mov    $0x20,%edi
call   1090 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x29(%rbp)
jne    11cb <readInfo+0x4b>
cmpl   $0x8,-0x1c(%rbp)
setl   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    11db <readInfo+0x5b>
jmp    12a0 <readInfo+0x120>
lea    -0x21(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1060 <memset@plt>
movb   $0x0,-0x22(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x2a(%rbp)
jne    122d <readInfo+0xad>
mov    -0x8(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %al,-0x22(%rbp)
movsbl %al,%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2a(%rbp)
mov    -0x2a(%rbp),%al
test   $0x1,%al
jne    123d <readInfo+0xbd>
jmp    1256 <readInfo+0xd6>
mov    -0x22(%rbp),%cl
mov    -0x28(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
cltq
mov    %cl,-0x21(%rbp,%rax,1)
jmp    11f6 <readInfo+0x76>
lea    -0x21(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jle    1289 <readInfo+0x109>
lea    -0x21(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movsbl -0x22(%rbp),%eax
cmp    $0xa,%eax
jne    129b <readInfo+0x11b>
jmp    12a0 <readInfo+0x120>
jmp    11a8 <readInfo+0x28>
cmpl   $0x8,-0x1c(%rbp)
jge    12bb <readInfo+0x13b>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readInfo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
mov    $0x20,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
xor    %r12d,%r12d
mov    %rsp,%r15
jmp    11aa <readInfo+0x3a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0xa,%bpl
je     1249 <readInfo+0xd9>
mov    %r13,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    1249 <readInfo+0xd9>
cmp    $0x7,%r12d
jg     1249 <readInfo+0xd9>
movb   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
mov    %r13,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     11e0 <readInfo+0x70>
xor    %ebp,%ebp
jmp    1220 <readInfo+0xb0>
mov    %r15,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
call   1060 <fgetc@plt>
mov    %eax,%ebp
movsbl %al,%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     1220 <readInfo+0xb0>
mov    %bpl,(%rbx)
mov    %r13,%rdi
call   1070 <feof@plt>
add    $0x1,%rbx
test   %eax,%eax
je     11f0 <readInfo+0x80>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1050 <strlen@plt>
test   %rax,%rax
jle    11a0 <readInfo+0x30>
mov    %r15,%rdi
call   1090 <atoi@plt>
movslq %r12d,%rcx
add    $0x1,%r12d
mov    %eax,(%r14,%rcx,4)
jmp    11a0 <readInfo+0x30>
cmp    $0x7,%r12d
jg     125a <readInfo+0xea>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32* @readInfo(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [5 x i8]
%7 = alloca i8
%8 = alloca i32
store i32* %0, i32** %2
store i32 8, i32* %3
%9 = call i32* @malloc(i32 32)
store i32* %9, i32** %4
store i32 0, i32* %5
br label %10
10: ; preds = %55, %1
%11 = load i32*, i32** %2
%12 = call i32 @feof(i32* %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 8
br label %17
17: ; preds = %14, %10
%18 = phi i1 [ false, %10 ], [ %16, %14 ]
br i1 %18, label %19, label %56
19: ; preds = %17
%20 = bitcast [5 x i8]* %6 to i8*
store i8 0, i8* %7
store i32 0, i32* %8
br label %21
21: ; preds = %32, %19
%22 = load i32*, i32** %2
%23 = call i32 @feof(i32* %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %21
%26 = load i32*, i32** %2
%27 = call signext i8 @fgetc(i32* %26)
store i8 %27, i8* %7
%28 = call i64 @isdigit(i8 signext %27)
%29 = icmp ne i64 %28, 0
br label %30
30: ; preds = %25, %21
%31 = phi i1 [ false, %21 ], [ %29, %25 ]
br i1 %31, label %32, label %38
32: ; preds = %30
%33 = load i8, i8* %7
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
%36 = sext i32 %34 to i64
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 %36
store i8 %33, i8* %37
br label %21
38: ; preds = %30
%39 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%40 = call i64 @strlen(i8* %39)
%41 = icmp sgt i64 %40, 0
br i1 %41, label %42, label %50
42: ; preds = %38
%43 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%44 = call i32 @atoi(i8* %43)
%45 = load i32*, i32** %4
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
%48 = sext i32 %46 to i64
%49 = getelementptr inbounds i32, i32* %45, i64 %48
store i32 %44, i32* %49
br label %50
50: ; preds = %42, %38
%51 = load i8, i8* %7
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 10
br i1 %53, label %54, label %55
54: ; preds = %50
br label %56
55: ; preds = %50
br label %10
56: ; preds = %54, %17
%57 = load i32, i32* %5
%58 = icmp slt i32 %57, 8
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = load i32*, i32** %4
%61 = call i32 @free(i32* %60)
store i32* null, i32** %4
br label %62
62: ; preds = %59, %56
%63 = load i32*, i32** %4
ret i32* %63
}

LLVM IR (-O2):
define noalias i32* @readInfo(i32* nocapture %0) {
%2 = alloca [5 x i8]
%3 = tail call i32* @malloc(i32 32)
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %33, %1
%6 = phi i32 [ 0, %1 ], [ %34, %33 ]
%7 = tail call i32 @feof(i32* %0)
%8 = icmp eq i32 %7, 0
%9 = icmp slt i32 %6, 8
%10 = select i1 %8, i1 %9, i1 false
br i1 %10, label %11, label %36
11: ; preds = %5
%12 = tail call i32 @feof(i32* %0)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %11, %19
%15 = phi i64 [ %20, %19 ], [ 0, %11 ]
%16 = tail call signext i8 @fgetc(i32* %0)
%17 = tail call i64 @isdigit(i8 signext %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %14
%20 = add nuw i64 %15, 1
%21 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 %15
store i8 %16, i8* %21
%22 = tail call i32 @feof(i32* %0)
%23 = icmp eq i32 %22, 0
br i1 %23, label %14, label %24
24: ; preds = %14, %19, %11
%25 = phi i8 [ 0, %11 ], [ %16, %19 ], [ %16, %14 ]
%26 = call i64 @strlen(i8* %4)
%27 = icmp sgt i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = call i32 @atoi(i8* %4)
%30 = add nsw i32 %6, 1
%31 = sext i32 %6 to i64
%32 = getelementptr inbounds i32, i32* %3, i64 %31
store i32 %29, i32* %32
br label %33
33: ; preds = %28, %24
%34 = phi i32 [ %30, %28 ], [ %6, %24 ]
%35 = icmp eq i8 %25, 10
br i1 %35, label %36, label %5
36: ; preds = %33, %5
%37 = phi i32 [ %34, %33 ], [ %6, %5 ]
%38 = icmp slt i32 %37, 8
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = tail call i32 @free(i32* %3)
br label %41
41: ; preds = %39, %36
%42 = phi i32* [ null, %39 ], [ %3, %36 ]
ret i32* %42
}