#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__ calloc(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fill_line_geno(int *, int, int, int, char *,
                                  int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ *fopen_read(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ test_line(char *, int /*<<< orphan*/ *, int, int);
void read_geno(char *input_file, int *data, int N, int M) {
  FILE *m_File = NULL;
  int j = 0;
  char *szbuff = (char *)calloc(5 * N, sizeof(char));
  int max_char_per_line = 5 * N;
  int warning = 0;
  m_File = fopen_read(input_file);
  while (fgets(szbuff, max_char_per_line, m_File) && (j < M)) {
    fill_line_geno(data, M, N, j, input_file, m_File, szbuff, &warning);
    j++;
  }
  test_line(input_file, m_File, j, M);
  fclose(m_File);
  free(szbuff);
}


x86 assembly (clang, -O0):
<read_geno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
imul   $0x5,-0x14(%rbp),%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,-0x30(%rbp)
imul   $0x5,-0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <fopen_read@plt>
mov    %rax,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1060 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x39(%rbp)
je     11f0 <read_geno+0x80>
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
setl   %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    1200 <read_geno+0x90>
jmp    1239 <read_geno+0xc9>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x8(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    -0x30(%rbp),%r10
lea    -0x38(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <fill_line_geno@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c2 <read_geno+0x52>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1090 <test_line@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_geno>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r13d
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbp
mov    %rdx,0x10(%rsp)
lea    (%rdx,%rdx,4),%r12d
mov    %r12d,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,%rbx
movl   $0x0,0x4(%rsp)
mov    %rbp,%r15
mov    %rbp,%rdi
call   1080 <fopen_read@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     1222 <read_geno+0xb2>
test   %r13d,%r13d
jle    1222 <read_geno+0xb2>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
mov    0x8(%rsp),%rdi
mov    %r13d,%esi
mov    0x10(%rsp),%rdx
mov    %r14d,%ecx
mov    %r15,%r8
mov    %rbp,%r9
lea    0x4(%rsp),%rax
push   %rax
push   %rbx
call   1040 <fill_line_geno@plt>
add    $0x10,%rsp
add    $0x1,%r14d
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %rbp,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1222 <read_geno+0xb2>
cmp    %r13d,%r14d
jl     11e0 <read_geno+0x70>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
mov    %r13d,%ecx
call   1090 <test_line@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @read_geno(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 i8*
%12 = alloca i32
%13 = alloca i32
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
%14 = load i32, i32* %7
%15 = mul nsw i32 5, %14
%16 = call i64 @calloc(i32 %15, i32 1)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %11
%18 = load i32, i32* %7
%19 = mul nsw i32 5, %18
store i32 %19, i32* %12
store i32 0, i32* %13
%20 = load i8*, i8** %5
%21 = call i32* @fopen_read(i8* %20)
store i32* %21, i32** %9
br label %22
22: ; preds = %34, %4
%23 = load i8*, i8** %11
%24 = load i32, i32* %12
%25 = load i32*, i32** %9
%26 = call i64 @fgets(i8* %23, i32 %24, i32* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %22
%29 = load i32, i32* %10
%30 = load i32, i32* %8
%31 = icmp slt i32 %29, %30
br label %32
32: ; preds = %28, %22
%33 = phi i1 [ false, %22 ], [ %31, %28 ]
br i1 %33, label %34, label %45
34: ; preds = %32
%35 = load i32*, i32** %6
%36 = load i32, i32* %8
%37 = load i32, i32* %7
%38 = load i32, i32* %10
%39 = load i8*, i8** %5
%40 = load i32*, i32** %9
%41 = load i8*, i8** %11
%42 = call i32 @fill_line_geno(i32* %35, i32 %36, i32 %37, i32 %38, i8* %39, i32* %40, i8* %41, i32* %13)
%43 = load i32, i32* %10
%44 = add nsw i32 %43, 1
store i32 %44, i32* %10
br label %22
45: ; preds = %32
%46 = load i8*, i8** %5
%47 = load i32*, i32** %9
%48 = load i32, i32* %10
%49 = load i32, i32* %8
%50 = call i32 @test_line(i8* %46, i32* %47, i32 %48, i32 %49)
%51 = load i32*, i32** %9
%52 = call i32 @fclose(i32* %51)
%53 = load i8*, i8** %11
%54 = call i32 @free(i8* %53)
ret void
}

LLVM IR (-O2):
define void @read_geno(i8* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = mul nsw i32 %2, 5
%7 = tail call i64 @calloc(i32 %6, i32 1)
%8 = inttoptr i64 %7 to i8*
%9 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = tail call i32* @fopen_read(i8* %0)
%11 = call i64 @fgets(i8* %8, i32 %6, i32* %10)
%12 = icmp ne i64 %11, 0
%13 = icmp sgt i32 %3, 0
%14 = and i1 %12, %13
br i1 %14, label %15, label %23
15: ; preds = %4, %15
%16 = phi i32 [ %18, %15 ], [ 0, %4 ]
%17 = call i32 @fill_line_geno(i32* %1, i32 %3, i32 %2, i32 %16, i8* %0, i32* %10, i8* %8, i32* %5)
%18 = add nuw nsw i32 %16, 1
%19 = call i64 @fgets(i8* %8, i32 %6, i32* %10)
%20 = icmp ne i64 %19, 0
%21 = icmp slt i32 %18, %3
%22 = select i1 %20, i1 %21, i1 false
br i1 %22, label %15, label %23
23: ; preds = %15, %4
%24 = phi i32 [ 0, %4 ], [ %18, %15 ]
%25 = call i32 @test_line(i8* %0, i32* %10, i32 %24, i32 %3)
%26 = call i32 @fclose(i32* %10)
%27 = call i32 @free(i8* %8)
ret void
}