#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(float *);
scalar_t__ malloc(int);
int /*<<< orphan*/ print_data_float(float *, int, int);
int /*<<< orphan*/ read_data_float(char *, int, int, float *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ write_data_float(char *, int, int, float *);
int main(int argc, char *argv[]) {
  char input_file[512];
  char output_file1[512];
  int N, M;
  float *data;
  strcpy(input_file, argv[1]);
  N = (int)atoi(argv[2]);
  M = (int)atoi(argv[3]);
  strcpy(output_file1, argv[4]);
  data = (float *)malloc(N * M * sizeof(float));
  read_data_float(input_file, N, M, data);
  write_data_float(output_file1, N, M, data);
  print_data_float(data, N, M);
  free(data);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%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   1080 <atoi@plt>
mov    %eax,-0x414(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x414(%rbp),%eax
imul   -0x418(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x420(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x414(%rbp),%esi
mov    -0x418(%rbp),%edx
mov    -0x420(%rbp),%rcx
call   1090 <read_data_float@plt>
lea    -0x410(%rbp),%rdi
mov    -0x414(%rbp),%esi
mov    -0x418(%rbp),%edx
mov    -0x420(%rbp),%rcx
call   1050 <write_data_float@plt>
mov    -0x420(%rbp),%rdi
mov    -0x414(%rbp),%esi
mov    -0x418(%rbp),%edx
call   1070 <print_data_float@plt>
mov    -0x420(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0x200(%rsp),%r14
mov    %r14,%rdi
call   1040 <strcpy@plt>
mov    0x10(%rbx),%rdi
call   1080 <atoi@plt>
mov    %rax,%r15
mov    0x18(%rbx),%rdi
call   1080 <atoi@plt>
mov    %rax,%r12
mov    0x20(%rbx),%rsi
mov    %rsp,%r13
mov    %r13,%rdi
call   1040 <strcpy@plt>
mov    %r12d,%edi
imul   %r15d,%edi
shl    $0x2,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %rax,%rcx
call   1090 <read_data_float@plt>
mov    %r13,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %rbx,%rcx
call   1050 <write_data_float@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
call   1070 <print_data_float@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
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 i32
%9 = alloca i32
%10 = alloca float*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strcpy(i8* %11, i8* %14)
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = call i64 @atoi(i8* %18)
%20 = trunc i64 %19 to i32
store i32 %20, i32* %8
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 3
%23 = load i8*, i8** %22
%24 = call i64 @atoi(i8* %23)
%25 = trunc i64 %24 to i32
store i32 %25, i32* %9
%26 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 4
%29 = load i8*, i8** %28
%30 = call i32 @strcpy(i8* %26, i8* %29)
%31 = load i32, i32* %8
%32 = load i32, i32* %9
%33 = mul nsw i32 %31, %32
%34 = sext i32 %33 to i64
%35 = mul i64 %34, 4
%36 = trunc i64 %35 to i32
%37 = call i64 @malloc(i32 %36)
%38 = inttoptr i64 %37 to float*
store float* %38, float** %10
%39 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%40 = load i32, i32* %8
%41 = load i32, i32* %9
%42 = load float*, float** %10
%43 = call i32 @read_data_float(i8* %39, i32 %40, i32 %41, float* %42)
%44 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%45 = load i32, i32* %8
%46 = load i32, i32* %9
%47 = load float*, float** %10
%48 = call i32 @write_data_float(i8* %44, i32 %45, i32 %46, float* %47)
%49 = load float*, float** %10
%50 = load i32, i32* %8
%51 = load i32, i32* %9
%52 = call i32 @print_data_float(float* %49, i32 %50, i32 %51)
%53 = load float*, float** %10
%54 = call i32 @free(float* %53)
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 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @strcpy(i8* %5, i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = call i64 @atoi(i8* %11)
%13 = trunc i64 %12 to i32
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = call i64 @atoi(i8* %15)
%17 = trunc i64 %16 to i32
%18 = getelementptr inbounds i8*, i8** %1, i64 4
%19 = load i8*, i8** %18
%20 = call i32 @strcpy(i8* %6, i8* %19)
%21 = mul i64 %16, %12
%22 = trunc i64 %21 to i32
%23 = shl i32 %22, 2
%24 = call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to float*
%26 = call i32 @read_data_float(i8* %5, i32 %13, i32 %17, float* %25)
%27 = call i32 @write_data_float(i8* %6, i32 %13, i32 %17, float* %25)
%28 = call i32 @print_data_float(float* %25, i32 %13, i32 %17)
%29 = call i32 @free(float* %25)
ret i32 0
}