#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*/ displyMatrix(int, int, int **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ transposeMatrix(int, int, int **, int **);
int main(void) {
  int matrix_ij[4][5] = {
      {1, 5, 5, 1, 0}, {9, 6, 9, 8, 2}, {8, 1, 8, 2, 5}, {9, 4, 6, 2, 0}};
  int matrix_ji[5][4];
  printf("×ªÖÃÇ°µÄ¾ØÕó:\n");
  displyMatrix(4, 5, matrix_ij);
  transposeMatrix(4, 5, matrix_ij, matrix_ji);
  printf("×ªÖÃºóµÄ¾ØÕó:\n");
  displyMatrix(5, 4, matrix_ji);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x50,%edx
call   1060 <memcpy@plt>
lea    0xee2(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdx
mov    $0x4,%edi
mov    $0x5,%esi
call   1030 <displyMatrix@plt>
lea    -0x60(%rbp),%rdx
lea    -0xb0(%rbp),%rcx
mov    $0x4,%edi
mov    $0x5,%esi
call   1050 <transposeMatrix@plt>
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    -0xb0(%rbp),%rdx
mov    $0x5,%edi
mov    $0x4,%esi
call   1030 <displyMatrix@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xa8,%rsp
movaps 0xeff(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee3(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeab(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe8f(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    $0x4,%edi
mov    $0x5,%esi
mov    %rbx,%rdx
call   1040 <displyMatrix@plt>
lea    0x50(%rsp),%r14
mov    $0x4,%edi
mov    $0x5,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1050 <transposeMatrix@plt>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
mov    $0x4,%esi
mov    %r14,%rdx
call   1040 <displyMatrix@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.matrix_ij = [4 x [5 x i32]] [[5 x i32] [i32 1, i32 5, i32 5, i32 1, i32 0], [5 x i32] [i32 9, i32 6, i32 9, i32 8, i32 2], [5 x i32] [i32 8, i32 1, i32 8, i32 2, i32 5], [5 x i32] [i32 9, i32 4, i32 6, i32 2, i32 0]]
@.str = [27 x i8] c"\C3\97\C2\AA\C3\96\C3\83\C3\87\C2\B0\C2\B5\C3\84\C2\BE\C3\98\C3\95\C3\B3:\0A\00"
@.str.1 = [27 x i8] c"\C3\97\C2\AA\C3\96\C3\83\C2\BA\C3\B3\C2\B5\C3\84\C2\BE\C3\98\C3\95\C3\B3:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x [5 x i32]]
%3 = alloca [5 x [4 x i32]]
store i32 0, i32* %1
%4 = bitcast [4 x [5 x i32]]* %2 to i8*
%5 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %2, i64 0, i64 0
%7 = bitcast [5 x i32]* %6 to i32**
%8 = call i32 @displyMatrix(i32 4, i32 5, i32** %7)
%9 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %2, i64 0, i64 0
%10 = bitcast [5 x i32]* %9 to i32**
%11 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %3, i64 0, i64 0
%12 = bitcast [4 x i32]* %11 to i32**
%13 = call i32 @transposeMatrix(i32 4, i32 5, i32** %10, i32** %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %3, i64 0, i64 0
%16 = bitcast [4 x i32]* %15 to i32**
%17 = call i32 @displyMatrix(i32 5, i32 4, i32** %16)
ret i32 0
}

LLVM IR (-O2):
@__const.main.matrix_ij = [4 x [5 x i32]] [[5 x i32] [i32 1, i32 5, i32 5, i32 1, i32 0], [5 x i32] [i32 9, i32 6, i32 9, i32 8, i32 2], [5 x i32] [i32 8, i32 1, i32 8, i32 2, i32 5], [5 x i32] [i32 9, i32 4, i32 6, i32 2, i32 0]]
@str = [26 x i8] c"\C3\97\C2\AA\C3\96\C3\83\C3\87\C2\B0\C2\B5\C3\84\C2\BE\C3\98\C3\95\C3\B3:\00"
@str.2 = [26 x i8] c"\C3\97\C2\AA\C3\96\C3\83\C2\BA\C3\B3\C2\B5\C3\84\C2\BE\C3\98\C3\95\C3\B3:\00"
define i32 @main() {
%1 = alloca [4 x [5 x i32]]
%2 = alloca [5 x [4 x i32]]
%3 = bitcast [4 x [5 x i32]]* %1 to i8*
%4 = bitcast [5 x [4 x i32]]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%6 = bitcast [4 x [5 x i32]]* %1 to i32**
%7 = call i32 @displyMatrix(i32 4, i32 5, i32** %6)
%8 = bitcast [5 x [4 x i32]]* %2 to i32**
%9 = call i32 @transposeMatrix(i32 4, i32 5, i32** %6, i32** %8)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
%11 = call i32 @displyMatrix(i32 5, i32 4, i32** %8)
ret i32 0
}