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


x86 assembly (clang, -O0):
<synth_2to1_mono>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rdx
xor    %esi,%esi
lea    -0x74(%rbp),%rcx
call   1030 <synth_2to1@plt>
mov    %eax,-0x70(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x6c(%rbp)
cmpl   $0x10,-0x6c(%rbp)
jge    11a5 <synth_2to1_mono+0x95>
mov    -0x68(%rbp),%rax
mov    (%rax),%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x68(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x68(%rbp)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1167 <synth_2to1_mono+0x57>
mov    -0x18(%rbp),%rax
movslq (%rax),%rcx
add    $0x20,%rcx
mov    %ecx,(%rax)
mov    -0x70(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<synth_2to1_mono>:
push   %r14
push   %rbx
sub    $0x58,%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_2to1@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)
movzwl 0x30(%rsp),%edx
mov    %dx,0x10(%rbx,%rcx,1)
movzwl 0x34(%rsp),%edx
mov    %dx,0x12(%rbx,%rcx,1)
movzwl 0x38(%rsp),%edx
mov    %dx,0x14(%rbx,%rcx,1)
movzwl 0x3c(%rsp),%edx
mov    %dx,0x16(%rbx,%rcx,1)
movzwl 0x40(%rsp),%edx
mov    %dx,0x18(%rbx,%rcx,1)
movzwl 0x44(%rsp),%edx
mov    %dx,0x1a(%rbx,%rcx,1)
movzwl 0x48(%rsp),%edx
mov    %dx,0x1c(%rbx,%rcx,1)
movzwl 0x4c(%rsp),%edx
mov    %dx,0x1e(%rbx,%rcx,1)
add    $0x20,%ecx
mov    %ecx,(%r14)
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @synth_2to1_mono(double* %0, i8* %1, i32* %2) {
%4 = alloca double*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [32 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 [32 x i16], [32 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 [32 x i16], [32 x i16]* %7, i64 0, i64 0
%15 = bitcast i16* %14 to i8*
%16 = call i32 @synth_2to1(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, 16
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, 32
%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_2to1_mono(double* %0, i8* nocapture writeonly %1, i32* nocapture %2) {
%4 = alloca [32 x i16]
%5 = alloca i32
%6 = bitcast [32 x i16]* %4 to i8*
%7 = getelementptr inbounds [32 x i16], [32 x i16]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = call i32 @synth_2to1(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 [32 x i16], [32 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 [32 x i16], [32 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 [32 x i16], [32 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 [32 x i16], [32 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 [32 x i16], [32 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 [32 x i16], [32 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 [32 x i16], [32 x i16]* %4, i64 0, i64 14
%41 = load i16, i16* %40
%42 = bitcast i8* %39 to i16*
store i16 %41, i16* %42
%43 = getelementptr inbounds i8, i8* %39, i64 2
%44 = getelementptr inbounds [32 x i16], [32 x i16]* %4, i64 0, i64 16
%45 = load i16, i16* %44
%46 = bitcast i8* %43 to i16*
store i16 %45, i16* %46
%47 = getelementptr inbounds i8, i8* %43, i64 2
%48 = getelementptr inbounds [32 x i16], [32 x i16]* %4, i64 0, i64 18
%49 = load i16, i16* %48
%50 = bitcast i8* %47 to i16*
store i16 %49, i16* %50
%51 = getelementptr inbounds i8, i8* %47, i64 2
%52 = getelementptr inbounds [32 x i16], [32 x i16]* %4, i64 0, i64 20
%53 = load i16, i16* %52
%54 = bitcast i8* %51 to i16*
store i16 %53, i16* %54
%55 = getelementptr inbounds i8, i8* %51, i64 2
%56 = getelementptr inbounds [32 x i16], [32 x i16]* %4, i64 0, i64 22
%57 = load i16, i16* %56
%58 = bitcast i8* %55 to i16*
store i16 %57, i16* %58
%59 = getelementptr inbounds i8, i8* %55, i64 2
%60 = getelementptr inbounds [32 x i16], [32 x i16]* %4, i64 0, i64 24
%61 = load i16, i16* %60
%62 = bitcast i8* %59 to i16*
store i16 %61, i16* %62
%63 = getelementptr inbounds i8, i8* %59, i64 2
%64 = getelementptr inbounds [32 x i16], [32 x i16]* %4, i64 0, i64 26
%65 = load i16, i16* %64
%66 = bitcast i8* %63 to i16*
store i16 %65, i16* %66
%67 = getelementptr inbounds i8, i8* %63, i64 2
%68 = getelementptr inbounds [32 x i16], [32 x i16]* %4, i64 0, i64 28
%69 = load i16, i16* %68
%70 = bitcast i8* %67 to i16*
store i16 %69, i16* %70
%71 = getelementptr inbounds i8, i8* %67, i64 2
%72 = getelementptr inbounds [32 x i16], [32 x i16]* %4, i64 0, i64 30
%73 = load i16, i16* %72
%74 = bitcast i8* %71 to i16*
store i16 %73, i16* %74
%75 = add i32 %10, 32
store i32 %75, i32* %2
ret i32 %9
}