#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*/ 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;
  FILE *fp1, *fp2, *fp3;
  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 >= 512) {
    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);
  cargam1(nombre1, fp1);
  cargam2(nombre2, fp2);
  multimatriz(nombre3, finicio, ffin, fp3);
}


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     11ab <main+0x3b>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x314(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x318(%rbp)
mov    -0x314(%rbp),%eax
cmp    -0x318(%rbp),%eax
jg     1200 <main+0x90>
cmpl   $0x0,-0x314(%rbp)
jl     1200 <main+0x90>
cmpl   $0x200,-0x318(%rbp)
jl     121f <main+0xaf>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
lea    0xe17(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
lea    -0x310(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x314(%rbp),%ecx
mov    -0x318(%rbp),%r8d
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
lea    -0x110(%rbp),%rdi
mov    -0x320(%rbp),%rsi
call   1090 <cargam1@plt>
lea    -0x210(%rbp),%rdi
mov    -0x328(%rbp),%rsi
call   1050 <cargam2@plt>
lea    -0x310(%rbp),%rdi
mov    -0x314(%rbp),%esi
mov    -0x318(%rbp),%edx
mov    -0x330(%rbp),%rcx
call   1030 <multimatriz@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    1246 <main+0xd6>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbx),%rdi
call   1060 <atoi@plt>
cmp    $0x1ff,%eax
jg     1258 <main+0xe8>
test   %r14d,%r14d
js     1258 <main+0xe8>
mov    %eax,%ebp
cmp    %eax,%r14d
jg     1258 <main+0xe8>
mov    0x8(%rbx),%rdx
lea    0xed6(%rip),%rsi
lea    0x200(%rsp),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <sprintf@plt>
mov    0x8(%rbx),%rdx
lea    0xec1(%rip),%rsi
lea    0x100(%rsp),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <sprintf@plt>
mov    0x8(%rbx),%rdx
lea    0xeac(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14d,%ecx
mov    %ebp,%r8d
xor    %eax,%eax
call   1070 <sprintf@plt>
mov    %r15,%rdi
call   1090 <cargam1@plt>
mov    %r12,%rdi
call   1050 <cargam2@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1030 <multimatriz@plt>
xor    %eax,%eax
add    $0x300,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
lea    0xdaa(%rip),%rsi
jmp    1268 <main+0xf8>
mov    0x2d81(%rip),%rax
mov    (%rax),%edi
lea    0xdbf(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <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, 512
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)
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, 511
%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)
ret i32 0
}