#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 */

/* Variables and functions */
scalar_t__ atoi(char *);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ normalize_cov(double *, int, int);
int /*<<< orphan*/ normalize_cov_I(double *, int, int);
int /*<<< orphan*/ normalize_lines(double *, int, int);
int /*<<< orphan*/ normalize_mean_I(double *, int, int);
int /*<<< orphan*/ read_data_double(char *, int, int, double *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ write_data_double(char *, int, int, double *);
int main(int argc, char *argv[]) {
  char input_file[512];
  char output_file1[512];
  char output_file2[512];
  char output_file3[512];
  char output_file4[512];
  int N, M;
  double *data;
  strcpy(input_file, argv[1]);
  N = (int)atoi(argv[2]);
  M = (int)atoi(argv[3]);
  strcpy(output_file1, argv[4]);
  strcpy(output_file2, argv[5]);
  strcpy(output_file3, argv[6]);
  strcpy(output_file4, argv[7]);
  data = (double *)malloc(N * M * sizeof(double));
  read_data_double(input_file, N, M, data);
  normalize_cov(data, N, M);
  write_data_double(output_file1, N, M, data);
  normalize_cov_I(data, N, M);
  write_data_double(output_file3, N, M, data);
  normalize_lines(data, N, M);
  write_data_double(output_file2, N, M, data);
  normalize_mean_I(data, N, M);
  write_data_double(output_file4, N, M, data);
  free(data);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0xa14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0xa18(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
call   1040 <strcpy@plt>
lea    -0x610(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rsi
call   1040 <strcpy@plt>
lea    -0x810(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rsi
call   1040 <strcpy@plt>
lea    -0xa10(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0xa14(%rbp),%eax
imul   -0xa18(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0xa20(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0xa14(%rbp),%esi
mov    -0xa18(%rbp),%edx
mov    -0xa20(%rbp),%rcx
call   1050 <read_data_double@plt>
mov    -0xa20(%rbp),%rdi
mov    -0xa14(%rbp),%esi
mov    -0xa18(%rbp),%edx
call   10c0 <normalize_cov@plt>
lea    -0x410(%rbp),%rdi
mov    -0xa14(%rbp),%esi
mov    -0xa18(%rbp),%edx
mov    -0xa20(%rbp),%rcx
call   1090 <write_data_double@plt>
mov    -0xa20(%rbp),%rdi
mov    -0xa14(%rbp),%esi
mov    -0xa18(%rbp),%edx
call   1060 <normalize_cov_I@plt>
lea    -0x810(%rbp),%rdi
mov    -0xa14(%rbp),%esi
mov    -0xa18(%rbp),%edx
mov    -0xa20(%rbp),%rcx
call   1090 <write_data_double@plt>
mov    -0xa20(%rbp),%rdi
mov    -0xa14(%rbp),%esi
mov    -0xa18(%rbp),%edx
call   1080 <normalize_lines@plt>
lea    -0x610(%rbp),%rdi
mov    -0xa14(%rbp),%esi
mov    -0xa18(%rbp),%edx
mov    -0xa20(%rbp),%rcx
call   1090 <write_data_double@plt>
mov    -0xa20(%rbp),%rdi
mov    -0xa14(%rbp),%esi
mov    -0xa18(%rbp),%edx
call   10a0 <normalize_mean_I@plt>
lea    -0xa10(%rbp),%rdi
mov    -0xa14(%rbp),%esi
mov    -0xa18(%rbp),%edx
mov    -0xa20(%rbp),%rcx
call   1090 <write_data_double@plt>
mov    -0xa20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0xa20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa08,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0x800(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    0x10(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %rax,%r14
mov    0x18(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %rax,%r13
mov    0x20(%rbx),%rsi
lea    0x600(%rsp),%r15
mov    %r15,%rdi
call   1040 <strcpy@plt>
mov    0x28(%rbx),%rsi
lea    0x200(%rsp),%rdi
call   1040 <strcpy@plt>
mov    0x30(%rbx),%rsi
lea    0x400(%rsp),%r12
mov    %r12,%rdi
call   1040 <strcpy@plt>
mov    0x38(%rbx),%rsi
mov    %rsp,%rdi
call   1040 <strcpy@plt>
mov    %r13d,%edi
imul   %r14d,%edi
shl    $0x3,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %r13d,%edx
mov    %rax,%rcx
call   1050 <read_data_double@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r13d,%edx
call   10c0 <normalize_cov@plt>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %r13d,%edx
mov    %rbx,%rcx
call   1090 <write_data_double@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r13d,%edx
call   1060 <normalize_cov_I@plt>
mov    %r12,%rdi
mov    %r14d,%esi
mov    %r13d,%edx
mov    %rbx,%rcx
call   1090 <write_data_double@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r13d,%edx
call   1080 <normalize_lines@plt>
lea    0x200(%rsp),%rdi
mov    %r14d,%esi
mov    %r13d,%edx
mov    %rbx,%rcx
call   1090 <write_data_double@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r13d,%edx
call   10a0 <normalize_mean_I@plt>
mov    %rsp,%rdi
mov    %r14d,%esi
mov    %r13d,%edx
mov    %rbx,%rcx
call   1090 <write_data_double@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0xa08,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [512 x i8]
%7 = alloca [512 x i8]
%8 = alloca [512 x i8]
%9 = alloca [512 x i8]
%10 = alloca [512 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @strcpy(i8* %14, i8* %17)
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i64 @atoi(i8* %21)
%23 = trunc i64 %22 to i32
store i32 %23, i32* %11
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call i64 @atoi(i8* %26)
%28 = trunc i64 %27 to i32
store i32 %28, i32* %12
%29 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 4
%32 = load i8*, i8** %31
%33 = call i32 @strcpy(i8* %29, i8* %32)
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 5
%37 = load i8*, i8** %36
%38 = call i32 @strcpy(i8* %34, i8* %37)
%39 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 6
%42 = load i8*, i8** %41
%43 = call i32 @strcpy(i8* %39, i8* %42)
%44 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 7
%47 = load i8*, i8** %46
%48 = call i32 @strcpy(i8* %44, i8* %47)
%49 = load i32, i32* %11
%50 = load i32, i32* %12
%51 = mul nsw i32 %49, %50
%52 = sext i32 %51 to i64
%53 = mul i64 %52, 8
%54 = trunc i64 %53 to i32
%55 = call i64 @malloc(i32 %54)
%56 = inttoptr i64 %55 to double*
store double* %56, double** %13
%57 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%58 = load i32, i32* %11
%59 = load i32, i32* %12
%60 = load double*, double** %13
%61 = call i32 @read_data_double(i8* %57, i32 %58, i32 %59, double* %60)
%62 = load double*, double** %13
%63 = load i32, i32* %11
%64 = load i32, i32* %12
%65 = call i32 @normalize_cov(double* %62, i32 %63, i32 %64)
%66 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%67 = load i32, i32* %11
%68 = load i32, i32* %12
%69 = load double*, double** %13
%70 = call i32 @write_data_double(i8* %66, i32 %67, i32 %68, double* %69)
%71 = load double*, double** %13
%72 = load i32, i32* %11
%73 = load i32, i32* %12
%74 = call i32 @normalize_cov_I(double* %71, i32 %72, i32 %73)
%75 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%76 = load i32, i32* %11
%77 = load i32, i32* %12
%78 = load double*, double** %13
%79 = call i32 @write_data_double(i8* %75, i32 %76, i32 %77, double* %78)
%80 = load double*, double** %13
%81 = load i32, i32* %11
%82 = load i32, i32* %12
%83 = call i32 @normalize_lines(double* %80, i32 %81, i32 %82)
%84 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%85 = load i32, i32* %11
%86 = load i32, i32* %12
%87 = load double*, double** %13
%88 = call i32 @write_data_double(i8* %84, i32 %85, i32 %86, double* %87)
%89 = load double*, double** %13
%90 = load i32, i32* %11
%91 = load i32, i32* %12
%92 = call i32 @normalize_mean_I(double* %89, i32 %90, i32 %91)
%93 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%94 = load i32, i32* %11
%95 = load i32, i32* %12
%96 = load double*, double** %13
%97 = call i32 @write_data_double(i8* %93, i32 %94, i32 %95, double* %96)
%98 = load double*, double** %13
%99 = call i32 @free(double* %98)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = alloca [512 x i8]
%6 = alloca [512 x i8]
%7 = alloca [512 x i8]
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strcpy(i8* %8, i8* %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = call i64 @atoi(i8* %17)
%19 = trunc i64 %18 to i32
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = call i64 @atoi(i8* %21)
%23 = trunc i64 %22 to i32
%24 = getelementptr inbounds i8*, i8** %1, i64 4
%25 = load i8*, i8** %24
%26 = call i32 @strcpy(i8* %9, i8* %25)
%27 = getelementptr inbounds i8*, i8** %1, i64 5
%28 = load i8*, i8** %27
%29 = call i32 @strcpy(i8* %10, i8* %28)
%30 = getelementptr inbounds i8*, i8** %1, i64 6
%31 = load i8*, i8** %30
%32 = call i32 @strcpy(i8* %11, i8* %31)
%33 = getelementptr inbounds i8*, i8** %1, i64 7
%34 = load i8*, i8** %33
%35 = call i32 @strcpy(i8* %12, i8* %34)
%36 = mul i64 %22, %18
%37 = trunc i64 %36 to i32
%38 = shl i32 %37, 3
%39 = call i64 @malloc(i32 %38)
%40 = inttoptr i64 %39 to double*
%41 = call i32 @read_data_double(i8* %8, i32 %19, i32 %23, double* %40)
%42 = call i32 @normalize_cov(double* %40, i32 %19, i32 %23)
%43 = call i32 @write_data_double(i8* %9, i32 %19, i32 %23, double* %40)
%44 = call i32 @normalize_cov_I(double* %40, i32 %19, i32 %23)
%45 = call i32 @write_data_double(i8* %11, i32 %19, i32 %23, double* %40)
%46 = call i32 @normalize_lines(double* %40, i32 %19, i32 %23)
%47 = call i32 @write_data_double(i8* %10, i32 %19, i32 %23, double* %40)
%48 = call i32 @normalize_mean_I(double* %40, i32 %19, i32 %23)
%49 = call i32 @write_data_double(i8* %12, i32 %19, i32 %23, double* %40)
%50 = call i32 @free(double* %40)
ret i32 0
}