#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 */
scalar_t__ atof(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen_read(char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
char *strtok(char *, char *);
int /*<<< orphan*/ test_column(char *, int /*<<< orphan*/ *, int, int, int,
                               char *);
int /*<<< orphan*/ test_line(char *, int /*<<< orphan*/ *, int, int);
void read_data_int(char *file_data, int N, int M, int *dat) {
  FILE *m_File = NULL;
  int i = 0;
  int j = 0;
  int max_char_per_line = 5 * M + 20;
  char *szbuff;
  char *token;
  szbuff = (char *)malloc(max_char_per_line * sizeof(char));
  m_File = fopen_read(file_data);
  i = 0;
  while (fgets(szbuff, max_char_per_line, m_File) && (i < N)) {
    j = 0;
    token = strtok(szbuff, " \t\n");
    while (token && j < M) {
      dat[i * M + j] = (int)atof(token);
      token = strtok(NULL, " \t\n");
      j++;
    }
    i++;
    test_column(file_data, m_File, j, i, M, token);
  }
  test_line(file_data, m_File, i, N);
  fclose(m_File);
  free(szbuff);
}


x86 assembly (clang, -O0):
<read_data_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
imul   $0x5,-0x10(%rbp),%eax
add    $0x14,%eax
mov    %eax,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <fopen_read@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1060 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x41(%rbp)
je     121b <read_data_int+0x8b>
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    122b <read_data_int+0x9b>
jmp    12dc <read_data_int+0x14c>
movl   $0x0,-0x28(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x40(%rbp)
mov    %al,-0x42(%rbp)
je     1262 <read_data_int+0xd2>
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
setl   %al
mov    %al,-0x42(%rbp)
mov    -0x42(%rbp),%al
test   $0x1,%al
jne    1272 <read_data_int+0xe2>
jmp    12b3 <read_data_int+0x123>
mov    -0x40(%rbp),%rdi
call   1040 <atof@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
xor    %eax,%eax
mov    %eax,%edi
lea    0xd64(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1246 <read_data_int+0xb6>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x40(%rbp),%r9
call   1080 <test_column@plt>
jmp    11ed <read_data_int+0x5d>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   10b0 <test_line@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_data_int>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,%rbx
mov    %esi,%r14d
mov    %rdi,%r15
mov    %rdx,(%rsp)
lea    (%rdx,%rdx,4),%ebp
add    $0x14,%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%r13
mov    %r15,0x18(%rsp)
mov    %r15,%rdi
call   1090 <fopen_read@plt>
mov    %r13,%rdi
mov    %ebp,0xc(%rsp)
mov    %ebp,%esi
mov    %rax,0x10(%rsp)
mov    %rax,%rdx
call   1060 <fgets@plt>
xor    %r15d,%r15d
test   %r14d,%r14d
jle    12cf <read_data_int+0x13f>
test   %rax,%rax
je     12cf <read_data_int+0x13f>
movslq (%rsp),%r12
mov    %r14d,0x8(%rsp)
mov    %r14d,%eax
mov    %rax,0x28(%rsp)
lea    0x0(,%r12,4),%rax
mov    %rax,0x20(%rsp)
xor    %r15d,%r15d
lea    0xde5(%rip),%r14
mov    %r13,0x30(%rsp)
mov    0x10(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    %r14,%rsi
call   10a0 <strtok@plt>
test   %rax,%rax
je     1280 <read_data_int+0xf0>
cmpl   $0x0,(%rsp)
jle    1280 <read_data_int+0xf0>
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    %rax,%rdi
call   1040 <atof@plt>
mov    %eax,(%rbx,%r13,4)
xor    %edi,%edi
mov    %r14,%rsi
call   10a0 <strtok@plt>
add    $0x1,%r13
test   %rax,%rax
je     1283 <read_data_int+0xf3>
cmp    %r12,%r13
jl     1250 <read_data_int+0xc0>
jmp    1283 <read_data_int+0xf3>
cs nopw 0x0(%rax,%rax,1)
xor    %r13d,%r13d
add    $0x1,%r15
mov    0x18(%rsp),%rdi
mov    %rbp,%rsi
mov    %r13d,%edx
mov    %r15d,%ecx
mov    (%rsp),%r8
mov    %rax,%r9
call   1080 <test_column@plt>
mov    0x30(%rsp),%r13
mov    %r13,%rdi
mov    0xc(%rsp),%esi
mov    %rbp,%rdx
call   1060 <fgets@plt>
cmp    0x28(%rsp),%r15
jae    12ca <read_data_int+0x13a>
add    0x20(%rsp),%rbx
test   %rax,%rax
jne    1230 <read_data_int+0xa0>
mov    0x8(%rsp),%r14d
mov    0x18(%rsp),%rdi
mov    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14d,%ecx
call   10b0 <test_line@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r13,%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [4 x i8] c" \09\0A\00"
define void @read_data_int(i8* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
store i32* null, i32** %9
store i32 0, i32* %10
store i32 0, i32* %11
%15 = load i32, i32* %7
%16 = mul nsw i32 5, %15
%17 = add nsw i32 %16, 20
store i32 %17, i32* %12
%18 = load i32, i32* %12
%19 = sext i32 %18 to i64
%20 = mul i64 %19, 1
%21 = trunc i64 %20 to i32
%22 = call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %13
%24 = load i8*, i8** %5
%25 = call i32* @fopen_read(i8* %24)
store i32* %25, i32** %9
store i32 0, i32* %10
br label %26
26: ; preds = %65, %4
%27 = load i8*, i8** %13
%28 = load i32, i32* %12
%29 = load i32*, i32** %9
%30 = call i64 @fgets(i8* %27, i32 %28, i32* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %26
%33 = load i32, i32* %10
%34 = load i32, i32* %6
%35 = icmp slt i32 %33, %34
br label %36
36: ; preds = %32, %26
%37 = phi i1 [ false, %26 ], [ %35, %32 ]
br i1 %37, label %38, label %75
38: ; preds = %36
store i32 0, i32* %11
%39 = load i8*, i8** %13
%40 = call i8* @strtok(i8* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %40, i8** %14
br label %41
41: ; preds = %50, %38
%42 = load i8*, i8** %14
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = load i32, i32* %11
%46 = load i32, i32* %7
%47 = icmp slt i32 %45, %46
br label %48
48: ; preds = %44, %41
%49 = phi i1 [ false, %41 ], [ %47, %44 ]
br i1 %49, label %50, label %65
50: ; preds = %48
%51 = load i8*, i8** %14
%52 = call i64 @atof(i8* %51)
%53 = trunc i64 %52 to i32
%54 = load i32*, i32** %8
%55 = load i32, i32* %10
%56 = load i32, i32* %7
%57 = mul nsw i32 %55, %56
%58 = load i32, i32* %11
%59 = add nsw i32 %57, %58
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %54, i64 %60
store i32 %53, i32* %61
%62 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %62, i8** %14
%63 = load i32, i32* %11
%64 = add nsw i32 %63, 1
store i32 %64, i32* %11
br label %41
65: ; preds = %48
%66 = load i32, i32* %10
%67 = add nsw i32 %66, 1
store i32 %67, i32* %10
%68 = load i8*, i8** %5
%69 = load i32*, i32** %9
%70 = load i32, i32* %11
%71 = load i32, i32* %10
%72 = load i32, i32* %7
%73 = load i8*, i8** %14
%74 = call i32 @test_column(i8* %68, i32* %69, i32 %70, i32 %71, i32 %72, i8* %73)
br label %26
75: ; preds = %36
%76 = load i8*, i8** %5
%77 = load i32*, i32** %9
%78 = load i32, i32* %10
%79 = load i32, i32* %6
%80 = call i32 @test_line(i8* %76, i32* %77, i32 %78, i32 %79)
%81 = load i32*, i32** %9
%82 = call i32 @fclose(i32* %81)
%83 = load i8*, i8** %13
%84 = call i32 @free(i8* %83)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" \09\0A\00"
define void @read_data_int(i8* %0, i32 %1, i32 %2, i32* nocapture writeonly %3) {
%5 = mul nsw i32 %2, 5
%6 = add nsw i32 %5, 20
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32* @fopen_read(i8* %0)
%10 = tail call i64 @fgets(i8* %8, i32 %6, i32* %9)
%11 = icmp ne i64 %10, 0
%12 = icmp sgt i32 %1, 0
%13 = and i1 %12, %11
br i1 %13, label %14, label %51
14: ; preds = %4
%15 = icmp sgt i32 %2, 0
%16 = sext i32 %2 to i64
%17 = zext i32 %1 to i64
br label %18
18: ; preds = %14, %39
%19 = phi i64 [ 0, %14 ], [ %42, %39 ]
%20 = tail call i8* @strtok(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i8* %20, null
%22 = and i1 %21, %15
br i1 %22, label %23, label %39
23: ; preds = %18
%24 = mul nsw i64 %19, %16
br label %25
25: ; preds = %23, %25
%26 = phi i64 [ 0, %23 ], [ %33, %25 ]
%27 = phi i8* [ %20, %23 ], [ %32, %25 ]
%28 = tail call i64 @atof(i8* %27)
%29 = trunc i64 %28 to i32
%30 = add nsw i64 %26, %24
%31 = getelementptr inbounds i32, i32* %3, i64 %30
store i32 %29, i32* %31
%32 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%33 = add nuw nsw i64 %26, 1
%34 = icmp ne i8* %32, null
%35 = icmp slt i64 %33, %16
%36 = select i1 %34, i1 %35, i1 false
br i1 %36, label %25, label %37
37: ; preds = %25
%38 = trunc i64 %33 to i32
br label %39
39: ; preds = %37, %18
%40 = phi i32 [ 0, %18 ], [ %38, %37 ]
%41 = phi i8* [ %20, %18 ], [ %32, %37 ]
%42 = add nuw nsw i64 %19, 1
%43 = trunc i64 %42 to i32
%44 = tail call i32 @test_column(i8* %0, i32* %9, i32 %40, i32 %43, i32 %2, i8* %41)
%45 = tail call i64 @fgets(i8* %8, i32 %6, i32* %9)
%46 = icmp ne i64 %45, 0
%47 = icmp ult i64 %42, %17
%48 = and i1 %47, %46
br i1 %48, label %18, label %49
49: ; preds = %39
%50 = trunc i64 %42 to i32
br label %51
51: ; preds = %49, %4
%52 = phi i32 [ 0, %4 ], [ %50, %49 ]
%53 = tail call i32 @test_line(i8* %0, i32* %9, i32 %52, i32 %1)
%54 = tail call i32 @fclose(i32* %9)
%55 = tail call i32 @free(i8* %8)
ret void
}