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


x86 assembly (clang, -O0):
<synth_4to1_mono2stereo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
xor    %esi,%esi
call   1030 <synth_4to1@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
add    $0xffffffffffffffe0,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    118a <synth_4to1_mono2stereo+0x7a>
mov    -0x10(%rbp),%rax
mov    (%rax),%cx
mov    -0x10(%rbp),%rax
mov    %cx,0x2(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1157 <synth_4to1_mono2stereo+0x47>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<synth_4to1_mono2stereo>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
xor    %esi,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <synth_4to1@plt>
movslq (%r14),%rcx
movzwl -0x20(%rbx,%rcx,1),%edx
movzwl -0x1c(%rbx,%rcx,1),%esi
mov    %dx,-0x1e(%rbx,%rcx,1)
mov    %si,-0x1a(%rbx,%rcx,1)
movzwl -0x18(%rbx,%rcx,1),%edx
mov    %dx,-0x16(%rbx,%rcx,1)
movzwl -0x14(%rbx,%rcx,1),%edx
mov    %dx,-0x12(%rbx,%rcx,1)
movzwl -0x10(%rbx,%rcx,1),%edx
mov    %dx,-0xe(%rbx,%rcx,1)
movzwl -0xc(%rbx,%rcx,1),%edx
mov    %dx,-0xa(%rbx,%rcx,1)
movzwl -0x8(%rbx,%rcx,1),%edx
mov    %dx,-0x6(%rbx,%rcx,1)
movzwl -0x4(%rbx,%rcx,1),%edx
mov    %dx,-0x2(%rbx,%rcx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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