#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 tl_scheme_object {
  int dummy;
};
struct tl_compiler {
  int dummy;
};
struct tl_buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ tl_compiler_clear_errors(struct tl_compiler *);
int tl_expression_unserialize(struct tl_compiler *, int *, int, int, char *,
                              struct tl_scheme_object **);
int /*<<< orphan*/ tl_scheme_object_free(struct tl_scheme_object *);
int /*<<< orphan*/ tl_scheme_object_sbdump(struct tl_buffer *,
                                           struct tl_scheme_object *);
int /*<<< orphan*/ tl_scheme_object_sbdump_indent(struct tl_buffer *,
                                                  struct tl_scheme_object *,
                                                  int /*<<< orphan*/);
int tl_unserialize_rpc_function_result(struct tl_compiler *C,
                                       struct tl_buffer *b, int *input,
                                       int ilen, char *result_typename,
                                       int indentation) {
  struct tl_scheme_object *O = NULL;
  tl_compiler_clear_errors(C);
  int r =
      tl_expression_unserialize(C, input, ilen, 1 << 0, result_typename, &O);
  if (r >= 0 && O != NULL) {
    if (indentation) {
      tl_scheme_object_sbdump_indent(b, O, 0);
    } else {
      tl_scheme_object_sbdump(b, O);
    }
    tl_scheme_object_free(O);
  }
  return r;
}


x86 assembly (clang, -O0):
<tl_unserialize_rpc_function_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <tl_compiler_clear_errors@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%r8
mov    $0x1,%ecx
lea    -0x38(%rbp),%r9
call   1070 <tl_expression_unserialize@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jl     11e9 <tl_unserialize_rpc_function_result+0x99>
cmpq   $0x0,-0x38(%rbp)
je     11e9 <tl_unserialize_rpc_function_result+0x99>
cmpl   $0x0,-0x2c(%rbp)
je     11d3 <tl_unserialize_rpc_function_result+0x83>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
xor    %edx,%edx
call   1040 <tl_scheme_object_sbdump_indent@plt>
jmp    11e0 <tl_unserialize_rpc_function_result+0x90>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <tl_scheme_object_sbdump@plt>
mov    -0x38(%rbp),%rdi
call   1050 <tl_scheme_object_free@plt>
mov    -0x3c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tl_unserialize_rpc_function_result>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r15d
mov    %r8,%r12
mov    %ecx,%r13d
mov    %rdx,%rbp
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,(%rsp)
call   1030 <tl_compiler_clear_errors@plt>
mov    %rsp,%r9
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r13d,%edx
mov    $0x1,%ecx
mov    %r12,%r8
call   1070 <tl_expression_unserialize@plt>
mov    %eax,%ebp
test   %eax,%eax
js     11c1 <tl_unserialize_rpc_function_result+0x71>
mov    (%rsp),%rsi
test   %rsi,%rsi
je     11c1 <tl_unserialize_rpc_function_result+0x71>
mov    %r14,%rdi
test   %r15d,%r15d
je     11b3 <tl_unserialize_rpc_function_result+0x63>
xor    %edx,%edx
call   1040 <tl_scheme_object_sbdump_indent@plt>
jmp    11b8 <tl_unserialize_rpc_function_result+0x68>
call   1060 <tl_scheme_object_sbdump@plt>
mov    (%rsp),%rdi
call   1050 <tl_scheme_object_free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tl_compiler = type { i32 }
%struct.tl_buffer = type { i32 }
%struct.tl_scheme_object = type { i32 }
define i32 @tl_unserialize_rpc_function_result(%struct.tl_compiler* %0, %struct.tl_buffer* %1, i32* %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca %struct.tl_compiler*
%8 = alloca %struct.tl_buffer*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca %struct.tl_scheme_object*
%14 = alloca i32
store %struct.tl_compiler* %0, %struct.tl_compiler** %7
store %struct.tl_buffer* %1, %struct.tl_buffer** %8
store i32* %2, i32** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
store %struct.tl_scheme_object* null, %struct.tl_scheme_object** %13
%15 = load %struct.tl_compiler*, %struct.tl_compiler** %7
%16 = call i32 @tl_compiler_clear_errors(%struct.tl_compiler* %15)
%17 = load %struct.tl_compiler*, %struct.tl_compiler** %7
%18 = load i32*, i32** %9
%19 = load i32, i32* %10
%20 = load i8*, i8** %11
%21 = call i32 @tl_expression_unserialize(%struct.tl_compiler* %17, i32* %18, i32 %19, i32 1, i8* %20, %struct.tl_scheme_object** %13)
store i32 %21, i32* %14
%22 = load i32, i32* %14
%23 = icmp sge i32 %22, 0
br i1 %23, label %24, label %41
24: ; preds = %6
%25 = load %struct.tl_scheme_object*, %struct.tl_scheme_object** %13
%26 = icmp ne %struct.tl_scheme_object* %25, null
br i1 %26, label %27, label %41
27: ; preds = %24
%28 = load i32, i32* %12
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load %struct.tl_buffer*, %struct.tl_buffer** %8
%32 = load %struct.tl_scheme_object*, %struct.tl_scheme_object** %13
%33 = call i32 @tl_scheme_object_sbdump_indent(%struct.tl_buffer* %31, %struct.tl_scheme_object* %32, i32 0)
br label %38
34: ; preds = %27
%35 = load %struct.tl_buffer*, %struct.tl_buffer** %8
%36 = load %struct.tl_scheme_object*, %struct.tl_scheme_object** %13
%37 = call i32 @tl_scheme_object_sbdump(%struct.tl_buffer* %35, %struct.tl_scheme_object* %36)
br label %38
38: ; preds = %34, %30
%39 = load %struct.tl_scheme_object*, %struct.tl_scheme_object** %13
%40 = call i32 @tl_scheme_object_free(%struct.tl_scheme_object* %39)
br label %41
41: ; preds = %38, %24, %6
%42 = load i32, i32* %14
ret i32 %42
}

LLVM IR (-O2):
%struct.tl_compiler = type { i32 }
%struct.tl_buffer = type { i32 }
%struct.tl_scheme_object = type { i32 }
define i32 @tl_unserialize_rpc_function_result(%struct.tl_compiler* %0, %struct.tl_buffer* %1, i32* %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca %struct.tl_scheme_object*
%8 = bitcast %struct.tl_scheme_object** %7 to i8*
store %struct.tl_scheme_object* null, %struct.tl_scheme_object** %7
%9 = tail call i32 @tl_compiler_clear_errors(%struct.tl_compiler* %0)
%10 = call i32 @tl_expression_unserialize(%struct.tl_compiler* %0, i32* %2, i32 %3, i32 1, i8* %4, %struct.tl_scheme_object** %7)
%11 = icmp sgt i32 %10, -1
%12 = load %struct.tl_scheme_object*, %struct.tl_scheme_object** %7
%13 = icmp ne %struct.tl_scheme_object* %12, null
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %15, label %24
15: ; preds = %6
%16 = icmp eq i32 %5, 0
br i1 %16, label %19, label %17
17: ; preds = %15
%18 = call i32 @tl_scheme_object_sbdump_indent(%struct.tl_buffer* %1, %struct.tl_scheme_object* %12, i32 0)
br label %21
19: ; preds = %15
%20 = call i32 @tl_scheme_object_sbdump(%struct.tl_buffer* %1, %struct.tl_scheme_object* %12)
br label %21
21: ; preds = %19, %17
%22 = load %struct.tl_scheme_object*, %struct.tl_scheme_object** %7
%23 = call i32 @tl_scheme_object_free(%struct.tl_scheme_object* %22)
br label %24
24: ; preds = %21, %6
ret i32 %10
}