#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 */
scalar_t__ calloc(unsigned int, int);
int /*<<< orphan*/ free(float *);
scalar_t__ malloc(unsigned int);
int /*<<< orphan*/ memcpy(float *, float *, int);
float *cpu_compute(float *input, float *coeff, unsigned int numTap,
                   unsigned int numData) {
  float *out_cpu, *temp_in;
  out_cpu = (float *)malloc(numData * sizeof(float));
  temp_in = (float *)calloc((numData + numTap - 1), sizeof(float));
  memcpy((temp_in + numTap - 1), input, sizeof(float) * numData);
  free(temp_in);
  return out_cpu;
}


x86 assembly (clang, -O0):
<cpu_compute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
add    -0x14(%rbp),%edi
sub    $0x1,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%eax
shl    $0x2,%rax
add    %rax,%rdi
add    $0xfffffffffffffffc,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edx
call   1050 <memcpy@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_compute>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %rdi,%r15
lea    0x0(,%rbx,4),%ebp
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
lea    (%r14,%rbx,1),%edi
add    $0xffffffff,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    %r14d,%eax
lea    (%rbx,%rax,4),%rdi
add    $0xfffffffffffffffc,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1050 <memcpy@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float* @cpu_compute(float* %0, float* %1, i32 %2, i32 %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca float*
%10 = alloca float*
store float* %0, float** %5
store float* %1, float** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %8
%12 = zext i32 %11 to i64
%13 = mul i64 %12, 4
%14 = trunc i64 %13 to i32
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to float*
store float* %16, float** %9
%17 = load i32, i32* %8
%18 = load i32, i32* %7
%19 = add i32 %17, %18
%20 = sub i32 %19, 1
%21 = call i64 @calloc(i32 %20, i32 4)
%22 = inttoptr i64 %21 to float*
store float* %22, float** %10
%23 = load float*, float** %10
%24 = load i32, i32* %7
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds float, float* %23, i64 %25
%27 = getelementptr inbounds float, float* %26, i64 -1
%28 = load float*, float** %5
%29 = load i32, i32* %8
%30 = zext i32 %29 to i64
%31 = mul i64 4, %30
%32 = trunc i64 %31 to i32
%33 = call i32 @memcpy(float* %27, float* %28, i32 %32)
%34 = load float*, float** %10
%35 = call i32 @free(float* %34)
%36 = load float*, float** %9
ret float* %36
}

LLVM IR (-O2):
define float* @cpu_compute(float* %0, float* nocapture readnone %1, i32 %2, i32 %3) {
%5 = shl i32 %3, 2
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to float*
%8 = add i32 %2, -1
%9 = add i32 %8, %3
%10 = tail call i64 @calloc(i32 %9, i32 4)
%11 = inttoptr i64 %10 to float*
%12 = zext i32 %2 to i64
%13 = getelementptr inbounds float, float* %11, i64 %12
%14 = getelementptr inbounds float, float* %13, i64 -1
%15 = tail call i32 @memcpy(float* %14, float* %0, i32 %5)
%16 = tail call i32 @free(float* %11)
ret float* %7
}