#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 */
typedef unsigned char *zl;
typedef scalar_t__ uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
unsigned char *__ziplistInsert(unsigned char *, unsigned char *,
                               unsigned char *, unsigned int);
unsigned char *ziplistPush(unsigned char *zl, unsigned char *s,
                           unsigned int slen, int where) {
  unsigned char *p;
  p = (where == 0) ? ((zl) + (sizeof(uint32_t) * 2 + sizeof(uint16_t)))
                   : ((zl) + ((*((uint32_t *)(zl)))) - 1);
  return __ziplistInsert(zl, p, s, slen);
}


x86 assembly (clang, -O0):
<ziplistPush>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1141 <ziplistPush+0x31>
mov    -0x8(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x28(%rbp)
jmp    1154 <ziplistPush+0x44>
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    (%rcx),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <__ziplistInsert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ziplistPush>:
mov    %ecx,%eax
mov    %edx,%ecx
mov    %rsi,%rdx
test   %eax,%eax
je     112b <ziplistPush+0x1b>
mov    (%rdi),%rax
lea    (%rdi,%rax,1),%rsi
add    $0xffffffffffffffff,%rsi
jmp    1030 <__ziplistInsert@plt>
lea    0x14(%rdi),%rsi
jmp    1030 <__ziplistInsert@plt>

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

LLVM IR (-O2):
define i8* @ziplistPush(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = getelementptr inbounds i8, i8* %0, i64 20
br label %13
8: ; preds = %4
%9 = bitcast i8* %0 to i64*
%10 = load i64, i64* %9
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = getelementptr inbounds i8, i8* %11, i64 -1
br label %13
13: ; preds = %8, %6
%14 = phi i8* [ %7, %6 ], [ %12, %8 ]
%15 = tail call i8* @__ziplistInsert(i8* %0, i8* %14, i8* %1, i32 %2)
ret i8* %15
}