#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*/ HC_abs(int, double *, double *);
int /*<<< orphan*/ HC_div(int, double const *, double const *, double *);
int /*<<< orphan*/ HC_mul(int, double const *, double *, double *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ malloc(int);
scalar_t__ realloc(double *, int);
int /*<<< orphan*/ stderr;
void HC_complex_phase_vocoder(int len, const double *fs, const double *ft,
                              const double *f_out_old, double *f_out) {
  static double *tmp1 = NULL;
  static double *tmp2 = NULL;
  static int n0 = 0;
  if (tmp1 == NULL) {
    tmp1 = (double *)malloc(sizeof(double) * len);
    tmp2 = (double *)malloc(sizeof(double) * len);
    if (tmp1 == NULL) {
      fprintf(stderr, "HC_complex_phase_vocoder"
                      " : malloc error for "
                      "tmp1"
                      "\n");
      exit(1);
    };
    if (tmp2 == NULL) {
      fprintf(stderr, "HC_complex_phase_vocoder"
                      " : malloc error for "
                      "tmp2"
                      "\n");
      exit(1);
    };
    n0 = len;
  } else if (n0 < len) {
    tmp1 = (double *)realloc(tmp1, sizeof(double) * len);
    tmp2 = (double *)realloc(tmp2, sizeof(double) * len);
    if (tmp1 == NULL) {
      fprintf(stderr, "HC_complex_phase_vocoder"
                      " : malloc error for "
                      "tmp1"
                      "\n");
      exit(1);
    };
    if (tmp2 == NULL) {
      fprintf(stderr, "HC_complex_phase_vocoder"
                      " : malloc error for "
                      "tmp2"
                      "\n");
      exit(1);
    };
    n0 = len;
  }
  HC_div(len, f_out_old, fs, tmp1);
  HC_abs(len, tmp1, tmp2);
  HC_div(len, tmp1, tmp2, tmp1);
  HC_mul(len, ft, tmp1, f_out);
}


x86 assembly (clang, -O0):
<HC_complex_phase_vocoder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,0x2ecd(%rip)
jne    122d <HC_complex_phase_vocoder+0xbd>
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,0x2eb1(%rip)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,0x2ea3(%rip)
cmpq   $0x0,0x2e93(%rip)
jne    11f2 <HC_complex_phase_vocoder+0x82>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
lea    0xe1d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
cmpq   $0x0,0x2e6e(%rip)
jne    121f <HC_complex_phase_vocoder+0xaf>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
lea    0xe22(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x4(%rbp),%eax
mov    %eax,0x2e48(%rip)
jmp    12de <HC_complex_phase_vocoder+0x16e>
mov    0x2e3d(%rip),%eax
cmp    -0x4(%rbp),%eax
jge    12d9 <HC_complex_phase_vocoder+0x169>
mov    0x2e1d(%rip),%rdi
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
call   1080 <realloc@plt>
mov    %rax,0x2e07(%rip)
mov    0x2e08(%rip),%rdi
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
call   1080 <realloc@plt>
mov    %rax,0x2df2(%rip)
cmpq   $0x0,0x2de2(%rip)
jne    12a3 <HC_complex_phase_vocoder+0x133>
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
lea    0xd6c(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
cmpq   $0x0,0x2dbd(%rip)
jne    12d0 <HC_complex_phase_vocoder+0x160>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
lea    0xd71(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x4(%rbp),%eax
mov    %eax,0x2d97(%rip)
jmp    12de <HC_complex_phase_vocoder+0x16e>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    0x2d70(%rip),%rcx
call   1030 <HC_div@plt>
mov    -0x4(%rbp),%edi
mov    0x2d61(%rip),%rsi
mov    0x2d62(%rip),%rdx
call   1060 <HC_abs@plt>
mov    -0x4(%rbp),%edi
mov    0x2d4b(%rip),%rsi
mov    0x2d4c(%rip),%rdx
mov    0x2d3d(%rip),%rcx
call   1030 <HC_div@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    0x2d2a(%rip),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <HC_mul@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HC_complex_phase_vocoder>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r12
mov    %rdx,%r15
mov    %rsi,%r13
mov    %edi,%ebx
mov    0x2ed0(%rip),%rcx
test   %rcx,%rcx
je     11c5 <HC_complex_phase_vocoder+0x55>
cmp    %ebx,0x2ed5(%rip)
jge    11ff <HC_complex_phase_vocoder+0x8f>
lea    0x0(,%rbx,8),%ebp
mov    %rcx,%rdi
mov    %ebp,%esi
call   1080 <realloc@plt>
mov    %rax,0x2eab(%rip)
mov    0x2eac(%rip),%rdi
mov    %ebp,%esi
call   1080 <realloc@plt>
jmp    11e1 <HC_complex_phase_vocoder+0x71>
lea    0x0(,%rbx,8),%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,0x2e86(%rip)
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,0x2e80(%rip)
mov    0x2e71(%rip),%rcx
test   %rcx,%rcx
je     125b <HC_complex_phase_vocoder+0xeb>
test   %rax,%rax
je     126d <HC_complex_phase_vocoder+0xfd>
mov    %ebx,0x2e71(%rip)
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r13,%rdx
call   1030 <HC_div@plt>
mov    0x2e4d(%rip),%rsi
mov    0x2e4e(%rip),%rdx
mov    %ebx,%edi
call   1060 <HC_abs@plt>
mov    0x2e38(%rip),%rcx
mov    0x2e39(%rip),%rdx
mov    %ebx,%edi
mov    %rcx,%rsi
call   1030 <HC_div@plt>
mov    0x2e20(%rip),%rdx
mov    %ebx,%edi
mov    %r15,%rsi
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <HC_mul@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%edi
lea    0xd95(%rip),%rsi
jmp    127d <HC_complex_phase_vocoder+0x10d>
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
lea    0xdb5(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@HC_complex_phase_vocoder.tmp1 = internal global double* null
@HC_complex_phase_vocoder.tmp2 = internal global double* null
@HC_complex_phase_vocoder.n0 = internal global i32 0
@stderr = global i32 0
@.str = [50 x i8] c"HC_complex_phase_vocoder : malloc error for tmp1\0A\00"
@.str.1 = [50 x i8] c"HC_complex_phase_vocoder : malloc error for tmp2\0A\00"
define void @HC_complex_phase_vocoder(i32 %0, double* %1, double* %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
store i32 %0, i32* %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%11 = load double*, double** @HC_complex_phase_vocoder.tmp1
%12 = icmp eq double* %11, null
br i1 %12, label %13, label %41
13: ; preds = %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = mul i64 8, %15
%17 = trunc i64 %16 to i32
%18 = call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to double*
store double* %19, double** @HC_complex_phase_vocoder.tmp1
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = mul i64 8, %21
%23 = trunc i64 %22 to i32
%24 = call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to double*
store double* %25, double** @HC_complex_phase_vocoder.tmp2
%26 = load double*, double** @HC_complex_phase_vocoder.tmp1
%27 = icmp eq double* %26, null
br i1 %27, label %28, label %32
28: ; preds = %13
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %13
%33 = load double*, double** @HC_complex_phase_vocoder.tmp2
%34 = icmp eq double* %33, null
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %32
%40 = load i32, i32* %6
store i32 %40, i32* @HC_complex_phase_vocoder.n0
br label %76
41: ; preds = %5
%42 = load i32, i32* @HC_complex_phase_vocoder.n0
%43 = load i32, i32* %6
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %75
45: ; preds = %41
%46 = load double*, double** @HC_complex_phase_vocoder.tmp1
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = mul i64 8, %48
%50 = trunc i64 %49 to i32
%51 = call i64 @realloc(double* %46, i32 %50)
%52 = inttoptr i64 %51 to double*
store double* %52, double** @HC_complex_phase_vocoder.tmp1
%53 = load double*, double** @HC_complex_phase_vocoder.tmp2
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = mul i64 8, %55
%57 = trunc i64 %56 to i32
%58 = call i64 @realloc(double* %53, i32 %57)
%59 = inttoptr i64 %58 to double*
store double* %59, double** @HC_complex_phase_vocoder.tmp2
%60 = load double*, double** @HC_complex_phase_vocoder.tmp1
%61 = icmp eq double* %60, null
br i1 %61, label %62, label %66
62: ; preds = %45
%63 = load i32, i32* @stderr
%64 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %45
%67 = load double*, double** @HC_complex_phase_vocoder.tmp2
%68 = icmp eq double* %67, null
br i1 %68, label %69, label %73
69: ; preds = %66
%70 = load i32, i32* @stderr
%71 = call i32 @fprintf(i32 %70, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %66
%74 = load i32, i32* %6
store i32 %74, i32* @HC_complex_phase_vocoder.n0
br label %75
75: ; preds = %73, %41
br label %76
76: ; preds = %75, %39
%77 = load i32, i32* %6
%78 = load double*, double** %9
%79 = load double*, double** %7
%80 = load double*, double** @HC_complex_phase_vocoder.tmp1
%81 = call i32 @HC_div(i32 %77, double* %78, double* %79, double* %80)
%82 = load i32, i32* %6
%83 = load double*, double** @HC_complex_phase_vocoder.tmp1
%84 = load double*, double** @HC_complex_phase_vocoder.tmp2
%85 = call i32 @HC_abs(i32 %82, double* %83, double* %84)
%86 = load i32, i32* %6
%87 = load double*, double** @HC_complex_phase_vocoder.tmp1
%88 = load double*, double** @HC_complex_phase_vocoder.tmp2
%89 = load double*, double** @HC_complex_phase_vocoder.tmp1
%90 = call i32 @HC_div(i32 %86, double* %87, double* %88, double* %89)
%91 = load i32, i32* %6
%92 = load double*, double** %8
%93 = load double*, double** @HC_complex_phase_vocoder.tmp1
%94 = load double*, double** %10
%95 = call i32 @HC_mul(i32 %91, double* %92, double* %93, double* %94)
ret void
}

LLVM IR (-O2):
@HC_complex_phase_vocoder.tmp1 = internal unnamed_addr global double* null
@HC_complex_phase_vocoder.tmp2 = internal unnamed_addr global double* null
@HC_complex_phase_vocoder.n0 = internal unnamed_addr global i32 0
@stderr = global i32 0
@.str = [50 x i8] c"HC_complex_phase_vocoder : malloc error for tmp1\0A\00"
@.str.1 = [50 x i8] c"HC_complex_phase_vocoder : malloc error for tmp2\0A\00"
define void @HC_complex_phase_vocoder(i32 %0, double* %1, double* %2, double* %3, double* %4) {
%6 = load double*, double** @HC_complex_phase_vocoder.tmp1
%7 = icmp eq double* %6, null
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = shl i32 %0, 3
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to double*
store double* %11, double** @HC_complex_phase_vocoder.tmp1
%12 = tail call i64 @malloc(i32 %9)
%13 = inttoptr i64 %12 to double*
store double* %13, double** @HC_complex_phase_vocoder.tmp2
%14 = load double*, double** @HC_complex_phase_vocoder.tmp1
%15 = icmp eq double* %14, null
br i1 %15, label %16, label %20
16: ; preds = %8
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %8
%21 = icmp eq i64 %12, 0
br i1 %21, label %22, label %48
22: ; preds = %20
%23 = load i32, i32* @stderr
%24 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %5
%27 = load i32, i32* @HC_complex_phase_vocoder.n0
%28 = icmp slt i32 %27, %0
br i1 %28, label %29, label %50
29: ; preds = %26
%30 = shl i32 %0, 3
%31 = tail call i64 @realloc(double* %6, i32 %30)
%32 = inttoptr i64 %31 to double*
store double* %32, double** @HC_complex_phase_vocoder.tmp1
%33 = load double*, double** @HC_complex_phase_vocoder.tmp2
%34 = tail call i64 @realloc(double* %33, i32 %30)
%35 = inttoptr i64 %34 to double*
store double* %35, double** @HC_complex_phase_vocoder.tmp2
%36 = load double*, double** @HC_complex_phase_vocoder.tmp1
%37 = icmp eq double* %36, null
br i1 %37, label %38, label %42
38: ; preds = %29
%39 = load i32, i32* @stderr
%40 = tail call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%41 = tail call i32 @exit(i32 1)
unreachable
42: ; preds = %29
%43 = icmp eq i64 %34, 0
br i1 %43, label %44, label %48
44: ; preds = %42
%45 = load i32, i32* @stderr
%46 = tail call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%47 = tail call i32 @exit(i32 1)
unreachable
48: ; preds = %42, %20
%49 = phi double* [ %14, %20 ], [ %36, %42 ]
store i32 %0, i32* @HC_complex_phase_vocoder.n0
br label %50
50: ; preds = %48, %26
%51 = phi double* [ %6, %26 ], [ %49, %48 ]
%52 = tail call i32 @HC_div(i32 %0, double* %3, double* %1, double* %51)
%53 = load double*, double** @HC_complex_phase_vocoder.tmp1
%54 = load double*, double** @HC_complex_phase_vocoder.tmp2
%55 = tail call i32 @HC_abs(i32 %0, double* %53, double* %54)
%56 = load double*, double** @HC_complex_phase_vocoder.tmp1
%57 = load double*, double** @HC_complex_phase_vocoder.tmp2
%58 = tail call i32 @HC_div(i32 %0, double* %56, double* %57, double* %56)
%59 = load double*, double** @HC_complex_phase_vocoder.tmp1
%60 = tail call i32 @HC_mul(i32 %0, double* %2, double* %59, double* %4)
ret void
}