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

/* Variables and functions */
char const *libqwaitclient_json_encode_character(char const *, size_t,
                                                 size_t *);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *realloc(char *, size_t);
scalar_t__ strchr(char *, char);
size_t strlen(char const *);
int libqwaitclient_json_compose_string(const char *restrict string,
                                       size_t string_length,
                                       char **restrict data,
                                       size_t *restrict length) {
  size_t i, require = 2, offset;
  char *old = NULL;
  for (i = 0; i < string_length; i++) {
    char c = string[i];
    if (strchr("\"\\\b\f\n\r\t", c))
      require += 2;
    else if ((' ' <= (unsigned char)c) && ((unsigned char)c < 128))
      require += 1;
    else
      require += strlen(
          libqwaitclient_json_encode_character(string, string_length, &i)),
          i--;
  }
  offset = *length;
  *length += require;
  old = *data;
  if (((*data = realloc(*data, (*length) * sizeof(char))) == NULL))
    goto fail;
  old = NULL;
  (*data)[offset++] = '\"';
  for (i = 0; i < string_length; i++) {
    char c = string[i];
    if (c == '\"')
      (*data)[offset++] = '\\', (*data)[offset++] = '\"';
    else if (c == '\\')
      (*data)[offset++] = '\\', (*data)[offset++] = '\\';
    else if (c == '\b')
      (*data)[offset++] = '\\', (*data)[offset++] = 'b';
    else if (c == '\f')
      (*data)[offset++] = '\\', (*data)[offset++] = 'f';
    else if (c == '\n')
      (*data)[offset++] = '\\', (*data)[offset++] = 'n';
    else if (c == '\r')
      (*data)[offset++] = '\\', (*data)[offset++] = 'r';
    else if (c == '\t')
      (*data)[offset++] = '\\', (*data)[offset++] = 't';
    else if ((' ' <= (unsigned char)c) && ((unsigned char)c < 128))
      (*data)[offset++] = c;
    else {
      const char *encoding =
          libqwaitclient_json_encode_character(string, string_length, &i);
      size_t len = strlen(encoding);
      memcpy(*data + offset, encoding, len * sizeof(char));
      offset += len;
      i--;
    }
  }
  (*data)[offset++] = '\"';
  return 0;
fail:
  if (old)
    *data = old;
  return -1;
}


x86 assembly (clang, -O0):
<libqwaitclient_json_compose_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movq   $0x2,-0x38(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1240 <libqwaitclient_json_compose_string+0xf0>
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x49(%rbp)
lea    0xe5d(%rip),%rdi
movsbl -0x49(%rbp),%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     11c7 <libqwaitclient_json_compose_string+0x77>
mov    -0x38(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x38(%rbp)
jmp    122a <libqwaitclient_json_compose_string+0xda>
movzbl -0x49(%rbp),%ecx
mov    $0x20,%eax
cmp    %ecx,%eax
jg     11f8 <libqwaitclient_json_compose_string+0xa8>
movzbl -0x49(%rbp),%eax
cmp    $0x80,%eax
jge    11f8 <libqwaitclient_json_compose_string+0xa8>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1225 <libqwaitclient_json_compose_string+0xd5>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1050 <libqwaitclient_json_encode_character@plt>
mov    %rax,%rdi
call   1030 <strlen@plt>
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    122a <libqwaitclient_json_compose_string+0xda>
jmp    122f <libqwaitclient_json_compose_string+0xdf>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1180 <libqwaitclient_json_compose_string+0x30>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rcx
mov    -0x28(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
shl    $0x0,%rsi
call   1070 <realloc@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1291 <libqwaitclient_json_compose_string+0x141>
jmp    15b7 <libqwaitclient_json_compose_string+0x467>
movq   $0x0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x22,(%rax,%rcx,1)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1591 <libqwaitclient_json_compose_string+0x441>
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x4a(%rbp)
movsbl -0x4a(%rbp),%eax
cmp    $0x22,%eax
jne    131d <libqwaitclient_json_compose_string+0x1cd>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x5c,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x22,(%rax,%rcx,1)
jmp    157b <libqwaitclient_json_compose_string+0x42b>
movsbl -0x4a(%rbp),%eax
cmp    $0x5c,%eax
jne    1363 <libqwaitclient_json_compose_string+0x213>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x5c,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x5c,(%rax,%rcx,1)
jmp    1576 <libqwaitclient_json_compose_string+0x426>
movsbl -0x4a(%rbp),%eax
cmp    $0x8,%eax
jne    13a9 <libqwaitclient_json_compose_string+0x259>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x5c,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x62,(%rax,%rcx,1)
jmp    1571 <libqwaitclient_json_compose_string+0x421>
movsbl -0x4a(%rbp),%eax
cmp    $0xc,%eax
jne    13ef <libqwaitclient_json_compose_string+0x29f>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x5c,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x66,(%rax,%rcx,1)
jmp    156c <libqwaitclient_json_compose_string+0x41c>
movsbl -0x4a(%rbp),%eax
cmp    $0xa,%eax
jne    1435 <libqwaitclient_json_compose_string+0x2e5>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x5c,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x6e,(%rax,%rcx,1)
jmp    1567 <libqwaitclient_json_compose_string+0x417>
movsbl -0x4a(%rbp),%eax
cmp    $0xd,%eax
jne    147b <libqwaitclient_json_compose_string+0x32b>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x5c,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x72,(%rax,%rcx,1)
jmp    1562 <libqwaitclient_json_compose_string+0x412>
movsbl -0x4a(%rbp),%eax
cmp    $0x9,%eax
jne    14c1 <libqwaitclient_json_compose_string+0x371>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x5c,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x74,(%rax,%rcx,1)
jmp    155d <libqwaitclient_json_compose_string+0x40d>
movzbl -0x4a(%rbp),%ecx
mov    $0x20,%eax
cmp    %ecx,%eax
jg     1502 <libqwaitclient_json_compose_string+0x3b2>
movzbl -0x4a(%rbp),%eax
cmp    $0x80,%eax
jge    1502 <libqwaitclient_json_compose_string+0x3b2>
mov    -0x4a(%rbp),%dl
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,-0x40(%rbp)
mov    %dl,(%rax,%rcx,1)
jmp    1558 <libqwaitclient_json_compose_string+0x408>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1050 <libqwaitclient_json_encode_character@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x60(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
add    -0x40(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
shl    $0x0,%rdx
call   1060 <memcpy@plt>
mov    -0x60(%rbp),%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    155d <libqwaitclient_json_compose_string+0x40d>
jmp    1562 <libqwaitclient_json_compose_string+0x412>
jmp    1567 <libqwaitclient_json_compose_string+0x417>
jmp    156c <libqwaitclient_json_compose_string+0x41c>
jmp    1571 <libqwaitclient_json_compose_string+0x421>
jmp    1576 <libqwaitclient_json_compose_string+0x426>
jmp    157b <libqwaitclient_json_compose_string+0x42b>
jmp    1580 <libqwaitclient_json_compose_string+0x430>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    12bb <libqwaitclient_json_compose_string+0x16b>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
movb   $0x22,(%rax,%rcx,1)
movl   $0x0,-0x4(%rbp)
jmp    15d4 <libqwaitclient_json_compose_string+0x484>
cmpq   $0x0,-0x48(%rbp)
je     15cd <libqwaitclient_json_compose_string+0x47d>
mov    -0x48(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libqwaitclient_json_compose_string>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r12
mov    %rdx,0x10(%rsp)
mov    %rsi,%r13
mov    %rdi,%r14
movq   $0x0,0x8(%rsp)
mov    $0x2,%r15d
test   %rsi,%rsi
je     11ea <libqwaitclient_json_compose_string+0x9a>
xor    %eax,%eax
lea    0xee3(%rip),%rbp
jmp    11a7 <libqwaitclient_json_compose_string+0x57>
nopl   0x0(%rax,%rax,1)
add    $0x2,%r15
mov    0x8(%rsp),%rax
add    $0x1,%rax
mov    %rax,0x8(%rsp)
cmp    %r13,%rax
jae    11ea <libqwaitclient_json_compose_string+0x9a>
movzbl (%r14,%rax,1),%ebx
movsbl %bl,%esi
mov    %rbp,%rdi
call   1040 <strchr@plt>
test   %rax,%rax
jne    1190 <libqwaitclient_json_compose_string+0x40>
cmp    $0x20,%bl
jl     11c7 <libqwaitclient_json_compose_string+0x77>
add    $0x1,%r15
jmp    1194 <libqwaitclient_json_compose_string+0x44>
mov    %r14,%rdi
mov    %r13,%rsi
lea    0x8(%rsp),%rdx
call   1050 <libqwaitclient_json_encode_character@plt>
mov    %rax,%rdi
call   1030 <strlen@plt>
add    %rax,%r15
addq   $0xffffffffffffffff,0x8(%rsp)
jmp    1194 <libqwaitclient_json_compose_string+0x44>
mov    (%r12),%rbp
add    %rbp,%r15
mov    %r15,(%r12)
mov    0x10(%rsp),%rbx
mov    (%rbx),%r12
mov    %r12,%rdi
mov    %r15,%rsi
call   1070 <realloc@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     1317 <libqwaitclient_json_compose_string+0x1c7>
mov    %rax,%r15
lea    0x1(%rbp),%r12
movb   $0x22,(%rax,%rbp,1)
movq   $0x0,0x8(%rsp)
test   %r13,%r13
je     130e <libqwaitclient_json_compose_string+0x1be>
xor    %eax,%eax
lea    0xdc6(%rip),%rsi
jmp    1266 <libqwaitclient_json_compose_string+0x116>
movw   $0x745c,(%r15,%r12,1)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x2,%r12
add    $0x1,%rax
mov    %rax,0x8(%rsp)
cmp    %r13,%rax
jae    130e <libqwaitclient_json_compose_string+0x1be>
movzbl (%r14,%rax,1),%ecx
lea    -0x8(%rcx),%edx
cmp    $0x1a,%dl
ja     1288 <libqwaitclient_json_compose_string+0x138>
movzbl %dl,%edx
movslq (%rsi,%rdx,4),%rdx
add    %rsi,%rdx
jmp    *%rdx
movw   $0x625c,(%r15,%r12,1)
jmp    1250 <libqwaitclient_json_compose_string+0x100>
cmp    $0x5c,%cl
jne    1296 <libqwaitclient_json_compose_string+0x146>
movw   $0x5c5c,(%r15,%r12,1)
jmp    1250 <libqwaitclient_json_compose_string+0x100>
cmp    $0x20,%cl
jl     12c9 <libqwaitclient_json_compose_string+0x179>
mov    %cl,(%r15,%r12,1)
add    $0x1,%r12
jmp    1254 <libqwaitclient_json_compose_string+0x104>
movw   $0x6e5c,(%r15,%r12,1)
jmp    1250 <libqwaitclient_json_compose_string+0x100>
movw   $0x665c,(%r15,%r12,1)
jmp    1250 <libqwaitclient_json_compose_string+0x100>
movw   $0x725c,(%r15,%r12,1)
jmp    1250 <libqwaitclient_json_compose_string+0x100>
movw   $0x225c,(%r15,%r12,1)
jmp    1250 <libqwaitclient_json_compose_string+0x100>
mov    %r14,%rdi
mov    %r13,%rsi
lea    0x8(%rsp),%rdx
call   1050 <libqwaitclient_json_encode_character@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
lea    (%r15,%r12,1),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1060 <memcpy@plt>
lea    0xd03(%rip),%rsi
add    %rbp,%r12
mov    0x8(%rsp),%rax
add    $0xffffffffffffffff,%rax
jmp    1254 <libqwaitclient_json_compose_string+0x104>
movb   $0x22,(%r15,%r12,1)
xor    %eax,%eax
jmp    1327 <libqwaitclient_json_compose_string+0x1d7>
mov    $0xffffffff,%eax
test   %r12,%r12
je     1327 <libqwaitclient_json_compose_string+0x1d7>
mov    %rbx,%rcx
mov    %r12,(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\22\\\08\0C\0A\0D\09\00"
define i32 @libqwaitclient_json_compose_string(i8* noalias %0, i64 %1, i8** noalias %2, i64* noalias %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8**
%9 = alloca i64*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i8
%15 = alloca i8
%16 = alloca i8*
%17 = alloca i64
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8** %2, i8*** %8
store i64* %3, i64** %9
store i64 2, i64* %11
store i8* null, i8** %13
store i64 0, i64* %10
br label %18
18: ; preds = %55, %4
%19 = load i64, i64* %10
%20 = load i64, i64* %7
%21 = icmp ult i64 %19, %20
br i1 %21, label %22, label %58
22: ; preds = %18
%23 = load i8*, i8** %6
%24 = load i64, i64* %10
%25 = getelementptr inbounds i8, i8* %23, i64 %24
%26 = load i8, i8* %25
store i8 %26, i8* %14
%27 = load i8, i8* %14
%28 = call i64 @strchr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %22
%31 = load i64, i64* %11
%32 = add i64 %31, 2
store i64 %32, i64* %11
br label %54
33: ; preds = %22
%34 = load i8, i8* %14
%35 = zext i8 %34 to i32
%36 = icmp sle i32 32, %35
br i1 %36, label %37, label %44
37: ; preds = %33
%38 = load i8, i8* %14
%39 = zext i8 %38 to i32
%40 = icmp slt i32 %39, 128
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = load i64, i64* %11
%43 = add i64 %42, 1
store i64 %43, i64* %11
br label %53
44: ; preds = %37, %33
%45 = load i8*, i8** %6
%46 = load i64, i64* %7
%47 = call i8* @libqwaitclient_json_encode_character(i8* %45, i64 %46, i64* %10)
%48 = call i64 @strlen(i8* %47)
%49 = load i64, i64* %11
%50 = add i64 %49, %48
store i64 %50, i64* %11
%51 = load i64, i64* %10
%52 = add i64 %51, -1
store i64 %52, i64* %10
br label %53
53: ; preds = %44, %41
br label %54
54: ; preds = %53, %30
br label %55
55: ; preds = %54
%56 = load i64, i64* %10
%57 = add i64 %56, 1
store i64 %57, i64* %10
br label %18
58: ; preds = %18
%59 = load i64*, i64** %9
%60 = load i64, i64* %59
store i64 %60, i64* %12
%61 = load i64, i64* %11
%62 = load i64*, i64** %9
%63 = load i64, i64* %62
%64 = add i64 %63, %61
store i64 %64, i64* %62
%65 = load i8**, i8*** %8
%66 = load i8*, i8** %65
store i8* %66, i8** %13
%67 = load i8**, i8*** %8
%68 = load i8*, i8** %67
%69 = load i64*, i64** %9
%70 = load i64, i64* %69
%71 = mul i64 %70, 1
%72 = call i8* @realloc(i8* %68, i64 %71)
%73 = load i8**, i8*** %8
store i8* %72, i8** %73
%74 = icmp eq i8* %72, null
br i1 %74, label %75, label %76
75: ; preds = %58
br label %246
76: ; preds = %58
store i8* null, i8** %13
%77 = load i8**, i8*** %8
%78 = load i8*, i8** %77
%79 = load i64, i64* %12
%80 = add i64 %79, 1
store i64 %80, i64* %12
%81 = getelementptr inbounds i8, i8* %78, i64 %79
store i8 34, i8* %81
store i64 0, i64* %10
br label %82
82: ; preds = %237, %76
%83 = load i64, i64* %10
%84 = load i64, i64* %7
%85 = icmp ult i64 %83, %84
br i1 %85, label %86, label %240
86: ; preds = %82
%87 = load i8*, i8** %6
%88 = load i64, i64* %10
%89 = getelementptr inbounds i8, i8* %87, i64 %88
%90 = load i8, i8* %89
store i8 %90, i8* %15
%91 = load i8, i8* %15
%92 = sext i8 %91 to i32
%93 = icmp eq i32 %92, 34
br i1 %93, label %94, label %105
94: ; preds = %86
%95 = load i8**, i8*** %8
%96 = load i8*, i8** %95
%97 = load i64, i64* %12
%98 = add i64 %97, 1
store i64 %98, i64* %12
%99 = getelementptr inbounds i8, i8* %96, i64 %97
store i8 92, i8* %99
%100 = load i8**, i8*** %8
%101 = load i8*, i8** %100
%102 = load i64, i64* %12
%103 = add i64 %102, 1
store i64 %103, i64* %12
%104 = getelementptr inbounds i8, i8* %101, i64 %102
store i8 34, i8* %104
br label %236
105: ; preds = %86
%106 = load i8, i8* %15
%107 = sext i8 %106 to i32
%108 = icmp eq i32 %107, 92
br i1 %108, label %109, label %120
109: ; preds = %105
%110 = load i8**, i8*** %8
%111 = load i8*, i8** %110
%112 = load i64, i64* %12
%113 = add i64 %112, 1
store i64 %113, i64* %12
%114 = getelementptr inbounds i8, i8* %111, i64 %112
store i8 92, i8* %114
%115 = load i8**, i8*** %8
%116 = load i8*, i8** %115
%117 = load i64, i64* %12
%118 = add i64 %117, 1
store i64 %118, i64* %12
%119 = getelementptr inbounds i8, i8* %116, i64 %117
store i8 92, i8* %119
br label %235
120: ; preds = %105
%121 = load i8, i8* %15
%122 = sext i8 %121 to i32
%123 = icmp eq i32 %122, 8
br i1 %123, label %124, label %135
124: ; preds = %120
%125 = load i8**, i8*** %8
%126 = load i8*, i8** %125
%127 = load i64, i64* %12
%128 = add i64 %127, 1
store i64 %128, i64* %12
%129 = getelementptr inbounds i8, i8* %126, i64 %127
store i8 92, i8* %129
%130 = load i8**, i8*** %8
%131 = load i8*, i8** %130
%132 = load i64, i64* %12
%133 = add i64 %132, 1
store i64 %133, i64* %12
%134 = getelementptr inbounds i8, i8* %131, i64 %132
store i8 98, i8* %134
br label %234
135: ; preds = %120
%136 = load i8, i8* %15
%137 = sext i8 %136 to i32
%138 = icmp eq i32 %137, 12
br i1 %138, label %139, label %150
139: ; preds = %135
%140 = load i8**, i8*** %8
%141 = load i8*, i8** %140
%142 = load i64, i64* %12
%143 = add i64 %142, 1
store i64 %143, i64* %12
%144 = getelementptr inbounds i8, i8* %141, i64 %142
store i8 92, i8* %144
%145 = load i8**, i8*** %8
%146 = load i8*, i8** %145
%147 = load i64, i64* %12
%148 = add i64 %147, 1
store i64 %148, i64* %12
%149 = getelementptr inbounds i8, i8* %146, i64 %147
store i8 102, i8* %149
br label %233
150: ; preds = %135
%151 = load i8, i8* %15
%152 = sext i8 %151 to i32
%153 = icmp eq i32 %152, 10
br i1 %153, label %154, label %165
154: ; preds = %150
%155 = load i8**, i8*** %8
%156 = load i8*, i8** %155
%157 = load i64, i64* %12
%158 = add i64 %157, 1
store i64 %158, i64* %12
%159 = getelementptr inbounds i8, i8* %156, i64 %157
store i8 92, i8* %159
%160 = load i8**, i8*** %8
%161 = load i8*, i8** %160
%162 = load i64, i64* %12
%163 = add i64 %162, 1
store i64 %163, i64* %12
%164 = getelementptr inbounds i8, i8* %161, i64 %162
store i8 110, i8* %164
br label %232
165: ; preds = %150
%166 = load i8, i8* %15
%167 = sext i8 %166 to i32
%168 = icmp eq i32 %167, 13
br i1 %168, label %169, label %180
169: ; preds = %165
%170 = load i8**, i8*** %8
%171 = load i8*, i8** %170
%172 = load i64, i64* %12
%173 = add i64 %172, 1
store i64 %173, i64* %12
%174 = getelementptr inbounds i8, i8* %171, i64 %172
store i8 92, i8* %174
%175 = load i8**, i8*** %8
%176 = load i8*, i8** %175
%177 = load i64, i64* %12
%178 = add i64 %177, 1
store i64 %178, i64* %12
%179 = getelementptr inbounds i8, i8* %176, i64 %177
store i8 114, i8* %179
br label %231
180: ; preds = %165
%181 = load i8, i8* %15
%182 = sext i8 %181 to i32
%183 = icmp eq i32 %182, 9
br i1 %183, label %184, label %195
184: ; preds = %180
%185 = load i8**, i8*** %8
%186 = load i8*, i8** %185
%187 = load i64, i64* %12
%188 = add i64 %187, 1
store i64 %188, i64* %12
%189 = getelementptr inbounds i8, i8* %186, i64 %187
store i8 92, i8* %189
%190 = load i8**, i8*** %8
%191 = load i8*, i8** %190
%192 = load i64, i64* %12
%193 = add i64 %192, 1
store i64 %193, i64* %12
%194 = getelementptr inbounds i8, i8* %191, i64 %192
store i8 116, i8* %194
br label %230
195: ; preds = %180
%196 = load i8, i8* %15
%197 = zext i8 %196 to i32
%198 = icmp sle i32 32, %197
br i1 %198, label %199, label %210
199: ; preds = %195
%200 = load i8, i8* %15
%201 = zext i8 %200 to i32
%202 = icmp slt i32 %201, 128
br i1 %202, label %203, label %210
203: ; preds = %199
%204 = load i8, i8* %15
%205 = load i8**, i8*** %8
%206 = load i8*, i8** %205
%207 = load i64, i64* %12
%208 = add i64 %207, 1
store i64 %208, i64* %12
%209 = getelementptr inbounds i8, i8* %206, i64 %207
store i8 %204, i8* %209
br label %229
210: ; preds = %199, %195
%211 = load i8*, i8** %6
%212 = load i64, i64* %7
%213 = call i8* @libqwaitclient_json_encode_character(i8* %211, i64 %212, i64* %10)
store i8* %213, i8** %16
%214 = load i8*, i8** %16
%215 = call i64 @strlen(i8* %214)
store i64 %215, i64* %17
%216 = load i8**, i8*** %8
%217 = load i8*, i8** %216
%218 = load i64, i64* %12
%219 = getelementptr inbounds i8, i8* %217, i64 %218
%220 = load i8*, i8** %16
%221 = load i64, i64* %17
%222 = mul i64 %221, 1
%223 = call i32 @memcpy(i8* %219, i8* %220, i64 %222)
%224 = load i64, i64* %17
%225 = load i64, i64* %12
%226 = add i64 %225, %224
store i64 %226, i64* %12
%227 = load i64, i64* %10
%228 = add i64 %227, -1
store i64 %228, i64* %10
br label %229
229: ; preds = %210, %203
br label %230
230: ; preds = %229, %184
br label %231
231: ; preds = %230, %169
br label %232
232: ; preds = %231, %154
br label %233
233: ; preds = %232, %139
br label %234
234: ; preds = %233, %124
br label %235
235: ; preds = %234, %109
br label %236
236: ; preds = %235, %94
br label %237
237: ; preds = %236
%238 = load i64, i64* %10
%239 = add i64 %238, 1
store i64 %239, i64* %10
br label %82
240: ; preds = %82
%241 = load i8**, i8*** %8
%242 = load i8*, i8** %241
%243 = load i64, i64* %12
%244 = add i64 %243, 1
store i64 %244, i64* %12
%245 = getelementptr inbounds i8, i8* %242, i64 %243
store i8 34, i8* %245
store i32 0, i32* %5
br label %253
246: ; preds = %75
%247 = load i8*, i8** %13
%248 = icmp ne i8* %247, null
br i1 %248, label %249, label %252
249: ; preds = %246
%250 = load i8*, i8** %13
%251 = load i8**, i8*** %8
store i8* %250, i8** %251
br label %252
252: ; preds = %249, %246
store i32 -1, i32* %5
br label %253
253: ; preds = %252, %240
%254 = load i32, i32* %5
ret i32 %254
}

LLVM IR (-O2):
@.str = [8 x i8] c"\22\\\08\0C\0A\0D\09\00"
define i32 @libqwaitclient_json_compose_string(i8* noalias %0, i64 %1, i8** noalias nocapture %2, i64* noalias nocapture %3) {
%5 = alloca i64
%6 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%7 = icmp eq i64 %1, 0
br i1 %7, label %32, label %8
8: ; preds = %4, %27
%9 = phi i64 [ %28, %27 ], [ 2, %4 ]
%10 = phi i64 [ %30, %27 ], [ 0, %4 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = call i64 @strchr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %8
%16 = add i64 %9, 2
br label %27
17: ; preds = %8
%18 = icmp sgt i8 %12, 31
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = add i64 %9, 1
br label %27
21: ; preds = %17
%22 = call i8* @libqwaitclient_json_encode_character(i8* %0, i64 %1, i64* %5)
%23 = call i64 @strlen(i8* dereferenceable(1) %22)
%24 = add i64 %23, %9
%25 = load i64, i64* %5
%26 = add i64 %25, -1
store i64 %26, i64* %5
br label %27
27: ; preds = %19, %21, %15
%28 = phi i64 [ %16, %15 ], [ %20, %19 ], [ %24, %21 ]
%29 = load i64, i64* %5
%30 = add i64 %29, 1
store i64 %30, i64* %5
%31 = icmp ult i64 %30, %1
br i1 %31, label %8, label %32
32: ; preds = %27, %4
%33 = phi i64 [ 2, %4 ], [ %28, %27 ]
%34 = load i64, i64* %3
%35 = add i64 %34, %33
store i64 %35, i64* %3
%36 = load i8*, i8** %2
%37 = call i8* @realloc(i8* %36, i64 %35)
store i8* %37, i8** %2
%38 = icmp eq i8* %37, null
br i1 %38, label %103, label %39
39: ; preds = %32
%40 = add i64 %34, 1
%41 = getelementptr inbounds i8, i8* %37, i64 %34
store i8 34, i8* %41
store i64 0, i64* %5
br i1 %7, label %100, label %42
42: ; preds = %39, %95
%43 = phi i64 [ %97, %95 ], [ %40, %39 ]
%44 = phi i64 [ %98, %95 ], [ 0, %39 ]
%45 = getelementptr inbounds i8, i8* %0, i64 %44
%46 = load i8, i8* %45
switch i8 %46, label %82 [
i8 34, label %47
i8 92, label %52
i8 8, label %57
i8 12, label %62
i8 10, label %67
i8 13, label %72
i8 9, label %77
]
47: ; preds = %42
%48 = add i64 %43, 1
%49 = getelementptr inbounds i8, i8* %37, i64 %43
store i8 92, i8* %49
%50 = add i64 %43, 2
%51 = getelementptr inbounds i8, i8* %37, i64 %48
store i8 34, i8* %51
br label %95
52: ; preds = %42
%53 = add i64 %43, 1
%54 = getelementptr inbounds i8, i8* %37, i64 %43
store i8 92, i8* %54
%55 = add i64 %43, 2
%56 = getelementptr inbounds i8, i8* %37, i64 %53
store i8 92, i8* %56
br label %95
57: ; preds = %42
%58 = add i64 %43, 1
%59 = getelementptr inbounds i8, i8* %37, i64 %43
store i8 92, i8* %59
%60 = add i64 %43, 2
%61 = getelementptr inbounds i8, i8* %37, i64 %58
store i8 98, i8* %61
br label %95
62: ; preds = %42
%63 = add i64 %43, 1
%64 = getelementptr inbounds i8, i8* %37, i64 %43
store i8 92, i8* %64
%65 = add i64 %43, 2
%66 = getelementptr inbounds i8, i8* %37, i64 %63
store i8 102, i8* %66
br label %95
67: ; preds = %42
%68 = add i64 %43, 1
%69 = getelementptr inbounds i8, i8* %37, i64 %43
store i8 92, i8* %69
%70 = add i64 %43, 2
%71 = getelementptr inbounds i8, i8* %37, i64 %68
store i8 110, i8* %71
br label %95
72: ; preds = %42
%73 = add i64 %43, 1
%74 = getelementptr inbounds i8, i8* %37, i64 %43
store i8 92, i8* %74
%75 = add i64 %43, 2
%76 = getelementptr inbounds i8, i8* %37, i64 %73
store i8 114, i8* %76
br label %95
77: ; preds = %42
%78 = add i64 %43, 1
%79 = getelementptr inbounds i8, i8* %37, i64 %43
store i8 92, i8* %79
%80 = add i64 %43, 2
%81 = getelementptr inbounds i8, i8* %37, i64 %78
store i8 116, i8* %81
br label %95
82: ; preds = %42
%83 = icmp sgt i8 %46, 31
br i1 %83, label %84, label %87
84: ; preds = %82
%85 = add i64 %43, 1
%86 = getelementptr inbounds i8, i8* %37, i64 %43
store i8 %46, i8* %86
br label %95
87: ; preds = %82
%88 = call i8* @libqwaitclient_json_encode_character(i8* %0, i64 %1, i64* %5)
%89 = call i64 @strlen(i8* dereferenceable(1) %88)
%90 = getelementptr inbounds i8, i8* %37, i64 %43
%91 = call i32 @memcpy(i8* %90, i8* %88, i64 %89)
%92 = add i64 %89, %43
%93 = load i64, i64* %5
%94 = add i64 %93, -1
br label %95
95: ; preds = %52, %62, %72, %84, %87, %77, %67, %57, %47
%96 = phi i64 [ %44, %47 ], [ %44, %52 ], [ %44, %57 ], [ %44, %62 ], [ %44, %67 ], [ %44, %72 ], [ %44, %77 ], [ %44, %84 ], [ %94, %87 ]
%97 = phi i64 [ %50, %47 ], [ %55, %52 ], [ %60, %57 ], [ %65, %62 ], [ %70, %67 ], [ %75, %72 ], [ %80, %77 ], [ %85, %84 ], [ %92, %87 ]
%98 = add i64 %96, 1
store i64 %98, i64* %5
%99 = icmp ult i64 %98, %1
br i1 %99, label %42, label %100
100: ; preds = %95, %39
%101 = phi i64 [ %40, %39 ], [ %97, %95 ]
%102 = getelementptr inbounds i8, i8* %37, i64 %101
store i8 34, i8* %102
br label %106
103: ; preds = %32
%104 = icmp eq i8* %36, null
br i1 %104, label %106, label %105
105: ; preds = %103
store i8* %36, i8** %2
br label %106
106: ; preds = %103, %105, %100
%107 = phi i32 [ 0, %100 ], [ -1, %105 ], [ -1, %103 ]
ret i32 %107
}