#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void modificar(int control[1000][5], int registros, int id) {
  if (id > registros || id <= 0) {
    printf("Empleado no encontrado\n");
  } else {
    int edad, pacientes, horario, piso;
    printf("Edad: %d. Nueva edad: ", control[id - 1][1]);
    scanf("%d", &edad);
    printf("\nPacientes: %d. Nuevo numero de pacientes: ", control[id - 1][2]);
    scanf("%d", &pacientes);
    printf("\nHorario: %d. Nuevo horario: ", control[id - 1][3]);
    scanf("%d", &horario);
    printf("\nPiso: %d. Nuevo piso asignado: ", control[id - 1][4]);
    scanf("%d", &piso);
    control[id - 1][1] = edad;
    control[id - 1][2] = pacientes;
    control[id - 1][3] = horario;
    control[id - 1][4] = piso;
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<modificar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1148 <modificar+0x28>
cmpl   $0x0,-0x10(%rbp)
jg     115b <modificar+0x3b>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a5 <modificar+0x185>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe73(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3e(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
mov    0x10(%rax),%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe09(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
imul   $0x14,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
imul   $0x14,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x8(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
imul   $0x14,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0xc(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
imul   $0x14,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x10(%rax)
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modificar>:
cmp    %esi,%edx
jg     121e <modificar+0xde>
test   %edx,%edx
jle    121e <modificar+0xde>
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r15
add    $0xffffffff,%edx
lea    (%rdx,%rdx,4),%rbx
mov    0x4(%rdi,%rbx,4),%esi
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9b(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x8(%r15,%rbx,4),%esi
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0xc(%r15,%rbx,4),%esi
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x10(%r15,%rbx,4),%esi
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x4(%r15,%rbx,4)
mov    0x8(%rsp),%eax
mov    %eax,0x8(%r15,%rbx,4)
mov    0x4(%rsp),%eax
mov    %eax,0xc(%r15,%rbx,4)
mov    (%rsp),%eax
mov    %eax,0x10(%r15,%rbx,4)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe60(%rip),%rdi
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Empleado no encontrado\0A\00"
@.str.1 = [23 x i8] c"Edad: %d. Nueva edad: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [44 x i8] c"\0APacientes: %d. Nuevo numero de pacientes: \00"
@.str.4 = [30 x i8] c"\0AHorario: %d. Nuevo horario: \00"
@.str.5 = [33 x i8] c"\0APiso: %d. Nuevo piso asignado: \00"
@.str.6 = [2 x i8] c"\0A\00"
define void @modificar([5 x i32]* %0, i32 %1, i32 %2) {
%4 = alloca [5 x i32]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store [5 x i32]* %0, [5 x i32]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = icmp sgt i32 %11, %12
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = load i32, i32* %6
%16 = icmp sle i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14, %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %85
19: ; preds = %14
%20 = load [5 x i32]*, [5 x i32]** %4
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %20, i64 %23
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %24, i64 0, i64 1
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%29 = load [5 x i32]*, [5 x i32]** %4
%30 = load i32, i32* %6
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %29, i64 %32
%34 = getelementptr inbounds [5 x i32], [5 x i32]* %33, i64 0, i64 2
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%38 = load [5 x i32]*, [5 x i32]** %4
%39 = load i32, i32* %6
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [5 x i32], [5 x i32]* %38, i64 %41
%43 = getelementptr inbounds [5 x i32], [5 x i32]* %42, i64 0, i64 3
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %9)
%47 = load [5 x i32]*, [5 x i32]** %4
%48 = load i32, i32* %6
%49 = sub nsw i32 %48, 1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [5 x i32], [5 x i32]* %47, i64 %50
%52 = getelementptr inbounds [5 x i32], [5 x i32]* %51, i64 0, i64 4
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %53)
%55 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%56 = load i32, i32* %7
%57 = load [5 x i32]*, [5 x i32]** %4
%58 = load i32, i32* %6
%59 = sub nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [5 x i32], [5 x i32]* %57, i64 %60
%62 = getelementptr inbounds [5 x i32], [5 x i32]* %61, i64 0, i64 1
store i32 %56, i32* %62
%63 = load i32, i32* %8
%64 = load [5 x i32]*, [5 x i32]** %4
%65 = load i32, i32* %6
%66 = sub nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [5 x i32], [5 x i32]* %64, i64 %67
%69 = getelementptr inbounds [5 x i32], [5 x i32]* %68, i64 0, i64 2
store i32 %63, i32* %69
%70 = load i32, i32* %9
%71 = load [5 x i32]*, [5 x i32]** %4
%72 = load i32, i32* %6
%73 = sub nsw i32 %72, 1
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [5 x i32], [5 x i32]* %71, i64 %74
%76 = getelementptr inbounds [5 x i32], [5 x i32]* %75, i64 0, i64 3
store i32 %70, i32* %76
%77 = load i32, i32* %10
%78 = load [5 x i32]*, [5 x i32]** %4
%79 = load i32, i32* %6
%80 = sub nsw i32 %79, 1
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [5 x i32], [5 x i32]* %78, i64 %81
%83 = getelementptr inbounds [5 x i32], [5 x i32]* %82, i64 0, i64 4
store i32 %77, i32* %83
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %85
85: ; preds = %19, %17
ret void
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"Edad: %d. Nueva edad: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [44 x i8] c"\0APacientes: %d. Nuevo numero de pacientes: \00"
@.str.4 = [30 x i8] c"\0AHorario: %d. Nuevo horario: \00"
@.str.5 = [33 x i8] c"\0APiso: %d. Nuevo piso asignado: \00"
@str = [23 x i8] c"Empleado no encontrado\00"
define void @modificar([5 x i32]* nocapture %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = icmp sgt i32 %2, %1
%9 = icmp slt i32 %2, 1
%10 = or i1 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %41
13: ; preds = %3
%14 = bitcast i32* %4 to i8*
%15 = bitcast i32* %5 to i8*
%16 = bitcast i32* %6 to i8*
%17 = bitcast i32* %7 to i8*
%18 = add nsw i32 %2, -1
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %19, i64 1
%21 = load i32, i32* %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %19, i64 2
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %19, i64 3
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %29)
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %19, i64 4
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %33)
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%36 = load i32, i32* %4
store i32 %36, i32* %20
%37 = load i32, i32* %5
store i32 %37, i32* %24
%38 = load i32, i32* %6
store i32 %38, i32* %28
%39 = load i32, i32* %7
store i32 %39, i32* %32
%40 = call i32 @putchar(i32 10)
br label %41
41: ; preds = %13, %11
ret void
}