#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 */
struct lobject *lobject_call(struct lemon *, struct lobject *, int,
                             struct lobject **);
struct lobject *lobject_error_attribute(struct lemon *, char *,
                                        struct lobject *, struct lobject *);
struct lobject *lobject_get_attr(struct lemon *, struct lobject *,
                                 struct lobject *);
struct lobject *lobject_call_attr(struct lemon *lemon, struct lobject *self,
                                  struct lobject *name, int argc,
                                  struct lobject *argv[]) {
  struct lobject *value;
  value = lobject_get_attr(lemon, self, name);
  if (!value) {
    return lobject_error_attribute(lemon, "'%@' has no attribute %@", self,
                                   name);
  }
  return lobject_call(lemon, value, argc, argv);
}


x86 assembly (clang, -O0):
<lobject_call_attr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <lobject_get_attr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    118c <lobject_call_attr+0x5c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe82(%rip),%rsi
call   1050 <lobject_error_attribute@plt>
mov    %rax,-0x8(%rbp)
jmp    11a4 <lobject_call_attr+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x30(%rbp),%rcx
call   1040 <lobject_call@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lobject_call_attr>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r14
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1030 <lobject_get_attr@plt>
test   %rax,%rax
je     116a <lobject_call_attr+0x3a>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <lobject_call@plt>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
mov    %r12,%rcx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <lobject_error_attribute@plt>

LLVM IR (-O0):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
@.str = [25 x i8] c"'%@' has no attribute %@\00"
define %struct.lobject* @lobject_call_attr(%struct.lemon* %0, %struct.lobject* %1, %struct.lobject* %2, i32 %3, %struct.lobject** %4) {
%6 = alloca %struct.lobject*
%7 = alloca %struct.lemon*
%8 = alloca %struct.lobject*
%9 = alloca %struct.lobject*
%10 = alloca i32
%11 = alloca %struct.lobject**
%12 = alloca %struct.lobject*
store %struct.lemon* %0, %struct.lemon** %7
store %struct.lobject* %1, %struct.lobject** %8
store %struct.lobject* %2, %struct.lobject** %9
store i32 %3, i32* %10
store %struct.lobject** %4, %struct.lobject*** %11
%13 = load %struct.lemon*, %struct.lemon** %7
%14 = load %struct.lobject*, %struct.lobject** %8
%15 = load %struct.lobject*, %struct.lobject** %9
%16 = call %struct.lobject* @lobject_get_attr(%struct.lemon* %13, %struct.lobject* %14, %struct.lobject* %15)
store %struct.lobject* %16, %struct.lobject** %12
%17 = load %struct.lobject*, %struct.lobject** %12
%18 = icmp ne %struct.lobject* %17, null
br i1 %18, label %24, label %19
19: ; preds = %5
%20 = load %struct.lemon*, %struct.lemon** %7
%21 = load %struct.lobject*, %struct.lobject** %8
%22 = load %struct.lobject*, %struct.lobject** %9
%23 = call %struct.lobject* @lobject_error_attribute(%struct.lemon* %20, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), %struct.lobject* %21, %struct.lobject* %22)
store %struct.lobject* %23, %struct.lobject** %6
br label %30
24: ; preds = %5
%25 = load %struct.lemon*, %struct.lemon** %7
%26 = load %struct.lobject*, %struct.lobject** %12
%27 = load i32, i32* %10
%28 = load %struct.lobject**, %struct.lobject*** %11
%29 = call %struct.lobject* @lobject_call(%struct.lemon* %25, %struct.lobject* %26, i32 %27, %struct.lobject** %28)
store %struct.lobject* %29, %struct.lobject** %6
br label %30
30: ; preds = %24, %19
%31 = load %struct.lobject*, %struct.lobject** %6
ret %struct.lobject* %31
}

LLVM IR (-O2):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
@.str = [25 x i8] c"'%@' has no attribute %@\00"
define %struct.lobject* @lobject_call_attr(%struct.lemon* %0, %struct.lobject* %1, %struct.lobject* %2, i32 %3, %struct.lobject** %4) {
%6 = tail call %struct.lobject* @lobject_get_attr(%struct.lemon* %0, %struct.lobject* %1, %struct.lobject* %2)
%7 = icmp eq %struct.lobject* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call %struct.lobject* @lobject_error_attribute(%struct.lemon* %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), %struct.lobject* %1, %struct.lobject* %2)
br label %12
10: ; preds = %5
%11 = tail call %struct.lobject* @lobject_call(%struct.lemon* %0, %struct.lobject* %6, i32 %3, %struct.lobject** %4)
br label %12
12: ; preds = %10, %8
%13 = phi %struct.lobject* [ %11, %10 ], [ %9, %8 ]
ret %struct.lobject* %13
}