#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 atoi(char *);
int /*<<< orphan*/ printf(char *);
void handle_retrieve(char names[10][20], char addresses[10][200],
                     char phoneNumbers[10][10], char *index) {
  int item = atoi(index) - 1;
  printf(names[item]);
  printf(addresses[item]);
  printf(phoneNumbers[item]);
}


x86 assembly (clang, -O0):
<handle_retrieve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x24(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
movslq -0x24(%rbp),%rax
imul   $0xc8,%rax,%rax
add    %rax,%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
movslq -0x24(%rbp),%rax
imul   $0xa,%rax,%rax
add    %rax,%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_retrieve>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rcx,%rdi
call   1040 <atoi@plt>
add    $0xffffffff,%eax
movslq %eax,%rbx
lea    (%rbx,%rbx,4),%r13
lea    (%r12,%r13,4),%rdi
call   1030 <printf@plt>
imul   $0xc8,%rbx,%rdi
add    %r15,%rdi
call   1030 <printf@plt>
lea    (%r14,%r13,2),%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
define void @handle_retrieve([20 x i8]* %0, [200 x i8]* %1, [10 x i8]* %2, i8* %3) {
%5 = alloca [20 x i8]*
%6 = alloca [200 x i8]*
%7 = alloca [10 x i8]*
%8 = alloca i8*
%9 = alloca i32
store [20 x i8]* %0, [20 x i8]** %5
store [200 x i8]* %1, [200 x i8]** %6
store [10 x i8]* %2, [10 x i8]** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %8
%11 = call i32 @atoi(i8* %10)
%12 = sub nsw i32 %11, 1
store i32 %12, i32* %9
%13 = load [20 x i8]*, [20 x i8]** %5
%14 = load i32, i32* %9
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %13, i64 %15
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %16, i64 0, i64 0
%18 = call i32 @printf(i8* %17)
%19 = load [200 x i8]*, [200 x i8]** %6
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [200 x i8], [200 x i8]* %19, i64 %21
%23 = getelementptr inbounds [200 x i8], [200 x i8]* %22, i64 0, i64 0
%24 = call i32 @printf(i8* %23)
%25 = load [10 x i8]*, [10 x i8]** %7
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %25, i64 %27
%29 = getelementptr inbounds [10 x i8], [10 x i8]* %28, i64 0, i64 0
%30 = call i32 @printf(i8* %29)
ret void
}

LLVM IR (-O2):
define void @handle_retrieve([20 x i8]* nocapture %0, [200 x i8]* nocapture %1, [10 x i8]* nocapture %2, i8* nocapture %3) {
%5 = tail call i32 @atoi(i8* %3)
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %0, i64 %7, i64 0
%9 = tail call i32 @printf(i8* dereferenceable(1) %8)
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 %7, i64 0
%11 = tail call i32 @printf(i8* dereferenceable(1) %10)
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 %7, i64 0
%13 = tail call i32 @printf(i8* dereferenceable(1) %12)
ret void
}