#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 *plusOne(int *, int, int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int d1[] = {8, 9, 9, 9, 9, 9, 9, 9, 9};
  int d2[] = {9, 9, 9, 9, 9, 9, 9, 9, 9};
  int returnSize;
  int *nd1 = plusOne(d1, 9, &returnSize);
  for (int i = 0; i < returnSize; i++)
    printf("%d ", nd1[i]);
  printf("\n");
  int *nd2 = plusOne(d2, 9, &returnSize);
  for (int i = 0; i < returnSize; i++)
    printf("%d ", nd2[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xece(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
lea    -0x64(%rbp),%rdx
call   1040 <plusOne@plt>
mov    %rax,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    11bc <main+0x8c>
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1189 <main+0x59>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x9,%esi
lea    -0x64(%rbp),%rdx
call   1040 <plusOne@plt>
mov    %rax,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1229 <main+0xf9>
mov    -0x80(%rbp),%rax
movslq -0x84(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11ea <main+0xba>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    0xee1(%rip),%eax
mov    %eax,0x60(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    0xeef(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x40(%rsp),%rdi
lea    0xc(%rsp),%rdx
mov    $0x9,%esi
call   1050 <plusOne@plt>
cmpl   $0x0,0xc(%rsp)
jle    11cc <main+0x9c>
mov    %rax,%r15
lea    0xeb2(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11b0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rdx
mov    $0x9,%esi
call   1050 <plusOne@plt>
cmpl   $0x0,0xc(%rsp)
jle    121c <main+0xec>
mov    %rax,%r15
lea    0xe59(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1200 <main+0xd0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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