#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_3(int count, int *ages, char **names) {
  printf("third way: pointers are just arrays\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_3>:
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    117e <print_3+0x6e>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1137 <print_3+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_3>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r12
mov    %edi,%ebp
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1170 <print_3+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_3+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"third way: pointers are just arrays\0A\00"
@.str.1 = [21 x i8] c"%s is %d years old.\0A\00"
define void @print_3(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 ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %4
store i32 %9, i32* %7
br label %10
10: ; preds = %29, %3
%11 = load i32, i32* %7
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %32
13: ; preds = %10
%14 = load i8**, i8*** %6
%15 = load i32, i32* %4
%16 = load i32, i32* %7
%17 = sub nsw i32 %15, %16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %14, i64 %18
%20 = load i8*, i8** %19
%21 = load i32*, i32** %5
%22 = load i32, i32* %4
%23 = load i32, i32* %7
%24 = sub nsw i32 %22, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %21, i64 %25
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %20, i32 %27)
br label %29
29: ; preds = %13
%30 = load i32, i32* %7
%31 = add nsw i32 %30, -1
store i32 %31, i32* %7
br label %10
32: ; preds = %10
ret void
}

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