#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 binary_exponential_buffer {
  int dummy;
};

/* Variables and functions */
scalar_t__ binary_exponential_buffer_data(struct binary_exponential_buffer *);
int /*<<< orphan*/
binary_exponential_buffer_increment(struct binary_exponential_buffer *, int);
int binary_exponential_buffer_size(struct binary_exponential_buffer *);
void add_char_ptr_to_list(void *ptr, struct binary_exponential_buffer *b) {
  binary_exponential_buffer_increment(b, 1);
  ((unsigned char **)binary_exponential_buffer_data(
      b))[binary_exponential_buffer_size(b) - 1] = (unsigned char *)ptr;
}


x86 assembly (clang, -O0):
<add_char_ptr_to_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <binary_exponential_buffer_increment@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <binary_exponential_buffer_data@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <binary_exponential_buffer_size@plt>
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_char_ptr_to_list>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    $0x1,%esi
call   1030 <binary_exponential_buffer_increment@plt>
mov    %rbx,%rdi
call   1050 <binary_exponential_buffer_data@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1040 <binary_exponential_buffer_size@plt>
cltq
mov    %r14,-0x8(%r15,%rax,8)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.binary_exponential_buffer = type { i32 }
define void @add_char_ptr_to_list(i8* %0, %struct.binary_exponential_buffer* %1) {
%3 = alloca i8*
%4 = alloca %struct.binary_exponential_buffer*
store i8* %0, i8** %3
store %struct.binary_exponential_buffer* %1, %struct.binary_exponential_buffer** %4
%5 = load %struct.binary_exponential_buffer*, %struct.binary_exponential_buffer** %4
%6 = call i32 @binary_exponential_buffer_increment(%struct.binary_exponential_buffer* %5, i32 1)
%7 = load i8*, i8** %3
%8 = load %struct.binary_exponential_buffer*, %struct.binary_exponential_buffer** %4
%9 = call i64 @binary_exponential_buffer_data(%struct.binary_exponential_buffer* %8)
%10 = inttoptr i64 %9 to i8**
%11 = load %struct.binary_exponential_buffer*, %struct.binary_exponential_buffer** %4
%12 = call i32 @binary_exponential_buffer_size(%struct.binary_exponential_buffer* %11)
%13 = sub nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %10, i64 %14
store i8* %7, i8** %15
ret void
}

LLVM IR (-O2):
%struct.binary_exponential_buffer = type { i32 }
define void @add_char_ptr_to_list(i8* %0, %struct.binary_exponential_buffer* %1) {
%3 = tail call i32 @binary_exponential_buffer_increment(%struct.binary_exponential_buffer* %1, i32 1)
%4 = tail call i64 @binary_exponential_buffer_data(%struct.binary_exponential_buffer* %1)
%5 = inttoptr i64 %4 to i8**
%6 = tail call i32 @binary_exponential_buffer_size(%struct.binary_exponential_buffer* %1)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8*, i8** %5, i64 %8
store i8* %0, i8** %9
ret void
}