#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*/ cam16i(int const, int const, int const, int const,
                          int /*<<< orphan*/);
void cam16i_sn(const int c, const int n, const int a, const int f,
               unsigned short **d, const int r) {
  int i;
  for (i = 0; i < r; i++)
    cam16i(c, n + i, a, f, (*d)++);
}


x86 assembly (clang, -O0):
<cam16i_sn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1175 <cam16i_sn+0x65>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    -0x20(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    (%r8),%rax
mov    %rax,%r9
add    $0x2,%r9
mov    %r9,(%r8)
mov    %eax,%r8d
call   1030 <cam16i@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1133 <cam16i_sn+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cam16i_sn>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %r9d,%r9d
jle    1162 <cam16i_sn+0x52>
mov    %r9d,%ebx
mov    %r8,%r14
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %edi,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14),%r8
lea    0x2(%r8),%rax
mov    %rax,(%r14)
mov    %r13d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
call   1030 <cam16i@plt>
add    $0x1,%ebp
add    $0xffffffff,%ebx
jne    1140 <cam16i_sn+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @cam16i_sn(i32 %0, i32 %1, i32 %2, i32 %3, i16** %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i16**
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i16** %4, i16*** %11
store i32 %5, i32* %12
store i32 0, i32* %13
br label %14
14: ; preds = %30, %6
%15 = load i32, i32* %13
%16 = load i32, i32* %12
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %33
18: ; preds = %14
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = load i32, i32* %13
%22 = add nsw i32 %20, %21
%23 = load i32, i32* %9
%24 = load i32, i32* %10
%25 = load i16**, i16*** %11
%26 = load i16*, i16** %25
%27 = getelementptr inbounds i16, i16* %26, i32 1
store i16* %27, i16** %25
%28 = ptrtoint i16* %26 to i32
%29 = call i32 @cam16i(i32 %19, i32 %22, i32 %23, i32 %24, i32 %28)
br label %30
30: ; preds = %18
%31 = load i32, i32* %13
%32 = add nsw i32 %31, 1
store i32 %32, i32* %13
br label %14
33: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @cam16i_sn(i32 %0, i32 %1, i32 %2, i32 %3, i16** nocapture %4, i32 %5) {
%7 = icmp sgt i32 %5, 0
br i1 %7, label %8, label %18
8: ; preds = %6, %8
%9 = phi i32 [ %16, %8 ], [ 0, %6 ]
%10 = add nsw i32 %9, %1
%11 = load i16*, i16** %4
%12 = getelementptr inbounds i16, i16* %11, i64 1
store i16* %12, i16** %4
%13 = ptrtoint i16* %11 to i64
%14 = trunc i64 %13 to i32
%15 = tail call i32 @cam16i(i32 %0, i32 %10, i32 %2, i32 %3, i32 %14)
%16 = add nuw nsw i32 %9, 1
%17 = icmp eq i32 %16, %5
br i1 %17, label %18, label %8
18: ; preds = %8, %6
ret void
}