#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 *, char *, int);
void print_pointers_as_arrays(int *ages, char **names, int count) {
  int *age = ages;
  char **name = names;
  for (int i = 0; i < count; ++i) {
    printf("%s is %d years old again.\n", name[i], age[i]);
  }
}


x86 assembly (clang, -O0):
<print_pointers_as_arrays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1177 <print_pointers_as_arrays+0x67>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    113a <print_pointers_as_arrays+0x2a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_pointers_as_arrays>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edx,%edx
jle    1149 <print_pointers_as_arrays+0x39>
mov    %rsi,%r14
mov    %rdi,%r12
mov    %edx,%r13d
xor    %ebx,%ebx
lea    0xed1(%rip),%r15
nop
mov    (%r14,%rbx,8),%rsi
mov    (%r12,%rbx,4),%edx
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1130 <print_pointers_as_arrays+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"%s is %d years old again.\0A\00"
define void @print_pointers_as_arrays(i32* %0, i8** %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8**
%9 = alloca i32
store i32* %0, i32** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%10 = load i32*, i32** %4
store i32* %10, i32** %7
%11 = load i8**, i8*** %5
store i8** %11, i8*** %8
store i32 0, i32* %9
br label %12
12: ; preds = %28, %3
%13 = load i32, i32* %9
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load i8**, i8*** %8
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = load i32*, i32** %7
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %21, i32 %26)
br label %28
28: ; preds = %16
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
br label %12
31: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"%s is %d years old again.\0A\00"
define void @print_pointers_as_arrays(i32* nocapture %0, i8** nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %8
7: ; preds = %8, %3
ret void
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %15, %8 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i32, i32* %0, i64 %9
%13 = load i32, i32* %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %13)
%15 = add nuw nsw i64 %9, 1
%16 = icmp eq i64 %15, %6
br i1 %16, label %7, label %8
}