#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_4(int count, int *ages, char **names) {
  printf("fith way: stupid complex pointers reversed\n");
  int *cur_age = ages;
  char **cur_name = names;
  for (cur_name = names + count - 1, cur_age = ages + count - 1;
       (cur_age - ages) >= 0; (cur_name--, cur_age--)) {
    printf("%ld: %s is %d years atm.\n", (cur_age - ages), *cur_name, *cur_age);
  }
}


x86 assembly (clang, -O0):
<print_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
cmp    $0x0,%rax
jl     11cf <print_4+0xbf>
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rax
sub    %rax,%rsi
sar    $0x2,%rsi
mov    -0x28(%rbp),%rax
mov    (%rax),%rdx
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x20(%rbp)
jmp    116f <print_4+0x5f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_4>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
movslq %ebp,%rax
lea    -0x4(,%rax,4),%rbp
ff
cmp    $0xfffffffffffffffd,%rbp
jl     1182 <print_4+0x62>
lea    0xead(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbp,%rsi
sar    $0x2,%rsi
mov    (%r14,%rbp,2),%rdx
mov    (%rbx,%rbp,1),%ecx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xfffffffffffffffc,%rbp
cmp    $0xfffffffffffffffc,%rbp
jg     1160 <print_4+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"fith way: stupid complex pointers reversed\0A\00"
@.str.1 = [26 x i8] c"%ld: %s is %d years atm.\0A\00"
define void @print_4(i32 %0, i32* %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8**
%7 = alloca i32*
%8 = alloca i8**
store i32 %0, i32* %4
store i32* %1, i32** %5
store i8** %2, i8*** %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%10 = load i32*, i32** %5
store i32* %10, i32** %7
%11 = load i8**, i8*** %6
store i8** %11, i8*** %8
%12 = load i8**, i8*** %6
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = getelementptr inbounds i8*, i8** %15, i64 -1
store i8** %16, i8*** %8
%17 = load i32*, i32** %5
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = getelementptr inbounds i32, i32* %20, i64 -1
store i32* %21, i32** %7
br label %22
22: ; preds = %42, %3
%23 = load i32*, i32** %7
%24 = load i32*, i32** %5
%25 = ptrtoint i32* %23 to i64
%26 = ptrtoint i32* %24 to i64
%27 = sub i64 %25, %26
%28 = sdiv exact i64 %27, 4
%29 = icmp sge i64 %28, 0
br i1 %29, label %30, label %47
30: ; preds = %22
%31 = load i32*, i32** %7
%32 = load i32*, i32** %5
%33 = ptrtoint i32* %31 to i64
%34 = ptrtoint i32* %32 to i64
%35 = sub i64 %33, %34
%36 = sdiv exact i64 %35, 4
%37 = load i8**, i8*** %8
%38 = load i8*, i8** %37
%39 = load i32*, i32** %7
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i64 %36, i8* %38, i32 %40)
br label %42
42: ; preds = %30
%43 = load i8**, i8*** %8
%44 = getelementptr inbounds i8*, i8** %43, i32 -1
store i8** %44, i8*** %8
%45 = load i32*, i32** %7
%46 = getelementptr inbounds i32, i32* %45, i32 -1
store i32* %46, i32** %7
br label %22
47: ; preds = %22
ret void
}

LLVM IR (-O2):
@.str.1 = [26 x i8] c"%ld: %s is %d years atm.\0A\00"
@str = [43 x i8] c"fith way: stupid complex pointers reversed\00"
define void @print_4(i32 %0, i32* %1, i8** nocapture %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%5 = sext i32 %0 to i64
%6 = getelementptr inbounds i32, i32* %1, i64 %5
%7 = ptrtoint i32* %1 to i64
%8 = getelementptr inbounds i32, i32* %6, i64 -1
%9 = ptrtoint i32* %8 to i64
%10 = sub i64 %9, %7
%11 = icmp sgt i64 %10, -4
br i1 %11, label %12, label %27
12: ; preds = %3
%13 = getelementptr inbounds i8*, i8** %2, i64 %5
br label %14
14: ; preds = %12, %14
%15 = phi i64 [ %25, %14 ], [ %10, %12 ]
%16 = phi i8** [ %18, %14 ], [ %13, %12 ]
%17 = phi i32* [ %23, %14 ], [ %8, %12 ]
%18 = getelementptr inbounds i8*, i8** %16, i64 -1
%19 = ashr exact i64 %15, 2
%20 = load i8*, i8** %18
%21 = load i32, i32* %17
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i64 %19, i8* %20, i32 %21)
%23 = getelementptr inbounds i32, i32* %17, i64 -1
%24 = ptrtoint i32* %23 to i64
%25 = sub i64 %24, %7
%26 = icmp sgt i64 %25, -4
br i1 %26, label %14, label %27
27: ; preds = %14, %3
ret void
}