#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*/ sprintf(char *, char *, int);
void handle_list(char names[10][20], char addresses[10][200],
                 char phoneNumbers[10][10], int curLength) {
  int i;
  for (i = 0; i < curLength; i++) {
    printf("contact: ");
    char curItem[10];
    sprintf(curItem, "%d", i + 1);
    printf(curItem);
    printf("\n");
    printf(names[i]);
    printf("\n");
    printf(addresses[i]);
    printf("\n");
    printf(phoneNumbers[i]);
    printf("\n");
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<handle_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11fe <handle_list+0xde>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
lea    -0x2a(%rbp),%rdi
mov    -0x20(%rbp),%edx
add    $0x1,%edx
lea    0xea3(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x2a(%rbp),%rdi
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
movslq -0x20(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
call   1030 <printf@plt>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
movslq -0x20(%rbp),%rax
imul   $0xc8,%rax,%rax
add    %rax,%rdi
call   1030 <printf@plt>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
movslq -0x20(%rbp),%rax
imul   $0xa,%rax,%rax
add    %rax,%rdi
call   1030 <printf@plt>
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113e <handle_list+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_list>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %ecx,%ecx
jle    11eb <handle_list+0xbb>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %ecx,%ebp
xor    %ebx,%ebx
lea    0xe(%rsp),%r13
nopl   0x0(%rax,%rax,1)
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
mov    %r13,%rdi
lea    0xe90(%rip),%rsi
mov    %ebx,%edx
call   1050 <sprintf@plt>
mov    %r13,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x14,%r12
add    $0xc8,%r15
add    $0xa,%r14
cmp    %rbx,%rbp
jne    1160 <handle_list+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"contact: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @handle_list([20 x i8]* nocapture %0, [200 x i8]* nocapture %1, [10 x i8]* nocapture %2, i32 %3) {
%5 = alloca [10 x i8]
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %29
7: ; preds = %4
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%9 = zext i32 %3 to i64
br label %10
10: ; preds = %7, %10
%11 = phi i64 [ 0, %7 ], [ %13, %10 ]
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%13 = add nuw nsw i64 %11, 1
%14 = trunc i64 %13 to i32
%15 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = call i32 @printf(i8* %8)
%17 = tail call i32 @putchar(i32 10)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %0, i64 %11, i64 0
%19 = tail call i32 @printf(i8* dereferenceable(1) %18)
%20 = tail call i32 @putchar(i32 10)
%21 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 %11, i64 0
%22 = tail call i32 @printf(i8* dereferenceable(1) %21)
%23 = tail call i32 @putchar(i32 10)
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 %11, i64 0
%25 = tail call i32 @printf(i8* dereferenceable(1) %24)
%26 = tail call i32 @putchar(i32 10)
%27 = tail call i32 @putchar(i32 10)
%28 = icmp eq i64 %13, %9
br i1 %28, label %29, label %10
29: ; preds = %10, %4
ret void
}