#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;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
struct rmsummary *json_to_rmsummary(struct jx *);
int /*<<< orphan*/ jx_delete(struct jx *);
struct jx *jx_parse_stream(int /*<<< orphan*/ *);
struct rmsummary *rmsummary_parse_next(FILE *stream) {
  struct jx *j = jx_parse_stream(stream);
  if (!j)
    return NULL;
  struct rmsummary *s = json_to_rmsummary(j);
  jx_delete(j);
  return s;
}


x86 assembly (clang, -O0):
<rmsummary_parse_next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <jx_parse_stream@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1161 <rmsummary_parse_next+0x31>
movq   $0x0,-0x8(%rbp)
jmp    117f <rmsummary_parse_next+0x4f>
mov    -0x18(%rbp),%rdi
call   1030 <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_next>:
push   %r14
push   %rbx
push   %rax
call   1040 <jx_parse_stream@plt>
test   %rax,%rax
je     1159 <rmsummary_parse_next+0x29>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <json_to_rmsummary@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <jx_delete@plt>
mov    %r14,%rax
jmp    115b <rmsummary_parse_next+0x2b>
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_next(i32* %0) {
%2 = alloca %struct.rmsummary*
%3 = alloca i32*
%4 = alloca %struct.jx*
%5 = alloca %struct.rmsummary*
store i32* %0, i32** %3
%6 = load i32*, i32** %3
%7 = call %struct.jx* @jx_parse_stream(i32* %6)
store %struct.jx* %7, %struct.jx** %4
%8 = load %struct.jx*, %struct.jx** %4
%9 = icmp ne %struct.jx* %8, null
br i1 %9, label %11, label %10
10: ; preds = %1
store %struct.rmsummary* null, %struct.rmsummary** %2
br label %17
11: ; preds = %1
%12 = load %struct.jx*, %struct.jx** %4
%13 = call %struct.rmsummary* @json_to_rmsummary(%struct.jx* %12)
store %struct.rmsummary* %13, %struct.rmsummary** %5
%14 = load %struct.jx*, %struct.jx** %4
%15 = call i32 @jx_delete(%struct.jx* %14)
%16 = load %struct.rmsummary*, %struct.rmsummary** %5
store %struct.rmsummary* %16, %struct.rmsummary** %2
br label %17
17: ; preds = %11, %10
%18 = load %struct.rmsummary*, %struct.rmsummary** %2
ret %struct.rmsummary* %18
}

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