#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 estimate_next(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int target[10];
  int c;
  for (c = 0; c < 10; c++) {
    target[c] = c * c * c + c - 9;
  }
  int x = estimate_next(target, 10);
  for (c = 0; c < 10; c++) {
    printf("%d ", target[c]);
  }
  printf("\n---\n%d", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1167 <main+0x47>
mov    -0x34(%rbp),%ecx
imul   -0x34(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x34(%rbp),%ecx
sub    $0x9,%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1136 <main+0x16>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <estimate_next@plt>
mov    %eax,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11ab <main+0x8b>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    117f <main+0x5f>
mov    -0x38(%rbp),%esi
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
movaps 0xed3(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x2d9000001ff,%rax
mov    %rax,0x20(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <estimate_next@plt>
mov    %eax,%ebp
mov    (%rsp),%esi
lea    0xebb(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xe44(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@.str.1 = [8 x i8] c"\0A---\0A%d\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%7 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 -9, i32 -7, i32 1, i32 21>, <4 x i32>* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%12 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 59, i32 121, i32 213, i32 341>, <4 x i32>* %12
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
store i32 511, i32* %13
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
store i32 729, i32* %14
%15 = call i32 @estimate_next(i32* %3, i32 10)
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %5
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %6
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %8
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %9
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %10
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %11
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %13
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %14
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %15)
ret i32 0
}