#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 printTest(char const *argv[], int *list, int people) {
  int i;
  for (i = 0; i < people; i++) {
    printf("person %d got person %d\n", i + 2, list[i] + 2);
  }
  printf("\n");
  for (i = 0; i < people; i++) {
    printf("%s:\t\t%s\n", argv[i + 2], argv[list[i] + 2]);
  }
}


x86 assembly (clang, -O0):
<printTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1166 <printTest+0x56>
mov    -0x18(%rbp),%esi
add    $0x2,%esi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x2,%edx
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <printTest+0x1a>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11cd <printTest+0xbd>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117b <printTest+0x6b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTest>:
test   %edx,%edx
jle    11c1 <printTest+0xa1>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r13
mov    %rdi,%r14
mov    %edx,%ebp
lea    0xebb(%rip),%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbx,4),%edx
add    $0x2,%edx
lea    0x2(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <printTest+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r15d,%r15d
jle    11b2 <printTest+0x92>
lea    0xe95(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%r14,%rbx,8),%rsi
movslq 0x0(%r13,%rbx,4),%rax
mov    0x10(%r14,%rax,8),%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1190 <printTest+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xa,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [25 x i8] c"person %d got person %d\0A\00"
@.str.2 = [9 x i8] c"%s:\09\09%s\0A\00"
define void @printTest(i8** nocapture %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @putchar(i32 10)
br label %37
7: ; preds = %3
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %17, %9 ]
%11 = getelementptr inbounds i32, i32* %1, i64 %10
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 2
%14 = trunc i64 %10 to i32
%15 = add i32 %14, 2
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %13)
%17 = add nuw nsw i64 %10, 1
%18 = icmp eq i64 %17, %8
br i1 %18, label %19, label %9
19: ; preds = %9
%20 = tail call i32 @putchar(i32 10)
br i1 %4, label %21, label %37
21: ; preds = %19
%22 = zext i32 %2 to i64
br label %23
23: ; preds = %21, %23
%24 = phi i64 [ 0, %21 ], [ %35, %23 ]
%25 = add nuw nsw i64 %24, 2
%26 = getelementptr inbounds i8*, i8** %0, i64 %25
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i32, i32* %1, i64 %24
%29 = load i32, i32* %28
%30 = add nsw i32 %29, 2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %0, i64 %31
%33 = load i8*, i8** %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %27, i8* %33)
%35 = add nuw nsw i64 %24, 1
%36 = icmp eq i64 %35, %22
br i1 %36, label %37, label %23
37: ; preds = %23, %5, %19
ret void
}