#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__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read_geno(char *, int *, int, int);
int main(int argc, char *argv[]) {
  int i, j;
  int *lines = (int *)malloc(20000 * 1092 * sizeof(int));
  int N = 1092;
  int M = 20000;
  read_geno(argv[1], lines, 1092, 20000);
  for (i = 0; i < N; i++) {
    printf("%d 1 0 0 1 2", i);
    for (j = 0; j < M; j++) {
      if (lines[i * M + j] == 0)
        printf(" 0 0");
      else if (lines[i * M + j] == 1)
        printf(" 0 1");
      else
        printf(" 1 1");
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x5350200,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x444,-0x24(%rbp)
movl   $0x4e20,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x444,%edx
mov    $0x4e20,%ecx
call   1030 <read_geno@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1252 <main+0x122>
mov    -0x14(%rbp),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1236 <main+0x106>
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x28(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    11e2 <main+0xb2>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1223 <main+0xf3>
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x28(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    1210 <main+0xe0>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121e <main+0xee>
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1223 <main+0xf3>
jmp    1228 <main+0xf8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a8 <main+0x78>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1184 <main+0x54>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    $0x5350200,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    0x8(%r14),%rdi
mov    %rax,%rsi
mov    $0x444,%edx
mov    $0x4e20,%ecx
call   1030 <read_geno@plt>
lea    0xe9a(%rip),%r12
lea    0xe98(%rip),%r13
lea    0xe87(%rip),%rbp
xor    %r15d,%r15d
jmp    11ae <main+0x6e>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0x1,%r15
add    $0x13880,%rbx
cmp    $0x444,%r15
je     11fb <main+0xbb>
lea    0xe4b(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %r14d,%r14d
jmp    11ea <main+0xaa>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %eax,%eax
cmove  %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
cmp    $0x4e20,%r14
je     1190 <main+0x50>
mov    (%rbx,%r14,4),%eax
mov    %r12,%rdi
cmp    $0x1,%eax
je     11d0 <main+0x90>
mov    %r13,%rdi
jmp    11d0 <main+0x90>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%d 1 0 0 1 2\00"
@.str.1 = [5 x i8] c" 0 0\00"
@.str.2 = [5 x i8] c" 0 1\00"
@.str.3 = [5 x i8] c" 1 1\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i64 @malloc(i32 87360000)
%12 = inttoptr i64 %11 to i32*
store i32* %12, i32** %8
store i32 1092, i32* %9
store i32 20000, i32* %10
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = load i32*, i32** %8
%17 = call i32 @read_geno(i8* %15, i32* %16, i32 1092, i32 20000)
store i32 0, i32* %6
br label %18
18: ; preds = %64, %2
%19 = load i32, i32* %6
%20 = load i32, i32* %9
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %67
22: ; preds = %18
%23 = load i32, i32* %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %23)
store i32 0, i32* %7
br label %25
25: ; preds = %59, %22
%26 = load i32, i32* %7
%27 = load i32, i32* %10
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %62
29: ; preds = %25
%30 = load i32*, i32** %8
%31 = load i32, i32* %6
%32 = load i32, i32* %10
%33 = mul nsw i32 %31, %32
%34 = load i32, i32* %7
%35 = add nsw i32 %33, %34
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %30, i64 %36
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %29
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %58
42: ; preds = %29
%43 = load i32*, i32** %8
%44 = load i32, i32* %6
%45 = load i32, i32* %10
%46 = mul nsw i32 %44, %45
%47 = load i32, i32* %7
%48 = add nsw i32 %46, %47
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %43, i64 %49
%51 = load i32, i32* %50
%52 = icmp eq i32 %51, 1
br i1 %52, label %53, label %55
53: ; preds = %42
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %57
55: ; preds = %42
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %57
57: ; preds = %55, %53
br label %58
58: ; preds = %57, %40
br label %59
59: ; preds = %58
%60 = load i32, i32* %7
%61 = add nsw i32 %60, 1
store i32 %61, i32* %7
br label %25
62: ; preds = %25
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %64
64: ; preds = %62
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %18
67: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"%d 1 0 0 1 2\00"
@.str.1 = [5 x i8] c" 0 0\00"
@.str.2 = [5 x i8] c" 0 1\00"
@.str.3 = [5 x i8] c" 1 1\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @malloc(i32 87360000)
%4 = inttoptr i64 %3 to i32*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @read_geno(i8* %6, i32* %4, i32 1092, i32 20000)
br label %8
8: ; preds = %2, %25
%9 = phi i64 [ 0, %2 ], [ %27, %25 ]
%10 = trunc i64 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = mul nuw nsw i64 %9, 20000
br label %13
13: ; preds = %8, %13
%14 = phi i64 [ 0, %8 ], [ %23, %13 ]
%15 = add nuw nsw i64 %14, %12
%16 = getelementptr inbounds i32, i32* %4, i64 %15
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 1
%19 = select i1 %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%20 = icmp eq i32 %17, 0
%21 = select i1 %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %19
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %21)
%23 = add nuw nsw i64 %14, 1
%24 = icmp eq i64 %23, 20000
br i1 %24, label %25, label %13
25: ; preds = %13
%26 = tail call i32 @putchar(i32 10)
%27 = add nuw nsw i64 %9, 1
%28 = icmp eq i64 %27, 1092
br i1 %28, label %29, label %8
29: ; preds = %25
ret i32 0
}