#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(float *, int, unsigned char *);
void xmp3_sbt_mono(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(sample, vbuf[0] + vb_ptr);
    xmp3_window(vbuf[0], vb_ptr, pcm);
    sample += 64;
    vb_ptr = (vb_ptr - 32) & 511;
    pcm += 32 * sizeof(short);
  }
  vb_ptr_arg[0] = vb_ptr;
}


x86 assembly (clang, -O0):
<xmp3_sbt_mono>:
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    11b5 <xmp3_sbt_mono+0x95>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movslq -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
call   1030 <xmp3_fdct32@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1040 <xmp3_window@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    $0x40,%rax
mov    %rax,-0x10(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    114b <xmp3_sbt_mono+0x2b>
mov    -0x30(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmp3_sbt_mono>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    (%r8),%ebx
test   %edx,%edx
jle    1189 <xmp3_sbt_mono+0x69>
mov    %rcx,%r15
mov    %edx,%r12d
mov    %rsi,%r13
mov    %rdi,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %ebx,%rbx
lea    (%r15,%rbx,4),%rsi
mov    %rbp,%rdi
call   1030 <xmp3_fdct32@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r13,%rdx
call   1040 <xmp3_window@plt>
add    $0x100,%rbp
add    $0x1e0,%ebx
and    $0x1ff,%ebx
add    $0x40,%r13
add    $0xffffffff,%r12d
jne    1150 <xmp3_sbt_mono+0x30>
mov    %ebx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @xmp3_sbt_mono(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 = %42, %5
%17 = load i32, i32* %11
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %45
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(float* %21, float* %27)
%29 = load [512 x float]*, [512 x float]** %9
%30 = getelementptr inbounds [512 x float], [512 x float]* %29, i64 0
%31 = getelementptr inbounds [512 x float], [512 x float]* %30, i64 0, i64 0
%32 = load i32, i32* %12
%33 = load i8*, i8** %7
%34 = call i32 @xmp3_window(float* %31, i32 %32, i8* %33)
%35 = load float*, float** %6
%36 = getelementptr inbounds float, float* %35, i64 64
store float* %36, float** %6
%37 = load i32, i32* %12
%38 = sub nsw i32 %37, 32
%39 = and i32 %38, 511
store i32 %39, i32* %12
%40 = load i8*, i8** %7
%41 = getelementptr inbounds i8, i8* %40, i64 64
store i8* %41, i8** %7
br label %42
42: ; preds = %20
%43 = load i32, i32* %11
%44 = add nsw i32 %43, 1
store i32 %44, i32* %11
br label %16
45: ; preds = %16
%46 = load i32, i32* %12
%47 = load i32*, i32** %10
%48 = getelementptr inbounds i32, i32* %47, i64 0
store i32 %46, i32* %48
ret void
}

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