#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*/ _base_convolve_complex(float *, int, float *, int, float *,
                                          int, int, int, int, int);
scalar_t__ bounds_check(int, int, int, int, int, int);
int /*<<< orphan*/ memset(float *, int /*<<< orphan*/, int);
int convolve_complex(float *x, int x_len, float *h, int h_len, float *y,
                     int y_len, int start, int len, int step, int offset) {
  void (*conv_func)(float *, float *, float *, int, int) = NULL;
  if (bounds_check(x_len, h_len, y_len, start, len, step) < 0)
    return -1;
  memset(y, 0, len * 2 * sizeof(float));
  if (conv_func) {
    conv_func(&x[2 * (-(h_len - 1) + start)], h, y, h_len, len);
  } else {
    _base_convolve_complex(x, x_len, h, h_len, y, y_len, start, len, step,
                           offset);
  }
  return len;
}


x86 assembly (clang, -O0):
<convolve_complex>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x68,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9d,-0x3c(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    0x18(%rbp),%r8d
mov    0x20(%rbp),%r9d
call   1040 <bounds_check@plt>
cmp    $0x0,%rax
jge    1192 <convolve_complex+0x62>
movl   $0xffffffff,-0xc(%rbp)
jmp    122e <convolve_complex+0xfe>
mov    -0x38(%rbp),%rdi
mov    0x18(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
cmpq   $0x0,-0x48(%rbp)
je     11ee <convolve_complex+0xbe>
mov    -0x48(%rbp),%rax
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%edx
sub    $0x1,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
add    0x10(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rdi
mov    -0x28(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
mov    0x18(%rbp),%r8d
call   *%rax
jmp    1228 <convolve_complex+0xf8>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
mov    -0x38(%rbp),%r8
mov    -0x3c(%rbp),%r9d
mov    0x10(%rbp),%ebx
mov    0x18(%rbp),%r11d
mov    0x20(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1050 <_base_convolve_complex@plt>
mov    0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<convolve_complex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r13d
mov    %r8,%r12
mov    %ecx,%ebp
mov    %rdx,(%rsp)
mov    %esi,%r15d
mov    %rdi,%r14
mov    0x50(%rsp),%r9d
mov    0x48(%rsp),%ebx
mov    0x40(%rsp),%ecx
mov    %esi,%edi
mov    %ebp,%esi
mov    %r13d,%edx
mov    %ebx,%r8d
call   1040 <bounds_check@plt>
test   %rax,%rax
js     11ac <convolve_complex+0x7c>
lea    0x0(,%rbx,8),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %r14,%rdi
mov    %r15d,%esi
mov    (%rsp),%rdx
mov    %ebp,%ecx
mov    %r12,%r8
mov    %r13d,%r9d
mov    0x58(%rsp),%eax
push   %rax
mov    0x58(%rsp),%eax
push   %rax
push   %rbx
mov    0x58(%rsp),%eax
push   %rax
call   1050 <_base_convolve_complex@plt>
add    $0x20,%rsp
jmp    11b1 <convolve_complex+0x81>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @convolve_complex(float* %0, i32 %1, float* %2, i32 %3, float* %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca i32
%12 = alloca float*
%13 = alloca i32
%14 = alloca float*
%15 = alloca i32
%16 = alloca float*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca void (float*, float*, float*, i32, i32)*
store float* %0, float** %12
store i32 %1, i32* %13
store float* %2, float** %14
store i32 %3, i32* %15
store float* %4, float** %16
store i32 %5, i32* %17
store i32 %6, i32* %18
store i32 %7, i32* %19
store i32 %8, i32* %20
store i32 %9, i32* %21
store void (float*, float*, float*, i32, i32)* null, void (float*, float*, float*, i32, i32)** %22
%23 = load i32, i32* %13
%24 = load i32, i32* %15
%25 = load i32, i32* %17
%26 = load i32, i32* %18
%27 = load i32, i32* %19
%28 = load i32, i32* %20
%29 = call i64 @bounds_check(i32 %23, i32 %24, i32 %25, i32 %26, i32 %27, i32 %28)
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %10
store i32 -1, i32* %11
br label %71
32: ; preds = %10
%33 = load float*, float** %16
%34 = load i32, i32* %19
%35 = mul nsw i32 %34, 2
%36 = sext i32 %35 to i64
%37 = mul i64 %36, 4
%38 = trunc i64 %37 to i32
%39 = call i32 @memset(float* %33, i32 0, i32 %38)
%40 = load void (float*, float*, float*, i32, i32)*, void (float*, float*, float*, i32, i32)** %22
%41 = icmp ne void (float*, float*, float*, i32, i32)* %40, null
br i1 %41, label %42, label %57
42: ; preds = %32
%43 = load void (float*, float*, float*, i32, i32)*, void (float*, float*, float*, i32, i32)** %22
%44 = load float*, float** %12
%45 = load i32, i32* %15
%46 = sub nsw i32 %45, 1
%47 = sub nsw i32 0, %46
%48 = load i32, i32* %18
%49 = add nsw i32 %47, %48
%50 = mul nsw i32 2, %49
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds float, float* %44, i64 %51
%53 = load float*, float** %14
%54 = load float*, float** %16
%55 = load i32, i32* %15
%56 = load i32, i32* %19
br label %69
57: ; preds = %32
%58 = load float*, float** %12
%59 = load i32, i32* %13
%60 = load float*, float** %14
%61 = load i32, i32* %15
%62 = load float*, float** %16
%63 = load i32, i32* %17
%64 = load i32, i32* %18
%65 = load i32, i32* %19
%66 = load i32, i32* %20
%67 = load i32, i32* %21
%68 = call i32 @_base_convolve_complex(float* %58, i32 %59, float* %60, i32 %61, float* %62, i32 %63, i32 %64, i32 %65, i32 %66, i32 %67)
br label %69
69: ; preds = %57, %42
%70 = load i32, i32* %19
store i32 %70, i32* %11
br label %71
71: ; preds = %69, %31
%72 = load i32, i32* %11
ret i32 %72
}

LLVM IR (-O2):
define i32 @convolve_complex(float* %0, i32 %1, float* %2, i32 %3, float* %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = tail call i64 @bounds_check(i32 %1, i32 %3, i32 %5, i32 %6, i32 %7, i32 %8)
%12 = icmp slt i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = shl i32 %7, 3
%15 = tail call i32 @memset(float* %4, i32 0, i32 %14)
%16 = tail call i32 @_base_convolve_complex(float* %0, i32 %1, float* %2, i32 %3, float* %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9)
br label %17
17: ; preds = %10, %13
%18 = phi i32 [ %7, %13 ], [ -1, %10 ]
ret i32 %18
}