#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ cargam1(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ cargam2(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ imprimematriz();
int /*<<< orphan*/ imprimeresultado(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ multimatriz(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ stderr;
main(int argc, char *argv[]) {
  char nombre1[256], nombre2[256], nombre3[256];
  int finicio, ffin;
  if (argc != 4) {
    fprintf(stderr, "Usar: subproducto fichero fila1 fila2\n");
    exit(-1);
  }
  finicio = atoi(argv[2]);
  ffin = atoi(argv[3]);
  if (finicio > ffin || finicio < 0 || ffin >= 3) {
    fprintf(stderr,
            "fila 1 y fila2 deben corresponder  con numeros de lineas "
            "existentes en la matriz y fila 1 ser inferior o igual a fila 2\n");
    exit(-1);
  }
  sprintf(nombre1, "%s1.flt", argv[1]);
  sprintf(nombre2, "%s2.flt", argv[1]);
  sprintf(nombre3, "%s-%d-%d.flt", argv[1], finicio, ffin);
  FILE *fp1, *fp2, *fp3;
  cargam1(nombre1, fp1);
  cargam2(nombre2, fp2);
  multimatriz(nombre3, finicio, ffin, fp3);
  imprimeresultado(nombre3, fp3);
  imprimematriz();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x4(%rbp)
je     11cb <main+0x3b>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    0xe44(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x314(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x318(%rbp)
mov    -0x314(%rbp),%eax
cmp    -0x318(%rbp),%eax
jg     121d <main+0x8d>
cmpl   $0x0,-0x314(%rbp)
jl     121d <main+0x8d>
cmpl   $0x3,-0x318(%rbp)
jl     123c <main+0xac>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
lea    0xdfa(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe39(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0x310(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x314(%rbp),%ecx
mov    -0x318(%rbp),%r8d
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0x110(%rbp),%rdi
mov    -0x320(%rbp),%rsi
call   10b0 <cargam1@plt>
lea    -0x210(%rbp),%rdi
mov    -0x328(%rbp),%rsi
call   1070 <cargam2@plt>
lea    -0x310(%rbp),%rdi
mov    -0x314(%rbp),%esi
mov    -0x318(%rbp),%edx
mov    -0x330(%rbp),%rcx
call   1040 <multimatriz@plt>
lea    -0x310(%rbp),%rdi
mov    -0x330(%rbp),%rsi
call   1050 <imprimeresultado@plt>
mov    $0x0,%al
call   1030 <imprimematriz@plt>
xor    %eax,%eax
add    $0x330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x300,%rsp
cmp    $0x4,%edi
jne    1273 <main+0xe3>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbx),%rdi
call   1080 <atoi@plt>
cmp    $0x2,%eax
jg     1285 <main+0xf5>
test   %r14d,%r14d
js     1285 <main+0xf5>
mov    %eax,%ebp
cmp    %eax,%r14d
jg     1285 <main+0xf5>
mov    0x8(%rbx),%rdx
lea    0xeb8(%rip),%rsi
lea    0x200(%rsp),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    0x8(%rbx),%rdx
lea    0xea3(%rip),%rsi
lea    0x100(%rsp),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    0x8(%rbx),%rdx
lea    0xe8e(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14d,%ecx
mov    %ebp,%r8d
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    %r15,%rdi
call   10b0 <cargam1@plt>
mov    %r12,%rdi
call   1070 <cargam2@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1040 <multimatriz@plt>
mov    %rbx,%rdi
call   1050 <imprimeresultado@plt>
xor    %eax,%eax
call   1030 <imprimematriz@plt>
xor    %eax,%eax
add    $0x300,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
lea    0xd7d(%rip),%rsi
jmp    1295 <main+0x105>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
lea    0xd92(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"Usar: subproducto fichero fila1 fila2\0A\00"
@.str.1 = [121 x i8] c"fila 1 y fila2 deben corresponder con numeros de lineas existentes en la matriz y fila 1 ser inferior o igual a fila 2\0A\00"
@.str.2 = [8 x i8] c"%s1.flt\00"
@.str.3 = [8 x i8] c"%s2.flt\00"
@.str.4 = [13 x i8] c"%s-%d-%d.flt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 4
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %4
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %8
%24 = load i8**, i8*** %4
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %9
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = icmp sgt i32 %28, %29
br i1 %30, label %37, label %31
31: ; preds = %19
%32 = load i32, i32* %8
%33 = icmp slt i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %31
%35 = load i32, i32* %9
%36 = icmp sge i32 %35, 3
br i1 %36, label %37, label %41
37: ; preds = %34, %31, %19
%38 = load i32, i32* @stderr
%39 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([121 x i8], [121 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @exit(i32 -1)
unreachable
41: ; preds = %34
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%43 = load i8**, i8*** %4
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %42, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %45)
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%48 = load i8**, i8*** %4
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %47, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %50)
%52 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%53 = load i8**, i8*** %4
%54 = getelementptr inbounds i8*, i8** %53, i64 1
%55 = load i8*, i8** %54
%56 = load i32, i32* %8
%57 = load i32, i32* %9
%58 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %52, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %55, i32 %56, i32 %57)
%59 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%60 = load i32*, i32** %10
%61 = call i32 @cargam1(i8* %59, i32* %60)
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%63 = load i32*, i32** %11
%64 = call i32 @cargam2(i8* %62, i32* %63)
%65 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%66 = load i32, i32* %8
%67 = load i32, i32* %9
%68 = load i32*, i32** %12
%69 = call i32 @multimatriz(i8* %65, i32 %66, i32 %67, i32* %68)
%70 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%71 = load i32*, i32** %12
%72 = call i32 @imprimeresultado(i8* %70, i32* %71)
%73 = call i32 (...) @imprimematriz()
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"Usar: subproducto fichero fila1 fila2\0A\00"
@.str.1 = [121 x i8] c"fila 1 y fila2 deben corresponder con numeros de lineas existentes en la matriz y fila 1 ser inferior o igual a fila 2\0A\00"
@.str.2 = [8 x i8] c"%s1.flt\00"
@.str.3 = [8 x i8] c"%s2.flt\00"
@.str.4 = [13 x i8] c"%s-%d-%d.flt\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 4
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 -1)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = icmp sgt i32 %17, %20
%22 = icmp slt i32 %17, 0
%23 = or i1 %22, %21
%24 = icmp sgt i32 %20, 2
%25 = or i1 %24, %23
br i1 %25, label %26, label %30
26: ; preds = %14
%27 = load i32, i32* @stderr
%28 = tail call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([121 x i8], [121 x i8]* @.str.1, i64 0, i64 0))
%29 = tail call i32 @exit(i32 -1)
unreachable
30: ; preds = %14
%31 = getelementptr inbounds i8*, i8** %1, i64 1
%32 = load i8*, i8** %31
%33 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %32)
%34 = load i8*, i8** %31
%35 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** %31
%37 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %36, i32 %17, i32 %20)
%38 = call i32 @cargam1(i8* %6, i32* undef)
%39 = call i32 @cargam2(i8* %7, i32* undef)
%40 = call i32 @multimatriz(i8* %8, i32 %17, i32 %20, i32* undef)
%41 = call i32 @imprimeresultado(i8* %8, i32* undef)
%42 = call i32 (...) @imprimematriz()
ret i32 0
}