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


x86 assembly (clang, -O0):
<SKP_Silk_resample_3_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8a0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    122d <SKP_Silk_resample_3_4+0xed>
mov    -0x1c(%rbp),%esi
mov    $0x50,%edi
call   1040 <SKP_min_int@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cwtl
imul   $0x0,%eax,%eax
mov    -0x20(%rbp),%ecx
movswl %cx,%ecx
imul   $0xc000,%ecx,%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   1060 <SKP_Silk_resample_3_1@plt>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1c,%rsi
lea    -0x300(%rbp),%rdx
lea    -0x8a0(%rbp),%rcx
mov    -0x24(%rbp),%r8d
shl    $0x1,%r8d
call   1050 <SKP_Silk_resample_1_2_coarsest@plt>
lea    -0x300(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x24,%rsi
mov    -0x8(%rbp),%rdx
lea    -0x8a0(%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    115a <SKP_Silk_resample_3_4+0x1a>
add    $0x8a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SKP_Silk_resample_3_4>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x898,%rsp
mov    %rsi,0x8(%rsp)
test   %ecx,%ecx
jle    120e <SKP_Silk_resample_3_4+0xce>
mov    %ecx,%r15d
mov    %rdx,%rbx
mov    %rdi,%rbp
mov    0x8(%rsp),%rax
lea    0x1c(%rax),%rcx
mov    %rcx,0x18(%rsp)
add    $0x24,%rax
mov    %rax,0x10(%rsp)
xchg   %ax,%ax
mov    $0x50,%edi
mov    %r15d,%esi
call   1040 <SKP_min_int@plt>
mov    %eax,%r12d
movswl %r12w,%eax
shl    $0xe,%eax
lea    (%rax,%rax,2),%r14d
sar    $0x10,%r14d
lea    0x110(%rsp),%r13
mov    %r13,%rdi
mov    0x8(%rsp),%rsi
mov    %rbx,%rdx
mov    %r12d,%ecx
call   1060 <SKP_Silk_resample_3_1@plt>
lea    (%r14,%r14,1),%r8d
mov    %r13,%rdi
mov    0x18(%rsp),%rsi
lea    0x20(%rsp),%r13
mov    %r13,%rdx
lea    0x2f0(%rsp),%rcx
call   1050 <SKP_Silk_resample_1_2_coarsest@plt>
mov    %r13,%rdi
mov    0x10(%rsp),%rsi
mov    %rbp,%rdx
lea    0x2f0(%rsp),%rcx
mov    %r14d,%r8d
call   1030 <SKP_Silk_resample_1_2_coarse@plt>
movslq %r12d,%rax
lea    (%rbx,%rax,2),%rbx
movslq %r14d,%rcx
lea    0x0(%rbp,%rcx,2),%rbp
sub    %eax,%r15d
jg     1180 <SKP_Silk_resample_3_4+0x40>
add    $0x898,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @SKP_Silk_resample_3_4(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 [120 x i16]
%13 = 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 %14
14: ; preds = %17, %4
%15 = load i32, i32* %8
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %62
17: ; preds = %14
%18 = load i32, i32* %8
%19 = call i32 @SKP_min_int(i32 80, i32 %18)
store i32 %19, i32* %9
%20 = load i32, i32* %9
%21 = trunc i32 %20 to i16
%22 = sext i16 %21 to i32
%23 = mul nsw i32 0, %22
%24 = load i32, i32* %9
%25 = trunc i32 %24 to i16
%26 = sext i16 %25 to i32
%27 = mul nsw i32 49152, %26
%28 = ashr i32 %27, 16
%29 = add nsw i32 %23, %28
store i32 %29, i32* %10
%30 = getelementptr inbounds [240 x i16], [240 x i16]* %11, i64 0, i64 0
%31 = load i32*, i32** %6
%32 = getelementptr inbounds i32, i32* %31, i64 0
%33 = load i16*, i16** %7
%34 = load i32, i32* %9
%35 = call i32 @SKP_Silk_resample_3_1(i16* %30, i32* %32, i16* %33, i32 %34)
%36 = getelementptr inbounds [240 x i16], [240 x i16]* %11, i64 0, i64 0
%37 = load i32*, i32** %6
%38 = getelementptr inbounds i32, i32* %37, i64 7
%39 = getelementptr inbounds [120 x i16], [120 x i16]* %12, i64 0, i64 0
%40 = getelementptr inbounds [360 x i32], [360 x i32]* %13, i64 0, i64 0
%41 = load i32, i32* %10
%42 = shl i32 %41, 1
%43 = call i32 @SKP_Silk_resample_1_2_coarsest(i16* %36, i32* %38, i16* %39, i32* %40, i32 %42)
%44 = getelementptr inbounds [120 x i16], [120 x i16]* %12, i64 0, i64 0
%45 = load i32*, i32** %6
%46 = getelementptr inbounds i32, i32* %45, i64 9
%47 = load i16*, i16** %5
%48 = getelementptr inbounds [360 x i32], [360 x i32]* %13, i64 0, i64 0
%49 = load i32, i32* %10
%50 = call i32 @SKP_Silk_resample_1_2_coarse(i16* %44, i32* %46, i16* %47, i32* %48, i32 %49)
%51 = load i32, i32* %9
%52 = load i16*, i16** %7
%53 = sext i32 %51 to i64
%54 = getelementptr inbounds i16, i16* %52, i64 %53
store i16* %54, i16** %7
%55 = load i32, i32* %10
%56 = load i16*, i16** %5
%57 = sext i32 %55 to i64
%58 = getelementptr inbounds i16, i16* %56, i64 %57
store i16* %58, i16** %5
%59 = load i32, i32* %9
%60 = load i32, i32* %8
%61 = sub nsw i32 %60, %59
store i32 %61, i32* %8
br label %14
62: ; preds = %14
ret void
}

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