#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 */
struct ambe_synth {
  int dummy;
};
struct ambe_subframe {
  int dummy;
};
typedef scalar_t__ int16_t;

/* Variables and functions */
int /*<<< orphan*/ ambe_synth_unvoiced(struct ambe_synth *, float *,
                                       struct ambe_subframe *);
int /*<<< orphan*/ ambe_synth_voiced(struct ambe_synth *, float *,
                                     struct ambe_subframe *,
                                     struct ambe_subframe *);
void ambe_synth_audio(struct ambe_synth *synth, int16_t *audio,
                      struct ambe_subframe *sf, struct ambe_subframe *sf_prev) {
  float suv[80], sv[80];
  int i;
  ambe_synth_unvoiced(synth, suv, sf);
  ambe_synth_voiced(synth, sv, sf, sf_prev);
  for (i = 0; i < 80; i++)
    audio[i] = (int16_t)((suv[i] + 2.0f * sv[i]) * 4.0f);
}


x86 assembly (clang, -O0):
<ambe_synth_audio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x160(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <ambe_synth_unvoiced@plt>
mov    -0x8(%rbp),%rdi
lea    -0x2a0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1040 <ambe_synth_voiced@plt>
movl   $0x0,-0x2a4(%rbp)
cmpl   $0x50,-0x2a4(%rbp)
jge    11da <ambe_synth_audio+0xba>
movslq -0x2a4(%rbp),%rax
movss  -0x160(%rbp,%rax,4),%xmm1
ff ff
movslq -0x2a4(%rbp),%rax
movss  -0x2a0(%rbp,%rax,4),%xmm0
ff ff
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  0xe52(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%rdx
mov    -0x10(%rbp),%rax
movslq -0x2a4(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x2a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2a4(%rbp)
jmp    1171 <ambe_synth_audio+0x51>
add    $0x2b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ambe_synth_audio>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x288,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
lea    0x140(%rsp),%rsi
call   1030 <ambe_synth_unvoiced@plt>
mov    %rsp,%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <ambe_synth_voiced@plt>
mov    $0x2,%eax
movaps 0xe9c(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  0x138(%rsp,%rax,4),%xmm1
movsd  -0x8(%rsp,%rax,4),%xmm2
addps  %xmm2,%xmm2
addps  %xmm1,%xmm2
mulps  %xmm0,%xmm2
cvttss2si %xmm2,%rcx
shufps $0x55,%xmm2,%xmm2
cvttss2si %xmm2,%rdx
movq   %rcx,%xmm1
movq   %rdx,%xmm2
punpcklqdq %xmm2,%xmm1
movdqu %xmm1,-0x10(%rbx,%rax,8)
movsd  0x140(%rsp,%rax,4),%xmm1
movsd  (%rsp,%rax,4),%xmm2
addps  %xmm2,%xmm2
addps  %xmm1,%xmm2
mulps  %xmm0,%xmm2
cvttss2si %xmm2,%rcx
movq   %rcx,%xmm1
shufps $0x55,%xmm2,%xmm2
cvttss2si %xmm2,%rcx
movq   %rcx,%xmm2
punpcklqdq %xmm2,%xmm1
movdqu %xmm1,(%rbx,%rax,8)
add    $0x4,%rax
cmp    $0x52,%rax
jne    1170 <ambe_synth_audio+0x50>
add    $0x288,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.ambe_synth = type { i32 }
%struct.ambe_subframe = type { i32 }
define void @ambe_synth_audio(%struct.ambe_synth* %0, i64* %1, %struct.ambe_subframe* %2, %struct.ambe_subframe* %3) {
%5 = alloca %struct.ambe_synth*
%6 = alloca i64*
%7 = alloca %struct.ambe_subframe*
%8 = alloca %struct.ambe_subframe*
%9 = alloca [80 x float]
%10 = alloca [80 x float]
%11 = alloca i32
store %struct.ambe_synth* %0, %struct.ambe_synth** %5
store i64* %1, i64** %6
store %struct.ambe_subframe* %2, %struct.ambe_subframe** %7
store %struct.ambe_subframe* %3, %struct.ambe_subframe** %8
%12 = load %struct.ambe_synth*, %struct.ambe_synth** %5
%13 = getelementptr inbounds [80 x float], [80 x float]* %9, i64 0, i64 0
%14 = load %struct.ambe_subframe*, %struct.ambe_subframe** %7
%15 = call i32 @ambe_synth_unvoiced(%struct.ambe_synth* %12, float* %13, %struct.ambe_subframe* %14)
%16 = load %struct.ambe_synth*, %struct.ambe_synth** %5
%17 = getelementptr inbounds [80 x float], [80 x float]* %10, i64 0, i64 0
%18 = load %struct.ambe_subframe*, %struct.ambe_subframe** %7
%19 = load %struct.ambe_subframe*, %struct.ambe_subframe** %8
%20 = call i32 @ambe_synth_voiced(%struct.ambe_synth* %16, float* %17, %struct.ambe_subframe* %18, %struct.ambe_subframe* %19)
store i32 0, i32* %11
br label %21
21: ; preds = %40, %4
%22 = load i32, i32* %11
%23 = icmp slt i32 %22, 80
br i1 %23, label %24, label %43
24: ; preds = %21
%25 = load i32, i32* %11
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [80 x float], [80 x float]* %9, i64 0, i64 %26
%28 = load float, float* %27
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [80 x float], [80 x float]* %10, i64 0, i64 %30
%32 = load float, float* %31
%33 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %32, float %28)
%34 = fmul float %33, 4.000000e+00
%35 = fptosi float %34 to i64
%36 = load i64*, i64** %6
%37 = load i32, i32* %11
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i64, i64* %36, i64 %38
store i64 %35, i64* %39
br label %40
40: ; preds = %24
%41 = load i32, i32* %11
%42 = add nsw i32 %41, 1
store i32 %42, i32* %11
br label %21
43: ; preds = %21
ret void
}

LLVM IR (-O2):
%struct.ambe_synth = type { i32 }
%struct.ambe_subframe = type { i32 }
define void @ambe_synth_audio(%struct.ambe_synth* %0, i64* nocapture writeonly %1, %struct.ambe_subframe* %2, %struct.ambe_subframe* %3) {
%5 = alloca [80 x float]
%6 = alloca [80 x float]
%7 = bitcast [80 x float]* %5 to i8*
%8 = bitcast [80 x float]* %6 to i8*
%9 = getelementptr inbounds [80 x float], [80 x float]* %5, i64 0, i64 0
%10 = call i32 @ambe_synth_unvoiced(%struct.ambe_synth* %0, float* %9, %struct.ambe_subframe* %2)
%11 = getelementptr inbounds [80 x float], [80 x float]* %6, i64 0, i64 0
%12 = call i32 @ambe_synth_voiced(%struct.ambe_synth* %0, float* %11, %struct.ambe_subframe* %2, %struct.ambe_subframe* %3)
br label %13
13: ; preds = %13, %4
%14 = phi i64 [ 0, %4 ], [ %38, %13 ]
%15 = getelementptr inbounds [80 x float], [80 x float]* %5, i64 0, i64 %14
%16 = bitcast float* %15 to <2 x float>*
%17 = load <2 x float>, <2 x float>* %16
%18 = getelementptr inbounds [80 x float], [80 x float]* %6, i64 0, i64 %14
%19 = bitcast float* %18 to <2 x float>*
%20 = load <2 x float>, <2 x float>* %19
%21 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %20, <2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> %17)
%22 = fmul <2 x float> %21, <float 4.000000e+00, float 4.000000e+00>
%23 = fptosi <2 x float> %22 to <2 x i64>
%24 = getelementptr inbounds i64, i64* %1, i64 %14
%25 = bitcast i64* %24 to <2 x i64>*
store <2 x i64> %23, <2 x i64>* %25
%26 = or i64 %14, 2
%27 = getelementptr inbounds [80 x float], [80 x float]* %5, i64 0, i64 %26
%28 = bitcast float* %27 to <2 x float>*
%29 = load <2 x float>, <2 x float>* %28
%30 = getelementptr inbounds [80 x float], [80 x float]* %6, i64 0, i64 %26
%31 = bitcast float* %30 to <2 x float>*
%32 = load <2 x float>, <2 x float>* %31
%33 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %32, <2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> %29)
%34 = fmul <2 x float> %33, <float 4.000000e+00, float 4.000000e+00>
%35 = fptosi <2 x float> %34 to <2 x i64>
%36 = getelementptr inbounds i64, i64* %1, i64 %26
%37 = bitcast i64* %36 to <2 x i64>*
store <2 x i64> %35, <2 x i64>* %37
%38 = add nuw nsw i64 %14, 4
%39 = icmp eq i64 %38, 80
br i1 %39, label %40, label %13
40: ; preds = %13
ret void
}