#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*/ input(int **, int, int);
int /*<<< orphan*/ output(int **, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ transpose(int **, int **, int, int);
main() {
  int a[5][5] = {0}, b[5][5] = {0}, m, n;
  printf("Enter the dimensions of the matrix:");
  scanf("%d%d", &m, &n);
  input(a, m, n);
  transpose(a, b, m, n);
  output(b, m, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    0xe64(%rip),%rdi
call   1050 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    -0xe4(%rbp),%rsi
lea    -0xe8(%rbp),%rdx
call   1080 <scanf@plt>
lea    -0x70(%rbp),%rdi
mov    -0xe4(%rbp),%esi
mov    -0xe8(%rbp),%edx
call   1030 <input@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
mov    -0xe4(%rbp),%edx
mov    -0xe8(%rbp),%ecx
call   1070 <transpose@plt>
lea    -0xe0(%rbp),%rdi
mov    -0xe4(%rbp),%esi
mov    -0xe8(%rbp),%edx
call   1040 <output@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xe8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movl   $0x0,0xe0(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x70(%rsp)
lea    0xe3b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe53(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <input@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0x10(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <transpose@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r14,%rdi
call   1040 <output@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Enter the dimensions of the matrix:\00"
@.str.1 = [5 x i8] c"%d%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [5 x i32]]
%3 = alloca [5 x [5 x i32]]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [5 x [5 x i32]]* %2 to i8*
%7 = bitcast [5 x [5 x i32]]* %3 to i8*
%8 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
%10 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%11 = bitcast [5 x i32]* %10 to i32**
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i32 @input(i32** %11, i32 %12, i32 %13)
%15 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%16 = bitcast [5 x i32]* %15 to i32**
%17 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %3, i64 0, i64 0
%18 = bitcast [5 x i32]* %17 to i32**
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = call i32 @transpose(i32** %16, i32** %18, i32 %19, i32 %20)
%22 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %3, i64 0, i64 0
%23 = bitcast [5 x i32]* %22 to i32**
%24 = load i32, i32* %4
%25 = load i32, i32* %5
%26 = call i32 @output(i32** %23, i32 %24, i32 %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"Enter the dimensions of the matrix:\00"
@.str.1 = [5 x i8] c"%d%d\00"
define i32 @main() {
%1 = alloca [5 x [5 x i32]]
%2 = alloca [5 x [5 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [5 x [5 x i32]]* %1 to i8*
%6 = bitcast [5 x [5 x i32]]* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%11 = bitcast [5 x [5 x i32]]* %1 to i32**
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @input(i32** %11, i32 %12, i32 %13)
%15 = bitcast [5 x [5 x i32]]* %2 to i32**
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 @transpose(i32** %11, i32** %15, i32 %16, i32 %17)
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @output(i32** %15, i32 %19, i32 %20)
ret i32 0
}