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


x86 assembly (clang, -O0):
<xmp3_sbt_dual>:
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)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f5 <xmp3_sbt_dual+0xd5>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movslq -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
call   1040 <xmp3_fdct32_dual@plt>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0x20(%rbp),%rsi
add    $0x800,%rsi
movslq -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
call   1040 <xmp3_fdct32_dual@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <xmp3_window_dual@plt>
mov    -0x20(%rbp),%rdi
add    $0x800,%rdi
mov    -0x30(%rbp),%esi
mov    -0x10(%rbp),%rdx
add    $0x2,%rdx
call   1030 <xmp3_window_dual@plt>
mov    -0x8(%rbp),%rax
add    $0x100,%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    114b <xmp3_sbt_dual+0x2b>
mov    -0x30(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmp3_sbt_dual>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,(%rsp)
mov    (%r8),%ebx
test   %edx,%edx
jle    11ab <xmp3_sbt_dual+0x8b>
mov    %rcx,%r15
mov    %edx,%r12d
mov    %rsi,%r13
mov    %rdi,%rbp
lea    0x800(%rcx),%r14
nopl   0x0(%rax)
movslq %ebx,%rbx
lea    (%r15,%rbx,4),%rsi
mov    %rbp,%rdi
call   1040 <xmp3_fdct32_dual@plt>
lea    (%r15,%rbx,4),%rsi
add    $0x800,%rsi
lea    0x4(%rbp),%rdi
call   1040 <xmp3_fdct32_dual@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r13,%rdx
call   1030 <xmp3_window_dual@plt>
lea    0x2(%r13),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <xmp3_window_dual@plt>
add    $0x1e0,%ebx
and    $0x1ff,%ebx
add    $0x100,%rbp
sub    $0xffffffffffffff80,%r13
add    $0xffffffff,%r12d
jne    1150 <xmp3_sbt_dual+0x30>
mov    (%rsp),%rax
mov    %ebx,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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