#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 *bear_json_escape_string(char const *);
int /*<<< orphan*/ free(void *);
char const **bear_json_escape_strings(char const **raw) {
  for (char const **it = raw; (raw) && (*it); ++it) {
    char const *const new = bear_json_escape_string(*it);
    if (new) {
      char const *const tmp = *it;
      *it = new;
      free((void *)tmp);
    }
  }
  return raw;
}


x86 assembly (clang, -O0):
<bear_json_escape_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x21(%rbp)
je     1152 <bear_json_escape_strings+0x32>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1162 <bear_json_escape_strings+0x42>
jmp    11b2 <bear_json_escape_strings+0x92>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <bear_json_escape_string@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     119c <bear_json_escape_strings+0x7c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
jmp    11a1 <bear_json_escape_strings+0x81>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <bear_json_escape_strings+0x14>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bear_json_escape_strings>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rdi,%rdi
je     1164 <bear_json_escape_strings+0x44>
mov    (%r14),%rdi
test   %rdi,%rdi
je     1164 <bear_json_escape_strings+0x44>
mov    %r14,%rbx
jmp    114d <bear_json_escape_strings+0x2d>
nopl   0x0(%rax)
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     1164 <bear_json_escape_strings+0x44>
call   1040 <bear_json_escape_string@plt>
test   %rax,%rax
je     1140 <bear_json_escape_strings+0x20>
mov    (%rbx),%rdi
mov    %rax,(%rbx)
call   1030 <free@plt>
jmp    1140 <bear_json_escape_strings+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8** @bear_json_escape_strings(i8** %0) {
%2 = alloca i8**
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8*
store i8** %0, i8*** %2
%6 = load i8**, i8*** %2
store i8** %6, i8*** %3
br label %7
7: ; preds = %30, %1
%8 = load i8**, i8*** %2
%9 = icmp ne i8** %8, null
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i8**, i8*** %3
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br label %14
14: ; preds = %10, %7
%15 = phi i1 [ false, %7 ], [ %13, %10 ]
br i1 %15, label %16, label %33
16: ; preds = %14
%17 = load i8**, i8*** %3
%18 = load i8*, i8** %17
%19 = call i8* @bear_json_escape_string(i8* %18)
store i8* %19, i8** %4
%20 = load i8*, i8** %4
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %29
22: ; preds = %16
%23 = load i8**, i8*** %3
%24 = load i8*, i8** %23
store i8* %24, i8** %5
%25 = load i8*, i8** %4
%26 = load i8**, i8*** %3
store i8* %25, i8** %26
%27 = load i8*, i8** %5
%28 = call i32 @free(i8* %27)
br label %29
29: ; preds = %22, %16
br label %30
30: ; preds = %29
%31 = load i8**, i8*** %3
%32 = getelementptr inbounds i8*, i8** %31, i32 1
store i8** %32, i8*** %3
br label %7
33: ; preds = %14
%34 = load i8**, i8*** %2
ret i8** %34
}

LLVM IR (-O2):
define i8** @bear_json_escape_strings(i8** returned %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %15, %3, %1
ret i8** %0
7: ; preds = %3, %15
%8 = phi i8* [ %17, %15 ], [ %4, %3 ]
%9 = phi i8** [ %16, %15 ], [ %0, %3 ]
%10 = tail call i8* @bear_json_escape_string(i8* %8)
%11 = icmp eq i8* %10, null
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = load i8*, i8** %9
store i8* %10, i8** %9
%14 = tail call i32 @free(i8* %13)
br label %15
15: ; preds = %12, %7
%16 = getelementptr inbounds i8*, i8** %9, i64 1
%17 = load i8*, i8** %16
%18 = icmp eq i8* %17, null
br i1 %18, label %6, label %7
}