#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*/ ImaExpandS(unsigned int, unsigned int, unsigned char const *,
                              short *, int, unsigned int);
void lsx_ima_block_expand_i(unsigned chans, const unsigned char *ibuff,
                            short *obuff, int n) {
  unsigned ch;
  for (ch = 0; ch < chans; ch++)
    ImaExpandS(ch, chans, ibuff, obuff + ch, n, chans);
}


x86 assembly (clang, -O0):
<lsx_ima_block_expand_i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    116c <lsx_ima_block_expand_i+0x5c>
mov    -0x20(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%eax
shl    $0x1,%rax
add    %rax,%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x4(%rbp),%r9d
call   1030 <ImaExpandS@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112d <lsx_ima_block_expand_i+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsx_ima_block_expand_i>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
je     1153 <lsx_ima_block_expand_i+0x43>
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %edi,%r12d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %r14d,%r8d
mov    %r12d,%r9d
call   1030 <ImaExpandS@plt>
add    $0x1,%rbp
add    $0x2,%rbx
cmp    %rbp,%r12
jne    1130 <lsx_ima_block_expand_i+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @lsx_ima_block_expand_i(i32 %0, i8* %1, i16* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i16*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i16* %2, i16** %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %25, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %5
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = load i32, i32* %9
%16 = load i32, i32* %5
%17 = load i8*, i8** %6
%18 = load i16*, i16** %7
%19 = load i32, i32* %9
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i16, i16* %18, i64 %20
%22 = load i32, i32* %8
%23 = load i32, i32* %5
%24 = call i32 @ImaExpandS(i32 %15, i32 %16, i8* %17, i16* %21, i32 %22, i32 %23)
br label %25
25: ; preds = %14
%26 = load i32, i32* %9
%27 = add i32 %26, 1
store i32 %27, i32* %9
br label %10
28: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @lsx_ima_block_expand_i(i32 %0, i8* %1, i16* %2, i32 %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %15, label %6
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %13, %8 ]
%10 = getelementptr inbounds i16, i16* %2, i64 %9
%11 = trunc i64 %9 to i32
%12 = tail call i32 @ImaExpandS(i32 %11, i32 %0, i8* %1, i16* %10, i32 %3, i32 %0)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %4
ret void
}