#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, int);
void lsx_ima_block_expand_m(unsigned chans, const unsigned char *ibuff,
                            short **obuffs, int n) {
  unsigned ch;
  for (ch = 0; ch < chans; ch++)
    ImaExpandS(ch, chans, ibuff, obuffs[ch], n, 1);
}


x86 assembly (clang, -O0):
<lsx_ima_block_expand_m>:
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    116b <lsx_ima_block_expand_m+0x5b>
mov    -0x20(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,8),%rcx
mov    -0x1c(%rbp),%r8d
mov    $0x1,%r9d
call   1030 <ImaExpandS@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112d <lsx_ima_block_expand_m+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsx_ima_block_expand_m>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
je     1152 <lsx_ima_block_expand_m+0x42>
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%r12
mov    %edi,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%r15,%rbp,8),%rcx
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %r14d,%r8d
mov    $0x1,%r9d
call   1030 <ImaExpandS@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <lsx_ima_block_expand_m+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @lsx_ima_block_expand_m(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 i16*, i16** %21
%23 = load i32, i32* %8
%24 = call i32 @ImaExpandS(i32 %15, i32 %16, i8* %17, i16* %22, i32 %23, i32 1)
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_m(i32 %0, i8* %1, i16** nocapture %2, i32 %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %16, label %6
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %14, %8 ]
%10 = getelementptr inbounds i16*, i16** %2, i64 %9
%11 = load i16*, i16** %10
%12 = trunc i64 %9 to i32
%13 = tail call i32 @ImaExpandS(i32 %12, i32 %0, i8* %1, i16* %11, i32 %3, i32 1)
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %16, label %8
16: ; preds = %8, %4
ret void
}