#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*/ printf(char *, ...);
int /*<<< orphan*/ receiv_M(int **, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ transpose_M(int **, int **, int, int);
int main() {
  int A[10][10], At[10][10], fil, col;
  printf("Ingresar el numero de filas:\n");
  scanf("%d", &fil);
  printf("Ingresar el numero de columnas:\n");
  scanf("%d", &col);
  receiv_M(A, fil, col);
  printf("La matriz ingresada es: \n");
  for (int i = 0; i < fil; i++) {
    for (int j = 0; j < col; j++) {
      printf("%d\t", A[i][j]);
    }
    printf("\n");
  }
  transpose_M(A, At, fil, col);
  printf("La matriz transpuesta es: \n");
  for (int i = 0; i < col; i++) {
    for (int j = 0; j < fil; j++) {
      printf("%d\t", At[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x334(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0x338(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x334(%rbp),%esi
mov    -0x338(%rbp),%edx
call   1060 <receiv_M@plt>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x33c(%rbp)
mov    -0x33c(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    1255 <main+0x115>
movl   $0x0,-0x340(%rbp)
mov    -0x340(%rbp),%eax
cmp    -0x338(%rbp),%eax
jge    1233 <main+0xf3>
movslq -0x33c(%rbp),%rcx
lea    -0x1a0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x340(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x340(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x340(%rbp)
jmp    11e0 <main+0xa0>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x33c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x33c(%rbp)
jmp    11c4 <main+0x84>
lea    -0x1a0(%rbp),%rdi
lea    -0x330(%rbp),%rsi
mov    -0x334(%rbp),%edx
mov    -0x338(%rbp),%ecx
call   1040 <transpose_M@plt>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x344(%rbp)
mov    -0x344(%rbp),%eax
cmp    -0x338(%rbp),%eax
jge    131d <main+0x1dd>
movl   $0x0,-0x348(%rbp)
mov    -0x348(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    12fb <main+0x1bb>
movslq -0x344(%rbp),%rcx
lea    -0x330(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x348(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x348(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x348(%rbp)
jmp    12a8 <main+0x168>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x344(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x344(%rbp)
jmp    128c <main+0x14c>
mov    -0x4(%rbp),%eax
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x338,%rsp
lea    0xe92(%rip),%rdi
call   1040 <puts@plt>
lea    0xe7f(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xe8f(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0x10(%rsp),%r12
mov    %r12,%rdi
call   1080 <receiv_M@plt>
lea    0xe81(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    122e <main+0xce>
lea    0xe2c(%rip),%r14
xor    %r15d,%r15d
jmp    11fc <main+0x9c>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
movslq 0xc(%rsp),%rdx
add    $0x28,%r12
cmp    %rdx,%r15
jge    122e <main+0xce>
cmpl   $0x0,0x8(%rsp)
jle    11e0 <main+0x80>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1210 <main+0xb0>
jmp    11e0 <main+0x80>
mov    0x8(%rsp),%ecx
lea    0x10(%rsp),%rdi
lea    0x1a0(%rsp),%r12
mov    %r12,%rsi
call   1060 <transpose_M@plt>
lea    0xe0f(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x8(%rsp)
jle    12be <main+0x15e>
lea    0xda2(%rip),%r14
xor    %r15d,%r15d
jmp    128c <main+0x12c>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
movslq 0x8(%rsp),%rax
add    $0x28,%r12
cmp    %rax,%r15
jge    12be <main+0x15e>
cmpl   $0x0,0xc(%rsp)
jle    1270 <main+0x110>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     12a0 <main+0x140>
jmp    1270 <main+0x110>
xor    %eax,%eax
add    $0x338,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Ingresar el numero de filas:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"Ingresar el numero de columnas:\0A\00"
@.str.3 = [26 x i8] c"La matriz ingresada es: \0A\00"
@.str.4 = [4 x i8] c"%d\09\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [28 x i8] c"La matriz transpuesta es: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [10 x i32]]
%3 = alloca [10 x [10 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%14 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%15 = bitcast [10 x i32]* %14 to i32**
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = call i32 @receiv_M(i32** %15, i32 %16, i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %20
20: ; preds = %43, %0
%21 = load i32, i32* %6
%22 = load i32, i32* %4
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %46
24: ; preds = %20
store i32 0, i32* %7
br label %25
25: ; preds = %38, %24
%26 = load i32, i32* %7
%27 = load i32, i32* %5
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %41
29: ; preds = %25
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 %31
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %32, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %29
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %25
41: ; preds = %25
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %43
43: ; preds = %41
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %20
46: ; preds = %20
%47 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%48 = bitcast [10 x i32]* %47 to i32**
%49 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %3, i64 0, i64 0
%50 = bitcast [10 x i32]* %49 to i32**
%51 = load i32, i32* %4
%52 = load i32, i32* %5
%53 = call i32 @transpose_M(i32** %48, i32** %50, i32 %51, i32 %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %8
br label %55
55: ; preds = %78, %46
%56 = load i32, i32* %8
%57 = load i32, i32* %5
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %81
59: ; preds = %55
store i32 0, i32* %9
br label %60
60: ; preds = %73, %59
%61 = load i32, i32* %9
%62 = load i32, i32* %4
%63 = icmp slt i32 %61, %62
br i1 %63, label %64, label %76
64: ; preds = %60
%65 = load i32, i32* %8
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %3, i64 0, i64 %66
%68 = load i32, i32* %9
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [10 x i32], [10 x i32]* %67, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %71)
br label %73
73: ; preds = %64
%74 = load i32, i32* %9
%75 = add nsw i32 %74, 1
store i32 %75, i32* %9
br label %60
76: ; preds = %60
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %78
78: ; preds = %76
%79 = load i32, i32* %8
%80 = add nsw i32 %79, 1
store i32 %80, i32* %8
br label %55
81: ; preds = %55
%82 = load i32, i32* %1
ret i32 %82
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d\09\00"
@str = [29 x i8] c"Ingresar el numero de filas:\00"
@str.7 = [32 x i8] c"Ingresar el numero de columnas:\00"
@str.8 = [25 x i8] c"La matriz ingresada es: \00"
@str.9 = [27 x i8] c"La matriz transpuesta es: \00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = alloca [10 x [10 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [10 x [10 x i32]]* %1 to i8*
%6 = bitcast [10 x [10 x i32]]* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.7, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%13 = bitcast [10 x [10 x i32]]* %1 to i32**
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @receiv_M(i32** %13, i32 %14, i32 %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.8, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %0, %32
%21 = phi i64 [ %34, %32 ], [ 0, %0 ]
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 0
br i1 %23, label %38, label %32
24: ; preds = %32, %0
%25 = phi i32 [ %18, %0 ], [ %35, %32 ]
%26 = bitcast [10 x [10 x i32]]* %2 to i32**
%27 = load i32, i32* %4
%28 = call i32 @transpose_M(i32** %13, i32** %26, i32 %25, i32 %27)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0))
%30 = load i32, i32* %4
%31 = icmp sgt i32 %30, 0
br i1 %31, label %47, label %51
32: ; preds = %38, %20
%33 = call i32 @putchar(i32 10)
%34 = add nuw nsw i64 %21, 1
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %34, %36
br i1 %37, label %20, label %24
38: ; preds = %20, %38
%39 = phi i64 [ %43, %38 ], [ 0, %20 ]
%40 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %21, i64 %39
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %41)
%43 = add nuw nsw i64 %39, 1
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = icmp slt i64 %43, %45
br i1 %46, label %38, label %32
47: ; preds = %24, %52
%48 = phi i64 [ %54, %52 ], [ 0, %24 ]
%49 = load i32, i32* %3
%50 = icmp sgt i32 %49, 0
br i1 %50, label %58, label %52
51: ; preds = %52, %24
ret i32 0
52: ; preds = %58, %47
%53 = call i32 @putchar(i32 10)
%54 = add nuw nsw i64 %48, 1
%55 = load i32, i32* %4
%56 = sext i32 %55 to i64
%57 = icmp slt i64 %54, %56
br i1 %57, label %47, label %51
58: ; preds = %47, %58
%59 = phi i64 [ %63, %58 ], [ 0, %47 ]
%60 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 %48, i64 %59
%61 = load i32, i32* %60
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %61)
%63 = add nuw nsw i64 %59, 1
%64 = load i32, i32* %3
%65 = sext i32 %64 to i64
%66 = icmp slt i64 %63, %65
br i1 %66, label %58, label %52
}