#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 /*<<< orphan*/ SKP_Silk_resample_1_2_coarse(short *, int *, short *, int *,
                                                int);
int /*<<< orphan*/ SKP_Silk_resample_3_1(short *, int *, short const *, int);
int SKP_min_int(int, int);
void SKP_Silk_resample_3_2(short *out, int *S, const short *in, int inLen) {
  int LSubFrameIn, LSubFrameOut;
  short outH[3 * 80];
  int scratch[(9 * 80) / 2];
  ;
  while (inLen > 0) {
    LSubFrameIn = SKP_min_int(80, inLen);
    LSubFrameOut =
        ((((98304) >> 16) * (int)((short)(LSubFrameIn))) +
         ((((98304) & 0x0000FFFF) * (int)((short)(LSubFrameIn))) >> 16));
    SKP_Silk_resample_3_1(outH, &S[0], in, LSubFrameIn);
    SKP_Silk_resample_1_2_coarse(outH, &S[7], out, scratch, LSubFrameOut);
    in += LSubFrameIn;
    out += LSubFrameOut;
    inLen -= LSubFrameIn;
  }
}


x86 assembly (clang, -O0):
<SKP_Silk_resample_3_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    11f0 <SKP_Silk_resample_3_2+0xc0>
mov    -0x1c(%rbp),%esi
mov    $0x50,%edi
call   1040 <SKP_min_int@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cwtl
shl    $0x0,%eax
mov    -0x20(%rbp),%ecx
movswl %cx,%ecx
shl    $0xf,%ecx
sar    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%ecx
call   1050 <SKP_Silk_resample_3_1@plt>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1c,%rsi
mov    -0x8(%rbp),%rdx
lea    -0x7b0(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1030 <SKP_Silk_resample_1_2_coarse@plt>
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
shl    $0x1,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x1,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
jmp    114a <SKP_Silk_resample_3_2+0x1a>
add    $0x7b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SKP_Silk_resample_3_2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x798,%rsp
mov    %rsi,(%rsp)
test   %ecx,%ecx
jle    11ce <SKP_Silk_resample_3_2+0x9e>
mov    %ecx,%r15d
mov    %rdx,%rbx
mov    %rdi,%rbp
mov    (%rsp),%rax
add    $0x1c,%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%r13
nopl   0x0(%rax,%rax,1)
mov    $0x50,%edi
mov    %r15d,%esi
call   1040 <SKP_min_int@plt>
mov    %eax,%r14d
movswl %r14w,%eax
mov    %eax,%r12d
sar    %r12d
add    %eax,%r12d
mov    %r13,%rdi
mov    (%rsp),%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1050 <SKP_Silk_resample_3_1@plt>
mov    %r13,%rdi
mov    0x8(%rsp),%rsi
mov    %rbp,%rdx
lea    0x1f0(%rsp),%rcx
mov    %r12d,%r8d
call   1030 <SKP_Silk_resample_1_2_coarse@plt>
movslq %r14d,%rax
lea    (%rbx,%rax,2),%rbx
movslq %r12d,%rcx
lea    0x0(%rbp,%rcx,2),%rbp
sub    %eax,%r15d
jg     1170 <SKP_Silk_resample_3_2+0x40>
add    $0x798,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @SKP_Silk_resample_3_2(i16* %0, i32* %1, i16* %2, i32 %3) {
%5 = alloca i16*
%6 = alloca i32*
%7 = alloca i16*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [240 x i16]
%12 = alloca [360 x i32]
store i16* %0, i16** %5
store i32* %1, i32** %6
store i16* %2, i16** %7
store i32 %3, i32* %8
br label %13
13: ; preds = %16, %4
%14 = load i32, i32* %8
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %53
16: ; preds = %13
%17 = load i32, i32* %8
%18 = call i32 @SKP_min_int(i32 80, i32 %17)
store i32 %18, i32* %9
%19 = load i32, i32* %9
%20 = trunc i32 %19 to i16
%21 = sext i16 %20 to i32
%22 = mul nsw i32 1, %21
%23 = load i32, i32* %9
%24 = trunc i32 %23 to i16
%25 = sext i16 %24 to i32
%26 = mul nsw i32 32768, %25
%27 = ashr i32 %26, 16
%28 = add nsw i32 %22, %27
store i32 %28, i32* %10
%29 = getelementptr inbounds [240 x i16], [240 x i16]* %11, i64 0, i64 0
%30 = load i32*, i32** %6
%31 = getelementptr inbounds i32, i32* %30, i64 0
%32 = load i16*, i16** %7
%33 = load i32, i32* %9
%34 = call i32 @SKP_Silk_resample_3_1(i16* %29, i32* %31, i16* %32, i32 %33)
%35 = getelementptr inbounds [240 x i16], [240 x i16]* %11, i64 0, i64 0
%36 = load i32*, i32** %6
%37 = getelementptr inbounds i32, i32* %36, i64 7
%38 = load i16*, i16** %5
%39 = getelementptr inbounds [360 x i32], [360 x i32]* %12, i64 0, i64 0
%40 = load i32, i32* %10
%41 = call i32 @SKP_Silk_resample_1_2_coarse(i16* %35, i32* %37, i16* %38, i32* %39, i32 %40)
%42 = load i32, i32* %9
%43 = load i16*, i16** %7
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds i16, i16* %43, i64 %44
store i16* %45, i16** %7
%46 = load i32, i32* %10
%47 = load i16*, i16** %5
%48 = sext i32 %46 to i64
%49 = getelementptr inbounds i16, i16* %47, i64 %48
store i16* %49, i16** %5
%50 = load i32, i32* %9
%51 = load i32, i32* %8
%52 = sub nsw i32 %51, %50
store i32 %52, i32* %8
br label %13
53: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @SKP_Silk_resample_3_2(i16* %0, i32* %1, i16* %2, i32 %3) {
%5 = alloca [240 x i16]
%6 = alloca [360 x i32]
%7 = bitcast [240 x i16]* %5 to i8*
%8 = bitcast [360 x i32]* %6 to i8*
%9 = icmp sgt i32 %3, 0
br i1 %9, label %10, label %31
10: ; preds = %4
%11 = getelementptr inbounds [240 x i16], [240 x i16]* %5, i64 0, i64 0
%12 = getelementptr inbounds i32, i32* %1, i64 7
%13 = getelementptr inbounds [360 x i32], [360 x i32]* %6, i64 0, i64 0
br label %14
14: ; preds = %10, %14
%15 = phi i16* [ %0, %10 ], [ %28, %14 ]
%16 = phi i16* [ %2, %10 ], [ %26, %14 ]
%17 = phi i32 [ %3, %10 ], [ %29, %14 ]
%18 = call i32 @SKP_min_int(i32 80, i32 %17)
%19 = shl i32 %18, 16
%20 = ashr exact i32 %19, 16
%21 = ashr i32 %19, 17
%22 = add nsw i32 %20, %21
%23 = call i32 @SKP_Silk_resample_3_1(i16* %11, i32* %1, i16* %16, i32 %18)
%24 = call i32 @SKP_Silk_resample_1_2_coarse(i16* %11, i32* %12, i16* %15, i32* %13, i32 %22)
%25 = sext i32 %18 to i64
%26 = getelementptr inbounds i16, i16* %16, i64 %25
%27 = sext i32 %22 to i64
%28 = getelementptr inbounds i16, i16* %15, i64 %27
%29 = sub nsw i32 %17, %18
%30 = icmp sgt i32 %29, 0
br i1 %30, label %14, label %31
31: ; preds = %14, %4
ret void
}