#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 uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
scalar_t__ malloc(int);
void something_about_strings_latent(const uint16_t *utf16String,
                                    size_t utf16StringLen,
                                    uint8_t **utf8StringOut,
                                    size_t *utf8StringLenOut) {
  if (!utf16String || utf16StringLen < 0) {
    *utf8StringOut = NULL;
    return;
  }
  if (utf16StringLen == 0) {
    *utf8StringOut = (uint8_t *)malloc(1);
    **utf8StringOut = '\0';
    *utf8StringLenOut = 0;
    return;
  }
}


x86 assembly (clang, -O0):
<something_about_strings_latent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113e <something_about_strings_latent+0x2e>
cmpq   $0x0,-0x10(%rbp)
jae    114e <something_about_strings_latent+0x3e>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
jmp    1182 <something_about_strings_latent+0x72>
cmpq   $0x0,-0x10(%rbp)
jne    1182 <something_about_strings_latent+0x72>
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<something_about_strings_latent>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
test   %rdi,%rdi
je     113d <something_about_strings_latent+0x2d>
test   %rsi,%rsi
jne    1144 <something_about_strings_latent+0x34>
mov    %rcx,%r14
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
movb   $0x0,(%rax)
movq   $0x0,(%r14)
jmp    1144 <something_about_strings_latent+0x34>
movq   $0x0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @something_about_strings_latent(i32* readnone %0, i64 %1, i8** nocapture writeonly %2, i64* nocapture writeonly %3) {
%5 = icmp eq i32* %0, null
br i1 %5, label %6, label %7
6: ; preds = %4
store i8* null, i8** %2
br label %12
7: ; preds = %4
%8 = icmp eq i64 %1, 0
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = tail call i64 @malloc(i32 1)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %2
store i8 0, i8* %11
store i64 0, i64* %3
br label %12
12: ; preds = %6, %9, %7
ret void
}