#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*/ negate(int *, int);
int /*<<< orphan*/ printf(char *, ...);
void printTest(int *numbers, int n) {
  printf("%d\n", n);
  for (int i = 0; i < n; i++)
    printf("%d ", numbers[i]);
  printf("\n");
  negate(numbers, n);
  for (int i = 0; i < n; i++)
    printf("%d ", numbers[i]);
  printf("\n\n");
}


x86 assembly (clang, -O0):
<printTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117a <printTest+0x5a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1147 <printTest+0x27>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <negate@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ce <printTest+0xae>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119b <printTest+0x7b>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTest>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
jle    11c9 <printTest+0x89>
mov    %r14d,%ebp
lea    0xe99(%rip),%r15
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r12,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <printTest+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    %r14d,%esi
call   1060 <negate@plt>
test   %r14d,%r14d
jle    11de <printTest+0x9e>
lea    0xe5c(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11b0 <printTest+0x70>
jmp    11de <printTest+0x9e>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    %r14d,%esi
call   1060 <negate@plt>
lea    0xe1d(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

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

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