#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 lobject {
  int dummy;
};
struct lemon {
  int dummy;
};

/* Variables and functions */
scalar_t__ lobject_is_array(struct lemon *, struct lobject *);
struct lobject *lstring_join_array(struct lemon *, struct lobject *,
                                   struct lobject *);
struct lobject *lstring_join_iterable(struct lemon *, struct lobject *,
                                      struct lobject *);
struct lobject *lstring_join(struct lemon *lemon, struct lobject *self,
                             int argc, struct lobject *argv[]) {
  if (lobject_is_array(lemon, argv[0])) {
    return lstring_join_array(lemon, self, argv[0]);
  }
  return lstring_join_iterable(lemon, self, argv[0]);
}


x86 assembly (clang, -O0):
<lstring_join>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
call   1030 <lobject_is_array@plt>
cmp    $0x0,%rax
je     117e <lstring_join+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    (%rax),%rdx
call   1050 <lstring_join_array@plt>
mov    %rax,-0x8(%rbp)
jmp    1196 <lstring_join+0x66>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    (%rax),%rdx
call   1040 <lstring_join_iterable@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lstring_join>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rcx),%rsi
call   1030 <lobject_is_array@plt>
mov    (%rbx),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
test   %rax,%rax
je     115e <lstring_join+0x2e>
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <lstring_join_array@plt>
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <lstring_join_iterable@plt>

LLVM IR (-O0):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
define %struct.lobject* @lstring_join(%struct.lemon* %0, %struct.lobject* %1, i32 %2, %struct.lobject** %3) {
%5 = alloca %struct.lobject*
%6 = alloca %struct.lemon*
%7 = alloca %struct.lobject*
%8 = alloca i32
%9 = alloca %struct.lobject**
store %struct.lemon* %0, %struct.lemon** %6
store %struct.lobject* %1, %struct.lobject** %7
store i32 %2, i32* %8
store %struct.lobject** %3, %struct.lobject*** %9
%10 = load %struct.lemon*, %struct.lemon** %6
%11 = load %struct.lobject**, %struct.lobject*** %9
%12 = getelementptr inbounds %struct.lobject*, %struct.lobject** %11, i64 0
%13 = load %struct.lobject*, %struct.lobject** %12
%14 = call i64 @lobject_is_array(%struct.lemon* %10, %struct.lobject* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %4
%17 = load %struct.lemon*, %struct.lemon** %6
%18 = load %struct.lobject*, %struct.lobject** %7
%19 = load %struct.lobject**, %struct.lobject*** %9
%20 = getelementptr inbounds %struct.lobject*, %struct.lobject** %19, i64 0
%21 = load %struct.lobject*, %struct.lobject** %20
%22 = call %struct.lobject* @lstring_join_array(%struct.lemon* %17, %struct.lobject* %18, %struct.lobject* %21)
store %struct.lobject* %22, %struct.lobject** %5
br label %30
23: ; preds = %4
%24 = load %struct.lemon*, %struct.lemon** %6
%25 = load %struct.lobject*, %struct.lobject** %7
%26 = load %struct.lobject**, %struct.lobject*** %9
%27 = getelementptr inbounds %struct.lobject*, %struct.lobject** %26, i64 0
%28 = load %struct.lobject*, %struct.lobject** %27
%29 = call %struct.lobject* @lstring_join_iterable(%struct.lemon* %24, %struct.lobject* %25, %struct.lobject* %28)
store %struct.lobject* %29, %struct.lobject** %5
br label %30
30: ; preds = %23, %16
%31 = load %struct.lobject*, %struct.lobject** %5
ret %struct.lobject* %31
}

LLVM IR (-O2):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
define %struct.lobject* @lstring_join(%struct.lemon* %0, %struct.lobject* %1, i32 %2, %struct.lobject** nocapture %3) {
%5 = load %struct.lobject*, %struct.lobject** %3
%6 = tail call i64 @lobject_is_array(%struct.lemon* %0, %struct.lobject* %5)
%7 = icmp eq i64 %6, 0
%8 = load %struct.lobject*, %struct.lobject** %3
br i1 %7, label %11, label %9
9: ; preds = %4
%10 = tail call %struct.lobject* @lstring_join_array(%struct.lemon* %0, %struct.lobject* %1, %struct.lobject* %8)
br label %13
11: ; preds = %4
%12 = tail call %struct.lobject* @lstring_join_iterable(%struct.lemon* %0, %struct.lobject* %1, %struct.lobject* %8)
br label %13
13: ; preds = %11, %9
%14 = phi %struct.lobject* [ %10, %9 ], [ %12, %11 ]
ret %struct.lobject* %14
}