#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*/ xmp3_fdct32(float *, float *);
int /*<<< orphan*/ xmp3_window_dual(float *, int, unsigned char *);
void xmp3_sbt_dual_L3(float *sample, unsigned char *pcm, int ch,
                      float vbuf[][512], int vb_ptr_arg[]) {
  int i;
  int vb_ptr;
  pcm += ch * sizeof(short);
  vb_ptr = vb_ptr_arg[ch];
  for (i = 0; i < 18; i++) {
    xmp3_fdct32(sample, vbuf[ch] + vb_ptr);
    xmp3_window_dual(vbuf[ch], vb_ptr, pcm);
    sample += 32;
    vb_ptr = (vb_ptr - 32) & 511;
    pcm += 64 * sizeof(short);
  }
  vb_ptr_arg[ch] = vb_ptr;
}


x86 assembly (clang, -O0):
<xmp3_sbt_dual_L3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x1,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x12,-0x2c(%rbp)
jge    11e0 <xmp3_sbt_dual_L3+0xc0>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0xb,%rax
add    %rax,%rsi
movslq -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
call   1030 <xmp3_fdct32@plt>
mov    -0x20(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0xb,%rax
add    %rax,%rdi
mov    -0x30(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1040 <xmp3_window_dual@plt>
mov    -0x8(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x8(%rbp)
mov    -0x30(%rbp),%eax
sub    $0x20,%eax
and    $0x1ff,%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x10(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1160 <xmp3_sbt_dual_L3+0x40>
mov    -0x30(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmp3_sbt_dual_L3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r15
movslq %edx,%r12
lea    (%rsi,%r12,2),%r14
mov    %r8,0x10(%rsp)
mov    (%r8,%r12,4),%ebx
mov    %r12,0x8(%rsp)
shl    $0xb,%r12
add    %rcx,%r12
xor    %ebp,%ebp
nop
lea    (%r15,%rbp,1),%rdi
lea    (%r14,%rbp,1),%r13
movslq %ebx,%rbx
lea    (%r12,%rbx,4),%rsi
call   1030 <xmp3_fdct32@plt>
mov    %r12,%rdi
mov    %ebx,%esi
mov    %r13,%rdx
call   1040 <xmp3_window_dual@plt>
add    $0x1e0,%ebx
and    $0x1ff,%ebx
sub    $0xffffffffffffff80,%rbp
cmp    $0x900,%ebp
jne    1150 <xmp3_sbt_dual_L3+0x30>
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rcx
mov    %ebx,(%rax,%rcx,4)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @xmp3_sbt_dual_L3(float* %0, i8* %1, i32 %2, [512 x float]* %3, i32* %4) {
%6 = alloca float*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [512 x float]*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
store float* %0, float** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store [512 x float]* %3, [512 x float]** %9
store i32* %4, i32** %10
%13 = load i32, i32* %8
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 2
%16 = load i8*, i8** %7
%17 = getelementptr inbounds i8, i8* %16, i64 %15
store i8* %17, i8** %7
%18 = load i32*, i32** %10
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
store i32 %22, i32* %12
store i32 0, i32* %11
br label %23
23: ; preds = %52, %5
%24 = load i32, i32* %11
%25 = icmp slt i32 %24, 18
br i1 %25, label %26, label %55
26: ; preds = %23
%27 = load float*, float** %6
%28 = load [512 x float]*, [512 x float]** %9
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [512 x float], [512 x float]* %28, i64 %30
%32 = getelementptr inbounds [512 x float], [512 x float]* %31, i64 0, i64 0
%33 = load i32, i32* %12
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds float, float* %32, i64 %34
%36 = call i32 @xmp3_fdct32(float* %27, float* %35)
%37 = load [512 x float]*, [512 x float]** %9
%38 = load i32, i32* %8
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [512 x float], [512 x float]* %37, i64 %39
%41 = getelementptr inbounds [512 x float], [512 x float]* %40, i64 0, i64 0
%42 = load i32, i32* %12
%43 = load i8*, i8** %7
%44 = call i32 @xmp3_window_dual(float* %41, i32 %42, i8* %43)
%45 = load float*, float** %6
%46 = getelementptr inbounds float, float* %45, i64 32
store float* %46, float** %6
%47 = load i32, i32* %12
%48 = sub nsw i32 %47, 32
%49 = and i32 %48, 511
store i32 %49, i32* %12
%50 = load i8*, i8** %7
%51 = getelementptr inbounds i8, i8* %50, i64 128
store i8* %51, i8** %7
br label %52
52: ; preds = %26
%53 = load i32, i32* %11
%54 = add nsw i32 %53, 1
store i32 %54, i32* %11
br label %23
55: ; preds = %23
%56 = load i32, i32* %12
%57 = load i32*, i32** %10
%58 = load i32, i32* %8
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i32, i32* %57, i64 %59
store i32 %56, i32* %60
ret void
}

LLVM IR (-O2):
define void @xmp3_sbt_dual_L3(float* %0, i8* %1, i32 %2, [512 x float]* %3, i32* nocapture %4) {
%6 = sext i32 %2 to i64
%7 = shl nsw i64 %6, 1
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = getelementptr inbounds i32, i32* %4, i64 %6
%10 = load i32, i32* %9
%11 = getelementptr inbounds [512 x float], [512 x float]* %3, i64 %6, i64 0
br label %12
12: ; preds = %5, %12
%13 = phi i32 [ %10, %5 ], [ %23, %12 ]
%14 = phi i32 [ 0, %5 ], [ %25, %12 ]
%15 = phi float* [ %0, %5 ], [ %21, %12 ]
%16 = phi i8* [ %8, %5 ], [ %24, %12 ]
%17 = sext i32 %13 to i64
%18 = getelementptr inbounds [512 x float], [512 x float]* %3, i64 %6, i64 %17
%19 = tail call i32 @xmp3_fdct32(float* %15, float* %18)
%20 = tail call i32 @xmp3_window_dual(float* %11, i32 %13, i8* %16)
%21 = getelementptr inbounds float, float* %15, i64 32
%22 = add i32 %13, 480
%23 = and i32 %22, 511
%24 = getelementptr inbounds i8, i8* %16, i64 128
%25 = add nuw nsw i32 %14, 1
%26 = icmp eq i32 %25, 18
br i1 %26, label %27, label %12
27: ; preds = %12
store i32 %23, i32* %9
ret void
}