#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 int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(unsigned int);
unsigned int unicode_code_point_byte_requirement_utf8(int /*<<< orphan*/);
unsigned int
unicode_code_point_string_size_requirement_utf8(uint32_t *code_points,
                                                size_t code_points_length) {
  unsigned int ret = 0, tmp;
  for (size_t k = 0; k < code_points_length; k++) {
    tmp = unicode_code_point_byte_requirement_utf8(code_points[k]);
    assert(tmp);
    ret += tmp;
  }
  return ret;
}


x86 assembly (clang, -O0):
<unicode_code_point_string_size_requirement_utf8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1182 <unicode_code_point_string_size_requirement_utf8+0x62>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <unicode_code_point_byte_requirement_utf8@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113f <unicode_code_point_string_size_requirement_utf8+0x1f>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unicode_code_point_string_size_requirement_utf8>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rsi,%rsi
je     1161 <unicode_code_point_string_size_requirement_utf8+0x41>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
call   1030 <unicode_code_point_byte_requirement_utf8@plt>
mov    %eax,%r12d
mov    %eax,%edi
call   1040 <assert@plt>
add    %r12d,%ebp
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <unicode_code_point_string_size_requirement_utf8+0x20>
jmp    1163 <unicode_code_point_string_size_requirement_utf8+0x43>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @unicode_code_point_string_size_requirement_utf8(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
store i32 0, i32* %5
store i64 0, i64* %7
br label %8
8: ; preds = %23, %2
%9 = load i64, i64* %7
%10 = load i64, i64* %4
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = load i32*, i32** %3
%14 = load i64, i64* %7
%15 = getelementptr inbounds i32, i32* %13, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @unicode_code_point_byte_requirement_utf8(i32 %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = call i32 @assert(i32 %18)
%20 = load i32, i32* %6
%21 = load i32, i32* %5
%22 = add i32 %21, %20
store i32 %22, i32* %5
br label %23
23: ; preds = %12
%24 = load i64, i64* %7
%25 = add i64 %24, 1
store i64 %25, i64* %7
br label %8
26: ; preds = %8
%27 = load i32, i32* %5
ret i32 %27
}

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