#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*/ dynarray_nochk_add(void ***, void *);
int dynarray_nochk_count(void **);
int /*<<< orphan*/ memmove(void **, void **, int);
void dynarray_nochk_prepend(void ***par, void *new) {
  void **ar;
  int i;
  dynarray_nochk_add(par, new);
  ar = *par;
  i = dynarray_nochk_count(ar) - 1;
  if (i > 0)
    memmove(ar + 1, ar, i * sizeof *ar);
  ar[0] = new;
}


x86 assembly (clang, -O0):
<dynarray_nochk_prepend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <dynarray_nochk_add@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <dynarray_nochk_count@plt>
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    118c <dynarray_nochk_prepend+0x5c>
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
mov    -0x18(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1040 <memmove@plt>
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dynarray_nochk_prepend>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <dynarray_nochk_add@plt>
mov    (%rbx),%rbx
mov    %rbx,%rdi
call   1050 <dynarray_nochk_count@plt>
cmp    $0x2,%eax
jl     1162 <dynarray_nochk_prepend+0x32>
lea    0x8(%rbx),%rdi
lea    -0x8(,%rax,8),%edx
mov    %rbx,%rsi
call   1040 <memmove@plt>
mov    %r14,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @dynarray_nochk_prepend(i8*** %0, i8* %1) {
%3 = alloca i8***
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8*** %0, i8**** %3
store i8* %1, i8** %4
%7 = load i8***, i8**** %3
%8 = load i8*, i8** %4
%9 = call i32 @dynarray_nochk_add(i8*** %7, i8* %8)
%10 = load i8***, i8**** %3
%11 = load i8**, i8*** %10
store i8** %11, i8*** %5
%12 = load i8**, i8*** %5
%13 = call i32 @dynarray_nochk_count(i8** %12)
%14 = sub nsw i32 %13, 1
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %26
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = mul i64 %22, 8
%24 = trunc i64 %23 to i32
%25 = call i32 @memmove(i8** %19, i8** %20, i32 %24)
br label %26
26: ; preds = %17, %2
%27 = load i8*, i8** %4
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
store i8* %27, i8** %29
ret void
}

LLVM IR (-O2):
define void @dynarray_nochk_prepend(i8*** %0, i8* %1) {
%3 = tail call i32 @dynarray_nochk_add(i8*** %0, i8* %1)
%4 = load i8**, i8*** %0
%5 = tail call i32 @dynarray_nochk_count(i8** %4)
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %4, i64 1
%9 = shl i32 %5, 3
%10 = add i32 %9, -8
%11 = tail call i32 @memmove(i8** %8, i8** %4, i32 %10)
br label %12
12: ; preds = %7, %2
store i8* %1, i8** %4
ret void
}