#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 char uint32_t;

/* Variables and functions */
char *base64_decode(char *, size_t *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ memcpy(char *, char *, int);
char *unicode_read_string_utf16be(char *, size_t, size_t *);
void unicode_parse_base64_to_code_points(char *string, uint32_t *code_points,
                                         size_t *code_points_length_ptr) {
  size_t data_length, utf16_code_points_length;
  uint32_t *utf16_code_points;
  char *data;
  data = base64_decode(string, &data_length);
  utf16_code_points = unicode_read_string_utf16be((char *)data, data_length,
                                                  &utf16_code_points_length);
  memcpy(&code_points[*code_points_length_ptr], utf16_code_points,
         sizeof(uint32_t) * utf16_code_points_length);
  *code_points_length_ptr += utf16_code_points_length;
  free(utf16_code_points);
  free(data);
}


x86 assembly (clang, -O0):
<unicode_parse_base64_to_code_points>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <base64_decode@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <unicode_read_string_utf16be@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
add    (%rax),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edx
call   1050 <memcpy@plt>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unicode_parse_base64_to_code_points>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0x10(%rsp),%rsi
call   1060 <base64_decode@plt>
mov    %rax,%r15
mov    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rax,%rdi
call   1040 <unicode_read_string_utf16be@plt>
mov    %rax,%r12
add    (%r14),%rbx
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <memcpy@plt>
mov    0x8(%rsp),%rax
add    %rax,(%r14)
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @unicode_parse_base64_to_code_points(i8* %0, i8* %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64* %2, i64** %6
%11 = load i8*, i8** %4
%12 = call i8* @base64_decode(i8* %11, i64* %7)
store i8* %12, i8** %10
%13 = load i8*, i8** %10
%14 = load i64, i64* %7
%15 = call i8* @unicode_read_string_utf16be(i8* %13, i64 %14, i64* %8)
store i8* %15, i8** %9
%16 = load i8*, i8** %5
%17 = load i64*, i64** %6
%18 = load i64, i64* %17
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8*, i8** %9
%21 = load i64, i64* %8
%22 = mul i64 1, %21
%23 = trunc i64 %22 to i32
%24 = call i32 @memcpy(i8* %19, i8* %20, i32 %23)
%25 = load i64, i64* %8
%26 = load i64*, i64** %6
%27 = load i64, i64* %26
%28 = add i64 %27, %25
store i64 %28, i64* %26
%29 = load i8*, i8** %9
%30 = call i32 @free(i8* %29)
%31 = load i8*, i8** %10
%32 = call i32 @free(i8* %31)
ret void
}

LLVM IR (-O2):
define void @unicode_parse_base64_to_code_points(i8* %0, i8* %1, i64* nocapture %2) {
%4 = alloca i64
%5 = alloca i64
%6 = bitcast i64* %4 to i8*
%7 = bitcast i64* %5 to i8*
%8 = call i8* @base64_decode(i8* %0, i64* %4)
%9 = load i64, i64* %4
%10 = call i8* @unicode_read_string_utf16be(i8* %8, i64 %9, i64* %5)
%11 = load i64, i64* %2
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = load i64, i64* %5
%14 = trunc i64 %13 to i32
%15 = call i32 @memcpy(i8* %12, i8* %10, i32 %14)
%16 = load i64, i64* %5
%17 = load i64, i64* %2
%18 = add i64 %17, %16
store i64 %18, i64* %2
%19 = call i32 @free(i8* %10)
%20 = call i32 @free(i8* %8)
ret void
}