#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int a[10], i = 0;
  printf("Índice del elemento que desea modificar: ");
  scanf("%d", &i);
  if (!(i >= 0 && i < 10)) {
    printf("%s(%d): índice fuera de límites.\n",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/luciferfran/codigos-luciferfran/refs/"
           "heads/master/C/Ejemplos C-C++/Cap10/assert.c",
           25);
    exit(1);
  };
  printf("a[i] = ");
  scanf("%d", &a[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x34(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x34(%rbp)
jl     1171 <main+0x41>
cmpl   $0xa,-0x34(%rbp)
jl     1195 <main+0x65>
lea    0xeb6(%rip),%rdi
lea    0xed3(%rip),%rsi
mov    $0x19,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xf62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe72(%rip),%rdi
call   1040 <scanf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movl   $0x0,0xc(%rsp)
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0xa,0xc(%rsp)
jae    1190 <main+0x60>
lea    0xf95(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movslq 0xc(%rsp),%rax
lea    (%rsp,%rax,4),%rsi
add    $0x10,%rsi
lea    0xea7(%rip),%rdi
call   1040 <scanf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret
lea    0xe97(%rip),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x19,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"\C3\8Dndice del elemento que desea modificar: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"%s(%d): \C3\ADndice fuera de l\C3\ADmites.\0A\00"
@.str.3 = [172 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/luciferfran/codigos-luciferfran/refs/heads/master/C/Ejemplos C-C++/Cap10/assert.c\00"
@.str.4 = [8 x i8] c"a[i] = \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %13, label %10
10: ; preds = %7, %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str.3, i64 0, i64 0), i32 25)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"\C3\8Dndice del elemento que desea modificar: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"%s(%d): \C3\ADndice fuera de l\C3\ADmites.\0A\00"
@.str.3 = [172 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/luciferfran/codigos-luciferfran/refs/heads/master/C/Ejemplos C-C++/Cap10/assert.c\00"
@.str.4 = [8 x i8] c"a[i] = \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp ult i32 %7, 10
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str.3, i64 0, i64 0), i32 25)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
ret i32 0
}