#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*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ gg_message_text_to_html_110_buff(char *, char const *,
                                                    int /*<<< orphan*/);
char *malloc(size_t);
char *gg_message_text_to_html_110(const char *text, ssize_t text_len) {
  size_t dst_len;
  char *dst;
  dst_len = gg_message_text_to_html_110_buff(NULL, text, text_len) + 1;
  dst = malloc(dst_len);
  if (!dst)
    return NULL;
  gg_message_text_to_html_110_buff(dst, text, text_len);
  return dst;
}


x86 assembly (clang, -O0):
<gg_message_text_to_html_110>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
call   1040 <gg_message_text_to_html_110_buff@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116d <gg_message_text_to_html_110+0x4d>
movq   $0x0,-0x8(%rbp)
jmp    1185 <gg_message_text_to_html_110+0x65>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <gg_message_text_to_html_110_buff@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gg_message_text_to_html_110>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1040 <gg_message_text_to_html_110_buff@plt>
add    $0x1,%eax
movslq %eax,%rdi
call   1030 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1158 <gg_message_text_to_html_110+0x38>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1040 <gg_message_text_to_html_110_buff@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @gg_message_text_to_html_110(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = call i32 @gg_message_text_to_html_110_buff(i8* null, i8* %8, i32 %9)
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
store i64 %12, i64* %6
%13 = load i64, i64* %6
%14 = call i8* @malloc(i64 %13)
store i8* %14, i8** %7
%15 = load i8*, i8** %7
%16 = icmp ne i8* %15, null
br i1 %16, label %18, label %17
17: ; preds = %2
store i8* null, i8** %3
br label %24
18: ; preds = %2
%19 = load i8*, i8** %7
%20 = load i8*, i8** %4
%21 = load i32, i32* %5
%22 = call i32 @gg_message_text_to_html_110_buff(i8* %19, i8* %20, i32 %21)
%23 = load i8*, i8** %7
store i8* %23, i8** %3
br label %24
24: ; preds = %18, %17
%25 = load i8*, i8** %3
ret i8* %25
}

LLVM IR (-O2):
define i8* @gg_message_text_to_html_110(i8* %0, i32 %1) {
%3 = tail call i32 @gg_message_text_to_html_110_buff(i8* null, i8* %0, i32 %1)
%4 = add nsw i32 %3, 1
%5 = sext i32 %4 to i64
%6 = tail call i8* @malloc(i64 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @gg_message_text_to_html_110_buff(i8* %6, i8* %0, i32 %1)
br label %10
10: ; preds = %2, %8
ret i8* %6
}