#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 synth_4to1(double *, int /*<<< orphan*/, unsigned char *, int *);
int synth_4to1_mono(double *bandPtr, unsigned char *samples, int *pnt) {
  short samples_tmp[16];
  short *tmp1 = samples_tmp;
  int i, ret;
  int pnt1 = 0;
  ret = synth_4to1(bandPtr, 0, (unsigned char *)samples_tmp, &pnt1);
  samples += *pnt;
  for (i = 0; i < 8; i++) {
    *((short *)samples) = *tmp1;
    samples += sizeof(short);
    tmp1 += 2;
  }
  *pnt += 8 * sizeof(short);
  return ret;
}


x86 assembly (clang, -O0):
<synth_4to1_mono>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rdx
xor    %esi,%esi
lea    -0x54(%rbp),%rcx
call   1030 <synth_4to1@plt>
mov    %eax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x4c(%rbp)
cmpl   $0x8,-0x4c(%rbp)
jge    11a2 <synth_4to1_mono+0x92>
mov    -0x48(%rbp),%rax
mov    (%rax),%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x48(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x48(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1164 <synth_4to1_mono+0x54>
mov    -0x18(%rbp),%rax
movslq (%rax),%rcx
add    $0x10,%rcx
mov    %ecx,(%rax)
mov    -0x50(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<synth_4to1_mono>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
movl   $0x0,0xc(%rsp)
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
xor    %esi,%esi
call   1030 <synth_4to1@plt>
movslq (%r14),%rcx
movzwl 0x10(%rsp),%edx
mov    %dx,(%rbx,%rcx,1)
movzwl 0x14(%rsp),%edx
mov    %dx,0x2(%rbx,%rcx,1)
movzwl 0x18(%rsp),%edx
mov    %dx,0x4(%rbx,%rcx,1)
movzwl 0x1c(%rsp),%edx
mov    %dx,0x6(%rbx,%rcx,1)
movzwl 0x20(%rsp),%edx
mov    %dx,0x8(%rbx,%rcx,1)
movzwl 0x24(%rsp),%edx
mov    %dx,0xa(%rbx,%rcx,1)
movzwl 0x28(%rsp),%edx
mov    %dx,0xc(%rbx,%rcx,1)
movzwl 0x2c(%rsp),%edx
mov    %dx,0xe(%rbx,%rcx,1)
add    $0x10,%ecx
mov    %ecx,(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @synth_4to1_mono(double* %0, i8* %1, i32* %2) {
%4 = alloca double*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [16 x i16]
%8 = alloca i16*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store double* %0, double** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%12 = getelementptr inbounds [16 x i16], [16 x i16]* %7, i64 0, i64 0
store i16* %12, i16** %8
store i32 0, i32* %11
%13 = load double*, double** %4
%14 = getelementptr inbounds [16 x i16], [16 x i16]* %7, i64 0, i64 0
%15 = bitcast i16* %14 to i8*
%16 = call i32 @synth_4to1(double* %13, i32 0, i8* %15, i32* %11)
store i32 %16, i32* %10
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = load i8*, i8** %5
%20 = sext i32 %18 to i64
%21 = getelementptr inbounds i8, i8* %19, i64 %20
store i8* %21, i8** %5
store i32 0, i32* %9
br label %22
22: ; preds = %34, %3
%23 = load i32, i32* %9
%24 = icmp slt i32 %23, 8
br i1 %24, label %25, label %37
25: ; preds = %22
%26 = load i16*, i16** %8
%27 = load i16, i16* %26
%28 = load i8*, i8** %5
%29 = bitcast i8* %28 to i16*
store i16 %27, i16* %29
%30 = load i8*, i8** %5
%31 = getelementptr inbounds i8, i8* %30, i64 2
store i8* %31, i8** %5
%32 = load i16*, i16** %8
%33 = getelementptr inbounds i16, i16* %32, i64 2
store i16* %33, i16** %8
br label %34
34: ; preds = %25
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %22
37: ; preds = %22
%38 = load i32*, i32** %6
%39 = load i32, i32* %38
%40 = sext i32 %39 to i64
%41 = add i64 %40, 16
%42 = trunc i64 %41 to i32
store i32 %42, i32* %38
%43 = load i32, i32* %10
ret i32 %43
}

LLVM IR (-O2):
define i32 @synth_4to1_mono(double* %0, i8* nocapture writeonly %1, i32* nocapture %2) {
%4 = alloca [16 x i16]
%5 = alloca i32
%6 = bitcast [16 x i16]* %4 to i8*
%7 = getelementptr inbounds [16 x i16], [16 x i16]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = call i32 @synth_4to1(double* %0, i32 0, i8* %6, i32* %5)
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = load i16, i16* %7
%14 = bitcast i8* %12 to i16*
store i16 %13, i16* %14
%15 = getelementptr inbounds i8, i8* %12, i64 2
%16 = getelementptr inbounds [16 x i16], [16 x i16]* %4, i64 0, i64 2
%17 = load i16, i16* %16
%18 = bitcast i8* %15 to i16*
store i16 %17, i16* %18
%19 = getelementptr inbounds i8, i8* %15, i64 2
%20 = getelementptr inbounds [16 x i16], [16 x i16]* %4, i64 0, i64 4
%21 = load i16, i16* %20
%22 = bitcast i8* %19 to i16*
store i16 %21, i16* %22
%23 = getelementptr inbounds i8, i8* %19, i64 2
%24 = getelementptr inbounds [16 x i16], [16 x i16]* %4, i64 0, i64 6
%25 = load i16, i16* %24
%26 = bitcast i8* %23 to i16*
store i16 %25, i16* %26
%27 = getelementptr inbounds i8, i8* %23, i64 2
%28 = getelementptr inbounds [16 x i16], [16 x i16]* %4, i64 0, i64 8
%29 = load i16, i16* %28
%30 = bitcast i8* %27 to i16*
store i16 %29, i16* %30
%31 = getelementptr inbounds i8, i8* %27, i64 2
%32 = getelementptr inbounds [16 x i16], [16 x i16]* %4, i64 0, i64 10
%33 = load i16, i16* %32
%34 = bitcast i8* %31 to i16*
store i16 %33, i16* %34
%35 = getelementptr inbounds i8, i8* %31, i64 2
%36 = getelementptr inbounds [16 x i16], [16 x i16]* %4, i64 0, i64 12
%37 = load i16, i16* %36
%38 = bitcast i8* %35 to i16*
store i16 %37, i16* %38
%39 = getelementptr inbounds i8, i8* %35, i64 2
%40 = getelementptr inbounds [16 x i16], [16 x i16]* %4, i64 0, i64 14
%41 = load i16, i16* %40
%42 = bitcast i8* %39 to i16*
store i16 %41, i16* %42
%43 = add i32 %10, 16
store i32 %43, i32* %2
ret i32 %9
}