#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 */
struct bitstream {
  int dummy;
};

/* Variables and functions */
int bits_get_signed_rice(struct bitstream *, int);
void bits_get_signed_rice_array(struct bitstream *bits, int *array, int size,
                                int k) {
  for (int i = 0; i < size; i++)
    array[i] = bits_get_signed_rice(bits, k);
}


x86 assembly (clang, -O0):
<bits_get_signed_rice_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1160 <bits_get_signed_rice_array+0x50>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <bits_get_signed_rice@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <bits_get_signed_rice_array+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits_get_signed_rice_array>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edx,%edx
jle    1148 <bits_get_signed_rice_array+0x38>
mov    %ecx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
mov    %edx,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r14d,%esi
call   1030 <bits_get_signed_rice@plt>
mov    %eax,(%r15,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <bits_get_signed_rice_array+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.bitstream = type { i32 }
define void @bits_get_signed_rice_array(%struct.bitstream* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca %struct.bitstream*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store %struct.bitstream* %0, %struct.bitstream** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %22, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %25
14: ; preds = %10
%15 = load %struct.bitstream*, %struct.bitstream** %5
%16 = load i32, i32* %8
%17 = call i32 @bits_get_signed_rice(%struct.bitstream* %15, i32 %16)
%18 = load i32*, i32** %6
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
br label %22
22: ; preds = %14
%23 = load i32, i32* %9
%24 = add nsw i32 %23, 1
store i32 %24, i32* %9
br label %10
25: ; preds = %10
ret void
}

LLVM IR (-O2):
%struct.bitstream = type { i32 }
define void @bits_get_signed_rice_array(%struct.bitstream* %0, i32* nocapture writeonly %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %9
8: ; preds = %9, %4
ret void
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %13, %9 ]
%11 = tail call i32 @bits_get_signed_rice(%struct.bitstream* %0, i32 %3)
%12 = getelementptr inbounds i32, i32* %1, i64 %10
store i32 %11, i32* %12
%13 = add nuw nsw i64 %10, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %8, label %9
}