#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 */
struct rmsummary {
  int dummy;
};
struct jx {
  int dummy;
};

/* Variables and functions */
struct rmsummary *json_to_rmsummary(struct jx *);
int /*<<< orphan*/ jx_delete(struct jx *);
struct jx *jx_parse_string(char const *);
struct rmsummary *rmsummary_parse_string(const char *str) {
  if (!str)
    return NULL;
  struct jx *j = jx_parse_string(str);
  if (!j)
    return NULL;
  struct rmsummary *s = json_to_rmsummary(j);
  jx_delete(j);
  return s;
}


x86 assembly (clang, -O0):
<rmsummary_parse_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <rmsummary_parse_string+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1197 <rmsummary_parse_string+0x67>
mov    -0x10(%rbp),%rdi
call   1030 <jx_parse_string@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1179 <rmsummary_parse_string+0x49>
movq   $0x0,-0x8(%rbp)
jmp    1197 <rmsummary_parse_string+0x67>
mov    -0x18(%rbp),%rdi
call   1040 <json_to_rmsummary@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <jx_delete@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rmsummary_parse_string>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115e <rmsummary_parse_string+0x2e>
call   1030 <jx_parse_string@plt>
test   %rax,%rax
je     115e <rmsummary_parse_string+0x2e>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <json_to_rmsummary@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <jx_delete@plt>
mov    %r14,%rax
jmp    1160 <rmsummary_parse_string+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.rmsummary = type { i32 }
%struct.jx = type { i32 }
define %struct.rmsummary* @rmsummary_parse_string(i8* %0) {
%2 = alloca %struct.rmsummary*
%3 = alloca i8*
%4 = alloca %struct.jx*
%5 = alloca %struct.rmsummary*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %1
store %struct.rmsummary* null, %struct.rmsummary** %2
br label %21
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call %struct.jx* @jx_parse_string(i8* %10)
store %struct.jx* %11, %struct.jx** %4
%12 = load %struct.jx*, %struct.jx** %4
%13 = icmp ne %struct.jx* %12, null
br i1 %13, label %15, label %14
14: ; preds = %9
store %struct.rmsummary* null, %struct.rmsummary** %2
br label %21
15: ; preds = %9
%16 = load %struct.jx*, %struct.jx** %4
%17 = call %struct.rmsummary* @json_to_rmsummary(%struct.jx* %16)
store %struct.rmsummary* %17, %struct.rmsummary** %5
%18 = load %struct.jx*, %struct.jx** %4
%19 = call i32 @jx_delete(%struct.jx* %18)
%20 = load %struct.rmsummary*, %struct.rmsummary** %5
store %struct.rmsummary* %20, %struct.rmsummary** %2
br label %21
21: ; preds = %15, %14, %8
%22 = load %struct.rmsummary*, %struct.rmsummary** %2
ret %struct.rmsummary* %22
}

LLVM IR (-O2):
%struct.rmsummary = type { i32 }
%struct.jx = type { i32 }
define %struct.rmsummary* @rmsummary_parse_string(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call %struct.jx* @jx_parse_string(i8* %0)
%5 = icmp eq %struct.jx* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call %struct.rmsummary* @json_to_rmsummary(%struct.jx* %4)
%8 = tail call i32 @jx_delete(%struct.jx* %4)
br label %9
9: ; preds = %6, %3, %1
%10 = phi %struct.rmsummary* [ null, %1 ], [ %7, %6 ], [ null, %3 ]
ret %struct.rmsummary* %10
}