#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rellenaFichero(char *, int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ strcat(char *, char *);
int main() {
  int nEle = 0;
  int limite[1];
  char nombreFichero[50];
  printf("\nIntroduzca el nombre del fichero: ");
  gets(nombreFichero);
  strcat(nombreFichero, ".txt\0");
  printf("\nIntroduzca el numero de elementos del fichero: ");
  scanf("%i", &nEle);
  printf("\nIntroduzca el limite inferior de los numeros: ");
  scanf("%i", &limite[0]);
  printf("\nIntroduzca el limite superior de los numeros: ");
  scanf("%i", &limite[1]);
  rellenaFichero(nombreFichero, limite, nEle);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x40(%rbp),%rdi
lea    0xf32(%rip),%rsi
call   1060 <strcat@plt>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
lea    0xe97(%rip),%rdi
call   1050 <scanf@plt>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
add    $0x4,%rsi
lea    0xe77(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x40(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    -0x8(%rbp),%edx
call   1070 <rellenaFichero@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movl   $0x0,0x8(%rsp)
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1040 <gets@plt>
lea    0xf37(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcat@plt>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb9(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
lea    0xc(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <rellenaFichero@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [36 x i8] c"\0AIntroduzca el nombre del fichero: \00"
@.str.1 = [6 x i8] c".txt\00\00"
@.str.2 = [49 x i8] c"\0AIntroduzca el numero de elementos del fichero: \00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [48 x i8] c"\0AIntroduzca el limite inferior de los numeros: \00"
@.str.5 = [48 x i8] c"\0AIntroduzca el limite superior de los numeros: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1 x i32]
%4 = alloca [50 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%9 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%12 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%13 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%16 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 1
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%19 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
%20 = load i32, i32* %2
%21 = call i32 @rellenaFichero(i8* %18, i32* %19, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"\0AIntroduzca el nombre del fichero: \00"
@.str.1 = [6 x i8] c".txt\00\00"
@.str.2 = [49 x i8] c"\0AIntroduzca el numero de elementos del fichero: \00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [48 x i8] c"\0AIntroduzca el limite inferior de los numeros: \00"
@.str.5 = [48 x i8] c"\0AIntroduzca el limite superior de los numeros: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x i32]
%3 = alloca [50 x i8]
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast [1 x i32]* %2 to i8*
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @gets(i8* %6)
%9 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%13 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %13)
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%16 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 1
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %1
%19 = call i32 @rellenaFichero(i8* %6, i32* %13, i32 %18)
ret i32 0
}