#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;
};
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
struct lobject *lstring_create(struct lemon *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, void *);
int /*<<< orphan*/ strlen(char *);
struct lobject *lcoroutine_string(struct lemon *lemon, struct lobject *self) {
  char buffer[256];
  snprintf(buffer, sizeof(buffer), "<coroutine %p>", (void *)self);
  buffer[sizeof(buffer) - 1] = '\0';
  return lstring_create(lemon, buffer, strlen(buffer));
}


x86 assembly (clang, -O0):
<lcoroutine_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x100,%esi
lea    0xea6(%rip),%rdx
call   1040 <snprintf@plt>
movb   $0x0,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x120(%rbp)
lea    -0x110(%rbp),%rax
mov    %rax,-0x118(%rbp)
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x120(%rbp),%rdi
mov    -0x118(%rbp),%rsi
mov    %eax,%edx
call   1050 <lstring_create@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcoroutine_string>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%rcx
mov    %rdi,%r14
lea    0xeb9(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1040 <snprintf@plt>
movb   $0x0,0xff(%rsp)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <lstring_create@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
@.str = [15 x i8] c"<coroutine %p>\00"
define %struct.lobject* @lcoroutine_string(%struct.lemon* %0, %struct.lobject* %1) {
%3 = alloca %struct.lemon*
%4 = alloca %struct.lobject*
%5 = alloca [256 x i8]
store %struct.lemon* %0, %struct.lemon** %3
store %struct.lobject* %1, %struct.lobject** %4
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = load %struct.lobject*, %struct.lobject** %4
%8 = bitcast %struct.lobject* %7 to i8*
%9 = call i32 @snprintf(i8* %6, i32 256, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 255
store i8 0, i8* %10
%11 = load %struct.lemon*, %struct.lemon** %3
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = call %struct.lobject* @lstring_create(%struct.lemon* %11, i8* %12, i32 %14)
ret %struct.lobject* %15
}

LLVM IR (-O2):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
@.str = [15 x i8] c"<coroutine %p>\00"
define %struct.lobject* @lcoroutine_string(%struct.lemon* %0, %struct.lobject* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = bitcast %struct.lobject* %1 to i8*
%6 = call i32 @snprintf(i8* %4, i32 256, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 255
store i8 0, i8* %7
%8 = call i32 @strlen(i8* %4)
%9 = call %struct.lobject* @lstring_create(%struct.lemon* %0, i8* %4, i32 %8)
ret %struct.lobject* %9
}