#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 print_2(int count, int *ages, char **names) {
  printf("seccond way: pointers to start of array\n");
  int i;
  for (i = count; i > 0; i--) {
    printf("%s is %d years old\n", *(names + count - i), *(ages + count - i));
  }
}


x86 assembly (clang, -O0):
<print_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    1194 <print_2+0x84>
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1137 <print_2+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_2>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r12
mov    %edi,%ebp
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1170 <print_2+0x50>
mov    %ebp,%ebp
add    $0x1,%rbp
lea    0xeb3(%rip),%r15
xor    %ebx,%ebx
nop
mov    (%r14,%rbx,2),%rsi
mov    (%r12,%rbx,1),%edx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbp
add    $0x4,%rbx
cmp    $0x1,%rbp
ja     1150 <print_2+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [20 x i8] c"%s is %d years old\0A\00"
@str = [40 x i8] c"seccond way: pointers to start of array\00"
define void @print_2(i32 %0, i32* nocapture %1, i8** nocapture %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = zext i32 %0 to i64
%8 = getelementptr inbounds i8*, i8** %2, i64 %7
%9 = getelementptr inbounds i32, i32* %1, i64 %7
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %6, %11
%12 = phi i64 [ %10, %6 ], [ %19, %11 ]
%13 = sub nsw i64 0, %12
%14 = getelementptr inbounds i8*, i8** %8, i64 %13
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i32, i32* %9, i64 %13
%17 = load i32, i32* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %15, i32 %17)
%19 = add nsw i64 %12, -1
%20 = icmp ugt i64 %12, 1
br i1 %20, label %11, label %21
21: ; preds = %11, %3
ret void
}