#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 pow(int, int);
void integerPower(int y, int ret[4]) {
  ret[0] = pow(y, 2);
  ret[1] = pow(y, 3);
  ret[2] = pow(y, 4);
  ret[3] = ret[0] + ret[1] + ret[2];
}


x86 assembly (clang, -O0):
<integerPower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    $0x3,%esi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
add    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
add    0x8(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integerPower>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %eax,(%rbx)
mov    %ebp,%edi
mov    $0x3,%esi
call   1030 <pow@plt>
mov    %eax,0x4(%rbx)
mov    %ebp,%edi
mov    $0x4,%esi
call   1030 <pow@plt>
mov    %eax,0x8(%rbx)
add    (%rbx),%eax
add    0x4(%rbx),%eax
mov    %eax,0xc(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @integerPower(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = call i32 @pow(i32 %5, i32 2)
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %6, i32* %8
%9 = load i32, i32* %3
%10 = call i32 @pow(i32 %9, i32 3)
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 1
store i32 %10, i32* %12
%13 = load i32, i32* %3
%14 = call i32 @pow(i32 %13, i32 4)
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 2
store i32 %14, i32* %16
%17 = load i32*, i32** %4
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = load i32*, i32** %4
%21 = getelementptr inbounds i32, i32* %20, i64 1
%22 = load i32, i32* %21
%23 = add nsw i32 %19, %22
%24 = load i32*, i32** %4
%25 = getelementptr inbounds i32, i32* %24, i64 2
%26 = load i32, i32* %25
%27 = add nsw i32 %23, %26
%28 = load i32*, i32** %4
%29 = getelementptr inbounds i32, i32* %28, i64 3
store i32 %27, i32* %29
ret void
}

LLVM IR (-O2):
define void @integerPower(i32 %0, i32* nocapture %1) {
%3 = tail call i32 @pow(i32 %0, i32 2)
store i32 %3, i32* %1
%4 = tail call i32 @pow(i32 %0, i32 3)
%5 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %4, i32* %5
%6 = tail call i32 @pow(i32 %0, i32 4)
%7 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %6, i32* %7
%8 = load i32, i32* %1
%9 = load i32, i32* %5
%10 = add i32 %8, %6
%11 = add i32 %10, %9
%12 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %11, i32* %12
ret void
}