#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;
};

/* Variables and functions */
int /*<<< orphan*/ szl_as_str(struct szl_interp *, struct szl_obj *, char **,
                              size_t *);
int szl_str_append_str(struct szl_interp *, struct szl_obj *, char *, size_t);
__attribute__((nonnull(1, 2, 3))) int szl_str_append(struct szl_interp *interp,
                                                     struct szl_obj *dest,
                                                     struct szl_obj *src) {
  char *buf;
  size_t len;
  if (!szl_as_str(interp, src, &buf, &len))
    return 0;
  return szl_str_append_str(interp, dest, buf, len);
}


x86 assembly (clang, -O0):
<szl_str_append>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1030 <szl_as_str@plt>
cmp    $0x0,%eax
jne    115e <szl_str_append+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1176 <szl_str_append+0x56>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1040 <szl_str_append_str@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<szl_str_append>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x10(%rsp),%rax
lea    0x8(%rsp),%rcx
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <szl_as_str@plt>
test   %eax,%eax
je     115d <szl_str_append+0x3d>
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <szl_str_append_str@plt>
jmp    115f <szl_str_append+0x3f>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.szl_interp = type { i32 }
%struct.szl_obj = type { i32 }
define i32 @szl_str_append(%struct.szl_interp* %0, %struct.szl_obj* %1, %struct.szl_obj* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = bitcast i8** %4 to i8*
%7 = bitcast i64* %5 to i8*
%8 = call i32 @szl_as_str(%struct.szl_interp* %0, %struct.szl_obj* %2, i8** %4, i64* %5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i64, i64* %5
%13 = call i32 @szl_str_append_str(%struct.szl_interp* %0, %struct.szl_obj* %1, i8* %11, i64 %12)
br label %14
14: ; preds = %3, %10
%15 = phi i32 [ %13, %10 ], [ 0, %3 ]
ret i32 %15
}