#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 szl_obj {
  int dummy;
};
struct szl_interp {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int szl_list_append(struct szl_interp *, struct szl_obj *, struct szl_obj *);
struct szl_obj *szl_new_str(struct szl_interp *, char const *,
                            int /*<<< orphan*/ const);
int /*<<< orphan*/ szl_unref(struct szl_obj *);
__attribute__((nonnull(1, 2, 3))) int
szl_list_append_str(struct szl_interp *interp, struct szl_obj *list,
                    const char *buf, const ssize_t len) {
  struct szl_obj *item;
  int ret = 0;
  item = szl_new_str(interp, buf, len);
  if (item) {
    ret = szl_list_append(interp, list, item);
    szl_unref(item);
  }
  return ret;
}


x86 assembly (clang, -O0):
<szl_list_append_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <szl_new_str@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     118a <szl_list_append_str+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <szl_list_append@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <szl_unref@plt>
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<szl_list_append_str>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rsi
mov    %ecx,%edx
call   1030 <szl_new_str@plt>
test   %rax,%rax
je     116b <szl_list_append_str+0x3b>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <szl_list_append@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <szl_unref@plt>
mov    %ebp,%eax
jmp    116d <szl_list_append_str+0x3d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.szl_interp = type { i32 }
%struct.szl_obj = type { i32 }
define i32 @szl_list_append_str(%struct.szl_interp* %0, %struct.szl_obj* %1, i8* %2, i32 %3) {
%5 = alloca %struct.szl_interp*
%6 = alloca %struct.szl_obj*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca %struct.szl_obj*
%10 = alloca i32
store %struct.szl_interp* %0, %struct.szl_interp** %5
store %struct.szl_obj* %1, %struct.szl_obj** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %10
%11 = load %struct.szl_interp*, %struct.szl_interp** %5
%12 = load i8*, i8** %7
%13 = load i32, i32* %8
%14 = call %struct.szl_obj* @szl_new_str(%struct.szl_interp* %11, i8* %12, i32 %13)
store %struct.szl_obj* %14, %struct.szl_obj** %9
%15 = load %struct.szl_obj*, %struct.szl_obj** %9
%16 = icmp ne %struct.szl_obj* %15, null
br i1 %16, label %17, label %24
17: ; preds = %4
%18 = load %struct.szl_interp*, %struct.szl_interp** %5
%19 = load %struct.szl_obj*, %struct.szl_obj** %6
%20 = load %struct.szl_obj*, %struct.szl_obj** %9
%21 = call i32 @szl_list_append(%struct.szl_interp* %18, %struct.szl_obj* %19, %struct.szl_obj* %20)
store i32 %21, i32* %10
%22 = load %struct.szl_obj*, %struct.szl_obj** %9
%23 = call i32 @szl_unref(%struct.szl_obj* %22)
br label %24
24: ; preds = %17, %4
%25 = load i32, i32* %10
ret i32 %25
}

LLVM IR (-O2):
%struct.szl_interp = type { i32 }
%struct.szl_obj = type { i32 }
define i32 @szl_list_append_str(%struct.szl_interp* %0, %struct.szl_obj* %1, i8* %2, i32 %3) {
%5 = tail call %struct.szl_obj* @szl_new_str(%struct.szl_interp* %0, i8* %2, i32 %3)
%6 = icmp eq %struct.szl_obj* %5, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i32 @szl_list_append(%struct.szl_interp* %0, %struct.szl_obj* %1, %struct.szl_obj* %5)
%9 = tail call i32 @szl_unref(%struct.szl_obj* %5)
br label %10
10: ; preds = %7, %4
%11 = phi i32 [ %8, %7 ], [ 0, %4 ]
ret i32 %11
}