#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 */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ sample_mix(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/ const);
void alist_envmix_mix(size_t n, int16_t **dst, const int16_t *gains,
                      int16_t src) {
  size_t i;
  for (i = 0; i < n; ++i)
    sample_mix(dst[i], src, gains[i]);
}


x86 assembly (clang, -O0):
<alist_envmix_mix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    116d <alist_envmix_mix+0x5d>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
call   1030 <sample_mix@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    112f <alist_envmix_mix+0x1f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alist_envmix_mix>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rdi,%rdi
je     1149 <alist_envmix_mix+0x39>
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbp,8),%rdi
mov    (%r15,%rbp,4),%edx
mov    %r14d,%esi
call   1030 <sample_mix@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <alist_envmix_mix+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @alist_envmix_mix(i64 %0, i32** nocapture %1, i32* nocapture %2, i32 %3) {
%5 = icmp eq i64 %0, 0
br i1 %5, label %15, label %6
6: ; preds = %4, %6
%7 = phi i64 [ %13, %6 ], [ 0, %4 ]
%8 = getelementptr inbounds i32*, i32** %1, i64 %7
%9 = load i32*, i32** %8
%10 = getelementptr inbounds i32, i32* %2, i64 %7
%11 = load i32, i32* %10
%12 = tail call i32 @sample_mix(i32* %9, i32 %3, i32 %11)
%13 = add nuw i64 %7, 1
%14 = icmp eq i64 %13, %0
br i1 %14, label %15, label %6
15: ; preds = %6, %4
ret void
}