#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 *, ...);
void consulta(int control[1000][5], int registros, int id) {
  if (id > registros || id <= 0) {
    printf("Empleado no encontrado\n");
  } else {
    printf("Edad: %d\n", control[id - 1][1]);
    printf("Pacientes: %d\n", control[id - 1][2]);
    printf("Horario: %d\n", control[id - 1][3]);
    printf("Piso: %d\n", control[id - 1][4]);
  }
}


x86 assembly (clang, -O0):
<consulta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1138 <consulta+0x28>
cmpl   $0x0,-0x10(%rbp)
jg     114b <consulta+0x3b>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11df <consulta+0xcf>
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    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@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    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@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    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@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    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<consulta>:
cmp    %esi,%edx
jg     1188 <consulta+0x68>
test   %edx,%edx
jle    1188 <consulta+0x68>
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
add    $0xffffffff,%edx
lea    (%rdx,%rdx,4),%rbx
mov    0x4(%rdi,%rbx,4),%esi
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r14,%rbx,4),%esi
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%r14,%rbx,4),%esi
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%r14,%rbx,4),%esi
lea    0xeac(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>
lea    0xea1(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Empleado no encontrado\0A\00"
@.str.1 = [10 x i8] c"Edad: %d\0A\00"
@.str.2 = [15 x i8] c"Pacientes: %d\0A\00"
@.str.3 = [13 x i8] c"Horario: %d\0A\00"
@.str.4 = [10 x i8] c"Piso: %d\0A\00"
define void @consulta([5 x i32]* %0, i32 %1, i32 %2) {
%4 = alloca [5 x i32]*
%5 = alloca i32
%6 = alloca i32
store [5 x i32]* %0, [5 x i32]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* %5
%9 = icmp sgt i32 %7, %8
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i32, i32* %6
%12 = icmp sle i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10, %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %48
15: ; preds = %10
%16 = load [5 x i32]*, [5 x i32]** %4
%17 = load i32, i32* %6
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %16, i64 %19
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %20, i64 0, i64 1
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = load [5 x i32]*, [5 x i32]** %4
%25 = load i32, i32* %6
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %24, i64 %27
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %28, i64 0, i64 2
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load [5 x i32]*, [5 x i32]** %4
%33 = load i32, i32* %6
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %32, i64 %35
%37 = getelementptr inbounds [5 x i32], [5 x i32]* %36, i64 0, i64 3
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = load [5 x i32]*, [5 x i32]** %4
%41 = load i32, i32* %6
%42 = sub nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [5 x i32], [5 x i32]* %40, i64 %43
%45 = getelementptr inbounds [5 x i32], [5 x i32]* %44, i64 0, i64 4
%46 = load i32, i32* %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %15, %13
ret void
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"Edad: %d\0A\00"
@.str.2 = [15 x i8] c"Pacientes: %d\0A\00"
@.str.3 = [13 x i8] c"Horario: %d\0A\00"
@.str.4 = [10 x i8] c"Piso: %d\0A\00"
@str = [23 x i8] c"Empleado no encontrado\00"
define void @consulta([5 x i32]* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, %1
%5 = icmp slt i32 %2, 1
%6 = or i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %24
9: ; preds = %3
%10 = add nsw i32 %2, -1
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %11, i64 1
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %11, i64 2
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %11, i64 3
%19 = load i32, i32* %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %11, i64 4
%22 = load i32, i32* %21
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %9, %7
ret void
}