#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_2to1(double *, int /*<<< orphan*/, unsigned char *, int *);
int synth_2to1_mono2stereo(double *bandPtr, unsigned char *samples, int *pnt) {
  int i, ret;
  ret = synth_2to1(bandPtr, 0, samples, pnt);
  samples = samples + *pnt - 64;
  for (i = 0; i < 16; i++) {
    ((short *)samples)[1] = ((short *)samples)[0];
    samples += 4;
  }
  return ret;
}


x86 assembly (clang, -O0):
<synth_2to1_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_2to1@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
add    $0xffffffffffffffc0,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x10,-0x1c(%rbp)
jge    118a <synth_2to1_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_2to1_mono2stereo+0x47>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<synth_2to1_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_2to1@plt>
movslq (%r14),%rcx
movzwl -0x40(%rbx,%rcx,1),%edx
movzwl -0x3c(%rbx,%rcx,1),%esi
mov    %dx,-0x3e(%rbx,%rcx,1)
mov    %si,-0x3a(%rbx,%rcx,1)
movzwl -0x38(%rbx,%rcx,1),%edx
mov    %dx,-0x36(%rbx,%rcx,1)
movzwl -0x34(%rbx,%rcx,1),%edx
mov    %dx,-0x32(%rbx,%rcx,1)
movzwl -0x30(%rbx,%rcx,1),%edx
mov    %dx,-0x2e(%rbx,%rcx,1)
movzwl -0x2c(%rbx,%rcx,1),%edx
mov    %dx,-0x2a(%rbx,%rcx,1)
movzwl -0x28(%rbx,%rcx,1),%edx
mov    %dx,-0x26(%rbx,%rcx,1)
movzwl -0x24(%rbx,%rcx,1),%edx
mov    %dx,-0x22(%rbx,%rcx,1)
movzwl -0x20(%rbx,%rcx,1),%edx
mov    %dx,-0x1e(%rbx,%rcx,1)
movzwl -0x1c(%rbx,%rcx,1),%edx
movzwl -0x18(%rbx,%rcx,1),%esi
mov    %dx,-0x1a(%rbx,%rcx,1)
mov    %si,-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_2to1_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_2to1(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 -64
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, 16
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_2to1_mono2stereo(double* %0, i8* %1, i32* %2) {
%4 = tail call i32 @synth_2to1(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 -64
%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
%48 = getelementptr inbounds i8, i8* %43, i64 4
%49 = bitcast i8* %48 to i16*
%50 = load i16, i16* %49
%51 = getelementptr inbounds i8, i8* %48, i64 2
%52 = bitcast i8* %51 to i16*
store i16 %50, i16* %52
%53 = getelementptr inbounds i8, i8* %48, i64 4
%54 = bitcast i8* %53 to i16*
%55 = load i16, i16* %54
%56 = getelementptr inbounds i8, i8* %53, i64 2
%57 = bitcast i8* %56 to i16*
store i16 %55, i16* %57
%58 = getelementptr inbounds i8, i8* %53, i64 4
%59 = bitcast i8* %58 to i16*
%60 = load i16, i16* %59
%61 = getelementptr inbounds i8, i8* %58, i64 2
%62 = bitcast i8* %61 to i16*
store i16 %60, i16* %62
%63 = getelementptr inbounds i8, i8* %58, i64 4
%64 = bitcast i8* %63 to i16*
%65 = load i16, i16* %64
%66 = getelementptr inbounds i8, i8* %63, i64 2
%67 = bitcast i8* %66 to i16*
store i16 %65, i16* %67
%68 = getelementptr inbounds i8, i8* %63, i64 4
%69 = bitcast i8* %68 to i16*
%70 = load i16, i16* %69
%71 = getelementptr inbounds i8, i8* %68, i64 2
%72 = bitcast i8* %71 to i16*
store i16 %70, i16* %72
%73 = getelementptr inbounds i8, i8* %68, i64 4
%74 = bitcast i8* %73 to i16*
%75 = load i16, i16* %74
%76 = getelementptr inbounds i8, i8* %73, i64 2
%77 = bitcast i8* %76 to i16*
store i16 %75, i16* %77
%78 = getelementptr inbounds i8, i8* %73, i64 4
%79 = bitcast i8* %78 to i16*
%80 = load i16, i16* %79
%81 = getelementptr inbounds i8, i8* %78, i64 2
%82 = bitcast i8* %81 to i16*
store i16 %80, i16* %82
%83 = getelementptr inbounds i8, i8* %78, i64 4
%84 = bitcast i8* %83 to i16*
%85 = load i16, i16* %84
%86 = getelementptr inbounds i8, i8* %83, i64 2
%87 = bitcast i8* %86 to i16*
store i16 %85, i16* %87
ret i32 %4
}