#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 */
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ merge(int **, int *);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int a[4][5] = {
      {1, 3, 5, 6, 5}, {0, 7, 5, 3, 2}, {4, 3, 2, 1, 9}, {-1, 3, 6, 7, -6}};
  int out[5 * 4];
  memset(out, 0, 5 * 4);
  merge(a, out);
  for (int i = 0; i < 5 * 4; i++) {
    printf("%d ", out[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
lea    -0x50(%rbp),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
lea    -0x50(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1060 <merge@plt>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x14,-0xa4(%rbp)
jge    11c8 <main+0x88>
movslq -0xa4(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    118d <main+0x4d>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xa0,%rsp
movaps 0xf01(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
lea    0x50(%rsp),%rdi
mov    %rbx,%rsi
call   1050 <merge@plt>
mov    (%rsp),%esi
lea    0xead(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [4 x [5 x i32]] [[5 x i32] [i32 1, i32 3, i32 5, i32 6, i32 5], [5 x i32] [i32 0, i32 7, i32 5, i32 3, i32 2], [5 x i32] [i32 4, i32 3, i32 2, i32 1, i32 9], [5 x i32] [i32 -1, i32 3, i32 6, i32 7, i32 -6]]
@.str = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca [4 x [5 x i32]]
%2 = alloca [20 x i32]
%3 = alloca i32
%4 = bitcast [4 x [5 x i32]]* %1 to i8*
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%6 = call i32 @memset(i32* %5, i32 0, i32 20)
%7 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %1, i64 0, i64 0
%8 = bitcast [5 x i32]* %7 to i32**
%9 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%10 = call i32 @merge(i32** %8, i32* %9)
store i32 0, i32* %3
br label %11
11: ; preds = %20, %0
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 20
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %14
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %11
23: ; preds = %11
ret void
}

LLVM IR (-O2):
@__const.main.a = [4 x [5 x i32]] [[5 x i32] [i32 1, i32 3, i32 5, i32 6, i32 5], [5 x i32] [i32 0, i32 7, i32 5, i32 3, i32 2], [5 x i32] [i32 4, i32 3, i32 2, i32 1, i32 9], [5 x i32] [i32 -1, i32 3, i32 6, i32 7, i32 -6]]
@.str = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca [4 x [5 x i32]]
%2 = alloca [20 x i32]
%3 = bitcast [4 x [5 x i32]]* %1 to i8*
%4 = bitcast [20 x i32]* %2 to i8*
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%6 = call i32 @memset(i32* %5, i32 0, i32 20)
%7 = bitcast [4 x [5 x i32]]* %1 to i32**
%8 = call i32 @merge(i32** %7, i32* %5)
%9 = load i32, i32* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 1
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 2
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 3
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 4
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 5
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 6
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 7
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 8
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 9
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 10
%39 = load i32, i32* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 11
%42 = load i32, i32* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 12
%45 = load i32, i32* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 13
%48 = load i32, i32* %47
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 14
%51 = load i32, i32* %50
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 15
%54 = load i32, i32* %53
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %54)
%56 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 16
%57 = load i32, i32* %56
%58 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 17
%60 = load i32, i32* %59
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %60)
%62 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 18
%63 = load i32, i32* %62
%64 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %63)
%65 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 19
%66 = load i32, i32* %65
%67 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %66)
ret void
}