#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*/ imprimeMatriz(int **, int, int);
int /*<<< orphan*/ imprimeVector(int *, int);
int /*<<< orphan*/ liberarMemoria(int **, int);
int *minCol(int **, int, int, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rellenaMatriz(int **, int, int);
int *reservaVector(int);
int **reservarMemoria(int, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  int nFil = 0, nCol = 0;
  int **matriz = NULL;
  int *minimos = NULL;
  printf("Introduzca el numero de filas: ");
  scanf("%i", &nFil);
  printf("Introduzca el numero de columnas: ");
  scanf("%i", &nCol);
  matriz = reservarMemoria(nFil, nCol);
  minimos = reservaVector(nCol);
  rellenaMatriz(matriz, nFil, nCol);
  printf("\n\nLa matriz es: \n");
  imprimeMatriz(matriz, nFil, nCol);
  minimos = minCol(matriz, nFil, nCol, minimos);
  printf("El vector con los minimos de cada columna es → ");
  imprimeVector(minimos, nCol);
  liberarMemoria(matriz, nFil);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xe0c(%rip),%rdi
call   1050 <printf@plt>
lea    0xe20(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10c0 <scanf@plt>
lea    0xe13(%rip),%rdi
call   1050 <printf@plt>
lea    0xe04(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   10c0 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <reservarMemoria@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   10b0 <reservaVector@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <rellenaMatriz@plt>
lea    0xdf0(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   10a0 <imprimeMatriz@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1030 <minCol@plt>
mov    %rax,-0x20(%rbp)
lea    0xdd0(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   10d0 <imprimeVector@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <liberarMemoria@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1090 <srand@plt>
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xe18(%rip),%rdi
call   1060 <printf@plt>
lea    0xe2c(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   10d0 <scanf@plt>
lea    0xe1b(%rip),%rdi
call   1060 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   10d0 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1080 <reservarMemoria@plt>
mov    %rax,%rbx
mov    (%rsp),%edi
call   10c0 <reservaVector@plt>
mov    %rax,%r14
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %rbx,%rdi
call   1050 <rellenaMatriz@plt>
lea    0xe30(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %rbx,%rdi
call   10b0 <imprimeMatriz@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rcx
call   1040 <minCol@plt>
mov    %rax,%r14
lea    0xdce(%rip),%rdi
call   1060 <printf@plt>
mov    (%rsp),%esi
mov    %r14,%rdi
call   10e0 <imprimeVector@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1070 <liberarMemoria@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Introduzca el numero de filas: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [35 x i8] c"Introduzca el numero de columnas: \00"
@.str.3 = [18 x i8] c"\0A\0ALa matriz es: \0A\00"
@.str.4 = [50 x i8] c"El vector con los minimos de cada columna es \E2\86\92 \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32**
%5 = alloca i32*
store i32 0, i32* %1
%6 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %2
store i32 0, i32* %3
store i32** null, i32*** %4
store i32* null, i32** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = call i32** @reservarMemoria(i32 %12, i32 %13)
store i32** %14, i32*** %4
%15 = load i32, i32* %3
%16 = call i32* @reservaVector(i32 %15)
store i32* %16, i32** %5
%17 = load i32**, i32*** %4
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @rellenaMatriz(i32** %17, i32 %18, i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32**, i32*** %4
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 @imprimeMatriz(i32** %22, i32 %23, i32 %24)
%26 = load i32**, i32*** %4
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = load i32*, i32** %5
%30 = call i32* @minCol(i32** %26, i32 %27, i32 %28, i32* %29)
store i32* %30, i32** %5
%31 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
%32 = load i32*, i32** %5
%33 = load i32, i32* %3
%34 = call i32 @imprimeVector(i32* %32, i32 %33)
%35 = load i32**, i32*** %4
%36 = load i32, i32* %2
%37 = call i32 @liberarMemoria(i32** %35, i32 %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Introduzca el numero de filas: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [35 x i8] c"Introduzca el numero de columnas: \00"
@.str.4 = [50 x i8] c"El vector con los minimos de cada columna es \E2\86\92 \00"
@str = [17 x i8] c"\0A\0ALa matriz es: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = call i32** @reservarMemoria(i32 %11, i32 %12)
%14 = load i32, i32* %2
%15 = call i32* @reservaVector(i32 %14)
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = call i32 @rellenaMatriz(i32** %13, i32 %16, i32 %17)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = call i32 @imprimeMatriz(i32** %13, i32 %20, i32 %21)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = call i32* @minCol(i32** %13, i32 %23, i32 %24, i32* %15)
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
%27 = load i32, i32* %2
%28 = call i32 @imprimeVector(i32* %25, i32 %27)
%29 = load i32, i32* %1
%30 = call i32 @liberarMemoria(i32** %13, i32 %29)
ret i32 0
}