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


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